8.3MB

The following document contains information on Cypress products.
FUJITSU SEMICONDUCTOR
CONTROLLER MANUAL
CM44-10143-5E
F2MC-16LX
16-BIT MICROCONTROLLER
MB90340E Series
HARDWARE MANUAL
F2MC-16LX
16-BIT MICROCONTROLLER
MB90340E Series
HARDWARE MANUAL
For the information for microcontroller supports, see the following web site.
This web site includes the "Customer Design Review Supplement" which provides the latest cautions on
system development and the minimal requirements to be checked to prevent problems before the system
development.
http://edevice.fujitsu.com/micom/en-support/
FUJITSU SEMICONDUCTOR LIMITED
MB90340E Series
PREFACE
■ Objectives and Intended Reader
Thank you very much for your continued patronage of Fujitsu semiconductor products.
The MB90340E series has been developed as one of the general-purpose products of the F2MC-16LX
family, which is an original 16-bit single-chip microcontroller compatible with the Application Specific IC
(ASIC).
This manual describes the functions and operation of the MB90340E series for engineers who actually use
this semiconductor to design products. Please read this manual first.
Note : F2MC is the abbreviation of FUJITSU Flexible Microcontroller.
■ Trademark
The company names and brand names herein are the trademarks or registered trademarks of their respective
owners.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
i
MB90340E Series
■ Overall Structure of This Manual
This manual consists of the following 28 chapters and an appendix.
CHAPTER 1 OVERVIEW
This chapter describes the features and basic specifications of the MB90340E series.
CHAPTER 2 CPU
This chapter explains the setting and operation of the CPU.
CHAPTER 3 INTERRUPTS
This chapter describes the interrupts, the extended intelligent I/O service (EI2OS), and the exceptions.
CHAPTER 4 μDMAC
This chapter describes the functions and operations of the μDMAC. The μDMAC is the simplified
DMA having functions equivalent to the extended intelligent I/O service (EI2OS).
CHAPTER 5 DELAY INTERRUPT
This chapter describes the functions and operations of the delayed interrupt.
CHAPTER 6 CLOCK
This chapter describes the clock.
CHAPTER 7 RESET
This chapter describes the reset.
CHAPTER 8 LOW-POWER CONSUMPTION MODE
This chapter explains the low-power consumption mode.
CHAPTER 9 MEMORY ACCESS MODE
This chapter explains the functions and operations of the memory access mode.
CHAPTER 10 I/O PORTS
This chapter explains the functions of I/O ports.
CHAPTER 11 TIME-BASE TIMER
This chapter explains the function and operation of the time-base timer.
CHAPTER 12 WATCHDOG TIMER
This chapter explains the function and operation of the watchdog timer.
CHAPTER 13 16-BIT I/O TIMER
This chapter describes the functions and operations of the 16-bit I/O timer.
CHAPTER 14 16-BIT RELOAD TIMERS
This chapter describes the functions and operations of 16-bit reload timers.
CHAPTER 15 WATCH TIMER
This chapter explains the functions and operations of the watch timer.
CHAPTER 16 8/16-BIT PPG TIMER
This chapter explains the functions and operations of the 8/16-bit PPG timer.
CHAPTER 17 DTP/EXTERNAL INTERRUPT
This chapter explains the functions and operations of the DTP/external interrupt.
CHAPTER 18 8/10-BIT A/D CONVERTER
This chapter explains the functions and operations of the 8/10-bit A/D converter.
ii
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
MB90340E Series
CHAPTER 19 CLOCK MONITOR FUNCTION
This chapter explains the functions and operations of the clock monitor.
CHAPTER 20 LIN-UART
This chapter explains the functions and operations of LIN-UART.
CHAPTER 21 I2C INTERFACE (400 kHz)
This chapter explains the functions and operations of the high-speed I2C interface.
CHAPTER 22 CAN CONTROLLER
This chapter explains the functions and overview of the CAN controller.
CHAPTER 23 ADDRESS MATCH DETECTION FUNCTION
This chapter describes the functions and operations of the address match detection function.
CHAPTER 24 ROM MIRRORING FUNCTION SELECT MODULE
This chapter explains the functions and operations of the ROM mirroring function select module.
CHAPTER 25 FLASH MEMORY
This chapter explains the functions and operation of the 0.5M/1M/2M/4M-bit flash memory.
CHAPTER 26 EXAMPLES OF SERIAL PROGRAMMING CONNECTION FOR FLASH
MEMORY PRODUCTS
This chapter shows examples of serial programming connection using the AF220/AF210/AF120/AF110
flash microcontroller programmers by Yokogawa Digital Computer Corporation.
CHAPTER 27 ROM SECURITY FUNCTION
This chapter explains the ROM security function.
CHAPTER 28 CLOCK MODULATOR
This chapter explains the overview, operations, and register configuration of the clock modulator.
APPENDIX
The appendixes provide I/O maps, F2MC-16LX instructions, and other information.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
iii
MB90340E Series
•
•
•
•
•
•
•
The contents of this document are subject to change without notice.
Customers are advised to consult with sales representatives before ordering.
The information, such as descriptions of function and application circuit examples, in this document are presented solely for the
purpose of reference to show examples of operations and uses of FUJITSU SEMICONDUCTOR device; FUJITSU
SEMICONDUCTOR does not warrant proper operation of the device with respect to use based on such information. When you
develop equipment incorporating the device based on such information, you must assume any responsibility arising out of such
use of the information. FUJITSU SEMICONDUCTOR assumes no liability for any damages whatsoever arising out of the use of
the information.
Any information in this document, including descriptions of function and schematic diagrams, shall not be construed as license of
the use or exercise of any intellectual property right, such as patent right or copyright, or any other right of FUJITSU
SEMICONDUCTOR or any third party or does FUJITSU SEMICONDUCTOR warrant non-infringement of any third-party's
intellectual property right or other right by using such information. FUJITSU SEMICONDUCTOR assumes no liability for any
infringement of the intellectual property rights or other rights of third parties which would result from the use of information
contained herein.
The products described in this document are designed, developed and manufactured as contemplated for general use, including
without limitation, ordinary industrial use, general office use, personal use, and household use, but are not designed, developed
and manufactured as contemplated (1) for use accompanying fatal risks or dangers that, unless extremely high safety is secured,
could have a serious effect to the public, and could lead directly to death, personal injury, severe physical damage or other loss
(i.e., nuclear reaction control in nuclear facility, aircraft flight control, air traffic control, mass transport control, medical life
support system, missile launch control in weapon system), or (2) for use requiring extremely high reliability (i.e., submersible
repeater and artificial satellite).
Please note that FUJITSU SEMICONDUCTOR will not be liable against you and/or any third party for any claims or damages
arising in connection with above-mentioned uses of the products.
Any semiconductor devices have an inherent chance of failure. You must protect against injury, damage or loss from such
failures by incorporating safety design measures into your facility and equipment such as redundancy, fire protection, and
prevention of over-current levels and other abnormal operating conditions.
Exportation/release of any products described in this document may require necessary procedures in accordance with the
regulations of the Foreign Exchange and Foreign Trade Control Law of Japan and/or US export control laws.
The company names and brand names herein are the trademarks or registered trademarks of their respective owners.
Copyright ©2007-2010 FUJITSU SEMICONDUCTOR LIMITED All rights reserved.
iv
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
MB90340E Series
CONTENTS
CHAPTER 1
1.1
1.2
1.3
1.4
1.5
1.6
1.7
CHAPTER 2
2.1
2.2
2.3
2.4
2.5
2.6
2.6.1
2.6.2
2.6.3
2.6.4
2.6.5
2.6.6
2.7
2.8
2.9
CPU ............................................................................................................ 35
Overview of the CPU ........................................................................................................................
Memory Space ..................................................................................................................................
Linear Addressing .............................................................................................................................
Bank Addressing ...............................................................................................................................
Multibyte Data in Memory Space ......................................................................................................
Registers ...........................................................................................................................................
Accumulator (A) ...........................................................................................................................
User Stack Pointer (USP) and System Stack Pointer (SSP) .......................................................
Processor Status (PS) .................................................................................................................
Program Counter (PC) .................................................................................................................
Bank Registers (PCB, DTB, USB, SSB, ADB) ............................................................................
Direct Page Register (DPR) ........................................................................................................
Register Bank ...................................................................................................................................
Prefix Codes .....................................................................................................................................
Interrupt Disable Instructions ............................................................................................................
CHAPTER 3
3.1
3.2
3.3
3.4
3.5
3.5.1
3.5.2
3.5.3
3.6
3.7
3.7.1
3.8
3.9
OVERVIEW ................................................................................................... 1
Overview of the MB90340E Series ..................................................................................................... 2
Block Diagram of the MB90340E Series ............................................................................................ 8
Package Dimensions ........................................................................................................................ 10
Pin Assignment ................................................................................................................................. 12
Pin Function ...................................................................................................................................... 18
I/O Circuit Type ................................................................................................................................. 26
Precautions when Handling Devices ................................................................................................ 30
INTERRUPTS ............................................................................................. 61
Overview of Interrupts .......................................................................................................................
Interrupt Vector .................................................................................................................................
Interrupt Control Register (ICR00 to ICR15) .....................................................................................
Interrupt Flow ....................................................................................................................................
Hardware Interrupts ..........................................................................................................................
Hardware Interrupt Operation ......................................................................................................
Occurrence and Release of Hardware Interrupt ..........................................................................
Multiple Interrupts ........................................................................................................................
Software Interrupts ...........................................................................................................................
Extended Intelligent I/O Service (EI2OS) ..........................................................................................
Extended Intelligent I/O Service Descriptor (ISD) .......................................................................
Operation Flow of Extended Intelligent I/O Service (EI2OS) and its Application Procedure .............
Exceptions ........................................................................................................................................
CM44-10143-5E
36
37
40
41
43
44
47
48
50
53
54
55
56
57
60
FUJITSU SEMICONDUCTOR LIMITED
62
66
68
72
74
75
76
78
79
81
83
86
89
v
MB90340E Series
CHAPTER 4
4.1
4.2
4.2.1
4.2.2
4.2.3
4.2.4
4.3
4.3.1
4.3.2
4.3.3
4.3.4
4.4
4.5
Overview of μDMAC ......................................................................................................................... 92
Registers of μDMAC ......................................................................................................................... 93
DMA Descriptor Channel Specification Register (DCSR) ............................................................ 95
DMA Status Register (DSR) ........................................................................................................ 97
DMA Stop Status Register (DSSR) ............................................................................................. 98
DMA Enable Register (DER) ..................................................................................................... 100
DMA Descriptor Window Register (DDWR) .................................................................................... 101
Data Counter (DCT) .................................................................................................................. 102
I/O Register Address Pointer (IOA) ........................................................................................... 103
DMA Control Register (DMACS) ............................................................................................... 104
DMA Buffer Address Pointer (BAP) ........................................................................................... 106
Operations of μDMAC ..................................................................................................................... 107
Notes on Using μDMAC .................................................................................................................. 111
CHAPTER 5
5.1
5.2
5.3
5.3.1
5.4
5.5
5.6
8.1
8.2
8.3
8.4
vi
122
125
127
128
131
133
137
138
RESET ...................................................................................................... 139
Overview of Reset ..........................................................................................................................
Reset Source and Oscillation Stabilization Wait Times ..................................................................
External Reset Pin ..........................................................................................................................
Reset Operation ..............................................................................................................................
Reset Source Bits ...........................................................................................................................
Status of Pins by Reset ..................................................................................................................
CHAPTER 8
114
115
116
117
118
119
120
CLOCK ..................................................................................................... 121
Clock ...............................................................................................................................................
Block Diagram of the Clock Generation Block ................................................................................
Register in the Clock Generation Block .....................................................................................
Clock Selection Registers (CKSCR) ...............................................................................................
PLL/Sub Clock Control Register (PSCCR) .....................................................................................
Clock Mode .....................................................................................................................................
Oscillation Stabilization Wait Time ..................................................................................................
Connection of the Oscillator and External Clock ............................................................................
CHAPTER 7
7.1
7.2
7.3
7.4
7.5
7.6
DELAY INTERRUPT ................................................................................ 113
Overview of Delay Interrupt ............................................................................................................
Block Diagram of Delay Interrupt ....................................................................................................
Configuration of Delay Interrupt ......................................................................................................
Delay Interrupt Request Generation/Release Register (DIRR) .................................................
Operating Explanation of Delay Interrupt ........................................................................................
Precautions when Using Delay Interrupt ........................................................................................
Program Example that uses Delay Interrupt ...................................................................................
CHAPTER 6
6.1
6.2
6.2.1
6.3
6.4
6.5
6.6
6.7
μDMAC ....................................................................................................... 91
140
142
143
144
146
148
LOW-POWER CONSUMPTION MODE ................................................... 149
Overview of the Low-power Consumption Mode ............................................................................
Block Diagram of the Low-power Consumption Circuit ..................................................................
Low-power Consumption Mode Control Register (LPMCR) ...........................................................
CPU Intermittent Operation Mode ..................................................................................................
FUJITSU SEMICONDUCTOR LIMITED
150
153
155
158
CM44-10143-5E
MB90340E Series
8.5
8.5.1
8.5.2
8.5.3
8.5.4
8.6
8.7
8.8
Standby Mode .................................................................................................................................
Sleep Mode ...............................................................................................................................
Watch Mode ..............................................................................................................................
Time-base Timer Mode .............................................................................................................
Stop Mode .................................................................................................................................
State Transition of the Standby Mode ............................................................................................
Pin State in the Standby Mode and at the Time of Reset ...............................................................
Notes on Using the Low-power Consumption Mode ......................................................................
CHAPTER 9
159
161
163
165
167
170
171
176
MEMORY ACCESS MODE ...................................................................... 179
9.1
Overview of the Memory Access Mode ..........................................................................................
9.1.1
Mode Pin ...................................................................................................................................
9.1.2
Mode Data .................................................................................................................................
9.1.3
Memory Space by Bus Mode ....................................................................................................
9.2
External Memory Access (Bus Pin Control Circuit) ........................................................................
9.2.1
Register for External Memory Access (External Bus Pin Control Circuit) ..................................
9.2.2
Auto Ready Selection Register (ARSR) ....................................................................................
9.2.3
External Address Output Control Register (HACR) ...................................................................
9.2.4
Bus Control Signal Selection Register (ECSR) .........................................................................
9.3
External Memory Access Control Signal Operations ......................................................................
9.3.1
Ready Function .........................................................................................................................
9.3.2
Hold function ..............................................................................................................................
180
181
182
183
186
187
188
190
191
194
196
198
CHAPTER 10 I/O PORTS ................................................................................................ 199
10.1 I/O Ports ..........................................................................................................................................
10.2 Register List for I/O Ports ...............................................................................................................
10.2.1 Port Data Register (PDR0 to PDRA) .........................................................................................
10.2.2 Port Data Direction Register (DDR0 to DDRA) .........................................................................
10.2.3 Pull-up Control Register (PUCR0 to PUCR3) ............................................................................
10.2.4 Analog Data Input Enabling Register (ADER5 to ADER7) ........................................................
10.2.5 Input Level Selection Register (ILSR0, ILSR1) .........................................................................
200
201
202
204
207
208
209
CHAPTER 11 TIME-BASE TIMER .................................................................................. 211
11.1 Overview of the Time-base Timer ...................................................................................................
11.2 Block Diagram of the Time-base Timer ..........................................................................................
11.3 Configuration of the Time-base Timer ............................................................................................
11.3.1 Time-base Timer Control Register (TBTC) ................................................................................
11.4 Interrupt of the Time-base Timer ....................................................................................................
11.5 Operating Explanation of the Time-base Timer ..............................................................................
11.6 Notes on Using the Time-base Timer .............................................................................................
11.7 Programming Example of the Time-base Timer .............................................................................
212
214
216
217
219
220
224
225
CHAPTER 12 WATCHDOG TIMER ................................................................................ 227
12.1 Overview of the Watchdog Timer ...................................................................................................
12.2 Configuration of the Watchdog Timer .............................................................................................
12.3 Register of the Watchdog Timer .....................................................................................................
12.3.1 Watchdog Timer Control Register (WDTC) ...............................................................................
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
228
229
231
232
vii
MB90340E Series
12.4
12.5
12.6
Operating Explanation of the Watchdog Timer ............................................................................... 234
Notes on Using the Watchdog Timer .............................................................................................. 238
Programming Example of the Watchdog Timer .............................................................................. 240
CHAPTER 13 16-BIT I/O TIMER ..................................................................................... 241
13.1 Overview of 16-bit I/O Timer ...........................................................................................................
13.2 Block Diagram of 16-bit I/O Timer ..................................................................................................
13.2.1 Block Diagram of 16-bit Free-run Timer ....................................................................................
13.2.2 Block Diagrams of Input Capture Units .....................................................................................
13.2.3 Block Diagram of Output Compare Unit ....................................................................................
13.3 Configuration of 16-bit I/O Timer ....................................................................................................
13.3.1 Timer Control Status Register (Upper) (TCCSH0, TCCSH1) ....................................................
13.3.2 Timer Control Status Register (Lower) (TCCSL0, TCCSL1) .....................................................
13.3.3 Timer Data Register (TCDT0, TCDT1) ......................................................................................
13.3.4 Input Capture Control Status Registers (ICS) ...........................................................................
13.3.5 Input Capture Registers (IPCP0 to IPCP7) ...............................................................................
13.3.6 Input Capture Edge Registers (ICE01, ICE23, ICE45, ICE67) ..................................................
13.3.7 Output Compare Control Status Register (OCS) (Upper) .........................................................
13.3.8 Output Compare Control Status Register (OCS) (Lower) .........................................................
13.3.9 Output Compare Registers (OCCP0 to OCCP7) .......................................................................
13.4 Interrupts from 16-bit I/O Timer ......................................................................................................
13.5 Operations of 16-bit Free-run Timer ...............................................................................................
13.6 Input Capture Operations ...............................................................................................................
13.7 Output Compare Operations ...........................................................................................................
13.8 Notes on Using the 16-bit I/O Timer ...............................................................................................
13.9 Sample Programs for 16-bit I/O Timer ............................................................................................
242
244
246
247
250
252
254
255
258
259
261
263
267
270
272
274
276
279
281
284
285
CHAPTER 14 16-BIT RELOAD TIMERS ........................................................................ 289
14.1 Overview of 16-bit Reload Timers ..................................................................................................
14.2 Block Diagram of 16-bit Reload Timer ............................................................................................
14.3 Configuration of 16-bit Reload Timers ............................................................................................
14.3.1 Upper Byte of Timer Control Status Register (TMCSR:H) .........................................................
14.3.2 Lower Byte of Timer Control Status Register (TMCSR:L) .........................................................
14.3.3 16-bit Timer Register (TMR) ......................................................................................................
14.3.4 16-bit Reload Register (TMRLR) ...............................................................................................
14.4 Interrupts of 16-bit Reload Timers ..................................................................................................
14.5 Operations of 16-bit Reload Timers ................................................................................................
14.5.1 Operations in Internal Clock Mode ............................................................................................
14.5.2 Operations in Event Count Mode ..............................................................................................
14.6 Notes on Using 16-bit Reload Timers .............................................................................................
14.7 Sample Programs for 16-bit Reload Timers ...................................................................................
290
293
296
301
303
306
307
308
309
311
317
320
321
CHAPTER 15 WATCH TIMER ........................................................................................ 325
15.1 Overview of Watch Timer ...............................................................................................................
15.2 Block Diagram of Watch Timer .......................................................................................................
15.3 Configuration of Watch Timer .........................................................................................................
15.3.1 Watch Timer Control Register (WTC) ........................................................................................
viii
FUJITSU SEMICONDUCTOR LIMITED
326
328
330
331
CM44-10143-5E
MB90340E Series
15.4
15.5
15.6
Interrupt of Watch Timer ................................................................................................................. 333
Operating Explanation of Watch Timer ........................................................................................... 334
Example Program of Watch Timer .................................................................................................. 336
CHAPTER 16 8/16-BIT PPG TIMER ............................................................................... 339
16.1 Overview of 8/16-bit PPG Timer .....................................................................................................
16.2 Block Diagram of 8/16-bit PPG Timer .............................................................................................
16.2.1 Block Diagram of 8/16-bit PPG Timer 0 ....................................................................................
16.2.2 Block Diagram of 8/16-bit PPG Timer 1 ....................................................................................
16.3 Configuration of 8/16-bit PPG Timer ...............................................................................................
16.3.1 PPG0 Operation Mode Control Register (PPGC0) ....................................................................
16.3.2 PPG1 Operation Mode Control Register (PPGC1) ....................................................................
16.3.3 PPG0/1 Count Clock Selection Register (PPG01) ....................................................................
16.3.4 PPG Reload Registers (PRLL0/PRLH0, PRLL1/PRLH1) ..........................................................
16.4 Interrupts of 8/16-bit PPG Timer .....................................................................................................
16.5 Operating Explanation of 8/16-bit PPG Timer ................................................................................
16.5.1 8-bit PPG Output 2-channel Independent Operation Mode .......................................................
16.5.2 16-bit PPG Output Operation Mode ..........................................................................................
16.5.3 8+8-bit PPG Output Operation Mode ........................................................................................
16.6 Notes on Using 8/16-bit PPG Timer ...............................................................................................
340
343
344
347
350
353
355
357
359
361
362
363
365
368
371
CHAPTER 17 DTP/EXTERNAL INTERRUPT ................................................................. 373
17.1 Overview of DTP/External Interrupt ................................................................................................
17.2 Block Diagram of DTP/External Interrupt ........................................................................................
17.3 Configuration of DTP/External Interrupt ..........................................................................................
17.3.1 DTP/External Interrupt Source Register (EIRR0/EIRR1) ..........................................................
17.3.2 DTP/External Interrupt Enable Register (ENIR0/ENIR1) ...........................................................
17.3.3 Detection Level Setting Register (ELVR0/ELVR1) ....................................................................
17.3.4 External Interrupt Source Select Register (EISSR) ...................................................................
17.4 Explanation of Operation of DTP/External Interrupt .......................................................................
17.4.1 External Interrupt Function ........................................................................................................
17.4.2 DTP Function .............................................................................................................................
17.5 Notes on Using DTP/External Interrupt ..........................................................................................
17.6 Program Example of DTP/External Interrupt Function ...................................................................
CHAPTER 18
8/10-BIT A/D CONVERTER ................................................................... 401
18.1 Overview of 8/10-bit A/D Converter ................................................................................................
18.2 Block Diagram of 8/10-bit A/D Converter ........................................................................................
18.3 Configuration of 8/10-bit A/D Converter ..........................................................................................
18.3.1 A/D Control Status Register 1 (ADCS1) ....................................................................................
18.3.2 A/D Control Status Register 0 (ADCS0) ....................................................................................
18.3.3 A/D Data Registers 0/1 (ADCR0/ADCR1) .................................................................................
18.3.4 A/D Setting Register (ADSR0/ADSR1) ......................................................................................
18.3.5 Analog Input Enable Register (ADER5 to ADER7) ...................................................................
18.4 Interrupt of 8/10-bit A/D Converter ..................................................................................................
18.5 Operating Explanation of 8/10-bit A/D Converter ...........................................................................
18.5.1 Single Conversion Mode ...........................................................................................................
CM44-10143-5E
374
375
378
381
383
385
387
389
393
394
395
397
FUJITSU SEMICONDUCTOR LIMITED
402
404
407
410
414
416
417
421
423
424
425
ix
MB90340E Series
18.5.2 Continuous Conversion Mode ...................................................................................................
18.5.3 Stop Conversion Mode ..............................................................................................................
18.5.4 Conversion Operation with μDMAC or EI2OS Function .............................................................
18.5.5 A/D Conversion Data Protection Function .................................................................................
18.6 Notes on Using 8/10-bit A/D Converter ..........................................................................................
427
429
431
432
435
CHAPTER 19 CLOCK MONITOR FUNCTION ................................................................ 437
19.1 Overview of Clock Monitor Function ...............................................................................................
19.2 Block Diagram of Clock Monitor Function .......................................................................................
19.3 Configuration of Clock Monitor Function .........................................................................................
19.3.1 Clock output enable register (CLKR) .........................................................................................
19.4 Program Example of Clock Monitor Function .................................................................................
438
439
440
441
442
CHAPTER 20 LIN-UART ................................................................................................. 443
20.1 Overview of LIN-UART ...................................................................................................................
20.2 Configuration of LIN-UART .............................................................................................................
20.3 Pins of LIN-UART ...........................................................................................................................
20.4 Registers of LIN-UART ...................................................................................................................
20.4.1 Serial Control Register (SCR) ...................................................................................................
20.4.2 LIN-UART Serial Mode Register (SMR) ....................................................................................
20.4.3 Serial Status Register (SSR) .....................................................................................................
20.4.4 Reception Data Register / Transmit Data Register (RDR/TDR) ................................................
20.4.5 Extended Status Control Register (ESCR) ................................................................................
20.4.6 Extended Communication Control Register (ECCR) .................................................................
20.4.7 Baud Rate Generator Register 0, 1 (BGRn0/BGRn1) ...............................................................
20.5 Interrupts of LIN-UART ...................................................................................................................
20.5.1 Timing of Reception Interrupt Generation and Flag Set ............................................................
20.5.2 Timing of Transmit Interrupt Generation and Flag Set ..............................................................
20.6 Baud Rate of LIN-UART .................................................................................................................
20.6.1 Baud Rate Setting .....................................................................................................................
20.6.2 Reload Counter .........................................................................................................................
20.7 Operation of LIN-UART ..................................................................................................................
20.7.1 Operation of Asynchronous Mode (Operation Mode 0, 1) .........................................................
20.7.2 Operation of Synchronous Mode (Operating Mode 2) ...............................................................
20.7.3 Operation of LIN Function (Operating Mode 3) .........................................................................
20.7.4 Serial Pin Direct Access ............................................................................................................
20.7.5 Bidirectional Communication Function (Normal Mode) .............................................................
20.7.6 Master/Slave Mode Communication Function (Multiprocessor Mode) ......................................
20.7.7 LIN Communication Function ....................................................................................................
20.7.8 Example Flowchart of LIN-UART LIN Communication (Operating Mode 3) ..............................
20.8 Notes on Using LIN-UART ..............................................................................................................
x
FUJITSU SEMICONDUCTOR LIMITED
444
447
452
454
455
458
460
463
465
468
470
471
474
475
477
479
482
484
486
490
494
497
498
500
503
504
506
CM44-10143-5E
MB90340E Series
CHAPTER 21 I2C INTERFACE (400 kHz) ...................................................................... 513
21.1 Overview of I2C Interface (400 kHz) ...............................................................................................
21.2 Registers of I2C Interface ...............................................................................................................
21.2.1 Bus Status Register (IBSR0, IBSR1) .........................................................................................
21.2.2 Bus Control Register (IBCR0, IBCR1) .......................................................................................
21.2.3 10-Bit Slave Address Register (ITBAH0/ITBAH1, ITBAL0/ITBAL1) ..........................................
21.2.4 10-Bit Slave Address Mask Register (ITMK0, ITMK1) ..............................................................
21.2.5 7-Bit Slave Address Register (ISBA0, ISBA1) ...........................................................................
21.2.6 7-Bit Slave Address Mask Register (ISMK0, ISMK1) ................................................................
21.2.7 Data Register (IDAR0, IDAR1) ..................................................................................................
21.2.8 Clock Control Register (ICCR0, ICCR1) ....................................................................................
21.3 Operations of I2C Interface .............................................................................................................
21.4 Programming Flowcharts ................................................................................................................
514
516
518
522
530
531
533
534
535
536
539
542
CHAPTER 22 CAN CONTROLLER ................................................................................ 545
22.1 Features of CAN Controller ............................................................................................................
22.2 Block Diagram of CAN Controller ...................................................................................................
22.3 List of Overall Control Registers .....................................................................................................
22.4 Classifying the CAN Controller Registers .......................................................................................
22.4.1 Configuration of Control Status Register (CSR) ........................................................................
22.4.2 Function of Control Status Register (CSR) ................................................................................
22.4.3 Notes on Using Bus Operation Stop Bit (HALT = 1) ..................................................................
22.4.4 Last Event Indicator Register (LEIR) .........................................................................................
22.4.5 Receive and Transmit Error Counters (RTEC) ..........................................................................
22.4.6 Bit Timing Register (BTR) ..........................................................................................................
22.4.7 Prescaler Setting by Bit Timing Register (BTR) ........................................................................
22.4.8 Message Buffer Valid Register (BVALR) ...................................................................................
22.4.9 IDE register (IDER) ....................................................................................................................
22.4.10 Transmission Request Register (TREQR) ................................................................................
22.4.11 Transmission RTR Register (TRTRR) .......................................................................................
22.4.12 Remote Frame Receiving Wait Register (RFWTR) ...................................................................
22.4.13 Transmission Cancel Register (TCANR) ...................................................................................
22.4.14 Transmission Complete Register (TCR) ....................................................................................
22.4.15 Transmission Interrupt Enable Register (TIER) .........................................................................
22.4.16 Reception Complete Register (RCR) ........................................................................................
22.4.17 Remote Request Receiving Register (RRTRR) ........................................................................
22.4.18 Receive Overrun Register (ROVRR) .........................................................................................
22.4.19 Reception Interrupt Enable Register (RIER) .............................................................................
22.4.20 Acceptance Mask Select Register (AMSR) ...............................................................................
22.4.21 Acceptance Mask Registers 0, 1 (AMR0, AMR1) ......................................................................
22.4.22 Message Buffers ........................................................................................................................
22.4.23 ID Register x (x = 0 to 15) (IDR0 to IDR15) ...............................................................................
22.4.24 DLC Register x (x = 0 to 15) (DLCR0 to DLCR15) ....................................................................
22.4.25 Data Register x (x = 0 to 15) (DTR0 to DTR15) ........................................................................
22.5 Transmission of CAN Controller .....................................................................................................
22.6 Reception of CAN Controller ..........................................................................................................
22.7 Reception Flowchart of CAN Controller ..........................................................................................
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
546
547
548
556
557
559
563
564
567
568
569
571
572
573
574
575
576
577
578
579
580
581
582
583
585
587
589
591
592
594
596
599
xi
MB90340E Series
22.8
22.9
22.10
22.11
22.12
22.13
22.14
How to Use the CAN Controller ......................................................................................................
Procedure for Transmission by Message Buffer (x) .......................................................................
Procedure for Reception by Message Buffer (x) .............................................................................
Setting Configuration of Multi-level Message Buffer .......................................................................
Setting the Redirection of CAN1 RX/TX pin ...................................................................................
CAN Direct Mode Register (CDMR) ...............................................................................................
Precautions when Using CAN Controller ........................................................................................
600
602
604
606
608
609
610
CHAPTER 23 ADDRESS MATCH DETECTION FUNCTION ......................................... 613
23.1 Overview of Address Match Detection Function .............................................................................
23.2 Block Diagram of Address Match Detection Function ....................................................................
23.3 Configuration of Address Match Detection Function ......................................................................
23.3.1 Address Detection Control Register (PACSR0/PACSR1) .........................................................
23.3.2 Detection Address Setting Registers (PADR0 to PADR5) ........................................................
23.4 Explanation of Operation of Address Match Detection Function ....................................................
23.4.1 Example of Using Address Match Detection Function ..............................................................
23.5 Program Example of Address Match Detection Function ...............................................................
614
615
616
617
621
624
625
630
CHAPTER 24 ROM MIRRORING FUNCTION SELECT MODULE ................................ 633
24.1
24.2
Overview of ROM Mirroring Function Select Module ...................................................................... 634
ROM Mirroring Function Select Register (ROMM) ......................................................................... 636
CHAPTER 25 FLASH MEMORY ..................................................................................... 637
25.1 Outline of Flash Memory .................................................................................................................
25.2 Block Diagram of Flash Memory .....................................................................................................
25.3 Sector Configuration of Flash Memory ...........................................................................................
25.4 Flash Memory Control Status Register (FMCS) .............................................................................
25.5 Starting the Flash Memory Automatic Algorithm ............................................................................
25.6 Confirming the Automatic Algorithm Execution State .....................................................................
25.6.1 Data Polling Flag (DQ7) ............................................................................................................
25.6.2 Toggle Bit Flag (DQ6) ................................................................................................................
25.6.3 Timing Limit Exceeded Flag (DQ5) ...........................................................................................
25.6.4 Sector Erase Timer Flag (DQ3) .................................................................................................
25.7 Writing Data to and Erasing Data from Flash Memory ...................................................................
25.7.1 Setting Flash Memory to the Read/Reset State ........................................................................
25.7.2 Writing Data to Flash Memory ...................................................................................................
25.7.3 Erasing All Data (Erasing Chips) of Flash Memory ...................................................................
25.7.4 Erasing Optional Data (Erasing Sectors) in Flash Memory .......................................................
25.7.5 Suspending Sector Erase of Flash Memory ..............................................................................
25.7.6 Restarting Sector Erase of Flash Memory .................................................................................
25.8 Flash Security Feature ....................................................................................................................
25.9 Notes on Using Flash Memory .......................................................................................................
25.10 Example of Flash Memory Program ...............................................................................................
25.11 Writing Data to or Erasing Data from External Pins ........................................................................
xii
FUJITSU SEMICONDUCTOR LIMITED
638
640
641
644
646
647
648
650
651
652
653
654
655
657
658
660
661
662
663
664
668
CM44-10143-5E
MB90340E Series
CHAPTER 26 EXAMPLES OF SERIAL PROGRAMMING CONNECTION FOR FLASH
MEMORY PRODUCTS.............................................................................. 671
26.1
26.2
26.3
26.4
26.5
Basic Configuration of Serial Programming Connection for Flash Memory Products .................... 672
Example of Serial Programming Connection (User Power Supply Used) ...................................... 675
Example of Serial Programming Connection (Power Supplied from Programmer) ........................ 677
Example of Minimum Connection to Flash Microcontroller Programmer (User Power Supply Used)
....................................................................................................................................................... 679
Example of Minimum Connection to Flash Microcontroller Programmer
(Power Supplied from Programmer) ................................................................................................ 681
CHAPTER 27 ROM SECURITY FUNCTION ................................................................... 683
27.1
Overview of ROM Security Function ............................................................................................... 684
CHAPTER 28 CLOCK MODULATOR ............................................................................. 685
28.1
28.2
28.3
Overview of Clock Modulator .......................................................................................................... 686
Clock Modulator Control Registers (CMCR) ................................................................................... 687
Notes on Using Clock Modulator .................................................................................................... 689
APPENDIX ......................................................................................................................... 691
APPENDIX A I/O Maps ..............................................................................................................................
APPENDIX B Memory Map ........................................................................................................................
APPENDIX C Instructions ...........................................................................................................................
C.1 Instruction Types ............................................................................................................................
C.2 Addressing .....................................................................................................................................
C.3 Direct Addressing ...........................................................................................................................
C.4 Indirect Addressing ........................................................................................................................
C.5 Execution Cycle Count ...................................................................................................................
C.6 Effective address field ....................................................................................................................
C.7 How to Read the Instruction List ....................................................................................................
C.8 F2MC-16LX Instruction List ............................................................................................................
C.9 Instruction Map ...............................................................................................................................
APPENDIX D Timing Diagrams in Flash Memory Mode ............................................................................
APPENDIX E List of Interrupt Vectors ........................................................................................................
692
708
710
711
712
714
720
728
731
733
736
750
772
779
INDEX................................................................................................................................... 783
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
xiii
MB90340E Series
xiv
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
MB90340E Series
Main changes in this edition
Changes (For details, refer to main body.)
Page
CHAPTER 1 OVERVIEW
1.1 Overview of the MB90340E Series
Corrected the note (*) in "■ Product Lineup".
(· MB2147-01 → MB2147-01-E
· Emulator hardware manual → Emulator operation manual)
CHAPTER 1 OVERVIEW
1.2 Block Diagram of the MB90340E
Series
Corrected Figure 1.2-1.
(Added μDMAC to the block diagram.)
34
CHAPTER 1 OVERVIEW
1.7 Precautions when Handling
Devices
Added "● Characteristic difference among products with different memory size and between flash memory product and mask
ROM product".
64
CHAPTER 3 INTERRUPTS
3.1 Overview of Interrupts
Changed Figure 3.1-3.
Added the explanation.
114
CHAPTER 5 DELAY INTERRUPT
5.1 Overview of Delay Interrupt
Changed Table 5.1-1.
(EI2OS/μDMA → EI2OS/μDMAC)
200
CHAPTER 10 I/O PORTS
10.1 I/O Ports
Deleted the explanation of "■ Overview of I/O Ports".
203
10.2.1 Port Data Register
(PDR0 to PDRA)
Added Table 10.2-1. Numbered an existing table Table 10.2-2.
13.3.2 Timer Control Status Register
(Lower) (TCCSL0, TCCSL1)
■ Timer Control Status Register
(Lower) (TCCSL0, TCCSL1)
Corrected the bit name and table of Figure 13.3-2.
Count clock cycle select bits →Count clock setting bits
5
8
9
255
256
Corrected Figure 1.2-2.
(Added μDMAC to the block diagram.)
Added Notes to bit7 of Table 13.3-3.
Corrected the bit name and table of Table 13.3-3.
Count clock cycle select bits →Count clock setting bits
257
Added Note to bit7 and bit6 of Table 13.3-4.
260
13.3.4 Input Capture Control Status
Registers (ICS)
■ Input Capture Control Status
Register (ICS)
Added Note to bit7 and bit6 of Table 13.3-10.
271
13.3.8 Output Compare Control Status
Register (OCS) (Lower)
■ Output Compare Control Status
Register (OCS) (Lower)
281
13.7 Output Compare Operations
Added Note to "■ Output Compare Operations".
300
CHAPTER 14 16-BIT RELOAD
TIMERS
14.3 Configuration of 16-bit Reload
Timers
Added the explanation to "■ Generation of an Interrupt Request
by a 16-bit Reload Timer".
313
14.5.1 Operations in Internal Clock
Mode
Added the explanation to Note of "■ Operations in Internal Clock
Mode".
314
CM44-10143-5E
Corrected the Note of "■ Operations in Internal Clock Mode".
FUJITSU SEMICONDUCTOR LIMITED
xv
MB90340E Series
Page
Changes (For details, refer to main body.)
319
■ Operations in Event Count Mode
Corrected the Note.
CHAPTER 15 WATCH TIMER
15.3.1 Watch Timer Control Register
(WTC)
Added Note to bit 4 of Table 15.3-1.
332
CHAPTER 15 WATCH TIMER
15.5 Operating Explanation of Watch
Timer
Added an item to Notes of "■ Watch Timer Counter".
334
Changed Figure 17.4-2.
392
CHAPTER 17 DTP/EXTERNAL
INTERRUPT
17.4 Explanation of Operation of DTP/
External Interrupt
■ DTP/External Interrupt Operation
405
CHAPTER 18 WATCH TIMER
18.2 Block Diagram of 8/10-bit A/D
Converter
■ Block Diagram of 8/10-bit A/D
Converter
● Details of pins in block diagram
Corrected the pin name of AVCC pin and AVSS pin.
VCC input pin →A/D converter power supply pin
VSS input pin →A/D converter analog GND pin
Added Notes to bit15 to bit13 and bit12 to bit10 of Table 18.3-5.
418
18.3.4 A/D Setting Register (ADSR0/
ADSR1)
■ A/D Setting Register (ADSR0/
ADSR1)
18.3 Operating Explanation of Watch
Timer
Corrected the formula of the sampling time in "■ Setting for
Sampling Time (ST2 to ST0 Bits)".
420
444
456, 457
xvi
Corrected "■ Setting for Compare Time (CT2 to CT0 Bits)".
(Conversion accuracy is not assured · · · →
Refer to the data sheet for details.)
CHAPTER 20 LIN-UART
20.1 Overview of LIN-UART
■ Functions of LIN-UART
● Functions of LIN-UART
Corrected the parity error in Reception error detection of Table
20.1-1.
Parity error (Not supported in operating mode 1)
→
Parity error (Not supported in operation mode 1 and operation
mode 3)
20.4.1 Serial Control Register (SCR)
■ Serial Control Register (SCR)
Table 20.4-1
Corrected the explanation of bit9 and bit8.
data frame reception →reception
Added the sentence to Notes of bit9 and bit8.
Added Note to bit7, bit6 in Table 20.4-2.
459
20.4.2 LIN-UART Serial Mode
Register (SMR)
■ LIN-UART Serial Mode Register
(SMR)
461
20.4.3 Serial Status Register (SSR)
■ Serial Status Register (SSR)
Added the sentence to Notes of bit11 in Table 20.4-3.
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
MB90340E Series
Changes (For details, refer to main body.)
Page
Added the sentence to Note of bit9 in Table 20.4-4.
466
CHAPTER 20 LIN-UART
20.4.5 Extended Status Control
Register (ESCR)
■ Bit Configuration of Extended
Status Control Register (ESCR)
469
20.4.6 Extended Communication
Control Register (ECCR)
■ Bit Configuration of Extended
Communication Control Register
(ECCR)
Corrected Table 20.4-6.
Added Note to bit4.
Added the explanation of bit3.
Corrected the explanation of bit0.
471
20.5 Interrupts of LIN-UART
■ Interrupts of LIN-UART
Added the below to Clearing interrupt request flag of RX in Table
20.5-1.
Added Note to bit8 in Table 20.4-4.
Writing "1" to programmable reset bit (SMR:UPCL)
480
482
491, 492
497
20.6.1 Baud Rate Setting
Corrected the explanation of "■ External Clock".
synchronous mode 2 → operation mode 2,
20.6.2 Reload Counter
■ Function of Reload Counter
Added the below to "For both transmit/reception reload counters"
of "● Restart".
Writing to the baud rate generator register (BGR1, BGR0)
20.7.2 Operation of Synchronous
Mode (Operating Mode 2)
■ Operation of Synchronous Mode
(Operating Mode 2)
Added the explanation to "● Clock supply".
20.7.4 Serial Pin Direct Access
Added the sentence to Notes of "■ LIN-UART Pin Direct
Access".
20.8 Notes on Using LIN-UART
■ Notes on Using LIN-UART
Corrected the explanation of "● Bus idle function".
507, 508
Added the below.
● Parity
● Stop bit
● Data signaling
● Data transfer method
Added the below.
● ESCR:LBD bit
● ESCR:SCES bit
● Regarding serial transfer
514
CHAPTER 21 I2C INTERFACE
(400 kHz)
21.1 Overview of I2C Interface
(400 kHz)
Corrected the explanation of "■ Features of I2C Interface (400
kHz)".
General-purpose call → General call
515
■ Block Diagram of I2C Interface
Corrected Figure 21.1-1.
General-purpose call → General call
518
21.2.1 Bus Status Register
(IBSR0, IBSR1)
Corrected the explanation of "■ Functions of the Bus Status Register (IBSR0, IBSR1)".
General-purpose call → General call
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
xvii
MB90340E Series
Changes (For details, refer to main body.)
Page
519
■ Bit Function of the Bus Status
Register (IBSR0, IBSR1)
Corrected the explanation of bit1 in Table 21.2-1.
General-purpose call → General call
received → detected
521
522
523
Corrected the explanation of bit1 in Figure 21.2-2.
General-purpose call → General call
received → detected
21.2.2 Bus Control Register
(IBCR0, IBCR1)
Corrected the explanation of "■ Functions of Bus Control Register (IBCR0, IBCR1)".
General-purpose call → General call
■ Bit Function of Bus Control
Register (IBCR0, IBCR1)
Corrected the explanation of bit10 in Figure 21.2-3.
General-purpose call → General call
525
Corrected the explanation of bit10 in Table 21.2-2.
General-purpose call → General call
received → detected
526
Corrected the explanation of bit8 in Table 21.2-2.
General-purpose call → General call
533
21.2.5 7-Bit Slave Address Register
(ISBA0, ISBA1)
Corrected the explanation of bit6 to bit0 in Table 21.2-5.
general-purpose call → general call
541
21.3 Operations of I2C Interface
Added Note to "■ Acknowledgement".
544
21.4 Programming Flowcharts
■ Example of Interrupt Handler
Corrected Figure 21.4-3.
General-purpose call → General call
663
CHAPTER 25 FLASH MEMORY
25.9 Notes on Using Flash Memory
Added the item of "● Mode transition during data write/erase
operation" in "■ Notes on Using Flash Memory".
714
APPENDIX
C.3 Direct Addressing
● Register direct addressing
Changed Table C.3-1.
( S flag bit → stack flag (S) )
719
APPENDIX
C.3 Direct Addressing
● Vector Addressing (#vct)
Corrected Table C.3-2.
Corrected the explanation of XX.
Note: A PCB register value is set in XX. →
* : XX is replaced by the value of the program counter bank
register (PCB).
736
APPENDIX
Corrected Table C.8-1.
Corrected the number of bytes (#) for "MOVX A, Ri"
instruction.
(2 → 1)
2
C.8 F MC-16LX Instruction List
781
APPENDIX
APPENDIX E List of Interrupt
Vectors
Corrected the timer name of the column "Interrupt cause" in Table
E-2.
( I/O timer → Free-run timer)
The vertical lines marked in the left side of the page show the changes.
xviii
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 1
OVERVIEW
This chapter describes the features and basic
specifications of the MB90340E series.
1.1 Overview of the MB90340E Series
1.2 Block Diagram of the MB90340E Series
1.3 Package Dimensions
1.4 Pin Assignment
1.5 Pin Function
1.6 I/O Circuit Type
1.7 Precautions when Handling Devices
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
1
CHAPTER 1 OVERVIEW
1.1 Overview of the MB90340E Series
1.1
MB90340E Series
Overview of the MB90340E Series
MB90340E series is the 16-bit microcontrollers designed for in-vehicle applications.
Consisting of the CAN function, I2C, capture, compare timer, A/D converter, and others,
it is equipped with functions that are suitable for personal computer peripheral devices
such as displays and audio devices, and control of devices that support in-vehicle CAN
communications.
■ Feature of the MB90340E Series
MB90340E series has the following features:
● Clock
• Built-in PLL clock multiplier circuit
• Machine clock (PLL clock) selectable from divide-by-two of oscillation clock or multiply-by-one to
multiply-by-six of oscillation clocks (4 MHz to 24 MHz when oscillation clock is 4 MHz)
• Sub clock operation: Capable of maximum 50 kHz (when operating with 100 kHz and divide-by-two
of oscillation clock) of internal operation clock frequency (products without Ssuffix)
• Minimum instruction execution time: 41.7 ns (when operating with 4 MHz of oscillation clock and
multiply-by-six of PLL clock)
● 16 MB CPU memory space
Internal 24-bit addressing
● Instruction system optimized for controllers
• Various data types (bit, byte, word, long word)
• Various addressing modes (23 types)
• Enhanced signed instructions of multiplication/division and RETI
• High-accuracy operations enhanced by 32-bit accumulator
● Instruction system for high-level language (C language)/multitask
• System stack pointer
• Enhanced pointer indirect instructions
• Barrel shift instructions
● Higher execution speed
4-byte instruction queue
2
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 1 OVERVIEW
1.1 Overview of the MB90340E Series
MB90340E Series
● Powerful interrupt function
• Powerful interrupt function with 8 levels and 34 factors
• Supports maximum 16 channels of external interrupt
● CPU-independent automatic data transfer function
• Extended intelligent I/O service (EI2OS): Maximum 16 channels
• DMA function: Maximum 16 channels
● Low-power consumption (standby) mode
• Sleep mode (that stops CPU operating clock)
• Time-base timer mode (that operates only the oscillation clock, sub clock, time-base timer, and watch
timer)
• Watch mode (that operates only sub clock and watch timer)
• Stop mode (that stops the oscillation clock and sub clock)
• CPU intermittent operation mode
● Process
CMOS technology
● I/O port
• General-purpose I/O ports (CMOS output):
- 80 ports (products without S-suffix; sub clock compatible device)
- 82 ports (products with S-suffix; sub clock non-compatible device)
● Timers
• Time-base timer, watch timer, watchdog timer: 1 channel
• 8/16-bit PPG timer: 8-bit × 16 channels or 16-bit × 8 channels
• 16-bit reload timer: 4 channels
• 16-bit I/O timer
- 16-bit free-run timer
: 2 channels (FRT0: ICU0/ICU1/ICU2/ICU3, OCU0/1OCU/2OCU/3,
FRT1: ICU4/ICU5/ICU6/ICU7, OCU4/OCU5/OCU6/OCU7)
- 16-bit input capture (ICU)
: 8 channels
- 16-bit output compare (OCU) : 8 channels
● Full-CAN Controller: Maximum 2 channels
• Conforms to CAN Specification Ver.2.0A and Ver.2.0B.
• Built-in 16 message buffers
• CAN wake-up
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
3
CHAPTER 1 OVERVIEW
1.1 Overview of the MB90340E Series
MB90340E Series
● LIN-UART: 4 channels
• Full-duplex, double buffering
• Available for clock asynchronous/clock synchronous serial transfer
● I2C interface: 2 channels (products without C-suffix)
Capable of maximum 400 kbps of communication
● DTP/External interrupt: 16 channels, CAN wake-up: 2 channels
Starts EI2OS/DMA and generates an external interrupt by an external input
● Delayed interrupt generation module
Generates an interrupt request for task switching
● 8/10-bit A/D converter: 16 channels
24 channels (products without C-suffix)
• The resolution can be switched between 8 and 10 bits
• Starts by an external trigger input
• Conversion time: 3 μs (including sampling time when 24 MHz machine clock)
● Address match detection (program patch) function
Detects address match for 6 address pointers
● Variable port input voltage level
• Automotive input level/CMOS schmitt input level (the initial value for the single chip mode is
Automotive level)
• TTL input level (supports pins for the external bus mode only; the initial values for these pins are TTL
in the external bus mode)
● ROM security function
Protects the contents of the ROM (only for the mask ROM product)
● External bus interface
● Clock monitor function
4
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 1 OVERVIEW
1.1 Overview of the MB90340E Series
MB90340E Series
■ Product Lineup
Table 1.1-1 shows the product lineup for the MB90340E series.
Table 1.1-1 Product Lineup List for MB90340E Series
Features
MB90V340E-101,
MB90V340E-102
F2MC-16LX CPU
CPU
System
clock
MB90341E(S), MB90341CE(S)
MB90342E(S), MB90342CE(S)
MB90346E(S), MB90346CE(S)
MB90347E(S), MB90347CE(S)
MB90348E(S), MB90348CE(S)
MB90349E(S), MB90349CE(S)
MB90F342E(S), MB90F342CE(S)
MB90F345E(S), MB90F345CE(S)
MB90F346E(S), MB90F346CE(S)
MB90F347E(S), MB90F347CE(S)
MB90F349E(S), MB90F349CE(S)
On-chip PLL clock multiplier method (x1, x2, x3, x4, x6, 1/2 when PLL stops) Minimum instruction
execution time of 41.7 ns (at original oscillation of 4 MHz, multiply-by-six)
External
Boot-block, Flash memory
64K bytes :
MB90F346E(S), MB90F346CE(S)
128K bytes :
MB90F347E(S), MB90F347CE(S)
256K bytes :
MB90F342E(S), MB90F342CE(S),
MB90F349E(S), MB90F349CE(S)
512K bytes :
MB90F345E(S), MB90F345CE(S)
Boot-block, Mask ROM
64K bytes :
MB90346E(S), MB90346CE(S)
128K bytes:
MB90341E(S), MB90341CE(S),
MB90347E(S), MB90347CE(S),
MB90348E(S), MB90348CE(S)
256K bytes:
MB90342E(S), MB90342CE(S),
MB90349E(S), MB90349CE(S)
RAM size
30 Kbytes
2K bytes :
MB90F346E(S),MB90F346CE(S)
6K bytes :
MB90F347E(S),MB90F347CE(S)
16K bytes :
MB90F342E(S), MB90F342CE(S),
MB90F349E(S), MB90F349CE(S)
20K bytes :
MB90F345E(S), MB90F345CE(S)
2K bytes :
MB90346E(S), MB90346CE(S)
6K bytes :
MB90347E(S), MB90347CE(S)
16K bytes :
MB90341E(S), MB90341CE(S),
MB90342E(S), MB90342CE(S),
MB90348E(S), MB90348CE(S),
MB90349E(S), MB90349CE(S)
Technology
0.35 μm CMOS
with on-chip
voltage
regulator for
internal power
supply
0.35 μm CMOS with on-chip voltage
regulator for internal power supply +
Flash memory with on-chip charge pump
for voltage programming
0.35 μm CMOS with on-chip voltage
regulator for internal power supply
Package
PGA-299
QFP-100, LQFP-100
Emulatordedicated
power
supply*
Included
—
ROM size
*: It is a setting for the jumper switch (TOOL VCC) when the emulator (MB2147-01-E) is used.
Refer to the Emulator operation manual for details.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
5
CHAPTER 1 OVERVIEW
1.1 Overview of the MB90340E Series
MB90340E Series
■ Features
Table 1.1-2 Peripheral Functions of the MB90340E Series (1 / 2)
Function
MB90F342E(S), MB90F342CE(S), MB90F345E(S), MB90F345CE(S),
MB90F346E(S), MB90F346CE(S), MB90F347E(S), MB90F347CE(S),
MB90F349E(S), MB90F349CE(S), MB90341E(S), MB90341CE(S),
MB90342E(S), MB90342CE(S), MB90346E(S), MB90346CE(S),
MB90347E(S), MB90347CE(S), MB90348E(S), MB90348CE(S),
MB90349E(S), MB90349CE(S)
4 channels
MB90V340E-101,
MB90V340E-102
5 channels
LIN-UART
A wide-range baud rate can be set with the dedicated baud rate generator (reload timer).
LIN function can be used as a LIN master and LIN slave.
I2C (400 kbps)
Devices with C-suffix: 2 channels
Devices without C-suffix: --
A/D converter
Devices with C-suffix: 24channels
Devices without C-suffix: 16channels
2 channels
24 input channels
10/8-bit resolution
Conversion time: Minimum 3 μs including sampling time (per channel)
16-bit reload timer
(4 channels)
Operating clock frequency: fsys/21, fsys/23, fsys/25 (fsys=system clock frequency)
Supports the external event count function
16-bit free-run timer
(2 channels)
Outputs an interrupt signal at overflowing
Supports timer clear when a match with output compare (ch.0 and ch.4)
Operating clock frequency: fsys/21, fsys/22, fsys/23, fsys/24, fsys/25, fsys/26, fsys/27 (fsys=system
clock frequency)
16-bit free-run timer 0 (clock input FRCK0)
corresponds to ICU0/ICU1/ICU2/ICU3, OCU0/OCU1/OCU2/OCU3
16-bit free-run timer 1 (clock input FRCK1)
corresponds to ICU4/ICU5/ICU6/ICU7, OCU4/OCU5/OCU6/OCU7
16-bit output compare
(8 channels)
Outputs an interrupt signal when a match with 16-bit free-run timer and 16-bit compare registers
Up to 3 of compare registers can be used to generate an output signal
16-bit input capture
(8 channels)
Performs the retention of 16-bit free-run timer value and the generation of interrupt by the pin input
(rising edge, falling edge, or both edges)
8/16-bit PPG
(16/8 channels)
Supports 8-bit and 16-bit operating modes
8-bit reload counter × 16
Lower 8-bit reload register × 16
Upper 8-bit reload register × 16
A pair of 8-bit reload counters can be configured as one 16-bit reload counter or as 8-bit prescaler
plus 8-bit reload counter
Operating clock frequency: fsys, fsys/21, fsys/22, fsys/23, fsys/24 or 128 μs when fosc =
4 MHz (fsys=system clock frequency, fosc=oscillation clock frequency)
6
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 1 OVERVIEW
1.1 Overview of the MB90340E Series
MB90340E Series
Table 1.1-2 Peripheral Functions of the MB90340E Series (2 / 2)
Function
CAN Interface
External interrupt
(16 channels)
D/A converter
MB90F342E(S), MB90F342CE(S), MB90F345E(S), MB90F345CE(S),
MB90F346E(S), MB90F346CE(S), MB90F347E(S), MB90F347CE(S),
MB90F349E(S), MB90F349CE(S), MB90341E(S), MB90341CE(S),
MB90342E(S), MB90342CE(S), MB90346E(S), MB90346CE(S),
MB90347E(S), MB90347CE(S), MB90348E(S), MB90348CE(S),
MB90349E(S), MB90349CE(S)
MB90V340E-101,
MB90V340E-102
2 channels:
MB90F342E(S), MB90F342CE(S), MB90F345E(S), MB90F345CE(S),
MB90341E(S), MB90341CE(S), MB90342E(S), MB90342CE(S)
1 channel:
MB90F346E(S), MB90F346CE(S), MB90F347E(S), MB90F347CE(S),
MB90F349E(S), MB90F349CE(S), MB90346E(S), MB90346CE(S),
MB90347E(S), MB90347CE(S), MB90348E(S), MB90348CE(S),
MB90349E(S), MB90349CE(S)
3 channels
Conforms to CAN Specification Version 2.0 Part A and Version 2.0 Part B
Automatic re-transmission in case of error
Automatic transmission responding to Remote Frame
16 transmitting/receiving message buffers
Supports multiple messages
Flexible configuration of acceptance filtering:
Full bit compare / Full bit mask / Two partial bit masks
Supports up to 1Mbps
Edge detection or level detection can be configured
—
2 channels
Sub clock
(maximum 100 kHz)
Only the products without S-suffix in their part number support this function
I/O port
General-purpose I/O ports (CMOS output):
- 80 ports (products without S-suffix; sub clock compatible device)
- 82 ports (products with S-suffix; sub clock non-compatible device)
Input level setting:
- Port0 to Port3: Selectable among CMOS/Automotive/TTL levels
- Port4 to PortA: Selectable among CMOS/Automotive levels
Flash memory
Supports automatic programming, Embedded Algorithm, Write/Erase/ Erase-Suspend/Resume
commands
A flag indicating completion of the algorithm
Number of erase cycles: 10,000 times
Data retention time: 20 years
Boot block configuration
Erase can be performed on each block
Block protection with external programming voltage
Flash security function to protect the contents of the flash (except MB90F346E(S),
MB90F346CE(S))
ROM security
Protects the contents of the ROM (only for mask ROM product)
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
Only for
MB90V340E-102
-
7
CHAPTER 1 OVERVIEW
1.2 Block Diagram of the MB90340E Series
1.2
MB90340E Series
Block Diagram of the MB90340E Series
This section describes the block diagram of the MB90340E series.
■ Block Diagram of the Evaluation Chip
Figure 1.2-1 shows the block diagram of the evaluation chip.
Figure 1.2-1 Block Diagram of the Evaluation Chip
X0,X1
X0A,X1A*
RST
Clock
control
circuit
F2MC-16LX core
16-bit freerun timer 0
RAM 30K
Baud rate
generator
(5 ch)
AVcc
AVss
AN23 to AN0
AVRH
AVRL
ADTG
DA01 to DA00
10-bit D/A
converter
2 ch
PPGF to PPG0
8/16-bit
PPG
16/8 ch
SDA1, SDA0
SCL1, SCL0
I2C
interface
2 ch
μDMAC
IN7 to IN0
Output
compare
8 ch
OUT7 to OUT0
CAN
controller
3 ch
LIN-UART
5 ch
10-bit A/D
converter
24 ch
Input
capture
8 ch
16-bit freerun timer 1
Internal data bus
SOT4 to SOT0
SCK4 to SCK0
SIN4 to SIN0
FRCK0
16-bit reload
timer
4 ch
External
bus
Interface
FRCK1
RX2 to RX0
TX2 to TX0
TIN3 to TIN0
TOT3 to TOT0
AD15 to AD00
A23 to A16
ALE
RD
WRL
WRH
HRQ
HAK
RDY
CLK
External
interrupt
INT15 to INT8
(INT15R to INT8R)
INT7 to INT0
Clock
monitor
CKOT
*: Only for MB90V340E-102
8
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 1 OVERVIEW
1.2 Block Diagram of the MB90340E Series
MB90340E Series
■ Block Diagram of Flash Products and Mask ROM Products
Figure 1.2-2 shows the block diagram of flash products and mask ROM products.
Figure 1.2-2 Block Diagram of Flash Products and Mask ROM Products
X0,X1
1
X0A,X1A*
Clock
control
circuit
RST
F2MC-16LX core
16-bit freerun timer 0
RAM
2K/6K/16K/
20K/30K
ROM/Flash
64K/128K
256K/384K
Baud rate
generator
(4 ch)
SOT3 to SOT0
SCK3 to SCK0
SIN3 to SIN0
10-bit A/D
converter
16/24 ch
8/16-bit
PPG
16/8 ch
PPGF to PPG0
2
SDA1 to SDA0*
2
SCL1 to SCL0 *
I2 C
interface
2 ch
IN7 to IN0
Output
compare
8 ch
OUT7 to OUT0
CAN
controller
3
1 ch, 2 ch*
Internal data bus
AVcc
AVss
AN15 to AN0
AN23 to AN16*2
AVRH
AVRL
ADTG
Input
capture
8 ch
16-bit freerun timer 1
LIN-UART
4 ch
FRCK0
FRCK1
3
RX0,RX1*
*
TX0,TX1 3
16-bit
reload timer
4 ch
TIN3 to TIN0
TOT3 to TOT0
External
bus
AD15 to AD00
A23 to A16
ALE
RD
WRL
WRH
HRQ
HAK
RDY
CLK
DTP/
External
interrupt
μDMAC
Clock
monitor
INT15 to INT8
(INT15R to INT8R)
INT7 to INT0
CKOT
*1: Products without S-suffix
*2: Products with C-suffix
*3: Only following products have 2 channels CAN; MB90341E(S), MB90341CE(S), MB90F342E(S),
MB90F342CE(S), MB90342E(S), MB90342CE(S), MB90F345E(S), MB90F345CE(S)
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
9
CHAPTER 1 OVERVIEW
1.3 Package Dimensions
1.3
MB90340E Series
Package Dimensions
Two types of the package are provided for the MB90340E series.
These package dimensions are only a reference. Please ask us when you need the
official version.
■ Package Dimension (LQFP-100)
Figure 1.3-1 shows the LQFP-100 (FPT-100P-M20) type package dimension.
Figure 1.3-1 LQFP-100 Type (FPT-100P-M20) Package Dimension
100-pin plastic LQFP
Lead pitch
0.50 mm
Package width ×
package length
14.0 mm × 14.0 mm
Lead shape
Gullwing
Sealing method
Plastic mold
Mounting height
1.70 mm Max
Weight
0.65 g
Code
(Reference)
P-LFQFP100-14×14-0.50
(FPT-100P-M20)
100-pin plastic LQFP
(FPT-100P-M20)
Note 1) * : These dimensions do not include resin protrusion.
Note 2) Pins width and pins thickness include plating thickness.
Note 3) Pins width do not include tie bar cutting remainder.
16.00±0.20(.630±.008)SQ
* 14.00±0.10(.551±.004)SQ
75
51
76
50
0.08(.003)
Details of "A" part
+0.20
26
100
1
C
0.50±0.20
(.020±.008)
0.60±0.15
(.024±.006)
25
0.20±0.05
(.008±.002)
0.08(.003)
M
2005 -2010 FUJITSU SEMICONDUCTOR LIMITED F100031S-c-3-5
0.10±0.10
(.004±.004)
(Stand off)
0°~8°
"A"
0.50(.020)
+.008
1.50 –0.10 .059 –.004
(Mounting height)
INDEX
0.145±0.055
(.006±.002)
0.25(.010)
Dimensions in mm (inches).
Note: The values in parentheses are reference values
Please check the latest package dimension at the following URL.
http://edevice.fujitsu.com/package/en-search/
10
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 1 OVERVIEW
1.3 Package Dimensions
MB90340E Series
■ Package Dimension (QFP-100)
Figure 1.3-2 shows the QFP-100 type (FPT-100P-M06) package dimension.
Figure 1.3-2 QFP-100 Type (FPT-100P-M06) Package Dimension
100-pin plastic QFP
Lead pitch
0.65 mm
Package width ×
package length
14.00 × 20.00 mm
Lead shape
Gullwing
Sealing method
Plastic mold
Mounting height
3.35 mm MAX
Code
(Reference)
P-QFP100-14×20-0.65
(FPT-100P-M06)
100-pin plastic QFP
(FPT-100P-M06)
Note 1) * : These dimensions do not include resin protrusion.
Note 2) Pins width and pins thickness include plating thickness.
Note 3) Pins width do not include tie bar cutting remainder.
23.90±0.40(.941±.016)
* 20.00±0.20(.787±.008)
80
51
81
50
0.10(.004)
17.90±0.40
(.705±.016)
*14.00±0.20
(.551±.008)
INDEX
Details of "A" part
100
0.25(.010)
+0.35
3.00 –0.20
+.014
.118 –.008
(Mounting height)
0~8°
31
1
30
0.65(.026)
0.32±0.05
(.013±.002)
0.13(.005)
M
0.17±0.06
(.007±.002)
0.80±0.20
(.031±.008)
0.88±0.15
(.035±.006)
"A"
C
2002-2010 FUJITSU SEMICONDUCTOR LIMITED F100008S-c-5-7
0.25±0.20
(.010±.008)
(Stand off)
Dimensions in mm (inches).
Note: The values in parentheses are reference values.
Please check the latest package dimension at the following URL.
http://edevice.fujitsu.com/package/en-search/
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
11
CHAPTER 1 OVERVIEW
1.4 Pin Assignment
MB90340E Series
1.4Pin Assignment
This section describes the pin assignments of the MB90340E series, depending on two
types of packages.
■ Pin Assignment (QFP-100)
Figure 1.4-1 shows the QFP-100 type pin assignment of products without 'C' - suffix.
MD2
RST
MD0
MD1
P76/INT6
P80/TIN0/ADT G/INT12R
P77/INT7
P82/SIN0/TIN2/INT 14R
P81/TOT0/CKOT /INT13R
P83/SOT0/TOT2
P85/SIN1
P84/SCK0/INT15R
P87/SCK1
P86/SOT1
Vcc
Vss
P90/PPG1(0)
P91/PPG3(2)
P92/PPG5(4)
P93/PPG7(6)
P94/OUT0
P95/OUT1
P96/OUT2
PA0/RX0/INT8R
P97/OUT3
PA1/TX0
P00/AD00/INT8
P01/AD01/INT9
P02/AD02/INT10
P03/AD03/INT11
Figure 1.4-1 Pin Assignment (QFP-100) of Products without 'C' - Suffix
80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51
P04/AD04/INT12
81
50
P75/INT5
P05/AD05/INT13
82
49
P74/INT4
P06/AD06/INT14
83
48
P73/INT3
P07/AD07/INT15
84
47
P72/INT2
P10/AD08/TIN1
85
46
P71/INT1
P11/AD09/TOT1
86
45
P70/INT0
P12/AD10/SIN3/INT11R
87
44
Vss
P13/AD11/SOT3
88
43
P67/AN7/PPGE(F)
P14/AD12/SCK3
89
42
P66/AN6/PPGC(D)
Vcc
90
41
P65/AN5/PPGA(B)
Vss
91
40
P64/AN4/PPG8(9)
X1
92
39
P63/AN3/PPG6(7)
X0
93
38
P62/AN2/PPG4(5)
P15/AD13
94
37
P61/AN1/PPG2(3)
P16/AD14
95
36
P60/AN0/PPG0(1)
P17/AD15
96
35
AVss
P20/A16/PPG9(8)
97
34
AVRL
P21/A17/PPGB(A)
98
33
AVRH
P22/A18/PPGD(C)
99
32
AVcc
P23/A19/PPGF(E)
100
31
P57/AN15
QFP - 100
P56/AN14
P55/AN13
P54/AN12/TOT3
P53/AN11/TIN3
P52/AN10/SCK2
P40/X0A
P50/AN8/SIN2
P33/WRH
P34/HRQ/OUT4
P51/AN 9/SOT 2
P32/WRL/WR/INT10R
P47
P31/RD/IN5
P46
P30/ALE/IN4
P45/F RCK1
P27/A23/IN3
P44/F RCK0
P26/A22/IN2
P43/IN7/TX1
P25/A21/IN1
P42/IN6/RX1/INT9R
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
C
8
Vss
7
Vcc
6
P41/X1A *
5
*
4
P37/CLK/OUT7
3
P36/RDY/OUT6
2
P35/HAK /OUT5
1
P24/A20/IN0
Package code (mold)
FPT-100P-M06
(FPT-100P-M06)
*: X0A, X1A: Products without S-suffix.
P40, P41: Products with S-suffix.
12
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 1 OVERVIEW
1.4 Pin Assignment
MB90340E Series
Figure 1.4-2 shows the QFP-100 type pin assignment of products with 'C' - suffix.
MD2
RST
MD0
MD1
P76/AN22/INT6
P80/TIN0/ADT G/INT12R
P77/AN23/INT7
P82/SIN0/TIN2/INT 14R
P81/TOT0/CKOT /INT13R
P83/SOT0/TOT2
P85/SIN1
P84/SCK0/INT15R
P87/SCK1
P86/SOT1
Vcc
Vss
P90/PPG1(0)
P91/PPG3(2)
P92/PPG5(4)
P93/PPG7(6)
P94/OUT0
P95/OUT1
P96/OUT2
PA0/RX0/INT8R
P97/OUT3
PA1/TX0
P00/AD00/INT8
P01/AD01/INT9
P02/AD02/INT10
P03/AD03/INT11
Figure 1.4-2 Pin Assignment (QFP-100) of Products with 'C' - Suffix
80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51
P04/AD04/INT12
81
50
P75/AN21/INT5
P05/AD05/INT13
82
49
P74/AN20/INT4
P06/AD06/INT14
83
48
P73/AN19/INT3
P07/AD07/INT15
84
47
P72/AN18/INT2
P10/AD08/TIN1
85
46
P71/AN17/INT1
P11/AD09/TOT1
86
45
P70/AN16/INT0
P12/AD10/SIN3/INT11R
87
44
Vss
P13/AD11/SOT3
88
43
P67/AN7/PPGE(F)
P14/AD12/SCK3
89
42
P66/AN6/PPGC(D)
Vcc
90
41
P65/AN5/PPGA(B)
Vss
91
40
P64/AN4/PPG8(9)
X1
92
39
P63/AN3/PPG6(7)
X0
93
38
P62/AN2/PPG4(5)
P15/AD13
94
37
P61/AN1/PPG2(3)
P16/AD14
95
36
P60/AN0/PPG0(1)
P17/AD15
96
35
AVss
P20/A16/PPG9(8)
97
34
AVRL
P21/A17/PPGB(A)
98
33
AVRH
P22/A18/PPGD(C)
99
32
AVcc
P23/A19/PPGF(E)
100
31
P57/AN15
QFP - 100
P56/AN14
P55/AN13
P54/AN12/TOT3
P53/AN11/TIN3
P52/AN10/SCK2
P40/X0A
P50/AN8/SIN2
P33/WRH
P34/HRQ/OUT4
P51/AN 9/SOT 2
P32/WRL/WR/INT10R
P47/SCL1
P31/RD/IN5
P46/SDA1
P30/ALE/IN4
P45/SCL0/F RCK1
P27/A23/IN3
P43/IN7/TX1
P26/A22/IN2
P44/SDA0/FRCK0
P25/A21/IN1
P42/IN6/RX1/INT9R
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
C
8
Vss
7
Vcc
6
P41/X1A *
5
*
4
P37/CLK/OUT7
3
P36/RDY/OUT6
2
P35/HAK/OUT5
1
P24/A20/IN0
Package code (mold)
FPT-100P-M06
(FPT-100P-M06)
*: X0A, X1A: Products without S-suffix.
P40, P41: Products with S-suffix.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
13
CHAPTER 1 OVERVIEW
1.4 Pin Assignment
MB90340E Series
Figure 1.4-3 shows the QFP-100 type pin assignment.
Figure 1.4-3 Pin Assignment (QFP-100)
P03/AD03/INT11
P02/AD02/INT10
P01/AD01/INT9
P00/AD00/INT8
PA1/TX0
PA0/RX0/INT8R
P97/OUT3
P96/OUT2
P95/OUT1
P94/OUT0
P93/PPG7(6)
P92/PPG5(4)
P91/PPG3(2)
P90/PPG1(0)
Vss
Vcc
P87/SCK1
P86/SOT1
P85/SIN1
P84/SCK0/INT15R
P83/SOT0/TOT2
P82/SIN0/TIN2/INT14R
P81/TOT0/CKOT/INT13R
P80/TIN0/ADTG/INT12R
P77/AN23/INT7
P76/AN22/INT6
RST
MD0
MD1
MD2
(TOP VIEW)
P75/AN21/INT5
P74/AN20/INT4
P73/AN19/INT3
P72/AN18/INT2
P71/AN17/INT1
P70/AN16/INT0
Vss
P67/AN7/PPGE(F)
P66/AN6/PPGC(D)
P65/AN5/PPGA(B)
P64/AN4/PPG8(9)
P63/AN3/PPG6(7)
P62/AN2/PPG4(5)
P61/AN1/PPG2(3)
P60/AN0/PPG0(1)
AVss
AVRL
AVRH
AVcc
P57/AN15/DA01
P35/HAK/OUT5
P36/RDY/OUT6
P37/CLK/OUT7
P40/X0A*
P41/X1A*
Vcc
Vss
C
P42/IN6/RX1/INT9R
P43/IN7/TX1
P44/SDA0/FRCK0
P45/SCL0/FRCK1
P46/SDA1
P47/SCL1
P50/AN8/SIN2
P51/AN9/SOT2
P52/AN10/SCK2
P53/AN11/TIN3
P54/AN12/TOT3
P55/AN13
P56/AN14/DA00
P31/RD/IN5
P32/WRL/WR/RX2/INT10R
P33/WRH/TX2
P34/HRQ/OUT4
80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51
50
81
82
49
83
48
84
47
85
46
86
45
87
44
88
43
89
42
90
41
QFP - 100
91
40
92
39
93
38
94
37
95
36
96
35
97
34
98
33
99
32
100
31
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
P24/A20/IN0
P25/A21/IN1
P26/A22/IN2
P27/A23/IN3
P30/ALE/IN4
P04/AD04/INT12
P05/AD05/INT13
P06/AD06/INT14
P07/AD07/INT15
P10/AD08/TIN1
P11/AD09/TOT1
P12/AD10/SIN3/INT11R
P13/AD11/SOT3
P14/AD12/SCK3
Vcc
Vss
X1
X0
P15/AD13/SIN4
P16/AD14/SOT4
P17/AD15/SCK4
P20/A16/PPG9(8)
P21/A17/PPGB(A)
P22/A18/PPGD(C)
P23/A19/PPGF(E)
(FPT-100P-M06)
* : X0A, X1A : MB90V340E-102
P40, P41 : MB90V340E-101
14
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 1 OVERVIEW
1.4 Pin Assignment
MB90340E Series
■ Pin Assignment (LQFP-100)
Figure 1.4-4 shows the LQFP-100 type pin assignment of products without 'C' - suffix.
RST
MD0
P76/INT6
P80/TIN0/ADT G/INT12R
P77/INT7
P82/SIN0/TIN2/INT 14R
P81/TOT0/CKOT/INT 13R
P83/SOT 0/TOT2
P85/SIN1
P84/SCK0/INT15R
P87/SCK1
P86/SOT 1
Vcc
Vss
P90/PPG1(0)
P91/PPG3(2)
P92/PPG5(4)
P93/PPG7(6)
P94/OUT0
P95/OUT1
P96/OUT2
PA0/RX0/INT8R
P97/OUT3
PA1/TX0
P00/AD00/INT8
Figure 1.4-4 Pin Assignment (LQFP-100) of Products without 'C' - Suffix
P01/AD01/INT9
76
75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51
50
MD1
P02/AD02/INT10
77
49
MD2
P03/AD03/INT11
78
48
P75/INT5
P04/AD04/INT12
79
47
P74/INT4
P05/AD05/INT13
80
46
P73/INT3
P06/AD06/INT14
81
45
P72/INT2
P07/AD07/INT15
82
44
P71/INT1
P10/AD08/TIN1
83
43
P70/INT0
P11/AD09/TOT1
84
42
Vss
P12/AD10/SIN3/INT11R
85
41
P67/AN7/PPGE(F)
P13/AD11/SOT3
86
40
P66/AN6/PPGC(D)
P14/AD12/SCK3
87
39
P65/AN5/PPGA(B)
Vcc
88
38
P64/AN4/PPG8(9)
Vss
89
37
P63/AN3/PPG6(7)
X1
90
36
P62/AN2/PPG4(5)
LQFP - 100
Package code (mold)
FPT-100P-M20
33
AVss
P17/AD15
94
32
AVRL
P20/A16/PPG9(8)
95
31
AVRH
P21/A17/PPGB(A)
96
30
AVcc
P22/A18/PPGD(C)
97
29
P57/AN15
P23/A19/PPGF(E)
98
28
P56/AN14
P24/A20/IN0
99
27
P55/AN13
P25/A21/IN1
100
P54/AN12/TOT3
P53/AN11/TIN3
P51/AN9/SOT2
P52/AN10/SCK2
P47
P50/AN8/SIN2
P46
P45/FRCK1
P44/FRCK0
P43/IN7/TX1
P42/IN6/RX1/INT9R
C
Vss
Vcc
26
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
*
7 8
P41/X1A
6
*
5
P40/X0A
4
P37/CLK/OUT7
3
P36/RDY/OUT 6
2
P35/HAK/OUT5
1
P33/WRH
P34/HRQ/OUT4
93
P32/WRL/WR/INT10R
P60/AN0/PPG0(1)
P16/AD14
P31/RD/IN5
P61/AN1/PPG2(3)
34
P30/ALE/IN4
35
92
P27/A23/IN3
91
P26/A22/IN2
X0
P15/AD13
(FPT-100P-M20)
*: X0A, X1A: Products without S-suffix.
P40, P41: Products with S-suffix.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
15
CHAPTER 1 OVERVIEW
1.4 Pin Assignment
MB90340E Series
Figure 1.4-5 shows the LQFP-100 type pin assignment of products with 'C' - suffix.
RST
MD0
P76/AN22/INT6
P80/TIN0/ADT G/INT12R
P77/AN23/INT7
P82/SIN0/TIN2/INT 14R
P81/TOT0/CKOT/INT 13R
P83/SOT 0/TOT2
P85/SIN1
P84/SCK0/INT15R
P87/SCK1
P86/SOT 1
Vcc
Vss
P90/PPG1(0)
P91/PPG3(2)
P92/PPG5(4)
P93/PPG7(6)
P94/OUT0
P95/OUT1
P96/OUT2
PA0/RX0/INT8R
P97/OUT3
PA1/TX0
P00/AD00/INT8
Figure 1.4-5 Pin Assignment (LQFP-100) of Products with 'C' - Suffix
P01/AD01/INT9
76
75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51
50
MD1
P02/AD02/INT10
77
49
MD2
P03/AD03/INT11
78
48
P75/AN21/INT5
P04/AD04/INT12
79
47
P74/AN20/INT4
P05/AD05/INT13
80
46
P73/AN19/INT3
P06/AD06/INT14
81
45
P72/AN18/INT2
P07/AD07/INT15
82
44
P71/AN17/INT1
P10/AD08/TIN1
83
43
P70/AN16/INT0
P11/AD09/TOT1
84
42
Vss
P12/AD10/SIN3/INT11R
85
41
P67/AN7/PPGE(F)
P13/AD11/SOT3
86
40
P66/AN6/PPGC(D)
P14/AD12/SCK3
87
39
P65/AN5/PPGA(B)
Vcc
88
38
P64/AN4/PPG8(9)
Vss
89
37
P63/AN3/PPG6(7)
X1
90
36
P62/AN2/PPG4(5)
X0
91
35
P61/AN1/PPG2(3)
P15/AD13
92
34
P60/AN0/PPG0(1)
P16/AD14
93
33
AVss
P17/AD15
94
32
AVRL
P20/A16/PPG9(8)
95
31
AVRH
P21/A17/PPGB(A)
96
30
AVcc
P22/A18/PPGD(C)
97
29
P57/AN15
P23/A19/PPGF(E)
98
28
P56/AN14
P24/A20/IN0
99
27
P55/AN13
P25/A21/IN1
100
LQFP - 100
P54/AN12/TOT3
P53/AN11/TIN3
P51/AN9/SOT2
P52/AN10/SCK2
P47/SCL1
P50/AN8/SIN2
P46/SDA1
P45/SCL0/FRCK1
P44/SDA0/FRCK0
P43/IN7/TX1
P42/IN6/RX1/INT9R
P33/WRHX
P34/HRQ/OUT4
C
P32/WRL/ WR /INT10R
Vss
P31/RD /IN5
Vcc
P30/ALE/IN4
*
P27/A23/IN3
7 8
P41/X1A
6
*
5
P40/X0A
4
P37/CLK/OUT7
3
26
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
P36/RDY/OUT6
2
P35/HAK/OUT5
1
P26/A22/IN2
Package code (mold)
FPT-100P-M20
(FPT-100P-M20)
*: X0A, X1A: Products without S-suffix.
P40, P41: Products with S-suffix.
16
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 1 OVERVIEW
1.4 Pin Assignment
MB90340E Series
Figure 1.4-6 shows the LQFP-100 type pin assignment.
Figure 1.4-6 Pin Assignment (LQFP-100)
P35/HAK/OUT5
RST
MD0
MD1
MD2
P75/AN21/INT5
P74/AN20/INT4
P73/AN19/INT3
P72/AN18/INT2
P71/AN17/INT1
P70/AN16/INT0
Vss
P67/AN7/PPGE(F)
P66/AN6/PPGC(D)
P65/AN5/PPGA(B)
P64/AN4/PPG8(9)
P63/AN3/PPG6(7)
P62/AN2/PPG4(5)
P61/AN1/PPG2(3)
P60/AN0/PPG0(1)
AVss
AVRL
AVRH
AVcc
P57/AN15/DA01
P56/AN14/DA00
P55/AN13
P54/AN12/TOT3
P36/RDY/OUT6
P37/CLK/OUT7
P40/X0A*
P41/X1A*
Vcc
Vss
C
P42/IN6/RX1/INT9R
P43/IN7/TX1
P44/SDA0/FRCK0
P45/SCL0/FRCK1
P46/SDA1
P47/SCL1
P50/AN8/SIN2
P51/AN9/SOT2
P52/AN10/SCK2
P53/AN11/TIN3
75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51
76
50
77
49
78
48
47
79
46
80
45
81
44
82
43
83
42
84
41
85
40
86
39
87
38
88
LQFP - 100
37
89
36
90
35
91
34
92
33
93
32
94
31
95
30
96
29
97
98
28
99
27
100
26
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
P26/A22/IN2
P27/A23/IN3
P30/ALE/IN4
P31/RD/IN5
P32/WRL/WR/RX2/INT10R
P33/WRH/TX2
P34/HRQ/OUT4
P01/AD01/INT9
P02/AD02/INT10
P03/AD03/INT11
P04/AD04/INT12
P05/AD05/INT13
P06/AD06/INT14
P07/AD07/INT15
P10/AD08/TIN1
P11/AD09/TOT1
P12/AD10/SIN3/INT11R
P13/AD11/SOT3
P14/AD12/SCK3
Vcc
Vss
X1
X0
P15/AD13/SIN4
P16/AD14/SOT4
P17/AD15/SCK4
P20/A16/PPG9(8)
P21/A17/PPGB(A)
P22/A18/PPGD(C)
P23/A19/PPGF(E)
P24/A20/IN0
P25/A21/IN1
P81/TOT0/CKOT/INT13R
P80/TIN0/ADTG/INT12R
P77/AN23/INT7
P76/AN22/INT6
P00/AD00/INT8
PA1/TX0
PA0/RX0/INT8R
P97/OUT3
P96/OUT2
P95/OUT1
P94/OUT0
P93/PPG7(6)
P92/PPG5(4)
P91/PPG3(2)
P90/PPG1(0)
Vss
Vcc
P87/SCK1
P86/SOT1
P85/SIN1
P84/SCK0/INT15R
P83/SOT0/TOT2
P82/SIN0/TIN2/INT14R
(TOP VIEW)
(FPT-100P-M20)
* : X0A, X1A : MB90V340E-102
P40, P41 : MB90V340E-101
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
17
CHAPTER 1 OVERVIEW
1.5 Pin Function
1.5
MB90340E Series
Pin Function
This section describes the pin function of the MB90340E series.
■ Pin Function
Table 1.5-1 Pin Function of the MB90340E Series (1 / 8)
Pin No.
Pin name
LQFP100*2
QFP100*1
90
92
I/O circuit
type*3
X1
Function
Oscillation output pin
A
91
93
X0
Oscillation input pin
52
54
RST
E
General-purpose I/O port.
You can set a pull-up resistor On/Off by setting a register.
This function is valid in the single chip mode.
P00 to P07
75 to 82
77 to 84
AD00 to
AD07
G
INT8 to
INT15
85
General-purpose I/O port.
You can set a pull-up resistor On/Off by setting a register.
This function is valid in the single chip mode.
G
AD08
I/O pin for the external address/data bus (AD08). This
function is valid when the external bus is enabled.
TIN1
Event input pin for the reload timer 1
General-purpose I/O port.
You can set a pull-up resistor On/Off by setting a register.
This function is valid in the single chip mode.
P11
84
86
G
AD09
I/O pin for the external address/data bus (AD09). This
function is valid when the external bus is enabled.
TOT1
Output pin for the reload timer 1
General-purpose I/O port.
You can set a pull-up resistor On/Off by setting a register.
This function is valid in the single chip mode.
P12
85
87
AD10
SIN3
INT11R
18
I/O pin for the external address/data bus lower 8-bit.
This function is valid when the external bus is enabled.
External interrupt request input pin for INT8 to INT15
P10
83
Reset input
N
I/O pin for the external address/data bus (AD10). This
function is valid when the external bus is enabled.
Serial data input pin for UART3
External interrupt request input pin for INT11 (sub)
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 1 OVERVIEW
1.5 Pin Function
MB90340E Series
Table 1.5-1 Pin Function of the MB90340E Series (2 / 8)
Pin No.
Pin name
LQFP100
*2
QFP100
*1
I/O circuit
type*3
General-purpose I/O port.
You can set a pull-up resistor On/Off by setting a register.
This function is valid in the single chip mode.
P13
86
88
G
AD11
I/O pin for the external address/data bus (AD11). This
function is valid when the external bus is enabled.
SOT3
Serial data output pin for UART3
General-purpose I/O port.
You can set a pull-up resistor On/Off by setting a register.
This function is valid in the single chip mode.
P14
87
89
G
AD12
I/O pin for the external address/data bus (AD12). This
function is valid when the external bus is enabled.
SCK3
Clock I/O pin for UART3
P15
92
93
94
95 to 98
CM44-10143-5E
Function
94
N
General-purpose I/O port.
You can set a pull-up resistor On/Off by setting a register.
This function is valid in the single chip mode.
AD13
I/O pin for the external address/data bus (AD13). This
function is valid when the external bus is enabled.
P16
General-purpose I/O port.
You can set a pull-up resistor On/Off by setting a register.
This function is valid in the single chip mode.
95
G
AD14
I/O pin for the external address/data bus (AD14). This
function is valid when the external bus is enabled.
P17
General-purpose I/O port.
You can set a pull-up resistor On/Off by setting a register.
This function is valid in the single chip mode.
96
G
AD15
I/O pin for the external address/data bus (AD15). This
function is valid when the external bus is enabled.
P20 to P23
General-purpose I/O port.
You can set a pull-up resistor On/Off by setting the
register. In the external bus mode, it is enabled as a
general-purpose I/O port when the corresponding bit to
the external address output control register (HACR) is set
to "1".
97 to 100
G
A16 to A19
Output pins for the external address/data bus A16 to A19.
It is enabled as the upper address output pins (A16 to
A19) when the corresponding bit to the external address
output control register (HACR) is set to "0".
PPG9,
PPGB,
PPGD, PPGF
Output pins for PPG
FUJITSU SEMICONDUCTOR LIMITED
19
CHAPTER 1 OVERVIEW
1.5 Pin Function
MB90340E Series
Table 1.5-1 Pin Function of the MB90340E Series (3 / 8)
Pin No.
Pin name
LQFP100
*2
QFP100
*1
I/O circuit
type*3
General-purpose I/O port.
You can set a pull-up resistor On/Off by setting the
register. In the external bus mode, it is enabled as a
general-purpose I/O port when the corresponding bit to
the external address output control register (HACR) is set
to "1".
P24 to P27
99 to 2
3
4
5
1 to 4
G
A20 to A23
Output pins for the external address/data bus A20 to A23.
It is enabled as the upper address output pins (A20 to
A23) when the corresponding bit to the external address
output control register (HACR) is set to "0".
IN0 to IN3
Data sample input pins for the input capture ICU0 to
ICU3
P30
General-purpose I/O port.
You can set a pull-up resistor On/Off by setting a register.
This function becomes valid in the single chip mode.
5
G
ALE
Address latch enable output pin. This function becomes
valid when the external bus mode is enabled.
IN4
Data sample input pin for the input capture ICU4
P31
General-purpose I/O port.
You can set a pull-up resistor On/Off by setting a register.
This function becomes valid in the single chip mode.
6
G
RD
Read strobe output pin for the data bus. This function
becomes valid when the external bus is enabled.
IN5
Data sample input pin for the input capture ICU5
P32
General-purpose I/O port.
You can set a pull-up resistor On/Off by setting a register.
This function becomes valid when the single chip mode
or the WR/WRL pin output is disabled.
7
G
WRL/
WR
INT10R
20
Function
Write strobe output pin for the data bus. This function
becomes valid when the external bus or the WR/WRL
pin output is enabled. WRL is the write strobe output pin
for the data bus lower 8-bit on 16-bit access. WR is the
write strobe output pin for the data bus 8-bit on 8-bit
access.
External interrupt request input pin for INT10 (sub)
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 1 OVERVIEW
1.5 Pin Function
MB90340E Series
Table 1.5-1 Pin Function of the MB90340E Series (4 / 8)
Pin No.
Pin name
LQFP100
*2
QFP100
*1
I/O circuit
type*3
P33
6
7
8
G
WRH
P34
General-purpose I/O port.
You can set a pull-up resistor On/Off by setting a register.
This function becomes valid when the single chip mode
or the hold function is disabled.
9
G
HRQ
Hold request input pin. This function is valid when the
external bus and the hold function are enabled.
OUT4
Wave form output pin for the output compare OCU4
10
G
Hold acknowledgment output pin. This function is valid
when the external bus and the hold function are enabled.
OUT5
Wave form output pin for the output compare OCU5
11
G
11, 12
CM44-10143-5E
General-purpose I/O port.
You can set a pull-up resistor On/Off by setting a register.
This function becomes valid when the single chip mode
or the external ready function is disabled.
RDY
Ready input pin. This function becomes valid when the
external bus and external ready function are enabled.
OUT6
Wave form output pin for the output compare OCU6
P37
10
General-purpose I/O port.
You can set a pull-up resistor On/Off by setting a register.
This function becomes valid when the single chip mode
or the hold function is disabled.
HAK
P36
9
General-purpose I/O port.
You can set a pull-up resistor On/Off by setting a register.
This function becomes valid when the single chip mode,
external bus 8-bit mode or the WRH pin output is
disabled.
Write strobe output pin for the data bus upper 8-bit. This
function becomes valid when the external bus is enabled
and in the external bus 16-bit mode, and WRH pin output
is enabled.
P35
8
Function
12
G
General-purpose I/O port.
You can set a pull-up resistor On/Off by setting a register.
This function becomes valid when the single chip mode
or the CLK output is disabled.
CLK
CLK output pin. This function becomes valid when the
external bus and CLK output are enabled.
OUT7
Wave form output pin for the output compare OCU7
P40, P41
F
General-purpose I/O port (products with S-suffix)
X0A, X1A
B
Oscillation input pin for the sub clock
(products without S-suffix)
13, 14
FUJITSU SEMICONDUCTOR LIMITED
21
CHAPTER 1 OVERVIEW
1.5 Pin Function
MB90340E Series
Table 1.5-1 Pin Function of the MB90340E Series (5 / 8)
Pin No.
Pin name
LQFP100
16
*2
QFP100
*1
I/O circuit
type*3
P42
General-purpose I/O port
IN6
Data sample input pin for the input capture ICU6
18
F
RX1
INT9R
18
19
20
IN7
General-purpose I/O port
F
TX output pin for CAN1 interface
(only products with CAN2 channel)
P44
General-purpose I/O port
SDA0
H
SCL0
General-purpose I/O port
H
FRCK1
General-purpose I/O port
H
22
SDA1
P47
21
23
H
P50
23
24
25
AN8
O
25
27
Serial data input pin for UART2
P51
General-purpose I/O port
AN9
AN10
I
Analog input pin for A/D converter
Serial data output pin for UART2
General-purpose I/O port
I
Analog input pin for A/D converter
SCK2
Clock I/O pin for UART2
P53
General-purpose I/O port
AN11
TIN3
22
Analog input pin for A/D converter
SIN2
P52
26
Serial clock I/O pin for I2C1
(only products with C-suffix)
General-purpose I/O port
SOT2
24
Serial data I/O pin for I2C1 (only products with C-suffix)
General-purpose I/O port
SCL1
22
Serial clock I/O pin for I2C0
(only products with C-suffix)
Input for 16-bit free-run timer 1
P46
20
Serial data I/O pin for I2C0 (only products with C-suffix)
Input for 16-bit free-run timer 0
P45
21
Data sample input pin for the input capture ICU7
TX1
FRCK0
19
RX input pin for CAN1 interface
(only products with CAN2 channel)
External interrupt request input pin for INT10 (sub)
P43
17
Function
I
Analog input pin for A/D converter
Event input pin for the reload timer 3
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 1 OVERVIEW
1.5 Pin Function
MB90340E Series
Table 1.5-1 Pin Function of the MB90340E Series (6 / 8)
Pin No.
Pin name
LQFP100
*2
QFP100
*1
I/O circuit
type*3
P54
26
28
AN12
General-purpose I/O port
I
TOT3
29
General-purpose I/O port
I
AN13
Analog input pin for A/D converter
P56, P57
28, 29
30, 31
AN14,
AN15
General-purpose I/O port
J
Analog input pin for A/D converter
P60 to P67
General-purpose I/O port
AN0 to
AN7
34 to 41
36 to 43
PPG0,
PPG2,
PPG4,
PPG6,
PPG8,
PPGA,
PPGC,
PPGE
Analog input pin for A/D converter
I
Output pins for PPG
P70 to P77
43 to 48,
53, 54
45 to 50,
55, 56
AN16 to
AN23
General-purpose I/O port
I
INT0 to
INT7
General-purpose I/O port
TIN0
57
Event input pin for the reload timer 0
F
ADTG
Trigger input pin for A/D converter.
INT12R
External interrupt request input pin for INT12 (sub)
P81
General-purpose I/O port
TOT0
56
58
Output pin for the reload timer 0
F
CKOT
Output pin for the clock monitor
INT13R
External interrupt request input pin for INT13 (sub)
P82
General-purpose I/O port
SIN0
57
59
Serial data input for UART0
M
TIN2
INT14R
CM44-10143-5E
Analog input pin for A/D converter
(only products with C-suffix)
External interrupt request input pin for INT0 to INT7
P80
55
Analog input pin for A/D converter
Output pin for the reload timer 3
P55
27
Function
Event input pin for the reload timer 2
External interrupt request input pin for INT14 (sub)
FUJITSU SEMICONDUCTOR LIMITED
23
CHAPTER 1 OVERVIEW
1.5 Pin Function
MB90340E Series
Table 1.5-1 Pin Function of the MB90340E Series (7 / 8)
Pin No.
Pin name
LQFP100
*2
QFP100
*1
I/O circuit
type*3
P83
58
60
SOT0
General-purpose I/O port
F
TOT2
61
SCK0
General-purpose I/O port
F
INT15R
62
General-purpose I/O port
M
SIN1
Serial data input pin for UART1
P86
61
63
General-purpose I/O port
F
SOT1
Serial data output pin for UART1
P87
62
65 to 68
64
67 to 70
General-purpose I/O port
F
SCK1
Clock I/O pin for UART1
P90 to P93
General-purpose I/O port
PPG1,
PPG3,
PPG5,
PPG7
F
Output pins for PPG
P94 to P97
69 to 72
71 to 74
OUT0 to
OUT3
General-purpose I/O port
F
PA0
73
75
RX0
F
General-purpose I/O port
F
TX0
24
RX input pin for CAN0 interface.
When the CAN function is used, output from the other
functions must be stopped.
External interrupt request input pin for INT8 (sub)
PA1
76
Wave form output pins for the output compare OCU0 to
OCU3. This function becomes valid when the wave form
output is enabled.
General-purpose I/O port
INT8R
74
Clock I/O pin for UART0
External interrupt request input pin for INT15 (sub)
P85
60
Serial data output pin for UART0
Output pin for the reload timer 2
P84
59
Function
TX output pin for CAN0 interface
30
32
AVCC
K
VCC power supply input pin for the analog circuit
31
33
AVRH
L
Reference voltage input for A/D converter. Make sure
that AVCC is applied greater voltage than AVRH when
turning on and off the power supply.
32
34
AVRL
K
Lower reference voltage input for A/D converter
33
35
AVSS
K
VSS power supply input pin for the analog circuit
50, 51
52, 53
MD1,
MD0
C
Input pins for operating mode selection
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 1 OVERVIEW
1.5 Pin Function
MB90340E Series
Table 1.5-1 Pin Function of the MB90340E Series (8 / 8)
Pin No.
LQFP100
*2
QFP100
Pin name
I/O circuit
type*3
*1
Function
49
51
MD2
D
Input pin for operating mode selection
13, 63, 88
15, 65, 90
VCC
—
Power supply input pins (3.5V to 5.5 V)
14, 42, 64,
89
16, 44, 66,
91
VSS
—
Power supply input pin (0 V)
15
17
C
K
Power supply stabilization capacitor pin. Connects a
ceramic capacitor of over 0.1 μF.
*1:FPT-100P-M06
*2:FPT-100P-M20
*3: Refer to Section "1.6 I/O Circuit Type" for the I/O circuit type.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
25
CHAPTER 1 OVERVIEW
1.6 I/O Circuit Type
1.6
MB90340E Series
I/O Circuit Type
This section describes the I/O circuit types for each pin of the MB90340E series.
■ I/O Circuit Type
Table 1.6-1 I/O Circuit Type (1 / 4)
Classification
Circuit
X1
A
Remarks
Oscillation circuit
• High speed oscillation feedback
resistor = Approximately 1 MΩ
Xout
X0
Standby control signal
X1A
B
Oscillation circuit
• Low speed oscillation feedback
resistor = Approximately 10 MΩ
Xout
X0A
Standby control signal
R
C
R
D
CMOS
hysteresis
input
CMOS
hysteresis
input
Pull-down
resistor
Mask ROM product and evaluation device
• CMOS hysteresis input
Flash memory products
• CMOS input
Mask ROM product and evaluation device
• CMOS hysteresis input
• Pull-down resistor value =
Approximately 50 kΩ
Flash memory products
• CMOS input
• No pull-down
• CMOS hysteresis input
• Pull-up resistor value = Approximately
50 kΩ
Pull-up
resistor
E
R
26
CMOS
hysteresis
input
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 1 OVERVIEW
1.6 I/O Circuit Type
MB90340E Series
Table 1.6-1 I/O Circuit Type (2 / 4)
Classification
F
Circuit
P-ch
Pout
N-ch
Nout
R
CMOS hysteresis input
Remarks
• CMOS level output
(IOL = 4 mA, IOH = - 4 mA)
• CMOS hysteresis input
(with the input cut-off function on
standby)
• Automotive input
(with the input cut-off function on
standby)
Automotive input
Input cut-off
standby control
Pull-up control
P-ch
Pout
N-ch
Nout
R
G
CMOS hysteresis input
Automotive input
• CMOS level output
(IOL = 4 mA, IOH = - 4 mA)
• CMOS hysteresis input
(with the input cut-off function on
standby)
• Automotive input
(with the input cut-off function on
standby)
• TTL (with the input cut-off function on
standby)
• Pull-up resistor configurable resistor:
Approximately 50 kΩ
TTL input
Input cut-off
standby control
H
P-ch
Pout
N-ch
Nout
R
CMOS hysteresis input
• CMOS level output
(IOL = 3 mA, IOH = - 3 mA)
• CMOS hysteresis input
(with the input cut-off function on
standby)
• Automotive input
(with the input cut-off function on
standby)
Automotive input
Input cut-off
standby control
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
27
CHAPTER 1 OVERVIEW
1.6 I/O Circuit Type
MB90340E Series
Table 1.6-1 I/O Circuit Type (3 / 4)
Classification
Circuit
P-ch
Pout
N-ch
Nout
Remarks
R
CMOS hysteresis input
I
• CMOS level output
(IOL = 4 mA, IOH = - 4 mA)
• CMOS hysteresis input
(with the input cut-off function on
standby)
• Automotive input
(with the input cut-off function on
standby)
• A/D analog input
Automotive input
Input cut-off
standby control
Analog input
P-ch
Pout
N-ch
Nout
R
CMOS hysteresis input
J
Automotive input
Input cut-off
standby control
• CMOS level output
(IOL = 4 mA, IOH = - 4 mA)
• CMOS hysteresis input
(with the input cut-off function on
standby)
• Automotive input
(with the input cut-off function on
standby)
• A/D analog input
• D/A analog output
(only for the evaluation chip)
Analog input
Analog output
• Power supply input protection circuit
P-ch
K
N-ch
P-ch
L
N-ch
28
ANE
P-ch
AVR
N-ch
ANE
• With A/D converter reference voltage
input pin power supply protection
circuit.
AVRH pin in the flash memory products
does not have the protection circuit for
VCC.
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 1 OVERVIEW
1.6 I/O Circuit Type
MB90340E Series
Table 1.6-1 I/O Circuit Type (4 / 4)
Classification
M
Circuit
P-ch
Pout
N-ch
Nout
R
CMOS input
Remarks
• CMOS level output
(IOL = 4 mA, IOH = - 4 mA)
• CMOS input
(with the input cut-off function on
standby)
• Automotive input
(with the input cut-off function on
standby)
Automotive input
Input cut-off
standby control
Pull-up control
P-ch
Pout
N-ch
Nout
R
N
CMOS input
Automotive input
• CMOS level output
(IOL = 4 mA, IOH = - 4 mA)
• CMOS input
(with the input cut-off function on
standby)
• Automotive input
(with the input cut-off function on
standby)
• TTL input (with the input cut-off
function on standby)
• Pull-up resistor configurable resistor:
Approximately 50 kΩ
TTL input
Input cut-off
standby control
P-ch
Pout
N-ch
Nout
R
O
CMOS input
• CMOS level output
(IOL = 4 mA, IOH = - 4 mA)
• CMOS input
(with the input cut-off function on
standby)
• Automotive input
(with the input cut-off function on
standby)
• A/D analog input
Automotive input
Input cut-off
standby control
Analog input
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
29
CHAPTER 1 OVERVIEW
1.7 Precautions when Handling Devices
1.7
MB90340E Series
Precautions when Handling Devices
This section describes the precautions when handling the MB90340E series.
■ Precautions when Handling Devices
● Preventing latch-up
For a CMOS IC, a latch-up phenomenon may occur when:
• A voltage higher than VCC or a voltage lower than VSS is applied to the I/O pin
• A voltage that exceeds the rated voltage is applied between VCC and VSS
• Power supply for AVCC is supplied prior to the VCC voltage
Latch-up may cause a sudden increase in supply current, resulting in thermal damage to the device.
Therefore, the maximum voltage ratings must not be exceeded. By the same token, make sure that the
analog supply voltage (AVCC and AVRH) should not exceed the digital supply voltage.
● Handling unused pins
If unused input pins remain open, a malfunction or latch-up may cause permanent damage, so take
countermeasures such as pull-up or pull-down using a 2 kΩ or larger resistor. Leave unused I/O pins open
in the output state or, if left in the input state, treat them in the same manner as for input pins in use.
● Precautions when using external clock
When using an external clock, drive only the X0 (X0A) pin and open the X1 (X1A) pin.
Figure 1.7-1 Example of Using External Clock
MB90340E series
X0 (X0A)
Open
X1 (X1A)
● Precautions when not using sub clock
If an oscillator is not connected to the X0A and X1A pins, make a pull-down pin process to the X0A pin
and leave the X1A pin open.
30
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 1 OVERVIEW
1.7 Precautions when Handling Devices
MB90340E Series
● Precautions while operating PLL clock mode
If the PLL clock mode is selected on this microcontroller, it may attempt to be working with the free run
frequency of self-oscillating circuit in the PLL when the resonator is disconnected or clock input is stopped.
Performance of this operation, however, cannot be guaranteed.
● Power supply pins (VCC/VSS)
When the device is provided with multiple VCC pins and VSS pins, the pins designed to have equal
potential are internally connected to them to prevent malfunctions such as latch-up. However, be sure to
connect all of the potentially equal pins to the power supply and ground outside the device to reduce
unwanted radiation, prevent the strobe signal from malfunctioning due to a rise of ground level, and follow
the standards of total output current (See Figure 1.7-2).
The power pins should be connected to VCC and VSS of this device at the lowest possible impedance from
the current supply source.
We also recommend to connect an approximately 0.1 μF capacitor between VCC and VSS as a bypass
capacitor near the pins of this device.
Figure 1.7-2 Power Supply Pins (VCC/VSS)
Vcc
Vss
Vcc
Vss
Vss
Vcc
MB90340E
series
Vcc
Vss
Vss
Vcc
● Pull-up/pull-down resistors
The MB90340E series does not support internal pull-up/pull-down resistors
(However, only port0 to port3 have built-in pull-up resistors).
Make pull-up/pull-down pin process when needed.
● Crystal oscillation circuit
Noise near the X0 and X1 pins may cause this device to malfunction. Place the X0 and X1 pins, the crystal
(or ceramic) oscillator, and the bypass capacitor leading to the ground as close to one another as possible
and prevent the wiring patterns for the crystal oscillator from crossing other wiring as much as possible.
For stable operation, the printed circuit board is strongly recommended to have the artwork with the X0 and
X1 pins enclosed by a ground line. Please ask the crystal maker to evaluate the oscillational characteristics
of the crystal and this device.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
31
CHAPTER 1 OVERVIEW
1.7 Precautions when Handling Devices
MB90340E Series
● Serial Communication
There is a possibility to receive wrong data due to the noise or other causes on the serial communication.
Therefore, design a printed circuit board so as to avoid noise. Retransmit the data if an error occurs because
of applying the checksum to the last data in consideration of receiving wrong data due to the noise.
● Procedure of A/D converter/analog input power-on
Always apply the A/D converter power (AVCC, AVRH and AVRL) and the analog input (AN0 to AN23)
after the digital power (VCC) is turned on. Always turn off the A/D converter power and the analog input
before the digital power is turned down. Make sure that AVRH should not exceed AVCC at turn on or off.
● Unused pin processing of A/D converter
When not using the A/D converter, the pins should be connected so that AVCC = VCC, AVSS = AVRH =
AVRL = VSS.
● Precautions at power on
To prevent a malfunction of the internal step-down circuit, the voltage rising time at power-on should be
50 μs or more (0.2V to 2.7 V).
● Stabilization of supplied voltage
A sudden change in the supply voltage may cause the device to malfunction even within the specified VCC
supply voltage operating range. Therefore, the VCC supply voltage should be stabilized.
For stabilization reference, the supply voltage should be controlled so that VCC ripple variations (peak-topeak values) at commercial frequencies (50Hz to 60Hz) fall below 10% of the standard VCC supply voltage
and the transient fluctuation rate does not exceed 0.1 V/ms in the momentary fluctuation, such as switching
the power supply.
● Output of port0 to port3 when turning on the power supply (external bus mode)
Note that the output signals of port0 to port3 may become unstable when turning on the power supply in the
external bus mode (See Figure 1.7-3).
32
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 1 OVERVIEW
1.7 Precautions when Handling Devices
MB90340E Series
Figure 1.7-3 Output Between Port0 and Port3 When Power is On
VDD 5
VDD 3
Port 0 to Port 3
Output between port0
and port3 can be
unstable
Output between port0 and
port3 = Hi-Z
● Note on using CAN Function
Required settings of the clock modulator and CAN direct mode are shown in Table 1.7-1.
Table 1.7-1 Setting of the Clock Modulation and CAN Direct Mode
Setting of the clock
modulation
(CMCR: PMOD bit)
Setting of CAN direct mode
(CDMR: DIRECT bit)
Clock modulator disabled
0: Disabled the clock modulation
(Initial state)
1: Enabled the CAN direct mode
Clock modulator enabled
1: Enabled the clock modulation
0: Disabled the CAN direct mode
(Initial state)
Note: Do not use clock modulator, CAN and μDMAC at the same time. If CAN and μDMAC are used at
the same time, make sure that the DIRECT bit in CAN direct mode register CDMR is set to "1". For
details on clock modulation, see "CHAPTER 28 CLOCK MODULATOR". For details on the CAN
direct mode, see Section "22.13 CAN Direct Mode Register (CDMR)".
● Flash security function (except for MB90F346E)
Security bit is placed in the flash memory area. When you write the protecting code "01H" into the security
bit, the security function is enabled. If you don't use this function, don't write "01H" into the address.
Refer to the following table for the security bit address.
CM44-10143-5E
Flash memory size
Security bit address
MB90F347E
Embedded 1 Mbit Flash Memory
FE0001H
MB90F342E,
MB90F349E
Embedded 2 Mbit Flash Memory
FC0001H
MB90F345E
Embedded 4 Mbit Flash Memory
F80001H
FUJITSU SEMICONDUCTOR LIMITED
33
CHAPTER 1 OVERVIEW
1.7 Precautions when Handling Devices
MB90340E Series
● Characteristic difference among products with different memory size and between flash
memory product and mask ROM product
Among products with different memory size and between flash memory product and mask ROM product, the
electrical characteristic including the current consumption, ESD, latch-up, the noise characteristic, and the
oscillation characteristic, etc. is different because of their chip layout and memory structure.
Reevaluate the electrical specification when another product of the same series is replaced.
34
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 2
CPU
This chapter explains the setting and operation of the
CPU.
2.1 Overview of the CPU
2.2 Memory Space
2.3 Linear Addressing
2.4 Bank Addressing
2.5 Multibyte Data in Memory Space
2.6 Registers
2.7 Register Bank
2.8 Prefix Codes
2.9 Interrupt Disable Instructions
Code: CM44-00101-3E
Page: 36, 36
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
35
CHAPTER 2 CPU
2.1 Overview of the CPU
2.1
MB90340E Series
Overview of the CPU
The F2MC-16LX CPU core is a 16-bit CPU designed for applications that require highspeed real-time processing, such as consumer or vehicle-mounted equipments. The
F2MC-16LX instruction set is designed for controller applications, and is capable of
high-speed, highly efficient control processing.
■ Overview of the CPU
In addition to 16-bit data, the F2MC-16LX CPU core can process 32-bit data using an internal 32-bit
accumulator. Up to 16Mbytes of memory space can be used, which can be accessed by either the linear
pointer or bank method. The instruction set, based on the F2MC-8L A-T architecture, has been reinforced
by adding instructions compatible with high-level languages, expanding addressing modes, reinforcing
multiplication and division instructions, and enhancing bit processing.
The features of the F2MC-16LX CPU are explained below:
● Minimum execution time
• 41.7ns (at machine clock 24MHz)
● Maximum memory space
16Mbytes, accessed in linear or bank method
● Instruction set optimized for controller applications
• Rich data types:
Bit, byte, word, long word
• Extended addressing modes: 23 types
• Reinforced high-precision operation (32-bit length) with 32-bit accumulator
● Powerful interrupt function
8 priority levels (programmable)
● CPU-independent automatic transfer function
• Up to 16 channels of the extended intelligent I/O service (EI2OS)
• Up to 16 channels of the DMA transfer (μDMAC)
● Instruction set for high-level language (C language)/multitask
System stack pointer/instruction set symmetry/barrel-shift instructions
● Higher execution speed
4-byte queue
36
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 2 CPU
2.2 Memory Space
MB90340E Series
2.2
Memory Space
F2MC-16LX CPU has the memory space of 16Mbytes.
■ Overview of CPU Memory Space
A CPU has 16Mbytes of memory space where all data program I/Os managed by the F2MC-16LX CPU are
located. The CPU accesses the resources by indicating their addresses using a 24-bit address bus.
Figure 2.2-1 shows a sample relationship between the F2MC-16LX system and memory map.
Figure 2.2-1 Sample Relationship between F2MC-16LX System and Memory Map
F2MC-16LX device
FFFFFFH
FFFC00H
Programs
FF0000H*1
Vector table area
ROM area
Program area
100000H
External area*3
010000H
008000H
ROM area
(FF bank image)
2
F MC-16LX
CPU
Internal Data Bus
Peripheral circuits
I/O area
007900H
001900H*2
Data
EI2OS
000380H
000180H
000100H
Data area
General-purpose registers
RAM area
EI 2OS
descriptor area
External area*3
Peripheral circuits
Interrupts
0000F0H
0000C0H
0000B0H
Peripheral circuits
General-purpose
ports
000020H
000000H
Peripheral function
control register area
Interrupt control
register area
Peripheral function
control register area
I/O port control
register area
I/O area
*1: The size of the built-in ROM varies depending on the model.
*2: The size of the built-in RAM varies depending on the model.
*3: Access is not possible in single chip mode.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
37
CHAPTER 2 CPU
2.2 Memory Space
MB90340E Series
■ ROM Area
● Vector table area (address: FFFC00H to FFFFFFH)
• This area is used as a vector table for the reset, interrupt, and CALLV vectors.
• This area is allocated at the highest addresses of the ROM area. The start address of the corresponding
processing routine is set as data in each vector table address.
● Program area (address: Up to FFFBFFH)
• ROM is built in as an internal program area.
• The size of internal ROM varies depending on the model.
■ RAM Area
● Data area (address: 000100H to 0018FFH (for 6Kbytes))
• The static RAM is built in as an internal data area.
• The size of internal RAM varies depending on the model.
● General-purpose register area (address: 000180H to 00037FH)
• Auxiliary registers, used for 8-bit, 16-bit, and 32-bit arithmetic operations and transfer, are allocated in
this area.
• Since this area is allocated to a part of the RAM area, it can be used as ordinary RAM.
• When this area is used as a general-purpose register, general-purpose register addressing enables high
speed access with short instructions.
● Extended intelligent I/O service (El2OS) descriptor area (address: 0000100H to 00017FH)
• This area retains the transfer modes, I/O addresses, transfer count, and buffer addresses.
• Since this area is allocated to a part of the RAM area, it can be used as ordinary RAM.
■ I/O Area
● Interrupt control register area (address: 0000B0H to 0000BFH)
The interrupt control registers (ICR00 to ICR15) support all peripheral functions that have an interrupt
function, and perform the interrupt levels setting and the control of the extended intelligent I/O service
(EI2OS).
● Peripheral function control register area
(address: 000020H to 0000AFH, 0000C0H to 0000EFH, and 007900H to 007FFFH)
This register controls the peripheral functions and inputs/outputs of data.
● I/O port control register area (address: 000000H to 00001FH)
This register controls I/O ports, and inputs/outputs of data.
38
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 2 CPU
2.2 Memory Space
MB90340E Series
■ Address Generation Methods
The F2MC-16LX has the following two addressing methods:
● Linear addressing
An 24-bit address is specified by an instruction.
● Bank addressing
Upper 8-bit of an address are specified by an appropriate bank register, and the remaining lower 16-bit of
an address are specified by an instruction.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
39
CHAPTER 2 CPU
2.3 Linear Addressing
2.3
MB90340E Series
Linear Addressing
There are two types of linear addressing:
• 24-bit operand specification
• 32-bit register indirect specification
■ 24-bit Operand Specification
It is a method to specify a 24-bit address directly by the operand.
Figure 2.3-1 shows the example of the linear method (24-bit operand specification).
Figure 2.3-1 Example of Linear Method (24-bit Operand Specification)
JMPP 123456H
17452DH
Old program counter
17
program bank
452D
JMPP 123456H
123456H
Next instruction
New program counter
12
program bank
3456
■ 32-bit Register Indirect Specification
It is a method to use the lower 24-bit of a 32-bit general-purpose register (RLi) as the address.
Figure 2.3-2 shows the example of the linear method (32-bit register indirect specification).
Figure 2.3-2 Example of Linear Method (32-bit Register Indirect Specification)
MOV A,@RL1+7
Old
AL
090700H
XXXX
3AH
7
RL1
240906F9H
(The upper 8-bit are ignored)
New
40
AL
003A
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
MB90340E Series
2.4
Bank Addressing
CHAPTER 2 CPU
2.4 Bank Addressing
In the bank method, the 16 M byte space is divided into 256 of 64 K byte banks. The
following five bank registers are used to specify the banks corresponding to each
space:
• Program counter bank register (PCB)
• Data bank register (DTB)
• User stack bank register (USB)
• System stack bank register (SSB)
• Additional data bank register (ADB)
■ Bank Addressing
● Program counter bank register (PCB)
The 64Kbyte bank specified by the program counter bank register (PCB) is called a program (PC) space.
The PC space typically contains instruction codes, vector tables, and immediate data.
● Data bank register (DTB)
The 64Kbyte bank specified by the data bank register (DTB) is called a data (DT) space. The DT space
typically contains readable/ writable data, and control/data registers for internal and external resources.
● User stack bank register (USB) and System stack bank register (SSB)
The 64Kbyte bank specified by the user stack bank register (USB) or system stack bank register (SSB) is
called a stack (SP) space. The SP space is accessed when a stack access occurs during a push/pop
instruction or interrupt register saving. The stack flag (S) in the condition code register determines which
stack space is to be accessed.
● Additional data bank register (ADB)
The 64Kbyte bank specified by the Additional data bank register (ADB) is called an additional (AD) space.
The AD space typically contains data that cannot fit into the data (DT) space.
■ Bank Addressing and Default Space
Table 2.4-1 lists the default spaces used in each addressing mode, which are pre-determined to improve
instruction coding efficiency. To use a non-default space for an addressing mode, specify a prefix code
corresponding to a bank before the instruction. This enables access to the bank space corresponding to the
specified prefix code.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
41
CHAPTER 2 CPU
2.4 Bank Addressing
MB90340E Series
Table 2.4-1 Default Space
Default space
Addressing
Program space
PC indirect, program access, branch
Data space
@A, addr16, dir, and addressing using @RW0, @RW1, @RW4, or @RW5
Stack space
Addressing using PUSHW, POPW, @RW3, or @RW7
Additional space
Addressing using @RW2 or @RW6
The example of the physical address of the memory space divided into the register bank is shown in Figure
2.4-1.
Figure 2.4-1 The Example of Physical Addresses of Each Space
FFFFFFH
Program space
FF0000H
FFH
: PCB (Program counter bank register)
B3H
: ADB (Additional data bank register)
92H
: USB (User stack bank register)
B3FFFFH
Additional space
Physical address
B30000H
92FFFFH
User stack space
920000H
68FFFFH
Data space
680000H
68H
: DTB (Data bank register)
4BFFFFH
System stack space
4B0000H
4BH
: SSB (System stack bank register)
000000H
■ Initial Value of Bank Register
By resetting, the DTB, USB, SSB, and ADB are initialized to 00H. The PCB is initialized to a value
specified by the reset vector. After reset, the DT, SP, and AD spaces are allocated in bank 00H (000000H to
00FFFFH), and the PC space is allocated in the bank specified by the reset vector.
42
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 2 CPU
2.5 Multibyte Data in Memory Space
MB90340E Series
2.5
Multibyte Data in Memory Space
Multibyte data is allocated from the low-order addresses to the high-order addresses in
the memory space in the order from the byte in LSB to the byte in MSB.
■ Multibyte Data Allocation in Memory Space
Data is written to memory from the low-order addresses. Therefore, for a 32-bit data item, the lower 16 bits
are transferred before the upper 16 bits.
If a reset signal is input immediately after the lower bits are written, the upper bits might not be written.
Figure 2.5-1 shows a sample allocation of multibyte data in memory. The lower 8 bits of a data item are
stored at address n, then address n+1, address n+2, address n+3, etc.
Figure 2.5-1 Sample Allocation of Multibyte Data in Memory
High-order
addresses
MSB
01010101B
n+3
01010101B
n+2
11001100B
n+1
11111111B
n
00010100B
LSB
11001100B
11111111B
00010100B
low-order
addresses
■ Accessing Multibyte Data
Basically, all accesses are made within a bank. For an instruction accessing a multibyte data item, the next
address of FFFFH location is 0000H location of the same bank. Figure 2.5-2 shows an example of an
instruction accessing multibyte data.
Figure 2.5-2 Example of Accessing Multibyte Data
High-order
addresses
AL before execution
80FFFFH
??
01H
·
·
·
800000H
??
23H
Execution of "MOVW A, 080FFFFH"
AL after execution
23H
01H
low-order
addresses
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
43
CHAPTER 2 CPU
2.6 Registers
2.6
MB90340E Series
Registers
The F2MC-16LX registers are largely classified into two types: dedicated registers and
general-purpose registers.
The dedicated registers exist as dedicated internal hardware of the CPU, and they have
specific use defined by the CPU architecture.
The applications of the general-purpose registers can be specified by the user, as is
ordinary memory space. Sharing the CPU address space with RAM, the generalpurpose registers are the same as the dedicated registers in that they can be accessed
without using an address.
■ Dedicated Registers
The F2MC-16LX CPU core has the following 11 dedicated registers:
• Accumulator (A=AH: AL)
: 2 × 16-bit accumulators
(Can be used as a single 32-bit accumulator.)
• User stack pointer (USP)
: 16-bit pointer indicating the user stack area
• System stack pointer (SSP)
: 16-bit pointer indicating the system stack area
• Processor status (PS)
: 16-bit register indicating the system status
• Program counter (PC)
: 16-bit register containing the address where the program is
stored
• Program counter bank register (PCB) : 8-bit register indicating the PC space
• Data bank register (DTB)
: 8-bit register indicating the DT space
• User stack bank register (USB)
: 8-bit register indicating the user stack space
• System stack bank register (SSB)
: 8-bit register indicating the system stack space
• Additional data bank register (ADB) : 8-bit register indicating the AD space
• Direct page register (DPR)
: 8-bit register indicating a direct page
Figure 2.6-1 shows the configuration of the dedicated registers.
44
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 2 CPU
2.6 Registers
MB90340E Series
Figure 2.6-1 Dedicated Resisters
AH
AL
Accumulator
USP
User stack pointer
SSP
System stack pointer
PS
Processor status
PC
Program counter
DPR
Direct page register
PCB
Program counter bank register
DTB
Data bank register
USB
User bank register
SSB
System stack bank register
ADB
Additional data bank register
8 bits
16 bits
32 bits
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
45
CHAPTER 2 CPU
2.6 Registers
MB90340E Series
■ General-purpose Registers
As described in Figure 2.6-2, the F2MC-16LX general-purpose registers are located from 000180H to
00037FH (maximum configuration) of main storage. The register bank pointer (RP) indicates which of the
above addresses is currently being used as a register bank. Each bank has the following three types of
registers. These registers are mutually dependent and have a relationship as shown below:
• R0 to R7
: 8-bit general-purpose registers
• RW0 to RW7 : 16-bit general-purpose registers
• RL0 to RL3
: 32-bit general-purpose registers
Figure 2.6-2 General-purpose Registers
MSB
LSB
16 bits
000180H RP × 10 H
RW0
Lower
RL0
Starting address of general-purpose register
RW1
RW2
RL1
RW3
R1
R0
RW4
R3
R2
RW5
R5
R4
RW6
R7
R6
RW7
RL2
RL3
Upper
The relationship between the upper/lower bytes of a byte or word register is expressed as follows:
RW(i+4)=R(i × 2+1) × 256 + R(i × 2) [i=0 to 3]
The relationship between the upper/lower bytes of RLi and RW is expressed as follows:
RL(i)=RW(i × 2+1) × 65536 + RW(i × 2) [i=0 to 3]
46
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 2 CPU
2.6 Registers
MB90340E Series
2.6.1
Accumulator (A)
The accumulator (A) consists of 2 × 16-bit arithmetic operation registers (AH and AL),
and is used as a temporary register for operation results and transfer data.
■ Accumulator (A)
During 32-bit data processing, AH and AL are used together (see Figure 2.6-3). Only AL is used for word
processing in 16-bit data processing mode or for byte processing in 8-bit data processing mode (see Figure
2.6-4). The data stored in the accumulator (A) can be operated upon with the data in memory or registers
(Ri, RWi, and RLi). In the same manner as with the F2MC-8L, when a word or shorter data item is
transferred to AL, the previous data item in AL is automatically sent to AH (data preservation function).
The data preservation function and operation between AL and AH help improve processing efficiency.
When a byte or shorter data item is transferred to AL, the data is sign-extended or zero-extended and stored
as a 16-bit data item in AL. The data in AL can be handled either as word or byte long.
When a byte-processing arithmetic operation instruction is executed on AL, the upper 8 bits of AL before
operation are ignored. The upper 8 bits of the operation result all become "0". The accumulator (A) is not
initialized by a reset and holds an undefined value right after the reset.
Figure 2.6-3 and Figure 2.6-4 show the processing of 32-bit data transfer and AL to AH transfer, respectively.
Figure 2.6-3 An Example of 32-bit Data Transfer
MOVL A,@RW1+6
A before
execution
XXXXH
MSB
XXXXH
8F74H
8FH
74H
A6153EH
2BH
52H
15H
38H
+6
2B52H
AH
A61540H
A6H
DTB
A after
execution
LSB
RW1
AL
Figure 2.6-4 An Example of AL to AH Transfer
MSB
MOVW A,@RW1+6
A before
execution
XXXXH
1234H
DTB
A6H
LSB
A61540H
8FH
74H
A6153EH
2BH
52H
15H
38H
+6
A after
execution
CM44-10143-5E
1234H
2B52H
RW1
FUJITSU SEMICONDUCTOR LIMITED
47
CHAPTER 2 CPU
2.6 Registers
2.6.2
MB90340E Series
User Stack Pointer (USP) and
System Stack Pointer (SSP)
User stack pointer (USP) and system stack pointer (SSP) are 16-bit registers that
indicate the memory addresses for saving/restoring data when a push/pop instruction
or subroutine is executed.
■ User Stack Pointer (USP) and System Stack Pointer (SSP)
User stack pointer (USP) and system stack pointer (SSP) registers are used by the stack instructions.
However, the USP register is enabled when the stack flag (S) in the processor status (PS) is "0", and the
SSP register is enabled when the S flag is "1" (see Figure 2.6-5). Since the S flag is set when an interrupt is
accepted, register values are always saved in the memory area indicated by SSP during interrupt
processing. SSP is used for stack processing in an interrupt routine, while USP is used for stack processing
other than in an interrupt routine. If you do not need to divide the stack space, use only the SSP.
During stack processing, the upper 8 bits of an address are indicated by SSB (for SSP) or USB (for USP).
USP and SSP are not initialized by a reset. Instead, they hold undefined values.
Figure 2.6-5 shows the relationship between the stack manipulation instructions and the stack pointers when
the stack flag (S) is "0" or "1".
Figure 2.6-5 Stack Manipulation Instruction and Stack Pointer
Example of PUSHW A when the S flag is "0"
Before
execution
AL
S flag
After
execution
AL
S flag
MSB
C6F326H
LSB
A624 H
USB
C6H
USP
F328H
0
SSB
56H
SSP
1234H
A624 H
USB
C6H
USP
F326H
0
SSB
56H
SSP
1234H
C6F326H
A6H
24H
561232H
XX
XX
561232H
A6H
24H
XX
XX
System stack is used
because the S flag is "0".
Example of PUSHW A when the S flag is "1"
AL
S flag
AL
S flag
48
A624 H
USB
C6H
USP
F328H
1
SSB
56H
SSP
1234H
A624 H
USB
C6H
USP
F328H
1
SSB
56H
SSP
1232H
System stack is used
because the S flag is "1".
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 2 CPU
2.6 Registers
MB90340E Series
Note:
When you specify a value to be set in the stack pointer, use an even-numbered address whenever
possible. If an odd-numbered address is set, the word access is divided into two times. Therefore,
the processing efficiency decreases.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
49
CHAPTER 2 CPU
2.6 Registers
2.6.3
MB90340E Series
Processor Status (PS)
The processor status (PS) register consists of the bits controlling the CPU operation
and the bits indicating the CPU status.
■ Processor Status (PS)
As shown in Figure 2.6-6, the upper bytes of the PS register consist of the register bank pointers (RP) and
the interrupt level mask (ILM) that indicate the starting address of a register bank. The lower bytes of the
PS register consist of the condition code register (CCR), containing the flags to be set or reset depending on
the results of instruction execution or interrupt occurrences.
Figure 2.6-6 Processor Status (PS) Structure
bit
15
13
PS
12
8
ILM
7
0
RP
CCR
■ Condition Code Register (CCR)
Figure 2.6-7 shows the structure of the condition code register.
Figure 2.6-7 Structure of Condition Code Register (CCR)
bit
Initial value
7
6
5
4
3
2
1
0
-
I
S
T
N
Z
V
C
-
0
1
*
*
*
*
*
: CCR
* : Undefined value
● Interrupt enable flag (I)
Interrupts other than software interrupts are enabled when the I flag is "1", and are disabled when the I flag
is "0". The I flag is cleared to "0" by a reset.
● Stack flag (S)
When the S flag is "0", USP is enabled as the stack manipulation pointer. When the S flag is "1", SSP is
enabled as the stack manipulation pointer. The S flag is set to "1" by an interrupt reception or a reset.
● Sticky bit flag (T)
"1" is set in the T flag when there is one or more "1" in the data shifted out from the carry after execution of
a logical right/arithmetic right shift instruction. Otherwise, "0" is set in the T flag.
● Negative flag (N)
The "1" is set in the N flag when the MSB of the operation result is "1". Otherwise, N flag is cleared to "0".
50
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 2 CPU
2.6 Registers
MB90340E Series
● Zero flag (Z)
The Z flag is set to "1" when the operation result is all "0". Otherwise, Z flag is cleared to "0".
● Overflow flag (V)
The V flag is set when an overflow of a signed value occurs as a result of operation execution. In other
cases, V flag is cleared to "0".
● Carry flag (C)
The C flag is set when a carry-up or carry-down from the MSB occurs as a result of operation execution. In
other cases, C flag is cleared to "0".
■ Register Bank Pointer (RP)
As shown in Figure 2.6-8, the register bank pointer (RP) register indicates the relationship between the
general-purpose registers of the CPU and the internal RAM addresses where the general-purpose registers
exist. Specifically, the RP register indicates the starting memory address of the currently used register bank
in the following conversion expression: [00180H + (RP) × 10H]. The RP register that consists of five bits
can take a value between 00H and 1FH and allocate the register banks at addresses from 000180H to
00037FH in the memory. Even within that range, however, the register banks cannot be used as generalpurpose registers if the banks are not in internal RAM. All RP registers are initialized to "0" by a reset. An
instruction may transfer an 8-bit immediate value to the RP register but, only the lower 5 bits of that data
are used.
Figure 2.6-8 Register Bank Pointer (RP)
Initial value
B4
B3
B2
B1
B0
0
0
0
0
0
: RP
■ Interrupt Level Mask (ILM)
As described in Figure 2.6-9, the interrupt level mask (ILM) consists of 3 bits, indicating the CPU interrupt
masking level. Only an interrupt request of which interrupt level is higher than that indicated by these 3 bits
will be accepted. Level 0 is the highest priority interrupt, and level 7 is the lowest priority interrupt (see
Table 2.6-1). Therefore, for an interrupt to be accepted, its level value must be smaller than the current ILM
value. When an interrupt is accepted, the level value of that interrupt is set in ILM. Thus, a subsequent
interrupt of the same or lower level cannot be accepted. All ILMs are initialized to "0" by a reset. An
instruction may transfer an 8-bit immediate value to the ILM register, but only the lower 3 bits of that data
are used.
Figure 2.6-9 Interrupt Level Mask (ILM)
Initial value
CM44-10143-5E
ILM2
ILM1
ILM0
0
0
0
: ILM
FUJITSU SEMICONDUCTOR LIMITED
51
CHAPTER 2 CPU
2.6 Registers
MB90340E Series
Table 2.6-1 Levels Indicated by the Interrupt Level Mask (ILM)
52
ILM2
ILM1
ILM0
Level value
Acceptable interrupt level
0
0
0
0
Interrupts disabled
0
0
1
1
Level value less than 1 (0 only)
0
1
0
2
Level value less than 2 (0 and 1)
0
1
1
3
Level value less than 3 (0, 1 and 2)
1
0
0
4
Level value less than 4 (0, 1, 2 and 3)
1
0
1
5
Level value less than 5 (0, 1, 2, 3 and 4)
1
1
0
6
Level value less than 6 (0, 1, 2, 3, 4 and 5)
1
1
1
7
Level value less than 7 (0, 1, 2, 3, 4, 5 and 6)
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 2 CPU
2.6 Registers
MB90340E Series
2.6.4
Program Counter (PC)
Program counter (PC) shows lower 16-bit of the memory address of the instruction code
that CPU should execute.
■ Program Counter (PC)
The program counter (PC) register is a 16-bit counter that indicates the lower 16 bits of the memory
address of an instruction code to be executed by the CPU. The upper 8 bits of the address are indicated by
the PCB. The PC register is updated by a conditional branch instruction, subroutine call instruction,
interrupt, or reset. The PC register can also be used as a base pointer for operand access.
Figure 2.6-10 shows the program counter.
Figure 2.6-10 Program Counter
PCB
FEH
PC
ABCDH
Next instruction to be executed
FEABCDH
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
53
CHAPTER 2 CPU
2.6 Registers
2.6.5
MB90340E Series
Bank Registers (PCB, DTB, USB, SSB, ADB)
The bank register shows the memory bank where the program space, the data space,
the user stack space, the system stack space, and the Additional space are arranged.
■ Bank Registers (PCB, DTB, USB, SSB, ADB)
The bank registers includes the following five registers.
•
Program Count Bank Register (PCB) <Initial Value: Value in Reset Vector>
•
Data bank register (DTB) < Initial value: 00H >
•
User stack bank register (USB) < Initial value: 00H >
•
System stack bank register (SSB) < Initial value: 00H >
•
Additional data bank register (ADB) < Initial value: 00H >
Each bank register indicates memory banks to which PC, DT, SP (user), SP (system), and AD space are
allocated.
All bank registers has a length of 1 byte. They are initialized to 00H by a reset. Bank registers other than
PCB can be read and written. PCB can only be read.
PCB is updated either when the JMPP, CALLP, RETP, RETI, or RETF instruction that branches is
executed, and it may then branch to an entire 16-M bytes space. PCB is also updated when an interrupt
occurs. For information on the operation of each register, see Section "2.2 Memory Space".
54
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 2 CPU
2.6 Registers
MB90340E Series
2.6.6
Direct Page Register (DPR)
This section explains the direct page register (DPR) functions.
■ Direct Page Register (DPR) <Initial Value: 01H>
The direct page register (DPR) specifies, as shown in Figure 2.6-11, addresses 8 to 15 of an instruction
operand in the direct addressing mode. DPR has a length of 8 bits, and is initialized to 01H by a reset. It
also allows reading and writing by instructions.
Figure 2.6-11 illustrates the generation of a physical address in the direct addressing mode.
Figure 2.6-11 Generating a Physical Address in Direct Addressing Mode
DTB register
DPR register
MSB
Direct address in instruction
LSB
24-bit physical address
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
55
CHAPTER 2 CPU
2.7 Register Bank
2.7
MB90340E Series
Register Bank
A register bank that consists of 8 words can be used as the general-purpose registers
for the arithmetic operations or as the pointers for the instructions, such as byte
registers (R0 to R7), word registers (RW0 to RW7), and long word registers (RL0 to RL3).
In addition, RL0 to RL3 can also be used as the linear pointers to access directly to the
entire space in the memory space.
■ Register Bank
Table 2.7-1 lists the register functions. Table 2.7-2 shows the relationship between each register.
In the same manner as for an ordinary RAM area, the register bank values are not initialized by a reset. The
status before a reset is maintained. When the power is turned-on, however, the register bank will have an
undefined value.
Table 2.7-1 Register Functions
Used as operands of instructions.
Note: R0 is also used as a counter for barrel shift or normalization instruction
R0 to R7
RW0 to RW7
Used as pointers and operands of instructions.
Note: RW0 is used as a counter for string instructions.
RL0 to RL3
Used as long pointers and operands of instructions.
Table 2.7-2 Relationship between Registers
Address
Byte register
000180H + RP × 10H + 0
Long word register
RW0
000180H + RP × 10H + 1
RL0
000180H + RP × 10H + 2
RW1
000180H + RP × 10H + 3
000180H + RP × 10H + 4
RW2
000180H + RP × 10H + 5
RL1
000180H + RP × 10H + 6
RW3
000180H + RP × 10H + 7
56
Word register
000180H + RP × 10H + 8
R0
000180H + RP × 10H + 9
R1
000180H + RP × 10H + 10
R2
000180H + RP × 10H + 11
R3
000180H + RP × 10H + 12
R4
000180H + RP × 10H + 13
R5
000180H + RP × 10H + 14
R6
000180H + RP × 10H + 15
R7
RW4
RL2
RW5
RW6
RL3
RW7
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 2 CPU
2.8 Prefix Codes
MB90340E Series
2.8
Prefix Codes
Placing a prefix code before an instruction can partially change the operation of the
instruction. 3 types of prefix codes can be used: bank select prefix, common register
bank prefix, and flag change disable prefix.
■ Bank Select Prefix
The memory space used for accessing data depends on each addressing mode. When a bank select prefix is
placed before an instruction, the memory space used for accessing data by that instruction can be selected
regardless of the addressing mode.
Table 2.8-1 shows the bank select prefixes and selected memory spaces.
Table 2.8-1 Bank Select Prefix
Bank select prefix
Selected space
PCB
PC space
DTB
Data space
ADB
AD space
SPB
Either the SSP or USP space is used according to the stack flag (S) value.
In using the following instructions, the effect of prefix codes is different:
• String instructions
MOVS
MOVSW
SCEQ
SCWEQ
FILS
FILSW
The bank register specified by an operand is used regardless of the prefix.
• Stack manipulation instructions
PUSHW
POPW
SSB or USB is used according to the stack flag (S) regardless of the prefix.
I/O access instructions
MOV A,io
MOVW io,A
MOVB io:bp,A
BBS io:bp,rel
MOV io,A
MOV io,#imm8
SETB io:bp
WBTC
MOVX A,io
MOVW io,#imm16
CLRB io:bp
WBTS
MOVW A,io
MOVB A,io:bp
BBC io:bp,rel
The I/O space of the bank is used regardless of the prefix.
• Flag change instructions
AND CCR,#imm8
OR CCR,#imm8
The instruction is executed normally, but the prefix affects the next instruction.
• Other control instructions (Stack manipulation)
POPW PS
Either SSB or USB is used according to the stack flag (S) regardless of the prefix. The prefix affects the
next instruction.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
57
CHAPTER 2 CPU
2.8 Prefix Codes
MB90340E Series
• Other control instructions (Interrupt control)
MOV ILM,#imm8
The instruction is executed normally, but the prefix affects the next instruction.
• Branch instructions
RETI
SSB is used regardless of the prefix.
■ Common Register Bank Prefix (CMR)
To simplify data exchange between multiple tasks, the same register bank must be accessed regardless of
the register pointer (RP) value. When the common register bank prefix (CMR) is placed before an
instruction that accesses the register bank, that instruction accesses the common bank (the register bank
selected when RP=0) at addresses from 000180H to 00018FH regardless of the current RP value.
In using the following instructions, the effect of prefix codes is different:
• String instructions
MOVS
MOVSW
SCEQ
SCWEQ
FILS
FILSW
If an interrupt request occurs during execution of a string instruction with a prefix code, the string
instruction is executed falsely because the prefix becomes invalid for the string instruction after the
interrupt is returned. Do not attach CMR prefix to any of the above string instructions.
• Other control instructions (Flag change)
AND CCR,#imm8
OR CCR,#imm8
POPW PS
The instruction is executed normally, but the prefix affects the next instruction.
• Other control instructions (Interrupt control)
MOV ILM,#imm8
The instruction is executed normally, but the prefix affects the next instruction.
■ Flag Change Disable Prefix (NCC)
To disable a flag change, use the flag change disable prefix code (NCC). Placing NCC before an instruction
that disables an unwanted flag change can disable flag changes associated with that instruction.
In using the following instructions, the effect of prefix codes is different:
• String instructions
MOVS
MOVSW
SCEQ
SCWEQ
FILS
FILSW
If an interrupt request occurs during execution of a string instruction with a prefix code, the string
instruction is executed falsely because the prefix becomes invalid for the string instruction after the
interrupt is returned. Do not attach NCC prefix to any of the above string instructions.
• Flag change instructions
AND CCR,#imm8
OR CCR,#imm8
POPW PS
The instruction is executed normally, but the prefix affects the next instruction.
• Interrupt instructions
INT #vct8 / INT9
INT addr16
INTP addr24
RETI
CCR changes according to the instruction specifications regardless of the prefix.
58
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 2 CPU
2.8 Prefix Codes
MB90340E Series
• Other control instructions (Switch of tasks)
JCTX @A
CCR changes according to the instruction specifications regardless of the prefix.
• Other control instructions (Interrupt control)
MOV ILM, #imm8
The instruction is executed normally, but the prefix affects the next instruction.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
59
CHAPTER 2 CPU
2.9 Interrupt Disable Instructions
2.9
MB90340E Series
Interrupt Disable Instructions
Interrupt requests are not accepted about following 10 instructions:
MOV ILM, #imm8
AND CCR, #imm8
PCB
ADB
SPB
CMR
OR CCR, #imm8
POPW PS
NCC
DTB
■ Interrupt Disable Instructions
As shown in Figure 2.9-1, if a valid hardware interrupt request occurs during execution of any of the above
instructions, the interrupt can be processed only when an instruction other than the above is executed.
Figure 2.9-1 Interrupt Disable Instructions
Interrupt disable instructions
••••••••
•••
(a)
(a) : Ordinary instruction
Interrupt request generated
Interrupt accepted
■ Restrictions on Interrupt Disable Instructions and Prefix Instructions
As shown in Figure 2.9-2, when a prefix code is placed before an interrupt disable instruction, the prefix
code affects the first instruction after the code other than the interrupt disable instruction.
Figure 2.9-2 Interrupt Disable Instructions and Prefix Codes
Interrupt disable instructions
MOV A, FFH
NCC
••••
MOV ILM,#imm8
ADD A,01H
CCR:XXX10XXB
CCR:XXX10XXB
CCR does not change with NCC.
■ Consecutive Prefix Codes
As shown in Figure 2.9-3, when competitive prefix codes are placed consecutively, the latter one becomes
valid.
Competitive prefix codes are PCB, ADB, DTB, and SPB.
Figure 2.9-3 Consecutive Prefix Codes
Prefix codes
•••••
ADB
DTB
PCB
ADD A,01H
•••••
PCB becomes valid as
the prefix code
60
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 3
INTERRUPTS
This chapter describes the interrupts, the extended
intelligent I/O service (EI2OS), and the exceptions.
3.1 Overview of Interrupts
3.2 Interrupt Vector
3.3 Interrupt Control Register (ICR00 to ICR15)
3.4 Interrupt Flow
3.5 Hardware Interrupts
3.6 Software Interrupts
3.7 Extended Intelligent I/O Service (EI2OS)
3.8 Operation Flow of Extended Intelligent I/O Service (EI2OS) and its
Application Procedure
3.9 Exceptions
Code: CM44-00106-2E
Page: 65, 79
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
61
CHAPTER 3 INTERRUPTS
3.1 Overview of Interrupts
3.1
MB90340E Series
Overview of Interrupts
The F2MC-16LX has interrupt functions that suspend the currently executing processing
and transfer control to another specified program when a specified event occurs. There
are 5 types of interrupt functions:
• Hardware interrupt
• Software interrupt
• Extended intelligent I/O service (EI2OS)
• μDMAC
• Exception
■ Hardware Interrupts
A hardware interrupt is activated by an interrupt request from a peripheral resource. A hardware interrupt
request occurs when both the interrupt request flag and the interrupt enable flag in a peripheral resource are
set. A peripheral resource has an interrupt request flag and interrupt enable flag to use a hardware interrupt.
● Specifying an interrupt level
An interrupt level can be specified for the hardware interrupt. To specify an interrupt level, use the level
setting bits (IL0, IL1, and IL2) of the interrupt controller.
● Masking a hardware interrupt request
A hardware interrupt request can be masked by using the interrupt enable flag (I) and the interrupt level
mask (ILM) of the processor status (PS) in the CPU. When an unmasked interrupt request occurs, the CPU
saves 12 bytes of data that consists of registers PS, PC, PCB, DTB, ADB, DPR, AH, and AL in the
memory area indicated by the SSB and SSP registers.
Figure 3.1-1 Overview of Hardware Interrupt
Microcode
IR
ILM
Check
Comparator
PS
I
ILM
IR
: Processor status
: Interrupt enable flag
: Interrupt level mask
: Instruction register
Peripheral
AND
Source FF
Interrupt level IL
F2MC-16LX CPU
Enabling FF
62
I
PS
Level comparator
F2MC-16LX bus
Register file
Interrupt
controller
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 3 INTERRUPTS
3.1 Overview of Interrupts
MB90340E Series
■ Software Interrupts
The software interrupt function transfers control from the program that is currently being executed by the
CPU to another interrupt processing program that is defined by the user.
Software interrupts are requested by executing the INT instruction. An interrupt request by the INT
instruction does not have an interrupt request or enable flag. An interrupt request is issued always by
executing the INT instruction.
No interrupt level is assigned to the INT instruction. Therefore, interrupt level mask (ILM) is not updated
when the INT instruction is used. Instead, the interrupt enable flag (I) is cleared and the continuing interrupt
requests are suspended.
Figure 3.1-2 Overview of Software Interrupt
F2MC-16LX bus
Register
file
PS
I
S
B unit
Microcode
IR
F2MC-16LX CPU
Queue
Fetch
PS
I
S
IR
B unit
: Processor status
: Interrupt enable flag
: Stack flag
: Instruction register
: Bus interface unit
Save
Instruction bus
RAM
■ Extended Intelligent I/O Service (EI2OS)
The extended intelligent I/O service automatically transfers data between an internal peripheral and
memory. This processing is traditionally performed by an interrupt processing program, but the EI2OS
enables data to be transferred in a manner similar to a DMA (direct memory access) operation.
To use the extended intelligent I/O service function by a peripheral resource, the interrupt control register
(ICR00 to ICR15) of the interrupt controller has an extended intelligent I/O service enable flag (ISE).
The extended intelligent I/O service is activated by the occurrence of an interrupt request when the ISE flag
is set to "1".
To generate a normal interrupt using a hardware interrupt request, set the ISE flag to "0".
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
63
CHAPTER 3 INTERRUPTS
3.1 Overview of Interrupts
MB90340E Series
Figure 3.1-3 Overview of Extended Intelligent I/O Service (EI2OS)
Memory space
IOA
CPU
I/O register
I/O register
Peripheral
Interrupt request
(3)
ISD
(3)
(1)
ICS
(2)
Interrupt control register
Interrupt controller
BAP
(4)
Buffer
DCT
IOA: I/O register address pointer
BAP: Buffer address pointer
(1) I/O requests transfer.
(2) Interrupt controller selects a descriptor.
(3) Transfer source/destination is read from the descriptor.
(4) Data is transferred between I/O and memory.
64
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 3 INTERRUPTS
3.1 Overview of Interrupts
MB90340E Series
■ Direct Memory Access (DMA)
μDMAC is one of the hardware interrupts by which an automatic data transfer is performed between a
peripheral function and memory. μDMA enables the data that is transferred by an interrupt processing
program to be transferred in a manner similar to a Direct Memory Access (DMA) operation. The interrupt
processing program is automatically executed once a specified number of data transfers are completed.
This series is equipped with the μDMAC function. About the operation of μDMAC, see "CHAPTER 4
μDMAC".
Figure 3.1-4 Overview of Direct Memory Access (DMA)
Memory space
Descriptor RAM
IOA
I/O register
Peripheral
function (I/O)
I/O register
(4) (a)
(1)
(2)
(3)
DMA controller
DMA descriptor
(2)
(4) (b)
BAP
Buffer
Interrupt
controller
CPU
DCT
IOA : I/O register address pointer
DER: DMA enable register
BAP: Buffer address pointer
DCT: Data counter
(1) A peripheral (I/O) requests DMA transfer.
(2) When the corresponding bit of the DMA enable register (DER) is set to "1", the DMAC controller reads
transfer data (transfer source address, destination address and transfer channel) from the descriptor.
(3) DMA data transfer starts between I/O and memory.
(4) After one item (either byte data or word data) is transferred:
(a) If the transfer is not completed (DCT is not "0"), it will request the peripheral to clear the DMA
transfer request.
(b) If the transfer is completed (DCT=0), a transfer end flag will be set in the DMA status register upon
the completion of the DMA transfer, and an interrupt request will be output to the interrupt
controller.
To write to an internal register (DSRH, DSRL, DSSR, DERH, or DERL), use a read-modify-write (RMW)
instruction.
■ Exception Processing
Exception processing is basically the same as interrupt processing. When an exception is detected between
instructions, the normal processing is suspended and exception processing is performed instead. In general,
exception processing occurs as a result of an unexpected operation. Therefore, it is recommended to use
exception processing only for debugging programs or for activating recovery software in an emergency.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
65
CHAPTER 3 INTERRUPTS
3.2 Interrupt Vector
3.2
MB90340E Series
Interrupt Vector
An interrupt vector uses the same area for both hardware and software interrupts. For
example, interrupt request number (INT42) is used for a delayed hardware interrupt and
for software interrupt (INT #42). Therefore, the external interrupt and INT #42 call the
same interrupt processing routine. Interrupt vectors are allocated between addresses
FFFC00H and FFFFFFH as shown in Table 3.2-1.
■ Interrupt Vector
Table 3.2-1 Interrupt Vector (1 / 2)
Interrupt
request
Interrupt source
Interrupt control
register
No.
Address
Vector
address:
Low
Vector
address:
Middle
Vector
address:
High
Mode
register
INT 0 *
-
-
-
FFFFFCH
FFFFFDH
FFFFFEH
Unused
INT 1 *
-
-
-
FFFFF8H
FFFFF9H
FFFFFAH
Unused
-
-
-
.
.
.
.
.
.
.
.
.
.
.
.
-
-
-
FFFFE0H
FFFFE1H
FFFFE2H
Unused
.
.
.
INT 7 *
INT 8
Reset
-
-
FFFFDCH
FFFFDDH
FFFFDEH
FFFFDFH
INT 9
INT9 instruction
-
-
FFFFD8H
FFFFD9H
FFFFDAH
Unused
INT 10
Exception processing
-
-
FFFFD4H
FFFFD5H
FFFFD6H
Unused
INT 11
Hardware interrupt
0000B0H
FFFFD0H
FFFFD1H
FFFFD2H
Unused
ICR00
FFFFCCH
FFFFCDH
FFFFCEH
Unused
FFFFC8H
FFFFC9H
FFFFCAH
Unused
FFFFC4H
FFFFC5H
FFFFC6H
Unused
FFFFC0H
FFFFC1H
FFFFC2H
Unused
FFFFBCH
FFFFBDH
FFFFBEH
Unused
FFFFB8H
FFFFB9H
FFFFBAH
Unused
FFFFB4H
FFFFB5H
FFFFB6H
Unused
FFFFB0H
FFFFB1H
FFFFB2H
Unused
FFFFACH
FFFFADH
FFFFAEH
Unused
FFFFA8H
FFFFA9H
FFFFAAH
Unused
FFFFA4H
FFFFA5H
FFFFA6H
Unused
INT 12
Hardware interrupt
INT 13
Hardware interrupt
INT 14
Hardware interrupt
INT 15
Hardware interrupt
INT 16
Hardware interrupt
INT 17
Hardware interrupt
INT 18
Hardware interrupt
INT 19
Hardware interrupt
INT 20
Hardware interrupt
INT 21
Hardware interrupt
INT 22
66
Hardware interrupt
ICR01
ICR02
ICR03
ICR04
ICR05
0000B1H
0000B2H
0000B3H
0000B4H
0000B5H
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 3 INTERRUPTS
3.2 Interrupt Vector
MB90340E Series
Table 3.2-1 Interrupt Vector (2 / 2)
Interrupt
request
INT 23
Interrupt source
No.
Address
ICR06
0000B6H
Hardware interrupt
INT 24
Hardware interrupt
INT 25
Hardware interrupt
INT 26
Hardware interrupt
INT 27
Hardware interrupt
INT 28
Hardware interrupt
INT 29
Hardware interrupt
INT 30
Hardware interrupt
INT 31
Hardware interrupt
INT 32
Hardware interrupt
INT 33
Hardware interrupt
INT 34
Hardware interrupt
INT 35
Hardware interrupt
INT 36
Hardware interrupt
INT 37
Hardware interrupt
INT 38
Hardware interrupt
INT 39
Hardware interrupt
INT 40
Hardware interrupt
INT 41
Hardware interrupt
INT 42
Interrupt control
register
Hardware interrupt
INT 43
ICR07
ICR08
ICR09
ICR10
ICR11
ICR12
ICR13
ICR14
ICR15
0000B7H
0000B8H
0000B9H
0000BAH
0000BBH
0000BCH
0000BDH
0000BEH
0000BFH
Vector
address:
Low
Vector
address:
Middle
Vector
address:
High
Mode
register
FFFFA0H
FFFFA1H
FFFFA2H
Unused
FFFF9CH
FFFF9DH
FFFF9EH
Unused
FFFF98H
FFFF99H
FFFF9AH
Unused
FFFF94H
FFFF95H
FFFF96H
Unused
FFFF90H
FFFF91H
FFFF92H
Unused
FFFF8CH
FFFF8DH
FFFF8EH
Unused
FFFF88H
FFFF89H
FFFF8AH
Unused
FFFF84H
FFFF85H
FFFF86H
Unused
FFFF80H
FFFF81H
FFFF82H
Unused
FFFF7CH
FFFF7DH
FFFF7EH
Unused
FFFF78H
FFFF79H
FFFF7AH
Unused
FFFF74H
FFFF75H
FFFF76H
Unused
FFFF70H
FFFF71H
FFFF72H
Unused
FFFF6CH
FFFF6DH
FFFF6EH
Unused
FFFF68H
FFFF69H
FFFF6AH
Unused
FFFF64H
FFFF65H
FFFF66H
Unused
FFFF60H
FFFF61H
FFFF62H
Unused
FFFF5CH
FFFF5DH
FFFF5EH
Unused
FFFF58H
FFFF59H
FFFF5AH
Unused
FFFF54H
FFFF55H
FFFF56H
Unused
-
-
-
FFFF50H
FFFF51H
FFFF52H
Unused
-
-
-
.
.
.
.
.
.
.
.
.
.
.
.
INT 254
-
-
-
FFFC04H
FFFC05H
FFFC06H
Unused
INT 255
-
-
-
FFFC00H
FFFC01H
FFFC02H
Unused
.
.
.
*: When the program counter bank register (PCB) is FFH, the vector area for the CALLV instruction is the same as that for
#0 to #7 values setting #vct8 item in the "INT #vct8" instruction. Care must be taken when using the vector for the
CALLV instruction.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
67
CHAPTER 3 INTERRUPTS
3.3 Interrupt Control Register (ICR00 to ICR15)
3.3
MB90340E Series
Interrupt Control Register (ICR00 to ICR15)
The interrupt control registers are in the interrupt controller. Each interrupt control
register has a corresponding I/O that has an interrupt function. The interrupt control
registers have the following three functions:
• Setting an interrupt level for corresponding peripherals
• Selecting whether to use an ordinary interrupt or extended intelligent I/O service for
the corresponding peripherals
• Selecting the extended intelligent I/O service channel
Do not access an interrupt control register (ICR00 to ICR15) by using a read-modifywrite (RMW) instruction, as doing so causes a malfunction.
■ Interrupt Control Register (ICR00 to ICR15)
Figure 3.3-1 shows the bit configuration of an interrupt control register (ICR00 to ICR15).
Figure 3.3-1 Bit Configuration of an Interrupt Control Register(ICR00 to ICR15)
bit
7
6
5
4
3
ICS3
ICS2
ICS1
or
S1
ICS0
or
S0
ISE
W
W
R, W*
R, W*
R/W
2
1
0
IL2
IL1
IL0
R/W
R/W
R/W
When interrupt control
register is reset:
00000111B
R/W : Readable/Writable
W : Write only
*: ICS1 and ICS0 are valid for write (W) only. S1 and S0 are valid for read (R) only.
Additional information
The extended intelligent I/O service channel select bits (ICR:ICS3 to ICS0) are valid for
write only. The extended intelligent I/O service status bits (ICR:S1, S0) are valid for
read only. In read operation, "1" is read from bit6, bit7 (ICS2, ICS3).
Note:
ICS3 to ICS0 are valid only when EI2OS is activated. Set "1" in ISE to activate EI2OS, and set "0" in
ISE not to activate it. When EI2OS is not to be activated, any value can be set in ICS3 to ICS0.
68
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 3 INTERRUPTS
3.3 Interrupt Control Register (ICR00 to ICR15)
MB90340E Series
[bit7 to bit4] ICS3 to ICS0: extended intelligent I/O service channel select bits
These bits are used for write operation only. These bits specify the EI2OS channel. The values set in these
bits determine the intelligent I/O service descriptor addresses in memory. ICS3 to ICS0 is initialized to
0000B by a reset.
Table 3.3-1 shows the relationship between the ICS3 to ICS0 bits, channel numbers, and descriptor
addresses.
Table 3.3-1 ICS3 to ICS0 Bits, Channel Numbers, and Descriptor Addresses
CM44-10143-5E
ICS3
ICS2
ICS1
ICS0
Channel to be selected
Descriptor address
0
0
0
0
0
000100H
0
0
0
1
1
000108H
0
0
1
0
2
000110H
0
0
1
1
3
000118H
0
1
0
0
4
000120H
0
1
0
1
5
000128H
0
1
1
0
6
000130H
0
1
1
1
7
000138H
1
0
0
0
8
000140H
1
0
0
1
9
000148H
1
0
1
0
10
000150H
1
0
1
1
11
000158H
1
1
0
0
12
000160H
1
1
0
1
13
000168H
1
1
1
0
14
000170H
1
1
1
1
15
000178H
FUJITSU SEMICONDUCTOR LIMITED
69
CHAPTER 3 INTERRUPTS
3.3 Interrupt Control Register (ICR00 to ICR15)
MB90340E Series
[bit5, bit4] S0, S1: extended intelligent I/O service status bits
These are EI2OS end status bits and used for read operation only. The values set in these bits indicate the
end condition of EI2OS.
They are initialized to 00B by a reset.
Table 3.3-2 shows the relationship between the S1, S0 bits and the end conditions.
Table 3.3-2 S1, S0 Bits and End Conditions
S1
S0
End condition
0
0
EI2OS running or not activated
0
1
Terminated by completion of count
1
0
Reserved
1
1
Terminated by request from internal peripheral
[bit3] ISE: extended intelligent I/O service enable bits
These bits are used to enable EI2OS. In response to an interrupt request, EI2OS is activated when "1" is set
in the ISE bit and an interrupt sequence is activated when "0" is set in the ISE bit. Upon completion of
EI2OS (either due to completion of a count, or a request from a internal peripheral), the ISE bit is cleared to
"0". If the corresponding peripheral does not have the EI2OS function, the ISE bit must be set to "0" on the
software side. These bits are readable and writable.
The ISE bit is initialized to "0" by a reset.
[bit2 to bit0] IL2 to IL0: interrupt level setting bits
These bits specify the interrupt level of the corresponding internal peripherals, and they are readable and
writable. Upon a reset, these bits are initialized to level 7 (no interrupt).
Table 3.3-3 describes the relationship between the interrupt level setting bits and interrupt levels.
70
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 3 INTERRUPTS
3.3 Interrupt Control Register (ICR00 to ICR15)
MB90340E Series
Table 3.3-3 Interrupt Level Setting Bits and Interrupt Levels
CM44-10143-5E
IL2
IL1
IL0
Interrupt level
0
0
0
0 (Highest interrupt)
0
0
1
1
0
1
0
2
0
1
1
3
1
0
0
4
1
0
1
5
1
1
0
6 (Lowest interrupt)
1
1
1
7 (No interrupt)
FUJITSU SEMICONDUCTOR LIMITED
71
CHAPTER 3 INTERRUPTS
3.4 Interrupt Flow
3.4
MB90340E Series
Interrupt Flow
Figure 3.4-1 shows the interrupt flow.
■ Interrupt Flow
Figure 3.4-1 Interrupt Flow
I
: Interrupt enable flag in
CCR
ILM : Interrupt level mask
IF : Peripheral resource
interrupt request
IE : Peripheral resource
interrupt enable flag
ENx: DMA activation request
flag in DMA enable
register
ISE : EI2OS enable flag
IL : Peripheral resource
interrupt request level
S : Stack flag in CCR
START
NO*
ENx = 1
YES
DMA processing
Specified
number of transfers ended?
Or, any end request from
peripheral function?
YES
I & IF & IE = 1
AND
ILM > IL
NO
YES
YES
ISE = 1
NO
Fetching and decoding the next instruction
INT
instruction
NO
Saving PS, PC, PCB, DTB,
DPR, AH and AL into the stack
of SSP, and setting ILM=IL
Processing the extended
intelligent I/O service
YES
NO
Executing an ordinary instruction
NO
Saving PS, PC, PCB, DTB,
ADB, DPR, AH and AL into
the stack of SSP, and setting
I ←0, ILM ←IL
Completion
of string instruction
repetition
YES
Updating PC
S ←1
Fetching the interrupt vector
*: For the product without μDMAC, "NO" is always selected.
72
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 3 INTERRUPTS
3.4 Interrupt Flow
MB90340E Series
Figure 3.4-2 Register Saving during Interrupt Processing
Word (16 bits)
"H"
MSB
LSB
SSP (SSP value before interrupt)
AH
AL
DPR
ADB
DTB
PCB
PC
SSP (SSP value after interrupt)
"L"
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
73
CHAPTER 3 INTERRUPTS
3.5 Hardware Interrupts
3.5
MB90340E Series
Hardware Interrupts
In response to an interrupt request signal from a peripheral resource, the CPU
temporarily suspends the current program execution and transfers control to the
interrupt processing program defined by the user.
■ Hardware Interrupt
A hardware interrupt occurs when the relevant conditions are satisfied as a result of two operations:
comparison between the interrupt request level and the value in the interrupt level mask (ILM), and
hardware reference to the interrupt enable flag (I).
The CPU performs the following processing when a hardware interrupt occurs:
• Saves the values in the PC, PS, AH, AL, PCB, DTB, ADB, and DPR registers of the CPU to the system
stack.
• Sets ILM in the PS register. The currently requested interrupt level is automatically set.
• Fetches the corresponding interrupt vector value and branches to the processing indicated by that value.
■ Structure of Hardware Interrupt
Hardware interrupts are handled by the following three sections:
● Peripheral resource
Interrupt enable and request bits: Used to control interrupt requests from peripherals.
● Interrupt controller
ICR: Assigns interrupt levels and determines the priority levels of simultaneously requested interrupts.
● CPU
I and ILM: Compares the requested and current interrupt levels and identifies the interrupt enable status
Microcode: Interrupt processing step
The status of these sections is indicated by the peripheral control registers for peripheral resources, the ICR
for the interrupt controller, and the CCR value for the CPU. To use a hardware interrupt, set the three
sections beforehand by using software.
The interrupt vector table referenced during interrupt processing is assigned to addresses FFFC00H to
FFFFFFH in memory. These addresses are shared with software interrupts.
74
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 3 INTERRUPTS
3.5 Hardware Interrupts
MB90340E Series
3.5.1
Hardware Interrupt Operation
A internal peripheral with the hardware interrupt request function has 2 types of flags:
the interrupt request flag, which indicates whether an interrupt request exists; and the
interrupt enable flag, which determines whether it requests an interrupt to the CPU. An
interrupt request flag is set when an event specific to that internal peripheral is
generated. When the interrupt enable flag is set to Enable, the peripheral outputs an
interrupt request to the interrupt controller.
■ Hardware Interrupt Operation
When more than one request are received at the same time, the interrupt controller compares the interrupt
levels (IL) in ICR, selects the request with the highest level (the smallest IL value), then reports that request
to the CPU. If multiple requests are at the same level, the interrupt controller selects the request with the
smaller interrupt number. The relationship between the interrupt requests and ICRs is determined by the
hardware.
The CPU compares the received interrupt level (IL) with the interrupt level mask (ILM). If the IL is smaller
than the ILM value and the interrupt enable flag (I) set to "1", the CPU activates the interrupt processing
microcode after completing the currently executing instruction. The CPU references the ISE bit of the ICR
in the interrupt controller at the beginning of the interrupt processing microcode to check that the ISE bit is
"0" (interrupt sequence start). If the ISE bit is "0", the CPU activates the interrupt processing body.
The interrupt processing body saves 12 bytes (PS, PC, PCB, DTB, ADB, DPR, AH, and AL) to the
memory area indicated by SSB and SSP, fetches three bytes of interrupt vector and loads them onto PC and
PCB, updates the ILM of PS to a level value of the received interrupt, sets the S flag to "1", then performs
branch processing. Then, the microcode performs branch processing. As a result, the interrupt processing
program defined by the user application program is executed next.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
75
CHAPTER 3 INTERRUPTS
3.5 Hardware Interrupts
3.5.2
MB90340E Series
Occurrence and Release of Hardware Interrupt
Figure 3.5-1 illustrates the flow from the occurrence of a hardware interrupt until there
is no interrupt request in the interrupt processing program.
■ Occurrence and Release of Hardware Interrupt
Figure 3.5-1 Flow from Occurrence to Release of Hardware Interrupt
Register file
Microcode
F2MC-16LX bus
I
PS
IR
ILM
Check
(5)
F2MC-16LX CPU
Comparator
(1)
PS
I
ILM
IR
: Processor status
: Interrupt enable flag
: Interrupt level mask
: Instruction register
Enabling FF
AND
(7)
Source FF
(1)
(2)
Interrupt level (IL)
Peripheral
Level comparator
(3)
Interrupt
controller
(1) An interrupt source is generated in a peripheral.
(2) The interrupt enable bit in the peripheral is referenced. If an interrupt is enabled, the peripheral issues
an interrupt request to the interrupt controller.
(3) Upon reception of the interrupt request, the interrupt controller determines the priority levels of
simultaneously requested interrupts. Then, the interrupt controller transfers the interrupt level of the
corresponding interrupt to the CPU.
(4) The CPU compares the interrupt level (IL) requested by the interrupt controller with the interrupt level
mask (ILM) of the processor status (PS).
(5) If the comparison shows that the requested level is higher than the current interrupt processing level, the
interrupt enable flag (I) value of the processor status (PS) is checked.
(6) If the check in step (5) shows that the I flag indicates interrupt enable status, the requested level is
written to the ILM. Interrupt processing is performed as soon as the currently executing instruction is
completed, then control is transferred to the interrupt processing routine.
(7) When the interrupt source of step (1) is cleared by software in the user interrupt processing routine, the
interrupt request is completed.
The time required for the CPU to execute the interrupt processing in steps (6) and (7) is shown below.
For the cycle count correction values, see Table 3.5-1.
Interrupt start : 24 + 6 × cycle count correction value
Interrupt return : 15 + 6 × cycle count correction value (RETI instruction)
76
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 3 INTERRUPTS
3.5 Hardware Interrupts
MB90340E Series
Table 3.5-1 Correction Values for Interrupt Processing Cycle Count
Address indicated by the stack pointer
CM44-10143-5E
Correction value [cycle]
External 8-bit
+4
External even-numbered address
+1
External odd-numbered address
+4
Internal even-numbered address
0
Internal odd-numbered address
+2
FUJITSU SEMICONDUCTOR LIMITED
77
CHAPTER 3 INTERRUPTS
3.5 Hardware Interrupts
3.5.3
MB90340E Series
Multiple Interrupts
As a special case, no hardware interrupt request can be accepted while data is being
written to the I/O area. This is intended to prevent the CPU from causing an interruptrelated malfunction due to an interrupt request issued while an interrupt control register
for a peripheral is being updated. If an interrupt occurs during interrupt processing, a
higher level interrupt is processed first.
■ Multiple Interrupts
The F2MC-16LX CPU supports multiple interrupts. If an interrupt of a higher level occurs while another
interrupt is being processed, control is transferred to the high-level interrupt after the currently executing
instruction is completed. After processing of the high-level interrupt is completed, the original interrupt
processing is resumed. An interrupt of the same or lower level may be generated while another interrupt is
being processed. If this happens, the new interrupt request is suspended until the current interrupt
processing is completed, unless the interrupt level mask (ILM) or interrupt enable flag (I) value is changed
by an instruction.
The extended intelligent I/O service cannot be activated from multiple sources: while an extended
intelligent I/O service is being processed; all other interrupt requests or extended intelligent I/O service
requests are suspended.
Figure 3.5-2 shows the order of the registers saved in the stack.
Figure 3.5-2 Registers Saved in Stack
Word (16 bits)
MSB
LSB
"H"
SSP (SSP value before interrupt)
AH
AL
DPR
ADB
DTB
PCB
PC
PS
SSP (SSP value after interrupt)
"L"
78
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 3 INTERRUPTS
3.6 Software Interrupts
MB90340E Series
3.6
Software Interrupts
In response to execution of a special instruction, control is transferred from the
program currently executed by the CPU to the interrupt processing program defined by
the user. A software interrupt occurs whenever the software interrupt instruction is
executed.
■ Software Interrupts
The CPU performs the following processing when a software interrupt occurs:
• Saves the values in the PC, PS, AH, AL, PCB, DTB, ADB, and DPR registers of the CPU to the system
stack.
• The interrupt enable flag (I) of the processor status (PS) is set to "1". Interrupts are automatically disabled.
• Fetches the corresponding interrupt vector value and branches to the address indicated by the interrupt
vector.
A software interrupt request issued by the INT instruction has no interrupt request or enable flag. A
software interrupt request is always issued by executing the INT instruction.
The INT instruction does not have an interrupt level. Therefore, the INT instruction does not update
interrupt level mask (ILM). The INT instruction sets the interrupt enable flag (I) to "0" to suspend
subsequent interrupt requests.
Software interrupts are handled within the CPU.
■ List of Interrupt Vectors
About the interrupt vector table of this series, see the appendix.
As shown in the interrupt vector table, software interrupts share the same interrupt vector area with
hardware interrupts. For example, interrupt request number INT 12 is used for external hardware interrupt
as well as for INT #12 of a software interrupt. Therefore, the external interrupt and INT #12 call the same
interrupt processing routine.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
79
CHAPTER 3 INTERRUPTS
3.6 Software Interrupts
MB90340E Series
■ Software Interrupt Operation
When the CPU fetches and executes the software interrupt instruction, the software interrupt processing
microcode is activated. The software interrupt processing saves 12 bytes (PS, PC, PCB, DTB, ADB, DPR,
AH, and AL) to the memory area indicated by SSB and SSP. The microcode fetches 3 bytes of interrupt
vector and loads them onto PC and PCB, resets the I flag to "0", sets the S flag to "1", then performs branch
processing. As a result, the interrupt processing program defined by the user application program is
executed next.
Figure 3.6-1 illustrates the flow from the occurrence of a software interrupt until there is no interrupt
request in the interrupt processing program.
Figure 3.6-1 Flow from Occurrence to Release of Software Interrupt
F2MC-16LX bus
Register
file
(2) Microcode
F2MC-16LX CPU
(1)
I
PS
S
B unit
IR
Queue
Fetch
PS
I
S
IR
B unit
: Processor status
: Interrupt enable flag
: Stack flag
: Instruction register
: Bus interface unit
Save
Instruction bus
RAM
(1) The software interrupt instruction is executed.
(2) Dedicated CPU registers in the register file are saved according to the microcode corresponding to the
software interrupt instruction.
(3) The interrupt processing is completed with the RETI instruction in the user interrupt processing routine.
■ Other Information
When the program counter bank register (PCB) is FFH, the CALLV instruction vector area overlaps the
table of the "INT #vct8" instruction. When designing software, the CALLV instruction does not use the
same address as that of the "INT #vct8" instruction.
80
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 3 INTERRUPTS
3.7 Extended Intelligent I/O Service (EI2OS)
MB90340E Series
3.7
Extended Intelligent I/O Service (EI2OS)
The extended intelligent I/O service (EI2OS) is a type of hardware instruction operations,
and automatically transfers data between I/O and memory. An interrupt processing
program was conventionally used for such processing, but EI2OS enables data transfer
to be performed like DMA (direct memory access).
■ Extended Intelligent I/O Service (EI2OS)
EI2OS has the following advantages over the conventional method:
• The program size can be reduced because it is not necessary to write a transfer program.
• High transfer speed is enabled by eliminating the need for saving register as no internal register is used
for transfer.
• Transfer can be terminated by I/O, when required, preventing unnecessary data from being transferred.
• The buffer address may either be incremented or left unupdated.
• The I/O register address may either be incremented or left unupdated (when update is available for the
buffer address).
At the end of EI2OS, processing automatically branches to an interrupt processing routine after the end
condition is set. Thus, the user can identify the type of the end condition.
To implement EI2OS, the hardware is distributed in two blocks. Each block has the following registers and
descriptors.
● Interrupt control register:
Exists in the interrupt controller and indicates the extended intelligent I/O service descriptor (ISD) address.
● Extended intelligent I/O service descriptor
Exists in RAM and holds the transfer mode, I/O address, number of transfers, and buffer address.
Note:
When REALOS is used, the extended intelligent I/O service (EI2OS) cannot be used.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
81
CHAPTER 3 INTERRUPTS
3.7 Extended Intelligent I/O Service (EI2OS)
MB90340E Series
Figure 3.7-1 shows the overview of the extended intelligent I/O service.
Figure 3.7-1 Overview of Extended Intelligent I/O Service
Memory space
by IOA
CPU
I/O register
···············
I/O register
Peripheral
Interrupt request (1)
(3)
(3)
ISD
by ICS
(2)
Interrupt control register
Interrupt controller
by BAP
(4)
Buffer
by
DCT
BAP : Buffer address pointer
IOA : I/O register address pointer
ICS : Extended intelligent I/O service
channel select bits
DCT : Data counter
(1) I/O requests transfer.
(2) The interrupt controller selects the descriptor.
(3) Transfer source/destination is read from the descriptor.
(4) Data is transferred between I/O and memory.
Notes:
• The area that can be specified by IOA is between 000000H and 00FFFFH.
• The area that can be specified by BAP is between 000000H and FFFFFFH.
• The maximum transfer count that can be specified by DCT is 65,536.
■ Structure of Extended Intelligent I/O Service (EI2OS)
EI2OS is handled by the following four sections:
• Peripheral resources : Interrupt request flag bits, and interrupt request enable bits:
Controls interrupt requests from peripherals
• Interrupt controller : ICR:Assigns interrupt levels, determines the priority levels of simultaneously
requested interrupts, and selects the EI2OS operation.
82
• CPU: I and ILM
: Used to compare the requested and current interrupt levels and to identify
the interrupt enable status.
• RAM: Descriptor
: Describes the EI2OS transfer information.
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 3 INTERRUPTS
3.7 Extended Intelligent I/O Service (EI2OS)
MB90340E Series
3.7.1
Extended Intelligent I/O Service Descriptor (ISD)
The extended intelligent I/O service descriptor exists between 000100H and 00017FH in
internal RAM, and consists of the following items:
• Data counter
• I/O register address pointer
• Status data
• Buffer address pointer
■ Extended Intelligent I/O Service Descriptor (ISD)
Figure 3.7-2 shows the configuration of the extended intelligent I/O service descriptor.
Figure 3.7-2 Configuration of Extended Intelligent I/O Service Descriptor
"H"
Upper 8 bits of data counter (DCTH)
Lower 8 bits of data counter (DCTL)
Upper 8 bits of I/O register address pointer (IOAH)
Lower 8 bits of I/O register address pointer (IOAL)
EI2OS status (ISCS)
Upper 8 bits of buffer address pointer (BAPH)
Middle 8 bits of buffer address pointer (BAPM)
000100H + 8 x ICS
ISD starting address
Lower 8 bits of buffer address pointer (BAPL)
"L"
■ Data Counter (DCT)
This is a 16-bit register that works as a counter corresponding to the number of data items transferred. This
counter is decremented by 1 after data transfer. EI2OS is completed when the counter is set to 0000H.
Figure 3.7-3 shows the configuration of the data counter.
Figure 3.7-3 Configuration of Data Counter
bit 15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
DCT
B15 B14 B13 B12 B11 B10 B09 B08 B07 B06 B05 B04 B03 B02 B01 B00 (Undefined at a reset)
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
83
CHAPTER 3 INTERRUPTS
3.7 Extended Intelligent I/O Service (EI2OS)
MB90340E Series
■ I/O Register Address Pointer (IOA)
This is a 16-bit register that indicates the lower address (A15 to A00) of the buffer and I/O register used for
data transfer. All of upper addresses (A23 to A16) are "0", and any I/O between addresses 000000H and
00FFFFH can be specified. Figure 3.7-4 shows the configuration of the I/O register address pointer.
Figure 3.7-4 Configuration of the I/O Register Address Pointer
bit 15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
IOA
A15 A14 A13 A12 A11 A10 A09 A08 A07 A06 A05 A04 A03 A02 A01 A00 (Undefined at a reset)
■ Buffer Address Pointer (BAP)
This 24-bit register holds the address used for the next EI2OS transfer. BAP exists for each EI2OS channel
independently. Therefore, each EI2OS channel can be used for transfer with anywhere in the 16Mbyte
space. If the BF bit of ISCS is set to "0" (update enabled), only the lower 16 bits of BAP changes and
BAPH does not change.
■ EI2OS Status Register (ISCS)
This 8-bit register indicates whether the buffer address pointer or I/O register address pointer is updated or
fixed. It also indicates the transfer data length (byte/word) and transfer direction of the buffer address
pointer and the I/O register address pointer.
Figure 3.7-5 shows the configuration of the ISCS.
Always write "0" to bit7 to bit5 of ISCS.
Figure 3.7-5 Configuration of ISCS
bit
7
6
5
Reserved Reserved Reserved
4
3
2
1
0
IF
BW
BF
DIR
SE
ISCS
(Undefined at a reset)
Each bit is explained as follows.
[bit4] IF: IOA update/fix selection bit
This bit determines whether the I/O register address pointer is to be updated or fixed.
0: The I/O register address pointer is updated (incremented) after data transfer.
1: The I/O register address pointer is fixed after data transfer.
Note:
Only update (increment) is allowed.
[bit3] BW: Transfer data length specification bit
This bit specifies the transfer data length.
0: Byte
1: Word
84
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 3 INTERRUPTS
3.7 Extended Intelligent I/O Service (EI2OS)
MB90340E Series
[bit2] BF: BAP update/fix selection bit
This bit specifies whether the buffer address pointer is updated or fixed.
0: The buffer address pointer is updated (incremented) after data transfer.
1: The buffer address pointer is fixed after data transfer.
Note:
Only the lower 16 bits of the buffer address pointer are updated.
[bit1] DIR: Data transfer direction bit
This bit specifies the data transfer direction.
0: I/O register address pointer →Buffer address pointer
1: Buffer address pointer →I/O register address pointer
[bit0] SE: EI2OS completion control bit
This bit controls the termination of the extended intelligent I/O service based on requests from internal
peripherals.
0: The service is not terminated by a peripheral request.
1: The service is terminated by a peripheral request.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
85
CHAPTER 3 INTERRUPTS
3.8 Operation Flow of Extended Intelligent I/O Service (EI2OS) and its
Application Procedure
3.8
MB90340E Series
Operation Flow of Extended Intelligent I/O Service
(EI2OS) and its Application Procedure
Figure 3.8-1 illustrates the operation flow of the extended intelligent I/O service (EI2OS)
and Figure 3.8-2 shows its application procedure.
■ Operation Flow of Extended Intelligent I/O Service (EI2OS)
Figure 3.8-1 Operation Flow of Extended Intelligent I/O Service (EI2OS)
Interrupt request issued
from internal peripheral
ISE = 1
BAP
NO
YES
Interrupt sequence
Reading ISD/ISCS
End request from a peripheral
YES
NO
DIR = 1
: Buffer address pointer
: I/O register address pointer
: EI2OS descriptor
ISCS : EI2OS status
DCT : Data counter
ISE
: EI2OS enable bits
S1, S0 : EI2OS end status bits
IOA
ISD
SE = 1
YES
NO
Register indicated by IOA
(Data transfer)
Memory indicated by BAP
IF = 0
YES
NO
BF = 0
Memory transferred by BAP
(Data transfer)
Register indicated by IOA
Update value
depending on BW
Updating IOA
Update value
depending on BW
Updating BAP
YES
NO
Decrementing DCT
DCT = 00B
NO
Setting S1 and S0
to 00B
86
YES
Setting S1 and S0
to 01B
Setting S1 and S0
to 11B
Clearing peripheral
interrupt request
Clearing ISE to "0"
CPU operation return
Interrupt sequence
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 3 INTERRUPTS
3.8 Operation Flow of Extended Intelligent I/O Service (EI2OS) and its
Application Procedure
MB90340E Series
Figure 3.8-2 Application Procedure Flow of Extended Intelligent I/O Service (EI2OS)
Processing by EI2OS
Processing by CPU
EI2OS initialization
JOB execution
(Interrupt
request)
Normal termination
AND(ISE=1)
Data transfer
Interrupt occurs due to
count end or termination
request from peripheral
Setting extended intelligent I/O service
(Switching channels)
Processing data in buffer
The extended EI2OS execution time for each flow is described below.
● When data transfer continues (when the stop condition is not satisfied)
(Table 3.8-1 + Table 3.8-2) machine cycle
● When a stop request is issued from a peripheral
(36 + 6 × Table 3.8-3) machine cycle
● When the counting is completed
(Table 3.8-1 + Table 3.8-2 + (21 + 6 × Table 3.8-3)) machine cycle
Table 3.8-1 Execution Time when EI2OS Continues
ISCS: SE bit
Set to "0"
I/O register address pointer
Set to "1"
Fixed
Updated
Fixed
Updated
Fixed
32
34
33
35
Updated
34
36
35
37
Buffer address pointer
Table 3.8-2 Data Transfer Correction Values for EI2OS Execution Time
Internal access
I/O register address pointer
Buffer address pointer
B/E
O
B/E
0
+2
O
+2
+4
Internal access
B : Byte data transfer
E : Even-numbered address word transfer
O : Odd-numbered address word transfer
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
87
CHAPTER 3 INTERRUPTS
3.8 Operation Flow of Extended Intelligent I/O Service (EI2OS) and its
Application Procedure
Table 3.8-3 Correction Values for Interrupt Handling Times
Address indicated by the stack pointer
88
MB90340E Series
Correction value [cycle]
External 8-bit
+4
External even-numbered address
+1
External odd-numbered address
+4
Internal even-numbered address
0
Internal odd-numbered address
+2
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 3 INTERRUPTS
3.9 Exceptions
MB90340E Series
3.9
Exceptions
The F2MC-16LX performs exception processing when the following events occur.
■ Execution of an Undefined Instruction
Exception processing is fundamentally the same as interrupt processing. When an exception is detected
between instructions, exception processing is performed separately from ordinary processing. In general,
exception processing is performed as a result of an unexpected operation. Therefore, use exception processing
only for debugging or for activating emergency recovery software.
■ Exception Due to Execution of an Undefined Instruction
The F2MC-16LX handles all codes that are not defined in the instruction map as undefined instructions.
When an undefined instruction is executed, processing equivalent to the INT 10 software interrupt
instruction is performed. Specifically, the AL, AH, DPR, DTB, ADB, PCB, PC, and PS values are saved
into the system stack first, then the interrupt enable flag (I) is set to "0", the stack flag (S) is set to "1", and
processing branches to the routine indicated by the vector with the interrupt number 10. The PC value
saved in the stack is the address at which the undefined instruction is stored. For an instruction code of 2
bytes or more, the saved value is the address at which the code identified as undefined is stored. Processing
can be restored by the RETI instruction, but is of no use, however, because the same exception occurs
again.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
89
CHAPTER 3 INTERRUPTS
3.9 Exceptions
90
MB90340E Series
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 4
μDMAC
This chapter describes the functions and operations of
the μDMAC. The μDMAC is the simplified DMA having
functions equivalent to the extended intelligent I/O
service (EI2OS).
4.1 Overview of μDMAC
4.2 Registers of μDMAC
4.3 DMA Descriptor Window Register (DDWR)
4.4 Operations of μDMAC
4.5 Notes on Using μDMAC
Code: CM44-00108-1E
Page: 96, 99, 111
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
91
CHAPTER 4 μDMAC
4.1 Overview of μDMAC
4.1
MB90340E Series
Overview of μDMAC
Provided with a descriptor register, μDMAC can transfer data faster than EI2OS.
■ Overview of μDMAC
μDMAC has the following functions:
• Data is automatically transferred between a peripheral (I/O) and memory.
• The execution of a program by the CPU is stopped while DMA is running.
• The watchdog timer operates during DMA transfer.
• There are 16 DMA transfer channels available (The channel with the smallest channel number has the
highest priority for DMA transfer.)
• Increment or no increment option can be selected for the transfer source and destination addresses.
• DMA transfer is activated by an interrupt source from a peripheral (I/O).
• DMA transfer is controlled by (a) DMA enable register (DER), (b) DMA stop status register (DSSR),
(c) DMA status register (DSR), (d) DMA descriptor channel specification register (DCSR), and (e)
Descriptor (DMACS).
• STOP request can be used as a method for stopping DMA transfer from a peripheral.
• Upon completion of DMA transfer, a flag is set in the corresponding bit of the DMA status register
(DSR) and an interrupt is output to the interrupt controller.
92
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 4 μDMAC
4.2 Registers of μDMAC
MB90340E Series
4.2
Registers of μDMAC
μDMAC has 4 registers: DCSR, DSR, DSSR, and DER. This section describes the DMA
descriptors used for DMA transfer setting.
■ List of Registers
• DMA Descriptor Channel Specification Register (DCSR)
bit
Address
00009BH
15
14
13
12
11
STPctrl Reserved Reserved Reserved DCSR3
R/W
R/W
10
9
8
DCSR2
DCSR1
DCSR0
R/W
R/W
R/W
R/W
R/W
R/W
Initial value
00000000B
R/W: Readable/Writable
• DMA status register (DSR)
bit
Address
00009DH
bit
Address
00009CH
15
14
13
12
11
10
9
8
DSRH
DTE15
DTE14
DTE13
DTE12
DTE11
DTE10
DTE9
DTE8
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
Initial value
00000000B
7
6
5
4
3
2
1
0
DSRL
DTE7
DTE6
DTE5
DTE4
DTE3
DTE2
DTE1
DTE0
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
Initial value
00000000B
R/W: Readable/Writable
• DMA Stop Status Register (DSSR)
bit
Address
0000A4H
bit
Address
0000A4H
7
6
5
4
3
2
1
0
DSSR
STP15
STP14
STP13
STP12
STP11
STP10
STP9
STP8
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
Initial value
00000000B
7
6
5
4
3
2
1
0
DSSR
STP7
STP6
STP5
STP4
STP3
STP2
STP1
STP0
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
Initial value
00000000B
R/W: Readable/Writable
Note: DSSR uses STP8 to STP15 when the STPctrl bit in DCSR is set to "0", and uses STP0 to STP7 when
it is set to "1".
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
93
CHAPTER 4 μDMAC
4.2 Registers of μDMAC
MB90340E Series
• DMA Enable Register (DER)
bit
Address
0000ADH
bit
Address
0000ACH
15
14
13
12
11
10
9
8
DERH
EN15
EN14
EN13
EN12
EN11
EN10
EN9
EN8
Initial value
00000000B
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
7
6
5
4
3
2
1
0
DERL
EN7
EN6
EN5
EN4
EN3
EN2
EN1
EN0
Initial value
00000000B
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W: Readable/Writable
94
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 4 μDMAC
4.2 Registers of μDMAC
MB90340E Series
4.2.1
DMA Descriptor Channel Specification Register (DCSR)
The DMA descriptor channel specification register (DCSR) switches the descriptor
between channels. Use this register to specify a channel and then set the descriptor.
■ DMA Descriptor Channel Specification Register (DCSR)
Address
bit 15
00009BH
14
13
12
11
STPctrl Reserved Reserved Reserved DCSR3
R/W
R/W
R/W
R/W
R/W
10
9
8
DCSR2
DCSR1
DCSR0
R/W
R/W
R/W
Initial value
00000000B
R/W: Readable/Writable
[bit15] STPctrl (STP control bit)
STPctrl bit
Functions
0 [Initial value]
Selects STP8 to STP15 as DSSR.
1
Selects STP0 to STP7 as DSSR.
[bit14 to bit12] Reserved (reserved bits)
Reading the bits always returns "0".
Always write "0" to these bits.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
95
CHAPTER 4 μDMAC
4.2 Registers of μDMAC
MB90340E Series
[bit11 to bit8] DCSR3 to DCSR0 (DMA descriptor channel specification bits)
Table 4.2-1 Relationship between DCSR and Selected Channel
DCSR3 to DCSR0
Selected channel
Peripheral interrupt request
0000B
0
16-bit reload timer 0
0001B
1
16-bit reload timer 1
0010B
2
16-bit reload timer 2
0011B
3
External interrupt 8 to 11
0100B
4
External interrupt 12 to 15
0101B
5
A/D converter
0110B
6
Input capture 4/5
0111B
7
Output compare 4/5
1000B
8
Input capture 0/1
1001B
9
Output compare 6/7
1010B
10
(Reserved)
1011B
11
(Reserved)
1100B
12
UART3 RX
1101B
13
UART3 TX
1110B
14
UART2 RX
Note:
Based on the DCSR setting, the descriptor channel is selected from the 16 channels. For details,
see "4.3 DMA Descriptor Window Register (DDWR)".
96
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 4 μDMAC
4.2 Registers of μDMAC
MB90340E Series
4.2.2
DMA Status Register (DSR)
The DMA status register (DSR) indicates that DMA transfer is completed. When "1" is
set in this register, an interrupt occurs simultaneously.
■ DMA Status Register (DSR)
Address
bit 15
00009DH
Address
14
13
12
11
10
9
8
DSRH
DTE15
DTE14
DTE13
DTE12
DTE11
DTE10
DTE9
DTE8
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
Initial value
00000000B
6
5
4
3
2
1
0
DSRL
DTE7
DTE6
DTE5
DTE4
DTE3
DTE2
DTE1
DTE0
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
Initial value
00000000B
bit 7
00009CH
R/W: Readable/Writable
[bit15 to bit0] DTE15 to DTE0 (DMA status bits)
DTEx bit
0 [Initial value]
1
Functions
No interrupt has occurred due to completion of DMA transfer.
When DTEx are "0", always write "0" to these bits.
This indicates that DMA transfer is completed and an interrupt is being
requested. The bits cannot be set to "1" when DMA transfer is stopped by a
STOP request, except for the final transfer.
When DTEx are "1", writing "0" to these bits clears them to "0", and writing "1"
retains the previous data.
Note:
To write to DSR, use a read-modify-write (RMW) instruction.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
97
CHAPTER 4 μDMAC
4.2 Registers of μDMAC
4.2.3
MB90340E Series
DMA Stop Status Register (DSSR)
The DMA stop status register (DSSR) indicates that DMA transfer has been stopped by
a STOP request. The meaning of the bit indicated in this register varies depending on
the STPctrl bit in the DMA descriptor channel specification register (DCSR).
■ DMA Stop Status Register (DSSR)
When DCSR:STPctrl bit = 0
Address
bit 7
0000A4H
6
5
4
3
2
1
0
STP15
STP14
STP13
STP12
STP11
STP10
STP9
STP8
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
6
5
4
3
2
1
0
STP7
STP6
STP5
STP4
STP3
STP2
STP1
STP0
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
Initial value
00000000B
When DCSR:STPctrl bit = 1
Address
bit 7
0000A4H
Initial value
00000000B
R/W: Readable/Writable
[bit7 to bit0] STP15 to STP0 (DMA stop status bits)
STPx bit
Functions
0 [Initial value]
A STOP request has not been accepted from a peripheral during DMA transfer.
When STPx = 0, always write "0".
1
This indicates that DMA transfer has stopped upon reception of a STOP request
from a peripheral during the DMA transfer. Note however that when a STOP
request is accepted at the final transfer, STPx bits are not set to "1". When the
SE bit in the DMA control register is set to "1" and a STOP request is accepted
for the corresponding channel, the corresponding bit of the DMA enable register
is cleared to "0".
When STPx = "1", writing "0" clears them to "0" and writing "1" retains the
previous data.
Note:
To write to DSSR, use a read-modify-write (RMW) instruction.
98
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 4 μDMAC
4.2 Registers of μDMAC
MB90340E Series
The following 2 channels support the STOP request.
Channel
Corresponding STPx bit
Peripherals
ch.12
STP12
UART3 RX
ch.14
STP14
UART2 RX
Bits other than STP12 and STP14 have no meaning.
Note:
DSSR is controlled by the highest bit (STPctrl) of DCSR. When STPctrl is "0", STP8 to STP15 are
selected as DSSR. When STPctrl is "1", STP0 to STP7 are selected as DSSR. As the initial value of
STPctrl is "0", STP8 to STP15 are originally selected.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
99
CHAPTER 4 μDMAC
4.2 Registers of μDMAC
4.2.4
MB90340E Series
DMA Enable Register (DER)
The DMA enable register (DER) enables DMA transfer. When "1" is set in this register
and an interrupt request occurs at the corresponding channel, it is regarded as a DMA
transfer request and DMA transfer starts.
■ DMA Enable Register (DER)
Address
bit 15
0000ADH
Address
14
13
12
11
10
9
8
DERH
EN15
EN14
EN13
EN12
EN11
EN10
EN9
EN8
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
Initial value
00000000B
6
5
4
3
2
1
0
DERL
EN7
EN6
EN5
EN4
EN3
EN2
EN1
EN0
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
Initial value
00000000B
bit 7
0000ACH
R/W: Readable/Writable
[bit15 to bit0] EN15 to EN0: (DMA enable bits)
ENx bit
0 [Initial value]
1
Functions
DMA transfer is not executed.
An interrupt request from a peripheral is handled as a DMA start request and the
interrupt request is output to the interrupt controller upon completion of the
DMA transfer.
Cleared to "0" when there is no more DMA transfer, or when DMA transfer is
stopped by a STOP request from the peripheral.
Note:
To write to DER, use a read-modify-write (RMW) instruction.
100
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 4 μDMAC
4.3 DMA Descriptor Window Register (DDWR)
MB90340E Series
4.3
DMA Descriptor Window Register (DDWR)
The DMA descriptor consists of 16 channels of 8 bytes and is used to set DMA transfer. Out of
the 16 channels, one specified channel is mapped to the DMA descriptor window register
(DDWR) and can be accessed. The DDWR addresses are 0000D0H to 0000D7H.
■ Configuration of DMA Descriptor Window Register (DDWR)
The DMA descriptor consists of 16 channels of 8 bytes, and each channel is structured as illustrated in
Figure 4.3-1. The descriptor of the channel selected by the DMA descriptor channel specification register
(DCSR) or the interrupt request channel number is mapped to the DMA descriptor window register
(DDWR). For the relationship between the DMA descriptor channel specification register (DCSR) and the
selected channel, see Table 4.2-1.
Figure 4.3-1 Configuration of DMA Descriptor Window Register (DDWR)
Address
0000D7H
Upper 8 bits of data counter (DCTH)
0000D6H
Lower 8 bits of data counter (DCTL)
0000D5H
Upper 8 bits of I/O register address pointer (IOAH)
0000D4H
Lower 8 bits of I/O register address pointer (IOAL)
0000D3H
DMA Control Register (DMACS)
0000D2H
Upper 8 bits of buffer address pointer (BAPH)
0000D1H
Middle 8 bits of buffer address pointer (BAPM)
0000D0H
Lower 8 bits of buffer address pointer (BAPL)
■ Registers of DMA Descriptor
The registers that form the DMA descriptor are explained on the following pages. The initial value of each
register is undefined at a reset. Therefore, always initialize it before setting ENx to "1".
Note:
When the channel descriptor is switched by the DMA descriptor channel specification register
(DCSR), the DMA descriptor window register (DDWR) is not allowed to be accessed during 2
machine cycles.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
101
CHAPTER 4 μDMAC
4.3 DMA Descriptor Window Register (DDWR)
4.3.1
MB90340E Series
Data Counter (DCT)
The data counter (DCT) is a register that sets the number of data transfers.
When the data counter (DCT) is set to 0000H, the DMA transfer is completed.
■ Data Counter (DCT)
The data counter (DCT) is a 16-bit register that corresponds to the number of transfers. After the transfer of
each data item, the counter decrements (decreases) the values by 1, regardless of whether it is a word or
byte transfer. The DMA transfer is terminated when this counter reaches "0". Figure 4.3-2 shows the
configuration of the data counter (DCT).
Setting 0000H in DCT sets the maximum number of data transfers (65536).
Figure 4.3-2 Data Counter (DCT)
Address
0000D7H /0000D6H
bit 15
DCT
14
13
DCTH
12
11
DCTL
10
9
8
7
6
5
4
3
2
1
0
B15 B14 B13 B12 B11 B10 B09 B08 B07 B06 B05 B04 B03 B02 B01 B00
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
Initial value
XXXXXXXXXXXXXXXXB
R/W : Readable/writable
X : Undefined
■ Setting Value of Data Counter (DCT)
The relationship between the number of transfer bytes and the data counter (DCT) is as follows.
DMACS
DCT
BW bit
BYTEL bit
0
—
N
1
0
N/2
1
1
(N+1)/2
N: Number of transfer bytes
102
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 4 μDMAC
4.3 DMA Descriptor Window Register (DDWR)
MB90340E Series
4.3.2
I/O Register Address Pointer (IOA)
The I/O register address pointer (IOA) sets the I/O address pointer. The upper bits of the
address (A23 to A16) are fixed to 00H.
■ I/O Register Address Pointer (IOA)
The I/O register address pointer (IOA) is a 16-bit register that indicates the lower 16 bits (A15 to A00) of
the I/O register address. All of upper addresses (A23 to A16) are "0", and any I/O between addresses
000000H and 00FFFFH can be specified. When the IF bit (IOA update/fixing selection bit) in the DMA
control register (DMACS) is set to "perform update", IOA is updated by "+1" for a byte transfer, and by
"+2" for a word transfer. When the IF bit is set to "perform no update", IOA is fixed. Figure 4.3-3 shows
the configuration of the I/O register address pointer (IOA).
Figure 4.3-3 Configuration of the I/O Register Address Pointer (IOA)
Address
0000D5H /0000D4H
bit 15
IOA
14
13
IOAH
12
11
IOAL
10
9
8
7
6
5
4
3
2
1
0
A15 A14 A13 A12 A11 A10 A09 A08 A07 A06 A05 A04 A03 A02 A01 A00
Initial value
XXXXXXXXXXXXXXXXB
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
R/W : Readable/writable
X : Undefined
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
103
CHAPTER 4 μDMAC
4.3 DMA Descriptor Window Register (DDWR)
4.3.3
MB90340E Series
DMA Control Register (DMACS)
The DMA control register (DMACS) controls DMA transfers.
The DMA control register (DMACS) can be used to control the following:
• Direction control (IOA →BAP, BAP →IOA)
• Transfer bit length (byte, word)
• Address update (enabled, disabled)
• Transfer interval
• Odd-numbered byte control during word transfer
■ DMA Control Register (DMACS)
The DMA control register (DMACS) is an 8-bit register that updates or fixes the buffer address pointer and
the I/O register address pointer. It also indicates the transfer data length (byte/word), specifies the transfer
direction and byte transfer option, and gives a wait indication. Figure 4.3-4 shows the configuration of the
DMA control register (DMACS).
104
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 4 μDMAC
4.3 DMA Descriptor Window Register (DDWR)
MB90340E Series
Figure 4.3-4 Configuration of DMA Control Register (DMACS)
7
bit
Address
RDY2
0000D3H
R/W
6
5
4
3
2
1
0
RDY1
BYTEL
IF
BW
BF
DIR
SE
R/W
R/W
R/W
R/W
R/W
R/W
R/W
SE
Initial value
XXXXXXXXB
DMA transfer end control bit
0
Does not end transfer by request from peripheral function
1
Ends transfer by request from peripheral function
DIR
Data transfer direction specification bit
0
I/O register address pointer → Buffer address pointer
1
Buffer address pointer → I/O register address pointer
BF
BAP update/fixing selection bit
0
Updates buffer address pointer after data transfer
1
Does not update buffer address pointer after data transfer
BW
Transfer data length specification bit
0
Byte
1
Word
IF
IOA update/fixing selection bit
0
Updates I/O register address pointer after data transfer
1
Does not update I/O register address pointer after data transfer
BYTEL Byte transfer specification bit (Only valid for word transfer)
0
Even-numbered byte
1
Odd-numbered byte
Wait indication bits (See Figure 4.3-5)
RDY2 RDY1
R/W: Readable/writable
X: Undefined
0
0
Does not place a wait between transfers
0
1
Place 1 cycle of wait between transfers
1
0
Place 2 cycles of wait between transfers
1
1
Place 3 cycles of wait between transfers
Figure 4.3-5 Explanation of Wait Indication Bits
Reading transfer source
Writing transfer
destination
Wait
Reading transfer source
Writing transfer
destination
RDY2 and RDY1 are used to define the length
of the waiting part of transfer as shown in the
above figure.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
105
CHAPTER 4 μDMAC
4.3 DMA Descriptor Window Register (DDWR)
4.3.4
MB90340E Series
DMA Buffer Address Pointer (BAP)
The DMA buffer address pointer (BAP) is a register that sets the buffer address pointer.
A23 to A00 can be set to the DMA buffer address pointer (BAP).
■ DMA Buffer Address Pointer (BAP)
The DMA buffer address pointer (BAP) is a 24-bit register that stores the address used for DMA transfer.
As BAP exists independently, corresponding to separate DMA channels, each channel of DMA can transfer
data between any 16Mbyte address and I/O. When the BF bit (BAP update/fixing selection bit) in the DMA
control register (DMACS) is set to "perform update", the lower 16 bits of BAP (BAPM, BAPL) are
updated by "+1" for a byte transfer, and by "+2" for a word transfer. The upper 8 bits (BAPH) remain
unchanged. Figure 4.3-6 shows the configuration of the buffer address pointer (BAP).
Figure 4.3-6 Configuration of the Buffer Address Pointer (BAP)
Address : 0000D2H /0000D1H /0000D0H
bit23
BAP
to bit16 bit15 to
bit8 bit7
BAPH
BAPM
R/W
R/W
to
BAPL
bit0
Initial value
XXXXXXH
R/W
R/W: Readable/writable
X: Undefined
Notes:
• The I/O register address pointer (IOA) can specify the area from "000000H" to "00FFFFH".
• The area that can be specified by the buffer address pointer (BAP) is between 000000H and
FFFFFFH.
• It is prohibited to set IOA and BAP to the addresses of μDMAC internal registers (DCSR, DSRH,
DSRL, DSSR, DERH and DERL), and the address of the DMA descriptor window register
(DDWR).
106
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 4 μDMAC
4.4 Operations of μDMAC
MB90340E Series
4.4
Operations of μDMAC
This section explains the operation of μDMAC.
■ Operation of μDMAC
Figure 4.4-1 shows a block diagram for explaining the operation of μDMAC.
Note:
To write to an internal register (DSRH, DSRL, DSSR, DERH, or DERL), use a read-modify-write
(RMW) instruction.
Figure 4.4-1 Operation of μDMAC
Memory space
IOA
I/O register
Peripheral
function
(I/O)
I/O register
(4) (a)
Descriptor RAM
(1)
(2)
(3)
DMA controller
(2)
DMA descriptor
(4) (b)
BAP
Buffer
CPU
Interrupt
controller
DCT
(1) A peripheral (I/O) requests DMA transfer.
(2) When the DMA enable register (DER) is "1", DMAC reads the transfer source and
destination addresses of the specified channel as well as transfer data such as the number
of transfers from the descriptor.
(3) DMA data transfer starts between I/O and memory.
(4) After 1 byte or 1 word is transferred:
(a) If the transfer is not completed (data counter (DCT) ≠ 0),
the peripheral will be requested to clear the DMA transfer request.
(b)If the transfer is completed (data counter (DCT) = 0),
a transfer end flag is set in the DMA status register upon completion of the DMA transfer,
and an interrupt request is output to the interrupt controller.
CM44-10143-5E
IOA : I/O register address pointer
DER : DMA enable register
BAP: Buffer address pointer
DCT : Data counter
FUJITSU SEMICONDUCTOR LIMITED
107
CHAPTER 4 μDMAC
4.4 Operations of μDMAC
MB90340E Series
■ μDMAC Application Procedure
Figure 4.4-2 shows the application procedure for μDMAC.
Figure 4.4-2 μDMAC Application Procedure
Software processing
Harware processing
(Interrupt occurs)
Start
NO
Relevant channel:
ENx=1
Setting of system stack area
Initial setting
YES
YES
Initial setting of peripheral function
STOP request and SE=1
NO
Setting of interrupt control register
DMA transfer
(BAP)
(IOA)
Initial setting of μDMAC
BF = 0
NO
NO
IF = 0
YES
Execution of user program
BW = 1
YES
NO
BW = 1
YES
BYTEL = 0
YES
YES
NO
NO
BAP = BAP+2
NO
BYTEL = 0
YES
DCT = 0
YES
NO
IOA = IOA+2
BAP = BAP+1
NO
DCT = 0
YES
IOA = IOA+1
NO
STPx = 1
DCT = 0
YES
DTEx = 1
(To interrupt routine)
Interrupt processing
ENx = 0
*
Interrupt generation
NO
Another
interrupt occurs
YES
YES
NO
Processing
completed
ENx : Relevant bit of DMA enable register (DER)
DTEx: Relevant bit of DMA status register (DSR)
STPx : Relevant bit of DMA stop status register (DSSR)
*
: Outputting interrupt request to interrupt controller
108
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 4 μDMAC
4.4 Operations of μDMAC
MB90340E Series
■ Number of Data Transfer Cycles (Internal Transfer)
When μDMAC obtains the bus grant and data is transferred within the LSI, the number of transfer cycles is
as follows.
Table 4.4-1 Cycles from Obtaining Bus Grant until Transfer Start
Match between DCSR3 to DCSR0 in DCSR
and interrupt request channels
Mismatch between DCSR3 to DCSR0 in
DCSR and interrupt request channels
1 Machine cycle
2 Machine cycles
Table 4.4-2 Transfer Cycles
Address pointer
DMACS
Number of cycles
BAP
IOA
BW
BYTEL
⎯
⎯
0
⎯
4 + (RDY2, RDY1)*1 Machine cycle
O
E
1
⎯
6 + (RDY2, RDY1)*2 Machine cycle
E
O
O
O
1
⎯
8 + (RDY2, RDY1)*2 Machine cycle
E
E
1
⎯
4 + (RDY2, RDY1)*1 Machine cycle
*1: RDY2, RDY1 becomes 00B at the final transfer.
*2: When BYTEL is "1", the number of cycles is 4, and RDY2, RDY1 becomes 00B.
When BYTEL is "0", RDY2, RDY1 becomes 00B.
O : Odd-numbered address
E : Even-numbered address
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
109
CHAPTER 4 μDMAC
4.4 Operations of μDMAC
MB90340E Series
■ Watchdog Timer
Figure 4.4-3 shows the operation of the watchdog timer during DMA transfer. A reset occurs during
transfer, when the transfer exceeds the interval time of the watchdog timer set by the WT1/WT0 bits in the
watchdog timer control register (WDTC).
Figure 4.4-3 Watchdog Timer during DMAC Transfer
Count continues
Count starts
Count starts
Reset
(1)
Reset canceled
WTEbit=0
WTEbit=0
μMDAC register settings
DCSR : Channel selected
DER : DMA enabled
DDWR: DCT = 10
The number of
transfers: 10
BW=0
Byte transfer
110
(2)
(3)
(4)
(5)
(6)
(7)
μDMAC activated
1st transfer starts
Interrupt source generated
(1)
(2)
(3)
(4)
(5)
(6)
(7)
(8)
(9)
(10)
1st 1-byte transfer in progress
2nd 1-byte transfer in progress
3rd 1-byte transfer in progress
4th 1-byte transfer in progress
5th 1-byte transfer in progress
6th 1-byte transfer in progress
7th 1-byte transfer in progress
8th 1-byte transfer in progress
9th 1-byte transfer in progress
10th 1-byte transfer in progress
FUJITSU SEMICONDUCTOR LIMITED
(8)
(9)
(10)
Time
Jump to interrupt routine
Interrupt processing
executed
μDMAC transfer completed
To interrupt controller
Interrupt request generated
CM44-10143-5E
MB90340E Series
4.5
Notes on Using μDMAC
CHAPTER 4 μDMAC
4.5 Notes on Using μDMAC
This section explains notes on the using μDMAC.
■ Changing to the Low-power Consumption Mode
Please shift to the mode after setting "0000H" to DMA enable register (DER) whenever shifting to stand-by
mode (sleep mode, stop mode, watch mode, time-base timer mode) or (main clock intermittent operation
mode, PLL clock intermittent operation mode, sub clock intermittent operation mode).
■ Use of μDMAC in CAN Controller
• When the CAN controller is enabled (CSR:HALT=0 and either of BVALR:BVALx bits is "1" or either
of TREQR:TREQx bits is "1"), the message buffer of the CAN controller cannot be accessed (read and
write) using μDMAC.
• To access (read and write) the message buffer of the CAN controller using μDMAC, be sure that the
CAN controller is in the stop state (BVALR:BVALx bits and TREQR:TREQx bits are all "0", or CSR:
HALT=1).
■ Use of μDMAC in LIN-UART
When transfer data is written to LIN-UART using μDMAC, do not set to 00B in RDY2 and RDY1 bits of
DMA control register (DMACS).
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
111
CHAPTER 4 μDMAC
4.5 Notes on Using μDMAC
112
MB90340E Series
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 5
DELAY INTERRUPT
This chapter describes the functions and operations of
the delayed interrupt.
5.1 Overview of Delay Interrupt
5.2 Block Diagram of Delay Interrupt
5.3 Configuration of Delay Interrupt
5.4 Operating Explanation of Delay Interrupt
5.5 Precautions when Using Delay Interrupt
5.6 Program Example that uses Delay Interrupt
Code: CM44-00109-3E
Page: 114
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
113
CHAPTER 5 DELAY INTERRUPT
5.1 Overview of Delay Interrupt
5.1
MB90340E Series
Overview of Delay Interrupt
The delay interrupt is a function to generate the hardware interruption used for the task
switch such as Realtime Operating Systems. Software can generate a hardware interrupt
request.
■ Overview of Delay Interrupt
By using the delay interruption, a hardware interruption demand is generated, and can be released with
software.
Table 5.1-1 shows the overview of delay interrupt.
Table 5.1-1 Overview of Delay Interrupt
Function and Control
114
Interrupt source
An interrupt request is generated by setting the R0 bit in the delay interrupt request
generation/release register to "1" (DIRR: R0 = 1), an interrupt request is generated.
An interrupt request is generated by setting the R0 bit in the delay interrupt request
generation/release register to "0" (DIRR: R0 = 0), an interrupt request is generated.
Interrupt No.
#42 (2AH)
Interrupt control
Register does not enable any setting.
Interrupt flag
The interrupt flag is held in the R0 bit in the DIRR register.
EI2OS/μDMAC
It does not support the extended intelligent I/O service and DMA transfer.
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 5 DELAY INTERRUPT
MB90340E Series
5.2
5.2 Block Diagram of Delay Interrupt
Block Diagram of Delay Interrupt
The delay interrupt consists of the following blocks:
• Interrupt request latch
• Delay Interrupt Request Generation/Release Register (DIRR)
■ Block Diagram of Delay Interrupt
Figure 5.2-1 Block Diagram of Delay Interrupt
Internal data bus
-
-
-
-
-
-
-
R0
Delay Interrupt Request Generation/Release
Register (DIRR)
S
R
Interrupt
request signal
Interrupt Request Latch
− : Undefined bit
● Interrupt request latch
This latch keeps the settings (delay interrupt request generation or release) of the delay interrupt request
generation/release register (DIRR).
● Delay Interrupt Request Generation/Release Register (DIRR)
Generates or releases a delay interrupt request.
■ Interrupt No.
The interrupt number used by the delay interrupt is interrupt number #42 (2AH).
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
115
CHAPTER 5 DELAY INTERRUPT
5.3 Configuration of Delay Interrupt
5.3
MB90340E Series
Configuration of Delay Interrupt
This section lists registers for the delay interrupt and its details.
■ List of Registers and Initial Values
Figure 5.3-1 List of Registers for Delay Interrupt and its Initial Values
Delay Interrupt Request Generation/
Release register (DIRR)
Address: 00009FH
X
116
bit
7
6
5
4
3
2
1
0
X
X
X
X
X
X
X
0
: Undefined
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 5 DELAY INTERRUPT
MB90340E Series
5.3.1
5.3 Configuration of Delay Interrupt
Delay Interrupt Request Generation/Release Register
(DIRR)
The delay interrupt request generation/release register (DIRR) generates or releases a
delay interrupt request.
■ Delay Interrupt Request Generation/Release Register (DIRR)
Figure 5.3-2 Delay Interrupt Request Generation/Release Register (DIRR)
Address
bit
00009FH
−
R/W
X
7
6
5
4
3
2
1
0
−
−
−
−
−
−
−
R0
−
−
−
−
−
−
−
R/W
: Undefined bit
: Readable/Writable
: Undefined
: Initial value
Initial value
XXXXXXX0B
bit0
R0
Delay interrupt request generation bit
0
Releases the delay interrupt request
1
Generates the delay interrupt request
Table 5.3-1 Functions of Delay Interrupt Request Generation/Release Register (DIRR)
Bit name
CM44-10143-5E
Function
bit7
to
bit1
Undefined bit
Read : The value is undefined.
Write : No effect
bit0
R0:
Delay interrupt request
generation bit
Generates or releases a delay interrupt request.
When set to "0": Releases the delay interrupt request
When set to "1": Generates a delayed interrupt request
FUJITSU SEMICONDUCTOR LIMITED
117
CHAPTER 5 DELAY INTERRUPT
5.4 Operating Explanation of Delay Interrupt
5.4
MB90340E Series
Operating Explanation of Delay Interrupt
The delay interrupt has a function for generating or releasing an interrupt request by
software.
■ Operating Explanation of Delay Interrupt
To use the delay interrupt, the setting shown in Figure 5.4-1 is required.
Figure 5.4-1 Setting for Delay Interrupt
DIRR
−
bit7
6
5
4
3
2
1
bit0
−
−
−
−
−
−
−
R0
: Undefined bits
: Used bit
An interrupt request is generated by setting the R0 bit in the delay interrupt request generation/release
register to "1" (DIRR: R0 = 1). There is no enable bit for an interrupt request.
● Operation of delay interrupt generation module
• When the R0 bit in the delay interrupt request generation/release register (DIRR) is set to "1", the
interrupt request latch is set to "1" and an interrupt request is generated to the interrupt controller.
• An interrupt request is generated to the CPU when the interrupt controller prioritizes the interrupt
request over other requests.
• On the CPU side, if the level of an interrupt request (ICR:IL) is higher than that of the interrupt level
mask in the condition code register (CCR:ILM), the CPU generates delay interrupt processing after
completion of the current instruction execution.
• Within the interrupt processing, the user program sets the R0 bit to "0" to release the interrupt request
and switch the task.
Figure 5.4-2 shows the operation of the delay interrupt.
Figure 5.4-2 Operation of Delay Interrupt
Delay interrupt generation module
Other
request
DIRR
Interrupt controller
ICR YY
CPU
IL
CMP
CMP
ICR XX
118
ILM
FUJITSU SEMICONDUCTOR LIMITED
Interrupt
processing
CM44-10143-5E
CHAPTER 5 DELAY INTERRUPT
MB90340E Series
5.5
5.5 Precautions when Using Delay Interrupt
Precautions when Using Delay Interrupt
When using the delay interrupt, take the following precautions.
■ Precautions when Using Delay Interrupt
• Restart the interrupt processing when returned from interrupt processing without setting the R0 bit in the
delay interrupt request generation/release register (DIRR) to "0" within an interrupt processing routine.
• Unlike software interrupts, interrupts in the delay interrupt generation module are accompanied by
delays.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
119
CHAPTER 5 DELAY INTERRUPT
5.6 Program Example that uses Delay Interrupt
5.6
MB90340E Series
Program Example that uses Delay Interrupt
The program example that uses the delay interruption is shown.
■ Program Example of Delay Interrupt
● Processing specifications
The main program writes "1" to the R0 bit in the delay interrupt request generation/release register (DIRR)
to generate a delay interrupt request and performs task switching.
● Coding example
ICR15
DIRR
;Interrupt control register
;Delay interrupt source generation/
;release register
DIRR_R0 EQU
DIRR:0
;Delay interrupt request generation
;bit
;---------Main program----------------------------------------------CODE
CSEG
START:
;Data such as stack pointer (SP)
;are supposed to be initialized
AND
CCR,#0BFH
;Interrupt prohibited
MOV
I:ICR15,#00H
;Interrupt level 0 (highest)
MOV
ILM,#07H
;ILM in PS set to level 7
OR
CCR,#40H
;Interrupt allowed
SETB
I:DIRR_R0
;Delay interrupt request generated
LOOP
MOV
A,#00H
;Infinite loop
MOV
A,#01H
BRA
LOOP
;---------Interrupt program-----------------------------------------WARI:
CLRB
I:DIRR_R0
;Interrupt request flag cleared
:
;
User process
;
:
RETI
;Returns from the interrupt
CODE
ENDS
;---------Vector setting--------------------------------------------VECT
CSEG
ABS=0FFH
ORG
0FF54H
;Sets a vector for the interrupt #42
;(2AH)
VECT
120
EQU
EQU
0000BFH
00009FH
DSL
ORG
DSL
DB
ENDS
END
WARI
0FFDCH
START
00H
;Reset vector set
;Setting to the single chip mode
START
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 6
CLOCK
This chapter describes the clock.
6.1 Clock
6.2 Block Diagram of the Clock Generation Block
6.3 Clock Selection Registers (CKSCR)
6.4 PLL/Sub Clock Control Register (PSCCR)
6.5 Clock Mode
6.6 Oscillation Stabilization Wait Time
6.7 Connection of the Oscillator and External Clock
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
121
CHAPTER 6 CLOCK
6.1 Clock
6.1
MB90340E Series
Clock
The clock generation block controls the internal clock that controls operation of the
CPU and peripheral functions. The clock generated in the clock generation block is
referred to as machine clock and its one cycle as machine cycle. In addition, the clock
provided from a high-speed oscillator is referred as oscillation clock and the divide-bytwo frequency of the oscillation clock is referred as main clock. The divide-by-two or
divide-by-four frequency of the clock that is provided from a low-speed oscillator is
referred as sub clock, and a clock generated by the PLL oscillation as PLL clock.
■ Clock
The clock generation block contains the oscillation circuit that generates the oscillation clock by connecting
the oscillator to the oscillation pin. The oscillation clock can also be supplied by inputting an external clock
to the oscillation pin. The clock generation block also contains the PLL clock multiplier circuit and it can
generate 5 clocks of which frequencies are multiples of the oscillation clock frequency. The clock
generation block controls the oscillation stabilization wait time and PLL clock multiplication and switching
operation of the internal clock by the clock selector.
● Oscillation clock (HCLK)
The oscillation clock is generated either by connecting the high-speed oscillation pins (X0, X1) to an
oscillator or by inputting an external clock.
● Main clock (MCLK)
The clock that has the divided-by-two frequency of the oscillation clock supplies the input clock to the
time-base timer and the clock selector.
● Sub clock (SCLK)
The clock generated by connecting an oscillator to the low-speed oscillation pins (X0A, X1A) or by
dividing the clock, generated by inputting an external clock, by 4 or 2. The division ratio of the sub clock is
set with SCDS bit in the PPL/sub clock control register (PSCCR). This clock can be used as the operating
clock in the watch timer or the low-speed machine.
● PLL clock (PCLK)
The PLL clock is obtained by multiplying the oscillation clock with the PLL clock multiplier circuit (PLL
oscillation circuit). You can select among 5 types of clocks, depending on the setting of the multiplication
rate select bits (CKSCR: CS1, CS0, PSCCR: CS2).
122
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 6 CLOCK
6.1 Clock
MB90340E Series
● Machine clock
This is the operation clock for the CPU and peripheral functions. One cycle of the machine clock is defined
as a machine cycle (1/φ). A machine clock can be selected among any of the main clock, sub clock or 5
types of PPL clocks.
Note:
When the operating voltage is 5 V, an oscillation clock of 3 to 16 MHz can be generated. When
inputting an external clock, you can use an external clock from 3 to 24 MHz. The maximum operating
frequency for the CPU and peripheral functions is 24 MHz. Therefore if the multiplier rate that
exceeds the max operating frequency, devices will not operate correctly. Therefore, when inputting a
24 MHz of external clock, only 1 can be set for the multiplication rate of the PPL clock. Although the
PPL oscillation can generate from 4 to 24 MHz, the oscillation range of PPL depends on the
operating voltage and multiplication rate. Refer to "Data sheet" for details.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
123
CHAPTER 6 CLOCK
6.1 Clock
MB90340E Series
■ Clock Supply Map
Machine clock generated in the clock generation block is supplied as the operating clock for the CPU and
peripheral functions. The operation of the CPU and the peripheral functions are affected by switching
between main clock and sub clock, switching the PLL clock (clock mode) and by a change in the PLL
clock multiplication rate. Since some peripheral functions receive divided output from the time-base timer,
a peripheral unit can select the clock best suited for this operation.
Figure 6.1-1 shows the clock supply map.
Figure 6.1-1 Clock Supply Map
Peripheral function
4
Watch timer
4
Watchdog timer
Time-base timer
Clock generation block
X0A
Pin
X1A
Pin
X0
Pin
X1
Pin
1
2
3
4
Clock selector
Divide-by
four/two
Pin
PPG0 to PPGF
16-bit reload timer
0 to 3
Pin
TIN0 to TIN3
Pin
TOT0 to TOT3
Pin
RX0 to RX2
Pin
TX0 to TX2
Pin
AN0 to AN23
6
PLL multiplier circuit
PCLK (PLL clock)
Clock
generation
circuit
8/16-bit PPG timer
0 to F
CAN0 to 2
φc
Clock modulator
A/D converter (24ch)
(Sub clock)
SCLK
Clock
Divide-by-two
Clock selector
generation
HCLK
MCLK
φ
circuit
(Oscillation clock) (Main clock)
(Machine clock)
UART0 to 4
serial I/O
Pin
SCK0 to SCK4
Pin
SIN0 to SIN4
Pin
SOT0 to SOT4
Pin
OUT0 to OUT7
Pin
IN0 to IN7
Pin
SDA0, SDA1
Pin
SCL0, SCL1
Pin
CKOT
I/O timer
μDMA
Output compare
0 to 7
CPU
Free-run timer
0 and 1
Input capture
0 to 7
I2CO, 1
HCLK :
MCLK :
PCLK :
SCLK :
φ
:
φC
:
124
Oscillation clock
Main clock
PLL clock
Sub clock
Machine clock
CAN0 to CAN2 clock
Clock monitor
4
Oscillation stabilization
wait control
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 6 CLOCK
6.2 Block Diagram of the Clock Generation Block
MB90340E Series
6.2
Block Diagram of the Clock Generation Block
The clock generation block consists of the following blocks:
• Oscillation clock generation circuit/sub clock generation circuit
• PLL multiplier circuit
• Clock selector
• Clock selection registers (CKSCR)
• PLL/sub clock control registers (PSCCR)
• Oscillation stabilization wait time selector
■ Block Diagram of the Clock Generation Block
Figure 6.2-1 shows a block diagram of the clock generation block, including the standby control circuit and
the time-base timer circuit.
Figure 6.2-1 Block Diagram of the Clock Generation Block
Low-power consumption mode control register (LPMCR)
STP SLP SPL RST TMD CG1 CG0
Reserved
RST Pin
CPU intermittent
operation cycle
selector
Pin high
impedance
control circuit
Pin Hi-Z control
Internal reset
generation
circuit
Internal reset
Intermittent cycle select
CPU clock
control circuit
Reset (release)
Watch, stop and sleep signals
Standby
control circuit
2
Watch and stop signals
Peripheral
Peripheral functions
clock control
operating clock
circuit
Interrupt (release)
Sub clock oscillation stabilization wait release
Main clock oscillation stabilization wait
Clock generation
block
Operating clock
selector
Machine
clock
2
CS2
PLL/Sub clock
control resisters
(PSCCR):bit8
Oscillation
stabilization
wait selector
2
PLL multiplier
circuit
SCM MCM WS1 WS0 SCS MCS CS1 CS0
Clock selection register (CKSCR)
Divideby-two
X0 Pin
X1 Pin
CPU operating
clock
Oscillation clock
(HCLK)
Oscillation clock
oscillation circuit Sub clock
(SCLK)
X0A Pin
Divide-byfour/divideby-two
Divide-
Divide-
by-four
Main by-512
clock
Time-base timer
Divideby-1024
Divideby-two
Divideby-two
Divideby-two
Divideby-two
Divideby-two
Divideby-four
To watchdog timer
Divideby-eight
Divideby-two
Divideby-two
Watch timer
X1A Pin
SCDS
Sub clock oscillation circuit
CM44-10143-5E
PLL/sub clock
control resisters
(PSCCR):bit10
FUJITSU SEMICONDUCTOR LIMITED
125
CHAPTER 6 CLOCK
6.2 Block Diagram of the Clock Generation Block
MB90340E Series
● Oscillation clock generation circuit
The oscillation clock (HCLK) is generated either by connecting the high-speed oscillation pins to the
oscillator or by inputting an external clock.
● Sub clock generation circuit
The sub clock (SCLK) is generated either by connecting the low-speed oscillation pins (X0A, X1A) to an
oscillator or by inputting an external clock.
● PLL multiplier circuit
The PLL multiplier circuit multiplies the oscillation clock with the PLL oscillation and supplies the clock
as a PLL clock (PCLK) to the clock selector.
● Clock selector
It selects the clock to supply to the CPU and peripheral functions among the main clock, sub clock and 5
types of PLL clocks.
● Clock selection registers (CKSCR)
The clock selection register switches the oscillation clock/PLL clock and main clock/sub clock, and selects
an oscillation stabilization wait time and a PLL clock multiplication rate.
● PLL/sub clock control registers (PSCCR)
This register selects the PLL clock multiplication rate (selects by the setting of CS0 and CS1 bits in the
clock selection register, and setting of CS2 bit in this register) and sets the sub clock division ratio (divideby-two/divide-by-four).
● Oscillation stabilization wait time selector
This selector selects an oscillation stabilization wait time. Selection is made from among 4 types of timebase timer outputs.
126
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 6 CLOCK
6.2 Block Diagram of the Clock Generation Block
MB90340E Series
6.2.1
Register in the Clock Generation Block
This section explains the register in the clock generation block.
■ List of the Register in the Clock Generation Block and Its Initial Value
Figure 6.2-2 List of Clock Selection Register and Its Initial Value
bit
15
14
13
12
11
10
9
8
Clock selection register (CKSCR)
1
1
1
1
1
1
0
0
PLL/sub clock control registers (PSCCR)
×
×
×
×
0
0
0
0
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
127
CHAPTER 6 CLOCK
6.3 Clock Selection Registers (CKSCR)
6.3
MB90340E Series
Clock Selection Registers (CKSCR)
The clock selection register (CKSCR) switches the PLL clock, main clock and sub clock,
and selects an oscillation stabilization wait time and the PLL clock multiplication rate.
■ Clock Selection Registers (CKSCR)
Figure 6.3-1 Clock Selection Register (CKSCR)
Address
bit15 bit14 bit13 bit12 bit11 bit10 bit9
0000A1H
SCM MCM WS1 WS0 SCS MCS CS1 CS0 11111100B
R
R
bit8 Initial value
R/W R/W R/W R/W R/W R/W
CS2 (PSCCR register: bit8)
bit9
bit8
CS0
Multiplier selection bits
The results when the oscillation clock
(HCLK) frequency is 4 MHz is shown
between parentheses
CS2
CS1
0
0
0
1 × HCLK (4 MHz)
0
0
1
2 × HCLK (8 MHz)
0
1
0
3 × HCLK (12 MHz)
0
1
1
4 × HCLK (16 MHz)
1
1
0
6 × HCLK (24 MHz)
1
1
1
Setting disabled
bit10
MCS
PLL clock selection bit
0
Selects PLL clock
1
Selects main clock
bit11
SCS
Sub clock selection bit
0
Selects sub clock
1
Selects main clock
bit13 bit12
Oscillation stabilization wait time selection bits
WS1 WS0 The results when the oscillation clock (HCLK) frequency is
4 MHz is shown between parentheses
0
0
210/HCLK (approx. 256 μs)
0
1
213/HCLK (approx. 2.05 ms)
1
0
217/HCLK (approx. 32.77 ms)
1
1
215/HCLK (approx. 8.19 ms; except power-on reset)
216/HCLK (approx. 16.38 ms; power-on reset only)
bit14
MCM
HCLK
R/W
R
128
: Oscillation clock
: Readable/Writable
PLL clock operating bit
0
Operating with PLL clock
1
Operating with main clock or sub clock
bit15
SCM
Sub clock operating bit
: Read only
0
Operating with sub clock
: Initial value
1
Operating with PLL clock or main clock
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 6 CLOCK
6.3 Clock Selection Registers (CKSCR)
MB90340E Series
Table 6.3-1 Functions of Clock Selection Register (CKSCR) (1 / 2)
Bit name
Function
bit15
SCM:
Sub clock operation flag
bit
Indicates whether the main clock or sub clock has been selected as the machine clock.
• When the sub clock operating flag bit (CKSCR: SCM) is "0" and the sub clock selection bit
(CKSCR: SCS) is "1", it indicates that it is in the transition period from the sub clock to the
main clock. On the other hand, when SCM is "1" and SCS is "0", it indicates that it is in the
transition period from the main clock to the sub clock.
• Writing to this bit has no effect on operation.
bit14
MCM:
PLL clock operating flag
bit
Indicates whether the main clock or PLL clock has been selected as the machine clock.
• When the PLL clock operating flag bit (CKSCR: MCM) is "1" and the PLL clock selection bit
(CKSCR: MCS) is "0", it indicates that it is during the PLL clock oscillation stabilization wait
time.
• Writing to this bit has no effect on operation.
WS1, WS0:
Oscillation stabilization
wait time selection bits
Selects the oscillation stabilization wait time of the oscillation clock when releasing the stop mode,
transiting from sub clock to main clock mode, and transiting from sub clock to PLL clock mode.
• Selects from among 4 types of time-base timer outputs.
Returns to the initial value by resetting all.
Note:
An appropriate value must be set for the oscillation stabilization wait time according to the
oscillator. Refer to Section "7.2 Reset Source and Oscillation Stabilization Wait Times" for
details.
The oscillation stabilization wait time is fixed to 214/HCLK when switching from the main
clock to the PLL clock mode (when the oscillation clock frequency is 4 MHz: approx. 4.1 ms).
The oscillation stabilization wait time depends on the value set in the bits when switching from
the sub clock to the PLL clock mode or returning from PLL stop to PLL clock mode.
Since the PLL clock oscillation stabilization wait time requires 214/HCLK or more, when
switching from sub clock to PLL clock mode or transiting to PLL stop mode, set 10B or 11B for
these bits.
bit13,
bit12
bit11
SCS:
Sub clock selection bit
CM44-10143-5E
Specifies whether the main clock or sub clock to be selected as the machine clock.
• When switching from the main clock to sub clock (CKSCR: SCS=1→ 0), it is switched to 1/
SCLK (when the oscillation clock frequency is 32.768 kHz and divide-by-four setting: approx.
130 μs) sub clock mode, synchronizing with the sub clock.
• When switching from the sub clock to main clock (CKSCR: SCS=0→ 1), it is switched to the
main clock mode after the main clock oscillation stabilization wait time is generated. The timebase time will be cleared automatically.
Returns to the initial value by resetting all.
Notes:
1) When both MCS and SCS bits are "0", SCS is preferred, and the sub clock is selected.
2) When both sub clock selection bit (CKSCR: MCS) and PLL clock selection bit (CKSCR:
SCS) are "0", the sub clock is preferred.
3) Write after switching from the main clock to sub clock (CKSCR: SCS=1→ 0), disables the
time-base timer interrupt through the interrupt enable bit (TBTC: TBIE) in the time-base
timer or the interrupt level mask registers (ILM: ILM2 to 0).
4) When turning on the power or releasing form the stop mode, a sub clock oscillation
stabilization wait time 214/SCLK (when the oscillation clock frequency is 32.768 kHz and
divide-by-four setting: approx. 2 s) is generated. Therefore, if switching from the main
clock to the sub clock mode during that period, an oscillation stabilization wait time will be
generated.
FUJITSU SEMICONDUCTOR LIMITED
129
CHAPTER 6 CLOCK
6.3 Clock Selection Registers (CKSCR)
MB90340E Series
Table 6.3-1 Functions of Clock Selection Register (CKSCR) (2 / 2)
Bit name
bit10
MCS:
PLL clock selection bit
Function
Specifies whether the main clock or PLL clock to be selected as the machine clock.
When switched from the main clock to the PLL clock (CKSCR: MCS=1→ 0), the PLL clock
oscillation stabilization wait time is generated, and then the transition to the PLL clock mode is
made. The time-base timer is cleared automatically. The oscillation stabilization wait time is fixed
to 214/HCLK (when the oscillation clock frequency is 4 MHz: approx. 4.1ms) when switching from
the main clock to the PLL clock mode. The oscillation stabilization wait time when switching from
the sub clock to the PLL clock mode depends on the value set in the oscillation stabilization wait
time selection bits (CKSCR: WS1, WS0).
Returns to the initial value by resetting all.
Notes:
1) When both MCS and SCS bits are "0", SCS is preferred, and the sub clock is selected.
2) Write after switching from the main clock to PLL clock (CKSCR: MCS=1→ 0), disables
the time-base timer interrupt through the interrupt enable bit (TBTC: TBIE) in the timebase timer or the interrupt level mask registers (ILM: ILM2 to 0).
•
•
•
bit9,
bit8
CS1, CS0:
Multiplication rate
selection bits
These bits and CS2 bit in the PLL/Sub clock control register (PSCCR) select a multiplication
rate for the PLL clock.
Select from among 5 types of multiplication rates for the PLL clock.
Returns to the initial value by resetting all.
Settings for CS0, CS1 and CS2:
CS2
CS1
CS0
PLL clock multiplication rate
0
0
0
x1
0
0
1
x2
0
1
0
x3
0
1
1
x4
1
1
0
x6
1
1
1
Setting disabled
Note:
Setting CS2 to CS0 to 111B is disabled.
When PSCCR: CS2 is set to "1", don't set CKSCR: CS1 and CS0 to 11B.
When the PLL clock is selected (CKSCR: MCS=0), writing is controlled. When rewrite the
multiplication rate, first write "1" into the PLL clock selection bit (CKSCR: MCS) temporarily,
then rewrite the multiplication rate selection bits (CKSCR: CS1, CS0) and return the PLL clock
selection bit (CKSCR: MCS) to "0".
130
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 6 CLOCK
6.4 PLL/Sub Clock Control Register (PSCCR)
MB90340E Series
6.4
PLL/Sub Clock Control Register (PSCCR)
PLL/sub clock control register selects the PLL multiplication rate and the sub clock
division ratio. This register is write-only. The value read from this bit is always "1".
■ PLL/Sub Clock Control Register (PSCCR)
Figure 6.4-1 shows the configuration of the PLL/sub clock control register (PSCCR). Table 6.4-1 describes
the function of each bit in the PLL/sub clock control register (PSCCR).
Figure 6.4-1 Configuration of PLL/Sub Clock Control Registers (PSCCR)
Address
bit
0000CFH
15
14
13
12
11
10
9
8
Initial value
SCDS
Reserved
CS2
XXXX0000B
W
W
W
−
−
−
−
Reserved
−
−
−
−
W
bit8
CS2
0
1
Multiplier selection bits
See the clock selection registers (CKSCR)
bit9
Reserved bit
Reserved
0
Always write "0" to this bit
The value read from this bit is always "1"
bit10
W
: Write only
X
: Undefined value
−
: Undefined
: Initial value
SCDS
Sub clock division selection bit
0
Divide-by-four
1
Divide-by-two
bit11
Reserved bit
Reserved
0
CM44-10143-5E
Always write "0" to this bit
The value read from this bit is always "1"
FUJITSU SEMICONDUCTOR LIMITED
131
CHAPTER 6 CLOCK
6.4 PLL/Sub Clock Control Register (PSCCR)
MB90340E Series
Table 6.4-1 Function of Each Bit in PLL/Sub Clock Control Register (PSCCR)
Bit name
Function
bit15
to
bit12
Undefined
These bits are not used.
• Writing to these bits has no effect.
• The value read from this bit is always "1".
bit11
Reserved bit
•
•
bit10
SCDS:
Sub clock division
selection bit
Selects a division ratio for the sub clock.
• When you write "0", divide-by-four is selected.
• When you write "1", divide-by-two is selected.
• The value read from this bit is always "1".
• Initialized to "0" by all reset sources.
bit9
Reserved bit
•
•
Always write "0" to this bit.
The value read from this bit is always "1".
•
This bit determines the multiplication rate for PLL, together with CS1 and
CS0 bits in the clock selection register (CKSCR).
bit8
CS2:
Multiplication rate
selection bit
Always write "0" to this bit.
The value read from this bit is always "1".
CS2
CS1
CS0
PLL clock multiplication rate
0
0
0
x1
0
0
1
x2
0
1
0
x3
0
1
1
x4
1
1
0
x6
1
1
1
Setting disabled
• The value read from this bit is always "1".
• Initialized to "0" by all reset sources.
Note:
When the MCS or MCM bit is "0", changing the setting of this bit is not
allowed. Change this bit when in the main clock mode.
• Setting CS2 to CS0 to 111B is disabled.
When CKSCR: CS1 and CS0 are set to 11B, don't set this bit to "1".
Note:
132
The PSCCR register is a write-only register, so the read value is different from the write value.
Therefore, don't use RMW instructions, such as SETB/CLRB.
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 6 CLOCK
6.5 Clock Mode
MB90340E Series
6.5
Clock Mode
There are 3 clock modes: main clock, PLL clock, and sub clock modes.
■ Clock Mode
● Main clock mode
The main clock mode uses the divided-by-two oscillation clock, generated either by connecting the highspeed pins (X0, X1) to an oscillator or by inputting an external clock, as the operating clock for the CPU
and peripheral functions.
● Sub clock mode
The sub clock mode uses the divided-by-two or divided-by-four clock, generated either by connecting the
low-speed pins (X0A, X1A) to an oscillator or by inputting an external clock, as the operating clock for the
CPU and peripheral functions. The division ratio for the sub clock can be set with SCDS bit in the PLL/sub
clock control register (PSCCR).
● PLL clock mode
The PLL clock mode uses the oscillation clock, multiplied by the PLL clock multiplier circuit (PLL
oscillation circuit), as operating clock for the CPU and peripheral functions. The multiplication rate for
PLL clock can be set with the clock selection register (CKSCR: CS1, CS0) and PLL/sub clock control
register (PSCCR: CS2).
■ Transition of the Clock Mode
Clock mode can make the transition to the main clock, sub clock, and PLL clock modes by setting the PLL
clock selection bit (CKSCR: MCS) and the sub clock selection bit (CKSCR: SCS).
● Transition from main clock mode to PLL clock mode
When rewriting the PLL clock selection bit (CKSCR: MCS) from "1" to "0", main clock is switched to
PLL clock after the PLL oscillation stabilization wait time (214/HCLK) has elapsed.
● Transition from PLL clock mode to main clock mode
When rewriting the PLL clock selection bit (CKSCR: MCS) from "0" to "1", PLL clock is switched to
main clock at the timing (after 1 to 12 PLL clocks) the PLL and main clock edges match.
● Transition from main clock mode to sub clock mode
When rewriting the sub clock selection bit (CKSCR: SCS) from "1" to "0", main clock is switched to sub
clock when the sub clock edge is detected.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
133
CHAPTER 6 CLOCK
6.5 Clock Mode
MB90340E Series
● Transition from sub clock mode to main clock mode
When rewriting the sub clock selection bit (CKSCR: SCS) from "0" to "1", sub clock is switched to main
clock after the main clock oscillation stabilization wait time has elapsed.
● Transition from PLL clock mode to sub clock mode
When rewriting the sub clock selection bit (CKSCR: SCS) from "1" to "0", PLL clock is switched to sub
clock.
● Transition from sub clock mode to PLL clock mode
When rewriting the sub clock selection bit (CKSCR: SCS) from "0" to "1", sub clock is switched to PLL
clock after the main clock oscillation stabilization wait time has elapsed.
■ Selection of PLL Clock Multiplication Rate
One of 5 types of PLL clock multiplication rates (1 to 4, and 6 multiplications) can be selected by writing
000B to 011B and 110B in the multiplication rate selection bits (CKSCR: CS1, CS0, PSCCR: CS2).
■ Machine Clock
The PLL clock, main clock or sub clock output from the PLL multiplication circuit will be the machine
clock. This machine clock is supplied to the CPU and peripheral functions. One of main clock, PLL clock,
and sub clock can be selected by writing to the sub clock selection bit (CKSCR: SCS) and the PLL clock
selection bit (CKSCR: MCS).
Notes:
• When you rewrite the PLL clock selection bit (CKSCR: MCS) and sub clock selection bit (CKSCR:
SCS), the machine clock is not switched immediately. If you want to operate a machine clockdependent peripheral function, refer to the values on the PLL clock operating flag bit (CKSCR:
MCM) or on the sub clock operating flag bit (CKSCR: SCM) and make sure that the machine
clock has been switched before the operation.
• When the PLL clock selection bit (CKSCR: MCS) is "0" (PLL clock mode) and the sub clock
selection bit (CKSCR: SCS) is "0" (sub clock mode), SCS bit is preferred, and the sub clock mode
begins.
• When switching the clock mode, do not switch to other clock mode or the low-power consumption
mode until the switch is completed. You can refer to MCM and SCM bits in the clock selection
register (CKSCR) for the completion of switching. If the switch is not completed, switching to other
clock mode or the low-power consumption mode may not take effect.
134
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 6 CLOCK
6.5 Clock Mode
MB90340E Series
Figure 6.5-1 shows the state transition diagram by machine clock switching.
Figure 6.5-1 State Transition Diagram by Machine Clock Selection
Main
MCS = 1
MCM = 1
SCS = 1
SCM = 1
CS1, CS0 = xx B
CS2=x
(9)
(11)
(10)
(1)
(18)
(12)
(7)
Main --> PLLx
MCS = 0
MCM = 1
SCS = 1
SCM = 1
CS1, CS0 = xx B
CS2=x
PLL1 --> Main
(8) MCS = 1
MCM = 0
SCS = 1
SCM = 1
CS1, CS0 = 00 B
CS2=0
PLL2 --> Main
(8) MCS = 1
MCM = 0
SCS = 1
SCM = 1
CS1, CS0 = 01B
CS2=0
PLL3 --> Main
(8) MCS = 1
MCM = 0
SCS = 1
SCM = 1
CS1, CS0 = 10 B
CS2=0
PLL4 --> Main
(8) MCS = 1
MCM = 0
SCS = 1
SCM= 1
CS1, CS0 = 11B
CS2=0
PLL6 --> Main
(8) MCS = 1
MCM = 0
SCS = 1
SCM = 1
CS1, CS0 = 10 B
CS2=1
CM44-10143-5E
Main --> Sub
MCS = 1
MCM = 1
SCS = 0
SCM = 1
CS1, CS0 = xx B
CS2=x
(2)
(3)
(4)
(5)
(6)
Sub --> Main
MCS = 1
MCM = 1
SCS = 1
SCM = 0
CS1, CS0 = xx B
CS2=x
(7)
(7)
(7)
(7)
(7)
(11)
(10)
PLL1:Multiplied
MCS = 0
MCM = 0
SCS = 1
SCM = 1
CS1, CS0 = 00 B
CS2=0
PLL2:Multiplied
MCS = 0
MCM = 0
SCS = 1
SCM = 1
CS1, CS0 = 01B
CS2=0
PLL3:Multiplied
MCS = 0
MCM = 0
SCS = 1
SCM = 1
CS1, CS0 = 10 B
CS2=0
PLL4:Multiplied
MCS = 0
MCM = 0
SCS = 1
SCM = 1
CS1, CS0 = 11B
CS2=0
PLL6:Multiplied
MCS = 0
MCM = 0
SCS = 1
SCM = 1
CS1, CS0 = 10 B
CS2=1
Sub
MCS = X
MCM = 1
SCS = 0
SCM = 0
CS1, CS0 = xx B
CS2=x
(9)
(13)
(14)
(15)
(16)
(17)
(9)
(9)
(9)
(9)
(9)
FUJITSU SEMICONDUCTOR LIMITED
Sub --> PLL
MCS = 0
MCM = 1
SCS = 1
SCM = 0
CS1, CS0 = xx B
CS2=0
PLL1 --> Sub
MCS = 1
MCM = 0
SCS = 0
SCM = 1
CS1, CS = 00 B
CS2=0
(19)
PLL2 --> Sub (19)
MCS = 1
MCM = 0
SCS = 0
SCM = 1
CS1, CS0 = 01B
CS2=0
PLL3 --> Sub (19)
MCS = 1
MCM = 0
SCS = 0
SCM = 1
CS1, CS0 =10 B
CS2=0
PLL4 --> Sub (19)
MCS = 1
MCM = 0
SCS = 0
SCM = 1
CS1, CS0 = 11B
CS2=0
PLL6 --> Sub
MCS = 1
MCM = 0
SCS = 0
SCM = 1
CS1, CS0 =10B
CS2=1
(19)
135
CHAPTER 6 CLOCK
6.5 Clock Mode
MB90340E Series
(1)
MCS bit "0" write
(2)
End of PLL clock oscillation stabilization wait time &CS1, CS0 = 00B & CS2 = 0
(3)
End of PLL clock oscillation stabilization wait time &CS1, CS0 = 01B & CS2 = 0
(4)
End of PLL clock oscillation stabilization wait time &CS1, CS0 = 10B & CS2 = 0
(5)
End of PLL clock oscillation stabilization wait time &CS1, CS0 = 11B & CS2 = 0
(6)
End of PLL clock oscillation stabilization wait time &CS1, CS0 = 10B & CS2 = 1
(7)
MCS bit "1" write (including the resets)
(8)
Synchronous timing of PLL clock and main clock
(9)
SCS bit "0" write
(10)
Synchronous timing of main clock and sub clock
(11)
SCS bit "1" write (MCS1)
(12)
End of main clock oscillation stabilization wait time
(13)
End of main clock oscillation stabilization wait time & CS1, CS0 = 00B & CS2 = 0
(14)
End of main clock oscillation stabilization wait time & CS1, CS0 = 01B & CS2 = 0
(15)
End of main clock oscillation stabilization wait time & CS1, CS0 = 10B & CS2 = 0
(16)
End of main clock oscillation stabilization wait time & CS1, CS0 = 11B & CS2 = 0
(17)
End of main clock oscillation stabilization wait time & CS1, CS0 = 10B & CS2 = 1
(18)
SCS bit "1" write (MCS0)
(19)
Synchronous timing of PLL clock and sub clock
MCS
:
Machine clock selection bit in the clock selection register (CKSCR)
MCM
:
Machine clock selection bit in the clock selection register (CKSCR)
SCS
:
Machine clock display bit (sub) in the clock selection register (CKSCR)
SCM
:
Machine clock display bit (sub) in the clock selection register (CKSCR)
CS1, CS0
:
Machine clock in the clock selection register (CKSCR)
CS2
:
Multiplication rate selection bit in the PLL/sub clock control register (PSCCR)
Notes:
• Initial value of the machine clock is the main clock (CKSCR: MCS=1, SCS=1).
• When both MCS and SCS bits are "0", SCS is preferred, and the sub clock is selected.
• When switching from the sub clock to PLL clock mode, set CKSCR: WS1, WS0 to 10B or 11B.
136
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
MB90340E Series
6.6
Oscillation Stabilization Wait Time
CHAPTER 6 CLOCK
6.6 Oscillation Stabilization Wait Time
When the power is turned on where the oscillation clock is suspended or when stop
mode is open, the oscillation clock requires some time to stabilize (the oscillation
stabilization wait time) after oscillation begins. When switching the clock mode, such as
from the main to PLL, main to sub, sub to main, or sub to PLL, an oscillation
stabilization wait time is also required.
■ Operation During Oscillation Stabilization Wait Time
Generally, ceramic or crystal oscillator requires time of several to several dozen of milliseconds until the
oscillation is stabilized at the natural frequency (oscillation frequency) after starting the oscillation.
Accordingly, CPU operation should be disabled immediately after the oscillation starts and the clock
supply to the CPU is not enabled until the oscillation stabilization wait time has elapsed and the oscillation
becomes stable.
Since the oscillation stabilization wait time depends on the type of oscillator (such as crystal, ceramic), the
proper oscillation stabilization wait time must be selected for your oscillator. The oscillation stabilization
wait time can be set with the clock selection register (CKSCR).
When switching the clock mode from the main clock to PLL clock, main clock to sub clock, sub clock to
main clock, or sub clock to PLL clock, the CPU continues to operate on the original clock during the
oscillation stabilization wait time. After the wait time has elapsed, the operating clock switches to the
desire clock. Figure 6.6-1 shows the operation right after the oscillation starts.
Figure 6.6-1 Operation Immediately After the Oscillation Starts
Oscillation time of
oscillator
Oscillation stabilization wait time
Starting normal operation or
switching to PLL clock/sub
clock
X1
Oscillation starts
CM44-10143-5E
Oscillation stabilized
FUJITSU SEMICONDUCTOR LIMITED
137
CHAPTER 6 CLOCK
6.7 Connection of the Oscillator and External Clock
6.7
MB90340E Series
Connection of the Oscillator and External Clock
The MB90340E series contains a system clock generation circuit. Connecting the
oscillator to the oscillation pin generates an internal clock. The clock input to the
oscillation pin can be regarded as an oscillation clock.
■ Connection of the Oscillator and External Clock
● Example of connection of crystal oscillator or ceramic resonator
Figure 6.7-1 Example of Connection of Crystal Oscillator or Ceramic Resonator
X0
X1
C1
MB90340E series
C2
X0A
X1A
C3
C4
● Connection example of external clock
Figure 6.7-2 Connection Example of External Clock
X0
~
Open
X1
MB90340E series
X0A
~
138
Open
X1A
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 7
RESET
This chapter describes the reset.
7.1 Overview of Reset
7.2 Reset Source and Oscillation Stabilization Wait Times
7.3 External Reset Pin
7.4 Reset Operation
7.5 Reset Source Bits
7.6 Status of Pins by Reset
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
139
CHAPTER 7 RESET
7.1 Overview of Reset
7.1
MB90340E Series
Overview of Reset
When a reset source is generated, the CPU immediately stops the current execution
process and assumes the reset release wait state. Once the reset is open, the CPU then
begins processing with the address indicated by the reset vector.
The reset has the following 4 sources:
• Power-on reset
• External reset request via the RST pin
• Software reset request
• Watchdog timer overflow
■ Reset Source
Table 7.1-1 lists the sources of a reset.
Table 7.1-1 Reset Sources
Reset
Source
Machine clock
Watchdog
timer
Oscillation
stabilization wait
Power-on
When the power is turned on
Main clock
(MCLK)
Stop
Yes
External pin
"L" level input to the RST pin
Main clock
(MCLK)
Stop
No
"0" is written to the internal reset signal
generation bit (RST) in the low-power
consumption mode control register
(LPMCR).
Main clock
(MCLK)
Stop
No
Watchdog timer overflow
Main clock
(MCLK)
Stop
No
Software
Watchdog timer
MCLK: Main clock (divide-by-two clock of the oscillation clock)
● Power-on reset
A power-on reset is generated when the power is turned-on. The oscillation stabilization wait time is fixed
to 216 oscillation clock cycles (216/HCLK) (about 16.38 ms: at 4 MHz oscillation). When the oscillation
stabilization wait time has elapsed, the reset is executed.
● External reset
An external reset is generated by inputting the "L" level to an external reset pin (RST pin). The "L" level
input time to the RST pin should be 500 ns or longer. The oscillation stabilization wait time is not required
for the external resets.
140
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 7 RESET
7.1 Overview of Reset
MB90340E Series
Notes:
• Only for the reset requests via the RST pin, if the reset source is generated during a write
operation, the CPU assumes the reset release wait state after completion of the instruction.
Therefore, even though a reset is input while writing, the writing process will be completed
successfully. However, beware of the following:
• For the string instructions, a reset is accepted before a specified number of counter are
transferred, so that all data will never be transferred completely.
• A reset is forcibly accepted without waiting for the completion of the instruction, if the cycle
is extended to a certain level by the RDY input during access to the external bus.
A reset is forcibly accepted with 16 machine cycles.
• When returning from the stop mode, sub clock mode, sub clock sleep mode, and watch mode to
the main clock mode via the external reset pins (RST pin), input
Oscillation time of the oscillator* + 100 μs
or more "L" level.
*: Oscillation time of the oscillator is the time when the amplitude reaches to 90%. Several to
several dozen ms for the crystal oscillator, several hundred μs to several ms for the ceramic
resonator, and 0 ms for the external clock.
• When returning from the time-base timer mode to the main clock mode via the external reset pins
(RST pin), input 100 μs or more "L" level.
● Software reset
A software reset is an internal reset generated by writing "0" to the RST bit of the low-power consumption
mode control register (LPMCR). The oscillation stabilization wait time is not required for the software
reset.
● Watchdog reset
A watchdog reset is generated by a watchdog timer overflow that occurs when "0" is not written to the
watchdog control bit (WTE) in the watchdog timer control register (WDTC) within a given time after the
watchdog timer is activated. This reset doesn't take the oscillation stabilization wait time.
Clock definitions
HCLK : Oscillation clock frequency
MCLK: Main clock frequency
SCLK : Sub clock frequency
φ
: Machine clock (CPU operating clock) frequency
1/φ
: Machine cycle (CPU operating clock period)
See Section "6.1 Clock" for details.
Note:
When a reset is generated in stop or sub clock mode, 215/HCLK oscillation stabilization wait time is
required (approximately 8.19 ms, using HCLK=4 MHz oscillation).
Refer to Section "6.6 Oscillation Stabilization Wait Time" for details.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
141
CHAPTER 7 RESET
7.2 Reset Source and Oscillation Stabilization Wait Times
MB90340E Series
Reset Source and Oscillation Stabilization Wait Times
7.2
The MB90340E series has 4 types of reset sources. The oscillation stabilization wait
time when resetting varies, depending on the reset source.
■ Reset Source and Oscillation Stabilization Wait Times
Table 7.2-1 lists the reset sources and oscillation stabilization wait times.
Table 7.2-1 Reset Sources and Oscillation Stabilization Wait Times
Reset
Oscillation stabilization wait time
The oscillation clock frequency at 4 MHz is given in
parentheses.
Reset source
Power-on
When the power is turned on
216/HCLK (approx. 16.38 ms)
Watchdog
Watchdog timer overflow
None: WS1 and WS0 bits are initialized to 11B, however.
External
"L" input from the RST pin
None: WS1 and WS0 bits are initialized to 11B, however.
Software
Writing "0" to the RST bit in the low-power
consumption mode control register (LPMCR).
None: WS1 and WS0 bits are initialized to 11B, however.
HCLK
: Oscillation clock frequency
WS1, WS0 : Oscillation stabilization wait time selection bits in the clock select register (CKSCR)
Figure 7.2-1 shows the oscillation stabilization wait times at a power-on reset.
Figure 7.2-1 Oscillation Stabilization Wait Times at a Power-on Reset
Vcc
215/HCLK
215/HCLK
CLK
CPU
Operation
Voltage step-down
circuit stabilization
wait time
Oscillation
stabilization
wait time
Note:
Ceramic and crystal oscillators generally require several to several dozen ms of oscillation
stabilization wait time, until the oscillation is stabilized at a specific frequency from the start of the
oscillation. A proper oscillation stabilization wait time must be set for the particular oscillator to be
used. See Section "6.6 Oscillation Stabilization Wait Time", for details.
■ Oscillation Stabilization Wait Reset State
The reset operations in response to a reset at power-on, or during the stop mode and sub clock mode are
performed after the oscillation stabilization wait time, created by the time-base timer, has elapsed. If the
external reset input has not been open after the wait time, the reset operation is performed after the external
reset is open.
142
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 7 RESET
7.3 External Reset Pin
MB90340E Series
7.3
External Reset Pin
The external reset pin (RST pin) is a dedicated reset input pin that generates an internal
reset by inputting an "L" level. For the MB90340E series, resets are generated in
synchronization with the CPU operating clock however, only the external pin generates
a reset in asynchronous manner.
■ Block Diagram of the External Reset Pin
Figure 7.3-1 Block Diagram of External Reset Pin
CPU operating clock
(PLL multiplier circuit with an HCLK frequency
divided by 2)
RST
P-ch
Synchronization
circuit
Pin
CPU peripheral
functions
N-ch Input buffer
HCLK: Oscillation clock
Note:
Inputs to the RST pin are accepted during cycles in which memory is not affected in order to prevent
memory from being destroyed by a reset during a write operation. A clock is required to initialize the
internal circuit. In particular, an operation with an external clock requires clock input together with
reset input.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
143
CHAPTER 7 RESET
7.4 Reset Operation
7.4
MB90340E Series
Reset Operation
When a reset is open, the memory locations from which the mode data and the reset
vectors are read are selected according to the setting of the mode pins, and a mode
fetch is performed. The mode fetch determines the CPU operating mode and the
execution start address after a reset operation ends. When returning by a reset at
power-on or a reset from sub clock and stop mode, a mode fetch is performed when the
oscillation stabilization wait time elapses.
■ Overview of Reset Operation
Figure 7.4-1 shows the reset operation flow.
Figure 7.4-1 Reset Operation Flow
Power-on reset
Stop mode
Sub clock mode
During a reset
External reset
Software reset
Watchdog timer reset
Oscillation stabilization wait
reset state
Fetching the reset vector
Mode fetch
(Reset operation)
Fetching the mode data
Normal operation
(RUN state)
CPU executes an instruction,
fetching the instruction codes
from the address indicated by
the reset vector.
■ Mode Pins
Setting the mode pins (MD0 to MD2) specifies how to fetch the reset vector and the mode data. Fetching
the reset vector and the mode data is performed in the reset sequence. See Section "9.1.1 Mode Pin", for
details on mode pins.
■ Mode Fetch
When the reset is open, the CPU transfers the reset vector and the mode data to the appropriate registers in
the CPU core by hardware. The reset vector and mode data are allocated to the 4 bytes from FFFFDCH to
FFFFDFH. The CPU outputs these addresses to the bus immediately after the reset is open and then fetches
the reset vector and mode data. Using the mode fetch, the CPU can begin processing at the address
indicated by the reset vector.
Figure 7.4-2 shows the transfer of the reset vector and mode data.
144
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 7 RESET
7.4 Reset Operation
MB90340E Series
Figure 7.4-2 Transfer of Reset Vector and Mode Data
F2MC-16LX CPU core
Memory Space
Mode register
FFFFDFH Mode data
FFFFDEH Reset vector bits (23 to 16)
Micro-ROM
Reset sequence
FFFFDDH Reset vector bits (15 to 8)
FFFFDCH Reset vector bits (7 to 0)
PCB
PC
● Mode data (address: FFFFDFH)
Only a reset operation can change the contents of the mode register. The mode register setting becomes
valid after a reset operation. See Section "9.1.2 Mode Data", for details on mode data.
● Reset vector (address: FFFFDCH to FFFFDEH)
The execution start address after the reset operation ends is written as the reset vector. Execution starts with
the address contained in the reset vector.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
145
CHAPTER 7 RESET
7.5 Reset Source Bits
7.5
MB90340E Series
Reset Source Bits
A reset source can be identified by reading the watchdog timer control register (WDTC).
■ Reset Source Bits
As shown in Figure 7.5-1, each reset source has a corresponding flip-flop. The contents of the flip-flops can
be obtained by reading the watchdog timer control register (WDTC). If the source of a reset must be
identified after the reset has been open, the value read from the WDTC should be processed by the software
and branched to the appropriate program.
Figure 7.5-1 Block Diagram of Reset Source Bits
RST pin
Power-on
S
R
S
F/F
Q
Watchdog timer
reset generation
detection circuit
External reset
request
detection circuit
Power-on
detection circuit
Watchdog timer
control register
(WDTC)
No periodic clear
RST=L
R
S
F/F
Q
R
S
F/F
Q
R
F/F
Q
RST bit set
LPMCR:RST bit
write detection
circuit
Delay
circuit
Reading of watchdog
timer control register
(WDTC)
Internal data bus
S
: Set
R
: Reset
Q
: Out Put
F/F
: Flip Flop
■ Correspondence Between Reset Source Bits and Reset Sources
Figure 7.5-2 shows the configuration of the reset source bits of the watchdog timer control register
(WDTC). Table 7.5-1 maps the correspondence between the reset source bits and reset sources. See Section
"12.3.1 Watchdog Timer Control Register (WDTC)", for details.
146
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 7 RESET
7.5 Reset Source Bits
MB90340E Series
Figure 7.5-2 Configuration of the Reset Source Bits (Watchdog Timer Control Register)
Watchdog timer control register (WDTC)
Address
bit15
0000A8H
R
: Read only
W
: Write only
X
: Undefined
........
bit8
(TBTC)
bit7
bit6
PONR
−
R
−
bit5
bit4
bit3
WRST ERST SRST
R
R
R
bit2
bit1
bit0 Initial value
WTE
WT1
WT0
W
W
W
XXXXX111B
Table 7.5-1 Correspondence Between Reset Source Bits and Reset Sources
Reset source
PONR
WRST
ERST
SRST
1
X
X
X
Power-on reset request generated
Watchdog timer overflow reset request generated
1
External reset request via the RST pin
1
Software reset request generated
1
: Previous state retained
X : Undefined
■ Notes on Reset Source Bits
● When multiple reset sources are generated
When multiple reset sources are generated at the same time, the corresponding reset source bits of the
watchdog timer control register (WDTC) are set to "1". For example, an external reset request via the RST
pin and the watchdog timer overflow occur at the same time, both ERST and the WRST bits are set to "1".
● Power-on reset
For a power-on reset, the PONR bit is set to "1" but all other reset source bits are undefined. Because of it,
the software should be programmed so that it will ignore all reset source bits except the PONR when it is
"1".
● Clearing the reset source bits
The reset source bits are cleared only when the watchdog timer control register (WDTC) is read. Any flag
generated in the bit corresponding to a reset source is not cleared even though another reset is generated
and remains to "1".
Note:
If the power is turned-on under conditions where no power-on reset occurs, the value in this register
may not be guaranteed.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
147
CHAPTER 7 RESET
7.6 Status of Pins by Reset
7.6
MB90340E Series
Status of Pins by Reset
This section describes the status of pins when a reset occurs.
■ Status of Pins During a Reset
The status of pins during a reset depends on the settings of mode pins (MD2 to MD0).
Refer to Section "8.7 Pin State in the Standby Mode and at the Time of Reset" for the status of pins during
a reset
● When internal vector mode has been set (MD2 to MD0 = 011B)
All I/O pins (peripheral function pins) are high impedance, and mode data is read from the internal ROM.
■ Status of Pins after Mode Data is Read
The status of pins after mode data has been read depends on the mode data (M1 and M0).
● When single chip mode has been selected (M1 and M0 = 00B)
All I/O pins (peripheral function pins) are high impedance, and mode data is read from the internal ROM.
Note:
For those pins that change to high impedance when a reset source is generated, confirm that
devices connected to those pins do not malfunction.
148
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 8
LOW-POWER
CONSUMPTION MODE
This chapter explains the low-power consumption mode.
8.1 Overview of the Low-power Consumption Mode
8.2 Block Diagram of the Low-power Consumption Circuit
8.3 Low-power Consumption Mode Control Register (LPMCR)
8.4 CPU Intermittent Operation Mode
8.5 Standby Mode
8.6 State Transition of the Standby Mode
8.7 Pin State in the Standby Mode and at the Time of Reset
8.8 Notes on Using the Low-power Consumption Mode
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
149
CHAPTER 8 LOW-POWER CONSUMPTION MODE
8.1 Overview of the Low-power Consumption Mode
8.1
MB90340E Series
Overview of the Low-power Consumption Mode
CPU operation modes can be classified into the following operation modes based on
the operation clock selection and the clock oscillation control. Operation modes except
for the PLL clock mode belong to the low-power consumption mode.
• Clock modes (main clock mode, PLL clock mode, and sub clock mode)
• CPU intermittent operation modes (main clock intermittent operation mode, PLL clock
intermittent operation mode, and sub clock intermittent operation mode)
• Standby modes (sleep mode, stop mode, watch mode, and time-base timer mode)
■ CPU Operation Modes and Current Dissipation
Figure 8.1-1 shows the relationship between CPU operation modes and their current dissipation.
Figure 8.1-1 CPU Operation Modes and Current Dissipation
Current dissipation
Tens of mA
CPU operation mode
PLL clock mode
Multiply-by-six clock
Multiply-by-four clock
Multiply-by-three clock
Multiply-by-two clock
Multiply-by-one clock
PLL clock intermittent
operation mode
Multiply-by-six clock
Multiply-by-four clock
Multiply-by-three clock
Multiply-by-two clock
Multiply-by-one clock
Main clock mode (1/2HCLK)
Main clock intermittent operation mode
Sub clock mode (divide-by-four or divide-by-two of
oscillation frequency)
Sub clock intermittent operation mode
Some mA
Standby mode
Sleep mode
Time-base timer mode
Watch mode
Stop mode
Low-power consumption mode
This figure shows the outline of operation modes, and actual current dissipation may differ.
150
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 8 LOW-POWER CONSUMPTION MODE
8.1 Overview of the Low-power Consumption Mode
MB90340E Series
■ Clock Modes
● PLL clock mode
This is a mode that uses PLL multiplier clocks of the oscillation clock (HCLK) to operate CPU and
peripheral functions.
● Main clock mode
This is a mode that uses the divide-by-two clock of the oscillation clock (HCLK) to operate CPU and
peripheral functions. During the main clock mode, the PLL multiplier circuit stops.
● Sub clock mode
This is a mode that uses the sub clock (SCLK) to operate CPU and peripheral functions. Either divide-bytwo or divide-by-four of the sub clock oscillation clock can be selected for the sub clock. During the sub
clock mode, the main clock and PLL multiplier circuit stop. When power is turned on or the stop mode is
canceled, a sub clock oscillation stabilization wait time 214/SCLK occurs (in the case oscillation clock
frequency is 32.768 kHz with divide-by-four setting: about two seconds). Therefore, if the main clock
mode is switched to the sub clock mode therein, an oscillation stabilization wait time occurs.
Reference:
See "CHAPTER 6 CLOCK" for details on the clock mode.
■ CPU Intermittent Operation Mode
This is a mode that reduces power dissipation by operating a CPU intermittently while providing highspeed clock to peripheral functions. The CPU intermittent operation mode provides intermittent clock only
to a CPU when registers, internal memory peripheral functions, and external accesses are being used.
■ Standby Mode
The standby mode reduces power dissipation by stopping providing operation clock to a CPU and
peripheral functions using a standby control circuit or stopping the oscillation clock (HCLK).
● Sleep mode
The sleep mode is a mode that stops providing operation clock to a CPU while a clock mode is operating.
The CPU stops, and peripheral functions operate at the clock before switching to the sleep mode.
Depending on the clock mode when transiting to the sleep mode, it is classified into the main sleep mode,
PLL sleep mode, or sub sleep mode.
● Watch mode
The watch mode is a mode that operates the sub clock (SCLK) and watch timer only. The main clock and
PLL clock stop. Peripheral functions except the watch timer also stop.
If the WDCS bit in WTC register is "0", the watchdog timer continues to operate.
● Time-base timer mode
The time-base timer mode is a mode that operates the oscillation clock (HCLK), sub clock (SCLK), the
watchdog timer, time-base timer and watch timer only. Peripheral functions except the time-base timer,
watchdog timer and watch timer stop.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
151
CHAPTER 8 LOW-POWER CONSUMPTION MODE
8.1 Overview of the Low-power Consumption Mode
MB90340E Series
● Stop mode
The stop mode is a mode that stops the oscillation clock (HCLK) and sub clock (SCLK) while a clock
mode is operating. Data can be kept with lowest power dissipation.
Note:
When a clock mode is being switched, do not again switch to other clock modes or the low-power
consumption mode before the switching completes. The completion of switching can be checked by
referring to the MCM bit and SCM bit in the clock selection register (CKSCR). If a mode is switched
again to other clock modes or the low-power consumption mode before the first switching is finished,
the second switching may not complete.
152
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 8 LOW-POWER CONSUMPTION MODE
8.2 Block Diagram of the Low-power Consumption Circuit
MB90340E Series
8.2
Block Diagram of the Low-power Consumption Circuit
This section shows the block diagram of the low-power consumption circuit.
■ Block Diagram of the Low-power Consumption Circuit
Figure 8.2-1 Block Diagram of the Low-power Consumption Circuit
Low-power consumption mode control register (LPMCR)
STP SLP SPL RST TMD CG1 CG0
Reserved
RST Pin
CPU intermittent
operation
cycle selector
Pin high
impedance
control circuit
Pin Hi-Z control
Internal reset
generation
circuit
Internal reset
Intermittent cycle selected
CPU clock
control circuit
Reset (cancel)
Watch, sleep, and stop signals
Standby
control circuit
2
CPU operation
clock
Watch and stop signals
Peripheral
Peripheral functions
clock control
operation clock
circuit
Sub clock oscillation stabilization wait canceled
Main clock oscillation stabilization wait canceled
Interrupt (cancel)
Clock generation
block
Operation clock
selector
Machine
clock
2
CS2
PLL/Sub clock
control register
(PSCCR):bit8
Oscillation
stabilization wait
time selector
2
PLL multiplier
circuit
SCM MCM WS1 WS0 SCS MCS CS1 CS0
Clock selection register (CKSCR)
X0 Pin
X1 Pin
Divideby-two
Divide-
Divide-
by-four
Main by-512
Oscillation clock clock
( HCLK)
Time-base timer
Oscillation clock
oscillation circuit Sub clock
( SCLK)
X0A Pin
Divide-byfour/divideby-two
Divideby-1024
Divideby-two
Divideby-two
Divideby-two
Divideby-two
Divideby-two
Divideby-four
To watchdog timer
Divideby-eight
Divideby-two
Divideby-two
Watch timer
X1A Pin
SCDS
Sub clock oscillation circuit
CM44-10143-5E
PLL/Sub clock
control register
(PSCCR):bit10
FUJITSU SEMICONDUCTOR LIMITED
153
CHAPTER 8 LOW-POWER CONSUMPTION MODE
8.2 Block Diagram of the Low-power Consumption Circuit
MB90340E Series
● CPU intermittent operation selector
Selects the pause cycle count for CPU clock in the CPU intermittent operation mode.
● Standby control circuit
Switches to and cancels the standby mode by switching CPU operation clock and peripheral function
operation clock using the CPU clock control circuit and peripheral clock control circuit.
● CPU clock control circuit
This is a circuit that provides operation clock to a CPU.
● Pin high impedance control circuit
Switches an I/O pin to high impedance state when the mode is the watch mode, time-base timer mode, or
stop mode.
● Internal reset generation circuit
Generates internal reset signals.
● Low-power consumption mode control register (LPMCR)
Switches to and cancels the standby mode, or configures the CPU intermittent operation mode.
154
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 8 LOW-POWER CONSUMPTION MODE
8.3 Low-power Consumption Mode Control Register (LPMCR)
MB90340E Series
8.3
Low-power Consumption Mode Control Register (LPMCR)
The low-power consumption mode control register (LPMCR) switches to and cancels
the low-power consumption mode, generates internal reset signals, and sets the pause
cycle count of the CPU intermittent operation mode.
■ Low-power Consumption Mode Control Register (LPMCR)
Figure 8.3-1 Low-power Consumption Mode Control Register (LPMCR)
bit 7
6
5
4
3
2
1
STP SLP SPL RST TMD CG1 CG0
W
W
R/W
W
W
0
Initial value
Reserved
00011000B
R/W R/W R/W
bit0
Reserved bit
Reserved
0
Always set to "0"
bit2
bit1
CG1 CG0
CPU pause cycle count selection bits
0
0
0 cycle (CPU clock = peripheral clock)
0
1
8 cycles (CPU clock : peripheral clock = 1: approx. 3 to 4)
1
0
16 cycles (CPU clock : peripheral clock = 1: approx. 5 to 6)
1
1
32 cycles (CPU clock : peripheral clock = 1: approx. 9 to 10)
bit3
TMD
0
1
bit4
RST
0
1
bit5
SPL
0
1
Watch mode bit
Transits to the watch mode or time-base timer mode
No effect
Internal reset signal generation bit
Generates internal reset signals at 3 machine cycles
No effect
Pin state specifying bit
Keeps an input/output pin state
High impedance
Enabled only in the time-base timer, watch, and stop modes
bit6
Sleep mode bit
SLP
No effect
0
1
Transits to the sleep mode
bit7
STP
R/W : Readable/writable
: Write only
W
: Initial value
CM44-10143-5E
Stop mode bit
0
No effect
1
Transits to the stop mode
FUJITSU SEMICONDUCTOR LIMITED
155
CHAPTER 8 LOW-POWER CONSUMPTION MODE
8.3 Low-power Consumption Mode Control Register (LPMCR)
MB90340E Series
Table 8.3-1 Functions of Low-power Consumption Mode Control Register (LPMCR)
Bit name
Function
STP:
Stop mode bit
Switches to the stop mode.
When set to "0": No effect.
When set to "1": Switches to the stop mode.
When reading: "0" is consistently read.
• Initialized to "0" by a reset or an external interrupt.
SLP:
Sleep mode bit
Switches to the sleep mode.
When set to "0": No effect.
When set to "1": Switches to the sleep mode.
When reading : "0" is consistently read.
• Initialized to "0" by a reset or an external interrupt.
• If "1" is set to the STP bit and SLP bit concurrently, the STP bit has
priority, switching to the stop mode.
bit5
SPL:
Pin state setting bit
Sets the state of an input/output pin when switching to the stop mode, watch
mode, and time-base timer mode.
When set to "0": Keeps the current level of an input/output pin.
When set to "1": Switches the input/output pin to high impedance state.
• Initialized to "0" by a reset.
bit4
RST:
Internal reset signal
generation bit
Generates a software reset.
When set to "0": Generates internal reset signals at 3 machine cycles.
When set to "1": No effect.
When reading : "1" is consistently read.
bit7
bit6
bit3
TMD:
Watch mode bit
Switches to the watch mode or time-base timer mode.
When set to "0": Switches to the time-base timer mode if the mode is the
main clock mode or PLL clock mode. Switches to the
watch mode if the mode is the sub clock mode.
When set to "1": No effect.
• "1" is set by a reset or interrupt.
When reading : "1" is consistently read.
156
bit1,
bit2
CG1, CG0:
CPU pause cycle count
selection bits
Sets the pause cycle count for CPU clock in the CPU intermittent operation
mode.
bit0
Reserved: Reserved bit
Always set to "0".
• Returns to initial values by all kinds of reset.
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 8 LOW-POWER CONSUMPTION MODE
8.3 Low-power Consumption Mode Control Register (LPMCR)
MB90340E Series
Notes:
• Use the instructions in Table 8.3-2 to configure the settings for switching to the low-power
consumption mode in the low-power consumption mode control register (LPMCR). Operations
cannot be assured if instructions other than shown in the list below are used to switch to the lowpower consumption mode.
• Immediately after using the standby mode transition instructions in Table 8.3-2, be sure to add the
instructions shown in the dotted square below.
MOV LPMCR, #H’xx ; Low-power consumption mode transition instruction in
Table 8.3-2
NOP
NOP
JMP $+3
; Jump to next instruction
MOV A, #H’10
; Any instruction
If instruction lines other than shown in the dotted square are added, operations after canceling the
standby mode will not be assured.
• If the C language is used to access the low-power consumption mode control register, see "■
Notes on Accessing the Low-power Consumption Mode Control Register (LPMCR) for Switching
to the Standby Mode" in Section "8.8 Notes on Using the Low-power Consumption Mode".
• Use even number addresses to write in the low-power consumption mode control register
(LPMCR) in units of words. If an odd number address is used to write, it may cause malfunction.
• During the stop mode, watch mode, or time-base timer mode, in order to set the pin sharing a port
with peripheral functions to high impedance state, after prohibiting the output by peripheral
functions, set the STP bit to "1" or TMD bit to "0" in the low-power consumption mode control
register (LPMCR).
Table 8.3-2 List of Instructions Used When Transiting to the Low-power Consumption
Mode
CM44-10143-5E
MOV
io,#imm8
MOV
dir,#imm8
MOV
eam,#imm8
MOV
eam,Ri
MOV
io,A
MOV
dir,A
MOV
addr16,A
MOV
eam,A
MOV
@Rli+disp8,A
MOVW
io,#imm16
MOVW
dir,#imm16
MOVW
eam,#imm16
MOVW eam,RWi
MOVW
io,A
MOVW
dir,A
MOVW
addr16,A
MOVW eam,A
MOVW
@Rli+disp8,A
SETB
io:bp
SETB
dir:bp
SETB
addr16:bp
CLRB
io:bp
CLRB
dir:bp
CLRB
addr16:bp
FUJITSU SEMICONDUCTOR LIMITED
157
CHAPTER 8 LOW-POWER CONSUMPTION MODE
8.4 CPU Intermittent Operation Mode
8.4
MB90340E Series
CPU Intermittent Operation Mode
The CPU intermittent operation mode is a mode that reduces power dissipation by
operating a CPU intermittently while providing operation clock to the CPU and
peripheral functions.
■ Operation of CPU Intermittent Operation Mode
When the CPU accesses the register, internal memory, I/O, peripheral functions, and external buses, the
CPU intermittent operation mode temporarily holds the clock provided to CPU every time an instruction is
executed to delay the activation of internal buses. It can reduce power dissipation by lowering the CPU
execution speed while providing high-speed clock to peripheral functions.
• The machine cycle count to temporarily stop providing clock to CPU is set at the CG1 and CG0 bits in
the low-power consumption mode control register (LPMCR).
• The instruction execution time of the CPU intermittent operation mode can be calculated by adding the
normal execution time to the adjusted value that is the number of accesses to the register, internal
memory, peripheral functions, and external buses multiplied by the number of pause cycle count.
Figure 8.4-1 shows the clock operation of the CPU intermittent operation mode.
Figure 8.4-1 Clock Operation of the CPU Intermittent Operation Mode
Peripheral clock
CPU clock
One instruction
execution cycle
Pause cycle
Internal bus activated
158
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 8 LOW-POWER CONSUMPTION MODE
8.5 Standby Mode
MB90340E Series
8.5
Standby Mode
The standby mode can reduce power dissipation by stopping providing operation clock
to a CPU and peripheral functions using a standby control circuit or stopping the
oscillation clock.
■ Types and Operation States of the Standby Mode
Table 8.5-1 shows the types and operation states of the standby mode.
Table 8.5-1 Types and Operation States of the Standby Mode (1 / 2)
Mode name
Transition
conditions
Oscillation
clock
(HCLK)
Sub
clock
(SCLK)
Machine
clock
CPU
Watchdog
timer
Peripheral
functions
Pin
Release
method
Main
sleep
mode
MCS=1
SCS=1
SLP=1
❍
❍
❍
×
❍*7
❍
❍
External reset or
interrupt
Sub sleep
mode
MCS=X
SCS=0
SLP=1
WDCS=0
×
❍
❍
×
❍*7
❍
❍
External reset or
interrupt
Sub sleep
mode
MCS=X
SCS=0
SLP=1
WDCS=1
×
❍
❍
×
− *8
❍
❍
External reset or
interrupt
PLL sleep
mode
MCS=0
SCS=1
SLP=1
❍
❍
❍
×
❍*7
❍
❍
External reset or
interrupt
SPL=0
MCS=X
SCS=1
TMD=0
❍
❍
×
×
❍*7
× *1
◊
External reset or
interrupt*4
SPL=1
MCS=X
SCS=1
TMD=0
❍
❍
×
×
❍*7
× *1
Hi-Z*3
External reset or
interrupt*4
SPL=0
MCS=X
SCS=0
TMD=0
WDCS=0
×
❍
×
×
❍*7
× *2
◊
External reset or
interrupt*5
SPL=1
MCS=X
SCS=0
TMD=0
WDCS=0
×
❍
×
×
❍*7
× *2
Hi-Z*3
External reset or
interrupt*5
SPL=0
MCS=X
SCS=0
TMD=0
WDCS=1
×
❍
×
×
− *8
× *2
◊
External reset or
interrupt*5
SPL=1
MCS=X
SCS=0
TMD=0
WDCS=1
×
❍
×
×
− *8
× *2
Hi-Z*3
External reset or
interrupt*5
Sleep
mode
Time-base
timer mode
Watch
mode
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
159
CHAPTER 8 LOW-POWER CONSUMPTION MODE
8.5 Standby Mode
MB90340E Series
Table 8.5-1 Types and Operation States of the Standby Mode (2 / 2)
Mode name
Transition
conditions
Oscillation
clock
(HCLK)
Sub
clock
(SCLK)
Machine
clock
CPU
Watchdog
timer
Peripheral
functions
Pin
Release
method
SPL=0
STP=1
×
×
×
×
×
×
◊
External reset or
interrupt*6
SPL=1
STP=1
×
×
×
×
×
×
Hi-Z*3
External reset or
interrupt*6
Stop mode
❍: Operating × : Stopped ◊: Keeps the state before transition Hi-Z : High impedance
*1 : The time-base timer and watch timer operate.
*2 : The watch timer operates.
*3 : The input pin for DTP/external interrupt operates.
*4 : Watch timer, time-base timer, and external interrupt
*5 : Watch timer and external interrupt
*6 : External interrupt
*7 : The watchdog timer will be cleared when transiting to a different mode.
*8 : The watchdog timer is not available.
MCS : PLL clock selection bit of the clock selection register (CKSCR)
SCS : Sub clock selection bit of the clock selection register (CKSCR)
SPL : Pin state setting bit of the low-power consumption mode control register (LPMCR)
SLP : Sleep mode bit of the low-power consumption mode control register (LPMCR)
STP : Stop mode bit of the low-power consumption mode control register (LPMCR)
TMD : Watch mode bit of the low-power consumption mode control register (LPMCR)
Note:
During the stop mode, watch mode, or time-base timer mode, in order to set the pin sharing a port
with peripheral functions to high impedance state, after prohibiting the output by peripheral functions,
set the STP bit to "1" or TMD bit to "0" in the low-power consumption mode control register
(LPMCR).
160
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 8 LOW-POWER CONSUMPTION MODE
8.5 Standby Mode
MB90340E Series
8.5.1
Sleep Mode
The sleep mode is an operation mode that stops providing operation clock to a CPU
while a clock mode is operating. The CPU stops, but peripheral functions continue to
operate.
■ Switching to the Sleep Mode
When the mode is switched to the sleep mode by the low-power consumption mode control register settings
(LPMCR: SLP=1, STP=0), the transition to the sleep mode bases on the settings in the MCS bit and SCS
bit of the clock selection register (CKSCR).
Table 8.5-2 shows the correspondence between the sleep mode and the settings of the MCS bit and SCS bit
in the clock selection register (CKSCR).
Table 8.5-2 Clock Selection Register (CKSCR) Settings and Their Sleep Modes
Clock selection register (CKSCR)
Sleep mode to switch to
MCS
SCS
1
1
Main sleep mode
0
1
PLL sleep mode
1
0
0
0
Sub sleep mode
Note:
If "1" is concurrently set to the STP bit and SLP bit in the low-power consumption mode control
register (LPMCR), the STP bit has priority, switching to the stop mode.
Also, if "1" is set to the SLP bit and "0" to the TMD bit concurrently, the TMD bit has priority,
switching to the time-base timer mode or watch mode.
● Data retaining function
During the sleep mode, data stored in internal RAMs and dedicated registers such as an accumulator will be
retained.
● External bus hold function
During the sleep mode, the external bus hold function operates. If a hold request is generated to CPU, the
state transits to hold state.
● Operations while an interrupt request exists
While "1" is set to the SLP bit in the low-power consumption mode control register (LPMCR), if an
interrupt request exists, the mode does not switch to the sleep mode. If the CPU cannot accept an interrupt
request, the next instruction of the current one will be executed. On the other hand, if the CPU can accept
an interrupt request, it will immediately branch to the interrupt processing routine.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
161
CHAPTER 8 LOW-POWER CONSUMPTION MODE
8.5 Standby Mode
MB90340E Series
● Pin state
During the sleep mode, pins except ones that are used for bus input/output or bus control will keep the state
before switching to the sleep mode.
■ Returning from the Sleep Mode
Generation of a reset source or interrupt will cancel the sleep mode.
● Returning by a reset source
If the sleep mode is canceled by a reset source, after canceling the sleep mode, the mode switches to the
main clock mode and then to a reset sequence.
● Returning by an interrupt
During the sleep mode, if an interrupt request with interrupt level (IL) higher than seven is generated by
peripheral functions or the like, the sleep mode will be canceled. And after canceling the sleep mode,
generated interrupt requests will be judged based on the interrupt enable flag (I) in the condition code
register (CCR) and the settings in the interrupt level mask (ILM) and interrupt control register (ICR) as in
the case with normal interrupt processing.
• If the CPU cannot accept an interrupt request, the next instruction of the current one will be executed.
• If the CPU can accept an interrupt request, it will immediately branch to the interrupt processing
routine.
Figure 8.5-1 shows the canceling of the sleep mode by an interrupt.
Figure 8.5-1 Canceling of the Sleep Mode by an Interrupt
Interrupt flag settings of peripheral functions
INT occurs
(IL < 7)
YES
NO
Does not cancel sleep
Does not cancel sleep
Cancels sleep
I=0
YES
Executes the
next instruction
NO
ILM < IL
YES
NO
Executes interrupt processing
Note:
When executing an interrupt processing, it will be normally done after executing the next instruction
of the instruction having a sleep mode specification. However, if the switching to sleep mode and the
reception of external bus hold request are done simultaneously, the transition to interrupt processing
may occur before executing the next instruction.
162
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 8 LOW-POWER CONSUMPTION MODE
8.5 Standby Mode
MB90340E Series
8.5.2
Watch Mode
The watch mode is a mode that operates the sub clock (SCLK) and watch timer only.
The main clock and PLL clock stop.
If the WDCS bit in WTC register is "0", the watchdog timer continues to operate.
■ Switching to the Watch Mode
If "0" is written in the TMD bit of LPMCR because of the setting of low-power consumption mode control
register (LPMCR) during the sub clock mode, the mode switches to the watch mode.
● Data retaining function
During the watch mode, data stored in internal RAMs and dedicated registers such as an accumulator will
be retained.
● External bus hold function
During the watch mode, the external bus hold function stops. Although a hold request to CPU is input, it
will not be accepted. If a hold request is input during the transition to watch mode, the HAK signal may not
change to "L" level while keeping buses in high impedance state.
● Operations while an interrupt request exists
While "0" is set to the TMD bit in the low-power consumption mode control register (LPMCR), if an
interrupt request exists, the mode does not switch to the watch mode. If the CPU cannot accept an interrupt
request, the next instruction of the current one will be executed. On the other hand, if the CPU can accept
an interrupt request, it will immediately branch to the interrupt processing routine.
● Pin state
The state of input/output pins during the watch mode can be specified to set either to change to high
impedance state or to keep the state before transiting to the watch mode, by setting the SPL bit in the lowpower consumption mode control register (LPMCR).
Note:
During the watch mode, in order to set the pin sharing a port with peripheral functions to high
impedance state, after prohibiting the output by peripheral functions, set the TMD bit in the lowpower consumption mode control register (LPMCR) to "0".
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
163
CHAPTER 8 LOW-POWER CONSUMPTION MODE
8.5 Standby Mode
MB90340E Series
■ Returning from the Watch Mode
Generation of a reset source or interrupt will cancel the watch mode.
● Returning by a reset source
If the watch mode is canceled by a reset source, after canceling the watch mode, the mode switches to the
main clock mode and then to a reset sequence.
● Returning by an interrupt
During the watch mode, if an interrupt request with interrupt level (IL) higher than seven is generated by
the watch timer and an external interrupt, the watch mode will be canceled. And after canceling the watch
mode, the interrupt requests will be judged based on the I flag in the condition code register (CCR) and the
settings in the interrupt level mask register (ILM) and interrupt control register (ICR) as in the case with
normal interrupt processing. In the case of sub watch mode, because it does not have oscillation
stabilization wait time, the interrupt request will be judged immediately after returning to the watch mode.
• If the CPU cannot accept an interrupt request, the next instruction of the current one will be executed.
• If the CPU can accept an interrupt request, it will immediately branch to the interrupt processing
routine.
Note:
When executing an interrupt processing, it will be normally done after executing the next instruction
of the instruction having a watch mode specification. However, if the switching to watch mode and
the reception of external bus hold request are done simultaneously, the transition to interrupt
processing may occur before executing the next instruction.
164
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
MB90340E Series
8.5.3
Time-base Timer Mode
CHAPTER 8 LOW-POWER CONSUMPTION MODE
8.5 Standby Mode
The time-base timer mode is a mode that operates the oscillation clock (HCLK), sub
clock (SCLK), the time-base timer and watch timer only. Peripheral functions except the
time-base timer, watchdog timer and watch timer stop.
■ Switching to the Time-base Timer Mode
If "0" is written in the TMD bit of low-power consumption mode control register (LPMCR) while the PLL
clock mode or main clock mode is operating (CKSCR: SCM=1), the mode switches to the time-base timer
mode.
● Data retaining function
During the time-base timer mode, data stored in internal RAMs and dedicated registers such as an
accumulator will be retained.
● External bus hold function
During the time-base timer mode, the external bus hold function stops. Although a hold request to CPU is
input, it will not be accepted. If a hold request is input during the transition to time-base timer mode, the
HAK signal may not change to "L" level while keeping buses in high impedance state.
● Operations while an interrupt request exists
While "0" is set to the TMD bit in the low-power consumption mode control register (LPMCR), if an
interrupt request exists, the mode does not switch to the time-base timer mode. If the CPU cannot accept an
interrupt request, the next instruction of the current one will be executed. On the other hand, if the CPU can
accept an interrupt request, it will immediately branch to the interrupt processing routine.
● Pin state
The state of input/output pins during the time-base timer mode can be specified to set either to change to
high impedance state or to keep the state before transiting to the time-base timer mode, by setting the SPL
bit in the low-power consumption mode control register (LPMCR).
Note:
During the time-base timer mode, in order to set the pin sharing a port with peripheral functions to
high impedance state, after prohibiting the output by peripheral functions, set the TMD bit in the lowpower consumption mode control register (LPMCR) to "0".
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
165
CHAPTER 8 LOW-POWER CONSUMPTION MODE
8.5 Standby Mode
MB90340E Series
■ Returning from the Time-base Timer Mode
Generation of a reset source or interrupt will cancel the time-base timer mode.
● Returning by a reset source
If the time-base timer mode is canceled by a reset source, after canceling the time-base timer mode, the
mode switches to the main clock mode and then to a reset sequence.
● Returning by an interrupt
During the time-base timer mode, if an interrupt request with interrupt level (IL) higher than seven is
generated by the watch timer, time-base timer and an external interrupt, the time-base timer mode will be
canceled. And after canceling the time-base timer mode, generated interrupt requests will be judged based
on the interrupt enable flag (I) in the condition code register (CCR) and the settings in the interrupt level
mask (ILM) and interrupt control register (ICR) as in the case with normal interrupt processing.
• If the CPU cannot accept an interrupt request, the next instruction of the current one will be executed.
• If the CPU can accept an interrupt request, it will immediately branch to the interrupt processing
routine.
• The time-base timer mode has the following two types:
- Main clock to/from time-base timer mode
- PLL clock to/from time-base timer mode
Note:
When executing an interrupt processing, it will be normally done after executing the next instruction
of the instruction having a time-base timer mode specification. However, if the switching to time-base
timer mode and the reception of external bus hold request are done simultaneously, the transition to
interrupt processing may occur before executing the next instruction.
166
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 8 LOW-POWER CONSUMPTION MODE
8.5 Standby Mode
MB90340E Series
8.5.4
Stop Mode
The stop mode is a mode that stops the oscillation clock (HCLK) and sub clock (SCLK)
while a clock mode is operating. Data can be kept with lowest power dissipation.
■ Stop Mode
If "1" is written in the STP bit of low-power consumption mode control register (LPMCR) while the PLL
clock mode is operating (CKSCR: MCS=1, SCS=0), the mode switches to the stop mode based on the
settings of MCS bit and SCS bit in the clock selection register (CKSCR).
Table 8.5-3 shows the correspondence between the stop mode and the settings of the MCS bit and SCS bit
in the clock selection register (CKSCR).
Table 8.5-3 Clock Selection Register (CKSCR) Settings and Their Stop Modes
Clock selection register (CKSCR)
Stop mode to switch to
MCS
SCS
1
1
Main stop mode
0
1
PLL stop mode
1
0
0
0
Sub stop mode
Note:
If "1" is concurrently set to the STP bit and SLP bit in the low-power consumption mode control
register (LPMCR), the STP bit has priority, switching to the stop mode.
● Data retaining function
During the stop mode, data stored in internal RAMs and dedicated registers such as an accumulator will be
retained.
● External bus hold function
During the stop mode, the external bus hold function stops. Although a hold request to CPU is input, it will
not be accepted. If a hold request is input during the transition to stop mode, the HAK signal may not
change to "L" level while keeping buses in high impedance state.
● Operations while an interrupt request exists
While "1" is set to the STP bit in the low-power consumption mode control register (LPMCR), if an
interrupt request exists, the mode does not switch to the stop mode. If the CPU cannot accept an interrupt
request, the next instruction of the current one will be executed. On the other hand, if the CPU can accept
an interrupt request, it will immediately branch to the interrupt processing routine.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
167
CHAPTER 8 LOW-POWER CONSUMPTION MODE
8.5 Standby Mode
MB90340E Series
● Pin state
The state of input/output pins during the stop mode can be specified to set either to change to high
impedance state or to keep the state before transiting to the stop mode, by setting the SPL bit in the lowpower consumption mode control register (LPMCR).
Note:
During the stop mode, in order to set the pin sharing a port with peripheral functions to high
impedance state, after prohibiting the output by peripheral functions, set the STP bit in the low-power
consumption mode control register (LPMCR) to "1".
■ Returning from the Stop Mode
Generation of a reset source or interrupt will cancel the stop mode. When returning from the stop mode,
because the oscillation clock (HCLK) and sub clock (SCLK) are suspended, the stop mode will be canceled
after the main clock or sub clock oscillation stabilization wait time having elapsed.
● Returning by a reset source
If the stop mode is canceled by a reset source, the main clock oscillation stabilization wait time will be
necessary. After the main clock oscillation stabilization wait time elapses, the stop mode is canceled and
transits to the reset sequence.
Figure 8.5-2 shows the returning process from the sub stop mode caused by an external reset.
Figure 8.5-2 Returning Process from the Sub Stop Mode Caused by an External Reset
RST pin
Stop mode
Main clock
Oscillation stabilization waiting
Oscillating
Sub clock
Oscillation stabilization waiting
Oscillating
Oscillation
stabilization waiting
PLL clock
CPU operation clock
CPU operation
Main clock
Stopped
Reset sequence
Oscillating
PLL clock
Normal process
Stop mode canceled
Reset canceled
168
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
MB90340E Series
CHAPTER 8 LOW-POWER CONSUMPTION MODE
8.5 Standby Mode
● Returning by an interrupt
During the stop mode, if an interrupt request with interrupt level (IL) higher than seven is generated by an
external interrupt, the stop mode will be canceled. In the case of stop mode, a main clock oscillation
stabilization wait time or sub clock oscillation time will be required after canceling the stop mode. And
after finishing the main clock oscillation stabilization wait time or sub clock oscillation wait time,
generated interrupt requests will be judged based on the interrupt enable flag (I) in the condition code
register (CCR) and the settings in the interrupt level mask (ILM) and interrupt control register (ICR) as in
the case with normal interrupt processing.
• If the CPU cannot accept an interrupt request, the next instruction of the current one will be executed.
• If the CPU can accept an interrupt request, it will immediately branch to the interrupt processing
routine.
Notes:
• When executing an interrupt processing, it will be normally done after executing the next
instruction of the instruction having a stop mode specification. However, if the switching to stop
mode and the reception of external bus hold request are done simultaneously, the transition to
interrupt processing may occur before executing the next instruction.
When switching to the PLL stop mode, set 10B or 11B to the oscillation stabilization wait time
selection bit (CKSCR: WS1, WS0) in the clock selection register.
• During the PLL stop mode, a main clock oscillation stabilization wait time and PLL clock oscillation
stabilization wait time have to be secured when returning from the PLL stop mode because the
main clock and PLL multiplier circuits are stopped. The oscillation stabilization wait time in this
case bases upon the values set in the oscillation stabilization wait time selection bit in the clock
selection register (CKSCR:WS1, WS0), and the main clock oscillation stabilization wait time and
PLL clock oscillation stabilization wait time will be counted together. Therefore, set a value to the
"CKSCR:WS1, WS0" bit in line with the longest one of the oscillation stabilization wait times.
However, because 214/HCLK or more is needed for the PLL clock oscillation stabilization wait
time, set 10B or 11B to the "CKSCR: WS1, WS0" bit.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
169
CHAPTER 8 LOW-POWER CONSUMPTION MODE
8.6 State Transition of the Standby Mode
8.6
MB90340E Series
State Transition of the Standby Mode
Operation states and transitions of the clock mode and standby mode in MB90340E
series are shown in a chart.
■ State Transition Chart
Figure 8.6-1 State Transition Chart
Power turned on
External reset, watchdog timer reset, software reset
Power-on reset
Reset
SCS=0
SCS=1
Oscillation stabilization
wait done
Main clock mode
MCS=0
PLL clock mode
MCS=1
SLP=1
Interrupt
Main sleep mode
TMD=0
Interrupt
Main time-base
timer mode
STP=1
SCS=0
SCS=1
SLP=1
Interrupt
PLL sleep mode
TMD=0
Interrupt
PLL time-base
timer mode
STP=1
Main stop mode
Sub clock mode
PLL stop mode
SLP=1
Interrupt
Sub sleep mode
TMD=0
Interrupt
Watch mode
STP =1
Sub stop mode
Interrupt Oscillation stabili- Interrupt Oscillation stabili- Interrupt Oscillation stabilization wait done
zation wait done
zation wait done
Main clock
oscillation stabilization waiting
170
PLL clock
oscillation stabilization waiting
FUJITSU SEMICONDUCTOR LIMITED
Sub clock
oscillation stabilization waiting
CM44-10143-5E
CHAPTER 8 LOW-POWER CONSUMPTION MODE
8.7 Pin State in the Standby Mode and at the Time of Reset
MB90340E Series
8.7
Pin State in the Standby Mode and at the Time of Reset
This section shows the input/output pin states in the standby mode and at the time of
reset, for each access mode.
■ Input/Output Pin State (Single Chip Mode)
Table 8.7-1 Input/Output Pin State (Single Chip Mode)
During stop/watch/time-base timer*6
Pin name
During sleep
At the time of reset
SPL=0
P17 to P10
P27 to P20
P37 to P30
P47 to P40
P57 to P50
P67 to P60
P87 to P80
P97 to P90
PA1,PA0
Shuts off input*4/
Keeps the previous
state*2
SPL=1
Shuts off input*4/
Outputs Hi-Z*5
Input unavailable*3/
Outputs Hi-Z*5
Keeps the previous state*2
P07 to P00*7
P77 to P70 *9
Input available*1
PA0, P42, P32, P12,
P80 to P82, P84*8
*1: "Input available" means that input functions can be used. If the pin is set as an input port, apply pull-up/pull-down processing or
input external signals. If the pin is set as an output port, it transits to the same state as other pins.
*2: If the state immediately before transiting to a standby mode is output or input as is, this means "Input unavailable". This means that
if an outputting peripheral function is operating, output is obtained according to the state of the peripheral function, and if output is
obtained from an output pin, the output will be retained.
*3: "Input unavailable" means that the pin data cannot be accepted internally because the internal circuit is stopped while the operation
of input gate at the pin is allowed.
*4: During shut-off state, input is masked, and the "L" level will be sent inwardly if CMOS/Automotive is selected and the "H" level will
be sent inwardly if TTL is selected.
*5: "Outputs Hi-Z" means that the pin-driving transistor is prohibited from driving, and the pin is switched to high impedance state.
*6: The pull-up function in port 0 to 3 will be disabled in these modes.
*7: Can be input in the stop/watch/time-base timer mode when the INTxR bit in external interrupt source selection register EISSR is "0"
and the DTP/external interrupt request is enabled (ENIR:EN=1). In other settings, the input is masked and the "L" level will be sent
inwardly if CMOS/Automotive is selected and the "H" level will be sent inwardly if TTL
*8: Can be input in the stop/watch/time-base timer mode when the INTxR bit in external interrupt source selection register
EISSR is "1" and the DTP/external interrupt request is enabled (ENIR:EN=1). In other settings, the input is masked and
the "L" level will be sent inwardly if CMOS/Automotive is selected and the "H" level will be sent inwardly if TTL is
selected.
*9: Can be input in the stop/watch/time-base timer mode when the DTP/external interrupt request is enabled (ENIR:EN=1).
In other settings, the input is masked and the "L" level will be sent inwardly.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
171
CHAPTER 8 LOW-POWER CONSUMPTION MODE
8.7 Pin State in the Standby Mode and at the Time of Reset
MB90340E Series
Note:
During the stop mode, watch mode, or time-base timer mode, in order to set the pin sharing a port
with peripheral functions to high impedance state, after prohibiting the output by peripheral functions,
set the STP bit to "1" or TMD bit to "0" in the low-power consumption mode control register
(LPMCR).
■ Input/Output Pin State (16-bit Access Mode)
Table 8.7-2 Input/output Pin State (16-bit access Mode)
During stop/watch/
time-base timer
Pin name
During sleep
During hold
SPL=0
P07 to P00
(AD07 to AD00)
Input
unavailable/
P17 to P10
(AD15 to AD08)
Outputs Hi-Z
Shuts off
input/
Outputs Hi-Z
P27 to P20
(A23 to A16)
Output state
Output state
*1, *3
*1,*3
SPL=1
At the time of
internal ROM
At the time of
access after
reset
canceling
reset
At the time of
internal ROM
access after
accessing
external ROM
Input
unavailable/
Outputs Hi-Z
Outputs Hi-Z/ Outputs Hi-Z/
Input available Input available
Input
unavailable/
Outputs Hi-Z
Output state*1
Keeps the
previous address
*3
P37(CLK)
P36(RDY)
P35(HAK)
Input
unavailable/
Output
available*2,*3
Keeps the
previous
state*4
Input
unavailable/
Output state
*1, *3
Shuts off
input/
Keeps the
previous
state*4
*5
Input
unavailable/
Output Hi-Z/
Input
unavailable/
Outputs
Hi-Z*3
Outputs Hi-Z/ Outputs Hi-Z/
Input available Input available
Outputs "L"*3
Inputs "1"*3
P34(HRQ)
P33(WRH)
Outputs
"H"*3
Outputs
"H"*3
P32(WRL)
Input
unavailable/
Outputs Hi-Z
*3
P31(RD)
Outputs "H"
Outputs "H"
P30(ALE)
Outputs "L"
Outputs "L"
172
Shuts off
input/
Outputs Hi-Z
Input
unavailable/
Output
available*2,*3
Input
unavailable/
Outputs Hi-Z
Outputs "H"
Outputs "H"
Outputs "H"
Outputs "L"
Outputs "L"
Outputs "L"
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 8 LOW-POWER CONSUMPTION MODE
8.7 Pin State in the Standby Mode and at the Time of Reset
MB90340E Series
Table 8.7-2 Input/output Pin State (16-bit access Mode)
During stop/watch/
time-base timer
Pin name
During sleep
During hold
SPL=0
P47 to P40
P57 to P50
P67 to P60
P87 to P80
P97 to P90
PA1, PA0
Keeps the
previous
state*4
P77 to P70
PA0, P42, P32,
P12, P82 to P80,
P84*6
Keeps the
previous
state*4
SPL=1
At the time of
internal ROM
At the time of
access after
reset
canceling
reset
At the time of
internal ROM
access after
accessing
external ROM
Shuts off
input/
Outputs Hi-Z
*5
Keeps the
previous
state*4
Input
unavailable/
Outputs Hi-Z
Outputs Hi-Z/ Outputs Hi-Z/
Input available Input available
Input available
*1: "Output state" means that the fixed value of "H" level or "L" level will be output because the internal circuit stops operating while
the pin-driving transistor is allowed to drive. If the output function is being used while internal peripheral circuits are operating, the
output fluctuates except at the time of reset. (There is no output fluctuation at the time of reset.)
*2: "Output available" means that operation data will be output to pins because the internal circuit operation is allowed and the pindriving transistor is driving.
*3: If it is used as an output port, the value just previously output will be kept.
*4: If the state immediately before transiting to a standby mode is output or input as is, this means "Input unavailable". This means that
if an outputting peripheral function is operating, output is obtained according to the state of the peripheral function, and if output is
obtained from an output pin, the output will be retained. "Input unavailable" means that the pin data cannot be accepted internally
because the internal circuit is stopped while the operation of input gate at the pin is allowed.
*5: During shut-off state, input is masked, and the "L" level will be sent inwardly if CMOS/Automotive is selected and the "H" level will
be sent inwardly if TTL is selected. "Outputs Hi-Z" means that the pin-driving transistor is prohibited from driving, and the pin is
switched to high impedance state.
*6:Can be input in the stop mode when the INTxR bit in external interrupt source selection register EISSR is "1". If the bit is "0", the
state transits to the same one as other pins.
Note:
During the stop mode, watch mode, or time-base timer mode, in order to set the pin sharing a port
with peripheral functions to high impedance state, after prohibiting the output by peripheral functions,
set the STP bit to "1" or TMD bit to "0" in the low-power consumption mode control register
(LPMCR).
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
173
CHAPTER 8 LOW-POWER CONSUMPTION MODE
8.7 Pin State in the Standby Mode and at the Time of Reset
MB90340E Series
■ Input/Output Pin State (8-bit Access Mode)
Table 8.7-3 Input/output Pin State (8-bit Access Mode)
During stop/watch/
time-base timer
Pin name
During sleep
During hold
SPL=0
P07 to P00
(AD07 to AD00)
P17 to P10
(AD15 to AD08)
P27 to P20
(A23 to A16)
SPL=1
Shuts off
input/Outputs
Hi-Z
Input
unavailable/
Outputs Hi-Z
Output state
Output state
*1, *3
*1, *3
Input
unavailable/
Outputs Hi-Z
Input
unavailable/
Outputs Hi-Z
At the time of
internal ROM
At the time of
access after
reset
canceling
reset
At the time of
internal ROM
access after
accessing
external ROM
Outputs Hi-Z/ Outputs Hi-Z/
Input available Input available
Output state*1
Keeps the
previous address
*3
P37(CLK)
Input
unavailable/
Output
available
*2,*3
Input
unavailable/
Output state
Input
unavailable/
Output
available*2, *3
*1, *3
Input
unavailable/
Outputs Hi-Z
P36(RDY)
P35(HAK)
P34(HRQ)
Keeps the
previous
state*4
Shuts off
input/Keeps
the previous
state*4
*5
*3
Outputs Hi-Z/ Outputs Hi-Z/
Input available Input available
Outputs "L"*3
Inputs "1"*3
Keeps the
previous
state*4
P33
P32(WR)
Shuts off
input/
Outputs Hi-Z
Input
unavailable/
Outputs Hi-Z
Outputs "H"*3 Outputs "H"*3
Input
unavailable/
Outputs Hi-Z
*3
P31(RD)
Outputs "H"
Outputs "H"
P30(ALE)
Outputs "L"
Outputs "L"
P47 to P40
P57 to P50
P67 to P60
P87 to P80
P97 to P90
PA1, PA0
P77 to P70
PA0, P42, P32,
P12, P82 to P80,
P84*6
174
Keeps the
previous
state*4
Shuts off
input/
Keeps the
previous
state*4
Input
unavailable/
Outputs Hi-Z
Outputs "H"
Outputs "H"
Outputs "H"
Outputs "L"
Outputs "L"
Outputs "L"
Keeps the
previous
state*4
Input
unavailable/
Outputs Hi-Z
Outputs Hi-Z/ Outputs Hi-Z/
Input available Input available
Input available
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
MB90340E Series
CHAPTER 8 LOW-POWER CONSUMPTION MODE
8.7 Pin State in the Standby Mode and at the Time of Reset
*1: "Output state" means that the fixed value of "H" level or "L" level will be output because the internal circuit stops operating while
the pin-driving transistor is allowed to drive. If the output function is being used while internal peripheral circuits are operating, the
output fluctuates except at the time of reset. (There is no output fluctuation at the time of reset.)
*2: "Output available" means that operation data will be output to pins because the internal circuit operation is allowed and the pindriving transistor is driving.
*3: If it is used as an output port, the value just previously output will be kept.
*4: If the state immediately before transiting to a standby mode is output or input as is, this means "Input unavailable". This means that
if an outputting peripheral function is operating, output is obtained according to the state of the peripheral function, and if output is
obtained from an output pin, the output will be retained. "Input unavailable" means that the pin data cannot be accepted internally
because the internal circuit is stopped while the operation of input gate at the pin is allowed.
*5: During shut-off state, input is masked, and the "L" level will be sent inwardly if CMOS/Automotive is selected and the "H" level will
be sent inwardly if TTL is selected. "Outputs Hi-Z" means that the pin-driving transistor is prohibited from driving, and the pin is
switched to high impedance state.
*6: Can be input in the stop mode when the INTxR bit in external interrupt source selection register EISSR is "1". If the bit is "0", the
state transits to the same one as other pins.
Note:
During the stop mode, watch mode, or time-base timer mode, in order to set the pin sharing a port
with peripheral functions to high impedance state, after prohibiting the output by peripheral functions,
set the STP bit to "1" or TMD bit to "0" in the low-power consumption mode control register
(LPMCR).
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
175
CHAPTER 8 LOW-POWER CONSUMPTION MODE
8.8 Notes on Using the Low-power Consumption Mode
8.8
MB90340E Series
Notes on Using the Low-power Consumption Mode
Take notice of the following points when using the low-power consumption mode.
■ Switching to the Standby Mode
Even if "0" is set to the TMD bit or "1" is set to the STP and SLP bits of the low-power consumption mode
control register (LPMCR) while peripheral functions generate interrupt requests to the CPU, the modes do
not switch to their standby modes (do not switch even after finishing interrupt processing).
While the CPU is processing interrupts, the interrupt request flags being processed will be cleared, and the
mode is ready to switch to the standby mode unless other interrupt requests exist.
■ Notes on Switching to the Standby Mode
Follow the instructions below to change the pin that shares a port with other peripheral functions to high
impedance state during the stop mode, watch mode, or time-base timer mode.
1) Prohibit output by peripheral functions.
2) In the low-power consumption mode control register (LPMCR), set the SPL bit to "1", STP bit to "1",
or TMD bit to "0".
■ Canceling by the Interrupt of Standby Mode
During the sleep mode, watch mode, time-base timer mode, or stop mode, if an interrupt request with
interrupt level (IL) higher than seven is generated by the operating peripheral functions and an external
interrupt, the standby mode will be canceled. Canceling of the standby mode by an interrupt is independent
of whether the CPU accepts the interrupt or not.
Note:
If you do not want to branch to interrupt processing after the returning from the standby mode, take
measures such as prohibiting an interrupt before setting the standby mode.
■ Notes on Canceling the Standby Mode
Before entering into the stop mode, the standby mode can be canceled by inputting according to the settings
of input source of external interrupt. "H" level, "L" level, rising edge, and falling edge are available for the
input source.
■ Oscillation Stabilization Wait Time
● Main clock oscillation stabilization wait time
Because the main clock oscillation is stopped during the sub clock mode, watch mode, and stop mode, a
main clock oscillation stabilization wait time has to be secured. The WS1 and WS0 bits in the clock
selection register (CKSCR) set the oscillation stabilization wait time.
176
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 8 LOW-POWER CONSUMPTION MODE
8.8 Notes on Using the Low-power Consumption Mode
MB90340E Series
● Sub clock oscillation stabilization wait time
Because the sub clock (SCLK) oscillation is stopped during the sub stop mode, a sub clock oscillation
stabilization wait time has to be secured. The oscillation stabilization wait time is fixed at 214/SCLK
(SCLK: Sub clock).
● PLL clock oscillation stabilization wait time
During the main clock mode, because the PLL multiplier circuit is stopped, a PLL clock oscillation
stabilization wait time has to be secured when switching to the PLL clock mode. During the PLL clock
oscillation stabilization wait time, the main clock operates. At the time the mode is switched from the main
clock mode to PLL clock mode, the PLL clock oscillation stabilization wait time is fixed at 214/HCLK
(HCLK: oscillation clock).
During the sub clock mode, a main clock oscillation stabilization wait time and PLL clock oscillation
stabilization wait time have to be secured when switching to the PLL clock mode because the main clock
and PLL multiplier circuits are stopped. The oscillation stabilization wait time in this case bases upon the
values set in the oscillation stabilization wait time selection bit in the clock selection register
(CKSCR:WS1, WS0), and the main clock oscillation stabilization wait time and PLL clock oscillation
stabilization wait time will be counted together. Therefore, set a value to the "CKSCR:WS1, WS0" bit in
line with the longest one of the oscillation stabilization wait times. However, because 214/HCLK or more is
needed for the PLL clock oscillation stabilization wait time, set 10B or 11B to the "CKSCR: WS1, WS0"
bit.
During the PLL stop mode, a main clock oscillation stabilization wait time and PLL clock oscillation
stabilization wait time have to be secured when returning from the PLL stop mode because the main clock
and PLL multiplier circuits are stopped. The oscillation stabilization wait time in this case bases upon the
values set in the oscillation stabilization wait time selection bit in the clock selection register
(CKSCR:WS1, WS0), and the main clock oscillation stabilization wait time and PLL clock oscillation
stabilization wait time will be counted together. Therefore, set a value to the "CKSCR:WS1, WS0" bit in
line with the longest one of the oscillation stabilization wait times. However, because 214/HCLK or more is
needed for the PLL clock oscillation stabilization wait time, set 10B or 11B to the "CKSCR: WS1, WS0"
bit.
■ Clock Mode Switch
When the clock mode has been switched, do not again switch to the low-power consumption mode or other
clock modes before the switching completes. The completion of switching can be checked by referring to
the MCM bit and SCM bit in the clock selection register (CKSCR). If a mode is switched again to other
clock modes or the low-power consumption mode before the first switching is finished, the second
switching may not complete.
■ Notes on Accessing the Low-power Consumption Mode Control Register (LPMCR) for
Switching to the Standby Mode
● When accessing the low-power consumption mode control register (LPMCR) using an assemble
language
Use the instructions in Table 8.3-2 to configure the settings for switching to the standby mode in the lowpower consumption mode control register (LPMCR).
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
177
CHAPTER 8 LOW-POWER CONSUMPTION MODE
8.8 Notes on Using the Low-power Consumption Mode
MB90340E Series
Immediately after using the standby mode transition instructions in Table 8.3-2, be sure to add the
instructions shown in the dotted square below.
MOV LPMCR, #H’xx ; Low-power consumption mode transition instruction in Table 8.3-2
NOP
NOP
JMP $+3
; Jump to next instruction
MOV A, #H’10
; Any instruction
If instruction lines other than shown in the dotted square are added, operations after canceling the standby
mode will not be assured.
● When accessing the low-power consumption mode control register (LPMCR) using C language
Use one of the following instructions 1 to 3 to configure the settings for switching to the standby mode in
the low-power consumption mode control register (LPMCR).
1. Prepare a function for the instruction to be switched to the standby mode, and insert two "__wait_nop()"
built-in functions behind the standby mode transition instruction. If there is a possibility that an interrupt
except a standby returning interrupt may occur within the function, optimize the program while
compiling to prevent the occurrence of LINK/UNLINK instructions.
Example (Transition function to the watch mode or time-base timer mode)
void enter_watch(){
IO_LPMCR.byte = 0x10; /* Set the TMD bit of LPMCR to 0 */
__wait_nop();
__wait_nop();
}
2. Write an instruction to switch to the standby mode using the "__asm" statement, and insert two NOP
and a JMP instructions behind the standby mode transition instruction.
Example (Transition to the sleep mode)
__asm( " MOV I:_IO_LPMCR, #H’58); /* Set 1 to the SLP bit of LPMCR */
__asm( " NOP");
__asm( " NOP");
__asm( " JMP $+3");
/* Jump to next instruction
*/
3. Write an instruction to switch to the standby mode between "#pragma asm" and "#pragma endasm", and
insert two NOP and a JMP instructions behind the standby mode transition instruction.
Example (Transition to the stop mode)
#pragma asm
MOV I:_IO_LPMCR, #H’98
/* Set 1 to the STP bit of LPMCR */
NOP
NOP
JMP $+3
/* Jump to next instruction
*/
#pragma endasm
178
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 9
MEMORY ACCESS MODE
This chapter explains the functions and operations of
the memory access mode.
9.1 Overview of the Memory Access Mode
9.2 External Memory Access (Bus Pin Control Circuit)
9.3 External Memory Access Control Signal Operations
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
179
CHAPTER 9 MEMORY ACCESS MODE
9.1 Overview of the Memory Access Mode
9.1
MB90340E Series
Overview of the Memory Access Mode
F2MC-16LX has several modes for access methods and access areas.
■ Overview of the Memory Access Mode
Table 9.1-1 Mode Pins and Their Modes
Operation mode
Bus mode
Access mode
−
Single chip
8-bit
Internal ROM external bus
RUN
16-bit
8-bit
External ROM external bus
16-bit
Flash programming
−
−
● Operation mode
Operation mode refers to a mode that controls the operation states of devices. It is specified by the MD2 to
MD0 mode setting pin and the M1 to M0 bit in mode data. Selecting an operation mode allows to start a
normal operations or write to a flash memory.
● Bus mode
Bus mode refers to a mode that controls the operations of internal ROM and external access functions. It is
specified by the mode setting pins (MD2 to MD0) and the M1 to M0 bit in mode data. The mode setting
pins (MD2 to MD0) specifies the bus mode when it reads reset vectors and mode data, and the M1 to M0
bit in mode data specifies the bus mode in normal operations.
● Access mode
Access mode refers to a mode that controls external data bus widths. It is specified by the MD2 to MD0
mode setting pin and the S0 bit in mode data. Selecting an access mode specifies the length of external data
bus, either 8-bit or 16-bit.
180
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 9 MEMORY ACCESS MODE
9.1 Overview of the Memory Access Mode
MB90340E Series
9.1.1
Mode Pin
By combining the three external pins MD2 to MD0, the operations shown in Table 9.1-2
can be specified.
■ Mode Pin
Table 9.1-2 Mode Pins and Their Modes
Mode pin setting
Mode name
Reset vector
access area
External data bus
width
MD2
MD1
MD0
0
0
0
External vector mode 0
External
8-bit
0
0
1
External vector mode 1
External
16-bit
0
1
0
0
1
1
1
0
0
1
0
1
1
1
0
Flash serial writing*
−
−
1
1
1
Flash memory
−
−
Note
Reset vector 16-bit bus
width access
Specification not allowed
Internal vector mode
Internal
(Mode data)
Mode data will control after
reset sequence
Specification not allowed
Mode when using parallel
writer
*: Serial writing to a flash memory cannot be done by the mode pin settings alone. Other pin settings are required. See "CHAPTER 26
EXAMPLES OF SERIAL PROGRAMMING CONNECTION FOR FLASH MEMORY PRODUCTS" for details.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
181
CHAPTER 9 MEMORY ACCESS MODE
9.1 Overview of the Memory Access Mode
9.1.2
MB90340E Series
Mode Data
Mode data is stored in FFFFDFH of the main memory and used to control CPU
operations. During the reset sequence, this data is fetched in the mode register in the
device. It is the reset sequence only that can change the mode register values.
The settings by this register will be enabled after the reset sequence.
Be sure to set "0" to the reserved bit.
■ Mode Data
Figure 9.1-1 Mode Data Configuration
bit
Address: FFFFDFH
7
M1
6
5
4
M0
Reserved
Reserved
3
2
1
0
S0
Reserved
Reserved
Reserved
[bit7, bit6] M1, M0 (Bus mode setting bits)
M1 and M0 are the bits that specify the operation mode after the reset sequence. The relationship between
the M1 and M0 bit and their functions is shown in Table 9.1-3.
Table 9.1-3 Functions of M1 and M0 (Bus Mode Setting Bits)
M1
M0
Function
0
0
Single chip mode
0
1
Internal ROM - external bus mode
1
0
External ROM - external bus mode
1
1
Setting not allowed
Note
[bit3] S0 (Bus mode setting bit)
S0 is the bit to specify the bus mode and access mode after the reset sequence. The relationship between the
S0 bit and its functions is shown in Table 9.1-4.
Table 9.1-4 Functions of S0 (Mode Setting Bit)
S0
182
Function
0
External data bus 8-bit mode
1
External data bus 16-bit mode
FUJITSU SEMICONDUCTOR LIMITED
Note
CM44-10143-5E
MB90340E Series
9.1.3
Memory Space by Bus Mode
CHAPTER 9 MEMORY ACCESS MODE
9.1 Overview of the Memory Access Mode
Figure 9.1-2 shows the correspondence between access areas and their physical
addresses specified by bus modes.
■ Memory Space by Bus Mode
Figure 9.1-2 Relationship Between Access Areas and Their Physical Addresses
FFFFFFH
ROM area
ROM area
ROM area
ROM area
(FF bank
image)
(FF bank
image)
Extended I/O area
Extended I/O area
Address#1
010000H
008000H
Extended I/O area
007900H
Address#2
RAM
000100H
0000F0H
000000H
CM44-10143-5E
Generalpurpose
register
RAM
Generalpurpose
register
RAM
Generalpurpose
register
I/O
I/O
I/O
Single chip
Internal ROM
external bus
External ROM
internal bus
FUJITSU SEMICONDUCTOR LIMITED
: Internal
: External
: Access not allowed
183
CHAPTER 9 MEMORY ACCESS MODE
9.1 Overview of the Memory Access Mode
TYPE
184
MB90340E Series
Address #1
Address #2
MB90341E/CE/ES/CES
FE0000H
004000H
MB90(F)342E/CE/ES/CES
FC0000H
004000H
MB90F345E/CE/ES/CES
F80000H
005100H
MB90(F)346E/CE/ES/CES
FF0000H
000900H
MB90(F)347E/CE/ES/CES
FE0000H
001900H
MB90348E/CE/ES/CES
FE0000H
004000H
MB90(F)349E/CE/ES/CES
FC0000H
004000H
MB90V340E-101/102
F80000H
007900H
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 9 MEMORY ACCESS MODE
9.1 Overview of the Memory Access Mode
MB90340E Series
■ Recommended Settings
Table 9.1-5 shows the recommended setting examples for mode pins and mode data.
Table 9.1-5 Recommended Setting Examples for Mode Pins and Mode Data
Setting example
MD2
MD1
MD0
M1
M0
S0
Single chip
0
1
1
0
0
×
Internal ROM external bus mode - 16-bit bus
0
1
1
0
1
1
Internal ROM external bus mode - 8-bit bus
0
1
1
0
1
0
External ROM external bus mode - 16-bit bus - Vector
16-bit bus width
0
0
1
1
0
1
External ROM external bus mode - 8-bit bus
0
0
0
1
0
0
External pins have different signal functions for each mode.
Table 9.1-6 External Pin Functions for Each Mode
Function
Pin name
External data bus expansion
Single chip
Flash programming
8-bit
P07 to P00
16-bit
AD07 to AD00
P17 to P10
A15 to A08
AD15 to AD08
DQ07 to DQ00
AQ15 to AQ08
P27 to P20
A23 to A16*
AQ07 to AQ00
P30
ALE
AQ16
P31
RD
CE
P32
P33
Port
WR*
WRL*
OE
Port
WRH*
WE
P34
HRQ*
AQ17
P35
HAK*
AQ18
P36
RDY*
BYTE
P37
CLK*
RY/BY
*: The output pins placed in a high address, WRL/WR, WRH, HRQ, HAK, RDY, and CLK pins can be
used as a port by specifying a function. See Section "9.2 External Memory Access (Bus Pin Control
Circuit)" for details.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
185
CHAPTER 9 MEMORY ACCESS MODE
9.2 External Memory Access (Bus Pin Control Circuit)
9.2
MB90340E Series
External Memory Access (Bus Pin Control Circuit)
The external bus pin control circuit controls the external bus pin to expand the CPU
address and data bus outward.
■ External Memory Access (External Bus Pin Control Circuit)
Use the address, data, and control signal as shown below to access the external memory / peripherals of this
device.
• CLK(P37): Machine cycle clock (KBP) output pin
• RDY(P36): External ready input pin
• WRH(P33): Write strobe signal for the upper 8-bit of data bus. It operates only in the 16-bit bus mode.
• WRL/WR(P32): In 16-bit bus mode, it functions as a write strobe signal for the upper 8-bit of data bus.
In 8-bit bus mode, it functions as a write strobe signal.
• RD(P31): Read strobe signal
• ALE(P30): Address latch enable signal
The external bus pin control circuit controls the external bus pin and allows the CPU address and data bus
to expand outward.
■ Block Diagram of External Memory Access
Figure 9.2-1 External Bus Controller
P0
P1
P2
P3
P0 data
P3
P0
P0 direction
RB
Data control
Address control
Access
control
186
Access control
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 9 MEMORY ACCESS MODE
9.2 External Memory Access (Bus Pin Control Circuit)
MB90340E Series
9.2.1
Register for External Memory Access (External Bus Pin
Control Circuit)
There are three types of register for external memory access (external bus pin control
circuit).
• Auto ready selection register
• External address output control register
• Bus control signal selection register
■ List of Registers for External Memory Access
Figure 9.2-2 List of Registers for External Memory Access (External Bus Pin Control Circuit)
Auto ready selection register
bit
15
14
13
12
11
10
9
8
IOR1
IOR0 HMR1 HMR0
−
−
Read/write
→
(W)
(W)
(W)
(W)
(−)
(−)
(W)
(W)
Initial value
→
(0)
(0)
(1)
(1)
(×)
(×)
(0)
(0)
Address: 0000A5H
LMR1 LMR0
ARSR
External address output control register
bit
Address: 0000A6H
7
6
5
4
3
2
1
0
E23
E22
E21
E20
E19
E18
E17
E16
Read/write
→
(W)
(W)
(W)
(W)
(W)
(W)
(W)
(W)
Initial value
→
(0)
(0)
(0)
(0)
(0)
(0)
(0)
(0)
12
11
10
9
8
HACR
Bus control signal selection register
bit
Address: 0000A7H
15
14
13
CKE
RYE
HDE
IOBS HMBS WRE LMBS
−
Read/write
→
(W)
(W)
(W)
(W)
(W)
(W)
(W)
(−)
Initial value
→
(0)
(0)
(0)
(0)
(0)
(0)
(0)
(×)
ECSR
W: Write only
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
187
CHAPTER 9 MEMORY ACCESS MODE
9.2 External Memory Access (Bus Pin Control Circuit)
9.2.2
MB90340E Series
Auto Ready Selection Register (ARSR)
Auto ready selection register (ARSR) sets an auto wait time of memory access for each
area when externally accessing.
■ Auto Ready Selection Register (ARSR)
Figure 9.2-3 Configuration of Auto Ready Selection Register
Auto ready selection register
bit
Address: 0000A5H
15
14
13
12
11
10
−
−
(W)
(−)
(−)
(W)
(W)
(1)
(×)
(×)
(0)
(0)
IOR1
IOR0 HMR1 HMR0
Read/write
(W)
(W)
(W)
Initial value
(0)
(0)
(1)
9
8
LMR1 LMR0
ARSR
W: Write only
[bit15, bit14] IOR1, IOR0
The IOR1 and IOR0 bit specifies the auto wait function when the 0000F0H to 0000FFH area is accessed
externally. The combination of IOR1 and IOR0 bit configures the settings as shown in Table 9.2-1.
Table 9.2-1 Functions of IOR1 and IOR0 (Auto Wait Function Specification Bit)
IOR1
IOR0
Function
0
0
Auto wait prohibited [Initial value]
0
1
Auto wait of 1 cycle is inserted during external access
1
0
Auto wait of 2 cycles is inserted during external access
1
1
Auto wait of 3 cycles is inserted during external access
[bit13, bit12] HMR1, HMR0
The HMR1 and HMR0 specify the auto wait function when the 800000H to FFFFFFH area is accessed
externally. The combination of HMR1 and HMR0 bit configures the settings as shown in Table 9.2-2.
Table 9.2-2 Functions of HMR1 and HMR0 (Auto Wait Function Specification Bit)
188
HMR1
HMR0
Function
0
0
Auto wait prohibited
0
1
Auto wait of 1 cycle is inserted during external access
1
0
Auto wait of 2 cycles is inserted during external access
1
1
Auto wait of 3 cycles is inserted during external access [Initial value]
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 9 MEMORY ACCESS MODE
9.2 External Memory Access (Bus Pin Control Circuit)
MB90340E Series
[bit9, bit8] LMR1, LMR0
The LMR1 and LMR0 specifies the auto wait function when the 008000H to 7FFFFFH area is accessed
externally. The combination of LMR1 and LMR0 bit configures the settings as shown in Table 9.2-3.
Table 9.2-3 Functions of LMR1 and LMR0 (Auto Wait Function Specification Bit)
CM44-10143-5E
LMR1
LMR0
Function
0
0
Auto wait prohibited [Initial value]
0
1
Auto wait of 1 cycle is inserted during external access
1
0
Auto wait of 2 cycles is inserted during external access
1
1
Auto wait of 3 cycles is inserted during external access
FUJITSU SEMICONDUCTOR LIMITED
189
CHAPTER 9 MEMORY ACCESS MODE
9.2 External Memory Access (Bus Pin Control Circuit)
9.2.3
MB90340E Series
External Address Output Control Register (HACR)
The external address output control register (HACR) is a register to control the external
output by the addresses (A23 to A16). Each bit corresponds to the address A23 to A16
and controls each address output pin as shown in Figure 9.2-4. All bits of this register
are write-only. "1" will be used for read.
■ External Address Output Control Register (HACR)
Figure 9.2-4 Configuration of External Address Output Control Register
External address output control register
bit
Address: 0000A6H
7
6
5
4
3
2
1
0
E23
E22
E21
E20
E19
E18
E17
E16
Read/write
→
(W)
(W)
(W)
(W)
(W)
(W)
(W)
(W)
Initial value
→
(0)
(0)
(0)
(0)
(0)
(0)
(0)
(0)
HACR
W: Write only
The HACR register controls the output for the addresses (A23 to A16) that lead to external circuits. The
eight bits correspond to the addresses A23 to A16 and control the address output pin as shown below.
The HACR register cannot access when the device is in the single chip mode. In this case, all pins function
as I/O ports regardless of the values in this register.
All bits of this register are write-only. "1" will be used for read.
Table 9.2-4 Functions of External Address Output Control Register (E23 to E16 Bit)
190
0
Pins correspond to address outputs (AXX). [Initial value]
1
Pins correspond to I/O port (P2X).
Set this bit to "1" if it is used as a peripheral resource.
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 9 MEMORY ACCESS MODE
9.2 External Memory Access (Bus Pin Control Circuit)
MB90340E Series
9.2.4
Bus Control Signal Selection Register (ECSR)
Bus control signal selection register (ECSR) is a register to set the control functions of
bus operations in the external bus mode. It cannot access when the device is in the
single chip mode. In this case, all pins function as I/O ports regardless of the values in
this register. All bits of bus control signal selection register are write-only. "1" will be
used for read.
■ Bus Control Signal Selection Register (ECSR)
Figure 9.2-5 Configuration of Bus Control Signal Selection Register
Bus control signal selection register
bit
Address: 0000A7H
15
14
13
CKE
RYE
HDE
IOBS HMBS WRE LMBS
12
11
10
9
8
−
Read/write
→
(W)
(W)
(W)
(W)
(W)
(W)
(W)
(−)
Initial value
→
(0)
(0)
(0)
(0)
(0)
(0)
(0)
(×)
ECSR
W: Write only
[bit15] CKE
The CKE bit controls the output of external clock signal pin (CLK) as shown in Table 9.2-5.
Table 9.2-5 Functions of CKE (External Clock (CLK) Output Control Bit)
0
I/O port (P37) operation (Clock output prohibited) [Initial value]
1
Clock signal (CLK) output allowed
[bit14] RYE
The RYE bit controls the input of external ready (RDY) signal pin as shown in Table 9.2-6.
Table 9.2-6 Functions of RYE (External Ready (RDY) Input Control Bit)
0
I/O port (P36) operation (External RDY input prohibited) [Initial value]
1
External ready (RDY) input allowed
[bit13] HDE
The HDE bit specifies the input/output allowance for hold-related signals. The settings of HDE bit will
control the hold request input signal (HRQ) and hold acknowledgment output signal (HAK) as shown in
Table 9.2-7.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
191
CHAPTER 9 MEMORY ACCESS MODE
9.2 External Memory Access (Bus Pin Control Circuit)
MB90340E Series
Table 9.2-7 Functions of HDE (Input/Output Allowance Specification Bit for Hold-related
Pin)
0
I/O port (P35, P34) operation (Hold function input/output prohibited) [Initial value]
1
Hold request (HRQ) input/Hold acknowledgment (HAK) output allowance
[bit12] IOBS
The IOBS bit specifies the bus width when the area 0000F0H to 0000FFH is externally accessed during the
external data bus 16-bit mode. Table 9.2-8 shows the control by the setting of this bit.
Table 9.2-8 IOBS (Bus Width Specification Bit)
0
16-bit bus width access [Initial value]
1
8-bit bus width access
[bit11] HMBS
The HMBS bit specifies the bus width when the area 800000H to FFFFFFH is externally accessed during
the external data bus 16-bit mode. Table 9.2-9 shows the control by the setting of this bit.
Table 9.2-9 Functions of HMBS (Bus Width Specification Bit)
0
16-bit bus width access [Initial value]
1
8-bit bus width access
[bit10] WRE
The WRE bit controls the output of external write signal (both WRH and WRL pins, in the case of external
data bus 16-bit mode, and WR pin, in the case of external data bus 8-bit mode) as shown in Table 9.2-10.
When in the external data bus 8-bit mode, P33 functions as an I/O port, regardless of the value set in this
bit.
Table 9.2-10 Functions of WRE (External Write Signal Output Control Bit)
192
0
I/O port (P33, P32) operation (Write signal output prohibited) [Initial value]
1
Write strobe signal (both WRH and WRL, or WR only) allowed to output
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 9 MEMORY ACCESS MODE
9.2 External Memory Access (Bus Pin Control Circuit)
MB90340E Series
[bit9] LMBS
The LMBS bit specifies the bus width when the area 002000H to 7FFFFFH is externally accessed during
the external data bus 16-bit mode. Table 9.2-11 shows the control by the setting of this bit.
Table 9.2-11 Functions of LMBS (Bus Width Specification Bit)
0
16-bit bus width access [Initial value]
1
8-bit bus width access
Notes:
• When in the external data bus 16-bit mode, switch P33 and P32 to an input mode if the WR,
WRH, and WRL functions are allowed with the WRE bit (Set the bit3 and bit2 in DDR3 register to
"0").
• When in the external data bus 8-bit mode, switch P32 to an input mode if the WR function is
allowed with the WRE bit (Set the bit2 in DDR3 register to "0").
• Even if RDY and HRQ signal input is allowed with the RYE and HDE bits, the I/O port function of
this port will be enabled. Therefore, be sure to write "0" (input mode) in the DDR3 register that
corresponds to the port.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
193
CHAPTER 9 MEMORY ACCESS MODE
9.3 External Memory Access Control Signal Operations
9.3
MB90340E Series
External Memory Access Control Signal Operations
External memory will be accessed in three cycles if the ready function is not used. The
8-bit bus width access in the external 16-bit bus mode is a function to read from and
writes to peripheral chips with 8-bit width when peripheral chips with 8-bit width and 16bit width are connected to an external bus in a mixed manner.
■ External Memory Access Control Signal
The HMBS/LMBS/IOBS bits in ECSR register specify whether the 16-bit bus width access or the 8-bit bus
width access will be performed in the external data bus 16-bit mode.
Note that bus operations may not actually be performed by only outputting addresses and ALE signal
asserts, and by not asserting RD/WRL/WRH/WR. Be careful not to perform access to peripheral chips
using ALE signal only.
Figure 9.3-1 Access Timing Chart in the External Data Bus 8-bit Mode
Read
Write
Read
P37/CLK
P33/WRH
(Port data)
P32/WRL/WR
P31/RD
P30/ALE
P27 to P20/
A23 to AD16
P17 to P10/
A15 to AD08
P07 to P00/
AD07 AD00
Read address
Write address
Read address
Read address
Write address
Read address
Read address
Write address
Read data
194
FUJITSU SEMICONDUCTOR LIMITED
Read address
Write data
CM44-10143-5E
CHAPTER 9 MEMORY ACCESS MODE
9.3 External Memory Access Control Signal Operations
MB90340E Series
Figure 9.3-2 Access Timing Chart in the External Data Bus 16-bit Mode (16-bit Bus Width Access)
8-bit bus width byte read
Even number address byte read
8-bit bus width byte write
Even number address byte write
P37/CLK
P33/WRH
P32/WRL/WR
P31/RD
P30/ALE
Read address
P27 to P20/A23 to A16
P17 to P10/AD15 to AD08
Read address
P07 to P00/AD07 to AD00
Read address
Write address
Disabled
(Undefined)
Write address
Write address
Read data
Odd number address byte read
Read address
Read address
Read address
Write data
Odd number address byte write
P37/CLK
P33/WRH
P32/WRL/WR
P31/RD
P30/ALE
Read address
P27 to P20/A23 to A16
P17 to P10/AD15 to AD08
Read address
P07 to P00/AD07 to AD00
Read address
Write address
Write address
Disabled
Read address
(Undefined)
Write address
Read address
Write data
Read data
Even number address byte read
Read address
Even number address byte write
P37/CLK
P33/WRH
P32/WRL/WR
P31/RD
P30/ALE
Read address
P27 to 20/A23 to A16
Write address
Read address
P17 to 10/AD15 to AD08
Read address
Write address
Read address
P07 to 00/AD07 to AD00
Read address
Write address
Read address
Read data
Note:
Write data
Set external circuits to consistently read in units of words.
The settings in the P36/RDY pin and the auto ready selection register (ARSR) will allow the access to low
speed memory or peripheral circuits.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
195
CHAPTER 9 MEMORY ACCESS MODE
9.3 External Memory Access Control Signal Operations
9.3.1
MB90340E Series
Ready Function
The settings in the P36/RDY pin and the auto ready selection register (ARSR) will allow
the access to low speed memory or peripheral circuits.
If the RYE bit in the bus control signal selection register (ECSR) is set to "1", the wait
cycle will be used while the "L" level is input to the P36/RDY signal during the access to
an external circuit, resulting in an extended access cycle.
■ Ready Function
Figure 9.3-3 Ready Function Timing Chart
Even number address word read
Even number address word write
P37/CLK
P33/WRH
P32/WRL/WR
P31/RD
P30/ALE
P27 to P20/A23 to A16
Read address
Write address
P17 to P10/AD15 to AD08
Read address
Write address
P07 to P00/AD07 to AD00
Read address
Write address
P36/RDY
Read data
RDY pin fetched
Even number address word write
Write data
Even number address word read
P37/CLK
P33/WRH
P32/WRL/WR
P31/RD
P30/ALE
P27 to 20/A23 to A16
Write address
Read address
P17 to P10/AD15 to AD08
Write address
Address
P07 to P00/AD07 to AD00
Write address
Address
Write data
Extended cycled by auto ready
196
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
MB90340E Series
CHAPTER 9 MEMORY ACCESS MODE
9.3 External Memory Access Control Signal Operations
MB90340E has two types of auto ready functions for external memory access. The auto ready function is a
function that can extend access cycles by automatically inserting a wait cycle with 1 to 3 cycles without
external circuits when an access is generated to lower address external areas located between address
008000H to 7FFFFFH and upper address external areas located between address 800000H to FFFFFFH.
This function is enabled to start by the settings in the LMR1/LMR0 bit (lower address external area) of
ARSR and the HMR1/HMR0 bit (upper address external area) of ARSR.
In addition, MB90340E has an auto ready function for I/O independently of the one for memory. Setting
"0" to the IOR1/IOR0 bit in the ARSR register will extend the access cycle by automatically inserting a
wait cycle with 1 to 3 cycles without external circuits during the access to the external area between
address 0000F0H to 0000FFH.
If the RYE bit of either the external memory auto ready or the external I/O auto ready is set to "1", the wait
cycle remains unchanged if the "L" level continues to be input to the P36/RDY after the end of wait cycle
by the auto ready function described above.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
197
CHAPTER 9 MEMORY ACCESS MODE
9.3 External Memory Access Control Signal Operations
9.3.2
MB90340E Series
Hold function
If the HDE bit in the bus control signal selection register (ECSR) is set to "1", the
external address hold function by the P34/HRQ and P35/HAK pins will be enabled.
■ Hold Function
Inputting the "H" level to the P34/HRQ pin will change the state to hold state after CPU instructions are
finished (in the case of string instructions, after finishing processing the "1" element data), changing the
state of the pins shown below to high impedance state by outputting "L" level signals from the P35/HAK
pin.
• Address output
: P27/A23 to P20/A16
• Data input/output : P17/AD15 to P00/AD00
• Bus control signal : P30/ALE, P31/RD, P32/WRL/WR, P33/WRH
This allows the use of external buses through device external circuits. If "L" level signals are input to the
P34/HRQ pin, the P35/HAK pin will output "H" level, and the external pin state will be restored, causing
buses to operate again. In STOP state, no hold request input will be accepted.
Figure 9.3-4 Hold Timing
Hold cycle
Read cycle
Write cycle
P37/CLK
P34/HRQ
P35/HAK
P33/WRH
P32/WRL/WR
P31/RD
P30/ALE
P27 to P20/A23 to A16
(Address)
(Address)
P17 to P10/AD15 to AD08
(Address)
P07 to P00/AD07 to AD00
(Address)
Read data
Write data
Notes:
• If "H" level is input to the P34/HRQ pin, the P34/HRQ pin shall be kept at "H" level until the P35/
HAK pin reaches "L" level.
• Even during the period the P35/HAK pin is at "L" level, the watchdog timer continues to operate
without its timer being cleared. If the hold state continues longer than the interval time of
watchdog timer set at the WT1/WT0 bit in the watchdog timer control register (WDTC), a
watchdog reset will occur.
198
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 10
I/O PORTS
This chapter explains the functions of I/O ports.
10.1 I/O Ports
10.2 Register List for I/O Ports
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
199
CHAPTER 10 I/O PORTS
10.1 I/O Ports
10.1
MB90340E Series
I/O Ports
Each pin of I/O ports can specify to be an input or output port by setting the port data
direction register (DDR), as long as corresponding peripherals are configured not to
use the ports. If a pin is specified as an input, the logic level of the pin will be read. If
the pin is specified as an output, the data register value will be read. This also applies
to the reading of read-modify-write instruction.
■ Overview of I/O Ports
Figure 10.1-1 shows the block diagram of I/O ports.
Figure 10.1-1 Block Diagram of I/O Ports
Internal data bus
Data register read
Data register
Pin
Data register write
Direction register
Direction register write
Direction register read
200
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 10 I/O PORTS
10.2 Register List for I/O Ports
MB90340E Series
10.2
Register List for I/O Ports
There are five types of I/O port registers.
• Port data register (PDR0 to PDRA)
• Port data direction register (DDR0 to DDRA)
• Pull-up control register (PUCR0 to PUCR3)
• Analog data input enabling register (ADER5 to ADER7)
• Input level selection register (ILSR0, ILSR1)
■ Register List for I/O Ports
Figure 10.2-1 shows the bit configuration of each register for I/O ports.
Figure 10.2-1 Register List for I/O Ports
bit
Address: 000000H
Address: 000001H
Address: 000002H
Address: 000003H
Address: 000004H
Address: 000005H
Address: 000006H
Address: 000007H
Address: 000008H
Address: 000009H
Address: 00000AH
bit
Address: 000010H
Address: 000011H
Address: 000012H
Address: 000013H
Address: 000014H
Address: 000015H
Address: 000016H
Address: 000017H
Address: 000018H
Address: 000019H
Address: 00001AH
bit
Address: 00001CH
Address: 00001DH
Address: 00001EH
Address: 00001FH
bit
Address: 00000BH
Address: 00000CH
Address: 00000DH
bit
Address: 00000EH
Address: 00000FH
CM44-10143-5E
7
6
5
4
3
2
1
0
P07
P06
P05
P04
P03
P02
P01
P00
P17
P16
P15
P14
P13
P12
P11
P10
P27
P26
P25
P24
P23
P22
P21
P20
P37
P36
P35
P34
P33
P32
P31
P30
P47
P46
P45
P44
P43
P42
P41
P40
P57
P56
P55
P54
P53
P52
P51
P50
P67
P66
P65
P64
P63
P62
P61
P60
P77
P76
P75
P74
P73
P72
P71
P70
P87
P86
P85
P84
P83
P82
P81
P80
P97
P96
P95
P94
P93
P92
P91
P90
PA1
PA0
7
6
5
4
3
1
0
D07
D06
D05
D04
D03
D02
D01
D00
D17
D16
D15
D14
D13
D12
D11
D10
D27
D26
D25
D24
D23
D22
D21
D20
D37
D36
D35
D34
D33
D32
D31
D30
D47
D46
D45
D44
D43
D42
D41
D40
D57
D56
D55
D54
D53
D52
D51
D50
D67
D66
D65
D64
D63
D62
D61
D60
D77
D76
D75
D74
D73
D72
D71
D70
D87
D86
D85
D84
D83
D82
D81
D80
D97
D96
D95
D94
D93
D92
D91
D90
SIL4
SIL3
SIL2
SIL1
SIL0
DA1
DA0
7
6
1
0
5
4
3
2
2
PU07 PU06 PU05 PU04
PU03 PU02 PU01 PU00
PU17 PU16 PU15 PU14
PU13 PU12 PU11 PU10
PU27 PU26 PU25 PU24
PU23 PU22 PU21 PU20
PU37 PU36 PU35 PU34
PU33 PU32 PU31 PU30
15/7
14/6
13/5
12/4
11/3
10/2
9/1
ADE15 ADE14 ADE13 ADE12 ADE11 ADE10 ADE9
ADE7
ADE6
ADE5
ADE4
ADE3
ADE2
ADE1
14/6
13/5
12/4
11/3
IL3
IL7
IL6
IL5
IL4
ILT3
ILT2
ILT1
ILT0
10/2
9/1
Port 0 data direction register (DDR0)
Port 1 data direction register (DDR1)
Port 2 data direction register (DDR2)
Port 3 data direction register (DDR3)
Port 4 data direction register (DDR4)
Port 5 data direction register (DDR5)
Port 6 data direction register (DDR6)
Port 7 data direction register (DDR7)
Port 8 data direction register (DDR8)
Port 9 data direction register (DDR9)
Port A data direction register (DDRA)
Port 0 Pull-up control register (PUCR0)
Port 1 Pull-up control register (PUCR1)
Port 2 Pull-up control register (PUCR2)
Port 3 Pull-up control register (PUCR3)
8/0
ADE8
Port 5 Analog data input enabling register (ADER5)
ADE0
Port 6 Analog data input enabling register (ADER6)
ADE23 ADE22 ADE21 ADE20 ADE19 ADE18 ADE17 ADE16
15/7
Port 0 data register (PDR0)
Port 1 data register (PDR1)
Port 2 data register (PDR2)
Port 3 data register (PDR3)
Port 4 data register (PDR4)
Port 5 data register (PDR5)
Port 6 data register (PDR6)
Port 7 data register (PDR7)
Port 8 data register (PDR8)
Port 9 data register (PDR9)
Port A data register (PDRA)
Port 7 Analog data input enabling register (ADER7)
8/0
IL2
IL1
IL0
ILA
IL9
IL8
Input level selection register (ILSR0)
Input level selection register (ILSR1)
FUJITSU SEMICONDUCTOR LIMITED
201
CHAPTER 10 I/O PORTS
10.2 Register List for I/O Ports
10.2.1
MB90340E Series
Port Data Register (PDR0 to PDRA)
The reading and writing of I/O port operate differently from those of memory, as
described below.
• Input mode
When reading : Corresponding pin labels will be read.
When writing : Written to the latch for output.
• Output mode
When reading : The value of data register latch will be read.
When writing : Written to the latch for output, and output to the corresponding pin.
Figure 10.2-2 shows the details of bit configuration for the port data register (PDR).
■ Port Data Register (PDR)
Figure 10.2-2 Port Data Register (PDR)
bit
PDR0
Address: 000000H
7
6
5
4
3
2
1
0
Initial value
Access
P07
P06
P05
P04
P03
P02
P01
P00
XXXXXXXXB
R/W
6
5
4
3
2
1
0
P16
P15
P14
P13
P12
P11
P10
XXXXXXXXB
R/W
XXXXXXXXB
R/W
XXXXXXXXB
R/W
XXXXXXXXB
R/W
XXXXXXXXB
R/W
XXXXXXXXB
R/W
XXXXXXXXB
R/W
XXXXXXXXB
R/W
XXXXXXXXB
R/W
XXXXXXXXB
R/W
7
bit
PDR1
P17
Address: 000001H
bit
7
PDR2
P27
Address: 000002H
bit
7
PDR3
P37
Address: 000003H
bit
7
PDR4
P47
Address: 000004H
bit
7
PDR5
P57
Address: 000005H
bit
7
PDR6
P67
Address: 000006H
bit
7
PDR7
P77
Address: 000007H
bit
7
PDR8
P87
Address: 000008H
7
bit
PDR9
P97
Address: 000009H
bit
PDRA
Address: 00000AH
202
7
6
5
4
3
2
1
0
P26
P25
P24
P23
P22
P21
P20
6
5
4
3
2
1
0
P36
P35
P34
P33
P32
P31
P30
6
5
4
3
2
1
0
P46
P45
P44
P43
P42
P41
P40
6
5
4
3
2
1
0
P56
P55
P54
P53
P52
P51
P50
6
5
4
3
2
1
0
P66
P65
P64
P63
P62
P61
P60
6
5
4
3
2
1
0
P76
P75
P74
P73
P72
P71
P70
6
5
4
3
2
1
0
P86
P85
P84
P83
P82
P81
P80
6
5
4
3
2
1
0
P96
P95
P94
P93
P92
P91
P90
6
5
4
3
2
1
0
PA1
PA0
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 10 I/O PORTS
10.2 Register List for I/O Ports
MB90340E Series
■ Reading of the Port Data Register
The value obtained at the time of reading the port data register (PDR) depends on the state of port data
direction register (DDR) and the state of peripheral functions connected to the pins.
The values obtained for each combination are shown in Table 10.2-1 and Table 10.2-2.
Table 10.2-1 Reading value of the port data register for port 3 to port 0
DDR value
Output state of peripheral functions
Read value
0 (input)
Enabled
Output value from peripheral functions
1 (output)
Enabled
Value of output latch (PDR)
0 (input)
Disabled
Pin state
1 (output)
Disabled
Value of output latch (PDR)
Table 10.2-2 Reading value of the port data register for port A to port 4
DDR value
Output state of peripheral functions
Read value
0 (input)
Enabled
Output value from peripheral functions
1 (output)
Enabled
Output value from peripheral functions
0 (input)
Disabled
Pin state
1 (output)
Disabled
Value of output latch (PDR)
Set the DDR of connected pin to 0 (input), when it is used as an input in peripheral functions.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
203
CHAPTER 10 I/O PORTS
10.2 Register List for I/O Ports
10.2.2
MB90340E Series
Port Data Direction Register (DDR0 to DDRA)
The port data direction register has the following functions.
• Sets the data direction for the pin used as a port.
• Sets the input level of the SIN (Serial input of LIN-UART) pin.
■ Port Data Direction Register (DDR0 to DDRA)
Figure 10.2-3 shows the details of bit configuration for the port data direction register (DDR0 to DDRA).
Figure 10.2-3 Port Data Direction Register (DDR0 to DDRA)
bit
DDR0
Address: 000010H
7
6
5
4
3
2
1
0
D07
D06
D05
D04
D03
D02
D01
D00
bit 7
DDR1
D17
Address: 000011H
bit
7
DDR2
D27
Address: 000012H
bit 7
DDR3
D37
Address: 000013H
bit 7
DDR4
D47
Address: 000014H
bit 7
DDR5
D57
Address: 000015H
bit 7
DDR6
D67
Address: 000016H
bit 7
DDR7
D77
Address: 000017H
bit 7
DDR8
D87
Address: 000018H
bit 7
DDR9
D97
Address: 000019H
6
5
4
3
2
1
0
D16
D15
D14
D13
D12
D11
D10
6
5
4
3
2
1
0
D26
D25
D24
D23
D22
D21
D20
6
5
4
3
2
1
0
D36
D35
D34
D33
D32
D31
D30
6
5
4
3
2
1
0
D46
D45
D44
D43
D42
D41
D40
6
5
4
3
2
1
0
D56
D55
D54
D53
D52
D51
D50
6
5
4
3
2
1
0
D66
D65
D64
D63
D62
D61
D60
6
5
4
3
2
1
0
D76
D75
D74
D73
D72
D71
D70
6
5
4
3
2
1
0
D86
D85
D84
D83
D82
D81
D80
6
5
4
3
2
1
0
D96
D95
D94
D93
D92
D91
D90
bit 7
6
5
4
3
DDRA
SIL4 SIL3 SIL2 SIL1 SIL0
Address: 00001AH
W
W
W
W
W
2
1
0
DA1
DA0
R/W
R/W
Initial value
Access
00000000B
R/W
00000000B
R/W
00000000B
R/W
00000000B
R/W
00000000B
R/W
00000000B
R/W
00000000B
R/W
00000000B
R/W
00000000B
R/W
00000000B
R/W
00000100B
R/W
[bit7 to bit0] D00 to D97: DDR0 to DDR9
[bit1, bit0] DA0 to DA1: DDRA
These bits set the input and output directions for ports. If pins are used as ports, the corresponding pins are
controlled in the manner as follows.
When set to "0": Sets the corresponding pins to input mode.
When set to "1": Sets the corresponding pins to output mode.
204
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 10 I/O PORTS
10.2 Register List for I/O Ports
MB90340E Series
[bit7 to bit3] SIL4 to SIL0:DDRA (bit7 to bit3)
These bits forcefully set the input level of the SIN (Serial input of LIN-UART) pin. SIL0 to SIL4
correspond to SIN0 (LIN-UART0) to SIN4 (LIN-UART4), respectively.
When set to "0": The ILTx bit settings and the ILx bit to which ILSR corresponds will select CMOS,
automotive, or TTL for the input level.
See Section "10.2.5 Input Level Selection Register (ILSR0, ILSR1)" for details of
ILSR.
When set to "1": CMOS will be selected for the input level, independently of the ILx bit and its setting
corresponding to ILSR.
The initial value for these bits is "0".
Table 10.2-3 SIN0/SIN1 Input Level Settings
DDRA
ILSR1
SIL0/SIL1 bit
IL8 bit
0
0
Automotive level
0
1
CMOS level
1
x
CMOS level
SIN0(P82) / SIN1(P85) input level
Table 10.2-4 SIN2 Input Level Settings
DDRA
ILSR0
SIL2 bit
IL5 bit
0
0
Automotive level
0
1
CMOS level
1
x
CMOS level
SIN2(P50) input level
Table 10.2-5 SIN3/SIN4 Input Level Settings
DDRA
ILSR
SIN3(P12) / SIN4(P15) input level
Note:
CM44-10143-5E
SIL3/SIL4 bit
ILT1 bit
IL1 bit
0
0
0
Automotive level
0
0
1
CMOS level
0
1
x
TTL level
1
x
x
CMOS level
SIL0 to SIL4 bits are for writing only. When these bits are read, "1" is consistently read. Therefore,
do not use instructions such as INC/DEC instruction that perform read-modify-write (RMW) to
DDRA registers.
FUJITSU SEMICONDUCTOR LIMITED
205
CHAPTER 10 I/O PORTS
10.2 Register List for I/O Ports
MB90340E Series
[bit2] DDRA: Undefined
"1" is consistently read from this bit.
Writing to this bit does not have any effect.
206
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 10 I/O PORTS
10.2 Register List for I/O Ports
MB90340E Series
10.2.3
Pull-up Control Register (PUCR0 to PUCR3)
Each pin for port 0 to 3 has a programmable pull-up resistor. Each bit of this register
will control whether the corresponding pull-up resistor is used or not used.
Figure 10.2-4 shows the bit configuration for the pull-up control register (PUCR0 to
PUCR3), and Figure 10.2-5 shows the block diagram for it.
■ Pull-up Control Register (PUCR0 to PUCR3)
Figure 10.2-4 Bit Configuration for the Pull-up Control Register (PUCR0 to PUCR3)
bit
Address: 00001CH
7
6
5
4
3
2
1
0
PU07
PU06
PU05
PU04
PU03
PU02
PU01
PU00
R/W
0
R/W
0
R/W
0
R/W
0
R/W
0
R/W
0
R/W
0
R/W
0
Read/Write
Initial value
bit
Address: 00001DH
15
14
13
12
11
10
9
8
PU17
PU16
PU15
PU14
PU13
PU12
PU11
PU10
R/W
0
R/W
0
R/W
0
R/W
0
R/W
0
R/W
0
R/W
0
R/W
0
Read/Write
Initial value
bit
Address: 00001EH
Read/Write
Initial value
7
6
5
4
3
2
1
0
PU27
PU26
PU25
PU24
PU23
PU22
PU21
PU20
R/W
0
R/W
0
R/W
0
R/W
0
R/W
0
R/W
0
R/W
0
R/W
0
bit
Address: 00001FH
Read/Write
Initial value
15
14
13
12
11
10
9
8
PU37
PU36
PU35
PU34
PU33
PU32
PU31
PU30
R/W
0
R/W
0
R/W
0
R/W
0
R/W
0
R/W
0
R/W
0
R/W
0
PUCR0
PUCR1
PUCR2
PUCR3
R/W: Readable/writable
■ Block Diagram for the Pull-up Control Register (PUCR0 to PUCR3)
Figure 10.2-5 Block Diagram for the Pull-up Control Register (PUCR0 to PUCR3)
Data register
Pull-up resistor (about 50 kΩ)
P-ch
Port input/output
Direction register
Pull-up control register
Internal data bus
Controls the pull-up resistor during input mode.
When set to "0": No pull-up resistor during input mode.
When set to "1": Pull-up resistor during input mode.
Note:
This is not applied for the output mode (no pull-up resistor).
The port data direction register (DDR) determines the I/O mode.
When in the stop mode (SPL=1), no pull-up resistor (High impedance).
If a port is used as an external bus, this function is disabled, and no data will be written to the
register.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
207
CHAPTER 10 I/O PORTS
10.2 Register List for I/O Ports
MB90340E Series
Analog Data Input Enabling Register (ADER5 to ADER7)
10.2.4
Figure 10.2-6 shows the bit configuration of the analog data input enabling register
(ADER5 to ADER7).
■ Analog Data Input Enabling Register (ADER5 to ADER7)
Figure 10.2-6 Bit Configuration for the Analog Data Input Enabling Register (ADER5 to ADER7)
ADER7
bit
Address: 00000DH
ADER6
bit
Address: 00000CH
ADER5
bit
Address: 00000BH
15
14
13
12
11
10
9
8
ADE23 ADE22 ADE21 ADE20 ADE19 ADE18 ADE17 ADE16
7
6
5
4
3
2
1
0
ADE7
ADE6
ADE5
ADE4
ADE3
ADE2
ADE1
ADE0
15
14
13
12
11
10
9
8
ADE9
ADE8
ADE15 ADE14 ADE13 ADE12 ADE11 ADE10
Initial value
Access
11111111B
R/W
11111111B
R/W
11111111B
R/W
R/W: Readable/writable
Each bit for ADER5 to ADER7 enables and disables the analog input for the pins of Port 7 to Port 5.
ADER5 to ADER7 correspond to Port 7 to Port 5, respectively.
When set to "0": Analog input will be disabled at the corresponding pin. The pins with disabled analog
input can be used as an I/O pin for I/O ports and peripheral functions other than an A/D
converter.
When set to "1": Sets the corresponding pins to the analog input mode. The pin set to the analog input
mode will be a dedicated pin for analog input of an A/D converter. It cannot be used as
an I/O pin for I/O ports and other peripheral functions.
Note:
If "1" is set to the analog data input enabling bit (ADE23 to ADE0), each pin of Port 7 to Port5 will
become an analog input pin for an A/D converter. Because the initial value of ADEx bit is 1, each pin
of Port 7 to 5 cannot be used as an I/O port or an I/O pin of peripheral functions other than an A/D
converter, if it is in the initial state. To use it as an I/O port or an I/O pin for other peripheral devices,
set the ADEx bit to "0".
208
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 10 I/O PORTS
10.2 Register List for I/O Ports
MB90340E Series
10.2.5
Input Level Selection Register (ILSR0, ILSR1)
The input level selection register allows to change the setting from the automotive
hysteresis input level to the CMOS hysteresis input level or to the TTL input level.
■ Input Level Selection Register (ILSR0, ILSR1)
Figure 10.2-7 Bit Configuration of the Input Level Selection Register (ILSR0, ILSR1)
Address
bit 15
14
13
12
ILSR1: 00000FH
ILSR0: 00000EH ILT3 ILT2 ILT1 ILT0
Read/Write: R/W R/W R/W R/W
Initial value: 0/1 0/1 0/1 0/1
11
10
9
8
7
6
5
4
3
2
1
0
-
ILA
IL9
IL8
IL7
IL6
IL5
IL4
IL3
IL2
IL1
IL0
-
R/W R/W R/W
R/W R/W R/W R/W R/W R/W R/W R/W
0
0/1
0/1
0/1
0/1
0/1
0/1
0/1
0/1
0/1
0/1
0/1
R/W : Readable/writable
— : Undefined
[bit10 to bit0] ILA to IL0
These bits specify the input level of corresponding ports.
IL0 to ILA correspond to Port 0 to Port A, respectively.
When set to "0": Automotive input level.
When set to "1": CMOS input level.
The initial values for these bits depend on the settings of operation mode (mode pin).
• Flash memory mode - Initial value "1" (CMOS input)
• Other modes - Initial value "0" (Automotive)
[bit11] Undefined
"0" is consistently read from this bit. Writing has no effect.
[bit15 to bit12] ILT3 to ILT0
These bits specify the input level of corresponding ports to either TTL or CMOS/Automotive. ILT0 to
ILT3 bits correspond to Port 0 to Port 3, respectively.
When set to "0": The IL0 to ILA bits specify the input level of corresponding ports to either CMOS input
level or automotive input level.
When set to "1": Sets to TTL input level, independently of the settings in IL0 to ILA bits.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
209
CHAPTER 10 I/O PORTS
10.2 Register List for I/O Ports
MB90340E Series
■ Initial Value of Input Level Selection Register (ILSR0, ILSR1)
The initial values for the bits in ILSR0 and ILSR1 registers depend on the state of pin MD2, MD1, and
MD0 after the external reset input is canceled, as shown the table below.
See "CHAPTER 9 MEMORY ACCESS MODE" for details about the operation modes.
Table 10.2-6Relationship between the Mode Pins and the Input Level Selection Register (ILSR0, ILSR1)
Initial Values
Initial value
MD2
MD1
MD0
Operation modes
Port input level
ILT0 to
ILT3
IL0 to
ILA
Port 0 to Port 3
Port 4 to Port A
0
0
0
External vector mode 0
1
0
TTL
Automotive
0
0
1
External vector mode 1
1
0
TTL
Automotive
0
1
0
0
1
1
Automotive
Automotive
1
0
0
1
0
1
1
1
0
Flash serial writing
0
0
Automotive
Automotive
1
1
1
Flash memory
0
1
CMOS
CMOS
Reserved
Internal vector mode
0
0
Reserved
210
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 11
TIME-BASE TIMER
This chapter explains the function and operation of the
time-base timer.
11.1 Overview of the Time-base Timer
11.2 Block Diagram of the Time-base Timer
11.3 Configuration of the Time-base Timer
11.4 Interrupt of the Time-base Timer
11.5 Operating Explanation of the Time-base Timer
11.6 Notes on Using the Time-base Timer
11.7 Programming Example of the Time-base Timer
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
211
CHAPTER 11 TIME-BASE TIMER
11.1 Overview of the Time-base Timer
11.1
MB90340E Series
Overview of the Time-base Timer
The time-base timer is an 18-bit free-run counter (time-base timer counter) that counts
up in synchronization with the main clock (divide-by-two of the main oscillation clock).
• Provides four different types of interval time and can generate interrupt requests for
each interval time.
• Provides operating clock to the oscillation stabilization wait time timer or peripheral
functions.
■ Interval Timer Function
• When the counter of the time-base timer reaches the interval time set at the interval time selection bits
(TBTC:TBC1, TBC0), an overflow (carry) occurs (TBTC: TBOF=1), resulting in an interrupt request.
• If an interrupt caused by an overflow is allowed (TBTC: TBIE=1), an overflow (TBTC: TBOF=1)
triggers an interrupt.
• The interval time for the time-base timer can be selected from the following four types. Table 11.1-1
shows the interval time for the time-base timer.
Table 11.1-1 Interval Time for the Time-base Timer
Count clock
Interval time
212/HCLK (about 1.0 ms)
2/HCLK (0.5 μs)
214/HCLK (about 4.1 ms)
216/HCLK (about 16.4 ms)
219/HCLK (about 131.1 ms)
HCLK: Oscillation clock
The time in parenthesis applies when the oscillation clock operates at 4 MHz.
212
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 11 TIME-BASE TIMER
11.1 Overview of the Time-base Timer
MB90340E Series
■ Clock Provision
• Provides operating clock to the oscillation stabilization wait time timer and peripheral functions
including the PPG timer or watchdog timer. Table 11.1-2 shows the clock cycles provided to the each
peripheral from the time-base timer.
Table 11.1-2 Clock Cycles Provided from the Time-base Timer
Clocking provided to
Clock cycle
210/HCLK (about 256 μs)
213/HCLK (about 2.0 ms)
Oscillation stabilization wait time*
215/HCLK (about 8.2 ms)
217/HCLK (about 32.8 ms)
212/HCLK (about 1.0 ms)
214/HCLK (about 4.1 ms)
Watchdog timer
216/HCLK (about 16.4 ms)
219/HCLK (about 131.1 ms)
PPG timer
29/HCLK (about 128 μs)
HCLK: Oscillation clock
The time in parenthesis applies when the oscillation clock operates at 4 MHz.
*: The oscillation stabilization wait time is an estimated time because the oscillation cycle is unstable right after
starting oscillating.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
213
CHAPTER 11 TIME-BASE TIMER
11.2 Block Diagram of the Time-base Timer
11.2
MB90340E Series
Block Diagram of the Time-base Timer
The time-base timer consists of the following blocks.
• Time-base timer counter
• Counter clearing circuit
• Interval timer selector
• Time-base timer control register (TBTC)
■ Block Diagram of the Time-base Timer
Figure 11.2-1 Block Diagram of the Time-base Timer
To watchdog
timer
To PPG timer
Time-base timer counter
21/HCLK
× 21 × 22 × 23
⋅⋅⋅ ⋅⋅⋅
× 28 × 29 × 210 × 211 × 212 × 213 × 214 × 215 × 216 × 217 × 218
OF
OF
OF
OF
Power-on reset
Stop mode
CKSCR : MCS=1→0*1
CKSCR : SCS=0→1*2
To clock control part
oscillation
stabilization wait time
selector
Counter
clearing
circuit
Interval timer
selector
TBOF cleared
Time-base timer control register
(TBTC)
Reserved
⎯
TBOF set
⎯ TBIE TBOF TBR TBC1 TBC0
Time-base timer interrupt signal
OF
HCLK
*1
*2
: Overflow
: Oscillation clock
: Switches the machine clock from main clock to PLL clock
: Switches the machine clock from sub clock to main clock
The actual interrupt request number of the time-base timer is as follows.
Interrupt request number: #25 (19H)
214
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 11 TIME-BASE TIMER
11.2 Block Diagram of the Time-base Timer
MB90340E Series
● Time-base timer counter
An 18-bit up counter that uses the divide-by-two clock of the oscillation clock (HCLK) as count clock.
● Counter clearing circuit
The value of the time-base timer counter will be cleared due to the following sources.
• The time-base timer counter clearing bit of the time-base timer control register (TBTC: TBR=0)
• Power-on reset
• Transition to the main stop mode or PLL stop mode (CKSCR:SCS=1, LPMCR: STP=1)
• Switching of clock modes (from the main clock mode to the PLL clock mode, from the sub clock mode
to the PLL clock mode, or from the sub clock mode to the main clock mode)
● Interval timer selector
Selects the time-base timer counter output from the four different types. When an overflow (carry) occurs
at the bit of the selected interval time due to a count up, an interrupt request is generated.
● Time-base timer control register (TBTC)
Selects the interval time, clears the time-base timer counter, allows/prohibits an interrupt, and checks the
state of an interrupt request and clears it.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
215
CHAPTER 11 TIME-BASE TIMER
11.3 Configuration of the Time-base Timer
11.3
MB90340E Series
Configuration of the Time-base Timer
Explains the time-base timer register and interrupt sources.
■ List of the Time-base Timer Register and Its Initial Value
Figure 11.3-1 List of the Time-base Timer Register and Its Initial Value
bit
Time-base timer control register
(TBTC)
15
14
13
12
11
10
9
8
1
×
×
0
0
1
0
0
× : Undefined
■ Generation of an Interrupt Request in the Time-base Timer
When the counter bit for the selected interval timer reaches the interval time, the time-base timer sets "1" in
the overflow interrupt request flag bit in the time-base timer control register (TBTC:TBOF). When the
overflow interrupt request flag bit is set (TBTC: TBOF=1) while an interrupt is allowed (TBTC: TBIE=1),
an interrupt request is generated.
216
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 11 TIME-BASE TIMER
11.3 Configuration of the Time-base Timer
MB90340E Series
11.3.1
Time-base Timer Control Register (TBTC)
Time-base timer control register (TBTC) allows the following settings.
• Selecting the interval time for the time-base timer
• Clearing the counter value for the time-base timer
• Allowing and prohibiting an interrupt request due to an overflow
• Checking the state of and clearing the interrupt request flag due to an overflow
■ Time-base Timer Control Register (TBTC)
Figure 11.3-2 Time-base Timer Control Register (TBTC)
bit
Address
0000A9H
15
14
13
12
11
10
9
8
Initial value
Reserved
TBIE TBOF TBR TBC1 TBC0
R/W
R/W R/W W R/W R/W
1XX00100 B
bit9
bit8
TBC1 TBC0
Interval time selection bits
0
0
212/HCLK (about 1.0 ms)
0
1
214/HCLK (about 4.1 ms)
1
0
216/HCLK (about 16.4 ms)
1
1
219/HCLK (about 131.1 ms)
HCLK: Oscillation clock
The time in parenthesis applies when the oscillation clock operates at
4 MHz.
bit10
TBR
0
Time-base timer counter clearing bit
Reading
Writing
Clears time-base timer counter
Clears TBOF the bit
"1" is always read
1
No effect
bit11
TBOF
Overflow interrupt request flag bit
Reading
Writing
0
No overflow at the selected
Cleared
counter bit
1
Overflow at the selected
counter bit
No effect
bit12
TBIE
Overflow interrupt enable bit
0
Overflow interrupt request prohibited
1
Overflow interrupt request allowed
bit15
Reserved bit
Reserved
R/W : Readable/Writable
: Write only
W
: Undefined
X
: Initial value
: Undefined
CM44-10143-5E
1
Always set to "1".
FUJITSU SEMICONDUCTOR LIMITED
217
CHAPTER 11 TIME-BASE TIMER
11.3 Configuration of the Time-base Timer
MB90340E Series
Table 11.3-1 Functions of the Time-base Timer Control Register (TBTC)
Bit name
bit15
Reserved: Reserved bit
Always set to "1".
bit14,
bit13
Undefined bits
When reading : The value is undefined.
When writing : No effect.
TBIE:
Overflow interrupt
enable bit
Enables or prohibits an interrupt caused by the overflow at the interval timer
bit in the time-base timer counter.
When set to "0": An interrupt request is not generated even when an
overflow occurs (TBOF = 1).
When set to "1": An interrupt request is generated when an overflow occurs
(TBOF = 1).
bit11
TBOF:
Overflow interrupt
request flag bits
Shows an overflow (carry) at the interval timer bit in the time-base timer
counter.
When an overflow (carry) occurs (TBOF=1) while an interrupt is allowed
(TBIE=1), an interrupt request is generated.
When set to "0" : Cleared.
When set to "1" : Invalid. No change.
When read with a
read-modify-write
instruction
:"1" is read.
Notes:
1) In the case of clearing the TBOF bit, be sure to prohibit an interrupt
(TBIE=0) or mask an interrupt in the interrupt mask register (ILM) of
processor status before clearing it.
2) The TBOF bit is cleared in the case of writing of "0", transition to the
main stop mode, transition to the PLL stop mode, transition from the
sub clock mode to the main clock mode, transition from the sub clock
mode to the PLL clock mode, transition from the main clock mode to
the PLL clock mode, writing of "0" into the time-base timer counter
clearing bit (TBR), and reset.
bit10
TBR:
Time-base timer counter
clearing bit
Clears all bits in the time-base timer counter.
When set to "0": Clears all bits in the time-base timer counter to "0". The
TBOF bit is also cleared.
When set to "1": Invalid. No change.
When reading : "1" is always read.
bit9,
bit8
TBC1, TBC0:
Interval time selection
bits
bit12
218
Function
Sets a cycle for the interval timer in the time-base timer counter.
• The setting in the TBC1 and TBC0 bits configures the interval
time for the time-base timer.
• Four different types of interval time are selectable.
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
MB90340E Series
11.4
Interrupt of the Time-base Timer
CHAPTER 11 TIME-BASE TIMER
11.4 Interrupt of the Time-base Timer
Carrying (overflowing) the interval time bit in the time-base timer counter
corresponding to the interval time configured in the time-base timer control register
causes the time-base timer to generate an interrupt request (interval timer function).
■ Interrupt of the Time-base Timer
• The time-base timer continues to count up while the main clock (divide-by-two of the oscillation clock)
is input.
• As soon as the interval time configured at the TBC1 and TBC0 bits in the time-base timer control
register has been reached, the interval time selection bit corresponding to the interval time selected in
the time-base timer counter is carried to generate an overflow.
• When an overflow is generated at the interval time selection bit, the overflow interrupt request flag bit
in the time-base timer control register (TBTC: TBOF) is set to "1".
• When the overflow interrupt request flag bit in the time-base timer control register is set (TBTC:
TBOF=1) while an interrupt is allowed (TBTC: TBIE=1), an interrupt request is generated.
• The overflow interrupt request flag bit in the time-base timer control register (TBTC: TBOF) will be set
when the configured interval time is reached, regardless of whether an interrupt is allowed or prohibited
(TBTC: TBIE).
• To clear the overflow interrupt request flag bit (TBTC: TBOF), prohibit the interrupt by the time-base
timer in interrupt handling (TBTC: TBIE=0) or mask the interrupt by the time-base timer using the ILM
bit in the processor status (PS), and then write "0" into the TBOF bit to clear.
Note:
When an interrupt is allowed (TBTC: TBIE=1) while the overflow interrupt request flag bit in the timebase timer control register is set (TBTC: TBOF=1), an interrupt request will be generated
immediately.
■ Interrupt of Time-base Timer and Support for EI2OS/DMA Transfer
• The time-base timer does not support the extended intelligent I/O service (EI2OS) and DMA transfer.
• For interrupt numbers, the interrupt control register, and interrupt vector addresses, see Section "3.2
Interrupt Vector".
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
219
CHAPTER 11 TIME-BASE TIMER
11.5 Operating Explanation of the Time-base Timer
11.5
MB90340E Series
Operating Explanation of the Time-base Timer
The time-base timer operates as an interval timer or oscillation stabilization wait time
timer. It also provides operating clock to peripheral functions.
■ Interval Timer Function
When an interrupt is generated for each interval time, it can be used as an interval timer.
To operate the time-base timer as an interval timer, the setting in Figure 11.5-1 is necessary.
● Setting of the time-base timer
Figure 11.5-1 Setting of the Time-base Timer
Time-base timer control register
(TBTC)
bit15 14
Reserved
1
13
12
11
10
9
8
TBIE TBOF TBR TBC1TBC0
0
0
: Undefined bit
: Used bit
0 : Set to "0"
1 : Set to "1"
● Interval timer function operation
The time-base timer can be used as an interval timer by generating an interrupt for each set interval time.
• The time-base timer continues to count up synchronizing to the main clock (divide-by-two of the
oscillation clock), as long as the oscillation clock is working.
• When the interval time configured at the interval time selection bits in the time-base timer control
register (TBTC:TBC1, TBC0) has been reached, an overflow carrying occurs in the time-base timer
counter, resulting in setting "1" in the overflow interrupt request flag bit (TBTC: TBOF).
• An overflow interrupt request flag bit is set (TBTC: TBOF=1) while an interrupt is allowed (TBTC:
TBIE=1), an interrupt request is generated.
Note:
An interval time can be longer than the configured interval time due to the clearing operation by the
time-base timer counter.
220
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 11 TIME-BASE TIMER
11.5 Operating Explanation of the Time-base Timer
MB90340E Series
● Operating example of the time-base timer
Interval timer operations in the following states are shown in Figure 11.5-2.
• When a power-on reset occurs
• When transiting to the sleep mode while the interval timer function is operating
• When transiting to the stop mode while the interval timer function is operating
• When time-base timer counter clearing is requested
When transiting to the stop mode, the time-base timer counter is cleared and count-up operation terminates.
When returning from the stop mode, the time-base timer starts counting the main clock oscillation
stabilization wait time.
Figure 11.5-2 Operating Example of the Time-base Timer
Counter value
Cleared due to transition to
the stop mode
3FFFFH
Oscillation stabilization wait overflow
00000H
CPU operation
Interval period
starts
(TBTC: TBC1, TBC0 = 11B)
Power-on reset
Counter cleared
(TBTC: TBR = 0)
Cleared due to interrupt
TBOF bit
TBIE bit
Sleep
SLP bit
(LPMCR register)
Sleep canceled due to interrupt by
time-base timer interval
Stop
STP bit
(LPMCR register)
When 11B is set at the interval time selection bits (TBTC: TBC1, TBC0) (219/HCLK)
: Oscillation stabilization wait time
HCLK : Oscillation clock
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
221
CHAPTER 11 TIME-BASE TIMER
11.5 Operating Explanation of the Time-base Timer
MB90340E Series
■ Operation of Oscillation Stabilization Wait Time Timer
The time-base timer can be used as an oscillation stabilization wait time timer for the main clock and PLL
clock.
• The oscillation stabilization wait time is a time period from when the time-base timer counter starts
counting up from "0" to when the configured oscillation stabilization wait time selection bit is
overflowed (carried).
Table 11.5-1 shows time-base timer clearing conditions and oscillation stabilization wait time.
Table 11.5-1 Time-base Timer Clearing Conditions and Oscillation Stabilization Wait Time (1 / 2)
Counter
cleared
TBOF
cleared
❍
❍
Power-on reset
❍
❍
After the main clock oscillation stabilization wait
time is terminated, switches to the main clock
mode
Watchdog reset
×
❍
None
External reset
×
❍
None
Software reset
×
❍
None
Main clock to PLL clock
(CKSCR: MCS=1 to 0)
❍
❍
After the PLL clock oscillation stabilization wait
time is terminated, switches to the PLL clock
mode
Main clock to sub clock
(CKSCR: SCS=1 to 0)
×
×
After the sub clock oscillation stabilization wait
time is terminated, switches to the sub clock mode
Sub clock to main clock
(CKSCR: SCS=0 to 1)
❍
❍
After the main clock oscillation stabilization wait
time is terminated, switches to the main clock
mode
Sub clock to PLL clock
(CKSCR: MCS=0, SCS=0 to 1)
❍
❍
After the main clock oscillation stabilization wait
time is terminated, switches to the PLL clock
mode
PLL clock to main clock
(CKSCR: MCS=0 to 1)
×
×
None
PLL clock to sub clock
(CKSCR: MCS=0, SCS=1 to 0)
×
×
None
Operation
Writing "0" in the time-base timer
counter clearing bit (TBTC: TBR)
Oscillation stabilization wait time
Reset
Clock mode switch
222
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 11 TIME-BASE TIMER
11.5 Operating Explanation of the Time-base Timer
MB90340E Series
Table 11.5-1 Time-base Timer Clearing Conditions and Oscillation Stabilization Wait Time (2 / 2)
Counter
cleared
TBOF
cleared
Oscillation stabilization wait time
Canceling the main stop mode
❍
❍
After the main clock oscillation stabilization wait
time is terminated, switches to the PLL clock
mode
Canceling the PLL stop mode
❍
❍
After the main clock oscillation stabilization wait
time is terminated, switches to the PLL clock
mode
Canceling the sub stop mode
×
×
After the sub clock oscillation stabilization wait
time is terminated, switches to the sub clock mode
×
×
None
Returning to the main clock mode
×
×
None
Returning to the sub clock mode
×
×
None
Returning to the PLL clock mode
×
×
None
Canceling the main sleep mode
×
×
None
Canceling the sub sleep mode
×
×
None
Canceling the PLL sleep mode
×
×
None
Operation
Cancellation of stop modes
Cancellation of watch modes
Canceling the sub watch mode
Cancellation of time-base timer modes
Cancellation of sleep modes
■ Operating Clock Provision
The time-base timer provides operating clock to the PPG timer and watchdog timer.
Note:
Take notice that clearing the time-base timer counter affects the operation of peripheral functions
such as watchdog timer or PPG timer that uses the time-base timer output.
Reference:
• See "CHAPTER 16 8/16-BIT PPG TIMER" for details on the PPG timer.
• See "CHAPTER 12 WATCHDOG TIMER" for details on the watchdog timer.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
223
CHAPTER 11 TIME-BASE TIMER
11.6 Notes on Using the Time-base Timer
11.6
MB90340E Series
Notes on Using the Time-base Timer
This section shows some notes on using the time-base timer.
■ Notes on Using the Time-base Timer
● When clearing an interrupt request
To clear the overflow interrupt request flag bit of the time-base timer control register (TBTC: TBOF=0),
prohibit the interrupt (TBTC: TBIE=0) or mask the interrupt by the time-base timer using the interrupt
level mask (ILM) in the processor status.
● When clearing the time-base timer counter
Take notice that clearing the time-base timer counter affects the following operations.
• The time-base timer is used as an interval timer (interval interrupt)
• The watchdog timer is in use
• The time-base timer provides operating clock of the PPG timer
● When using as an oscillation stabilization wait time timer
• The oscillation clock is not operating after power is turned on or in main stop, PLL stop, and sub clock
modes. Therefore, when oscillation starts, the time-base timer provides main clock oscillation
stabilization wait time. Depending on the type of oscillator connected to the high-speed oscillator input
pins, suitable oscillation stabilization wait time needs to be specified.
Reference:
See Section "6.6 Oscillation Stabilization Wait Time" for details on the oscillation stabilization wait
time.
● Peripheral functions to which the time-base timer provides clock
• When transiting to the operation mode where the oscillation clock pauses (the PLL stop mode, sub clock
mode, and main clock mode), the time-base timer counter is cleared and the time-base timer stops
operating.
• When the time-base timer counter is cleared, an interval time from the point of clearance is needed.
Therefore, "L" level becomes longer by 1/2 period or "H" level becomes shorter in clock provided by
the time-base timer.
• In the case of watchdog timer, the watchdog timer counter normally counts because it is cleared
concurrently with the time-base timer counter.
224
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 11 TIME-BASE TIMER
11.7 Programming Example of the Time-base Timer
MB90340E Series
11.7
Programming Example of the Time-base Timer
This section shows programming examples of the time-base timer.
■ Programming Example of the Time-base Timer
● Processing
Repeatedly generates interval interrupts at 212/HCLK (HCLK: oscillation clock). The interval time is
approximately 1.0 ms (when operating at 4 MHz).
● Coding example
ICR07
EQU
0000B7H
;Time-base timer interrupt control
;register
TBTC
EQU
0000A9H
;Time-base timer control register
TBOF
EQU
TBTC:3
;Interrupt request flag bit
TBIE
EQU
TBTC:2
;Interrupt allowance bit
;-------Main program------------------------------------CODE
CSEG
START:
;Data such as stack pointer (SP) are
;supposed to be initialized
AND
CCR,#0BFH
;Interrupt prohibited
MOV
I:ICR07 #00H
;Interrupt level 0 (highest)
MOV
I:TBTC,#10000000B
;Upper three bits are fixed
;TBOF cleared,
;Counter clearing interval time
;212/HCLK selected
;Interrupt allowed
;ILM in PS set to level seven
;Interrupt allowed
;Infinite loop
SETB
I:TBIE
MOV
ILM,#07H
OR
CCR,#40H
LOOP:
MOV
A,#00H
MOV
A,#01H
BRA
LOOP
;-------Interrupt program-------------------------------WARI:
CLRB
I:TBIE
;Interrupt allowance bit cleared
CLRB
I:TBOF
;Interrupt request flag cleared
•
User process
•
SETB
I:TBIE
;Interrupt allowed
RETI
;Returned from interrupt process
CODE
ENDS
;-------Vector setting-----------------------------------
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
225
CHAPTER 11 TIME-BASE TIMER
11.7 Programming Example of the Time-base Timer
VECT
VECT
226
CSEG
ORG
ABS=0FFH
0FF98H
DSL
ORG
DSL
DB
ENDS
END
WARI
0FFDCH
START
00H
MB90340E Series
;Setting a vector for interrupt number
;#25 (19H)
;Reset vector set
;Setting to the single chip mode
START
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 12
WATCHDOG TIMER
This chapter explains the function and operation of the
watchdog timer.
12.1 Overview of the Watchdog Timer
12.2 Configuration of the Watchdog Timer
12.3 Register of the Watchdog Timer
12.4 Operating Explanation of the Watchdog Timer
12.5 Notes on Using the Watchdog Timer
12.6 Programming Example of the Watchdog Timer
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
227
CHAPTER 12 WATCHDOG TIMER
12.1 Overview of the Watchdog Timer
12.1
MB90340E Series
Overview of the Watchdog Timer
The watchdog timer is a 2-bit counter that uses the time-base timer or the watch timer
as count clock. If the counter is not cleared within an interval time, the CPU will be
reset.
■ Watchdog Timer Function
• The watchdog timer is a timer counter that prevents program hang-ups. Once the watchdog timer
activates, the watchdog timer counter shall be continuously cleared to stay within the configured interval
time. As soon as the watchdog timer counter reaches the interval time without being cleared, the CPU
will be reset. This is referred to as a watchdog timer.
• The interval time of the watchdog timer is based on the clock cycle input as count clock, and a
watchdog reset occurs between the minimum time and maximum time.
• The clock source output destination is set with the watchdog clock selection bit in the watch timer
control register (WTC: WDCS).
• The interval time of the watchdog timer is set with the time-base timer output selection bit and watch
timer output selection bit (WDTC: WT1, WT0) in the watchdog timer control register.
Table 12.1-1 shows the interval time for the watchdog timer.
Table 12.1-1 Interval Time for the Watchdog Timer
Minimum
Maximum
Clock cycle
Minimum
Maximum
Clock cycle
About 3.58 ms
About 4.61 ms
(214 ±211)/
HCLK
About 0.457 s
About 0.576 s
(212 ±29)/
SCLK
About 14.33 ms
About 18.3 ms
(216 ±213)/
HCLK
About 3.584 s
About 4.608 s
(215 ±212)/
SCLK
About 57.23 ms
About 73.73 ms
(218 ±215)/
HCLK
About 7.168 s
About 9.216 s
(216 ±213)/
SCLK
About 458.75 ms
About 589.82 ms
(221 ±218)/
HCLK
About 14.336 s
About 18.432 s
(217 ±214)/
SCLK
HCLK: Oscillation clock (4 MHz), SCLK: Sub clock (8.192 kHz)
Notes:
• In the case where the count clock of the watchdog timer is used as a time-base timer output (carry
signal), the generation time of a watchdog reset may become longer when the time-base timer is
cleared.
• When sub clock is used as machine clock, be sure to set "0" to the watchdog timer clock source
selection bit (WDCS) in the watch timer control register (WTC) to specify the watch timer output.
228
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 12 WATCHDOG TIMER
12.2 Configuration of the Watchdog Timer
MB90340E Series
12.2
Configuration of the Watchdog Timer
The watchdog timer consists of the following blocks.
• Count clock selector
• Watchdog timer counter (2-bit counter)
• Watchdog reset generation circuit
• Counter clearing control circuit
• Watchdog timer control register (WDTC)
■ Block Diagram of the Watchdog Timer
Figure 12.2-1 Block Diagram of the Watchdog Timer
Watch timer control register (WTC)
Watchdog timer control register (WDTC)
WRST ERST SRST WTE WT1 WT0
PONR
Watchdog Timer
2
Transits to the timebase timer mode
Counter
clearing
control circuit
Count clock
selector
Transits to the watch mode
Transits to the stop mode
Reset
generated
Stop
Activate
Reset generated
Transits to the sleep mode
WDCS
2-bit
counter
Watchdog reset
generation
circuit
Internal reset
generation
circuit
Clear
4
4
(Time-base timer counter)
Main clock
(divide-by-two of
HCLK)
× 21 × 22
⋅⋅⋅
× 28 × 29 × 210 × 211 × 212 × 213 × 214 × 215 × 216 × 217 × 218
(Watch counter)
Sub clock
SCLK*
× 21 × 22
⋅⋅⋅
× 25 × 26 × 27 × 28 × 29 × 210 × 211 × 212 × 213 × 214 × 215
HCLK: Oscillation clock
SCLK: Sub clock
*: SCLK will be divide-by-two or divide-by-four of the clock being input in low speed oscillator pins X0A and X1A.
The division ratio will be set at the SCDS bit of PLL/Sub clock control register (PSCCR).
(See "CHAPTER 6 CLOCK")
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
229
CHAPTER 12 WATCHDOG TIMER
12.2 Configuration of the Watchdog Timer
MB90340E Series
● Count clock selector
Specify the time-base timer or the watch timer as count clock to be input to the watchdog timer. Four
different types of interval time are selectable from each timer output.
● Watchdog timer counter (2-bit counter)
This is a 2-bit up counter that uses the time-base timer or the watch timer output as count clock. The clock
source output destination is set with the watchdog clock selection bit in the watch timer control register
(WTC: WDCS).
● Watchdog reset generation circuit
Sends a reset signal after the overflow (carry) of the watchdog timer.
● Counter clearing circuit
Clears the watchdog timer counter.
● Watchdog timer control register (WDTC)
Activates and clears the watchdog timer, sets an interval time, and keeps a reset generation source.
230
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 12 WATCHDOG TIMER
12.3 Register of the Watchdog Timer
MB90340E Series
12.3
Register of the Watchdog Timer
This section explains the register used to set the watchdog timer.
■ List of the Watchdog Timer Register and the Reset Value
Figure 12.3-1 List of the Watchdog Timer Register and the Reset Value
bit
Watchdog timer control register
(WDTC)
7
6
5
4
3
2
1
0
1
1
1
: Undefined
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
231
CHAPTER 12 WATCHDOG TIMER
12.3 Register of the Watchdog Timer
MB90340E Series
Watchdog Timer Control Register (WDTC)
12.3.1
Activates and clears the watchdog timer, sets an interval time, and keeps a reset
generation source.
■ Watchdog Timer Control Register (WDTC)
Figure 12.3-2 Watchdog Timer Control Register (WDTC)
7
Address
0000A8H
PONR
R
6
5
4
3
2
1
0
Initial value
WRST ERST SRST WTE WT1 WT0
R
R
R
W
W
W
XXXXX111B
bit1
bit0
Interval time selection bits (Time-base timer output selection)
WT1 WT0
Interval time
Minimum
Maximum
Clock cycle
0
0
About 3.58 ms
About 4.61 ms
(214 ±211)/HCLK
0
1
About 14.33 ms
About 18.3 ms
(216 ±213)/HCLK
1
0
About 57.23 ms
About 73.73 ms (218 ±215)/HCLK
1
1
About 458.75 ms About 589.82 ms (221 ±218)/HCLK
HCLK: Oscillation clock
The interval time in parenthesis applies when HCLK operates at 4 MHz.
bit1
bit0
Interval time selection bits (Watch timer output selection)
WT1 WT0
Interval time
Minimum
Maximum
Clock cycle
0
0
About 0.457 s
About 0.576 s
(212 ±29)/SCLK
0
1
About 3.584 s
About 4.608 s
(215 ±212)/SCLK
1
0
About 7.168 s
About 9.216 s
(216 ±213)/SCLK
1
1
About 14.336 s
About 18.432 s (217 ±214)/SCLK
SCLK: Sub clock (See Note below.)
The interval time in parenthesis applies when SCLK operates at 8.192 KHz.
bit2
WTE
Watchdog timer control bit
0
After resetting, the first writing: After resetting, the second writing or
Activates the watchdog timer later: Clears the watchdog timer
1
bit7
No effect
bit5
bit4
bit3
Reset source bits
Reset source
PONR WRST ERST SRST
R
W
*
X
-
: Read only
: Write only
: Keeps the previous state
: Undefined
: Undefined
1
X
X
X
Power-on reset
∗
1
∗
∗
Watchdog reset
∗
∗
1
∗
External reset (Inputs "L" level in RST pins)
∗
∗
∗
1
Software reset (Writes "1" in the RST bit)
Note: SCLK will be divide-by-two or divide-by-four of the clock being input in low speed oscillator pins X0A and X1A.
The division ratio will be set at the SCDS bit of PLL/Sub clock control register (PSCCR).
(See "CHAPTER 6 CLOCK")
232
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 12 WATCHDOG TIMER
12.3 Register of the Watchdog Timer
MB90340E Series
Table 12.3-1 Functions of the Watchdog Timer Control Register (WDTC)
Bit name
bit7,
bit5
to
bit3
PONR, WRST, ERST,
SRST:
Reset source bits
Shows the reset source.
• When reset occurs, "1" will be set in the bit that corresponds to the reset
source. After reset, the watchdog timer control register (WDTC) can be
read to check the reset source.
• The reset source bit will be cleared after reading the watchdog timer
control register (WDTC).
Note:
The data other than PONR bit will not be secured after power-on reset. If
the PONR bit is set when reading, ignore the other bit data.
bit6
Undefined bit
When reading : The value is undefined.
When writing : No effect.
WTE:
Watchdog control bit
Activates or clears the watchdog timer.
When set to "0"
(The first time after reset)
: Activates.
When set to "0"
(The second time or later after reset) : Cleared.
WT1, WT0:
Interval time selection
bits
Sets the watchdog timer interval time.
The interval time differs as shown in Figure 12.3-2 in the case where the
watch timer control register (WTC) specifies the watch timer as a clock
source for the watchdog timer (watchdog clock selection bit: WDCS=0), and
in the case where the main clock mode or PLL clock mode is selected as a
clock mode and the WDCS bit in WTC is "1".
In sub clock mode, be sure to set the watchdog clock selection bit (WDCS) in
the watch timer control register (WTC) to "0" and select the watch timer
output.
• The data on activating the watchdog timer will be effective.
• The written data after activating the watchdog timer will be ignored.
• These bits are for writing only.
bit2
bit0,
bit1
CM44-10143-5E
Function
FUJITSU SEMICONDUCTOR LIMITED
233
CHAPTER 12 WATCHDOG TIMER
12.4 Operating Explanation of the Watchdog Timer
12.4
MB90340E Series
Operating Explanation of the Watchdog Timer
After activating the watchdog timer, when its counter reaches the interval time without
being cleared, a watchdog reset occurs.
■ State Transition Chart of the Watchdog Timer
The watchdog timer has the following four states.
Disabled: Is not operating.
Operating: Starts counting from the counter-cleared state.
Stopped: Continues the counter-cleared state.
Overflowed: Generates a watchdog reset.
Figure 12.4-1 State Transition Chart of the Watchdog Timer
Disabled
(Initial state)
Writes "0"
in the WTE bit
Reset
Reset
Operating
Starts counting from the
counter-cleared state
Cancels the stop mode by interrupt
Stopped
Counter-cleared state
Transits to the stop mode
Counter
overflow
Overflowed
Always
Generates a watchdog reset
Writes "0" in the WTE bit
Transits to the sleep mode
Transits to the watch mode
Transits to the time-base timer mode
234
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 12 WATCHDOG TIMER
12.4 Operating Explanation of the Watchdog Timer
MB90340E Series
■ Watchdog Timer Operations
To operate the watchdog timer, the configuration shown in Figure 12.4-2 will be necessary.
Figure 12.4-2 Watchdog Timer Settings
bit 7
Watchdog timer control register
(WDTC)
6
5
4
3
2
1
bit 0
WRST ERST SRST WTE WT1 WT0
PONR
0
bit 7
Watch timer control register
(WTC)
6
5
4
3
2
1
bit 0
WDCS SCE WTIE WTOF WTR WTC2 WTC1 WTC0
: Used bit
0 : Set to "0"
● Selection of a clock input source
•
The time-base timer or watch timer can be selected as a clock input source for the watchdog timer count
clock. The time-base timer is selected when setting "1" to the watchdog clock selection bit (WTC:
WDCS), and the watch timer is selected when setting "0" thereto. It returns to "1" (time-base timer) after
resetting.
• When operating in the sub clock mode, set "0" to the WDCS bit to select the watch timer.
Note:
In a single clock product, the watchdog timer cannot be used if the watch timer is set as clock for the
watchdog timer.
● Setting of interval time
• To select the interval time of the watchdog timer, set the interval time selection bits (WDTC: WT1,
WT0).
• Set an interval time concurrently with the activation. It will be ignored if written after activating the
watchdog timer.
● Activation of watchdog timer
• When "0" is written to the watchdog timer control bit (WDTC: WTE) after resetting, the watchdog timer
activates and starts counting up.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
235
CHAPTER 12 WATCHDOG TIMER
12.4 Operating Explanation of the Watchdog Timer
MB90340E Series
● Clearing of the watchdog timer
• The watchdog timer will be cleared when "0" is written to the watchdog timer control bit (WDTC:
WTE) again within the interval time. If it is not cleared within the interval time, a watchdog timer
overflow occurs, resulting in CPU reset.
• The watchdog timer is cleared by resetting or transiting to standby modes (the sleep mode, stop mode,
and time-base timer mode).
• When the time-base timer is in operation, the watch mode is in operation, or the mode is sleep mode, the
watchdog timer counter will be cleared while the watchdog timer is activating.
• Figure 12.4-3 shows the relationship between the watchdog timer clearing timing and the interval time.
The interval time differs depending on the timing to clear the watchdog timer.
236
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 12 WATCHDOG TIMER
12.4 Operating Explanation of the Watchdog Timer
MB90340E Series
● Check of reset sources
• By reading the reset source bits (WDTC: PONR, WRST, ERST, SRST) in the watchdog timer control
register (WDTC) after resetting, reset sources can be checked.
Reference:
See Section "CHAPTER 7 RESET" for details on reset source bits.
Figure 12.4-3 The Watchdog Timer Clearing Timing and Interval Time
[Watchdog timer block diagram]
2-bit counter
Clock
selector
a
Divide-bytwo circuit
b
Divide-bytwo circuit
c
Reset
circuit
d
Reset
signal
Enabling and clearing counts
WTE bit
Count enable
output circuit
[Minimum interval time] When WTE bit cleared immediately before count clock rises
Count starts
Counter cleared
Count clock a
Divide-by-two value b
Divide-by-two value c
Count allowed
Reset signal d
7 × (Count clock cycle/2)
Watchdog reset generated
WTE bit cleared
[Maximum interval time] When WTE bit cleared immediately after count clock rises
Count starts
Counter cleared
Count clock a
Divide-by-two value b
Divide-by-two value c
Count allowed
Reset signal
9 × (Count clock cycle/2)
WTE bit cleared
CM44-10143-5E
Watchdog reset generated
FUJITSU SEMICONDUCTOR LIMITED
237
CHAPTER 12 WATCHDOG TIMER
12.5 Notes on Using the Watchdog Timer
12.5
MB90340E Series
Notes on Using the Watchdog Timer
Take notice of the following points when using the watchdog timer.
■ Notes on Using the Watchdog Timer
● Stopping the watchdog timer
• The watchdog timer stops on transition to the stop mode.
● Interval time
• Because the carry signal of the time-base timer or watch timer is used as count clock for interval time,
the interval time of the watchdog timer can be longer when the time-base timer or watch timer is
cleared. The time-base timer will also be cleared in the case of transition from the main clock mode to
the PLL clock mode, from the sub clock mode to the main clock mode, and from the sub clock mode to
the PLL clock mode, in addition to the case where "0" is written to the time-base timer counter clear bit
(TBR) in the time-base timer control register (TBTC).
• Set an interval time concurrently with the activation of watchdog timer. It will be ignored if set except at
the activation.
● Notes on writing programs
• When continuously clearing the watchdog timer in the main loop, set a shorter time than the watchdog
timer interval time for the main loop processing time including interrupt processing.
• Because the watchdog timer is operating during DMA transfer, the hold state, the sleep and time-base
timer mode, or the watch mode, the operation time (such as interval time) in each mode has to be taken
into consideration in user programs.
● Notes on using sub clock mode
• In sub clock mode, be sure to set the watchdog clock selection bit (WDCS) in the watch timer control
register (WTC) to "0" and select the watch timer output.
● Operations of watchdog timer in the sleep mode, time-base timer mode, and watch mode
• When transiting to the sleep mode, time-base timer mode, and watch mode, the watchdog timer is
cleared and restarts counting (see Table 12.5-1).
● Operations of watchdog timer during DMA transfer
• Because the watchdog timer operates during DMA transfer, a watchdog reset may occur during DMA
transfer. To prevent a reset, take necessary measures in user programs (see Table 12.5-1).
238
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 12 WATCHDOG TIMER
12.5 Notes on Using the Watchdog Timer
MB90340E Series
● Watchdog timer operations in hold state (external bus mode)
• When CPU is in hold state, the watchdog timer is cleared and stopped. As soon as the hold state is
canceled, the watchdog timer starts counting again (see Table 12.5-1).
● Operations of watchdog timer in stop mode
• When transiting to the stop mode, the watchdog timer is cleared and stopped. As soon as the stop mode
is canceled, the watchdog timer starts counting again (see Table 12.5-1).
● Operations of watchdog timer in reset
• The watchdog timer will be disabled by all reset sources. After the reset is cancelled, the watchdog timer
remains disabled (see Table 12.5-1).
Table 12.5-1 Watchdog Timer Clearing Conditions
Operation
mode
Reset
WDTC
register
WTE=0
Stop
mode
Sleep
mode
Time-base
timer mode
Watch
mode
Hold
μDMAC
Clear
In transition
In writing
In transition
In transition
In transition
In transition
None
None
Operating
(Starts
counting
after
clearing)
Operating
(Starts
counting
after
clearing)
Operating
(Starts
counting
after
clearing)
Operating
(Continues
counting)
Operating
(Continues
counting)
Watchdog timer
state in modes
Disabled
-
Stopped
(Keeps
cleared)
Watchdog reset in
modes
Not occur
-
Not occur
Occur
Occur
Occur
Occur
Occur
Operating
Operating
(Restarts
counting
after
clearing)
Operating
(Continues
counting)
Operating
(Continues
counting)
Operating
(Continues
counting)
Operating
(Continues
counting)
Operating
(Continues
counting)
Watchdog timer
state after
canceling and
returning modes
CM44-10143-5E
Disabled
FUJITSU SEMICONDUCTOR LIMITED
239
CHAPTER 12 WATCHDOG TIMER
12.6 Programming Example of the Watchdog Timer
12.6
MB90340E Series
Programming Example of the Watchdog Timer
This section shows programming examples of the watchdog timer.
■ Programming Example of the Watchdog Timer
● Processing specifications
• Clears the watchdog timer each time in the main program loop.
• The main program has to go around once within the minimum interval time of watchdog timer.
● Coding example
WDTC
EQU
0000A8H
;Watchdog timer control register
WTE
EQU
WDTC:2
;Watchdog control bit
;
;---------Main program--------------------------------------CODE
CSEG
START:
;Data such as stack pointer (SP) are
;supposed to be initialized
MOV
I:WDTC,#00000011B ;Activation of watchdog timer
;Selects a 221+218 cycle for interval
;time
LOOP:
CLRB I:WTE
;Clearing of the watchdog timer
•
User process
•
BRA
LOOP
;---------Vector setting------------------------------------VECT
CSEG ABS=0FFH
ORG
00FFDCH
;Reset vector set
DSL
START
DB
00H
;Setting to the single chip mode
VECT
ENDS
END
START
240
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 13
16-BIT I/O TIMER
This chapter describes the functions and operations of
the 16-bit I/O timer.
13.1 Overview of 16-bit I/O Timer
13.2 Block Diagram of 16-bit I/O Timer
13.3 Configuration of 16-bit I/O Timer
13.4 Interrupts from 16-bit I/O Timer
13.5 Operations of 16-bit Free-run Timer
13.6 Input Capture Operations
13.7 Output Compare Operations
13.8 Notes on Using the 16-bit I/O Timer
13.9 Sample Programs for 16-bit I/O Timer
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
241
CHAPTER 13 16-BIT I/O TIMER
13.1 Overview of 16-bit I/O Timer
13.1
MB90340E Series
Overview of 16-bit I/O Timer
The 16-bit I/O timer consists of two 16-bit free-run timers, eight input capture channels,
and eight output compare channels.
Based on the 16-bit free-run timers, the 16-bit I/O timer can output eight independent
waveforms and measure input pulses and external clock cycles.
■ Modules Making Up the 16-bit I/O Timer
The 16-bit I/O timer contains the following modules:
● 16-bit free-run timer × 2
• 16-bit free-run timer 0 (ch.0)
• 16-bit free-run timer 1 (ch.1)
● Input capture channels × 8
• Input capture unit 0: Captures 16-bit free-run timer 0.
- Input capture 0 (ch.0)
- Input capture 1 (ch.1)
- Input capture 2 (ch.2)
- Input capture 3 (ch.3)
• Input capture unit 1: Captures 16-bit free-run timer 1.
- Input capture 4 (ch.4)
- Input capture 5 (ch.5)
- Input capture 6 (ch.6)
- Input capture 7 (ch.7)
● Output compare channels × 8
• Output compare unit 0: Compares register values with16-bit free-run timer 0. (Comparison and
match detection)
- Output compare 0 (ch.0)
- Output compare 1 (ch.1)
- Output compare 2 (ch.2)
- Output compare 3 (ch.3)
• Output compare unit 1: Compares register values with16-bit free-run timer 1. (Comparison and
match detection)
- Output compare 4 (ch.4)
- Output compare 5 (ch.5)
- Output compare 6 (ch.6)
- Output compare 7 (ch.7)
242
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 13 16-BIT I/O TIMER
13.1 Overview of 16-bit I/O Timer
MB90340E Series
■ Functions of 16-bit I/O Timer
● Functions of 16-bit free-run timer
Each 16-bit free-run timer consists of a 16-bit up-counter, a prescaler, and control registers.
The count value of the 16-bit free-run timer is used as the reference time for the input capture and output
compare units.
• The count clock cycle can be selected from among eight options.
• An interrupt request can be generated when the counter overflows.
• The counter of the 16-bit free-run timer is cleared to 0000H at a reset, when the timer is cleared
(TCCSL: CLR=1), or upon detection of an output compare match.
● Functions of input capture units
The input capture units contain eight 16-bit capture registers corresponding to external input pins, control
registers, and edge detection circuits.
When a trigger edge is input to an external input pin, the 16-bit free-run timer holds its counter value and
generates an interrupt request at the same time.
• A capture interrupt can be generated independently for each channel.
• The input capture unit can activate DMA transfer or Extended Intelligent I/O Service (EI2OS).
• The trigger edge can be selected from among the rising edge, falling edge, and both edges.
• Each channel works independently, allowing up to eight inputs to be measured.
• If you set LIN-UART as the input signal, the baud rate can be measured in LIN slave mode.
● Functions of output compare unit
The output compare unit contains eight 16-bit compare registers, control registers, compare control circuits,
and output control circuits.
The output compare unit compares its register value with the counter value of the 16-bit free-run timer.
When they match, the output compare unit inverts the output level of the corresponding output compare pin
and generates an interrupt request at the same time.
• The output compare unit can activate DMA transfer or Extended Intelligent I/O Service (EI2OS).
• The output compare unit has the output pins and interrupt request flags corresponding to its eight output
compare registers and allows the individual registers to operate independently.
• The output level can be inverted upon detection of compare matches of at least two channels such as
output compare ch.0 and ch.1. (The OUT0 and OUT4 pin outputs are not supported.)
• The output level of each pin can be set upon activation.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
243
CHAPTER 13 16-BIT I/O TIMER
13.2 Block Diagram of 16-bit I/O Timer
13.2
MB90340E Series
Block Diagram of 16-bit I/O Timer
The 16-bit I/O timer consists of the following modules:
• 16-bit free-run timer
• Input capture units
• Output compare units
■ Block Diagram of 16-bit I/O Timer
Figure 13.2-1 Block Diagram of 16-bit I/O Timer
Internal data bus
Input
capture unit
Dedicated
bus
16-bit
free-run timer
Dedicated
bus
Output
compare unit
● 16-bit free-run timer
The count value of the 16-bit free-run timer is used as the base time for the input capture and output
compare units.
● Input capture unit
When a trigger edge is input to an external input pin or when the trigger edge for LIN slave baud rate
measurement is input from LIN-UART, the 16-bit free-run timer holds its counter value and generates an
interrupt request at the same time.
● Output compare unit
The output compare unit compares its register value with the counter value of the 16-bit free-run timer.
When they match, the output compare unit inverts the output level of the corresponding pin and generates
an interrupt request at the same time.
244
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 13 16-BIT I/O TIMER
13.2 Block Diagram of 16-bit I/O Timer
MB90340E Series
■ Pin Summary and Interrupt Numbers
Table 13.2-1 lists the pins used for the 16-bit I/O timer and their respective interrupts.
Table 13.2-1 Pin Summary and Interrupt Numbers
Interrupt
No.
DMA
channel
I2OS
support
#33
(21H)
8
❍
6
❍
P31/IN5
#31
(1FH)
IN6
P42/IN6/
RX1/
INT9R
#13
(0DH)
—
×
Input capture ch.7 (using 16-bit free-run timer ch.1)
IN7
P43/IN7/
TX1
#14
(0EH)
—
×
Output compare ch.0 (using 16-bit free-run timer ch.0)
OUT0
P94/
OUT0
#32
(20H)
7
❍
#34
(22H)
9
❍
#32
(20H)
7
❍
#34
(22H)
9
❍
#30
(1EH)
—
×
Channel
Dedicated
pin
Pin name
Input capture ch.0 (using 16-bit free-run timer ch.0)
IN0
P24/IN0
Input capture ch.1 (using 16-bit free-run timer ch.0)
IN1
P25/IN1
Input capture ch.2 (using 16-bit free-run timer ch.0)
IN2
P26/IN2
Input capture ch.3 (using 16-bit free-run timer ch.0)
IN3
P27/IN3
Input capture ch.4 (using 16-bit free-run timer ch.1)
IN4
P30/IN4
Input capture ch.5 (using 16-bit free-run timer ch.1)
IN5
Input capture ch.6 (using 16-bit free-run timer ch.1)
Output compare ch.1 (using 16-bit free-run timer ch.0)
OUT1
P95/
OUT1
Output compare ch.2 (using 16-bit free-run timer ch.0)
OUT2
P96/
OUT2
Output compare ch.3 (using 16-bit free-run timer ch.0)
OUT3
P97/
OUT3
Output compare ch.4 (using 16-bit free-run timer ch.1)
OUT4
P34/
OUT4
Output compare ch.5 (using 16-bit free-run timer ch.1)
OUT5
P35/
OUT5
Output compare ch.6 (using 16-bit free-run timer ch.1)
OUT6
P36/
OUT6
Output compare ch.7 (using 16-bit free-run timer ch.1)
OUT7
P37/
OUT7
16-bit free-run timer ch.0 (overflow interrupt or output compare ch.0
compare match interrupt)
FRCK0
P44/
FRCK0/
SDA0
16-bit free-run timer ch.1 (overflow interrupt or output compare ch.4
compare match interrupt)
CM44-10143-5E
FRCK1
P45/
FRCK1/
SCL0
FUJITSU SEMICONDUCTOR LIMITED
245
CHAPTER 13 16-BIT I/O TIMER
13.2 Block Diagram of 16-bit I/O Timer
13.2.1
MB90340E Series
Block Diagram of 16-bit Free-run Timer
The MB90340E series contains two channels of 16-bit free-run timer, each of which
consists of the following blocks:
■ Block Diagram of 16-bit Free-run Timer
Figure 13.2-2 Block Diagram of 16-bit Free-run Timer
Output count values to
input capture and output
compare units.
Timer data register
(TCDT0,♦TCDT1)
OF
16-bit counter
CLK
STOP
CLR
External clock
Prescaler
Output compare register 0 match signal
(♦ Output compare register 4)
3
Timer control status
register (lower)
(TCCSL0,♦TCCSL1)
Internal data bus
(TCDT0,♦TCDT1)
IVF IVFE STOP MODE CLR CLK2 CLK1 CLK0
Free-run timer
overflow interrupt request
Timer control status
register (upper)
(TCCSH0,♦TCCSH1)
ECKE
φ : Machine clock
OF : Overflow
♦ : Name for 16-bit free-run timer ch.1
● Prescaler
The prescaler divides the frequency of the machine clock signal and supplies the product to the 16-bit
counter as its count clock signal. The count clock cycle can be selected from among eight options,
depending on the settings (TCCSL: CLK2 to CLK0) in the timer control status register.
● Timer data register (TCDT)
The timer data register can read the counter value of the 16-bit free-run timer. While the 16-bit free-run
timer is inactive, the counter value can be set by writing it to the TCDT register.
● Timer control status registers (TCCSH, TCCSL)
The timer control status registers (upper and lower) can be used to select the count clock, select the counter
clear condition, clear the counter, enable counting, enable interrupt requests, and to check the overflow
generation flag.
246
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 13 16-BIT I/O TIMER
13.2 Block Diagram of 16-bit I/O Timer
MB90340E Series
13.2.2
Block Diagrams of Input Capture Units
The individual input capture units consist of the blocks illustrated below.
■ Block Diagrams of Input Capture Units
Figure 13.2-3 Block Diagram of Input Capture Unit 0
16-bit free-run timer
Edge detection circuit
IN3
Input capture data register 3 (IPCP3)
Pin
IN2
Input capture data register 2 (IPCP2)
Pin
Input capture edge register (ICE23)
IEI3 IEI2
2
2
ICP3 ICP2 ICE3 ICE2 EG31 EG30 EG21 EG20
Input capture
interrupt request
Input capture control
status register
(ICS01)
Internal data bus
Input capture control
status register
(ICS23)
ICP1 ICP0 ICE1 ICE0 EG11 EG10 EG01 EG00
2
2
Input capture edge register (ICE01)
ICUS1
ICUS0 IEI1 IEI0
IN1
Pin
Input capture data register 1 (IPCP1)
LIN-UART1
IN0
Pin
Input capture data register 0 (IPCP0)
LIN-UART0
Edge detection circuit
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
247
CHAPTER 13 16-BIT I/O TIMER
13.2 Block Diagram of 16-bit I/O Timer
MB90340E Series
Figure 13.2-4 Block Diagram of Input Capture Unit 1
16-bit free-run timer
Edge detection circuit
IN7
Pin
Input capture data register 7 (IPCP7)
LIN-UART3
IN6
Pin
Input capture edge register 6 (IPCP6)
LIN-UART2
LIN-UART4
2
ICUS7 ICUS61 ICUS60 IEI7 IEI6
Input capture edge register (ICE67)
2
2
ICP7 ICP6 ICE7 ICE6 EG71 EG70 EG61 EG60
Input capture
interrupt request
Input capture control
status register
(ICS45)
Internal data bus
Input capture control
status register
(ICS67)
ICP5 ICP4 ICE5 ICE4 EG51 EG50 EG41 EG40
2
2
Input capture edge register (ICE45)
IEI5 IEI4
IN5
Pin
Input capture data register 5 (IPCP5)
IN4
Pin
Input capture data register 4 (IPCP4)
Edge detection circuit
248
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 13 16-BIT I/O TIMER
13.2 Block Diagram of 16-bit I/O Timer
MB90340E Series
● Input capture data registers 0 to 7 (IPCP0 to IPCP7)
• The input capture data registers hold the captured counter value of the 16-bit free-run timers.
• Input capture data registers 0 to 3 hold the counter value of 16-bit free-run timer 0.
• Input capture data registers 4 to 7 hold the counter value of 16-bit free-run timer 1.
● Input capture control status registers 01 to 67 (ICS01 to ICS67)
• The input capture control status registers can be used to select the edge trigger, enable capturing, enable
capture interrupt requests, and to check the valid edge detection flag for the individual input capture
units.
• There are four input capture control status registers. These are used to control the input capture
operations of their respective channels as shown in Table 13.2-2.
● Input capture edge registers 01 to 67 (ICE01 to ICE67)
• The input capture edge registers display the polarities of edges detected through the input capture of
their respective channels. They are also used to select the input signal (external pin INx or LIN-UART).
When LIN-UART is selected as the input, the baud rate can be measured in LIN slave mode (see
Section "20.7.3 Operation of LIN Function (Operating Mode 3)").
• There are four input capture edge registers. These are used to control the input capture operations of
their respective channels as shown in Table 13.2-2.
Table 13.2-2 Correspondence Between Input Capture Registers and Pins
Input capture control
status register
Input capture edge
register
ICS01
ICE01
Input capture
unit 0
ICS23
ICS45
Input pin
Input from
LIN-UART
IPCP0
IN0
UART0
IPCP1
IN1
UART1
IPCP2
IN2
—
IPCP3
IN3
—
IPCP4
IN4
—
IPCP5
IN5
—
IPCP6
IN6
UART2, UART4
IPCP7
IN7
UART3
ICE23
ICE45
Input capture
unit 1
ICS67
Input capture data
register
ICE67
● Edge detection circuit
The edge detection circuit detects the edges of signals input to the external input pins. The edge type to be
detected can be selected from among the rising edge, falling edge, both edges, and no detection (capture
off).
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
249
CHAPTER 13 16-BIT I/O TIMER
13.2 Block Diagram of 16-bit I/O Timer
13.2.3
MB90340E Series
Block Diagram of Output Compare Unit
The output compare unit consists of the following blocks:
■ Block Diagram of Output Compare Unit
Figure 13.2-5 Block Diagram of Output Compare Unit 0 (1)
Output compare
interrupt request
Output compare control
status register OCS2, OCS3
(OCS6, OCS7)
CMOD1
CMOD0 OTE3 OTE2 OTD3 OTD2 IOP3 IOP2 IOE3 IOE2
2
2
CST3 CST2
2
2
Timer data register
TCDT0 (TCDT1)
16-bit free-run timer 0 (1)
Compare control circuit 3 (7)
OCCP3 (OCCP7)
Output compare register 3 (7)
Compare control circuit 2 (6)
OUT3 (OUT7)
Output control
circuit 3 (7)
Internal data bus
OCCP2 (OCCP6)
Output compare register 2 (6)
Pin
OUT2 (OUT6)
Output control
circuit 2 (6)
Pin
Compare control circuit 1 (5)
OUT1 (OUT5)
OCCP1 (OCCP5)
Output control
circuit 1 (5)
Output compare register 1 (5)
Pin
OUT0 (OUT4)
Output control
circuit 0 (4)
Compare control circuit 0 (4)
Pin
OCCP0 (OCCP4)
Output compare register 0 (4)
2
2
CMOD1
CMOD0 OTE1 OTE0 OTD1 OTD0 IOP1 IOP0 IOE1 IOE0
Output compare control status register
OCS0, OCS1(OCS4, OCS5)
CST1 CST0
Output compare
interrupt request
Components of output compare unit 1 are designated as in parentheses ().
250
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 13 16-BIT I/O TIMER
13.2 Block Diagram of 16-bit I/O Timer
MB90340E Series
● Output compare registers 0 to 7 (OCCP0 to OCCP7)
• The output compare registers contain the values to be compared with the counter value of the 16-bit
free-run timer.
• The values set in output compare registers 0 to 3 are compared with the counter value of 16-bit free-run
timer 0.
• The values set in output compare registers 4 to 7 are compared with the counter value of 16-bit free-run
timer 1.
• When a value set in output compare registers 0 to 7 matches the counter value of the free-run timer, the
output level of the corresponding output compare output pin is inverted and an interrupt request is
issued.
● Output compare control status registers 0 to 7 (OCS0 to OCS7)
• The output compare control status registers can be used to set and check the output levels of the output
compare pins, enable their output, select the output level inversion mode, enable and check compare
match interrupts, and to enable output comparison.
• There are four output compare control status registers. These are used to control the output comparison
of their respective channels as shown in Table 13.2-3.
Table 13.2-3 Correspondence between Output Compare Control Status Registers and Pins
Register name
Output compare
unit 0
Output compare
unit 1
Output compare register controlled
Output pin
Output compare control status register 0,1
(OCS0,OCS1)
Output compare register 0
OUT0
Output compare register 1
OUT1
Output compare control status register 2,3
(OCS2,OCS3)
Output compare register 2
OUT2
Output compare register 3
OUT3
Output compare control status register 4,5
(OCS4,OCS5)
Output compare register 4
OUT4
Output compare register 5
OUT5
Output compare control status register 6,7
(OCS6,OCS7)
Output compare register 6
OUT6
Output compare register 7
OUT7
● Compare control circuits 0 to 7
The compare control circuits compare the output compare register values with the 16-bit free-run timer
value and, if a compare match is detected, output a compare match signal to the corresponding output
control circuit.
● Output control circuits 0 to 7
The output control circuits inverts the output level of an output compare pin when the output compare
register value matches the 16-bit free-run timer value.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
251
CHAPTER 13 16-BIT I/O TIMER
13.3 Configuration of 16-bit I/O Timer
13.3
MB90340E Series
Configuration of 16-bit I/O Timer
This section details the pins, interrupt triggers, and registers for the 16-bit I/O timer.
■ Pins for 16-bit I/O Timer
The pins used for the 16-bit I/O timer also serve as general-purpose I/O ports.
Table 13.3-1 lists the pins, their functions, and the settings for use by the 16-bit I/O timer.
Table 13.3-1 Pins for 16-bit I/O Timer
Channel
Pin name
Pin function
Setting required for pin use
16-bit free-run timer 0
P44/
SDA0/
FRCK0
General-purpose I/O port /
I2C0 data input/output /
external clock input
• Use the port direction register (DDR) to set the pins as input ports.
• Disable I2C0 operation (ICCR0:EN=0).
16-bit free-run timer 1
P45/
SCL0/
FRCK1
General-purpose I/O port /
I2C0 clock input/output /
external clock input
• Use the port direction register (DDR) to set the pins as input ports.
• Disable I2C0 operation (clock control register ICCR0:EN=0).
252
Input capture 0
P24/IN0
Use the port direction register (DDR) to set the pin as an input port.
Input capture 1
P25/IN1
Use the port direction register (DDR) to set the pin as an input port.
Input capture 2
P26/IN2
Input capture 3
P27/IN3
Input capture 4
P30/IN4
Use the port direction register (DDR) to set the pin as an input port.
Input capture 5
P31/IN5
Use the port direction register (DDR) to set the pin as an input port.
Input capture 6
P42/
IN6/
RX1/
INT9R
General-purpose I/O port /
capture input /
CAN input /
external interrupt input
Use the port direction register (DDR) to set the pin as an input port.
Input capture 7
P43/
IN7/
TX1
General-purpose I/O port /
capture input /
CAN output
• Use the port direction register (DDR) to set the pin as an input port.
• Set CAN1 to disable output (CAN control status register CSR1:
TOE=0)
Output compare 0
P94/OUT0
Enable output compare output (OCS1: OTE0=1)
Output compare 1
P95/OUT1
Enable output compare output (OCS1: OTE1=1)
Output compare 2
P96/OUT2
Enable output compare output (OCS3: OTE2=1)
Output compare 3
P97/OUT3
Output compare 4
P34/OUT4
Output compare 5
P35/OUT5
Enable output compare output (OCS5: OTE5=1)
Output compare 6
P36/OUT6
Enable output compare output (OCS7: OTE6=1)
Output compare 7
P37/OUT7
Enable output compare output (OCS7: OTE7=1)
General-purpose I/O port /
capture input
General-purpose I/O port /
compare output
Use the port direction register (DDR) to set the pin as an input port.
Use the port direction register (DDR) to set the pin as an input port.
Enable output compare output (OCS3: OTE3=1)
Enable output compare output (OCS5: OTE4=1)
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 13 16-BIT I/O TIMER
13.3 Configuration of 16-bit I/O Timer
MB90340E Series
■ Generation of Interrupt Requests by the 16-bit I/O Timer
The 16-bit I/O timer can generate the following types of interrupt requests:
● Timer counter overflow interrupt
An interrupt request is generated when either of the following events occurs with overflow interrupt
requests enabled (TCCSL: IVFE=1):
• The 16-bit free-run timer causes an overflow.
• The counter of the 16-bit free-run timer is cleared (with TCCSL:MODE=1) as the counter value
matches an output compare register value.
● Input capture interrupt
When input capture interrupt requests have been enabled (ICS01:ICE=1), an interrupt request is generated
if a trigger edge is detected at the input capture pin or if the trigger edge for LIN slave baud rate
measurement is input from LIN-UART.
● Output compare interrupt
When output compare interrupt requests have been enabled (OCS0: IOE=1), an interrupt request is
generated if the counter value of the 16-bit free-run timer matches an output compare register value.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
253
CHAPTER 13 16-BIT I/O TIMER
13.3 Configuration of 16-bit I/O Timer
13.3.1
MB90340E Series
Timer Control Status Register (Upper)
(TCCSH0, TCCSH1)
The timer control status register (upper) can be used to select the count clock and
counter clear condition, clear the counter, enable counting and interrupts, and to check
the interrupt request flag.
■ Timer Control Status Register (Upper) (TCCSH0, TCCSH1)
Figure 13.3-1 Timer Control Status Register (Upper) (TCCSH0, TCCSH1)
bit 15 14
Address:
TCCSH0 : 007943H ECKE
TCCSH1 : 007947H
R/W -
13
12
11
10
9
8
-
-
-
-
-
-
-
-
-
-
-
-
Initial value
0XXXXXXXB
bit15
ECKE
External clock input enable bit
0
Use internal clock (prescaler output).
1
Use external clock (FRCK0/1 pin input).
R/W : Readable/writable
: Undefined
X
: Undefined bit
: Initial value
Table 13.3-2 Functions of Timer Control Status Register (Upper) (TCCSH0, TCCSH1)
Bit name
bit15
ECKE:
External clock input enable
bit
This bit selects the count clock for the 16-bit free-run timer.
Setting the bit to "1": Selects the clock signal input via the external pin FRCK0/FRCK1.
Setting the bit to "0": Selects the internal clock signal (output from the prescaler).
Note:
Set the ECKE bit with the free-run timer inactive (TCCSL:STOP=1).
Undefined bits
When read : The bits contain indeterminate values.
When written : The bits have no effect.
bit14
to
bit8
254
Function
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 13 16-BIT I/O TIMER
13.3 Configuration of 16-bit I/O Timer
MB90340E Series
13.3.2
Timer Control Status Register (Lower) (TCCSL0, TCCSL1)
The timer control status register (lower) can be used to select the count clock and
counter clear condition, clear the counter, enable counting and interrupts, and to check
the interrupt request flag.
■ Timer Control Status Register (Lower) (TCCSL0, TCCSL1)
Figure 13.3-2 Timer Control Status Register (Lower) (TCCSL0, TCCSL1)
Address
bit 7
6
5
4
3
2
1
0
TCCSL0:007942H IVF IVFE STOP MODE CLR CLK2 CLK1 CLK0
TCCSL1:007946H
R/W R/W R/W R/W R/W R/W R/W R/W
Initial value
00000000 B
bit2
bit1
bit0
Count clock setting bits
CLK2 CLK1 CLK0 Count
φ=16MHz
φ=8MHz φ=4MHz φ=1MHz
clock
0
0
0
1/φ
62.5ns 0.125μs 0.25μs
1μs
0
0
1
2/φ
0.125μs 0.25μs
0.5μs
2μs
0
1
0
4/φ
0.25μs
0.5μs
1μs
4μs
0
1
1
8/φ
0.5μs
1μs
2μs
8μs
1
0
0
16/φ
1μs
2μs
4μs
16μs
1
0
1
32/φ
2μs
4μs
8μs
32μs
1
1
0
64/φ
4μs
8μs
16μs
64μs
1
1
1
128/φ
8μs
16μs
32μs
128μs
φ: Machine clock
bit3
CLR
Timer clear bit
0
No effect
1
Clears the counter (TCDT = 0000H).
bit4
MODE
Clear condition select bit
0
Clears the counter at a reset or with the clear bit set.
1
Clears the counter at a reset, with the clear bit set, or with a
compare register match.
bit5
STOP
Timer operation stop bit
0
Enables timer operation.
1
Disables (stops) timer operation.
bit6
IVFE
Timer overflow interrupt enable bit
0
Disables timer overflow interrupts.
1
Enables timer overflow interrupts.
bit7
IVF
R/W
: Readable/writable
Timer overflow generation flag
When read
When written
0
Causes no timer overflow.
Clears this IVF bit.
1
Causes a timer overflow.
No effect
: Initial value
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
255
CHAPTER 13 16-BIT I/O TIMER
13.3 Configuration of 16-bit I/O Timer
MB90340E Series
Table 13.3-3 Functions of Timer Control Status Register (Lower) (TCCSL0, TCCSL1) (1 / 2)
Bit name
Function
bit7
IVF:
Timer overflow generation
flag
This bit indicates the occurrence of a timer overflow.
[Condition for setting the bit to "1"]
The bit is set in either of the following two conditions:
• The 16-bit free-run timer causes an overflow.
• The counter is cleared upon detection of a compare match between the counter value of 16bit free-run timer 0/1 and the value of output compare register 0/4 (only with TCCSL:
MODE=1).
[When the bit is set to "1"]
When the IVF bit is set to "1" with timer overflow interrupt requests enabled
(TCCSL:IVFE=1), an interrupt request is generated.
Setting the bit to "0": Clears the flag.
Setting the bit to "1": Has not effect.
Notes:
• If setting of this bit to "1" and writing "0" occur at the same time, "0" is written.
• When read by a read-modify-write instruction, the bit always returns "1".
bit6
IVFE:
Timer overflow interrupt
enable bit
This bit enables or disables interrupt requests to be generated when the timer overflow
generation flag bit (TCCSL: IVF) is set to "1".
Setting the bit to "1": Generates an interrupt request when the IVF bit is set to "1".
Setting the bit to "0": Disables the generation of interrupt requests.
STOP:
Timer operation stop bit
This bit enables or disables (stops) the operation of the 16-bit free-run timer.
Setting the bit to "0": Enables timer operation, allowing the timer to be incremented based
on the count clock set by CLK2 to CLK0.
Setting the bit to "1": Stops timer operation.
Note:
When the 16-bit free-run timer stops operation, the output compare operation is stopped as
well.
MODE:
Clear condition select bit
This bit selects the condition for clearing the counter value of the 16-bit free-run timer (TCDT
register).
Setting the bit to "0": Clears the TCDT counter value in either of the following conditions:
• A reset occurs.
• The timer clear bit is set to "1" (TCCSL:CLR=1).
Setting the bit to "1": Clears the TCDT counter value in any of the following conditions:
• A reset occurs.
• The timer clear bit is set to "1" (TCCSL:CLR=1).
• 16-bit free-run timer 0 is cleared when the counter value of 16-bit free-run timer 0 matches
the value of output compare register 0.
• 16-bit free-run timer 1 is cleared when the counter value of 16-bit free-run timer 1 matches
the value of output compare register 4.
CLR:
Timer clear bit
This bit clears the counter (TCDT) of the 16-bit free-run timer in synchronization with a
transition point of the counter.
Setting the bit to "1": Clears the TCDT to 0000H.
Setting the bit to "0": Has no effect.
When read: The bit always returns "0".
Notes:
• To clear the counter with the 16-bit free-run timer inactive (TCCSL:STOP=1), write
0000H directly to the TCDT.
• Writing "0" to this bit before the next count clock cycle after writing "1" prevents the
counter value from being initialized.
bit5
bit4
bit3
256
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
MB90340E Series
CHAPTER 13 16-BIT I/O TIMER
13.3 Configuration of 16-bit I/O Timer
Table 13.3-3 Functions of Timer Control Status Register (Lower) (TCCSL0, TCCSL1) (2 / 2)
Bit name
bit2,
bit1,
bit0
CLK2, CLK1, CLK0:
Count clock setting bits
Function
These bits set the count clock cycle for the 16-bit free-run timer.
Note:
Select the count clock cycle with the output compare unit inactive (TCCSL:STOP=1) and
the input capture units inactive (ICSnm: EGn1, EGno=00B or ICSnm:EGm1, EGm0=00B).
n = 0, 2, 4, 6 m = n+1
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
257
CHAPTER 13 16-BIT I/O TIMER
13.3 Configuration of 16-bit I/O Timer
13.3.3
MB90340E Series
Timer Data Register (TCDT0, TCDT1)
The timer data register is a 16-bit up-counter.
• The timer data register can read the counter value of the 16-bit free-run timer.
• While the 16-bit free-run timer is inactive, the counter value can be set.
■ Timer Data Register (TCDT0, TCDT1)
Figure 13.3-3 Timer Data Register (TCDT0, TCDT1)
Address
TCDT0 upper: 007941H
TCDT0 upper: 007945H
bit15 bit14 bit13 bit12 bit11 bit10 bit9
bit8
Tn15 Tn14 Tn13 Tn12 Tn11 Tn10 Tn9
Tn8
Initial value
00000000B
R/W R/W R/W R/W R/W R/W R/W R/W
TCDT0 lower: 007940H
TCDT0 lower: 007944H
bit7
bit6
bit5
bit4
bit3
bit2
bit1
bit0
Initial value
Tn7
Tn6
Tn5
Tn4 Tn3
Tn2
Tn1
Tn0
00000000B
R/W R/W R/W R/W R/W R/W R/W R/W
R/W: Readable/writable
n = 0, 1
This register allows the counter value of the 16-bit free-run timer to be read from.
[Conditions for clearing the counter value]
The counter value is cleared to 0000H in any of the following conditions:
• An overflow occurs.
• A compare match occurs (only with TCCSL: MODE=1).
• The timer clear bit in the timer control status register is set to "1" (TCCSL: CLR=1).
• The timer data register is set to 0000H with the 16-bit free-run timer inactive.
• A reset occurs.
[Setting the counter value]
If you set the timer by writing a timer value in the timer data register (TCDT), access the TCDT with the
timer inactive (TCCSL: STOP=1).
Note:
To read from or write to the timer data register, be sure to use a word instruction (MOVW).
258
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 13 16-BIT I/O TIMER
13.3 Configuration of 16-bit I/O Timer
MB90340E Series
13.3.4
Input Capture Control Status Registers (ICS)
This section describes the functions of input capture control status registers.
ICS01 to ICS67 correspond to input pins as follows:
ICS01: IN0
IN1
Input capture ch.0, ch.1
ICS23: IN2
IN3
Input capture ch.2, ch.3
ICS45: IN4
IN5
Input capture ch.4, ch.5
ICS67: IN6
IN7
Input capture ch.6, ch.7
■ Input Capture Control Status Register (ICS)
Figure 13.3-4 Input Capture Control Status Register (ICS)
7
bit
Address
ICS01: 000050H
ICS23: 000052H
ICS45: 000054H
ICS67: 000056H
6
ICPm ICPn
5
4
3
2
1
0
ICEm ICEn EGm1 EGm0 EGn1 EGn0
R/W R/W R/W R/W R/W R/W R/W R/W
Initial value
00000000B
bit1
EGn1
0
0
1
1
bit0
EGn0
0
1
0
1
Edge select bits n
Detect no edge. (Operation stopped)
Detect the rising edge.
Detect the falling edge.
Detect both edges.
bit3
EGm1
0
0
1
1
bit2
EGm0
0
1
0
1
Edge select bits m
Detect no edge. (Operation stopped)
Detect the rising edge.
Detect the falling edge.
Detect both edges.
bit4
ICEn
0
1
Capture interrupt enable bit n
Disables input capture 0 interrupts.
Enables input capture 0 interrupts.
bit5
ICEm
Capture interrupt enable bit m
0
Disables input capture 1 interrupts.
1
Enables input capture 1 interrupts.
bit6
ICPn
0
1
Valid edge detection flag bit n
When read
When written
Valid edge not detected for input
Clears this ICP0 bit.
capture 0
Valid edge detected for input
No effect
capture 0
bit7
ICPm
0
R/W
: Readable/writable
: Initial value
CM44-10143-5E
n = 0, 2, 4, 6 m = n+1
1
Valid edge detection flag bit m
When read
When written
Valid edge detected for input
Clears this ICP1 bit.
capture 1
Valid edge detected for input
No effect
capture 1
FUJITSU SEMICONDUCTOR LIMITED
259
CHAPTER 13 16-BIT I/O TIMER
13.3 Configuration of 16-bit I/O Timer
MB90340E Series
Table 13.3-4 Functions of Input Capture Control Status Register (ICS)
Bit name
Function
ICPm:
Valid edge detection flag bit
m
This bit is set to "1" upon detection of a valid edge at the INm pin.
If input capture m interrupt requests have been enabled (ICSnm:ICEm=1), an interrupt
request is generated when the ICPm bit is set.
Setting the bit to "0": Clears the flag.
Setting the bit to "1": Has no effect.
Note:
If setting of this bit to "1" and writing "0" occur at the same time, "0" is written.
bit6
ICPn:
Valid edge detection flag bit n
This bit is set to "1" upon detection of a valid edge at the INn pin.
• If input capture n interrupt requests have been enabled (ICSnm:ICEn=1), an interrupt
request is generated when the ICPn bit is set.
Setting the bit to "0": Clears the flag.
Setting the bit to "1": Has no effect.
Note:
If setting of this bit to "1" and writing "0" occur at the same time, "0" is written.
bit5
ICEm:
Capture interrupt enable bit m
This bit enables or disables input capture m interrupt requests.
Setting the bit to "1": Generates an interrupt request when valid edge detection flag bit m
is set to "1" (ICSnm: ICPm=1).
bit4
ICEn:
Capture interrupt enable bit n
This bit enables or disables input capture n interrupt requests.
Setting the bit to "1": Generates an interrupt request when valid edge detection flag bit n is
set to "1" (ICSnm: ICPn=1).
bit3,
bit2
EGm1, EGm0:
Edge select bits m
These bits select the capture trigger edge for input capture register m.
• Trigger edge setting enables or disables capturing as well.
Setting the bits to "00B": Detects no edge and stops capturing.
bit1,
bit0
EGn1, EGn0:
Edge select bits n
These bits select the capture trigger edge for input capture register n.
• Trigger edge setting enables or disables capturing as well.
Setting the bits to "00B": Detects no edge and stops capturing.
bit7
n = 0, 2, 4, 6 m = n+1
260
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 13 16-BIT I/O TIMER
13.3 Configuration of 16-bit I/O Timer
MB90340E Series
13.3.5
Input Capture Registers (IPCP0 to IPCP7)
• Input capture registers contain counter values captured from the 16-bit free-run timer.
• These are 16-bit read-only registers. There are input capture registers 0 to 7 (IPCP0 to
IPCP7).
■ Input Capture Registers (IPCP0 to IPCP7)
Figure 13.3-5 Input Capture Registers (IPCP0 to IPCP7)
Address
IPCP0 (upper): 007921H
bit15 bit14 bit13 bit12 bit11 bit10 bit9
Initial value
bit8
CP15 CP14 CP13 CP12 CP11 CP10 CP09 CP08
R
R
bit7
IPCP0 (lower): 007920H
R
bit6
R
bit5
R
bit4
R
bit3
R
bit2
XXXXXXXXB
R
bit1
bit0
CP07 CP06 CP05 CP04 CP03 CP02 CP01 CP00 XXXXXXXXB
R
R
R
R
R
R
R
R
bit15 bit14 bit13 bit12 bit11 bit10 bit9 bit8
IPCP1 (upper): 007923H
CP15 CP14 CP13 CP12 CP11 CP10 CP09 CP08
R
R
bit7
IPCP1 (lower): 007922H
R
bit6
R
bit5
R
bit4
R
bit3
R
bit2
XXXXXXXXB
R
bit1
bit0
CP07 CP06 CP05 CP04 CP03 CP02 CP01 CP00 XXXXXXXXB
R
R
R
R
R
R
R
R
bit15 bit14 bit13 bit12 bit11 bit10 bit9 bit8
IPCP2 (upper): 007925H
CP15 CP14 CP13 CP12 CP11 CP10 CP09 CP08
R
R
bit7
IPCP2 (lower): 007924H
R
bit6
R
bit5
R
bit4
R
bit3
R
bit2
XXXXXXXXB
R
bit1
bit0
CP07 CP06 CP05 CP04 CP03 CP02 CP01 CP00 XXXXXXXXB
R
R
R
R
R
R
R
R
bit15 bit14 bit13 bit12 bit11 bit10 bit9 bit8
IPCP3 (upper): 007927H
CP15 CP14 CP13 CP12 CP11 CP10 CP09 CP08
R
R
bit7
IPCP3 (lower): 007926H
R
bit6
R
bit5
R
bit4
R
bit3
R
bit2
XXXXXXXXB
R
bit1
bit0
CP07 CP06 CP05 CP04 CP03 CP02 CP01 CP00 XXXXXXXXB
R
R
R
R
R
R
R
R
bit15 bit14 bit13 bit12 bit11 bit10 bit9 bit8
IPCP4 (upper): 007929H
CP15 CP14 CP13 CP12 CP11 CP10 CP09 CP08
R
R
bit7
IPCP4 (lower): 007928H
R
bit6
R
bit5
R
bit4
R
bit3
R
bit2
XXXXXXXXB
R
bit1
bit0
CP07 CP06 CP05 CP04 CP03 CP02 CP01 CP00 XXXXXXXXB
R
R
R
R
R
R
R
R
bit15 bit14 bit13 bit12 bit11 bit10 bit9 bit8
IPCP5 (upper): 00792BH
CP15 CP14 CP13 CP12 CP11 CP10 CP09 CP08
R
R
bit7
IPCP5 (lower): 00792AH
R
bit6
R
bit5
R
bit4
R
bit3
R
bit2
XXXXXXXXB
R
bit1
bit0
CP07 CP06 CP05 CP04 CP03 CP02 CP01 CP00 XXXXXXXXB
R
R
R
R
R
R
R
R
bit15 bit14 bit13 bit12 bit11 bit10 bit9 bit8
IPCP6 (upper): 00792DH
CP15 CP14 CP13 CP12 CP11 CP10 CP09 CP08
R
R
bit7
IPCP6 (lower): 00792CH
R
bit6
R
bit5
R
bit4
R
bit3
R
bit2
XXXXXXXXB
R
bit1
bit0
CP07 CP06 CP05 CP04 CP03 CP02 CP01 CP00 XXXXXXXXB
R
R
R
R
R
R
R
R
bit15 bit14 bit13 bit12 bit11 bit10 bit9 bit8
IPCP7 (upper): 00792FH
CP15 CP14 CP13 CP12 CP11 CP10 CP09 CP08
R
R
bit7
IPCP7 (lower): 00792EH
R
X
: Read only
: Undefined
R
bit6
R
bit5
R
bit4
R
bit3
R
bit2
XXXXXXXXB
R
bit1
bit0
CP07 CP06 CP05 CP04 CP03 CP02 CP01 CP00 XXXXXXXXB
R
R
R
R
R
R
R
R
When the capture trigger edge (set by ICSnm: EGn1, Egn0; or EGm1, EGm0) is detected at the IN0 to IN7
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
261
CHAPTER 13 16-BIT I/O TIMER
13.3 Configuration of 16-bit I/O Timer
MB90340E Series
pin, input capture register 0 to 7 corresponding to the pin contains the counter value of the 16-bit free-run
timer.
For input capture registers 0, 1, 6, and 7, however, the signal from LIN-UART can be selected as the input
signal (by using the ICE:IEI bit). For details, see Section "13.3.6 Input Capture Edge Registers (ICE01,
ICE23, ICE45, ICE67)".
• Input capture registers are read-only; they cannot be written to.
n = 0, 2, 4, 6 m = n+1
Note:
To read input capture registers, be sure to use a word instruction (MOVW).
262
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 13 16-BIT I/O TIMER
13.3 Configuration of 16-bit I/O Timer
MB90340E Series
13.3.6
Input Capture Edge Registers (ICE01, ICE23, ICE45, ICE67)
Input capture edge registers are used to indicate the detected edge direction and to select
the external pin or LIN-UART as the input signal source. In combination with LIN-UART,
the input capture edge registers can measure the baud rate during LIN slave operation.
ICE01 to ICE67 correspond to input capture channels and input pins (UART) as follows:
ICE01: Input capture ch.0, ch.1
IN0 (/UART0)
IN1 (/UART1)
ICE23: Input capture ch.2, ch.3
IN2
IN3
ICE45: Input capture ch.4, ch.5
IN4
IN5
ICE67: Input capture ch.6, ch.7
IN6 (/UART2, 4)
IN7 (/UART3)
■ Input Capture Edge Registers (ICE01, ICE23, ICE45, ICE67)
Figure 13.3-6 Input Capture Edge Registers (ICE01, ICE23, ICE45, ICE67)
bit15 bit14 bit13 bit12 bit11 bit10 bit9
bit8
Initial value
ICUS0 IEI1
IEI0
XXX0X0XXB
bit10
ICUS0
Input signal select bit 0
0
External pin IN1 input signal
1
Signal from UART0
ICE01: 000051
ICUS1
R/W
R/W
R
R
bit12
ICUS1
Input signal select bit 1
0
External pin IN1 input signal
1
Signal from UART1
bit15 bit14 bit13 bit12 bit11 bit10 bit9
bit8
IEI3
IEI2
R
R
bit15 bit14 bit13 bit12 bit11 bit10 bit9
bit8
IEI5
IEI4
R
R
bit15 bit14 bit13 bit12 bit11 bit10 bit9
bit8
ICUS7 ICUS61 ICUS60 IEI7
IEI6
ICE23: 000053H
ICE45: 000055H
ICE67: 000057H
R/W R/W R/W
R
Initial value
XXXXXXXXB
Initial value
XXXXXXXXB
Initial value
XXX000XXB
bit8
IEIn Detected edge display bit n
0 Detects falling edge.
1 Detects rising edge.
R
bit9
IEIm Detected edge display bit m
0 Detects falling edge.
1 Detects rising edge.
bit11
bit10
ICUS61 ICUS60
R/W : Readable/writable
: Read-only
R
: Undefined
: Undefined
X
: Initial value
n = 0, 2, 4, 6 m = n+1
CM44-10143-5E
0
0
1
1
0
1
0
1
Input signal select bits 61, 60
External pin IN6 input signal
Signal from UART2
Signal from UART4
bit12
ICUS7
0
1
Input signal select bit 7
External pin IN7 input signal
Signal from UART3
FUJITSU SEMICONDUCTOR LIMITED
263
CHAPTER 13 16-BIT I/O TIMER
13.3 Configuration of 16-bit I/O Timer
MB90340E Series
Table 13.3-5 Functions of Input Capture Edge Register 01 (ICE01)
Bit name
bit15
Function
Undefined bits
When read : The bits contain indeterminate values.
When written : The bits have no effect.
bit12
ICUS1:
Input signal select bit 1
This bit selects the input signal to be used to trigger input capture 1.
Setting the bit to "0": Selects external pin IN1.
Setting the bit to "1": Selects LIN-UART1.
bit11
Undefined bit
When read : The bit contains an indeterminate value.
When written: The bit has no effect.
bit10
ICUS0:
Input signal select bit 0
This bit selects the input signal to be used to trigger input capture 0.
Setting the bit to "0": Selects external pin IN0.
Setting the bit to "1": Selects LIN-UART0.
IEI1:
Detected edge display bit 1
This bit indicates the type (rising or falling) of edge detected by input capture 1.
• This bit is read-only.
"0": Indicates that the falling edge has been detected.
"1": Indicates that the rising edge has been detected.
Note:
The value of this bit remains invalid while capturing is stopped (ICS01: EG11,
EG10=00B).
IEI0:
Detected edge display bit 0
This bit indicates the type (rising or falling) of edge detected by input capture 0.
• This bit is read-only.
"0": Indicates that the falling edge has been detected.
"1": Indicates that the rising edge has been detected.
Note:
The value of this bit remains invalid while capturing is stopped (ICS01: EG01,
EG00=00B).
to
bit13
bit9
bit8
264
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
MB90340E Series
CHAPTER 13 16-BIT I/O TIMER
13.3 Configuration of 16-bit I/O Timer
Table 13.3-6 Functions of Input Capture Edge Registers 23, 45 (ICE23, ICE45)
Bit name
bit15
to
bit10
bit9
bit8
Function
Undefined bits
When read : The bits contain indeterminate values.
When written : The bits have no effect.
IEI3, IEI5:
Detected edge display bit 3/5
This bit indicates the type (rising or falling) of edge detected by input capture 3 or 5.
• This bit is read-only.
"0": Indicates that the falling edge has been detected.
"1": Indicates that the rising edge has been detected.
Note:
The value of this bit remains invalid while capturing is stopped (ICSnm:EGm1,
EGm0=00B). (n = 2, 4 m = n+1)
IEI2, IEI4:
Detected edge display bit 2/4
This bit indicates the type (rising or falling) of edge detected by input capture 2 or 4.
• This bit is read-only.
"0": Indicates that the falling edge has been detected.
"1": Indicates that the rising edge has been detected.
Note:
The value of this bit remains invalid while capturing is stopped (ICSnm:EGn1,
EGn0=00B). (n = 2, 4 m = n+1)
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
265
CHAPTER 13 16-BIT I/O TIMER
13.3 Configuration of 16-bit I/O Timer
MB90340E Series
Table 13.3-7 Functions of Input Capture Edge Register 67 (ICE67)
Bit name
bit15
Function
Undefined bits
When read : The bits contain indeterminate values.
When written : The bits have no effect.
bit12
ICUS7:
Input signal select bit 7
This bit selects the input signal to be used to trigger input capture 7.
Setting the bit to "0": Selects external pin IN7.
Setting the bit to "1": Selects LIN-UART3.
bit11,
bit10
ICUS61, ICU60:
Input signal select bits 61, 60
These bits select the input signal to be used to trigger input capture 6.
Setting the bits to "00B": Selects external pin IN6.
Setting the bits to "01B": Selects LIN-UART2.
Setting the bits to "11B" or "10B": Selects LIN-UART4.
IEI7:
Detected edge display bit 7
This bit indicates the type (rising or falling) of edge detected by input capture 7.
• This bit is read-only.
"0": Indicates that the falling edge has been detected.
"1": Indicates that the rising edge has been detected.
Note:
The value of this bit remains invalid while capturing is stopped (ICS67: EG71,
EG70=00B).
IEI6:
Detected edge display bit 6
This bit indicates the type (rising or falling) of edge detected by input capture 6.
• This bit is read-only.
"0": Indicates that the falling edge has been detected
"1": Indicates that the rising edge has been detected.
Note:
The value of this bit remains invalid while capturing is stopped (ICS67: EG61,
EG60=00B).
to
bit13
bit9
bit8
Note:
If the LIN-UART is selected as the input signal source (ICEnm: ICUS) for input capture channel 0, 1,
6, or 7, the input capture channel is used to calculate the baud rate with the LIN-UART operating in
LIN slave mode. In this case, enable input capture interrupts (ICSnm: ICEn=1 or ICEm=1) and select
the detection of both edges (ICSnm: EGn1, EGn0=11B or EGm1, EGm0=11B). For details on baud
rate calculation, see Section "20.7.3 Operation of LIN Function (Operating Mode 3)".
n = 0, 2, 4, 6
266
m = n+1
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 13 16-BIT I/O TIMER
13.3 Configuration of 16-bit I/O Timer
MB90340E Series
13.3.7
Output Compare Control Status Register (OCS) (Upper)
The output compare control status register (OCS) (upper) can be used to enable the
output of output compare pins, set and check their output level, and to select the output
level inversion mode.
OCS1, OCS3, OCS5, and OCS7 correspond to output pins and channels as follows:
OCS1: OUT0
OUT1
Output compare ch.0, ch.1
OCS3: OUT2
OUT3
Output compare ch.2, ch.3
OCS5: OUT4
OUT5
Output compare ch.4, ch.5
OCS7: OUT6
OUT7
Output compare ch.6, ch.7
■ Output Compare Control Status Register (OCS) (Upper)
Figure 13.3-7 Output Compare Control Status Register (OCS) (Upper)
Address
15 14
OCS1 : 000059 H
OCS3 : 00005B H CMOD1
OCS5 : 00005DH
OCS7 : 00005F H R/W
13
12
CMOD0
11
10
9
8
OTEm OTEn OTDm OTDn
Initial value
0XX00000 B
R/W R/W R/W R/W R/W
bit8
OTDn
Output level setting bit n
0
Sets OUTn output level to "L".
OUTn pin output
level
1
Sets OUTn output level to "H".
bit9
OTDm
Output level setting bit m
0
Sets OUTm output level to "L".
OUTm pin output
level
1
Sets OUTm output level to "H".
bit10
OTEn
Compare output enable bit n
0
General-purpose I/O port
1
Output compare output (OUTn)
bit11
OTEm
Compare output enable bit m
0
General-purpose I/O port
1
Output compare output (OUTm)
R/W : Readable/writable
: Undefined
X
: Undefined
: Initial value
bit15
bit12
CMOD1 CMOD0
Output level inversion mode select bits
0
0
0
1
Set the condition for inverting the pin output
level. For details, see Table 13.3-9.
1
0
1
1
n = 0, 2, 4, 6 m = n+1
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
267
CHAPTER 13 16-BIT I/O TIMER
13.3 Configuration of 16-bit I/O Timer
MB90340E Series
Table 13.3-8 Functions of Output Compare Control Status Register (OCS) (Upper)
Bit name
Function
bit15,
bit12
CMOD1, CMOD0:
Output level inversion mode
select bits
These bits set the compare match detection condition for inverting the pin output level.
• Table 13.3-9 lists the output level inversion modes and compare match detection
conditions.
bit14,
bit13
Undefined bits
When read : The bits contain indeterminate values.
When written : The bits have no effect.
bit11
OTEm:
Compare output enable bit m
This bit enables the output of output compare pin OUTm.
Setting the bit to "1": Assigns the pin as an output compare output pin.
Setting the bit to "0": Assigns the pin as a general-purpose I/O port.
bit10
OTEn:
Compare output enable bit n
This bit enables the output of output compare pin OUTn.
Setting the bit to "1": Assigns the pin as an output compare output pin.
Setting the bit to "0": Assigns the pin as a general-purpose I/O port.
OTDm:
Output level setting bit m
This bit sets the output level of the OUTm pin.
• When output compare pin output is enabled (OCS: OTEm=1), the "L" or "H" level set by
the OTDm bit is output at the OUTm pin.
• Set the OTDm bit while output comparison is stopped (OCS: CSTm=0).
When read: The bit returns the output level of the OUTm pin.
OTDn:
Output level setting bit n
This bit sets the output level of the OUTn pin.
• When output compare pin output is enabled (OCS: OTEn=1), the "L" or "H" level set by
the OTDn bit is output at the OUTn pin.
• Set the OTDn bit while output comparison is stopped (OCS: CSTn=0).
When read: The bit returns the output level of the OUTn pin.
bit9
bit8
n = 0, 2, 4, 6 m = n+1
268
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 13 16-BIT I/O TIMER
13.3 Configuration of 16-bit I/O Timer
MB90340E Series
Table 13.3-9 Output Level Inversion Mode and Compare Match Detection
Controlled
register
name
Output level
inversion mode
CMOD1
CMOD0
X
0
Output
inverted pin
name
Compared register name
Output
inverted pin
name
Free-run timer 0:
OCCP1
X
1
Free-run timer 0:
OCCP0
Free-run timer 0:
OCCP1
0
0
Free-run timer 0:
OCCP3
OCS1
OUT0
Free-run timer 0: OCCP0
OUT1
Free-run timer 0:
OCCP2
Free-run timer 0:
OCCP3
Free-run timer 0: OCCP2
0
1
OCS3
OUT2
1
OUT3
0
Free-run timer 0: OCCP0
Free-run timer 0: OCCP2
1
1
X
0
Free-run timer 1:
OCCP5
X
1
Free-run timer 1:
OCCP4
Free-run timer 1:
OCCP5
0
0
Free-run timer 1:
OCCP7
OUT4
Free-run timer 1: OCCP4
OUT5
Free-run timer 1:
OCCP6
Free-run timer 1:
OCCP7
Free-run timer 1: OCCP6
0
1
1
0
OUT6
OUT7
Free-run timer 1: OCCP4
Free-run timer 1: OCCP6
1
CM44-10143-5E
Free-run timer 0:
OCCP0
Free-run timer 0:
OCCP3
Free-run timer 0:
OCCP0Free-run timer
0: OCCP2
Free-run timer 0:
OCCP3
OCS5
OCS7
Compared register
name
1
FUJITSU SEMICONDUCTOR LIMITED
Free-run timer 1:
OCCP4
Free-run timer 1:
OCCP7
Free-run timer 1:
OCCP4
Free-run timer 1:
OCCP6
Free-run timer 1:
OCCP7
269
CHAPTER 13 16-BIT I/O TIMER
13.3 Configuration of 16-bit I/O Timer
13.3.8
MB90340E Series
Output Compare Control Status Register (OCS) (Lower)
This section describes the functions of the output compare control status register.
OCS0, OCS2, OCS4, and OCS6 correspond to output pins and channels as follows:
OCS0: Output compare ch.0, ch.1
OCS2: Output compare ch.2, ch.3
OCS4: Output compare ch.4, ch.5
OCS6: Output compare ch.6, ch.7
■ Output Compare Control Status Register (OCS) (Lower)
Figure 13.3-8 Output Compare Control Status Register (OCS) (Lower)
Address
OCS0: 000058H
OCS2: 00005AH
OCS4: 00005CH
OCS6: 00005EH
7
6
5
4
3
2
1
0
IOPm IOPn IOEm IOEn
CSTm CSTn
R/W R/W R/W R/W
R/W R/W
Initial value
0000XX00B
bit0
CSTn
Compare operation enable bit n
0
Disables operation of output compare ch n.
1
Enables operation of output compare ch n.
bit1
CSTm
Compare operation enable bit m
0
Disables operation of output compare ch m.
1
Enables operation of output compare ch m.
bit4
IOEn
Compare match interrupt enable bit n
0
Disables output compare ch n interrupts.
1
Enables output compare ch n interrupts.
bit5
IOEm
Compare match interrupt enable bit m
0
Disables output compare ch m interrupts.
1
Enables output compare ch m interrupts.
bit6
IOPn
0
1
Compare match flag bit n
When read
When written
Detects no compare match
Clears this IOPn bit.
of output compare ch n.
Detects a compare match
No effect
of output compare ch n.
bit7
IOPm
R/W : Readable/writable
: Undefined
X
: Undefined
: Initial value
0
1
Compare match flag bit m
When read
When written
Detects no compare match
Clears this IOPm bit.
of output compare ch m.
Detects a compare match of
No effect
output compare ch m.
n = 0, 2, 4, 6 m = n+1
270
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
MB90340E Series
CHAPTER 13 16-BIT I/O TIMER
13.3 Configuration of 16-bit I/O Timer
Table 13.3-10 Functions of Output Compare Control Status Register (OCS) (Lower)
Bit name
Function
IOPm:
Compare match flag bit m
This bit is set to "1" when the value of output compare register m matches the counter value of
the corresponding 16-bit free-run timer.
• If compare match interrupt requests have been enabled (OCS:IOEm=1), an interrupt
request is generated when the IOPm bit is set to "1".
Setting the bit to "0": Clears the flag.
Setting the bit to "1": Has no effect.
Notes:
• If setting of this bit to "1" and writing "0" occur at the same time, "0" is written.
• When read by a read-modify-write instruction, the bit always returns "1".
bit6
IOPn:
Compare match flag bit n
This bit is set to "1" when the value of output compare register n matches the counter value of
the corresponding 16-bit free-run timer.
• If compare match interrupt requests have been enabled (OCS:IOEn=1), an interrupt request
is generated when the IOPn bit is set to "1".
Setting the bit to "0": Clears the flag.
Setting the bit to "1": Has no effect.
Notes:
• If setting of this bit to "1" and writing "0" occur at the same time, "0" is written.
• When read by a read-modify-write instruction, the bit always returns "1".
bit5
IOEm:
Compare match interrupt
enable bit m
This bit enables or disables interrupt requests to be generated when the value of output
compare register m matches the counter value of the corresponding 16-bit free-run timer.
Setting the bit to "1": Generates an interrupt request when compare match flag bit m
(OCS:IOPm) is set to "1".
bit4
IOEn:
Compare match interrupt
enable bit n
This bit enables or disables interrupt requests to be generated when the value of output
compare register n matches the counter value of the corresponding 16-bit free-run timer.
Setting the bit to "1": Generates an interrupt request when compare match flag bit n
(OCS:IOPn) is set to "1".
bit3,
bit2
Undefined bits
When read : The bits contain indeterminate values.
When written : The bits have no effect.
CSTm:
Compare operation enable
bit m
This bit enables or disables comparison of output compare ch m.
Setting the bit to "0": Disables comparison.
Setting the bit to "1": Enables comparison.
Note:
When a 16-bit free-run timer is stopped (TCCSL:STOP=1), the operation of the
corresponding output compare channel is stopped.
CSTn:
Compare operation enable
bit n
This bit enables or disables comparison of output compare ch n.
Setting the bit to "0": Disables comparison.
Setting the bit to "1": Enables comparison.
Note:
When a 16-bit free-run timer is stopped (TCCSL:STOP=1), the operation of the
corresponding output compare channel is stopped.
bit7
bit1
bit0
n = 0, 2, 4, 6, m = n+1
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
271
CHAPTER 13 16-BIT I/O TIMER
13.3 Configuration of 16-bit I/O Timer
13.3.9
MB90340E Series
Output Compare Registers (OCCP0 to OCCP7)
Output compare registers contain values to be compared with the counter value of the
16-bit free-run timer.
• There are eight channels: output compare registers 0 to 7 (OCCP0 to OCCP7).
■ Output Compare Registers (OCCP0 to OCCP7)
Figure 13.3-9 Output Compare Registers (OCCP0 to OCCP7)
Address
bit15 bit14 bit13 bit12 bit11 bit10 bit9
OCCP0 (upper): 007931H
C15 C14
C13
C12 C11
bit8
C10 C09 C08
Initial value
XXXXXXXXB
R/W R/W R/W R/W R/W R/W R/W R/W
bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0
OCCP0 (lower): 007930H
C07 C06
C05
C04 C03 C02
C01 C00
XXXXXXXXB
R/W R/W R/W R/W R/W R/W R/W R/W
bit15 bit14 bit13 bit12 bit11 bit10 bit9
OCCP1 (upper): 007933H
C15 C14
C13
C12 C11
bit8
C10 C09 C08
XXXXXXXXB
R/W R/W R/W R/W R/W R/W R/W R/W
bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0
OCCP1 (lower): 007932H
C07 C06
C05
C04 C03
C02
C01 C00
XXXXXXXXB
R/W R/W R/W R/W R/W R/W R/W R/W
bit15 bit14 bit13 bit12 bit11 bit10 bit9
OCCP2 (upper): 007935H
OCCP2 (lower): 007934H
C15 C14
C13
C12 C11
bit8
C10 C09 C08
XXXXXXXXB
R/W R/W R/W R/W R/W R/W R/W R/W
bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0
C07 C06
C05
C04 C03
C02
C01 C00
XXXXXXXXB
R/W R/W R/W R/W R/W R/W R/W R/W
bit15 bit14 bit13 bit12 bit11 bit10 bit9
OCCP3 (upper): 007937H
C15 C14
C13
C12 C11
bit8
C10 C09 C08
XXXXXXXXB
R/W R/W R/W R/W R/W R/W R/W R/W
bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0
OCCP3 (lower): 007936H
C07 C06
C05
C04 C03
C02
C01 C00
XXXXXXXXB
R/W R/W R/W R/W R/W R/W R/W R/W
R/W : Readable/writable
X
: Undefined
(Continued)
272
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 13 16-BIT I/O TIMER
13.3 Configuration of 16-bit I/O Timer
MB90340E Series
(Continued)
Address
bit15 bit14 bit13 bit12 bit11 bit10 bit9
OCCP4 (upper): 007939H
C15 C14
C13
C12 C11
bit8
C10 C09 C08
Initial value
XXXXXXXXB
R/W R/W R/W R/W R/W R/W R/W R/W
bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0
OCCP4 (lower): 007938H
C07 C06
C05
C04 C03 C02
C01 C00
XXXXXXXXB
R/W R/W R/W R/W R/W R/W R/W R/W
bit15 bit14 bit13 bit12 bit11 bit10 bit9
OCCP5 (upper): 00793BH
C15 C14
C13
C12 C11
bit8
C10 C09 C08
XXXXXXXXB
R/W R/W R/W R/W R/W R/W R/W R/W
bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0
OCCP5 (lower): 00793AH
C07 C06
C05
C04 C03
C02
C01 C00
XXXXXXXXB
R/W R/W R/W R/W R/W R/W R/W R/W
bit15 bit14 bit13 bit12 bit11 bit10 bit9
OCCP6 (upper): 00793DH
C15 C14
C13
C12 C11
bit8
C10 C09 C08
XXXXXXXXB
R/W R/W R/W R/W R/W R/W R/W R/W
bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0
OCCP6 (lower): 00793CH
C07 C06
C05
C04 C03
C02
C01 C00
XXXXXXXXB
R/W R/W R/W R/W R/W R/W R/W R/W
bit15 bit14 bit13 bit12 bit11 bit10 bit9
OCCP7 (upper): 00793FH
C15 C14
C13
C12 C11
bit8
C10 C09 C08
XXXXXXXXB
R/W R/W R/W R/W R/W R/W R/W R/W
bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0
OCCP7 (lower): 00793EH
C07 C06
C05
C04 C03
C02
C01 C00
XXXXXXXXB
R/W R/W R/W R/W R/W R/W R/W R/W
R/W : Readable/writable
X
: Undefined
Output compare register values are compared with the counter value of the free-run timer. When a match is
detected, the level at the output compare output pin is inverted and an interrupt request is generated.
After a release from a reset, the values of output compare registers are indeterminate. Before enabling
comparison, set the registers to the values to be compared. (OCS: CST=1)
Note:
To read from or write to output compare registers, be sure to use a word instruction (MOVW).
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
273
CHAPTER 13 16-BIT I/O TIMER
13.4 Interrupts from 16-bit I/O Timer
13.4
MB90340E Series
Interrupts from 16-bit I/O Timer
• An interrupt from the 16-bit I/O timer is triggered by the occurrence of an overflow
from the counter of the 16-bit free-run timer, the input of a trigger edge to an input
capture input pin, the input of a trigger edge for LIN slave baud rate measurement
from the LIN-UART, or the detection of an output compare match.
• An interrupt via an input capture channel (other than ch.6 and ch.7) or output compare
channel can be used to activate DMA transfer or Extended Intelligent I/O Service
(EI2OS). An interrupt via an input capture channel (ch.6 or ch.7) can be used to
activate EI2OS.
■ Interrupts from 16-bit I/O Timer
Table 13.4-1 lists the interrupt control bits and interrupt trigger events of the 16-bit I/O timer.
Table 13.4-1 Interrupts from 16-bit I/O Timer
Timer counter overflow
interrupt
Input capture interrupt
Output compare interrupt
Interrupt request flag
TCCSL: IVF
ICSnm: ICPn, ICPm
OCSn: IOPn, IOPm
Interrupt request output
enable bit
TCCSL: IVFE
ICSnm: ICEn, ICEm
OCSn: IOEn, IOEm
Interrupt generation triggers
16-bit free-run timer
counter overflow
Input of valid edge to input capture input
pin, and input of trigger edge for LIN
slave baud rate measurement from LINUART
Match of output compare
register value with counter
value
n = 0, 2, 4, 6 m = n+1
● Timer counter overflow interrupt
Case in which the timer overflow interrupt request flag is set
The timer overflow generation flag is set in the timer control status register in either of the following cases.
(TCCSL: IVF=1)
• The 16-bit free-run timer is incremented to cause an overflow (FFFFH →0000H).
• A compare match as shown below is detected when clearing by a compare match has been enabled
(TCCSL: MODE=1):
- The value of output compare register 0 matches the value of 16-bit free-run timer 0.
- The value of output compare register 4 matches the value of 16-bit free-run timer 1.
Case in which a timer overflow interrupt request is generated
An interrupt request is generated when the timer overflow generation flag is set to "1" (TCCSL: IVF=1)
with timer overflow interrupt requests enabled (TCCSL: IVFE=1).
274
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 13 16-BIT I/O TIMER
13.4 Interrupts from 16-bit I/O Timer
MB90340E Series
● Input capture interrupt
An interrupt is generated as follows when a selected valid edge (ICS: EG) is detected at an input capture
pin or when the trigger edge for LIN slave baud rate measurement is input from the LIN-UART (assuming
that both edges have been selected as valid edges).
• Upon edge detection, the current counter value of the 16-bit free-run timer is held in the input capture
register.
• The valid edge detection flag in the input capture control status register is set to "1". (ICS: ICP=1)
• An interrupt request is generated if the output of input capture interrupt requests has been enabled (ICS:
ICE=1).
● Output compare interrupt
An interrupt is generated as follows when a match is detected between the value of an output compare
register and the counter value of the 16-bit free-run timer.
• The output compare match flag in the output compare control status register is set to "1". (OCS:IOP=1)
■ 16-bit I/O
• An interrupt request is generated if output compare interrupt requests have been enabled (OCS: IOE=1).
Timer Interrupts and EI2OS
Reference:
See "CHAPTER 3 INTERRUPTS" for interrupt numbers, interrupt control registers, and
interrupt vector addresses.
■ Support for DMA Transfer and EI2OS Features
The input capture units (other than ch.6 and ch.7) and the output compare units (all channels) support DMA
transfer and EI2OS features.
The input capture channels (ch.6, ch.7) support only the EI2OS feature.
Note, however, that other interrupts sharing the interrupt control register (ICR) must be disabled before the
DMA or EI2OS feature can be used.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
275
CHAPTER 13 16-BIT I/O TIMER
13.5 Operations of 16-bit Free-run Timer
13.5
MB90340E Series
Operations of 16-bit Free-run Timer
The 16-bit free-run timer increments its counter from 0000H after a release from a reset.
The counter value of the 16-bit free-run timer is used as the base time for the output
compare and input capture units.
■ Operations of 16-bit Free-run Timer
The 16-bit free-run timer must be set as shown in Figure 13.5-1 so that it can operate.
Figure 13.5-1 Settings for 16-bit Free-run Timer
bit15 14
13
12
11
10
9
bit8 bit7
5
4
3
2
1
bit0
IVF IVFE STOP MODE CLR CLK2 CLK1 CLK0
TCCSH/TCCSL ECKE
×
TCDT
6
×
×
×
×
×
×
0
0
Counter value of 16-bit free-run timer
: Used bit
× : Undefined bit
0 : Set to "0"
[Setting the counter value of the 16-bit free-run timer]
• As the 16-bit free-run timer is enabled for operation after a release from a reset (TCCSL: STOP=0), it is
incremented from a counter value of 0000H.
• To set the counter value of the 16-bit free-run timer, disable the operation of the 16-bit free-run timer
(TCCSL: STOP=1), set the count start value in the timer data register, then enable timer operation
(TCCSL: STOP=0).
[Generation of a timer overflow and an interrupt request]
• When the 16-bit free-run timer causes an overflow (FFFFH →0000H), the timer overflow generation flag
is set to "1" (TCCSL: IVF) and the counter is incremented starting from 0000H.
• An interrupt request is generated if timer overflow interrupt requests have been enabled (TCCSL:
IVFE=1).
276
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 13 16-BIT I/O TIMER
13.5 Operations of 16-bit Free-run Timer
MB90340E Series
[Clearing sources and timings for clearing the counter value]
• Table 13.5-1 lists the trigger events and timings for clearing the 16-bit free-run timer.
Table 13.5-1 Clearing Sources and Timings for Clearing the Counter Value
Clearing source
Clearing timing
Writing "1" to the timer clear bit in the timer control status register
(TCCSL: CLR)
Synchronous with the occurrence of the trigger event
Writing 0000H to an inactive timer data register
Synchronous with the occurrence of the trigger event
Occurrence of a reset
Synchronous with the occurrence of the trigger event
Occurrence of a timer overflow
Synchronous with count timing
Occurrence of a compare match (TCCSL: MODE=1)
Synchronous with count timing
• If you enable the clearing on occurrence of a compare match (TCCSL: MODE=1), the compare match
flag is set to "1" (OCS: IOP) when a compare match as shown below is detected. At the same time, the
counter value is cleared to 0000H and the counter is incremented.
- The value of output compare register 0 matches the value of 16-bit free-run timer 0.
- The value of output compare register 4 matches the value of 16-bit free-run timer 1.
Figure 13.5-2 shows the timing of clearing the counter when a match with a compare register is detected.
Figure 13.5-2 16-bit Free-run Timer Clear Timing
φ
Count clock
Compare match
Counter value
Compare register
value
φ: Machine clock
CM44-10143-5E
N-1
0000H
N
N
Counter cleared
FUJITSU SEMICONDUCTOR LIMITED
277
CHAPTER 13 16-BIT I/O TIMER
13.5 Operations of 16-bit Free-run Timer
MB90340E Series
Figure 13.5-3 shows the clearing of the counter on occurrence of an overflow.
Figure 13.5-3 Clearing the Counter upon Overflow
Counter value
Overflow
FFFFH
BFFFH
7FFFH
3FFFH
0000H
Time
Reset
Figure 13.5-4 shows the clearing of the counter on occurrence of a match with a compare register.
Figure 13.5-4 Clearing the Counter upon Detection of a Compare Match
Counter value
FFFFH
BFFFH
Match
Match
7FFFH
3FFFH
0000H
Time
Reset
Compare
register value
278
BFFFH
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 13 16-BIT I/O TIMER
13.6 Input Capture Operations
MB90340E Series
13.6
Input Capture Operations
Upon detection of the valid edge of an input signal from an external input pin or upon
input of the trigger edge for LIN slave baud rate measurement from the LIN-UART, the
input capture unit stores the counter value of the 16-bit free-run timer in the input
capture register and generates an interrupt request.
■ Input Capture Operations
The input capture unit must be set as shown in Figure 13.6-1 so that it can be used.
Figure 13.6-1 Settings for Input Capture Operation
bit15 14
13
ICE/ICS
×
×
×
12
11
10
ICUS1/
ICUS0/
ICUS61
ICUS7
ICUS60
9
bit8 bit7
6
5
4
3
2
1
bit0
IEIm IEIn ICPm ICPn ICEm ICEn EGm1EGm0 EGn1 EGn0
Holding the capture counter value
IPCP
DDR port
direction register
Set that bit to "0" which corresponds to the
pin to be used as a capture input pin.
: Used bit (Set the bits corresponding to the channels to be used.)
: Used bit (These bits exist only in ICE01 and ICE67. Set the bits for baud rate measurement in LIN
slave mode.)
n = 0, 2, 4, 6 m = n+1
[Input capture operations]
The following operations are performed when the selected valid edge (ICS: EG) is detected at an input
capture pin or when the trigger edge for LIN slave baud rate measurement is input from the LIN-UART:
• Upon detection, the current counter value of the 16-bit free-run timer is held in the input capture
register.
• The direction of the detected edge is held in the detected edge display bit. (Rising edge: IEI=1, falling
edge: IEI=0)
• The valid edge detection flag in the input capture control status register is set to "1". (ICS:ICP=1)
• An interrupt request is generated when input capture interrupt requests have been enabled (ICS: ICE=1).
• To measure the baud rate in LIN slave mode, set the LIN-UART as the input signal source (ICE: ICUS),
enable input capture interrupt requests (ICS: ICE=1), and select both edges as valid edges (ICE: EG1,
EG0=11B). For calculation of the baud rate, see Section "20.7.3 Operation of LIN Function (Operating
Mode 3)".
Figure 13.6-2 shows the timing of data capturing by the input capture unit. Figure 13.6-3 shows the input
capture operations with the rising edge/falling edge set as the valid edge. Figure 13.6-4 shows the input
capture operations with both edges set as valid edges.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
279
CHAPTER 13 16-BIT I/O TIMER
13.6 Input Capture Operations
MB90340E Series
Figure 13.6-2 Timing of Data Capturing by Input Capture Unit
φ
Counter value
N
N+1
Input capture input
Valid edge
Capture signal
Capture register
N+1
Data captured
φ: Machine clock
Figure 13.6-3 Input Capture Operations (Rising Edge/Falling Edge)
Counter value
FFFFH
BFFFH
7FFFH
3FFFH
Time
0000H
Reset
INn (Rising edge)
INm (Falling edge)
Capture n
Undefined
Capture m
Undefined
3FFFH
7FFFH
n = 0, 2, 4, 6 m = n+1
Figure 13.6-4 Input Capture Operations (Both Edges)
Counter value
FFFFH
BFFFH
7FFFH
3FFFH
0000H
Time
Reset
INn (Both edges)
Capture example
Undefined
BFFFH
3FFFH
n = 0 to 7
280
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 13 16-BIT I/O TIMER
13.7 Output Compare Operations
MB90340E Series
13.7
Output Compare Operations
The output compare unit compares the set compare value with the counter value of the
16-bit free-run timer. When a match is detected, it inverts the output level at the output
compare pin and generates an interrupt request.
■ Output Compare Operations
The output compare unit must be set as shown in Figure 13.7-1 so that it can be used.
Figure 13.7-1 Settings for Output Compare Operations
bit15 14
13
12
11
10
9
bit8 bit7
6
5
4
3
2
×
×
1
bit0
CSTm CSTn
CMOD0 OTEm OTEn OTDm OTDn IOPm IOPn IOEm IOEn
OCSm/OSCn CMOD1
×
×
Set the value to compare.
OCCP
: Used bit
: Undefined bit
× : Set that bit to "1" which corresponds to the output compare pin to be used.
n = 0, 2, 4, 6 m = n+1
[Output compare operations]
• The output compare unit compares the output compare register value with the counter value of the 16bit free-run timer. When a match is detected, it performs the following operations:
- The level at the output compare output pin is inverted.
- The output compare match flag in the output compare control status register is set to "1". (OCS:IOP=1)
- An interrupt request is generated if output compare interrupt requests have been enabled (OCS:
IOE=1).
[Output level setting and inversion timing]
• The output level at the output compare pin can be set by the output level setting bit (OCS: OTD) in the
output compare control status register.
• When a compare match is detected, the output level is inverted in synchronization with the count timing
of the 16-bit free-run timer.
• Comparison with the counter value of the 16-bit free-run timer is not performed while the output
compare register is being updated.
Note:
Avoid simultaneous occurrence of comparison result match when rewriting the compare register.
Execute this action within a compare interrupt routine, or while the compare operation is stopped.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
281
CHAPTER 13 16-BIT I/O TIMER
13.7 Output Compare Operations
MB90340E Series
Figure 13.7-2 to Figure 13.7-4 show output compare operations.
Figure 13.7-2 Output Compare Timing
φ
Counter value
N
N+1
Compare register
value
N
Compare match
φ: Machine clock
Figure 13.7-3 Inversion of the Output Level at Output Compare Output Pin
Counter value
N
N+1
N
Compare register
value
N+1
N
Compare match signal
Output pin
Figure 13.7-4 Compare Operations with Output Compare Register Being Updated
Counter value
N
N+1
N+2
N+3
No match signal generated
Value of compare register 0
M
N+1
Write to compare register 0
Value of compare register 1
M
N+3
Write to compare register 1
Compare 0 stopped
282
FUJITSU SEMICONDUCTOR LIMITED
Compare 1 stopped
CM44-10143-5E
CHAPTER 13 16-BIT I/O TIMER
13.7 Output Compare Operations
MB90340E Series
● Output inversion using two or three compare registers
Depending on the settings of the output level inversion mode select bits (OCS: CMOD1, CMOD0), the
output level at the OUT pin (other than OUT0 and OUT4) can be inverted when a compare match occurs
on any of up to three output compare channels.
See Table 13.3-9 for the settings of the output level inversion mode select bits and relevant pin output level
inversion triggers.
Figure 13.7-5 shows a sample waveform to be output when the output level at the OUT (m) pin is inverted
upon detection of a match between output compare ch (n) and output compare ch (m).
Figure 13.7-5 Output Compare Sample Output Waveform
Counter value
FFFFH
BFFFH
7FFFH
3FFFH
Time
0000H
Reset
Value of compare
register (n)
BFFFH
Value of compare
register (m)
7FFFH
Corresponding
to compare (n)
OUT(n)
Corresponding to compare
(n) and compare (m)
OUT (m)
n = 0, 2, 4, 6
CM44-10143-5E
m = n+1
FUJITSU SEMICONDUCTOR LIMITED
283
CHAPTER 13 16-BIT I/O TIMER
13.8 Notes on Using the 16-bit I/O Timer
13.8
MB90340E Series
Notes on Using the 16-bit I/O Timer
Pay attention to the following points in using the 16-bit I/O timer.
■ Notes on Using the 16-bit I/O Timer
● Note on enabling output comparison
When the 16-bit free-run timer stops counting, the output compare operation is stopped as well because the
output compare operation is synchronous with the clock of the 16-bit free-run timer.
Before enabling output comparison (OCS: CST=1), therefore, enable the timer operation of the 16-bit freerun timer (TCCSL: STOP=0).
● Notes on setting the 16-bit free-run timer
• Do not update the count clock select bits (TCCSL: CLK2 to CLK0) during operation of the 16-bit freerun timer (TCCSL: STOP=0).
• The counter value of the 16-bit free-run timer is initialized to 0000H at a reset.
• Before setting the counter value by directly writing it to the timer data register (TCDT), stop the 16-bit
free-run timer (TCCSL: STOP=1).
• To write to the TCDT, be sure to use a word instruction.
● Operation delay owing to synchronization
As the input capture and output compare units are synchronous with the operating clock, they involve a
delay in operation time. The input capture unit captures data in synchronization with the machine clock
after detecting the trigger signal from the pin. The output compare unit performs comparison in
synchronization with the count clock of the free-run timer.
● Delay in match detection owing to the updating of the output compare register
If a match with the counter value of the 16-bit free-run timer is detected with the output compare register
being updated, the match detection is nullified.
In advance, read and check the count value of the free-run timer or clear the free-run timer to 0000H.
284
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 13 16-BIT I/O TIMER
13.9 Sample Programs for 16-bit I/O Timer
MB90340E Series
13.9
Sample Programs for 16-bit I/O Timer
This section provides sample programs for the 16-bit I/O timer.
■ Sample Program for 16-bit I/O Timer
● Processing specifications
• Measure the cycle of the signal to be input to the IN0 pin.
• Use 16-bit free-run timer 0 and input capture 0.
• Select the rising edge as the trigger edge to be detected.
• Set machine clock (φ) to 24 MHz and select 4/φ (0.17 μs) as the count clock of the free-run timer.
• Use the timer overflow interrupt and the capture interrupt of input capture 0.
• Count free-run timer overflow interrupts to be used for cycle calculation.
• Cycle can be calculated as follows:
Cycle = (overflow count × 10000H + N-th IPCP0 value - (N-1)-th IPCP0 value) × count clock cycle
= (overflow count × 10000H + N-th IPCP0 value - (N-1)-th IPCP0 value) × 0.17 μs
● Coding example
ICR09
ICR11
DDR2
TCCSL
TCDT
ICS01
IPCP0
IVF0
ICP0
DATA
EQU
EQU
EQU
EQU
EQU
EQU
0000B9H
0000BBH
000012H
007942H
007940H
000050H
;Interrupt control register
;Interrupt control register
;Port-2 direction data register
;Timer control status register
;Timer data register
;Input capture control status register
;Status register
;Input capture register 0
;Timer overflow generation flag bit
;Valid edge detection flag bit
EQU
007920H
EQU
TCCSL:7
EQU
ICS01:6
DSEG ABS=00H
ORG
0100H
OV_CNT RW
1H
DATA
ENDS
;Overflow counter
;
;---------Main program--------------------------------------------CODE
CSEG
START:
;
;Initialize resources such as the stack
;pointer (SP) in advance.
AND
CCR,#0BFH
;Disable interrupts.
MOV
I:ICR09,#00H
;Interrupt level 0 (Highest)
MOV
I:ICR11,#00H
;Interrupt level 0 (Highest)
MOV
I:DDR2,#00000000B ;Set the port-2 direction.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
285
CHAPTER 13 16-BIT I/O TIMER
13.9 Sample Programs for 16-bit I/O Timer
MOV
MOV
MOV
OR
MB90340E Series
I:TCCSL,#01001010B ;Enable counting and clear the counter;
;Enable overflow interrupts;
;Select count clock 4/φ and clear the
;counter.
I:ICS01,#00010001B ;Select the IN0 pin. External trigger.
;Set IPCP0 to select the rising edge.
;Set IPCP1 to select no edge detection.
;Clear each valid edge detection flag.
;Enable input capture interrupt requests.
ILM,#07H
;Set PS's ILM to level 7.
CCR,#40H
;Enable interrupts.
LOOP:
•
User processing
•
BRA
LOOP
;---------Interrupt program----------------------------------------WARI0:
CLRB I:ICP0
;Clear the valid edge detection flag.
•
;Save the OV-CNT and input capture values.
User processing
•
MOV
A,0
;Clear the overflow counter
MOV
OV_CNT,A
;for the next cycle measurement.
RETI
;Return from the interrupt service.
WARI1:
CLRB I:IVF0
;Clear the timer overflow generation flag.
INC
OV_CNT
;Increment the overflow counter.
•
User processing
•
RETI
;Return from the interrupt service.
CODE
ENDS
;---------Vector setting------------------------------------------VECT
CSEG ABS=0FFH
ORG
00FF78H
;Set a vector at interrupt No. #33 (21H).
;(Input capture)
DSL
WARI0
ORG
00FF84H
;Set a vector at interrupt No. #30 (1EH).
;(Overflow)
DSL
WARI1
ORG
00FFDCH
;Set a reset vector.
DSL
START
DB
00H
;Set single-chip mode.
VECT
ENDS
END
START
286
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 13 16-BIT I/O TIMER
13.9 Sample Programs for 16-bit I/O Timer
MB90340E Series
■ Sample Program for Output Compare Unit
● Processing specifications
• Use 16-bit free-run timer 0 and output compare 0.
• Use an output compare value of 5555H, OUT0 pin, and OCCP0 register.
• Invert the pin output level upon detection of a compare match and generate an interrupt at the same
time.
• Set machine clock (φ) to 24 MHz and select 4/φ (0.17 μs) as the count clock for the 16-bit free-run timer.
● Coding example
ICR10 EQU
0000BAH
;Interrupt control register
TCCS
EQU
007942H
;Timer control status register
TCDT
EQU
007940H
;Timer data register
OCS0
EQU
000058H
;Output compare control status register
OCS1
EQU
000059H
;Output compare control status register
OCCP0 EQU
007930H
;Output compare register
IOP0
EQU
OCS0:6
;Compare match flag bit
;
;---------Main program--------------------------------------CODE
CSEG
START:
;
;Initialize resources such as the stack
;pointer (SP) in advance.
AND
CCR,#0BFH
;Disable interrupts
MOV
I:ICR10,#00H
;Interrupt level 0 (Highest)
MOV
I:TCCSL,#00001010B ;Enable counting and clear the counter.
;Disable overflow interrupts; Select count
;clock 4/φ.
MOVW I:OCCP0,#5555H
;Set the compare register.
MOV
I:OCS0,#00010001B ;Clear the compare match flag; Enable the
;operation of output compare 0.
MOV
I:OCS1,#00000100B ;Enable the output of output compare 0; Set
;the pin output level to "L".
MOV
ILM,#07H
;Set PS's ILM to level 7.
OR
CCR,#40H
;Enable interrupts.
LOOP:
•
User processing
•
BRA
LOOP
;---------Interrupt program---------------------------------WARI:
CLRB I:IOP0
;Clear the compare match flag.
•
User processing
•
RETI
;Return from the interrupt service.
CODE
ENDS
;---------Vector setting------------------------------------VECT
CSEG ABS=0FFH
ORG
00FF7CH
;Set a vector at interrupt No. #32 (20H).
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
287
CHAPTER 13 16-BIT I/O TIMER
13.9 Sample Programs for 16-bit I/O Timer
VECT
288
DSL
ORG
DSL
DB
ENDS
END
WARI
00FFDCH
START
00H
MB90340E Series
;Set a reset vector.
;Set single-chip mode.
START
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 14
16-BIT RELOAD TIMERS
This chapter describes the functions and operations of
16-bit reload timers.
14.1 Overview of 16-bit Reload Timers
14.2 Block Diagram of 16-bit Reload Timer
14.3 Configuration of 16-bit Reload Timers
14.4 Interrupts of 16-bit Reload Timers
14.5 Operations of 16-bit Reload Timers
14.6 Notes on Using 16-bit Reload Timers
14.7 Sample Programs for 16-bit Reload Timers
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
289
CHAPTER 14 16-BIT RELOAD TIMERS
14.1 Overview of 16-bit Reload Timers
14.1
MB90340E Series
Overview of 16-bit Reload Timers
The 16-bit reload timer has the following features:
• Allowing the count clock to be selected from among three types of internal clocks and
an external event clock.
• Capable of selecting a software trigger or external trigger as the activation trigger.
• Capable of generating an interrupt to the CPU when the 16-bit timer register
underflows; therefore available as an interval timer using an interrupt.
• Offering a choice of two different modes for use when the 16-bit timer register (TMR)
underflows. One is one shot mode that causes the TMR register to stop counting and
the other is reload mode that allows the TMR to continue counting with the 16-bit
reload register value reloaded.
• Supporting extended intelligent I/O service (EI2OS, for all of the 4 channels) and DMA
transfer (16-bit reload timers 0 to 2 only).
• The MB90340E series contains four channels of 16-bit reload timers.
■ 16-bit Reload Timer Operation Mode
Table 14.1-1 shows the operation modes of the 16-bit reload timer.
Table 14.1-1 16-bit Reload Timer Operation Modes
Count clock
Activation trigger
Operation when an underflow
occurs
Internal clock mode
Software trigger
External trigger
One shot mode
Reload mode
Event count mode
Software trigger
One shot mode
Reload mode
■ Internal Clock Mode
• Setting the count clock select bits in the timer control status register (TMCSR:CSL1, CSL0) to 00B,
01B, or 10B places the 16-bit reload timer in internal clock mode.
• In internal clock mode, the 16-bit reload timer counts down in synchronization with the internal clock.
• The count clock select bits in the timer control status register (TMCSR:CSL1, CSL0) can be used to
select one of the three different count clock cycles.
• The activation trigger is the software trigger or external trigger set for edge detection.
290
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 14 16-BIT RELOAD TIMERS
14.1 Overview of 16-bit Reload Timers
MB90340E Series
■ Event Count Mode
• Setting the count clock select bits in the timer control status register (TMCSR:CSL1, CSL0) to 11B
places the 16-bit reload timer in event count mode.
• In event count mode, the 16-bit reload timer is decremented in synchronization with edge detection of
the external event clock input to the TIN pin.
• The activation trigger is the software trigger.
• The 16-bit reload timer can be used as an interval timer using an external clock signal of a fixed period.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
291
CHAPTER 14 16-BIT RELOAD TIMERS
14.1 Overview of 16-bit Reload Timers
MB90340E Series
■ Operation when an Underflow Occurs
When the activation trigger is input, the value set in the 16-bit reload register is reloaded into the 16-bit
timer register and the 16-bit reload timer starts being decrementing in synchronization with the count clock.
An underflow occurs when the 16-bit timer register is decremented from 0000H to FFFFH.
• An underflow interrupt occurs when an underflow occurs with underflow interrupts enabled
(TMCSR:INTE=1).
• The operation to be performed by the 16-bit reload timer when an underflow occurs is set by the reload
select bit in the timer control status register (TMCSR:RELD).
[One shot mode (TMCSR:RELD=0) ]
When an underflow occurs in this mode, the16-bit timer register (TMR) stops counting. When the next
activation trigger is input, the TMR register is reloaded with the value set in the 16-bit reload register
(TMRLR) to start counting.
• In one shot mode, the TOT0 to TOT3 pins output "H" or "L" level rectangular waves while the 16-bit
timer register is counting.
• The rectangular wave level ("H" or "L") can be set by the pin output level select bit in the timer control
status register (TMCSR:OUTL).
[Reload mode (TMCSR:RELD=1) ]
When an underflow occurs in this mode, the 16-bit timer register (TMR) is reloaded with the value set in
the 16-bit reload register and continues counting.
• In reload mode, a toggle wave is output each time the TMR register underflows during counting. The
toggle wave inverts the TOT pin output level.
• The toggle wave level ("H" or "L") at reload timer activation can be set by the pin output level select bit
in the timer control status register (TMCSR:OUTL).
• The 16-bit reload timer can be used as an interval time using underflow interrupts.
Table 14.1-2 16-bit Reload Timer Time Intervals
Count clock
Internal clock mode
Event count mode
Count clock cycle
Time interval example
21T (0.083 μs)
0.083 μs to 5.46 ms
23T (0.33 μs)
0.33 μs to 21.8 ms
25T (1.3 μs)
1.3 μs to 87.4 ms
23T or more
0.33 μs or more
T: Machine cycle
The time interval examples and the values in ( ) are calculated assuming a machine clock frequency of 24 MHz.
Reference:
292
16-bit reload timer 1 can be used as the activation trigger for the A/D converter.
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 14 16-BIT RELOAD TIMERS
14.2 Block Diagram of 16-bit Reload Timer
MB90340E Series
14.2
Block Diagram of 16-bit Reload Timer
Each of 16-bit reload timers 0, 1, 2, and 3 consists of the following blocks:
• Count clock generator circuit
• Reload control circuit
• Output control circuit
• Operation control circuit
• 16-bit timer register (TMR)
• 16-bit reload register (TMRLR)
• Timer control status register (TMCSR)
■ Block Diagram of 16-bit Reload Timer
Figure 14.2-1 Block Diagram of 16-bit Reload Timer
Internal data bus
TMRLR
16-bit reload register
Reload signal
TMR
16-bit timer register
UF
Counter clock generator
circuit
Machine
clock
Prescaler
3
Reload
control
circuit
CLK
Gate
input
Effective
clock
decision
circuit
φ
Wait signal
To A/D converter
(ch.1 only)
Clear
Internal
clock
Pin
TIN
Input
control
circuit
Output control circuit
CLK
Clock
selector
Output signal
generator circuit
Pin
TOT
EN
External clock
3
2
Select
signal
Operation
control circuit
Function selection
CSL1 CSL0 MOD2 MOD1 MOD0 OUTE OUTL RELD INTE UF CNTE TRG
Timer control status register (TMCSR)
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
Interrupt
request output
293
CHAPTER 14 16-BIT RELOAD TIMERS
14.2 Block Diagram of 16-bit Reload Timer
MB90340E Series
● Details of pins and other items in the block diagram
The MB90340E series contains four channels of 16-bit reload timers.
Listed below are the actual pin names, internal peripheral resource output, interrupt request numbers, and
DMA channels of the individual channels of 16-bit reload timers.
Table 14.2-1 Pin Names, Internal Peripheral Resource Output, Interrupt Numbers, and
DMA Channels of 16-bit Reload Timers
Reload timer
0
Reload timer
1
Reload timer
2
Reload timer
3
TIN pin
P80
P10
P82
P53
TOT pin
P81
P11
P83
P54
Output to internal
peripheral resource
—
A/D converter
—
—
#17(11H)
#18(12H)
#19(13H)
#20(14H)
0
1
2
—
Interrupt request No.
DMA channel No.
● Count clock generator circuit
This block generates a count clock signal to be supplied to the 16-bit timer register (TMR) based on the
machine clock signal or external event clock signal.
● Reload control circuit
This block reloads the 16-bit timer register (TMR) with the value set in the 16-bit reload register either to
start 16-bit reload timer operation or when the TMR register underflows.
● Output control circuit
This block inverts the TOT pin output when an underflow occurs and enables or disables TOT pin output.
● Operation control circuit
This block activates or stops the 16-bit reload timer.
● 16-bit timer register (TMR)
This block is a 16-bit down counter. When read, it returns the current count value.
● 16-bit reload register (TMRLR)
This block sets the time interval for the 16-bit reload timer. The value set in the 16-bit reload register is
reloaded into the 16-bit timer register (TMR) either to start 16-bit reload timer operation or when the TMR
register underflows.
294
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 14 16-BIT RELOAD TIMERS
14.2 Block Diagram of 16-bit Reload Timer
MB90340E Series
● Timer control status register (TMCSR)
This block is used to select the 16-bit reload timer operation mode, set operating conditions, select the
activation trigger, activate the reload timer using the software trigger, select the reload operation mode,
enable/disable interrupt requests, set the TOT pin output level, and set TOT output pins.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
295
CHAPTER 14 16-BIT RELOAD TIMERS
14.3 Configuration of 16-bit Reload Timers
14.3
MB90340E Series
Configuration of 16-bit Reload Timers
This section describes the pins, registers, and interrupt sources of 16-bit reload timers.
■ Pins of 16-bit Reload Timers
The pins of 16-bit reload timers can serve as general-purpose I/O ports as well. Table 14.3-1 shows the
functions of the pins and their required settings for use for 16-bit reload timers.
Table 14.3-1 Pins of 16-bit Reload Timers (1 / 2)
Pin
names
Pin functions
Settings required for use as 16-bit reload timer
General-purpose I/O port/
A/D converter trigger input/
External interrupt 12/
16-bit reload timer input 0
• Port direction register:
Set the register for use as an input port (DDR8:D80=0).
• Disable external interrupts (by setting the external interrupt enable
register ENIR1:EN12 = 0) or use P04 in place of P80 as an
external interrupt input port (by setting the external interrupt
source select register EISSR:INT12R = 0).
• A/D control register:
Set the register to disable trigger activation (ADCS1:STS1,
STS0 = 00B/10B)
P81 /
CKOT /
INT13R/
TOT0
General-purpose I/O port/
Clock monitor output/
External interrupt 13/
16-bit reload timer output 0
• Disable external interrupts (by setting the external interrupt enable
register ENIR1:EN13 = 0) or use P05 in place of P81 as an
external interrupt input port (by setting the external interrupt
source select register EISSR:INT13R = 0).
• Clock output enable register:
Disable clock monitor output (CLKR:CKEN=0).
• Timer control status register:
Enable timer output (TMCSR0:OUTE=1).
P10 /
TIN1
General-purpose I/O port/
16-bit reload timer input 1
• Port direction register (DDR1):
Set the register for use as an input port (DDR1:D10=0).
P11 /
TOT1
General-purpose I/O port/
16-bit reload timer output 1
• Timer control status register:
Enable timer output (TMCSR1:OUTE=1).
P82 /
SIN0 /
INT14R /
TIN2
General-purpose I/O port/
UART input 0/
External interrupt 14/
16-bit reload timer input 2
• Port direction register:
Set the register for use as an input port (DDR8:D82=0).
• Serial control register:
Set the register to disable reception (SCR0:RXE=0).
• Disable external interrupts (by setting the external interrupt enable
register ENIR1:EN14 = 0) or use P06 in place of P82 as an
external interrupt input port (by setting the external interrupt
source select register EISSR:INT14R = 0).
P83 /
SOT0 /
TOT2
General-purpose I/O port/
UART output 0/
16-bit reload timer output 2
• Serial control register:
Set the register to disable transmission (SCR0:TXE=0).
• Timer control status register:
Enable timer output (TMCSR2:OUTE=1).
P53 /
AN11 /
TIN3
General-purpose I/O port/
A/D converter analog input 11/
16-bit reload timer input 3
• Port direction register:
Set the register for use as an input port (DDR5:D53=0).
• Analog input enable register:
Set the register to disable analog input (ADER5:ADE11=0).
P80 /
ADTG /
INT12R/
TIN0
296
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 14 16-BIT RELOAD TIMERS
14.3 Configuration of 16-bit Reload Timers
MB90340E Series
Table 14.3-1 Pins of 16-bit Reload Timers (2 / 2)
Pin
names
P54 /
AN12 /
TOT3
Pin functions
Settings required for use as 16-bit reload timer
General-purpose I/O port/
A/D converter analog input 12/
16-bit reload timer output 3
CM44-10143-5E
• Analog input enable register:
Set the register to disable analog input (ADER5:ADE12=0).
• Timer control status register:
Enable timer output (TMCSR3:OUTE=1).
FUJITSU SEMICONDUCTOR LIMITED
297
CHAPTER 14 16-BIT RELOAD TIMERS
14.3 Configuration of 16-bit Reload Timers
MB90340E Series
■ Registers of Each 16-bit Reload Timer and Their Reset Values
● Registers of 16-bit reload timer 0
Figure 14.3-1 Registers of 16-bit Reload Timer 0 and Their Reset Values
bit
Timer control status register: Upper byte (TMCSR0)
bit
Timer control status register: Lower byte (TMCSR0)
bit
16-bit timer register: Upper byte (TMR0)
bit
16-bit timer register: Lower byte (TMR0)
bit
16-bit reload register: Upper byte (TMRLR0)
bit
16-bit reload register: Lower byte (TMRLR0)
15
14
13
12
11
10
9
8
X
X
X
X
0
0
0
0
7
6
5
4
3
2
1
0
0
0
0
0
0
0
0
0
15
14
13
12
11
10
9
8
X
X
X
X
X
X
X
X
7
6
5
4
3
2
1
0
X
X
X
X
X
X
X
X
15
14
13
12
11
10
9
8
X
X
X
X
X
X
X
X
7
6
5
4
3
2
1
0
X
X
X
X
X
X
X
X
X : Undefined
● Registers of 16-bit reload timer 1
Figure 14.3-2 Registers of 16-bit Reload Timer 1 and Their Reset Values
bit
Timer control status register: Upper byte (TMCSR1)
bit
Timer control status register: Lower byte (TMCSR1)
bit
16-bit timer register: Upper byte (TMR1)
bit
16-bit timer register: Lower byte (TMR1)
bit
16-bit reload register: Upper byte (TMRLR1)
bit
16-bit reload register: Lower byte (TMRLR1)
15
14
13
12
11
10
9
8
X
X
X
X
0
0
0
0
7
6
5
4
3
2
1
0
0
0
0
0
0
0
0
0
15
14
13
12
11
10
9
8
X
X
X
X
X
X
X
X
7
6
5
4
3
2
1
0
X
X
X
X
X
X
X
X
15
14
13
12
11
10
9
8
X
X
X
X
X
X
X
X
7
6
5
4
3
2
1
0
X
X
X
X
X
X
X
X
X :Undefined
298
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 14 16-BIT RELOAD TIMERS
14.3 Configuration of 16-bit Reload Timers
MB90340E Series
● Registers of 16-bit reload timer 2
Figure 14.3-3 Registers of 16-bit Reload Timer 2 and Their Reset Values
bit
Timer control status register: Upper byte (TMCSR2)
bit
Timer control status register: Lower byte (TMCSR2)
bit
16-bit timer register: Upper byte (TMR2)
bit
16-bit timer register: Lower byte (TMR2)
bit
16-bit reload register: Upper byte (TMRLR2)
bit
16-bit reload register: Lower byte (TMRLR2)
15
14
13
12
11
10
9
8
X
X
X
X
0
0
0
0
7
6
5
4
3
2
1
0
0
0
0
0
0
0
0
0
15
14
13
12
11
10
9
8
X
X
X
X
X
X
X
X
7
6
5
4
3
2
1
0
X
X
X
X
X
X
X
X
15
14
13
12
11
10
9
8
X
X
X
X
X
X
X
X
7
6
5
4
3
2
1
0
X
X
X
X
X
X
X
X
X :Undefined
● Registers of 16-bit reload timer 3
Figure 14.3-4 Registers of 16-bit Reload Timer 3 and Their Reset Values
bit
Timer control status register: Upper byte (TMCSR3)
bit
Timer control status register: Lower byte (TMCSR3)
bit
16-bit timer register: Upper byte (TMR3)
bit
16-bit timer register: Lower byte (TMR3)
bit
16-bit reload register: Upper byte (TMRLR3)
bit
16-bit reload register: Lower byte (TMRLR3)
15
14
13
12
11
10
9
8
X
X
X
X
0
0
0
0
7
6
5
4
3
2
1
0
0
0
0
0
0
0
0
0
15
14
13
12
11
10
9
8
X
X
X
X
X
X
X
X
7
6
5
4
3
2
1
0
X
X
X
X
X
X
X
X
15
14
13
12
11
10
9
8
X
X
X
X
X
X
X
X
7
6
5
4
3
2
1
0
X
X
X
X
X
X
X
X
X :Undefined
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
299
CHAPTER 14 16-BIT RELOAD TIMERS
14.3 Configuration of 16-bit Reload Timers
MB90340E Series
■ Generation of an Interrupt Request by a 16-bit Reload Timer
When a 16-bit reload timer is activated and the count value in the 16-bit timer register (TMR) is
decremented from 0000H to FFFFH, the register causes an underflow and the UF bit in the timer control
status register is set to "1" (TMCSR:UF). An interrupt request is generated when underflow interrupts have
been enabled (TMCSR:INTE=1).
If setting of the UF bit to "1" and writing "0" occur simultaneously, the latter takes preceidence, and "0" is
written.
300
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 14 16-BIT RELOAD TIMERS
14.3 Configuration of 16-bit Reload Timers
MB90340E Series
14.3.1
Upper Byte of Timer Control Status Register (TMCSR:H)
The upper byte of the timer control status register (TMCSR:H) is used to set the
operation mode and count clock.
Note that bit 7 in lower byte of the timer control status register (TMCSR:L) is also
covered in this section.
■ Upper Byte of Timer Control Status Register (TMCSR:H)
Figure 14.3-5 Upper Byte of Timer Control Status Register (TMCSR:H)
Address:
TMCSR0
TMCSR1
TMCSR2
TMCSR3
15
14
: 000061H
: 000063H
: 000065H
: 000067H
13
12
11
10
9
8
7
CSL1 CSL0 MOD2 MOD1 MOD0
Initial value
XXXX00000B
R/W R/W R/W R/W R/W
bit9
bit8
bit7
MOD2
MOD1
MOD0
0
0
0
0
0
1
Operation mode select bits (internal clock mode)
(CSL1, CSL0=00B, 01B, 10B)
Input pin function
1
0
0
1
1
1
X
0
1
X
1
bit9
bit8
bit7
MOD2
MOD1
MOD0
X
0
0
Trigger input
X
0
1
R/W
: Readable/writable
X
: Undefined
−
: Undefined bit
1
0
1
1
bit11
bit10
CSL1
CSL0
0
0
0
1
1
0
1
1
Falling edge
Both edges
"L" level
Gate input
"H" level
Operation mode select bits (event count mode)
(CSL1, CSL0=11B)
Input pin function
X
−
Rising edge
0
X
Effective edge/level
Trigger prohibition
Effective edge
−
−
Rising edge
Trigger input
Falling edge
Both edges
Count clock select bits
Count clock
Count clock cycle
21T
Internal clock mode
23T
25T
Event count mode
External event clock
T: Machine cycle
: Initial value
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
301
CHAPTER 14 16-BIT RELOAD TIMERS
14.3 Configuration of 16-bit Reload Timers
MB90340E Series
Table 14.3-2 Functions of Upper Bytes of Timer Control Status Register (TMCSR:H)
Bit name
bit15
to
bit12
bit11,
bit10
bit9
to
bit7
302
Function
Undefined bits
When the bits are read
: The values are indeterminate.
When the bits are written to : Operation is not affected.
CSL1, CSL0:
Count clock select bits
Select the count clock for the 16-bit reload timer.
When the bits are set to other than "11B":
The internal clock is used for counting (internal clock mode).
When the bits are set to "11B":
Edges of the external event clock signal are counted (event count
mode).
MOD2, MOD1, MOD0:
Operation mode select
bits
Set the operating conditions for the 16-bit reload timer.
[In internal clock mode]
The MOD2 bit selects the function of the input pin.
When the MOD2 bit is "0":
The input pin serves as a trigger input.
The MOD1 and MOD0 bits select the edge to be detected. When the
edge is detected, the value set in the 16-bit reload register is reloaded
into the 16-bit timer register (TMR) to start the count operation of the
TMR register.
When the MOD2 bit is "1":
The input pin serves as a gate input.
The MOD1 bit is not used; the MOD0 bit selects the signal level ("H",
"L") to be detected. The 16-bit timer register performs counting only
when the signal level is input.
[In event count mode]
The MOD2 bit is not used. The input pin inputs an external event clock
signal. The MOD1 and MOD0 bits are used to select the edge to be detected.
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 14 16-BIT RELOAD TIMERS
14.3 Configuration of 16-bit Reload Timers
MB90340E Series
14.3.2
Lower Byte of Timer Control Status Register (TMCSR:L)
The lower byte of the timer control status register (TMCSR:L) is used to enable/disable
the timer operation, set the software trigger, check whether an underflow has occurred,
enable/disable underflow interrupts, select reload mode, and set the TOT pin output.
■ Lower Byte of Timer Control Status Register (TMCSR:L)
Figure 14.3-6 Lower Byte of Timer Control Status Register (TMCSR:L)
bit 7
Address:
TMCSR0 : 000060H
TMCSR1 : 000062H
TMCSR2 : 000064H
TMCSR3 : 000066H
6
5
4
3
2
1
0
OUTE OUTL RELD INTE UF CNTE TRG
Initial value
00000000B
R/W R/W R/W R/W R/W R/W R/W
bit0
TRG
Software trigger bit
0
Has no effect on operation.
1
Starts counting after reloading.
bit1
CNTE
Timer operation enable bit
0
Disables timer operation.
1
Enables timer operation (waiting for an activation trigger).
bit2
UF
Underflow detection flag bit
When read
When written to
0
No underflow
The UF bit is cleared.
1
Underflow detected
No effect
bit3
INTE
Underflow interrupt enable bit
0
Disables underflow interrupts.
1
Enables underflow interrupts.
bit4
RELD
Reload select bit
0
One shot mode
1
Reload mode
bit5
OUTL
TOT pin output level select bit
One shot mode (RELD=0)
Reload mode (RELD=1)
0
Outputs "H"-level rectangular wave
during counting.
Outputs "L"-level toggle wave at reload timer
activation.
1
Outputs "L"-level rectangular wave
during counting.
Outputs "H"-level toggle wave at reload timer
activation.
bit6
TOT pin output enable bit
OUTE
R/W
: Initial value
*
Pin function
: Readable/writable
0
General-purpose I/O port
1
TOT output
: For MOD0 (bit7), see Section "14.3.1 Upper Byte of Timer Control Status Register (TMCSR:H)".
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
303
CHAPTER 14 16-BIT RELOAD TIMERS
14.3 Configuration of 16-bit Reload Timers
MB90340E Series
Table 14.3-3 Functions of Lower Byte of Timer Control Status Register (TMCSR:L) (1 / 2)
Bit name
OUTE:
TOT output enable bit
Sets the function of the TOT pin of the 16-bit reload timer.
When the bit is set to "0": The pin serves as a general-purpose I/O port.
When the bit is set to "1": The pin serves as the TOT pin for the 16-bit
reload timer.
OUTL:
TOT pin output level
select bit
Sets the output level of the output pin of the 16-bit reload timer.
<When one shot mode is selected (RELD=0)>
When the bit is set to "0": The pin outputs "H"-level rectangular wave
while the timer register is counting.
When the bit is set to "1": The pin outputs "L"-level rectangular wave
while the timer register is counting.
<When reload mode is selected (RELD=1)>
When the bit is set to "0": The pin outputs "L"-level toggle wave at reload
timer activation.
When the bit is set to "1": The pin outputs "H"-level toggle wave at reload
timer activation.
bit4
RELD:
Reload select bit
Sets the reload operation to be performed when an underflow occurs.
When the bit is set to "1": When an underflow occurs, the 16-bit timer
register is reloaded with the value set in the 16bit reload register to continue counting (reload
mode).
When the bit is set to "0": When an underflow occurs, the 16-bit timer
register stops counting (one shot mode).
bi3
INTE:
Underflow interrupt
enable bit
Enables or disables underflow interrupts.
An interrupt request occurs when an underflow occurs (TMCSR:UF=1) with
underflow interrupts enabled (TMCSR:INTE=1).
bit2
UF:
Underflow detection flag
bit
Indicates that the timer register has caused an underflow.
When the bit is set to "0": The flag is cleared.
When the bit is set to "1": No effect is produced.
When the bit is read by a read-modify-write instruction:
"1" is read.
CNTE:
Timer operation enable
bit
Enables or disables the operation of the 16-bit reload timer.
When the bit is set to "1": The 16-bit reload timer waits for an activation
trigger. When the activation trigger is input, the
reload timer causes the timer register to restart
counting.
When the bit is set to "0": The 16-bit reload timer causes the timer register
to stop counting.
bit6
bit5
bit1
304
Function
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 14 16-BIT RELOAD TIMERS
14.3 Configuration of 16-bit Reload Timers
MB90340E Series
Table 14.3-3 Functions of Lower Byte of Timer Control Status Register (TMCSR:L) (2 / 2)
Bit name
bit0
CM44-10143-5E
Function
TRG:
Software trigger bit
Activates the 16-bit reload timer by software.
The software trigger function works only when the timer operation is enabled
(CNTE=1).
When the bit is set to "0": The setting is invalid and makes no change.
When the bit is set to "1": The 16-bit timer register (TMR) is reloaded
with the value set in the 16-bit reload register to
start counting.
When the bit is read: "0" is always read.
FUJITSU SEMICONDUCTOR LIMITED
305
CHAPTER 14 16-BIT RELOAD TIMERS
14.3 Configuration of 16-bit Reload Timers
14.3.3
MB90340E Series
16-bit Timer Register (TMR)
The 16-bit timer register is a 16-bit down counter. The current count value is read from
the timer register.
■ 16-bit Timer Register (TMR)
Figure 14.3-7 16-bit Timer Register (TMR)
Address:
bit 15
TMR0 : 007949 H
TMR1 : 00794BH
TMR2 : 00794DH
TMR3 : 00794F H
D15 D14
Address:
TMR0 : 007948 H
TMR1 : 00794AH
TMR2 : 00794CH
TMR3 : 00794EH
R
: Read only
X
: Undefined
14
R
13
12
D13
D12 D11 D10
R
bit 7
R
11
R
10
R
9
8
Initial value
D9
D8
XXXXXXXX B
R
R
R
6
5
4
3
2
1
0
D7
D6
D5
D4
D3
D2
D1
D0
R
R
R
R
R
R
R
R
Initial value
XXXXXXXX B
When the activation trigger is input with the timer operation enabled (TMCSR:CNTE=1), the 16-bit timer
register (TMR) is reloaded with the value set in the 16-bit reload register (TMRLR) to start counting.
If the timer operation is disabled (TMCSR:CNTE=0), the TMR register retains its value.
An underflow occurs if the TMR register decrements its value from 0000H to FFFFH during counting.
[In reload mode]
When the 16-bit timer register (TMR) underflows, it is reloaded with the value set in the 16-bit reload
register (TMRLR) to restart counting.
[In one shot mode]
When the 16-bit timer register (TMR) underflows, it stops counting and enters the activation trigger input
wait state. The TMR register retains its value as FFFFH.
Notes:
• Although the 16-bit timer register (TMR) can be read even during counting, be sure to use a word
instruction (MOVW).
• The 16-bit timer register (TMR) is located at the same address as that of the 16-bit reload register
(TMRLR). Write access to that address writes a set value to the TMRLR register without affecting
the TMR register. Read access to the address reads the current count value from the TMR
register.
306
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
MB90340E Series
14.3.4
16-bit Reload Register (TMRLR)
CHAPTER 14 16-BIT RELOAD TIMERS
14.3 Configuration of 16-bit Reload Timers
The 16-bit reload register sets the value to be reloaded into the 16-bit timer register
(TMR). When the activation trigger is input, the 16-bit timer register is reloaded with the
value set in the 16-bit reload register to start counting.
■ 16-bit Reload Register (TMRLR)
Figure 14.3-8 16-bit Reload Register (TMRLR)
Address:
TMRLR0 : 007949 H
TMRLR1 : 00794B H
TMRLR2 : 00794DH
TMRLR3 : 00794F H
Address:
TMRLR0 : 007948 H
TMRLR1 : 00794A H
TMRLR2 : 00794CH
TMRLR3 : 00794E H
W
: Write only
X
:Undefined
bit 15
14
D15 D14
W
13
12
D13
D12 D11 D10
W
bit 7
W
11
W
10
W
W
9
8
Initial value
D9
D8
XXXXXXXX B
W
W
6
5
4
3
2
1
0
D7
D6
D5
D4
D3
D2
D1
D0
W
W
W
W
W
W
W
W
Initial value
XXXXXXXX B
Before setting the 16-bit reload register, disable the timer operation (TMCSR:CNTE=0). After setting the
16-bit reload register, enable the timer operation (TMCSR:CNTE=1).
When the activation trigger is input, the 16-bit timer register (TMR) is reloaded with the value set in the
16-bit reload register (TMRLR) to start counting.
Notes:
• Before writing to the 16-bit timer register, disable the 16-bit reload timer operation
(TMCSR:CNTE=0). Be sure to use a word instruction (MOVW) to write to the timer register.
• The 16-bit reload register (TMRLR) is located at the same address as that of the 16-bit timer
register (TMR). Write access to that address writes a set value to the TMRLR register without
affecting the TMR register. Read access to the address reads the current count value from the
TMR register.
• Read-modify-write (RMW) instructions such as INC/DEC cannot be used.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
307
CHAPTER 14 16-BIT RELOAD TIMERS
14.4 Interrupts of 16-bit Reload Timers
14.4
MB90340E Series
Interrupts of 16-bit Reload Timers
The 16-bit reload timer generates an interrupt request when the 16-bit timer register
underflows.
■ Interrupts of 16-bit Reload Timers
The 16-bit timer register (TMR) underflows when its value is decremented from 0000H to FFFFH during
counting. When an underflow occurs, the underflow detection flag bit in the timer control status register
(TMCSR:UF) is set to "1". An interrupt request occurs when underflow interrupts have been enabled
(TMCSR:INTE=1).
Table 14.4-1 Interrupt Control Bits and Interrupt Sources of 16-bit Reload Timers
Interrupt request flag bit
Interrupt request enable bit
Interrupt source
16-bit reload timer 0
16-bit reload timer 1
16-bit reload timer 2
16-bit reload timer 3
TMCSR0: UF
TMCSR1: UF
TMCSR2: UF
TMCSR3: UF
TMCSR0: INTE
TMCSR1: INTE
TMCSR2: INTE
TMCSR3: INTE
Underflow of 16-bit
timer register (TMR1)
Underflow of 16-bit
timer register (TMR2)
Underflow of 16-bit
timer register (TMR3)
Underflow of 16-bit
timer register (TMR0)
■ 16-bit Reload Timer Interrupts, EI2OS, and DMA Transfer
Reference:
See "CHAPTER 3 INTERRUPTS" for interrupt numbers, interrupt control registers, and
interrupt vector addresses.
■ EI2OS Features and DMA Transfer of 16-bit Reload Timers
16-bit reload timers 0 to 3 support EI2OS features. 16-bit reload timers 0 to 2 support DMA transfer. EI2OS
or DMA transfer can be activated when the 16-bit timer register underflows.
Note, however, that EI2OS/DMA can be used only when any other peripheral resource sharing the interrupt
control register (ICR) is not using an interrupt. 16-bit reload timers 0 and 1 share ICR03; 16-bit reload
timers 2 and 3 share ICR04. When 16-bit reload timers 0 to 3 use EI2OS/DMA, disable interrupts by the
other 16-bit reload timers sharing the same ICR register.
308
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 14 16-BIT RELOAD TIMERS
14.5 Operations of 16-bit Reload Timers
MB90340E Series
14.5
Operations of 16-bit Reload Timers
This section describes the settings for the 16-bit reload timer and its counter operating
states.
■ 16-bit Reload Timer Settings
● Settings for internal clock mode
Counting the internal clock signal requires the settings in Figure 14.5-1.
Figure 14.5-1 Settings for Internal Clock Mode
bit15
14
13
12
TMCSR
11
10
9
8
7
6
5
4
3
CSL1 CSL0 MOD2 MOD1 MOD0 OUTE OUTL RELD INTE
2
1
bit0
UF CNTE TRG
1
Other than 11B
Value to be reloaded into 16-bit timer register
TMRLR
: Used bit
1 : Set to "1"
● Settings for event count mode
The operation using external event inputs requires the settings in Figure 14.5-2.
Figure 14.5-2 Settings for Event Count Mode
bit15
14
13
12
−
−
−
−
TMCSR
11
9
8
7
6
5
4
3
2
1
bit0
CSL1 CSL0 MOD2 MOD1 MOD0 OUTE OUTL RELD INTE UF CNTE TRG
1
TMRLR
10
1
1
Value to be reloaded into 16-bit timer register
Set that bit in the port direction register (DDR) to "0" which corresponds to the pin to be used as a TIN pin.
: Used bit
1 : Set to "1"
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
309
CHAPTER 14 16-BIT RELOAD TIMERS
14.5 Operations of 16-bit Reload Timers
MB90340E Series
■ Operating States of 16-bit Timer Register
The operating state of the 16-bit timer register is determined by the timer operation enable bit in the timer
control status register (TMCSR:CNTE) and the WAIT signal. The operating states available are the stopped
state (STOP state), activation trigger input wait state (WAIT state), and executing state (RUN state).
Figure 14.5-3 illustrates the transitions of the operating state of the 16-bit timer register.
Figure 14.5-3 Operating State Transition Diagram
STOP state CNTE=0, WAIT=1
TIN pin: Input disabled
Reset
TOT pin: General-purpose I/O port
16-bit timer register: Retains the value existing
when the operation is stopped.
The value immediately after a
reset is indeterminate.
CNTE=0
CNTE=0
CNTE=1
TRG=0
WAIT state
CNTE=1, WAIT=1
TIN pin: Accepts trigger input only.
TOT pin: Outputs the 16-bit reload
register value.
16-bit timer register: Retains the value existing
when the operation is stopped. The value immediately
after a reset is indeterminate.
TRG=1
(Software trigger)
External trigger from TIN
CNTE=1
TRG=1
UF=1&
RELD=0
RUN state
CNTE=1, WAIT=0
TIN pin: Serves as the input pin for
the 16-bit reload timer.
TOT pin: Serves as the output pin
for the 16-bit reload timer.
(One shot
mode)
UF=1& 16-bit timer register: Operating
RELD=1
(Reload mode)
TRG=1
LOAD
CNTE=1, WAIT=0
(Software trigger)
Loads the content of the 16-bit reload
End of loading
register into the 16-bit timer register.
: State transition by hardware
WAIT
TRG
CNTE
UF
RELD
310
: State transition by register access
: WAIT signal (internal signal)
: Software trigger bit (TMCSR)
: Timer operation enable bit (TMCSR)
: Underflow detection flag bit (TMCSR)
: Reload select bit (TMCSR)
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 14 16-BIT RELOAD TIMERS
14.5 Operations of 16-bit Reload Timers
MB90340E Series
14.5.1
Operations in Internal Clock Mode
In internal clock mode, you can select one of the three different operation modes by
setting the operation mode select bits in the timer control status register (TMCSR:
MOD2 to MOD0). The TOT pin outputs the rectangular or toggle wave depending on the
operation mode and reload mode settings.
■ Settings for Internal Clock Mode
• Setting the count clock select bits (CSL1, CSL0) in the timer control status register to 00B, 01B, or 10B
places the 16-bit reload timer in internal clock mode.
• In internal clock mode, the 16-bit timer register counts down in synchronization with the internal clock.
• You can select one of the three different count clock cycles by setting the count clock select bits (CSL1,
CSL0) in the timer control status register.
[Setting the value to be reloaded into the 16-bit timer register]
After the 16-bit reload timer is activated, the value set in the 16-bit reload register (TMRLR) is reloaded
into the 16-bit timer register (TMR).
1. Disable the timer operation (TMCSR:CNTE=0).
2. Set the 16-bit reload register to the value to be reloaded into the 16-bit timer register.
3. Enable the timer operation (TMCSR:CNTE=1).
Note:
It takes a time period of 1T (T: machine cycle) for the value set in the 16-bit reload register (TMRLR)
to be reloaded into the 16-bit timer register (TMR) after the activation trigger is input.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
311
CHAPTER 14 16-BIT RELOAD TIMERS
14.5 Operations of 16-bit Reload Timers
MB90340E Series
■ Operations when the 16-bit Timer Register Underflows
The 16-bit timer register (TMR) underflows when its value is decremented from 0000H to FFFFH during
counting.
• When an underflow occurs, the underflow detection flag bit in the timer control status register
(TMCSR:UF) is set to "1".
• An underflow interrupt occurs when the underflow interrupt enable bit in the timer control status
register (TMCSR:INTE) contains "1".
• The reload operation to be performed when an underflow occurs is set by the reload select bit in the
timer control status register (TMCSR:RELD).
[In one shot mode (TMCSR:RELD=0)]
When the 16-bit timer register (TMR) underflows, it stops counting and enters the activation trigger input
wait state. When the next activation trigger is input, the TMR register restarts counting.
In one shot mode, the TOT pin outputs rectangular wave while the TMR register is counting. You can
select the rectangular wave level ("H" or "L") by setting the pin output level select bit in the timer control
status register (TMCSR:OUTL).
[In reload mode (TMCSR:RELD=1)]
When the 16-bit timer register (TMR) underflows, it is reloaded with the value set in the 16-bit reload
register (TMRLR) to continue counting.
In reload mode, a toggle wave is output each time the TMR register underflows during counting. The
toggle wave inverts the TOT pin output level. The toggle wave level ("H" or "L") at reload timer activation
can be selected by setting the pin output level select bit in the timer control status register
(TMCSR:OUTL).
■ Operations in Internal Clock Mode
Internal clock mode, you can select the operation mode by setting the operation mode select bits in the
timer control status register (TMCSR:MOD2 to MOD0). Disable the timer operation by setting the timer
operation enable bit in the timer control status register (TMCSR:CNTE) to "0".
312
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 14 16-BIT RELOAD TIMERS
14.5 Operations of 16-bit Reload Timers
MB90340E Series
[Software trigger mode (MOD2 to MOD0=000B)]
When you select software trigger mode, set the software trigger bit in the timer control status register
(TMCSR:TRG) to "1" to activate the 16-bit reload timer. When the 16-bit reload timer is activated, the 16bit timer register (TMR) is reloaded with the value set in the 16-bit reload register (TMRLR) to start
counting.
Note:
If you set the timer operation enable bit (TMCSR:CNTE) and software trigger bit (TMCSR:TRG) in
the timer control status register to "1" at the same time, the 16-bit timer register starts counting
simultaneously with the activation of the 16-bit reload timer. However, timer activation during gate
input operation can only be enabled by software triggering.
Figure 14.5-4 Count Operations in Software Trigger Operation Mode (One Shot Mode)
Counter clock
Counter
Reload data
-1
0000 H FFFF H
Reload data
-1
0000 H
FFFFH
Data load signal
UF bit
CNTE bit
TRG bit
T*
TOT pin
Activation trigger input wait state
T : Machine cycle
* : It takes a time period of 1T to load data from the reload register after trigger input.
Figure 14.5-5 Count Operations in Software Trigger Operation Mode (Reload Mode)
Counter clock
Counter
Reload data
-1
0000 H Reload data
-1
0000 H Reload data
-1
0000 H Reload data
-1
Data load signal
UF bit
CNTE bit
TRG bit
T*
TOT pin
T : Machine cycle
* : It takes a time period of 1T to load data from the reload register after trigger input.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
313
CHAPTER 14 16-BIT RELOAD TIMERS
14.5 Operations of 16-bit Reload Timers
MB90340E Series
[External trigger mode (MOD2 to MOD0=001B, 010B, 011B)]
When you select external trigger mode, input an external effective edge to the TIN pin to activate the 16-bit
reload timer. When the 16-bit reload timer is activated, the 16-bit timer register (TMR) is reloaded with the
value set in the 16-bit reload register (TMRLR) to start counting.
• You can select the rising edge, falling edge, or both edges to be detected, by setting the operation mode
select bits in the timer control status register (TMCSR:MOD2 to MOD0).
Note:
For trigger pulse width to be input to the TIN pin, as well as the pulse width of the gate input, refer to
the value of data sheet.
Figure 14.5-6 Count Operations in External Trigger Mode (One Shot Mode)
Counter clock
Counter
Reload data
-1
0000 H FFFF H
Reload data
-1
0000 H FFFF H
Data load signal
UF bit
CNTE bit
TIN pin
2T to 2.5T *
TOT pin
Activation trigger input wait state
T : Machine cycle
* : It takes a time period of 2 to 2.5 T to load data from the reload register after external trigger input.
314
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 14 16-BIT RELOAD TIMERS
14.5 Operations of 16-bit Reload Timers
MB90340E Series
Figure 14.5-7 Count Operations in External Trigger Mode (Reload Mode)
Counter clock
Counter
Reload data
-1
0000 H Reload data
-1
0000 H Reload data
-1
0000 H Reload data
-1
Data load signal
UF bit
CNTE bit
TIN pin
TOT pin
2T to 2.5T *
T : Machine cycle
* : It takes a time period of 2 to 2.5 T to load data from the reload register after external trigger input.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
315
CHAPTER 14 16-BIT RELOAD TIMERS
14.5 Operations of 16-bit Reload Timers
MB90340E Series
[External gate input operation mode (MOD2 to MOD0=1x0B, 1x1B)]
When you select external gate input operation mode, set the software trigger bit in the timer control status
register (TMCSR:TRG) to "1" to activate the 16-bit reload timer. When the 16-bit reload timer is activated,
the value set in the 16-bit reload timer (TMRLR) is reloaded into the 16-bit timer register (TMR).
• While the set gate input level remains input to the TIN pin after the 16-bit reload timer is activated, the
16-bit timer register continues counting.
• You can select the gate input level ("H" or "L") by setting the operation mode select bits in the timer
control status register (TMCSR: MOD2 to MOD0).
Figure 14.5-8 Count Operations in External Gate Input Operation Mode (One Shot Mode)
Counter clock
Counter
Reload data
-1
0000 H
-1
Reload data
FFFFH
-1
-1
Data load signal
UF bit
CNTE bit
TRG bit
T*
T*
TIN pin
TOT pin
Activation trigger input wait state
T : Machine cycle
* : It takes a time period of 1 T to load data from the reload register after trigger input.
Figure 14.5-9 Count Operations in External Gate Input Operation Mode (Reload Mode)
Counter clock
Counter
Reload data
-1
-1
-1
0000H Reload data
-1
-1
Data load signal
UF bit
CNTE bit
TRG bit
TIN pin
T*
TOT pin
T : Machine cycle
* : It takes a time period of 1T to load data from the reload register after trigger input.
316
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
MB90340E Series
14.5.2
Operations in Event Count Mode
CHAPTER 14 16-BIT RELOAD TIMERS
14.5 Operations of 16-bit Reload Timers
In event count mode, the activated 16-bit reload timer detects the edge of the signal
input to the TIN pin to cause the 16-bit timer register to start counting. The TOT pin
outputs rectangular or toggle wave depending on the operation mode and reload mode
settings.
■ Settings for Event Count Mode
• Setting the count clock select bits in the timer control status register (TMCSR: CSL1, CSL0) to 11B
places the 16-bit reload timer in event count mode.
• In event count mode, the 16-bit timer register is decremented in synchronization with edge detection of
the external event clock input to the TIN pin.
[Setting the counter initial value]
After the 16-bit reload timer is activated, the value set in the 16-bit reload register (TMRLR) is reloaded
into the 16-bit timer register (TMR).
1. Disable the 16-bit reload timer operation (TMCSR:CNTE=0).
2. Set the 16-bit reload register to the value to be reloaded into the 16-bit timer register.
3. Enable the 16-bit reload timer operation (TMCSR:CNTE=1).
Note:
It takes a time period of 1 T (T: machine cycle) for the value set in the 16-bit reload register (TMRLR)
to be loaded into the 16-bit timer register (TMR) after the activation trigger is input.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
317
CHAPTER 14 16-BIT RELOAD TIMERS
14.5 Operations of 16-bit Reload Timers
MB90340E Series
■ Operations when the 16-bit Timer Register Underflows
The 16-bit timer register (TMR) underflows when its value is decremented from 0000H to FFFFH during
counting.
• When an underflow occurs, the underflow detection flag bit in the timer control status register
(TMCSR:UF) is set to "1".
• An underflow interrupt occurs when the underflow interrupt enable bit in the timer control status
register (TMCSR:INTE) contains "1".
• The reload operation to be performed when an underflow occurs is set by the reload select bit in the
timer control status register (TMCSR:RELD).
[In one shot mode (TMCSR:RELD=0)]
When the 16-bit timer register (TMR) underflows, it stops counting and enters the activation trigger input
wait state. When the next activation trigger is input, the TMR register restarts counting.
In one shot mode, the TOT pin outputs rectangular wave while the TMR register is counting. You can
select the rectangular wave level ("H" or "L") by setting the pin output level select bit in the timer control
status register (TMCSR:OUTL).
[In reload mode (TMCSR:RELD=1)]
When the 16-bit timer register (TMR) underflows, it is reloaded with the value set in the 16-bit reload
register (TMRLR) to continue counting.
In reload mode, a toggle wave is output each time the TMR register underflows during counting. The
toggle wave inverts the TOT pin output level. The toggle wave level ("H" or "L") at reload timer activation
can be selected by setting the pin output level select bit in the timer control status register
(TMCSR:OUTL).
318
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 14 16-BIT RELOAD TIMERS
14.5 Operations of 16-bit Reload Timers
MB90340E Series
■ Operations in Event Count Mode
Enable the 16-bit reload timer operation by setting the timer operation enable bit in the timer control status
register (TMCSR:CNTE) to "1". Setting the software trigger bit in the timer control status register
(TMCSR:TRG) to "1" activates the 16-bit reload timer. When the 16-bit reload timer is activated, the 16-bit
timer register (TMR) is loaded with the value set in the 16-bit reload register (TMRLR) to start counting.
The TMR register performs counting while detecting edges of the external event clock signal input to the
TIN pin after the 16-bit reload timer is activated.
• You can select the rising edge, falling edge, or both edges to be detected, by setting the operation mode
select bits in the timer control status register (TMCSR: MOD2 to MOD0).
Note:
For "H" and "L" clock widths to be input to the TIN pin, refer to the value of data sheet.
Figure 14.5-10 Count Operations in Event Count Mode (One Shot Mode)
TIN pin
Counter
Reload data
-1
0000H FFFFH
Reload data
-1
0000H FFFFH
Data load signal
UF bit
CNTE bit
TRG bit
T*
TOT pin
Activation trigger input wait state
T : Machine cycle
* : It takes a time period of 1 T to load data from the reload register after trigger input.
Figure 14.5-11 Count Operations in Event Count Mode (Reload Mode)
TIN pin
Counter
Reload data
-1
0000 H Reload data
-1
0000 H Reload data
-1
0000H Reload data
-1
Data load signal
UF bit
CNTE bit
TRG bit
TOT pin
T*
T : Machine cycle
* : It takes a time period of 1 T to load data from the reload register after trigger input.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
319
CHAPTER 14 16-BIT RELOAD TIMERS
14.6 Notes on Using 16-bit Reload Timers
14.6
MB90340E Series
Notes on Using 16-bit Reload Timers
Take the following precautions in using 16-bit reload timers:
■ Notes on Using 16-bit Reload Timers
● Notes on programming for setting
• Before setting the 16-bit reload register (TMRLR), disable the timer operation (TMCSR:CNTE=0).
• Although the 16-bit timer register (TMR) can be read even with the TMR register counting, be sure to
use a word instruction for read access.
• Before updating the CSL1 and CSL0 bits in the timer control status register (TMCSR), disable the timer
operation (TMCSR:CNTE=0).
● Notes on interrupts
• It is impossible to return from interrupt processing when the UF bit in the timer control status register
(TMCSR) contains "1" with underflow interrupt output enabled (TMCSR:INTE=1). Be sure to clear the
UF bit. Note, however, that the UF bit is cleared automatically when EI2OS or DMA transfer is used.
• When a 16-bit reload timer uses EI2OS or DMA transfer, disable interrupts by 16-bit reload timers
sharing the same interrupt control register (ICR).
320
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 14 16-BIT RELOAD TIMERS
14.7 Sample Programs for 16-bit Reload Timers
MB90340E Series
14.7
Sample Programs for 16-bit Reload Timers
This section provides sample programs to use the 16-bit reload timer in internal clock
mode and in event count mode.
■ Sample Program for Internal Clock Mode
● Processing specifications
• Use 16-bit reload timer 0 to generate 24-ms interval timer interrupts.
• Use the reload timer in reload mode to generate an interrupt repeatedly.
• Activate the timer using a software trigger without using the external trigger input.
• Neither EI2OS nor DMA is used.
• The machine clock is 24 MHz; the count clock is 1.33 μs.
● Coding example
ICR03
;Interrupt control register for 16-bit
;reload timer
TMCSR0 EQU 000060H
;Timer control status register
TMR0
EQU 007948H
;16-bit timer register
TMRLR0 EQU 007948H
;16-bit reload register
UF0
EQU TMCSR0:2
;Interrupt request flag bit
CNTE0 EQU TMCSR0:1
;Counter operation enable bit
TRG0
EQU TMCSR0:0
;Software trigger bit
;--------Main program-------------------------------------CODE
CSEG
;
:
;Assume that the items such as the stack
;pointer (SP) have been initialized.
AND CCR,#0BFH
;Disable interrupts.
MOV I:ICR03,#00H
;Interrupt level 0 (Highest)
CLRB I:CNTE0
;Suspend the counter.
MOVW I:TMRLR0,#4650H ;Set 24-ms timer data.
MOVW I:TMCSR0,#0000100000011011B
;Operate as an interval timer with clock
1.33 μs
;Disable external trigger and external
output.
;Select reload mode and enable
interrupts.
;Clear the interrupt flag and start
counting.
MOV ILM,#07H
;Set ILM in PS to level 7.
OR
CCR,#40H
;Enable interrupts.
LOOP:
CM44-10143-5E
EQU
0000B3H
FUJITSU SEMICONDUCTOR LIMITED
321
CHAPTER 14 16-BIT RELOAD TIMERS
14.7 Sample Programs for 16-bit Reload Timers
MB90340E Series
•
User processing
•
BRA LOOP
;
;---------Interrupt program-------------------------------WARI:
CLR I:UF0
;Clear the interrupt request flag.
•
•
User processing
•
•
RETI
;Return from interrupt.
CODE
ENDS
;---------Vector setting----------------------------------VECT
CSEG ABS=0FFH
ORG 00FFB8H
;Set a vector for interrupt #17(11H).
DSL WARI
ORG 00FFDCH
;Set a reset vector.
DSL START
DB
00H
;Set single-chip mode.
VECT
ENDS
END START
■ Sample Program for Event Count Mode
● Processing specifications
• Use 16-bit reload timer 0 to generate an interrupt when it counts the rising edge of the pulse input to the
external event input pin 10000 times.
• Operate the reload timer in one shot mode.
• Select the rising edge as the external trigger input.
• Neither EI2OS nor DMA is not used.
● Coding example
ICR03
;Interrupt control register for 16-bit
;reload timer
TMCSR0 EQU 000060H
;Timer control status register
TMR0
EQU 007948H
;16-bit timer register
TMRLR0 EQU 007948H
;16-bit reload register
DDR8
EQU 000018H
;Port data register
UF0
EQU TMCSR0:2
;Interrupt request flag bit
CNTE0 EQU TMCSR0:1
;Counter operation enable bit
TRG0
EQU TMCSR0:0
;Software trigger bit
;---------Main program------------------------------------CODE
CSEG
322
EQU
0000B3H
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
MB90340E Series
;
CHAPTER 14 16-BIT RELOAD TIMERS
14.7 Sample Programs for 16-bit Reload Timers
:
;Assume that the items such as the stack
;pointer (SP) have been initialized.
;Assume that no A/D converter is used or
;that the reload timer is used in software
;activation mode (ACS1: STS1, 0 = 00B).
AND CCR,#0BFH
;Disable interrupts.
MOV I:ICR03,#00H
;Interrupt level 0 (Highest)
MOV I:DDR8,00H
;Set the P80/TIN0 pins for input.
CLRB I:CNTE0
;Suspend the counter.
MOVW I:TMRLR0,#2710H;Set the reload value to 10,000 (times).
MOVW I:TMCSR0,#0000110001001011B
;Operate the counter and select the rising
;edge.
;Disable external output.
;Select one shot mode and enable
;interrupts.
;Clear the interrupt flag and start
;counting.
MOV ILM,#07H
;Set the ILM in PS to level 7.
OR
CCR,#40H
;Enable interrupts.
LOOP:
•
User processing
•
BRA LOOP
;
;---------Interrupt program-------------------------------WARI:
CLR I:UF0
;Clear the interrupt request flag.
•
•
User processing
•
•
RETI
;Return from interrupt.
CODE
ENDS
;---------Vector setting----------------------------------VECT
CSEG ABS=0FFH
ORG 00FFB8H
;Set a vector for interrupt #17(11H).
DSL WARI
ORG 00FFDCH
;Set a reset vector.
DSL START
DB
00H
;Set single-chip mode.
VECT
ENDS
END START
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
323
CHAPTER 14 16-BIT RELOAD TIMERS
14.7 Sample Programs for 16-bit Reload Timers
324
FUJITSU SEMICONDUCTOR LIMITED
MB90340E Series
CM44-10143-5E
CHAPTER 15
WATCH TIMER
This chapter explains the functions and operations of
the watch timer.
15.1 Overview of Watch Timer
15.2 Block Diagram of Watch Timer
15.3 Configuration of Watch Timer
15.4 Interrupt of Watch Timer
15.5 Operating Explanation of Watch Timer
15.6 Example Program of Watch Timer
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
325
CHAPTER 15 WATCH TIMER
15.1 Overview of Watch Timer
15.1
MB90340E Series
Overview of Watch Timer
The watch timer is a 15-bit free-run counter that counts up in synchronization with the
sub clock.
• The interval time can be selected from 7 types and an interrupt request can be
generated for each interval time.
• An operation clock is supplied to the timer for sub clock oscillation stabilization wait
time and to the watchdog timer.
• The sub clock is always used as a count clock regardless of the settings of the clock
selection register (CKSCR).
■ Interval Timer Function
• When the watch timer reaches the interval time set by the interval time selection bits (WTC: WTC2 to
WTC0), the bit corresponding to the interval time of the watch timer counter generates an overflow
(carry) and the overflow flag bit is set (WTC:WTOF = 1).
• If an interrupt due to the generation of overflow is enabled (WTC:WTIE=1), an interrupt request is
generated when the overflow flag bit is set (WTC:WTOF=1).
• The interval time of the watch timer can be selected from 8 types shown in Table 15.1-1.
Table 15.1-1 Interval Time of Watch Timer
Sub clock cycle
Interval time
28/SCLK (31.25 ms)
29/SCLK (62.5 ms)
210/SCLK (125 ms)
SCLK (122 μs)
211/SCLK (250 ms)
212/SCLK (500 ms)
213/SCLK (1.0 s)
214/SCLK (2.0 s)
215/SCLK (4.0 s)
SCLK: Sub clock frequency
The value within parenthesis ( ) indicates a calculation example of sub clock operating at 8.192 kHz.
326
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 15 WATCH TIMER
15.1 Overview of Watch Timer
MB90340E Series
■ Cycle of Clock Supply
The watch timer supplies an operation clock to the timer for sub clock oscillation stabilization wait time
and to the watchdog timer. Table 15.1-2 shows the cycles of clocks supplied from the watch timer.
Table 15.1-2 Cycle of Clock Supplied from Watch Timer
Clock supply to
Clock cycle
Timer for sub clock oscillation stabilization wait time
214/SCLK (4.000 s)
210/SCLK (125 ms)
213/SCLK (1.000 s)
Watchdog timer
214/SCLK (2.000 s)
215/SCLK (4.000 s)
SCLK: Sub clock frequency
The value within parenthesis ( ) indicates a calculation example of sub clock operating at 8.192 kHz.
Note:
Sub clock SCLK frequency is the value of the clock to be input to low speed oscillation pins (X0A,
X1A) dividing by 2 or 4.
Division ratio is set by SCDS bit in PLL/sub clock control register (PSCCR).
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
327
CHAPTER 15 WATCH TIMER
15.2 Block Diagram of Watch Timer
15.2
MB90340E Series
Block Diagram of Watch Timer
The watch timer consists of the following blocks:
• Watch timer counter
• Counter clear circuit
• Interval timer selector
• Watch timer control register (WTC)
■ Block Diagram of Watch Timer
Figure 15.2-1 Block Diagram of Watch Timer
To watchdog
timer
Watch timer counter
SCLK
× 21 × 2 2 × 2 3 × 2 4 × 2 5 × 2 6 × 27 × 28 × 29 × 210 × 211 × 212 × 213 × 214 × 215
OF
OF OF
OF
Power-on reset
Transition to hardware standby
Transition to stop mode
OF
OF
Counter
clear circuit
OF
OF
To sub clock oscillation
stabilization wait time
Interval timer
selector
Watch timer interrupt
OF
: Overflow
SCLK : Sub clock
WDCS SCE WTIE WTOF WTR WTC2 WTC1 WTC0
Watch timer control register (WTC)
The actual interrupt request number of the watch timer is as follows:
Interrupt request number: #27 (1BH)
● Watch timer counter
This counter is a 15-bit up counter that uses the sub clock (SCLK) as a count clock.
● Counter clear circuit
The counter clear circuit clears the watch timer counter.
328
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 15 WATCH TIMER
15.2 Block Diagram of Watch Timer
MB90340E Series
● Interval timer selector
The interval timer selector sets the overflow flag bit when the watch timer counter reaches the interval time
value by referring to the interval time set in the watch timer control register (WTC).
● Watch timer control register (WTC)
The watch timer control register selects the interval time, clears the watch timer counter, enables or
disables interrupt, checks the overflow (carry) state, and clears the overflow flag bit.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
329
CHAPTER 15 WATCH TIMER
15.3 Configuration of Watch Timer
15.3
MB90340E Series
Configuration of Watch Timer
This section shows the registers and interrupt sources of the watch timer.
■ List of Registers and Reset Values of Watch Timer
Figure 15.3-1 List of Registers and Reset Values of Watch Timer
bit
Watch timer control register (WTC)
7
6
5
4
3
2
1
0
1
×
0
0
1
0
0
0
X: Undefined
■ Generation of Interrupt Request in Watch Timer
• When the interval time that has been set by the interval time selection bits (WTC: WTC2 to WTC0) is
reached, the overflow flag bit (WTC:WTOF) is set to "1".
• If interrupt by a watch timer counter overflow (carry) is enabled (WTC:WTIE=1), an interrupt request is
generated when the overflow flag bit is set (WTC:WTOF=1).
330
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
MB90340E Series
15.3.1
Watch Timer Control Register (WTC)
CHAPTER 15 WATCH TIMER
15.3 Configuration of Watch Timer
The functions of the watch timer control register (WTC) are shown below.
■ Watch Timer Control Register (WTC)
Figure 15.3-2 Watch Timer Control Register (WTC)
Address
0000AAH
7
6
5
4
3
2
1
0
Initial value
WDCS SCE WTIE WTOF WTR WTC2 WTC1 WTC0
R/W
R
1X001000B
R/W R/W R/W R/W R/W R/W
bit2
bit1
bit0
WTC2 WTC1 WTC0
Interval time selection bits
0
0
0
28/SCLK (31.25 ms)
0
0
1
29/SCLK (62.5 ms)
0
1
0
210/SCLK (125 ms)
0
1
1
211/SCLK (250 ms)
1
0
0
212/SCLK (500 ms)
1
0
1
213/SCLK (1.0 s)
1
1
0
214/SCLK (2.0 s)
1
bit3
1
1
215/SCLK (4.0 s)
WTR
0
1
Watch timer clear bit
Read
⎯
Always "1" is read
Write
Clears watch timer counter
No effect
bit4
WTOF
0
1
Overflow flag bit
Read
Write
No overflow of the bit
corresponding to a set
Clears WTOF bit
interval time occurred
Overflow of the bit
corresponding to a set
No effect
interval time occurred
bit5
Overflow interrupt enable bit
WTIE
0
Disables interrupt request
1
Enables interrupt request
bit6
Oscillation stabilization wait time end bit
SCE
0 In oscillation stabilization wait state
1 Oscillation stabilization wait time end
bit7
R/W
R
X
SCLK
: Readable/writable
: Read only
: Undefined
: Sub clock
: Initial value
CM44-10143-5E
WDCS
0
1
Watchdog clock selection bit (Input clock of watchdog timer)
Main or PLL clock mode
Sub clock mode
Watch timer
Set "0"
Time-base timer
The value within parenthesis ( ) indicates a calculation example
of sub clock operating at 8.192 kHz.
FUJITSU SEMICONDUCTOR LIMITED
331
CHAPTER 15 WATCH TIMER
15.3 Configuration of Watch Timer
MB90340E Series
Table 15.3-1 Functions of Watch Timer Control Register (WTC)
Bit name
Function
bit7
WDCS:
Watchdog clock selection
bit
This bit selects the operation clock of the watchdog timer.
<Main clock mode or PLL clock mode>
When set to "0": Selects the output of watch timer as an operation clock of watchdog timer.
When set to "1": Selects the output of time-base timer as an operation clock of watchdog
timer.
<Sub clock mode>
Always set this bit to "0" to select the output of the watch timer.
Note:
As the watch timer and time-base timer operate asynchronously, the watchdog timer may
run fast when WDCS bit is changed from "0" to "1". The watchdog timer must be cleared
before and after changing this bit.
bit6
SCE:
Oscillation stabilization
wait time end bit
This bit indicates that the oscillation stabilization wait time of the sub clock ends.
When cleared to "0": Indicates that the sub clock is in oscillation stabilization wait state.
When set to "1"
: Indicates that the oscillation stabilization wait time ends.
• The oscillation stabilization wait time of the sub clock is fixed at 214/SCLK (SCLK: sub
clock frequency).
bit5
WTIE:
Overflow interrupt enable
bit
This bit enables or disables generation of an interrupt request due to an overflow (carry) of the
watch timer counter.
When set to "0": No interrupt request is generated even if an overflow occurs (WTOF=1).
When set to "1": An interrupt request is generated if an overflow occurs (WTOF=1).
bit4
WTOF:
Overflow flag bit
This bit is set to "1" when the counter value of the watch timer reaches the value set by the
interval time selection bit.
If interrupt request is enabled (WTIE=1), an interrupt request is generated when an overflow
(carry) occurs (WTOF=1).
When set to "0": Clears the flag.
When set to "1": No effect.
• The overflow flag bit is set to "1" if an overflow (carry) of the bit of the watch timer
counter corresponding to the interval time set by the interval time selection bits (WTC2 to
WTC0) occurs.
Note:
In order to clear the overflow flag bit (WTC:WTOF), disable an overflow interrupt of the
watch timer or mask the interrupt using the ILM bit of the processor status (PS) at the
interrupt processing.
Do not clear the interrupt flag (WTC:WTOF=0) while the interrupt of the watch timer is
enabled (WTC:WTIE=1).
bit3
WTR:
Watch timer clear bit
This bit clears the watch timer counter.
When set to "0": Clears the watch timer counter to 0000H.
When set to "1": No effect.
When read
: Always "1" is read.
WTC2, WTC1, WTC0:
Interval time selection bits
These bits set the interval time of the watch timer.
• When the interval time set by the WTC2 to WTC0 bits is reached, the corresponding bit of
the watch timer counter generates an overflow (carry) and the overflow flag bit is set
(WTC:WTOF=1).
• When setting WTC2 to WTC0 bits, set WTOF bit to "0" at the same time.
bit2
to
bit0
332
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 15 WATCH TIMER
15.4 Interrupt of Watch Timer
MB90340E Series
15.4
Interrupt of Watch Timer
When the interval time is reached, the overflow flag bit is set to "1" and an interrupt
request is generated if interrupt of the watch timer is enabled.
■ Interrupt of Watch Timer
Table 15.4-1 shows the interrupt control bits and interrupt sources of the watch timer.
Table 15.4-1 Interrupt Control Bits of Watch Timer
Watch timer
Interrupt source
Interval time of watch timer counter
Interrupt request flag bit
WTC: WTOF (overflow flag bit)
Interrupt source enable bit
WTC: WTIE
• When the value set by the interval time selection bits (WTC2 to WTC0) in the watch timer control
register (WTC) is reached, the overflow flag bit in WTC is set to "1" (WTC:WTOF=1).
• If interrupt is enabled for the watch timer (WTC:WTIE=1), an interrupt request is generated when the
overflow flag bit is set (WTC:WTOF=1).
• To cancel an interrupt request, set WTOF bit to "0" by interrupt process.
■ Watch Timer Interrupt and EI2OS/DMA Transfer Function
• The watch timer does not support the extended intelligent I/O service (EI2OS) function and DMA
transfer.
• For interrupt number, interrupt control register and interrupt vector address, see "CHAPTER 3
INTERRUPTS".
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
333
CHAPTER 15 WATCH TIMER
15.5 Operating Explanation of Watch Timer
15.5
MB90340E Series
Operating Explanation of Watch Timer
The watch timer operates as an interval timer or a timer for sub clock oscillation
stabilization wait time. It also supplies an operation clock to the watchdog timer.
■ Watch Timer Counter
The watch timer counter continues to count up in synchronization with the sub clock (SCLK) while the sub
clock (SCLK) is operating.
● Clearing watch timer counter
The watch timer counter will be cleared to 0000H in the following cases:
• Power-on reset
• Transition to sleep mode
• Setting the watch timer clear bit (WTR) in the watch timer control register (WTC) to "0"
Notes:
• When a watch timer counter clear occurs, it affects the interrupt operation of the watchdog timer
and interval timer that use outputs from the watch timer counter.
When clearing the watch timer by setting the watch timer clear bit (WTR) in the watch timer
control register (WTC) to "0", do so after setting the overflow interrupt enable bit (WTIE) in WTC
to "0" to disable watch timer interrupt. In addition, before enabling the interrupt, clear an interrupt
request by setting the overflow bit (WTOF) in WTC to "0".
• In order to clear the overflow flag bit (WTC:WTOF), disable an overflow interrupt of the watch
timer or mask the interrupt using the ILM bit of the processor status (PS) at the interrupt processing.
Do not clear the interrupt flag (WTC:WTOF=0) while the interrupt of the watch timer is enabled
(WTC:WTIE=1).
■ Interval Timer Function
The watch timer can be used as an interval timer by generating an interrupt at each interval time.
● Setting for when using watch timer as interval timer
To make the watch timer operate as an interval timer, the setting shown in Figure 15.5-1 is required.
Figure 15.5-1 Setting of Watch Timer
bit7
WTC
6
5
4
3
2
1
0
WDCS SCE WTIE WTOF WTR WTC2 WTC1 WTC0
: Used bit
: Unused bit
• When the value set by the interval time selection bits (WTC1, WTC0) in the watch timer control register
(WTC) is reached, the overflow flag bit in WTC is set to "1" (WTC:WTOF=1).
• When the overflow flag bit is set (WTC:WTOF = 1) with the overflow interrupt of the watch timer
334
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 15 WATCH TIMER
15.5 Operating Explanation of Watch Timer
MB90340E Series
counter enabled (WTC:WTIE = 1), an interrupt request is generated.
• The overflow flag bit (WTC:WTOF) is set when the interval time is reached from the timing, as a
starting point, at which the watch timer is cleared last.
● Clearing overflow flag bit (WTC:WTOF)
When the mode transits to stop mode, WTOF bit is cleared concurrently with the mode transition because
the watch timer is used as the timer for oscillation stabilization wait time of the sub clock.
■ Setting for Operation Clock of Watchdog Timer
The watchdog clock selection bit (WDCS) in the watch timer control register (WTC) can be used to set the
clock input source of the watchdog timer.
When using the sub clock as the machine clock, be sure to set the WDCS bit to "0" to select watch timer
output.
■ Timer for Oscillation Stabilization Wait Time of Sub Clock
When the watch time returns from power-on reset or stop mode, it functions as a timer for oscillation
stabilization wait timer of the sub clock.
• The sub clock oscillation stabilization wait time is fixed at 214/SCLK (SCLK: sub clock).
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
335
CHAPTER 15 WATCH TIMER
15.6 Example Program of Watch Timer
15.6
MB90340E Series
Example Program of Watch Timer
This section shows an example program of the watch timer.
■ Example Program of Watch Timer
● Processing specification
An interrupt at 213/SCLK (SCLK: sub clock) interval is generated repeatedly. The interval time of this case
is approximately 1.0 s (when the sub clock operates at 8.192 kHz).
● Coding example
ICR08 EQU
0000B8H
;Interrupt control register
WTC
EQU
0000AAH
;Watch timer control register
WTOF
EQU
WTC:4
;Overflow flag bit
;
;---------Main program--------------------------------------CODE
CSEG
START:
;
;Stack pointer (SP) etc. should be
;initialized in advance
AND
CCR,#0BFH
;Disables interrupt
MOV
I:ICR07,#00H
;Interrupt level 0 (highest)
MOV
I:WTC,#10100101B
;Enables interrupt
;Clears overflow flag
;Clears watch timer counter
;213/SCLK (approximately 1.0 s)
MOV
ILM,#07H
;Sets ILM in PS to level 7
OR
CCR,#40H
;Enables interrupt
LOOP:
•
User processing
•
BRA
LOOP
;---------Interrupt program---------------------------------WARI:
CLRB I:WTOF
;Clears overflow flag
•
User processing
•
RETI
;Returns from interrupt processing
CODE
ENDS
;---------Vector setting------------------------------------VECT
CSEG ABS=0FFH
ORG
00FF90H
;Sets vector to interrupt #27 (1BH)
336
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 15 WATCH TIMER
15.6 Example Program of Watch Timer
MB90340E Series
VECT
CM44-10143-5E
DSL
ORG
DSL
DB
ENDS
END
WARI
00FFDCH
START
00H
;Resets vector setting
;Sets to single chip mode
START
FUJITSU SEMICONDUCTOR LIMITED
337
CHAPTER 15 WATCH TIMER
15.6 Example Program of Watch Timer
338
FUJITSU SEMICONDUCTOR LIMITED
MB90340E Series
CM44-10143-5E
CHAPTER 16
8/16-BIT PPG TIMER
This chapter explains the functions and operations of
the 8/16-bit PPG timer.
16.1 Overview of 8/16-bit PPG Timer
16.2 Block Diagram of 8/16-bit PPG Timer
16.3 Configuration of 8/16-bit PPG Timer
16.4 Interrupts of 8/16-bit PPG Timer
16.5 Operating Explanation of 8/16-bit PPG Timer
16.6 Notes on Using 8/16-bit PPG Timer
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
339
CHAPTER 16 8/16-BIT PPG TIMER
16.1 Overview of 8/16-bit PPG Timer
16.1
MB90340E Series
Overview of 8/16-bit PPG Timer
The 8/16-bit PPG timer is the 2-channel reload timer module (PPG0, PPG1) that can
perform pulse output of any cycle and duty ratio. The following operation can be
performed by combining the 2 channel modules.
• 8-bit PPG output 2-channel independent operation mode
• 16-bit PPG output operation mode
• 8+8-bit PPG output operation mode
The MB90340E series has eight built-in 8/16-bit PPG timers. This section explains the
functions of PPG0/1. PPG2/3, PPG4/5, PPG6/7, PPG8/9, PPGA/B, PPGC/D, and PPGE/F
have the same functions as PPG0/1.
■ Functions of 8/16-bit PPG Timer
The 8/16-bit PPG timer consists of four 8-bit reload registers (PRLH0/PRLL0, PRLH1/PRLL1) and two
PPG down counters (PCNT0, PCNT1).
• The "H" width and "L" width of an output pulse can be set separately, so the output pulse cycle and duty
ratio can be set arbitrarily.
• The count clock can be selected from six internal clocks.
• The 8/16-bit PPG timer can be used as an interval timer by generating an interrupt request at each
interval time.
• An external circuit enables the 8/16-bit PPG timer to be used as a D/A converter.
340
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 16 8/16-BIT PPG TIMER
16.1 Overview of 8/16-bit PPG Timer
MB90340E Series
■ Operation Modes for 8/16-bit PPG Timer
● 8-bit PPG output 2-channel independent operation mode
This mode makes each 2-channel module (PPG0, PPG1) operate as an independent 8-bit PPG timer.
Table 16.1-1 shows the interval times in 8-bit PPG output 2-channel independent operation mode.
Table 16.1-1 Interval Times in 8-bit PPG Output 2-channel Independent Operation Mode
PPG0, PPG1
Count clock cycle
Interval time
Output pulse time
1/φ (41.7 ns)
1/φ to 28/φ
2/φ to 29/φ
2/φ (83.3 ns)
2/φ to 29/φ
22/φ to 210/φ
22/φ (167 ns)
22/φ to 210/φ
23/φ to 211/φ
23/φ (333 ns)
23/φ to 211/φ
24/φ to 212/φ
24/φ (667 ns)
24/φ to 212/φ
25/φ to 213/φ
29/HCLK (128 μs)
29/HCLK to 217/HCLK
210/HCLK to 218/HCLK
HCLK : Oscillation clock
φ
: Machine clock frequency
The value within parenthesis ( ) is the value operating at HCLK=4 MHz and φ=24 MHz.
● 16-bit PPG output operation mode
This mode concatenates the 2-channel modules (PPG0, PPG1) to operate as a 16-bit 1-channel PPG timer.
Table 16.1-2 shows the interval times in 16-bit PPG output operation mode.
Table 16.1-2 Interval Times in 16-bit PPG Output Operation Mode
Count clock cycle
Interval time
Output pulse time
1/φ (41.7 ns)
1/φ to 216/φ
2/φ to 217/φ
2/φ (83.3 ns)
2/φ to 217/φ
22/φ to 218/φ
22/φ (167 ns)
22/φ to 218/φ
23/φ to 219/φ
23/φ (333 ns)
23/φ to 219/φ
24/φ to 220/φ
24/φ (667 ns)
24/φ to 220/φ
25/φ to 221/φ
29/HCLK (128 μs)
29/HCLK to 225/HCLK
210/HCLK to 226/HCLK
HCLK : Oscillation clock
φ
: Machine clock frequency
The value within parenthesis ( ) is the value operating at HCLK=4 MHz and φ=24 MHz.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
341
CHAPTER 16 8/16-BIT PPG TIMER
16.1 Overview of 8/16-bit PPG Timer
MB90340E Series
● 8+8 bit PPG output operation mode
This mode makes the PPG0 of the 2-channel modules operate as an 8-bit prescaler, operated by inputting
the PPG0 underflow output as PPG1 count clock.
Table 16.1-3 shows the interval times in 8+8-bit PPG output operation mode.
Table 16.1-3 Interval Times in 8+8-bit PPG Output Operation Mode
PPG0
PPG1
Count clock cycle
Interval time
Output pulse time
Interval time
Output pulse time
1/φ (41.7 ns)
1/φ to 28/φ
2/φ to 29/φ
1/φ to 216/φ
2/φ to 217/φ
2/φ (83.3 ns)
2/φ to 29/φ
22/φ to 210/φ
2/φ to 217/φ
22/φ to 218/φ
22/φ (167 ns)
22/φ to 210/φ
23/φ to 211/φ
22/φ to 218/φ
23/φ to 219/φ
23/φ (333 ns)
23/φ to 211/φ
24/φ to 212/φ
23/φ to 219/φ
24/φ to 220/φ
24/φ (667 ns)
24/φ to 212/φ
25/φ to 213/φ
24/φ to 220/φ
25/φ to 221/φ
29/HCLK (128 μs)
29/HCLK to
217/HCLK
210/HCLK to
218/HCLK
29/HCLK to
225/HCLK
210/HCLK to
226/HCLK
HCLK : Oscillation clock
φ
: Machine clock frequency
The value within parenthesis ( ) is the value operating at HCLK=4 MHz and φ=24 MHz.
342
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 16 8/16-BIT PPG TIMER
16.2 Block Diagram of 8/16-bit PPG Timer
MB90340E Series
16.2
Block Diagram of 8/16-bit PPG Timer
The MB90340E series contains eight built-in 8/16-bit PPG timers (with two channels
each).
One 8/16-bit PPG timer consists of 2-channel 8-bit PPG timers.
This section shows the block diagrams of the 8/16-bit PPG timer 0 and 8/16-bit PPG
timer 1. PPG2, 4, 6, 8, A, C, and E have the same function as PPG0, and PPG3, 5, 7, 9, B,
D, and F have the same function as PPG1.
■ Channels and PPG Pins of PPG Timers
Figure 16.2-1 shows the relationship between the channels and the PPG pins of the 8/16-bit PPG timers in
the MB90340E series.
Figure 16.2-1 Channels and PPG Pins of PPG Timers
Pin
PPG0/PPG1
PPG01: REV
PPG0 output pin
Pin
PPG1 output pin
Pin
PPG2/PPG3
PPG23: REV
PPG2 output pin
Pin
PPG3 output pin
PPG4/PPG5
Pin
PPG45: REV
PPG4 output pin
Pin
PPG5 output pin
PPG6/PPG7
Pin
PPG67: REV
PPG6 output pin
Pin
PPG7 output pin
PPG8/PPG9
Pin
PPG89: REV
PPG8 output pin
Pin
PPG9 output pin
PPGA/PPGB
Pin
PPGAB: REV
PPGA output pin
Pin
PPGB output pin
PPGC/PPGD
Pin
PPGCD: REV
PPGC output pin
Pin
PPGD output pin
PPGE/PPGF
Pin
PPGEF: REV
PPGE output pin
Pin
PPGF output pin
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
343
CHAPTER 16 8/16-BIT PPG TIMER
16.2 Block Diagram of 8/16-bit PPG Timer
16.2.1
MB90340E Series
Block Diagram of 8/16-bit PPG Timer 0
The 8/16-bit PPG timer 0 consists of the following blocks.
■ Block Diagram of 8/16-bit PPG Timer 0
Figure 16.2-2 Block Diagram of 8/16-bit PPG Timer 0
"H" level side data bus
"L" level side data bus
PPG0
reload
register
PRLH0
("H" level side)
PPG0 operation mode control
register (PPGC0)
PRLL0
("L" level side)
PEN0
Reserved
PE0 PIE0 PUF0
PPG0 temporary
buffer 0 (PRLBH0)
Interrupt request
R
output*
S Q
2
Select signal
Reload register
L/H selector
Count start value
Reload
Clear
Pulse selector
PPG0 down counter
(PCNT0)
Operation mode
control signal
PPG1 underflow
PPG0 underflow
(to PPG1)
Underflow
CLK
PPG0
Invert output latch
Pin
PPG output control circuit
PPG0
Time-base timer output
(512/HCLK)
Peripheral clock (1/φ)
Peripheral clock (2/φ)
Peripheral clock (4/φ)
Peripheral clock (8/φ)
Peripheral clock (16/φ)
PPG1
output
Count
clock
selector
3
Select signal
PCS2 PCS1 PCS0 PCM2 PCM1 PCM0
REV
PPG0/1 count clock selection register (PPG01)
−
: Undefined
Reserved : Reserve bit
HCLK
: Oscillation clock frequency
φ
: Machine clock frequency
*
: The interrupt output of 8/16-bit PPG timer 0 is combined to one interrupt by OR circuit with the interrupt request
output of PPG timers 1, 4 and 5.
344
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 16 8/16-BIT PPG TIMER
16.2 Block Diagram of 8/16-bit PPG Timer
MB90340E Series
● Details of pins in the block diagram
Table 16.2-1 shows the actual pin names and interrupt request numbers of the 8/16-bit PPG timer.
Table 16.2-1 Pins and Interrupt Request Numbers in Block Diagram
Output pin
Channel
PPG:REV=0
PPG:REV=1
PPG0
P60 / PPG0
P90 / PPG1
PPG1
P90 / PPG1
P60 / PPG0
PPG2
P61 / PPG2
P91 / PPG3
PPG3
P91 / PPG3
P61 / PPG2
PPG4
P62 / PPG4
P92 / PPG5
PPG5
P92/ PPG5
P62 / PPG4
PPG6
P63 / PPG6
P93 / PPG7
PPG7
P93/ PPG7
P63 / PPG6
PPG8
P64 / PPG8
P20 / PPG9
PPG9
P20 / PPG9
P64 / PPG8
PPGA
P65 / PPGA
P21 / PPGB
PPGB
P21 / PPGB
P65 / PPGA
PPGC
P66 / PPGC
P22 / PPGD
PPGD
P22 / PPGD
P66 / PPGC
PPGE
P67/ PPGE
P23 / PPGF
PPGF
P23/ PPGF
P67 / PPGE
Interrupt request
number
#21 (15H)
#22 (16H)
#21 (15H)
#22 (16H)
#23 (17H)
#24 (18H)
#23 (17H)
#24 (18H)
● PPG0 operation mode control register (PPGC0)
This register enables or disables the operation, pin output, and underflow interrupt of the 8/16-bit PPG
timer. It also indicates the occurrence of an underflow.
● PPG0/1 count clock selection register (PPG01)
This register sets the count clock of the 8/16-bit PPG timer and the switching between PPG0 and PPG1
output pins.
● PPG0 reload registers (PRLH0, PRLL0)
These registers set the "H" width or "L" width of output pulse. The values set in PPG0 reload registers are
reloaded into the PPG0 down counter (PCNT0) when the 8/16-bit PPG timer is activated.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
345
CHAPTER 16 8/16-BIT PPG TIMER
16.2 Block Diagram of 8/16-bit PPG Timer
MB90340E Series
● PPG0 down counter (PCNT0)
This counter is an 8-bit down counter that counts down by alternately reloading the values set in the PPG0
reload registers (PRLH0, PRLL0). When an underflow occurs, the pin output is inverted. This counter can
be used as a 1-channel 16-bit PPG down counter by concatenating 2-channel PPG down counters (PPG0,
PPG1).
● PPG0 temporary buffer (PRLBH0)
This buffer prevents deviation of the output pulse width caused by the timing of writing to the PPG reload
registers (PRLH0, PRLL0). This buffer stores the PRLH0 value temporarily and enables the set value of
the PRLH0 in synchronization with the timing of writing to the PRLL0.
● Reload register L/H selector
This selector detects the current pin output level to select which side of the reload register, "L" side
(PRLL0) or "H" side (PRLH0), is reloaded into the PPG0 down counter.
● Count clock selector
This selector selects the count clock to be input to the PPG down counter 0 from five divided clocks of the
machine clock or the divided clock of the time-base timer.
● PPG output control circuit
This circuit inverts the pin output level and the output when an underflow occurs.
346
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 16 8/16-BIT PPG TIMER
16.2 Block Diagram of 8/16-bit PPG Timer
MB90340E Series
16.2.2
Block Diagram of 8/16-bit PPG Timer 1
The 8/16-bit PPG timer 1 consists of the following blocks.
■ Block Diagram of 8/16-bit PPG Timer 1
Figure 16.2-3 Block Diagram of 8/16-bit PPG Timer 1
"H" side data bus
"L" side data bus
PPG1 operation mode control register (PPGC1)
PPG1 reload
register
PRLH1
("H" side)
PRLL1
("L" side)
PEN1
PE1 PIE1 PUF1 MD1 MD0
Operation
mode control
signal
Reserved
2
PPG1 temporary
buffer (PRLBH1)
R
S
Reload selector
L/H selector
Count start value
PPG0 underflow
(from PPG0)
Q
Select signal
Reload
Clear
PPG1 down counter Underflow
(PCNT1)
PPG1 underflow
(to PPG0)
Interrupt
request
output*
Invert
CLK
PPG1
output latch
Pin
PPG1
PPG output control circuit
MD0
PPG0
output
Time-base timer output
(512/HCLK)
Peripheral clock (1/φ)
Peripheral clock (2/φ)
Peripheral clock (4/φ)
Peripheral clock (8/φ)
Peripheral clock (16/φ)
Counter
clock
selector
3
Select signal
PCS2 PCS1 PCS0 PCM2 PCM1 PCM0
REV
−
: Undefined
PPG0/1 count clock selection register (PPG01)
Reserved : Reserved bit
HCLK
: Oscillation clock frequency
φ
: Machine clock frequency
*
: The interrupt output of 8/16-bit PPG timer 1 is combined to one interrupt by OR circuit with the interrupt
request output of PPG timers 0, 4 and 5.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
347
CHAPTER 16 8/16-BIT PPG TIMER
16.2 Block Diagram of 8/16-bit PPG Timer
MB90340E Series
● Details of pins in the block diagram
Table 16.2-2 shows the actual pin names and interrupt request numbers of the 8/16-bit PPG timer.
Table 16.2-2 Pins and Interrupt Request Numbers in Block Diagram
Output pin
Channel
PPG:REV=0
PPG:REV=1
PPG0
P60 / PPG0
P90 / PPG1
PPG1
P90 / PPG1
P60 / PPG0
PPG2
P61 / PPG2
P91 / PPG3
PPG3
P91 / PPG3
P61 / PPG2
PPG4
P62 / PPG4
P92 / PPG5
PPG5
P92/ PPG5
P62 / PPG4
PPG6
P63 / PPG6
P93 / PPG7
PPG7
P93/ PPG7
P63 / PPG6
PPG8
P64 / PPG8
P20 / PPG9
PPG9
P20 / PPG9
P64 / PPG8
PPGA
P65 / PPGA
P21 / PPGB
PPGB
P21 / PPGB
P65 / PPGA
PPGC
P66 / PPGC
P22 / PPGD
PPGD
P22 / PPGD
P66 / PPGC
PPGE
P67/ PPGE
P23 / PPGF
PPGF
P23/ PPGF
P67 / PPGE
Interrupt request
number
#21 (15H)
#22 (16H)
#21 (15H)
#22 (16H)
#23 (17H)
#24 (18H)
#23 (17H)
#24 (18H)
● PPG1 operation mode control register (PPGC1)
This register sets the operation mode of the 8/16-bit PPG timer. It enables or disables the operation, pin
output, and underflow interrupt of the 8/16-bit PPG timer 1. It also indicates the occurrence of an
underflow.
● PPG0/1 count clock selection register (PPG01)
This register sets the count clock of the 8/16-bit PPG timer.
● PPG1 reload registers (PRLH1, PRLL1)
These registers set the "H" width or "L" width of output pulse. The values set in PPG1 reload registers are
reloaded into the PPG1 down counter (PCNT1) when the 8/16-bit PPG timer 1 is activated.
348
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 16 8/16-BIT PPG TIMER
16.2 Block Diagram of 8/16-bit PPG Timer
MB90340E Series
● PPG1 down counter (PCNT1)
This counter is an 8-bit down counter that counts down by alternately reloading the values set in the PPG1
reload registers (PRLH1, PRLL1). When an underflow occurs, the pin output is inverted. This counter can
be used as a 1-channel 16-bit PPG down counter by concatenating 2-channel PPG down counters (PPG0,
PPG1).
● PPG1 temporary buffer (PRLBH1)
This buffer prevents deviation of the output pulse width caused by the timing of writing to the PPG reload
registers (PRLH1, PRLL1). This buffer stores the PRLH1 value temporarily and enables the set value of
the PRLH1 in synchronization with the timing of writing to the PRLL1.
● Reload register L/H selector
This selector detects the current pin output level to select which side of the reload register, "L" side
(PRLL1) or "H" side (PRLH1), is reloaded into the PPG1 down counter.
● Count clock selector
This selector selects the count clock to be input to the PPG1 down counter from five divided clocks of the
machine clock or the divided clock of the time-base timer.
● PPG output control circuit
This circuit inverts the pin output level and the output when an underflow occurs.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
349
CHAPTER 16 8/16-BIT PPG TIMER
16.3 Configuration of 8/16-bit PPG Timer
16.3
MB90340E Series
Configuration of 8/16-bit PPG Timer
This section shows the pins, registers and interrupt sources of the 8/16-bit PPG timer.
■ Pins of 8/16-bit PPG Timer
The pins of the 8/16-bit PPG timer serve as general-purpose I/O ports. Table 16.3-1 shows the pin functions
and pin settings for using the 8/16-bit PPG timer.
Table 16.3-1 Pins of 8/16-bit PPG Timer (1 / 2)
350
Channel
Pin
name
PPG0
P60 /
AN0 /
PPG0
General-purpose I/O port/
A/D converter analog input 0/
PPG output 0
• Analog input enable register: Set to disable
(ADER6:ADE0=0)
• PPG operation mode control register:
Enable pin output (PPGC0:PE0=1)
PPG1
P90 /
PPG1
General-purpose I/O port/
PPG output 1
• PPG operation mode control register:
Enable pin output (PPGC1:PE1=1)
PPG2
P61 /
AN1 /
PPG2
General-purpose I/O port/
A/D converter analog input 1/
PPG output 2
• Analog input enable register: Set to disable
(ADER6:ADE1=0)
• PPG operation mode control register:
Enable pin output (PPGC2:PE0=1)
PPG3
P91 /
PPG3
General-purpose I/O port/
PPG output 3
• PPG operation mode control register:
Enable pin output (PPGC3:PE1=1)
PPG4
P62 /
AN2 /
PPG4
General-purpose I/O port/
A/D converter analog input 2/
PPG output 4
• Analog input enable register: Set to disable
(ADER6:ADE2=0)
• PPG operation mode control register:
Enable pin output (PPGC4:PE0=1)
PPG5
P92 /
PPG5
General-purpose I/O port/
PPG output 5
• PPG operation mode control register:
Enable pin output (PPGC5:PE1=1)
PPG6
P63 /
AN3 /
PPG6
General-purpose I/O port/
A/D converter analog input 3/
PPG output 6
• Analog input enable register: Set to disable
(ADER6:ADE3=0)
• PPG operation mode control register:
Enable pin output (PPGC6:PE0=1)
PPG7
P93 /
PPG7
General-purpose I/O port/
PPG output 7
• PPG operation mode control register:
Enable pin output (PPGC7:PE1=1)
PPG8
P64 /
AN4 /
PPG8
General-purpose I/O port/
A/D converter analog input 4/
PPG output 8
• Analog input enable register: Set to disable
(ADER6:ADE4=0)
• PPG operation mode control register:
Enable pin output (PPGC8:PE0=1)
PPG9
P20 /
PPG9
General-purpose I/O port/
PPG output 9
• PPG operation mode control register:
Enable pin output (PPGC9:PE1=1)
Pin function
Setting required for use of 8/16-bit PPG
timer
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 16 8/16-BIT PPG TIMER
16.3 Configuration of 8/16-bit PPG Timer
MB90340E Series
Table 16.3-1 Pins of 8/16-bit PPG Timer (2 / 2)
CM44-10143-5E
Channel
Pin
name
PPGA
P65 /
AN5 /
PPGA
General-purpose I/O port/
A/D converter analog input 5/
PPG output A
• Analog input enable register: Set to disable
(ADER6:ADE5=0)
• PPG operation mode control register:
Enable pin output (PPGCA:PE0=1)
PPGB
P21 /
PPGB
General-purpose I/O port/
PPG output B
• PPG operation mode control register:
Enable pin output (PPGCB:PE1=1)
PPGC
P66 /
AN6 /
PPGC
General-purpose I/O port/
A/D converter analog input 6/
PPG output C
• Analog input enable register: Set to disable
(ADER6:ADE6=0)
• PPG operation mode control register:
Enable pin output (PPGCC:PE0=1)
PPGD
P22 /
PPGD
General-purpose I/O port/
PPG output D
• PPG operation mode control register:
Enable pin output (PPGCD:PE1=1)
PPGE
P67 /
AN7 /
PPGE
General-purpose I/O port/
A/D converter analog input 7/
PPG output E
• Analog input enable register: Set to disable
(ADER6:ADE7=0)
• PPG operation mode control register:
Enable pin output (PPGCE:PE0=1)
PPGF
P23 /
PPGF
General-purpose I/O port/
PPG output F
• PPG operation mode control register:
Enable pin output (PPGCF:PE1=1)
Pin function
Setting required for use of 8/16-bit PPG
timer
FUJITSU SEMICONDUCTOR LIMITED
351
CHAPTER 16 8/16-BIT PPG TIMER
16.3 Configuration of 8/16-bit PPG Timer
MB90340E Series
■ List of Registers and Reset Values of 8/16-bit PPG Timer
Figure 16.3-1 List of Registers and Reset Values of 8/16-bit PPG Timer
PPG0 operation mode control register: H
(PPGCm)
PPG0 operation mode control register: L
(PPGCn)
PPGn/m count clock selection register
(PPGnm)
bit
15
14
0
bit
7
6
0
13
12
11
10
9
8
0
0
0
0
0
1
5
4
3
2
1
0
0
0
0
1
7
6
5
4
3
2
0
0
0
0
0
0
bit
15
14
13
12
11
10
9
8
bit
7
6
5
4
3
2
1
0
bit
15
14
13
12
11
10
9
8
bit
7
6
5
4
3
2
1
0
bit
1
0
0
PPGn reload register: H (PRLHn)
PPGn reload register: L (PRLLn)
PPGm reload register: H (PRLHm)
PPGm reload register: L (PRLLm)
× : Undefined
n = 0, 2, 4, 6, 8, A, C, E
m = 1, 3, 5, 7, 9, B, D, F
■ Generation of Interrupt in 8/16-bit PPG Timer
In the 8/16-bit PPG timer, the underflow generation flag bits in the PPG operation mode control register
(PPGCn: PUFn, PPGCm: PUFm) are set to "1" when an underflow occurs. If underflow interrupt of the
channel causing an underflow is enabled (PPGCn:PIE0=1, PPGCm:PIE1=1), an underflow interrupt
request is generated to the interrupt controller.
352
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 16 8/16-BIT PPG TIMER
16.3 Configuration of 8/16-bit PPG Timer
MB90340E Series
16.3.1
PPG0 Operation Mode Control Register (PPGC0)
The PPG0 operation mode control register provides the following settings for the 8/16bit PPG timer 0 operation:
• Enabling or disabling operation of 8/16-bit PPG timer 0
• Switching between pin functions (enabling or disabling pulse output)
• Enabling or disabling underflow interrupt
• Setting interrupt request flag set by the occurrence of underflow
Only the function of PPGC0 is explained in this section. PPGC2, 4, 6, 8, A, C, and E have
the same function as PPGC0, setting the respective 8/16-bit PPG timers 2, 4, 6, 8, A, C,
and E.
■ PPG0 Operation Mode Control Register (PPGC0)
Figure 16.3-2 PPG0 Operation Mode Control Register (PPGC0)
bit 7
ch.0 PPGC0
Other channels:
ch.2 PPGC2
ch.4 PPGC4
ch.6 PPGC6
ch.8 PPGC8
ch.A PPGCA
ch.C PPGCC
ch.E PPGCE
Address
000030H
6
PEN0
R/W −
000034H
000038H
00003CH
000040H
000044H
000048H
00004CH
−
5
4
3
PE0 PIE0 PUF0
0
2
1
−
Re− served
R/W R/W R/W −
−
W
Initial value
0X000XX1B
bit0
Reserved
1
Reserved bit
Be sure to set this bit to "1"
bit3
PUF0
0
1
Underflow generation flag bit
Read
No underflow
Underflow
detected
Write
Clears PUF0 bit
No effect
bit4
PIE0
0
1
Underflow interrupt enable bit
Disables interrupt request
Enables interrupt request
bit5
PPG0 pin output enable bit
PE0
0
1
General-purpose I/O port
(Disables pulse output)
PPG0 output (Enables pulse output)
bit7
PPG0 operation enable bit
PEN0
R/W
: Readable/writable
W
: Write only
X
: Undefined
−
: Undefined
0
1
Disables count operation
(Retains "L" level output)
Enables count operation
: Initial value
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
353
CHAPTER 16 8/16-BIT PPG TIMER
16.3 Configuration of 8/16-bit PPG Timer
MB90340E Series
Table 16.3-2 Functions of PPG0 Operation Mode Control Register (PPGC0)
Bit name
354
Function
bit7
PEN0:
PPG0 operation enable
bit
This bit enables or disables the count operation of the 8/16-bit PPG timer 0.
When set to "0": Disables count operation
When set to "1": Enables count operation
• When the pulse output is enabled (PE0=1) while the count operation is
disabled (PEN0=0), "L" level output is retained.
bit6
Undefined bit
Read : The value is undefined
Write : No effect
bit5
PE0:
PPG0 pin output enable
bit
This bit switches between PPG0 pin functions and enables or disables the
pulse output.
When set to "0": Functions as a general-purpose I/O port. The pulse output
is disabled
When set to "1": Functions as PPG0 output pin. The pulse output is enabled
bit4
PIE0:
Underflow interrupt
enable bit
This bit enables or disables interrupt.
When set to "0": Generates no interrupt request even when an underflow
occurs (PUF0 = 1)
When set to "1": Generates an interrupt request when an underflow occurs
(PUF0 = 1)
bit3
PUF0:
Underflow generation
flag bit
8-bit PPG output 2-channel independent operation mode, 8+8-bit PPG
output operation mode:
Generates an underflow (PUF0 = 1) when the value of the PPG0 down
counter is counted down from 00H to FFH
16-bit PPG output operation mode:
Generates an underflow (PUF0 = 1) when the value of the
PPG0+PPG1 down counter is counted down from 0000H to FFFFH
• When an underflow occurs (PUF0=1) while underflow interrupt is enabled
(PIE0=1), an interrupt request is generated.
When set to "0": Clears this bit
When set to "1": No effect
Read by a read-modify-write instruction:
"1" is read
bit2,
bit1
Undefined bits
Write : No effect
Read : The value is undefined.
bit0
Reserved: Reserved bit
Be sure to set this bit to "1".
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 16 8/16-BIT PPG TIMER
16.3 Configuration of 8/16-bit PPG Timer
MB90340E Series
16.3.2
PPG1 Operation Mode Control Register (PPGC1)
The PPG1 operation mode control register provides the following settings for the 8/16bit PPG timer 1 operation:
• Enabling or disabling operation of 8/16-bit PPG timer 1
• Switching between pin functions (enabling or disabling pulse output)
• Enabling or disabling underflow interrupt
• Setting interrupt request flag set by the occurrence of underflow
• Setting operation mode for 8/16-bit PPG timers 1 and 0
Only the function of PPGC1 is explained in this section. PPGC3, 5, 7, 9, B, D, and F have
the same function as PPGC1, setting the respective 8/16-bit PPG timers 3, 5, 7, 9, B, D,
and F.
■ PPG1 Operation Mode Control Register (PPGC1)
Figure 16.3-3 PPG1 Operation Mode Control Register (PPGC1)
ch.1 PPGC1
Other channels:
ch.3 PPGC3
ch.5 PPGC5
ch.7 PPGC7
ch.9 PPGC9
ch.B PPGCB
ch.D PPGCD
ch.F PPGCF
bit 15 14
Address PEN1 −
000031H
R/W −
13
12
11
10
9
PE1 PIE1 PUF1 MD1 MD0
R/W R/W R/W R/W R/W
8
Initial value
Reserved
0X000001B
W
bit8
Reserved
000035H
000039H
00003DH
000041H
000045H
000049H
00004DH
1
Reserved bit
Be sure to set this bit to "1"
bit10
bit9
MD1
MD0
0
0
0
1
1
1
0
1
Operation mode selection bits
8-bit PPG output 2-channel
independent operation mode
8+8-bit PPG output operation mode
Setting is prohibited
16-bit PPG output operation mode
bit11
PUF1
0
1
Underflow generation flag bit
Read
Write
No underflow
Clears PUF1 bit
Underflow detected
No effect
bit12
PIE1
0
1
Underflow interrupt enable bit
Disables underflow interrupt request
Enables underflow interrupt request
bit13
PE1
0
1
R/W
: Readable/writable
W
: Write only
X
: Undefined
−
: Undefined
PPG1 pin output enable bit
General-purpose I/O port (Disables pulse output)
PPG1 output (Enables pulse output)
bit15
PEN1
0
1
PPG1 operation enable bit
Disables count operation (Retains "L" level output)
Enables count operation
: Initial value
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
355
CHAPTER 16 8/16-BIT PPG TIMER
16.3 Configuration of 8/16-bit PPG Timer
MB90340E Series
Table 16.3-3 Functions of PPG1 Operation Mode Control Register (PPGC1)
Bit name
bit15
PEN1:
PPG1 operation enable
bit
This bit enables or disables the count operation of the 8/16-bit PPG timer 1.
When set to "0": Disables count operation
When set to "1": Enables count operation
• When the pulse output is enabled (PE1=1) while the count operation is
disabled (PEN1=0), "L" level output is retained.
bit14
Undefined bit
Read : The value is undefined
Write : No effect
bit13
PE1:
PPG1 pin output enable
bit
This bit switches between PPG1 pin functions and enables or disables the
pulse output.
When set to "0": Functions as a general-purpose I/O port. The pulse output
is disabled
When set to "1": Functions as PPG1 output pin. The pulse output is enabled
bit12
PIE1:
Underflow interrupt
enable bit
This bit enables or disables interrupt.
When set to "0": Generates no interrupt request even when an underflow
occurs (PUF1 = 1)
When set to "1": Generates an interrupt request when an underflow occurs
(PUF1 = 1)
PUF1:
Underflow generation
flag bit
8-bit PPG output 2-channel independent operation mode, 8+8-bit PPG
output operation mode:
Generates an underflow (PUF1 = 1) when the value of the PPG1 down
counter is counted down from 00H to FFH
16-bit PPG output operation mode:
Generates an underflow (PUF1 = 1) when the value of the
PPG0+PPG1 down counter is counted down from 0000H to FFFFH
• When an underflow occurs (PUF1=1) while underflow interrupt request is
enabled (PIE1=1), an interrupt request is generated.
When set to "0": Clears this bit
When set to "1": No effect
Read by a read-modify-write instruction:
"1" is read
MD1, MD0:
Operation mode
selection bits
These bits set the operation mode of the 8/16-bit PPG timer.
[Any mode other than 8-bit PPG output 2-channel independent
operation mode]
• Set the two bits of the PPG operation enable bits (PEN0, PEN1) at the
same time using a word instruction.
• Do not set operation of only one of the two channels (PEN1=0/PEN0=1 or
PEN1=1/PEN0=0).
Note:
Do not set MD1, MD0=10B.
Reserved: Reserved bit
Be sure to set this bit to "1".
bit11
bit10,
bit9
bit8
356
Function
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 16 8/16-BIT PPG TIMER
16.3 Configuration of 8/16-bit PPG Timer
MB90340E Series
16.3.3
PPG0/1 Count Clock Selection Register (PPG01)
The PPG0/1 count clock selection register selects the count clock and the output pin for
the 8/16-bit PPG timers 0 and 1.
Only the function of PPG01 is explained in this section. PPG23, 45, 67, 89, AB, CD, and
EF have the same function as PPG01, setting the respective 8/16-bit PPG timers 2 and 3,
4 and 5, 6 and 7, 8 and 9, A and B, C and D, and E and F.
■ PPG0/1 Count Clock Selection Register (PPG01)
Figure 16.3-4 PPG0/1 Count Clock Selection Register (PPG01)
ch.1 PPG01
Other channels:
ch.3 PPG23
ch.5 PPG45
ch.7 PPG67
ch.9 PPG89
ch.B PPGAB
ch.D PPGCD
ch.F PPGEF
Address
000032H
7
6
5
4
3
2
PCS2 PCS1 PCS0 PCM2 PCM1 PCM0
000036H R/W R/W R/W R/W R/W R/W
00003AH
00003EH
000042H
000046H
00004AH
00004EH
1
0
−
REV
Initial value
0 0 0 0 0 0 X 0B
R/W
bit0
REV
0
1
bit4
PPG output pin selection bit
Outputs pulses from the standard output pins
Switches between output pin PPGn and PPGm
bit3
bit2
PCM2 PCM1 PCM0
0
0
0
0
1
1
1
1
0
0
1
1
0
0
1
1
0
1
0
1
0
1
0
1
bit7
bit6
bit5
PCS2 PCS1 PCS0
R/W : Readable/writable
: Undefined
X
: Undefined
: Initial value
HCLK : Oscillation clock
: Machine clock frequency
φ
0
0
0
0
1
1
1
1
0
0
1
1
0
0
1
1
0
1
0
1
0
1
0
1
PPG0 count clock
selection bits
1/φ (41.7 ns)
2/φ (83.3 ns)
22/φ (167 ns)
23/φ (333 ns)
24/φ (667 ns)
Setting is prohibited
Setting is prohibited
29/HCLK (128 μs)
PPG1 count clock
selection bits
1/φ (41.7 ns)
2/φ (83.3 ns)
22/φ (167 ns)
23/φ (333 ns)
24/φ (667 ns)
Setting is prohibited
Setting is prohibited
29/HCLK (128 μs)
The value within parenthesis ( ) is the value operating at HCLK=4 MHz and φ=24 MHz.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
357
CHAPTER 16 8/16-BIT PPG TIMER
16.3 Configuration of 8/16-bit PPG Timer
MB90340E Series
Table 16.3-4 Functions of PPG0/1 Count Clock Selection Register (PPG01)
Bit name
Function
These bits set the count clock of the 8/16-bit PPG timer 1.
bit7
to
bit5
PCS2 to PCS0:
PPG1 count clock
selection bits
• The count clock is selected from five divided clocks of the machine
clock or the divided clock of the time-base timer.
• The settings of the PPG1 count clock select bits (PCS2 to PCS0) are valid
only in 8-bit PPG output 2-channel independent mode (PPGC1: MD1,
MD0=00B).
PCM2 to PCM0:
PPG0 count clock
selection bits
bit1
Undefined bit
Read : The value is undefined
Write: No effect
REV:
PPG output pin selection
bit
This bit switches the output pins of the 8/16-bit PPG timers 0 and 1.
When set to "0": Outputs from the standard output pins
PPG0 → PPG0 output pin
PPG1 → PPG1 output pin
When set to "1": Switches output pins
PPG0 → PPG1 output pin
PPG1 → PPG0 output pin
bit0
358
These bits set the count clock of the 8/16-bit PPG timer 0.
bit4
to
bit2
• The count clock is selected from five divided clocks of the machine
clock or the divided clock of the time-base timer.
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 16 8/16-BIT PPG TIMER
16.3 Configuration of 8/16-bit PPG Timer
MB90340E Series
16.3.4
PPG Reload Registers (PRLL0/PRLH0, PRLL1/PRLH1)
The value (reload value) from which the PPG down counter starts counting is set in the
PPG reload registers. The registers have an 8-bit for each "L" level side and "H" level
side.
Only the function of PRLL0/PRLH0 and PRLL1/PRLH1 is explained in this section.
PRLL2/PRLH2 to PRLLF/PRLHF have the same function as PRLL0/PRLH0, setting the
respective 8/16-bit PPG timers 2 to F.
■ PPG Reload Registers (PRLL0/PRLH0, PRLL1/PRLH1)
Figure 16.3-5 PPG Reload Registers (PRLL0/PRLH0, PRLL1/PRLH1)
ch.0 PRLH0
ch.1 PRLH1
Address bit15 bit14 bit13 bit12 bit11 bit10
007901H
007903H
Other channels:
ch.2
ch.3
ch.4
ch.5
ch.6
ch.7
ch.8
ch.9
ch.A
ch.B
ch.C
ch.D
ch.E
ch.F
PRLH2
PRLH3
PRLH4
PRLH5
PRLH6
PRLH7
PRLH8
PRLH9
PRLHA
PRLHB
PRLHC
PRLHD
PRLHE
PRLHF
007905H
007907H
007909H
00790BH
00790DH
00790FH
007911H
007913H
007915H
007917H
007919H
00791BH
00791DH
00791FH
Address
ch.0 PRLL0
ch.1 PRLL1
007900H
007902H
Other channels:
ch.2
ch.3
ch.4
ch.5
ch.6
ch.7
ch.8
ch.9
ch.A
ch.B
ch.C
ch.D
ch.E
ch.F
PRLL2
PRLL3
PRLL4
PRLL5
PRLL6
PRLL7
PRLL8
PRLL9
PRLLA
PRLLB
PRLLC
PRLLD
PRLLE
PRLLF
bit9
bit8
Initial value
D15
D14
D13
D12
D11
D10
D9
D8
R/W
R/W
R/W
R/W R/W
R/W
R/W
R/W
bit7
bit6
bit5
bit4
bit3
D7
D6
D5
D4
R/W
R/W
R/W
R/W R/W
D3
bit2
bit1
XXXXXXXX B
bit0
D2
D1
D0
R/W
R/W
R/W
Initial value
XXXXXXXX B
007904H
007906H
007908H
00790AH
00790CH
00790EH
007910H
007912H
007914H
007916H
007918H
00791AH
00791CH
00791EH
R/W : Readable/writable
×
: Undefined
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
359
CHAPTER 16 8/16-BIT PPG TIMER
16.3 Configuration of 8/16-bit PPG Timer
MB90340E Series
Table 16.3-5 shows each register function of the PPG reload registers.
Table 16.3-5 Functions of PPG Reload Registers
Function
8/16-bit PPG timer 0
8/16-bit PPG timer 1
Retains the reload value at "L" level side
PRLL0
PRLL1
Retains the reload value at "H" level side
PRLH0
PRLH1
Notes:
• In 16-bit PPG output operation mode (PPGC1: MD1, MD0=11B), set the reload registers using a
long-word instruction or set the PPG0 and PPG1 in this order using a word instruction.
• In 8+8-bit PPG output operation mode (PPGC1: MD1, MD0=01B), set both "L" level and "H" level
sides of the PPG reload register (PRLL0/PRLH0) in the 8/16-bit PPG timer 0 to the same value.
Setting a different value in "L" level and "H" level sides may cause the 8/16-bit PPG timer 1 to
have a different PPG output wave form for each clock cycle.
360
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
MB90340E Series
16.4
Interrupts of 8/16-bit PPG Timer
CHAPTER 16 8/16-BIT PPG TIMER
16.4 Interrupts of 8/16-bit PPG Timer
The 8/16-bit PPG timer can generate an interrupt request when an underflow of the PPG
down counter occurs. It also supports the extended intelligent I/O service (EI2OS) and
DMA transfer.
■ Interrupts of 8/16-bit PPG Timer
Table 16.4-1 shows the interrupt control bits and interrupt sources of the 8/16-bit PPG timer.
Table 16.4-1 Interrupt Control Bits of 8/16-bit PPG Timer
PPGn
PPGm
Interrupt request flag bit
PPGCn: PUF0
PPGCm: PUF1
Interrupt request enable bit
PPGCn: PIE0
PPGCm: PIE1
Interrupt source
Generation of PPGn down counter
underflow
Generation of PPGm down counter
underflow
n = 0, 2, 4, 6, 8, A, C, E
m=n+1
[8-bit PPG output 2-channel independent operation mode, 8+8-bit PPG output operation mode]
• In 8-bit PPG output 2-channel independent operation mode or 8+8-bit PPG output operation mode, the
PPGn and PPGm can generate an interrupt independently.
• When the PPGn or PPGm down counter is counted down from 00H to FFH, an underflow occurs. When
an underflow occurs, the underflow generation flag bit of the channel generating the underflow is set
(PPGCn: PUF0=1 or PPGCm: PUF1=1).
• If interrupt request of the channel that causes an underflow is enabled (PPGCn: PIE0=1 or PPGCm:
PIE1=1), an interrupt request is generated.
[16-bit PPG output operation mode]
• In 16-bit PPG output operation mode, when the PPGn+PPGm down counter is counted down from
0000H to FFFFH, an underflow occurs. When an underflow occurs, the underflow generation flag bits of
the two channels are set at the same time (PPGCn: PUF0=1 and PPGCm: PUF1=1).
• An interrupt request is generated when an underflow occurs if interrupt request of either of the two
channels is enabled (PPGCn: PIE1=0, PPGCm: PIE1=1 or PPGCn: PIE0=1, PPGCm: PIE1=0).
• To prevent duplication of interrupt requests, disable the underflow interrupt enable bit of either of the
two channels in advance (PPGCn: PIE0=0, PPGCm: PIE1=1 or PPGCn: PIE0=1, PPGCm: PIE1=0).
• If the underflow generation flag bits of the two channels are set (PPGCn: PUF0=1 and PPGCm:
PUF1=1), clear the two channels at the same time.
■ Interrupts of 8/16-bit PPG Timer
For interrupt number, interrupt control register, and interrupt vector address, see "CHAPTER 3
INTERRUPTS".
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
361
CHAPTER 16 8/16-BIT PPG TIMER
16.5 Operating Explanation of 8/16-bit PPG Timer
16.5
MB90340E Series
Operating Explanation of 8/16-bit PPG Timer
The 8/16-bit PPG timer outputs a pulse width of any frequency and any duty ratio
continuously.
■ Operation of 8/16-bit PPG Timer
● Output operation of 8/16-bit PPG timer
• The 8/16-bit PPG timer has two ("L" level side and "H" level side) 8-bit reload registers (PRLLn/
PRLHn, PRLLm/PRLHm) for each channel.
• The values set in the reload registers (PRLLn/PRLHn, PRLLm/PRLHm) are reloaded alternately into
the PPG down counters (PCNTn, PCNTm).
• After reloading the value into the PPG down counters, counting down starts in synchronization with the
count clock set by the PPG count clock select bits (PPGnm: PCM2 to PCM0, PCS2 to PCS0).
• If the values set in the reload registers are reloaded to the PPG down counters due to underflow, the pin
output is inverted.
Figure 16.5-1 shows the output wave form of 8/16-bit PPG timer.
Figure 16.5-1 Output Wave Form of 8/16-bit PPG Timer
Operation start
Operation stop
PPG operation
enable bit (PEN)
PPG output pin
T × (L + 1)
T × (H + 1)
L : Value of PPG reload register (PRLL)
H : Value of PPG reload register (PRLH)
T : Count clock cycle
● Operation mode of 8/16-bit PPG timer
While the operation of the 8/16-bit PPG timer is enabled (PPGCn: PEN0=1, PPGCm: PEN1=1), a pulse
wave is output continuously from the PPG output pin. The pulse wave can be set to any frequency and duty
ratio.
The pulse output of the 8/16-bit PPG timer will not stop until operation of the 8/16-bit PPG timer is stopped
(PPGCn: PEN0=0, PPGCm: PEN1=0).
• 8-bit PPG output 2-channel independent operation mode
• 16-bit PPG output operation mode
• 8+8-bit PPG output operation mode
Note:
362
n = 0, 2, 4, 6, 8, A, C, E
m=n+1
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 16 8/16-BIT PPG TIMER
16.5 Operating Explanation of 8/16-bit PPG Timer
MB90340E Series
16.5.1
8-bit PPG Output 2-channel Independent Operation Mode
In 8-bit PPG output 2-channel independent operation mode, the 8/16-bit PPG timer is set
as an 8-bit PPG timer with two independent channels. PPG output operation and
interrupt request generation can be performed independently for each channel.
■ Setting for 8-bit PPG Output 2-channel Independent Operation Mode
To operate in 8-bit PPG output 2-channel independent operation mode, the setting shown in Figure 16.5-2
is required.
Figure 16.5-2 Setting for 8-bit PPG Output 2-channel Independent Operation Mode
bit15 14
PPGCm/PPGCn PEN1
13
12
11
10
9
PE1 PIE1 PUF1 MD1 MD0
1
0
0
bit8 bit7
Reserved PEN0
1
6
5
4
3
2
1
PE0 PIE0 PUF0
1
bit0
Reserved
1
PPGnm
(Reserved area)
PRLHn/PRLLn
Set PPGn "H" level side reload value
Set PPGn "L" level side reload value
PRLHm/PRLLm Set PPGm "H" level side reload value
Set PPGm "L" level side reload value
PCS2PCS1 PCS0 PCM2PCM1 PCM0
REV
: Used bit
− : Undefined bit
1 : Set to "1"
0 : Set to "0"
Note:
n = 0, 2, 4, 6, 8, A, C, E
m=n+1
Note:
Set both "H" level side and "L" level side of the PPG reload registers (PRLLn/PRLHn,
PRLLm/PRLHm) at the same time using a word instruction.
● Operation in 8-bit PPG output 2-channel independent operation mode
• The 8-bit PPG timer with two channels performs an independent PPG operation in each channel.
• When pin output is enabled (PPGCn:PE0=1, PPGCm:PE1=1), a PPGn pulse wave is output from the
PPGn pin and a PPGm pulse wave is output from the PPGm pin if the PPG output pin selection is set to
standard (PPGnm:REV=0). If PPG output pin switching is set (PPGnm:REV=1), a PPGm pulse wave is
output from the PPGn pin and a PPGn pulse wave is output from the PPGm pin.
• When the reload value is set in the PPG reload registers (PRLLn/PRLHn, PRLLm/PRLHm) to enable
the operation of the PPG timer (PPGCn: PEN0=1, PPGCm: PEN1=1), the PPG down counter of the
enabled channel starts counting.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
363
CHAPTER 16 8/16-BIT PPG TIMER
16.5 Operating Explanation of 8/16-bit PPG Timer
MB90340E Series
• To stop the count operation of the PPG down counter, disable the operation of the PPG timer of the
channel to be stopped (PPGCn: PEN0=0, PPGCm: PEN1=0). The count operation of the PPG down
counter is stopped and the output of the PPG output pin is held at "L" level.
• When the PPG down counter of one channel generates an underflow, the reload values set in the PPG
reload registers (PRLLn/PRLHn, PRLLm/PRLHm) are reloaded into the PPG down counter in which
the underflow occurs.
• When an underflow occurs, the underflow generation flag bit in the channel that causes the underflow is
set (PPGCn: PUF0=1, PPGCm: PUF1=1). If interrupt request is enabled at the channel that causes the
underflow (PPGCn: PIE0=1, PPGCm: PIE1=1), an interrupt request is generated.
● Output wave form in 8-bit PPG output 2-channel independent operation mode
• Both the "L" and "H" pulse widths to be output are determined by adding 1 to the values of the PPG
reload register of each channel and multiplying them by the count clock cycle. For example, if the value
of the PPG reload register is 00H, the pulse width becomes one cycle of the count clock, and if the value
is FFH, the pulse width becomes 256 cycles of the count clock.
The calculation formulas for pulse width are given below:
PL=T × (L+1)
PH=T × (H+1)
PL : "L" width of output pulse
PH : "H" width of output pulse
L : 8-bit value of PPG reload register (PRLLn or PRLLm)
H : 8-bit value of PPG reload register (PRLHn or PRLHm)
T : Count clock cycle
Figure 16.5-3 shows the output wave form in 8-bit PPG output 2-channel independent operation mode.
Figure 16.5-3 Output Wave Form in 8-bit PPG Output 2-channel Independent Operation Mode
Operation start
Operation stop
PPG operation enable
bit (PEN)
PPG output pin
T × (L + 1)
T × (H + 1)
L : Value of PPG reload register (PRLL)
H : Value of PPG reload register (PRLH)
T : Count clock cycle
Note:
364
n = 0, 2, 4, 6, 8, A, C, E
m=n+1
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 16 8/16-BIT PPG TIMER
16.5 Operating Explanation of 8/16-bit PPG Timer
MB90340E Series
16.5.2
16-bit PPG Output Operation Mode
In 16-bit PPG output operation mode, the 8/16-bit PPG timer is set as a 16-bit PPG timer
with one channel.
■ Setting for 16-bit PPG Output Operation Mode
To operate in 16-bit PPG output operation mode, the setting shown in Figure 16.5-4 is required.
Figure 16.5-4 Setting for 16-bit PPG Output Operation Mode
bit15 14
PPGCm/PPGCn PEN1
1
13
12
11
10
9
PE1 PIE1 PUF1 MD1 MD0
1
1
bit8 bit7
Reserved PEN0
1
6
5
4
3
2
PE0 PIE0 PUF0
1
1
bit0
Reserved
1
PPGnm
(Reserved area)
PRLHn/PRLLn
Set lower 8 bits of PPGn "H" level side reload value
PRLHm/PRLLm
Set upper 8 bits of PPGm "H" level side reload value Set upper 8 bits of PPGm "L" level side reload value
×
−
1
0
PCS2 PCS1 PCS0 PCM2 PCM1 PCM0
REV
Set lower 8 bits of PPGn "L" level side reload value
: Used bit
: Unused bit
: Undefined bit
: Set to "1"
: Set to "0"
Note:
n = 0, 2, 4, 6, 8, A, C, E
m=n+1
Note:
Set values in the PPG reload registers using a long-word instruction or set the PPGn and PPGm
(PRLLn →PRLLm, PRLHn →PRLHm) in this order using a word instruction.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
365
CHAPTER 16 8/16-BIT PPG TIMER
16.5 Operating Explanation of 8/16-bit PPG Timer
MB90340E Series
● Operation in 16-bit PPG Output Operation Mode
• When pin output of either PPGn pin or PPGm pin is enabled (PPGCn:PE0=1, PPGCm: PE1=1), a pulse
wave of the same wave form is output from both the PPGn and PPGm pins.
• When the reload value is set in the PPG reload registers (PRLLn/PRLHn, PRLLm/PRLHm) to enable
operation of the PPG timers (PPGCn:PEN0=1 and PPGCm: PEN1=1) simultaneously, the PPG down
counters start counting as a 16-bit down counter (PCNTn + PCNTm).
• To stop the count operation of the PPG down counters, disable the operation of the PPG timers of both
channels (PPGCn: PEN0=0 and PPGCm: PEN1=0) simultaneously. The count operation of the PPG
down counters is stopped and the output of the PPG output pin is held at "L" level.
• If the PPGm down counter generates an underflow, the reload values set in the PPGn and PPGm reload
registers (PRLLn/PRLHn, PRLLm/PRLHm) are reloaded into the PPG down counter (PCNTn +
PCNTm) simultaneously.
• When an underflow occurs, the underflow generation flag bits in both channels are set simultaneously
(PPGCn:PUF0=1, PPGCm:PUF1=1). If interrupt request is enabled at either channel (PPGCn: PIE0=1,
PPGCm: PIE1=1), an interrupt request is generated.
Notes:
• In 16-bit PPG output operation mode, the underflow generation flag bits in the two channels are
set simultaneously (PPGCn:PUF0=1 and PPGCm:PUF1=1) when an underflow occurs. To
prevent duplication of interrupt requests, disable either of the underflow interrupt enable bits in the
two channels (PPGCn:PIE0=0, PPGCm:PIE1=1 or PPGCn:PIE0=1, PPGCm:PIE1=0).
• If underflow generation flag bits are set, clear the two channels at the same time (PPGCn:
PUF0=0 and PPGCm: PUF1=0).
Note:
366
n = 0, 2, 4, 6, 8, A, C, E
m=n+1
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 16 8/16-BIT PPG TIMER
16.5 Operating Explanation of 8/16-bit PPG Timer
MB90340E Series
● Output wave form in 16-bit PPG output operation mode
• Both the "L" and "H" pulse widths to be output are determined by adding 1 to the values of the PPG
reload register of each channel and multiplying them by the count clock cycle. For example, if the value
of the PPG reload register is 0000H, the pulse width becomes one cycle of the count clock, and if the
value is FFFFH, the pulse width becomes 65,536 cycles of the count clock.
The calculation formulas for pulse width are given below:
PL=T × (L+1)
PH=T × (H+1)
PL : "L" width of output pulse
PH : "H" width of output pulse
L : 16-bit value of PPG reload register (PRLLn+PRLLm)
H : 16-bit value of PPG reload register (PRLHn+PRLHm)
T : Count clock cycle
Figure 16.5-5 shows the output wave form in 16-bit PPG output operation mode.
Figure 16.5-5 Output Wave Form in 16-bit PPG Output Operation Mode
Operation start
Operation stop
PPG operation enable
bit (PEN)
PPG output pin
T × (L + 1)
T × (H + 1)
L : 16-bit value of PPG reload register (PRLLm+PRLLn)
H : 16-bit value of PPG reload register (PRLHm+PRLHn)
T : Count clock cycle
Note:
n = 0, 2, 4, 6, 8, A, C, E
m=n+1
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
367
CHAPTER 16 8/16-BIT PPG TIMER
16.5 Operating Explanation of 8/16-bit PPG Timer
16.5.3
MB90340E Series
8+8-bit PPG Output Operation Mode
In 8+8-bit PPG output operation mode, the 8/16-bit PPG timer is set as an 8-bit PPG
timer in which PPG0 operates as an 8-bit prescaler and PPG1 operates using PPG
output of the PPG0 as a clock source.
■ Setting for 8+8-bit PPG Output Operation Mode
To operate in the 8+8-bit PPG output operation mode, the setting shown in Figure 16.5-6 is required.
Figure 16.5-6 Setting for 8+8-bit PPG Output Operation Mode
bit15 14
PPGCm/PPGCn PEN1
1
PPGnm
13
12
11
10
9
bit8 bit7
Re-
PE1 PIE1 PUF1 MD1 MD0 served PEN0
0
1
1
(Reserved area)
6
5
4
3
2
PE0 PIE0 PUF0
1
bit0
Reserved
1
1
PCS2 PCS1 PCS0 PCM2 PCM1 PCM0
REV
PRLHn/PRLLn
Set PPGn "H" level side reload value
Set PPGn "L" level side reload value
PRLHm/PRLLm
Set PPGm "H" level side reload value
Set PPGm "L" level side reload value
×
−
1
0
: Used bit
: Unused bit
: Undefined bit
: Set to "1"
: Set to "0"
Note:
n = 0, 2, 4, 6, 8, A, C, E
m=n+1
Note:
Set both "H" level side and "L" level side of the PPG reload registers (PRLLn/PRLHn,
PRLLm/PRLHm) at the same time using a word instruction.
368
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 16 8/16-BIT PPG TIMER
16.5 Operating Explanation of 8/16-bit PPG Timer
MB90340E Series
● Operation in 8+8-bit PPG output operation mode
• The PPGn operates as the prescaler of the PPGm timer and the PPGm operates using the PPGn output as
a count clock.
• When pin output is enabled (PPGCn: PE0=1, PPGCm: PE1=1), a PPGn pulse wave is output from the
PPGn pin and a PPGm pulse wave is output from the PPGm pin if the PPG output pin selection is set to
standard (PPGnm: REV=0). If PPG output pin switching is set (PPGnm: REV=1), the output pins of
PPGn and PPGm will be switched.
• When the reload value is set in the PPG reload registers (PRLLn/PRLHn, PRLLm/PRLHm) to enable
operation of the PPG timer (PPGCn:PEN0=1 and PPGCm: PEN1=1), the PPG down counter starts
counting.
• To stop the count operation of the PPG down counter, disable the operation of the PPG timers of both
channels (PPGCn: PEN0=0 and PPGCm: PEN1=0) at the same time. The count operation of the PPG
down counter is stopped and the output of the PPG output pin is held at "L" level.
• When the PPG down counter of one channel generates an underflow, the reload values set in the PPG
reload registers (PRLLn/PRLHn, PRLLm/PRLHm) are reloaded into the PPG down counter in which
the underflow occurs.
• When an underflow occurs, the underflow generation flag bit in the channel that causes the underflow is
set (PPGCn:PUF0=1, PPGCm:PUF1=1). If interrupt request is enabled at the channel that causes the
underflow (PPGCn: PIE0=1, PPGCm: PIE1=1), an interrupt request is generated.
Notes:
• Do not operate PPGm (PPGCm:PEN1=1) when PPGn is stopped (PPGCn:PEN0=0).
• It is recommended to set both "L" level and "H" level sides of the PPG reload registers (PRLLn/
PRLHn, PRLLm/PRLHm) to the same value.
n = 0, 2, 4, 6, 8, A, C, E
m=n+1
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
369
CHAPTER 16 8/16-BIT PPG TIMER
16.5 Operating Explanation of 8/16-bit PPG Timer
MB90340E Series
● Output wave form in 8+8-bit PPG output operation mode
• Both the "L" and "H" pulse widths to be output are determined by adding 1 to the values of the PPG
reload register of each channel and multiplying them by the count clock cycle.
The calculation formulas for pulse width are given below:
PL=T × (Ln+1) × (Lm+1)
PH=T × (Hn+1) × (Hm+1)
PL : "L" width of output pulse from PPGm pin
PH : "H" width of output pulse from PPGm pin
Ln : 8-bit value of PPG reload register (PRLLn)
Hn : 8-bit value of PPG reload register (PRLHn)
Lm : 8-bit value of PPG reload register (PRLLm)
Hm : 8-bit value of PPG reload register (PRLHm)
T : Count clock cycle
Figure 16.5-7 shows the output wave form in 8+8-bit PPG output operation mode.
Figure 16.5-7 Output Wave Form in 8+8-bit PPG Output Operation Mode
Operation disable
Operation start
PPG operation enable
bit (PEN0, PEN1)
T × (L 0 + 1) T × (H 0 + 1)
PPGn output pin
PPGm output pin
T × (L0 + 1) × (L1+ 1)
Ln
Hn
Lm
Hm
T
: 8-bit value of PPG reload register (PRLLn)
: 8-bit value of PPG reload register (PRLHn)
: 8-bit value of PPG reload register (PRLLm)
: 8-bit value of PPG reload register (PRLHm)
: Count clock cycle
Note:
370
T × (H 0 + 1) × (H 1 + 1)
n = 0, 2, 4, 6, 8, A, C, E
m=n+1
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
MB90340E Series
16.6
Notes on Using 8/16-bit PPG Timer
CHAPTER 16 8/16-BIT PPG TIMER
16.6 Notes on Using 8/16-bit PPG Timer
Note the following when using the 8/16-bit PPG timer.
■ Notes on Using 8/16-bit PPG Timer
● Effect on 8/16-bit PPG timer when using time-base timer output
• If output of the time-base timer is used as count clock input of the 8/16-bit PPG timer (PPGnm: PCM2
to PCM0=111B, PCS2 to PCS0=111B), deviation may occur in the first count cycle in which the PPG
timer is started by trigger input or in the count cycle immediately after the PPG timer is stopped.
• When the time-base timer counter is cleared (TBTC:TBR=0) during count operation of the PPG down
counter, deviation may occur in the count cycle.
● Setting of PPG reload registers when using 8-bit PPG timer
• The "L" level side and "H" level side pulse widths are determined at the timing of reloading the values
in the "L" level PPG reload registers (PRLLn, PRLLm) into the PPG down counter.
• If the 8-bit PPG timer is used in 8-bit PPG output 2-channel independent operation mode or 8+8-bit
PPG output operation mode, set both "H" level side and "L" level side of the PPG reload registers
(PRLLn/PRLHn, PRLLm/PRLHm) at the same time using a word instruction.
Using a byte instruction may cause an unexpected pulse to be generated.
[Example of rewriting PPG reload registers using a byte instruction]
If the value in the "H" level side PPG reload register (PRLH) is rewritten after the value in the "L" level
side PPG reload register (PRLL) is rewritten using a byte instruction immediately before the signal level of
the PPG pin switches from "H" to "L", a pulse having "L" width set after rewriting and "H" width set
before rewriting will be generated just one time.
Figure 16.6-1 shows a wave form of when the values in the PPG reload registers are rewritten using a byte
instruction.
Note:
CM44-10143-5E
n = 0, 2, 4, 6, 8, A, C, E
m=n+1
FUJITSU SEMICONDUCTOR LIMITED
371
CHAPTER 16 8/16-BIT PPG TIMER
16.6 Notes on Using 8/16-bit PPG Timer
MB90340E Series
Figure 16.6-1 Wave Form of when PPG Reload Registers are Rewritten Using a Byte Instruction
PRLL
A
PRLH
B
C
D
A +B
A +B
B +C
C+D
B
B
C+D
C+D
D
D
Timing of updating
reload value
PPG pin
A
B
A
C
C
C
<1> <2>
<1>: Change the value (A→C) of PPG reload register (PRLL)
<2>: Change the value (B →D) of PPG reload register (PRLH)
● Setting of PPG reload registers when using 16-bit PPG timer
• Set the PPG reload registers (PRLLn/PRLHn, PRLLm/PRLHm) using a long-word instruction or set
PPGn →PPGm (PRLLn/PRLHn →PRLLm/PRLHm) in this order using a word instruction.
[Reload timing in 16-bit PPG output operation mode]
In 16-bit PPG output operation mode, the reload values written to the PPGn reload register are written
temporarily to the temporary latch and then transferred to the PPGn reload register (PRLLn, PRLHn) after
reload values are written to the PPGm reload register. Therefore, when setting PPGm reload values, it is
necessary to set reload values in the PPGn reload register simultaneously or set reload values in the PPGn
reload register before setting reload values in the PPGm reload register.
Figure 16.6-2 shows the reload timing in 16-bit PPG output operation mode.
Figure 16.6-2 Reload Timing in 16-bit PPG Output Operation Mode
Reload value
of PPGn
Write to PPGn in any mode
other than 16-bit PPG output
operation mode
16-bit PPG output operation mode only
Temporary latch
372
Write to
PPGm
Transfer in synchronization
with writing to PPGm
PPG reload register
(PRLLn, PRLHn)
Note:
Reload value
of PPGm
PPG reload register
(PRLLm, PRLHm)
n = 0, 2, 4, 6, 8, A, C, E
m=n+1
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 17
DTP/EXTERNAL INTERRUPT
This chapter explains the functions and operations of
the DTP/external interrupt.
17.1 Overview of DTP/External Interrupt
17.2 Block Diagram of DTP/External Interrupt
17.3 Configuration of DTP/External Interrupt
17.4 Explanation of Operation of DTP/External Interrupt
17.5 Notes on Using DTP/External Interrupt
17.6 Program Example of DTP/External Interrupt Function
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
373
CHAPTER 17 DTP/EXTERNAL INTERRUPT
17.1 Overview of DTP/External Interrupt
17.1
MB90340E Series
Overview of DTP/External Interrupt
The DTP/external interrupt sends interrupt requests from external peripheral devices or
data transfer requests to CPU to generate an external interrupt request, or activates the
DMA extended intelligent I/O service (EI2OS).
■ DTP/External Interrupt Function
The DTP/external interrupt follows the same procedure as resource interrupts to send interrupt requests
from external peripheral devices to the CPU to generate an external interrupt request, or activates the DMA
extended intelligent I/O service (EI2OS).
If the extended intelligent I/O service (EI2OS) is disabled in the interrupt control register (ICR:ISE=0) and
the DMA transfer is disabled in the DMA enable register (DER:EN=0), the external interrupt function is
enabled, branching to interrupt processing.
If the DMA or the EI2OS is enabled, the DTP function is enabled and automatic data transfer is performed,
branching to interrupt processing after the completion of data transfer for the specified number of times.
Table 17.1-1 shows an overview of the DTP/external interrupt.
Table 17.1-1 Overview of DTP/External Interrupt
External Interrupt
Input pin
DTP Function
16 pins: INT0 to INT7, INT8 to INT15 (INT8R to INT15R)
Set for each pin using the detection level setting registers (ELVR).
Interrupt source
Input of "H" level/"L" level
Interrupt number
#26(1AH), #28(1CH)
Interrupt control
The interrupt request output is enabled/disabled using the DTP/external interrupt
enable register (ENIR)
Interrupt flag
The interrupt source is held using the DTP/external interrupt source register (EIRR)
Processing
selection
DMA and EI2OS is disabled.
(DER:EN=0 and ICR: ISE=0)
DMA and EI2OS is enabled.
(DER:EN=1 and ICR: ISE=1)
A branch is caused to the external
interrupt processing routine
DMA or EI2OS performs automatic
data transfer and completes the
specified number of time for data
transfers, causing a branch to the
interrupt processing
Process
374
Input of "H" level/"L" level/rising edge/
falling edge
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 17 DTP/EXTERNAL INTERRUPT
17.2 Block Diagram of DTP/External Interrupt
MB90340E Series
17.2
Block Diagram of DTP/External Interrupt
A block diagram of the DTP/external interrupt is shown below.
■ Block Diagram of DTP/External Interrupt
Figure 17.2-1 Block Diagram of DTP/External Interrupt
Detection level setting register (ELVR0)
LB7 LA7 LB6 LA6 LB5 LA5 LB4 LA4
Pin
Level edge
selector
INT7
Pin
Level edge
selector
Internal data bus
Level edge
selector
Pin
Level edge
selector
INT2
Level edge
selector
INT5
Pin
Pin
INT3
INT6
Pin
LB3 LA3 LB2 LA2 LB1 LA1 LB0 LA0
Pin
Level edge
selector
INT1
Level edge
selector
INT4
Pin
Level edge
selector
INT0
DTP/external interrupt input
detection circuit
ER7 ER6 ER5 ER4 ER3 ER2 ER1 ER0
Interrupt
request signal
DTP/external interrupt
source register (EIRR0)
Interrupt
request signal
EN7 EN6 EN5 EN4 EN3 EN2 EN1 EN0 DTP/external interrupt
enable register (ENIR0)
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
375
CHAPTER 17 DTP/EXTERNAL INTERRUPT
17.2 Block Diagram of DTP/External Interrupt
MB90340E Series
Figure 17.2-2 Block Diagram of DTP/External Interrupt
Detection level setting register (ELVR1)
LB15 LA15 LB14 LA14 LB13 LA13 LB12 LA12
Pin
Level edge
selector
INT15
Pin
Level edge
selector
Internal data bus
Level edge
selector
Pin
Level edge
selector
INT10
Level edge
selector
INT13
Pin
Pin
INT11
INT14
Pin
LB11 LA11 LB10 LA10 LB9 LA9 LB8 LA8
Pin
Level edge
selector
INT9
Level edge
selector
INT12
Pin
Level edge
selector
INT8
DTP/external interrupt input
detection circuit
ER15 ER14 ER13 ER12 ER11 ER10 ER9 ER8
Interrupt
request signal
DTP/external interrupt
source register (EIRR1)
Interrupt
request signal
EN15 EN14 EN13 EN12 EN11 EN10 EN9 EN8
DTP/external interrupt
enable register (ENIR1)
● DTP/external interrupt input detection circuit
This circuit detects interrupt requests or data transfer requests generated from external peripheral devices.
The interrupt request flag bit corresponding to the pin whose level or edge set by the detection level setting
register is detected is set to "1" (EIRR1:ER).
376
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 17 DTP/EXTERNAL INTERRUPT
17.2 Block Diagram of DTP/External Interrupt
MB90340E Series
● Detection level setting register (ELVR0/ELVR1)
This register sets the level or edge of input signals from external peripheral devices that cause DTP/external
interrupt source.
● DTP/external interrupt source register (EIRR0/EIRR1)
This register holds DTP/external interrupt sources.
If a valid signal is input to the DTP/external interrupt pin, the corresponding DTP/external interrupt request
flag bit is set to "1".
● DTP/external interrupt enable register (ENIR0/ENIR1)
This register enables or disables DTP/external interrupt requests from external peripheral devices.
■ Details of Pins and Interrupt Numbers
Table 17.2-1 shows the pins and interrupt numbers used in the DTP/external interrupt.
Table 17.2-1 Pins and Interrupt Numbers Used by DTP/External Interrupt
Pin
Channel
P70
INT0
P71
INT1
P72
INT2
P73
INT3
P74
INT4
P75
INT5
P76
INT6
P77
INT7
P00 / PA0
INT8 / INT8R
P01 / P42
INT9 / INT9R
P02 / P32
INT10 / INT10R
P03 / P12
INT11 / INT11R
P04 / P80
INT12 / INT12R
P05 / P81
INT13 / INT13R
P06 / P82
INT14 / INT14R
P07 / P84
INT15 / INT15R
Interrupt Number
DMA Number
#26(1AH)
3
#28(1CH)
4
#26(1AH)
3
#28(1CH)
4
INT8 to INT15 / INT8R to INT15R are selected in the external interrupt source select register (EISSR).
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
377
CHAPTER 17 DTP/EXTERNAL INTERRUPT
17.3 Configuration of DTP/External Interrupt
17.3
MB90340E Series
Configuration of DTP/External Interrupt
This section lists and details the pins, interrupt sources, and registers in the DTP/
external interrupt.
■ Pins of DTP/External Interrupt
The pins used by the DTP/external interrupt serve as general-purpose I/O ports.
Table 17.3-1 lists the pin functions and the pin setting required for use in the DTP/external interrupt.
Table 17.3-1 Pins of DTP/External Interrupt (1 / 2)
Pin Name
Pin Function
Pin Settings Required for Use in
DTP/External Interrupt
P70/INT0/AN16
P71/INT1/AN17
P72/INT2/AN18
P73/INT3/AN19
P74/INT4/AN20
General-purpose I/O ports /
DTP external interrupt inputs /
A/D converter analog input
• Set as input ports in port direction register
(DDR7)
• Set the analog input enable register
(ADER7) as disabled
P75/INT5/AN21
P76/INT6/AN22
P77/INT7/AN23
P00/INT8/AD00
P01/INT9/AD01
P02/INT10/AD02
P03/INT11/AD03
P04/INT12/AD04
P05/INT13/AD05
General-purpose I/O ports /
DTP external interrupt inputs /
Address data bus lower I/O
• Set the external interrupt source select
register (EISSR) to 0
• Set as input ports in port direction register
(DDR0)
Note:
Available only in the single-chip mode
P06/INT14/AD06
P07/INT15/AD07
378
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 17 DTP/EXTERNAL INTERRUPT
17.3 Configuration of DTP/External Interrupt
MB90340E Series
Table 17.3-1 Pins of DTP/External Interrupt (2 / 2)
Pin Name
Pin Function
PA0/
INT8R/
RX0
General-purpose I/O ports /
DTP external interrupt inputs /
CAN0 input Rx0
P42/
INT9R/
RX1/
IN6
General-purpose I/O ports /
DTP external interrupt inputs /
CAN1 input Rx1 /
Input capture input IN6
P32/
INT10R/
WR1/WR/
RX2
General-purpose I/O ports /
DTP external interrupt inputs /
Write strobe outputs /
CAN2 input Rx2
P12/
INT11R/
AD10/
SIN3
General-purpose I/O ports /
DTP external interrupt inputs /
Address data bus upper I/O
UART3 input SIN3
P80/
INT12R/
TIN0/
ADTG
General-purpose I/O ports /
DTP external interrupt inputs /
Reload timer 0 trigger input TIN0 /
A/D converter trigger input ADTG
P81/
INT13R/
TOT0/
CKOT
General-purpose I/O ports /
DTP external interrupt inputs /
Reload timer 0 output TOT0 /
Clock monitor output CKOT
P82/
INT14R/
SIN0/
TIN2
General-purpose I/O ports /
DTP external interrupt inputs /
UART0 input SIN0 /
Reload timer 2 trigger input TIN2
P84/
INT15R/
SCK0
General-purpose I/O ports /
DTP external interrupt inputs /
UART0 clock I/O SCK0
CM44-10143-5E
Pin Settings Required for Use in
DTP/External Interrupt
• Set the external interrupt source select
register (EISSR) to 1
• Set as input ports in port direction register
(DDR)
• Set the external interrupt source select
register (EISSR) to 1
• Set as input ports in port direction register
(DDR)
• Set the timer control status register
(TMCSR0:OUTE) as disabled
• Set the clock output enable register
(CLKR:CKEN) as disabled
• Set the external interrupt source select
register (EISSR) to 1
• Set as input ports in port direction register
(DDR)
FUJITSU SEMICONDUCTOR LIMITED
379
CHAPTER 17 DTP/EXTERNAL INTERRUPT
17.3 Configuration of DTP/External Interrupt
MB90340E Series
■ List of Registers and Reset Values in DTP/External Interrupt
Figure 17.3-1 List of Registers and Reset Values in DTP/External Interrupt
7
6
5
4
3
2
1
0
Initial value
EN7
EN6
EN5
EN4
EN3
EN2
EN1
EN0
00000000 B
7
6
5
4
3
2
1
0
EN15
EN14
EN13
EN12
EN11
EN10
EN9
EN8
15
14
13
12
11
10
9
8
Address: 0000C7H
ER7
ER6
ER5
ER4
ER3
ER2
ER1
ER0
bit
EIRR1
Address: 0000CB H
15
14
13
12
11
10
9
8
ER15
ER14
ER13
ER12
ER11
ER10
ER9
ER8
7
6
5
4
3
2
1
0
LB3
LA3
LB2
LA2
LB1
LA1
LB0
LA0
15
14
13
12
11
10
9
8
LB7
LA7
LB6
LA6
LB5
LA5
LB4
LA4
7
6
5
4
3
2
1
0
LB11
LA11
LB10
LA10
LB9
LA9
LB8
LA8
15
14
13
12
11
10
9
8
LB15
LA15
LB14
LA14
LB13
LA13
LB12
LA12
7
6
5
4
3
2
1
0
ENIR0
bit
Address: 0000C6 H
ENIR1
bit
Address: 0000CA H
EIRR0
ELVR0
bit
bit
Address: 0000C8 H
ELVR0
bit
Address: 0000C9 H
ELVR1
bit
Address: 0000CCH
ELVR1
bit
Address: 0000CDH
EISSR
bit
Address: 0000CE H INT15R INT14R INT13R INT12R INT11R INT10R INT9R INT8R
380
FUJITSU SEMICONDUCTOR LIMITED
00000000 B
XXXXXXXXB
XXXXXXXXB
00000000 B
00000000B
00000000B
00000000B
00000000B
CM44-10143-5E
CHAPTER 17 DTP/EXTERNAL INTERRUPT
17.3 Configuration of DTP/External Interrupt
MB90340E Series
17.3.1
DTP/External Interrupt Source Register (EIRR0/EIRR1)
This register holds DTP/external interrupt sources.
If a valid signal is input to the DTP/external interrupt pin, the corresponding interrupt
request flag bit is set to "1".
EIRR0 corresponds to INT0 to INT7, and EIRR1 corresponds to INT8 to INT15/INT8R to
INT15R.
■ DTP/External Interrupt Source Register (EIRR0/EIRR1)
Figure 17.3-2 DTP/External Interrupt Source Register (EIRR0/EIRR1)
Address
EIRR0: 0000C7H
bit 15
14
13
12
11
10
9
8
ER7 ER6 ER5 ER4 ER3 ER2 ER1 ER0
R/W R/W R/W R/W R/W R/W R/W R/W
Initial value: XXXXXXXB
bit15 to bit8
ER7 to ER0
0
1
Address
EIRR1: 0000CBH
bit 15
14
13
12
11
10
9
R/W R/W R/W R/W R/W R/W R/W R/W
Writing
Clear of ER bit
No effect
Initial value: XXXXXXXB
bit15 to bit8
ER15 to ER8
CM44-10143-5E
Reading
No DTP/external interrupt input
DTP/external interrupt input
8
ER15 ER14 ER13 ER12 ER11 ER10 ER9 ER8
R/W: Readable/writable
X : Undefined
DTP/External interrupt request flag bit
0
1
DTP/External interrupt request flag bit
Reading
No DTP/external interrupt input
DTP/external interrupt input
FUJITSU SEMICONDUCTOR LIMITED
Writing
Clear of ER bit
No effect
381
CHAPTER 17 DTP/EXTERNAL INTERRUPT
17.3 Configuration of DTP/External Interrupt
MB90340E Series
Table 17.3-2 Function of DTP/External Interrupt Source Register (EIRR)
Bit name
bit15
to
bit8
Function
ER15 to ER8(EIRR1),
ER7 to ER0(EIRR0):
DTP/External
interrupt request flag
bits
These bits are set to "1" when the edges or level signals set by the
detection condition select bits in the detection level setting register
(ELVR1:LB, LA) are input to the DTP/external interrupt pins.
When set to "1":
When the DTP/external interrupt request enable bit
(ENIR1:EN) is set to "1", an interrupt request is generated to
the corresponding DTP/external interrupt channel.
When set to "0": Cleared.
When set to "1": No effect.
Note:
For a read-modify-write (RMW) instruction, "1" is always read.
If more than one DTP/external interrupt request is enabled
(ENIR1:EN=1), clear only the bit in the channel that accepts an
interrupt (EIRR1:ER=0). No other bits must be cleared
unconditionally.
Reference:
When the DMA transfer or extended intelligent I/O service
(EI2OS) is activated, the interrupt request flag bit is automatically
cleared after the completion of data transfer (EIRR1:ER=0).
Notes:
• The value of the DTP/external interrupt source bit (EIRR:ER) is enabled only when the
corresponding DTP/external interrupt enable bit is set to "1". If the DTP/external interrupt is not
enabled (ENIR:EN=0), DTP/external interrupt source bit may be set regardless of the existence of
DTP/external interrupt source.
• Clear the corresponding DTP/external interrupt source bit (EIRR:ER) just before enabling the
DTP/external interrupt (ENIR:EN=1).
382
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 17 DTP/EXTERNAL INTERRUPT
17.3 Configuration of DTP/External Interrupt
MB90340E Series
17.3.2
DTP/External Interrupt Enable Register (ENIR0/ENIR1)
The DTP/external interrupt enable register (ENIR0/ENIR1) enables/disables the DTP/
external interrupt request in the external peripheral devices.
ENIR0 corresponds to INT0 to INT7, and ENIR1 corresponds to INT8 to INT15/INT8R to
INT15R.
■ DTP/External Interrupt Enable Register (ENIR0/ENIR1)
Figure 17.3-3 DTP/External Interrupt Enable Register (ENIR0/ENIR1)
bit 7
Address
ENIR0: 0000C6H
6
5
4
3
2
1
0
EN7 EN6 EN5 EN4 EN3 EN2 EN1 EN0
R/W R/W R/W R/W R/W R/W R/W R/W
Initial value: 00000000B
bit7 to bit0
EN7 to EN0
0
1
bit 7
Address
ENIR1: 0000CAH
6
5
4
3
2
1
0
EN15 EN14 EN13 EN12 EN11 EN10 EN9 EN8
R/W R/W R/W R/W R/W R/W R/W R/W
Initial value: 00000000B
bit7 to bit0
EN15 to EN8
0
1
R/W : Readable/writable
: Initial value
DTP/external interrupt request enable bit
DTP/external interrupt disable
DTP/external interrupt enable
DTP/external interrupt request enable bit
DTP/external interrupt disable
DTP/external interrupt enable
Table 17.3-3 Functions of DTP/External Interrupt Enable Register (ENIR0/ENIR1)
Bit name
bit7
to
bit0
Function
EN15 to EN8(ENIR1),
EN7 to EN0(ENIR0):
DTP/external interrupt
request enable bit
These bits enable or disable the DTP/external interrupt request to the
DTP/external interrupt channel.
If the DTP/external interrupt request enable bit (ENIR1:EN) and the
DTP/external interrupt request flag bit (EIRR1:ER) are set to "1", the
interrupt request is generated to the corresponding DTP/ external
interrupt pin.
Reference:
The state of the DTP/external interrupt pin can be read directly
using the port data register irrespective of the setting of the DTP/
external interrupt request enable bit.
Note:
Clear the corresponding DTP/external interrupt source bit (EIRR:ER) just before enabling the DTP/
external interrupt (ENIR:EN=1).
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
383
CHAPTER 17 DTP/EXTERNAL INTERRUPT
17.3 Configuration of DTP/External Interrupt
MB90340E Series
Table 17.3-4 Correspondence among DTP/External Interrupt Pins, DTP/External Interrupt
Request Flag Bits, and DTP/External Interrupt Request Enable Bits
384
DTP/external interrupt pin
DTP/external interrupt
request flag bit
DTP/external interrupt
request enable bit
INT0
ER0
EN0
INT1
ER1
EN1
INT2
ER2
EN2
INT3
ER3
EN3
INT4
ER4
EN4
INT5
ER5
EN5
INT6
ER6
EN6
INT7
ER7
EN7
INT8 / INT8R
ER8
EN8
INT9 / INT9R
ER9
EN9
INT10 / INT10R
ER10
EN10
INT11 / INT11R
ER11
EN11
INT12 / INT12R
ER12
EN12
INT13 / INT13R
ER13
EN13
INT14 / INT14R
ER14
EN14
INT15 / INT15R
ER15
EN15
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 17 DTP/EXTERNAL INTERRUPT
17.3 Configuration of DTP/External Interrupt
MB90340E Series
17.3.3
Detection Level Setting Register (ELVR0/ELVR1)
The detection level setting register sets the level or edge of input signals that cause the
interrupt sources of the DTP/external interrupt pin.
ELVR0 corresponds to INT0 to INT7, and ELVR1 corresponds to INT8 to INT15/INT8R to
INT15R.
■ Detection Level Setting Register (ELVR0/ELVR1)
Figure 17.3-4 Detection Level Setting Register (ELVR0/ELVR1)
Address
ELVR0: 0000C8B
bit 15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
Initial value
LB7 LA7 LB6 LA6 LB5 LA5 LB4 LA4 LB3 LA3 LB2 LA2 LB1 LA1 LB0 LA0 0000000000000000B
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
bit15 to bit0
LB7, LB6
LB5, LB4
LB3, LB2
LB1, LB0
0
0
1
1
Address
ELVR1: 0000CCB
bit 15
14
13
12
11
10
9
8
7
6
5
4
3
2
LA7, LA6,
LA5, LA4,
LA3, LA2,
LA1, LA0
Detection condition
select bit
0
1
"L" level detection
"H" level detection
0
1
Rising edge detection
Falling edge detection
1
0
Initial value
LB15 LA15 LB14 LA14 LB13 LA13 LB12 LA12 LB11 LA11 LB10 LA10 LB9 LA9 LB8 LA8 0000000000000000B
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
bit15 to bit0
LB15, LB14,
LB13, LB12,
LB11, LB10,
LB9, LB8,
LA15, LA14,
LA13, LA12,
LA11, LA10,
LA9, LA8
0
0
1
0
1
R/W : Readable/writable
: Initial value
0
1
1
Detection condition
select bit
"L" level detection
"H" level detection
Rising edge detection
Falling edge detection
Table 17.3-5 Functions of Detection Level Setting Register (ELVR0/1)
Bit name
bit15
to
bit0
Function
ELVR1:
LB15, LA15 to LB8,
LA8
ELVR0:
LB7, LA7 to LB0,
LA0
Detection condition
select bits
CM44-10143-5E
These bits set the levels or edges of input signals from external
peripheral devices that cause interrupt sources in the DTP/external
interrupt pins.
• Two levels or two edges are selectable for external interrupts, and
two levels are selectable for DMA or EI2OS.
Reference:
When the set detection signal is input to the DTP/external
interrupt pins, the DTP/external interrupt request flag bits are set
to "1" even if DTP/external interrupt requests are disabled
(ENIR1:EN=0).
FUJITSU SEMICONDUCTOR LIMITED
385
CHAPTER 17 DTP/EXTERNAL INTERRUPT
17.3 Configuration of DTP/External Interrupt
MB90340E Series
Notes:
• If any setting of this register is changed, the interrupt source flag can be set.
Therefore, If you want to change the setting of this register, disable the interrupt (or, set the
corresponding bit of ENIR0/ENIR1 to "0") in advance.
To enable the interrupt (or, set the corresponding bit of ENIR0/ENIR1 to "1") after the setting of
this register is changed, be sure to clear the interrupt source flag bit (the corresponding bit of
EIRR0/EIRR1).
• When the DTP/external interrupt is disabled (ENIR:EN=0) in the stop/watch/time-base timer
mode, the input is masked and the "L" level will be sent inwardly if CMOS/Automotive is selected
and the "H" level will be sent inwardly if TTL is selected. If the sent level matches the detection
level setting, interrupt source flag bit will be set.
Table 17.3-6 Correspondence between Detection Level Setting Register and Channels
DTP/External Interrupt Pin
Register Name
Bit name
INT0
LB0, LA0
INT1
LB1, LA1
INT2
LB2, LA2
INT3
LB3, LA3
ELVR0
INT4
LB4, LA4
INT5
LB5, LA5
INT6
LB6, LA6
INT7
LB7, LA7
INT8 / INT8R
LB8, LA8
INT9 / INT9R
LB9, LA9
INT10 / INT10R
LB10, LA10
INT11 / INT11R
LB11, LA11
ELVR1
386
INT12 / INT12R
LB12, LA12
INT13 / INT13R
LB13, LA13
INT14 / INT14R
LB14, LA14
INT15 / INT15R
LB15, LA15
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 17 DTP/EXTERNAL INTERRUPT
17.3 Configuration of DTP/External Interrupt
MB90340E Series
17.3.4
External Interrupt Source Select Register (EISSR)
This register can change the assignment of the external interrupt pin of upper 8 bits.
This allows the external interrupt of upper 8-bits when the external bus is used. Also,
the function such as CAN wakeup is implemented.
■ Selection of External Interrupt Source
The external interrupt pin of the upper 8-bit is normally assigned to INT15 to INT8, and shares the port 0/
external bus and pin. In the external bus mode, the port 0 cannot be used as the external interrupt pin.
However, those external interrupt can be used by assigning them to other pins (INT15R to INT8R). The pin
is switched by the external interrupt source select register (EISSR). In addition, because INT15R to INT8R
share the function such as CAN input pin, the function such as CAN wakeup is implemented. See Table
17.3-8 for the pin function of INT15R to INT8R.
Figure 17.3-5 DTP/External Interrupt Source Select Register (EISSR)
7
6
5
4
3
2
1
0
Address
EISSR: 0000CEH INT15R INT14R INT13R INT12R INT11R INT10R INT9R INT8R
Initial value: 00000000B
R/W R/W R/W R/W R/W R/W R/W R/W
bit7 to bit0
INT15R to INT8R
R/W : Readable/writable
X : Undefined
: Initial value
0
1
External Interrupt Source Select Bit
Set pins INT15 to INT8 (Port 0) as external interrupt source
Set pins INT15R to INT8R as external interrupt source
* See Table 17.3-8 for the pin assignment of INT15R to INT8R.
Table 17.3-7 Function of DTP/External Interrupt Source Register (EIRR)
Bit name
bit7
to
bit0
CM44-10143-5E
Function
INT15R to INT8R:
External interrupt
source select bits
When these bits are set to "1", the input pin of the corresponding
external interrupt source (upper 8-bit) is assigned to the INT15R to
INT8R.
When set to "0": The external interrupt source of the upper 8-bit is
assigned to INT15 to INT8 pins.
When set to "1": The external interrupt source of the upper 8-bit is
assigned to the INT15R to INT8R pins.
FUJITSU SEMICONDUCTOR LIMITED
387
CHAPTER 17 DTP/EXTERNAL INTERRUPT
17.3 Configuration of DTP/External Interrupt
MB90340E Series
Table 17.3-8 External Interrupt Source Select (Upper 8-bit)
388
EISSR Bit
"0" (Initial Value)
INT8R
INT8 : P00
INT8R : PA0 (RX0)
INT9R
INT9 : P01
INT9R : P42 (RX1/IN6)
INT10R
INT10: P02
INT10R: P32 (RX2)
INT11R
INT11: P03
INT11R: P12 (SIN3)
INT12R
INT12: P04
INT12R: P80 (TIN0/ADTG)
INT13R
INT13: P05
INT13R: P81 (TOT0/CKOT)
INT14R
INT14: P06
INT14R: P82 (SIN0/TIN2)
INT15R
INT15: P07
INT15R: P84 (SCK0)
FUJITSU SEMICONDUCTOR LIMITED
"1"
CM44-10143-5E
CHAPTER 17 DTP/EXTERNAL INTERRUPT
17.4 Explanation of Operation of DTP/External Interrupt
MB90340E Series
17.4
Explanation of Operation of DTP/External Interrupt
The DTP/external interrupt has an external interrupt function and a DTP function. This
section explains the setting and operation of each function.
■ Setting of DTP/External Interrupt
Using the DTP/external interrupt requires the setting shown in Figure 17.4-1.
Figure 17.4-1 Setting of DTP/External Interrupt
bit15 14
ICR Interrupt Control Register
(EI2
At DTP
OS)
At DTP (DMA)
ENIR1/ENIR0
–
11
10
9 bit8 bit7 6
5
4
3
2
1 bit0
–
–
–
0
1
–
–
–
0
1
EN15 EN14 EN13 EN12 EN11 EN10 EN9 EN8 EN7 EN6 EN5 EN4 EN3 EN2 EN1 EN0
–
–
–
–
–
–
–
–
–
–
–
–
–
–
–
–
–
–
–
–
–
–
0
1
0
1
–
–
–
–
–
–
EN15 EN14 EN13 EN12 EN11 EN10 EN9 EN8 EN7 EN6 EN5 EN4 EN3 EN2 EN1 EN0
❍
EIRR1/EIRR0
12
ICS3 ICS2 ICS1 ICS0 ISE IL2 IL1 IL0 ICS3 ICS2 ICS1 ICS0 ISE IL2 IL1 IL0
At external interrupt/DTP (DMA) –
At DTP (EI2OS)
DER
(DMA enable register)
13
❍
❍
❍
❍
❍
❍
❍
❍
❍
❍
❍
❍
❍
❍
❍
ER15 ER14 ER13 ER12 ER11 ER10 ER9 ER8 ER7 ER6 ER5 ER4 ER3 ER2 ER1 ER0
ELVR0
LB7 LA7 LB6 LA6 LB5 LA5 LB4 LA4 LB3 LA3 LB2 LA2 LB1 LA1 LB0 LA0
ELVR1
LB15 LA15 LB14 LA14 LB13 LA13 LB12 LA12 LB11 LA11 LB10 LA10 LB9 LA9 LB8 LA8
DDR port direction register
Set the bit corresponding to pin used for the DTP/external interrupt input to "0"
ADER7
(Analog input enable)
Only when using INT7 to INT0 ●
TMCSR0
(Timer control)
Only when using INT13R
●
●
●
–
–
–
–
–
–
–
–
●
●
●
●
CSL1 CSL0 MOD2 MOD1 MOD0 OUTE OUTL RELD INTE UF CNTE TRG
–
–
–
–
–
0
–
–
CLKR
(Clock output enable)
Only when using INT13R
−
❍
●
0
1
–
–
–
–
CKEN FRQ2 FRQ1 FRQ0
–
–
–
–
–
–
–
–
–
–
–
–
0 –
–
–
: Undefined bit
: Used bit
: Set the bit corresponding to used pin to "1"
: Set the bit corresponding to used pin to "0"
: Set "0"
: Set "1"
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
389
CHAPTER 17 DTP/EXTERNAL INTERRUPT
17.4 Explanation of Operation of DTP/External Interrupt
MB90340E Series
● Setting procedure
To use the DTP/external interrupt, set each register by using the following procedure:
1. Set the input port to the general-purpose I/O port, which is shared with the terminal to be used as
external interrupt input.
2. Set the interrupt request enable bit corresponding to the DTP/external interrupt channel to be used to "0"
(ENIR:EN).
3. Use the detection condition select bit corresponding to the DTP/external interrupt pin to be used to set
the edge or level to be detected (ELVR1:LA, LB).
4. Set the interrupt request flag bit corresponding to the DTP/external interrupt channel to be used to "0"
(EIRR:ER).
5. Set the interrupt request enable bit corresponding to the DTP/external interrupt channel to be used to "1"
(ENIR:EN).
• When setting the registers for the DTP/external interrupt, the external interrupt request must be disabled
in advance (ENIR:EN=0).
• When enabling the DTP/external interrupt request (ENIR:EN=1), the corresponding DTP/external
interrupt request flag bit must be cleared in advance (EIRR:ER=0). These actions prevent an interrupt
request from mistakenly occurring when setting the register.
● Selecting of external interrupt function and DTP function
Whether the external interrupt function or the DTP function is executed depends on the setting of the
EI2OS enable bit (ICR:ISE) and DMA enable register (DER:EN) in the corresponding interrupt control
register.
If the ISE bit is set to "1", the extended intelligent I/O service (EI2OS) is enabled. If the EN bit is set to "1",
the DMA transfer is enabled.
If both the ISE and EN bits are set to "0", the EI2OS or DMA transfer is disabled, and the external interrupt
function is executed.
Notes:
• All interrupt requests assigned to one interrupt control register have the same interrupt levels (IL2
to IL0).
• If two or more interrupt requests are assigned to one interrupt control register and the EI2OS is
used in one of them, other interrupt requests cannot be used.
390
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 17 DTP/EXTERNAL INTERRUPT
17.4 Explanation of Operation of DTP/External Interrupt
MB90340E Series
■ DTP/External Interrupt Operation
Table 17.4-1 shows the control bits and the interrupt sources for the DTP/external interrupt.
Table 17.4-1 Control Bits and Interrupt Sources for DTP/External Interrupt
DTP/External Interrupt
Interrupt request flag bit
EIRR0: ER7 to ER0, EIRR1: ER15 to ER8
Interrupt request enable bit
ENIR0: EN7 to EN0, ENIR1: EN15 to EN8
Interrupt source
INT15 to INT0, INT15R to INT8R Input of valid edge/level to
If the interrupt request from the DTP/external interrupt is output to the interrupt controller and the EI2OS
enable bit (ICR:ISE) and DMA enable register (DER:EN) in the interrupt control register are set to "0", the
interrupt processing is executed. If either of the bits is set to "1", the extended intelligent I/O service
(EI2OS) or DMA transfer is executed.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
391
CHAPTER 17 DTP/EXTERNAL INTERRUPT
17.4 Explanation of Operation of DTP/External Interrupt
MB90340E Series
Figure 17.4-2 shows the operation of the DTP/external interrupt.
Figure 17.4-2 Operation of DTP/External Interrupt
DTP/external interrupt circuit
Other
request
ELVR
Interrupt controller
CPU
ICR YY
EIRR
IL
CMP
CMP
ILM
ICR XX
ENIR
Interrupt
processing
Source
DMA activation
DTP/external interrupt
request generated
Memory ? Peripheral
data transfer
Interrupt
controller reception
judge
Renewal of descriptor
Descriptor
data counter
CPU interrupt
reception judge
=0
Interrupt processing
≠0
Reset or stop
Interrupt processing
microprogram activation
Recovery from DTP processing
Recovery from DMA processing
(DTP processing)
1
DER:EN
EI2OS activation
0
1
Memory ? Peripheral
data transfer
ICR:ISE
Renewal of descriptor
0
External interrupt activation
Descriptor
data counter
=0
Interrupt processing
≠0
Processing and interrupt flag clear
Reset or stop
Recovery from external interrupt
Recovery from DTP processing
Note: Do not use DMA and EI2OS simultaneously.
392
Recovery from EI2OS processing
(DTP processing)
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 17 DTP/EXTERNAL INTERRUPT
17.4 Explanation of Operation of DTP/External Interrupt
MB90340E Series
17.4.1
External Interrupt Function
The DTP/external interrupt has an external interrupt function for generating an interrupt
request by detecting the signal (edge or level) in the DTP/external interrupt pin.
■ External Interrupt Function
• When the signal (edge or level) set in the detection level setting register is detected in the DTP/external
interrupt pin, the interrupt request flag bit in the DTP/external interrupt source register (EIRR:ER) is set
to "1".
• If the interrupt request enable bit in the DTP/external interrupt enable register is enabled (ENIR1:EN=1)
with the interrupt request flag bit set to "1", the interrupt request generation is posted to the interrupt
controller.
• If an interrupt request is preferred to other interrupt request by the interrupt controller, the interrupt
request is generated.
• If the level of an interrupt request (ICR:IL) is higher than that of the interrupt level mask bit in the
condition code register (CCR:ILM) and the interrupt enable bit is enabled (CCR:I=1), the CPU performs
interrupt processing after completion of the current instruction execution and branches to interrupt
processing.
• At interrupt processing, set the corresponding DTP/external interrupt request flag bit to "0" and clear the
DTP/external interrupt request.
Notes:
• When the DTP/external interrupt activation source is generated, the DTP/external interrupt
request flag bit (EIRR:ER) is set to "1", regardless of the setting of the DTP/external interrupt
request enable bit (ENIR:EN).
• When the interrupt processing is activated, clear the DTP/external interrupt request flag bit that
caused the activation source. Control cannot be returned from the interrupt while the DTP/
external interrupt request flag bit is set to "1". When clearing, do not clear any flag bit other than
the accepted DTP/external interrupt source.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
393
CHAPTER 17 DTP/EXTERNAL INTERRUPT
17.4 Explanation of Operation of DTP/External Interrupt
17.4.2
MB90340E Series
DTP Function
The DTP/external interrupt has the DTP function that detects the signal of the external
peripheral device from the DTP/external interrupt pin to activate the DMA transfer or
extended intelligent I/O service (EI2OS).
■ DTP Function
The DTP function detects the signal level set by the detection level setting register of the DTP/external
interrupt function to activate the DMA transfer or EI2OS.
• When the DMA transfer is already enabled (DER:EN=1) at the point when the interrupt request is
accepted, DMA is activated and the data starts to be transferred .
• When the EI2OS operation is already enabled (ICR:ISE=1) at the point when the interrupt request is
accepted, EI2OS is activated and the data starts to be transferred.
• When transfer of one data item is completed, the descriptor is updated and the DTP/external interrupt
request flag bit is cleared to prepare for the next request from the DTP/external interrupt pin.
• When the DMA/EI2OS completes transfer of all the data, control branches to the interrupt processing.
Figure 17.4-3 Example of Interface with External Peripheral Device
(When Using EI2OS in Single-chip Mode)
"H" level request (ELVR:LB0, LA0=01B)
Input to INT0 pin
(DTP source)
Descriptor
CPU internal operation select and read
Update of
descriptor
Peripheral
device of
external
connection
Internal data bus
Read and write
operation*2
DTP source*1
Data transfer
request
Interrupt
INT DTP/external request
interrupt
circuit
CPU
(EI 2OS)
Internal
memory
*1: This must be canceled within three machine clocks after the start of data transfer.
*2: When the extended intelligent I/0 service is "peripheral function → internal memory transfer".
394
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 17 DTP/EXTERNAL INTERRUPT
17.5 Notes on Using DTP/External Interrupt
MB90340E Series
17.5
Notes on Using DTP/External Interrupt
This section explains the precautions when using the DTP/external interrupt.
■ Notes on Using DTP/External Interrupt
● Condition of external-connected peripheral device when DTP function is used
• When using the DTP function, the peripheral device must automatically clear a data transfer request
when data transfer is performed.
• Inactivate the transfer request signal within three machine clocks after starting data transfer. If the
transfer request signal remains active, the DTP/external interrupt regards the transfer request signal as a
generation of next transfer request.
● External interrupt input polarity
• When the edge detection is set in the detection level setting register, the minimum pulse width is
required to detect the edge described in the data sheet. See the data sheet.
• When a level causing an interrupt source is input with level detection set in the detection level setting
register, the interrupt request flag bit (EIRR:ER) in the DTP/external interrupt source register is set to
"1" and the source is held as shown in Figure 17.5-1.
With the source is held in the interrupt request flag bit (EIRR:ER), the request to the interrupt controller
remains active if the interrupt request is enabled (ENIR1:EN=1) even after the DTP/external interrupt
source is cancelled. To cancel the request to the interrupt controller, clear the interrupt request flag bit
(EIRR:ER) as shown in Figure 17.5-2.
Figure 17.5-1 Clearing Interrupt Request Flag Bit (EIRR:ER) when Level is Set
DTP/external
interrupt source
DTP/interrupt
input detection
circuit
Interrupt request flag bit
(EIRR:ER)
Enable gate
To interrupt
controller
(interrupt request)
The source remains held unless cleared.
Figure 17.5-2 DTP/External Interrupt Source and Interrupt Request Generated when Interrupt
Request is Enabled
DTP/external interrupt source
(when "H" level detected)
Interrupt source canceled
Interrupt request issued
to interrupt controller
The interrupt request is inactivated by clearing the interrupt request flag bit (EIRR:ER)
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
395
CHAPTER 17 DTP/EXTERNAL INTERRUPT
17.5 Notes on Using DTP/External Interrupt
MB90340E Series
● Precautions on interrupts
• When the DTP/external interrupt is used as the external interrupt function, no return from interrupt
processing can be made with the DTP/external interrupt request flag bit set to "1" (EIRR:ER=1) and the
DTP/external interrupt request set to "enabled" (ENIR:EN=1). Always set the DTP/external interrupt
request flag bit to "0" (EIRR:ER=0) at interrupt processing.
• When the level detection is set in the detection level setting register and the level that becomes the
interrupt source remains input, the DTP/external interrupt request flag bit is reset immediately even
when cleared (EIRR:ER=0). Disable the DTP/external interrupt request output as needed (ENIR:EN=0),
or cancel the interrupt source itself.
396
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 17 DTP/EXTERNAL INTERRUPT
17.6 Program Example of DTP/External Interrupt Function
MB90340E Series
17.6
Program Example of DTP/External Interrupt Function
This section gives a program example for the DTP/external interrupt function.
■ Program Example of DTP/External Interrupt Function
● Processing specification
An external interrupt is generated by detecting the rising edge of the pulse input to the INT0 pin.
● Coding example
ICR07
DDR7
ENIR0
EQU
EQU
EQU
0000B7H
000017H
0000C6H
;Interrupt control register ICR7
;Port 7 direction register
;DTP/external interrupt enable
;register 0
EIRR0 EQU
0000C7H
;DTP/external interrupt source
;register 0
ELVR0L EQU
0000C8H
;Detection level setting register
;0:"L"
ELVR0H EQU
0000C9H
;E Detection level setting register
;0:"H"
ADER7 EQU
00000DH
;Port7 analog input enable register
ER0
EQU
EIRR0:0
;INT0 Interrupt request flag bit
EN0
EQU
ENIR0:0
;INT0 Interrupt request enable bit
;---------Main program--------------------------------------CODE
CSEG
START:
;Stack pointer (SP), etc., already initialized
MOV
I:ADER7,#00000000B ;Set analog input of Port7 to
;disabled
MOV
I:DDR7,#00000000B ;Set DDR7 to input port
AND
CCR,#0BFH
;Interrupts disabled
MOV
I:ICR07,#00H
;Interrupt level 0 (highest)
CLRB I:EN0
;INT0 disabled using ENIR
MOV
I:ELVR0L,#00000010B;Rising edge selected for INT0
CLRB I:ER0
;INT0 interrupt flag cleared using
;EIRR
SETB I:EN0
;INT0 interrupt request enabled using
;ENIR
MOV
ILM,#07H
;Set ILM in PS to level 7
OR
CCR,#40H
;Interrupt enabled
LOOP:
•
Processing by user
•
BRA
CM44-10143-5E
LOOP
FUJITSU SEMICONDUCTOR LIMITED
397
CHAPTER 17 DTP/EXTERNAL INTERRUPT
17.6 Program Example of DTP/External Interrupt Function
MB90340E Series
;---------Interrupt program---------------------------------WARI:
CLRB I:ER0
;Interrupt request flag cleared
•
Processing by user
•
RETI
;Return from interrupt processing
CODE
ENDS
;---------Vector setting------------------------------------VECT
CSEG ABS=0FFH
ORG
00FF94H
;Set vector to interrupt number
;#26(1AH)
DSL
WARI
ORG
00FFDCH
;Set reset vector
DSL
START
DB
00H
;Set to single-chip mode
VECT
ENDS
END
START
■ Program Example of DTP Function
● Processing specification
• Channel 0 of the extended intelligent I/O service (EI2OS) is activated by detecting the "H" level of the
signal input to the INT0 pin.
• RAM data is output to port 0 by performing DTP processing (EI2OS).
● Coding example
398
ICR07
EQU
0000B7H
DDR0
DDR7
ENIR0
EQU
EQU
EQU
000010H
000017H
0000C6H
EIRR0
EQU
0000C7H
ELVR0L
ELVR0H
ADER7
ER0
EN0
;
BAPL
BAPM
BAPH
ISCS
IOAL
IOAH
EQU
EQU
EQU
EQU
EQU
0000C8H
0000C9H
00000DH
EIRR:0
ENIR:0
;DTP/external interrupt control
;register
;Port 0 direction register
;Port 7 direction register
;DTP/external interrupt enable
;register 0
;DTP/external interrupt source
;register 0
;Detection level setting register 0: L
;Detection level setting register 0: H
;Port7 analog input enable register
;INT0 Interrupt request flag bit
;INT0 Interrupt request enable bit
EQU
EQU
EQU
EQU
EQU
EQU
000100H
000101H
000102H
000103H
000104H
000105H
;Buffer address pointer lower
;Buffer address pointer middle
;Buffer address pointer higher
;EI2OS status register
;I/O address register lower
;I/O address register higher
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 17 DTP/EXTERNAL INTERRUPT
17.6 Program Example of DTP/External Interrupt Function
MB90340E Series
DCTL
EQU
000106H
;Data counter lower
DCTH
EQU
000107H
;Data counter higher
;
;---------Main program--------------------------------------CODE
CSEG
START:
;Stack pointer (SP), etc., already initialized
MOV
I:ADER7,#00000000B ;Set analog input of Port7 to
;disabled
MOV
I:DDR0,#11111111B ;Set DDR0 to output port
MOV
I:DDR7,#00000000B ;Set DDR7 to input port
AND
CCR,#0BFH
;Interrupts disabled
MOV
I:ICR07,#08H
;Interrupt level 0 (highest) EI2OS
;ch.0
;Data bank register (DTB) = 00H
MOV
BAPL,#00H
;Address for storing output data set
MOV
BAPM,#06H
;(600H to 60AH used)
MOV
BAPH,#00H
MOV
ISCS,#12H
;Byte transfer, buffer address + 1,
;I/O address fixed, transfer from
;memory to I/O
MOV
IOAL,#00H
;Set port 0 as transfer destination
MOV
IOAH,#00H
;address pointer
MOV
DCTL,#0AH
;Set transfer count to 10
MOV
DCTH,#00H
;
CLRB I:EN0
;INT0 disabled using ENIR
MOV
I:ELVR0L,#00000001B ;"H" level detection set for INT0
CLRB I:ER0
;INT0 interrupt flag cleared using
;EIRR
SETB I:EN0
;INT0 interrupt request enabled using
;ENIR
MOV
ILM,#07H
;Set ILM in PS to level 7
OR
CCR,#40H
;Interrupt enabled
LOOP:
•
Processing by user
•
BRA
LOOP
;---------Interrupt program---------------------------------WARI:
CLRB I:ER0
;INT0 interrupt request flag cleared
•
Processing by user
•
CODE
CM44-10143-5E
RETI
ENDS
;Return from interrupt processing
FUJITSU SEMICONDUCTOR LIMITED
399
CHAPTER 17 DTP/EXTERNAL INTERRUPT
17.6 Program Example of DTP/External Interrupt Function
MB90340E Series
;---------Vector setting------------------------------------VECT
CSEG ABS=0FFH
ORG
00FF94H
;Set vector to interrupt number
;#26(1AH)
DSL
WARI
ORG
00FFDCH
;Set reset vector
DSL
START
DB
00H
;Set to single-chip mode
VECT
ENDS
END
START
400
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 18
8/10-BIT A/D CONVERTER
This chapter explains the functions and operations of
the 8/10-bit A/D converter.
18.1 Overview of 8/10-bit A/D Converter
18.2 Block Diagram of 8/10-bit A/D Converter
18.3 Configuration of 8/10-bit A/D Converter
18.4 Interrupt of 8/10-bit A/D Converter
18.5 Operating Explanation of 8/10-bit A/D Converter
18.6 Notes on Using 8/10-bit A/D Converter
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
401
CHAPTER 18 8/10-BIT A/D CONVERTER
18.1 Overview of 8/10-bit A/D Converter
18.1
MB90340E Series
Overview of 8/10-bit A/D Converter
The 8/10-bit A/D converter converts an analog input voltage to an 8- or 10-bit digital
value by using RC-type successive approximation conversion method.
• The input signal can be selected from analog input pins of up to 24/16 channels.
• The activation trigger can be selected from software trigger, internal timer output, and
external trigger.
■ Functions of 8/10-bit A/D Converter
The 8/10-bit A/D converter converts an analog voltage (input voltage) that is input to the analog input pin
to an 8- or 10-bit digital value (A/D conversion).
The 8/10-bit A/D converter has the following functions:
• A/D conversion time is a minimum of 1.9 μs*1 per channel including sampling time.
• Sampling time is a minimum of 0.5 μs*1 per channel.
• Conversion method is RC-type successive approximation conversion method with sample & hold
circuit.
• A resolution of 8 bits or 10 bits can be set.
• The analog input pins can be used up to 24/16 channels*2.
• An interrupt request can be generated by storing an A/D conversion result to the A/D data register.
• When an interrupt request is generated, μDMAC or EI2OS can be activated.
• The activation trigger can be selected from software, internal timer output, and external trigger (falling
edge).
*1: It operates with machine clock frequency ; 24 MHz, AVCC ≥ 4.5 V
*2: The maximum number of analog input channel is different according to the kind.
• Products with 'C'-suffix
: Maximum 24 channel analog inputs.
• Products without 'C'-suffix: Maximum 16 channel analog inputs.
402
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 18 8/10-BIT A/D CONVERTER
18.1 Overview of 8/10-bit A/D Converter
MB90340E Series
■ Conversion Modes of 8/10-bit A/D Converter
The following types of conversion modes are available for the 8/10-bit A/D converter.
Table 18.1-1 Conversion Modes of 8/10-bit A/D Converter
Conversion mode
CM44-10143-5E
Description
Single conversion mode
A/D conversion is performed sequentially from the start channel to the
end channel. When A/D conversion for the end channel ends, the A/D
conversion function is stopped.
Continuous conversion mode
A/D conversion is performed sequentially from the start channel to the
end channel. When A/D conversion for the end channel ends, the A/D
conversion continues to operate by returning to the start channel.
Stop conversion mode
A/D conversion is performed stopping by one channel. When A/D
conversion for the end channel ends, it returns to the start channel and
repeats A/D conversions and the stops.
FUJITSU SEMICONDUCTOR LIMITED
403
CHAPTER 18 8/10-BIT A/D CONVERTER
18.2 Block Diagram of 8/10-bit A/D Converter
18.2
MB90340E Series
Block Diagram of 8/10-bit A/D Converter
The 8/10-bit A/D converter consists of the following blocks.
■ Block Diagram of 8/10-bit A/D Converter
Figure 18.2-1 Block Diagram of 8/10-bit A/D Converter
Interrupt request output
A/D control
status
register
BUSY INT INTE PAUS STS1 STS0 STRT ⎯ MD1 MD0 S10 ⎯
(ADCS0/ADCS1)
⎯
⎯
⎯
Reserved
2
ADTG
Pin
From 16-bit
reload timer 1
TO
Activation
selector
Software
activation
2
Sample &
hold circuit
AN0 to AN7
AN15 to AN8
AN23 to AN16*
Comparator
Control circuit
Analog
channel
selector
AVRH/AVRL
AVcc
AVss
D/A converter
Successive approximation register
Internal data bus
φ
3
3
A/D data
register
D9 D8 D7 D6 D5 D4 D3 D2 D1 D0
(ADCR0/
ADCR1)
Decoder
10
A/D setting
register
(ADSR0/
ST2 ST1 ST0 CT2 CT1 CT0 ANS4 ANS3 ANS2 ANS1 ANS0 ANE4 ANE3 ANE2 ANE1 ANE0
ADSR1)
TO
⎯
Reserved
φ
404
: Internal timer output
: Undefined
: Be sure to set to "0"
: Machine clock
*: Only the products with C-suffix in their part number
support these pins
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 18 8/10-BIT A/D CONVERTER
18.2 Block Diagram of 8/10-bit A/D Converter
MB90340E Series
● Details of pins in block diagram
Table 18.2-1 shows the actual pin names and interrupt request numbers for the 8/10-bit A/D converter.
Table 18.2-1 Pins and Interrupt Request Numbers in Block Diagram
Pin name/interrupt request number in block diagram
ADTG
Actual pin name/interrupt request number
Trigger input pin
P80/ADTG
Internal timer output
Output of 16-bit reload timer 1
AN0 to AN7
Analog input pins ch.0 to ch.7
P60/AN0 to P67/AN7
AN8 to AN15
Analog input pins ch.8 to ch.15
P50/AN8 to P57/AN15
AN16 to AN23
Analog input pins ch.16 to ch.23
P70/AN16 to P77/AN23
AVRH / AVRL
Vref+ / Vref- input pin
AVRH / AVRL
AVCC
A/D converter power supply pin
AVCC
AVSS
A/D converter analog GND pin
AVSS
Interrupt request output
#29(1DH)
TO
Interrupt request output
● A/D control status register (ADCS)
This register activates the A/D conversion function, selects the activation trigger for the A/D conversion
function, selects the conversion mode, enables or disables interrupt request, checks and clears the interrupt
request flag, pauses A/D conversion operation and checks the status during conversion, and selects the
resolution by software.
● Successive approximation register (SAR)
This circuit performs a successive approximation for each bit and stores the conversion result. The A/D
conversion result in this circuit is destroyed, once the next A/D conversion starts.
● A/D data register (ADCR)
An A/D conversion result is stored for each 1 bit in the successive approximation circuit during A/D
conversion and then stored in this register when the A/D conversion ends and the conversion result is
determined. The A/D conversion result can be read from this register.
● A/D setting register (ADSR)
This register sets the start channel, end channel, compare time and sampling time for A/D conversion.
● Activation selector
This selector selects the trigger to start A/D conversion. An internal timer output or external pin input can
be set as the start trigger.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
405
CHAPTER 18 8/10-BIT A/D CONVERTER
18.2 Block Diagram of 8/10-bit A/D Converter
MB90340E Series
● Decoder
This decoder selects the analog input pin to be used for A/D conversion based on the settings of the A/D
conversion start channel selection bits (ADSR: ANS4 to ANS0) and the A/D conversion end channel
selection bits (ADSR: ANE4 to ANE0) in the A/D setting register.
● Analog channel selector
This selector selects the pin to be used for A/D conversion from analog input pins of 24/16 channels by
receiving a signal from the decoder.
● Sample & hold circuit
This circuit holds the input voltage selected by the analog channel selector. The conversion can be
performed without being affected by the fluctuation of the input voltage during the A/D conversion by
holding the input voltage immediately after A/D conversion is stared.
● D/A converter
This converter generates the reference voltage to compare it with the input voltage held in the sample &
hold circuit.
● Comparator
This comparator compares the D/A converter output voltage with the input voltage held in the sample &
hold circuit to determine which voltage has a larger/smaller size.
● Control circuit
This circuit determines the A/D conversion value by receiving the large/small signal from the comparator.
When the conversion result is determined, the result data is stored in the A/D data register. If interrupt
request is enabled, an interrupt is generated.
406
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 18 8/10-BIT A/D CONVERTER
18.3 Configuration of 8/10-bit A/D Converter
MB90340E Series
18.3
Configuration of 8/10-bit A/D Converter
This section shows the pins, registers, and interrupt sources of the A/D converter.
■ Pins of 8/10-bit A/D Converter
The pins of the 8/10-bit A/D converter serve as general-purpose I/O ports. Table 18.3-1 shows the pin
functions and pin settings for using the 8/10-bit A/D converter.
Table 18.3-1 Pins of 8/10-bit A/D Converter (1 / 2)
Function
name
Pin name
Trigger input
P80 / ADTG
ch.0
P60 / AN0
ch.1
P61 / AN1
ch.2
P62 / AN2
ch.3
P63 / AN3
ch.4
P64 / AN4
ch.5
P65 / AN5
ch.6
P66 / AN6
ch.7
P67 / AN7
ch.8
P50 / AN8
ch.9
P51 / AN9
ch.10
P52 / AN10
ch.11
P53 / AN11
ch.12
P54 / AN12
ch.13
P55 / AN13
ch.14
P56 / AN14
ch.15
P57 / AN15
CM44-10143-5E
Settings for using 8/10-bit
A/D converter
Pin function
General-purpose I/O port /
external trigger input
Set as input port in port direction register
DDR8
General-purpose I/O port /
analog input /
PPG output
Enable input of analog signal (Set the bits
corresponding to ADER6: ADE7 to ADE0 to
"1")
General-purpose I/O port /
analog input /
UART2 I/O
General-purpose I/O port /
analog input /
reload timer 3 I/O
Enable input of analog signal (Set the bits
corresponding to ADER5: ADE15 to ADE8
to "1")
General-purpose I/O port /
analog input
FUJITSU SEMICONDUCTOR LIMITED
407
CHAPTER 18 8/10-BIT A/D CONVERTER
18.3 Configuration of 8/10-bit A/D Converter
MB90340E Series
Table 18.3-1 Pins of 8/10-bit A/D Converter (2 / 2)
Function
name
Pin name
ch.16
P70 / AN16
ch.17
P71 / AN17
ch.18
P72 / AN18
ch.19
P73 / AN19
ch.20
P74 / AN20
ch.21
P75 / AN21
ch.22
P76 / AN22
ch.23
P77 / AN23
Settings for using 8/10-bit
A/D converter
Pin function
General-purpose I/O port/
analog input /
external interrupt input
Enable input of analog signal (Set the bits
corresponding to ADER7: ADE23 to ADE16
to "1")
Notes:
The number of channels that can be used is different according to the device.
• Products with "C"-suffix: ch.0 to ch.23 (AN0 to AN23)
• Products without "C"-suffix: ch.0 to ch.15 (AN0 to AN15)
408
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 18 8/10-BIT A/D CONVERTER
18.3 Configuration of 8/10-bit A/D Converter
MB90340E Series
■ List of Registers and Initial Values of 8/10-bit A/D Converter
Figure 18.3-1 List of Registers and Initial Values of 8/10-bit A/D Converter
A/D control status register 1 ADCS1
14
bit 15
Address: 000069H
BUSY INT
R/W
13
12
11
10
9
R/W
R/W
R/W
R/W
A/D control status register 0 ADCS0
bit 7
6
5
4
3
2
0000000XB
W
1
0
MD1 MD0
S10
Reserved
R/W
R/W
R/W
A/D data register 1 ADCR1
15 15
R/W
14
13
12
11
10
Address: 00006BH
A/D data register 0 ADCR0
bit 7
Address: 00006AH
Initial value
INTE PAUS STS1 STS0 STRT
R/W
Address: 000068H
8
9
8
D9
R
D8
R
Initial value
000XXXX0B
Initial value
XXXXXX00B
6
5
4
3
2
1
0
Initial value
D7
D6
D5
D4
D3
D2
D1
D0
00000000B
R
R
R
R
R
R
R
R
ADSR1
A/D setting register 1 ADSR1
bit 15
14
13
ST2
R/W
ST1
R/W
ST0
R/W
A/D setting register 0 ADSR0
bit 7
6
5
Address: 00006DH
Address: 00006CH
12
11
10
CT2 CT1
R/W R/W
4
3
9
8
Initial value
CT0 ANS4 ANS3
R/W R/W R/W
2
1
0
ANS2 ANS1 ANS0 ANE4 ANE3 ANE2 ANE1 ANE0
R/W
R/W
R/W
R/W
R/W
R/W
R/W
00000000B
Initial value
00000000B
R/W
R/W : Readable/writable
R : Read only
W : Write only
: Undefined bit
X : Undefined
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
409
CHAPTER 18 8/10-BIT A/D CONVERTER
18.3 Configuration of 8/10-bit A/D Converter
18.3.1
MB90340E Series
A/D Control Status Register 1 (ADCS1)
The A/D control status register 1 (ADCS1) provides the following settings:
• Activating A/D conversion function by software
• Selecting activation trigger for A/D conversion
• Enabling or disabling interrupt request by storing A/D conversion result in the A/D
data register
• Checking and clearing interrupt request flag by storing A/D conversion result in the A/
D data register
• Pausing A/D conversion operation and checking the status during conversion
■ A/D Control Status Register 1 (ADCS1)
Figure 18.3-2 A/D Control Status Register 1 (ADCS1)
bit 15
Address
14
13
12
11
10
9
000069 H BUSY INT INTE PAUS STS1 STS0 STRT
R/W R/W R/W R/W R/W R/W
W
8
Initial value
-
0000000XB
bit8
-
Undefined bit
Read value is always "1"
bit9
STRT
A/D conversion software activation bit
0
Does not activate A/D conversion function
1
Activates A/D conversion function
bit11 bit10
A/D conversion activation trigger selection bits
STS1 STS0
0
0 Activation by software
0
1 Activation by software or external pin trigger
1
0 Activation by software or 16-bit reload timer
1
1 Activation by software, external pin trigger or 16-bit reload timer
bit12
Pause flag bit
PAUS
(Enabled only when EI2OS or DMA is used)
Read
0
1
Write
Conversion is not paused
Clears to "0"
Conversion is paused
Setting is prohibited
bit13
Interrupt request enable bit
INTE
Disables interrupt request
0
Enables interrupt request
1
bit14
INT
0
1
Interrupt request flag bit
Read
A/D conversion uncompleted
Write
Clears to "0"
A/D conversion completed
No effect
bit15
BUSY
R/W : Readable/writable
W
: Write only
: Undefined bit
: Undefined
X
: Initial value
410
A/D conversion operating flag bit
0
Read
A/D conversion completed
(non-activated state)
Write
Terminates A/D conversion
function forcibly
1
A/D conversion in progress
No effect
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
MB90340E Series
CHAPTER 18 8/10-BIT A/D CONVERTER
18.3 Configuration of 8/10-bit A/D Converter
Table 18.3-2 Function of A/D Control Status Register 1 (ADCS1) (1 / 3)
bit15
bit14
bit13
Bit name
Function
BUSY:
A/D conversion
operating flag bit
This bit forcibly terminates the 8/10-bit A/D converter. When this bit is read, it
indicates whether the 8/10-bit A/D converter is operating or stopped.
When set to "0": 8/10-bit converter is forcibly terminated
When set to "1": No effect
When reading : "1" is read when the 8/10-bit A/D converter is operating and "0"
is read when the converter is stopped
If in "stop state" in stop conversion mode, "1" is read
Notes:
• "1" is read when this bit is read by a RMW instruction.
• In single conversion mode, this bit is cleared when A/D conversion is
completed.
• In continuous conversion mode and stop conversion mode, this bit will not be
cleared until "0" is written to stop.
• Do not terminate the A/D converter forcibly (BUSY=0) and activate it (by any
of the triggers: software (STRT=1)/external trigger/timer) simultaneously.
INT:
Interrupt request flag bit
This bit indicates that an interrupt request is generated.
• The INT bit is set to "1" when an A/D conversion is completed and its result is
stored in the A/D data register (ADCR).
• When the interrupt request flag bit is set (INT=1) if interrupt request is enabled
(INTE=1), an interrupt request is generated.
• This bit is cleared when "0" is written to it. In addition, it will be cleared
automatically when a transfer of A/D conversion result data by EI2OS/μDMAC is
completed.
When set to "0": Clears this bit
When set to "1": No effect
Note:
"1" is read when this bit is read by a RMW instruction.
INTE:
Interrupt request enable
bit
This bit enables or disables interrupt request output.
• When the interrupt request flag bit is set (INT=1) if interrupt request is enabled
(INTE=1), an interrupt request is generated.
Note:
Be sure to set this bit to "1" if transferring A/D conversion result by
EI2OS/μDMAC.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
411
CHAPTER 18 8/10-BIT A/D CONVERTER
18.3 Configuration of 8/10-bit A/D Converter
MB90340E Series
Table 18.3-2 Function of A/D Control Status Register 1 (ADCS1) (2 / 3)
Bit name
bit12
bit11,
bit10
412
Function
PAUS:
Pause flag bit
PAUS bit indicates that the A/D conversion data protection function has been
worked. PAUS bit is valid only if interrupt request output is set to enable
(ADCS:INTE=1).
When A/D conversion data protection function worked: Sets this bit to "1"
When set to "0": Clears to "0"
When set to "1": Sets to "1"
• When A/D conversion is performed with interrupt request output enabled
(ADCS:INTE=1), an interrupt request is generated at the same time as the
interrupt request flag bit (ADCS:INT) is set after the A/D conversion ends once.
If the next A/D conversion ends without clearing the interrupt request flag bit
(ADCS:INT), the A/D conversion operation will be paused to prevent the
previous data from being overwritten and destroyed (A/D conversion data
protection function). When an A/D conversion operation is paused, PAUS bit is
set to "1".
• When the interrupt request flag bit (ADCS:INT) is cleared, the 8/10-bit A/D
converter cancels the pause state and restarts the A/D conversion operation.
• The interrupt request flag bit (ADCS:INT) is cleared by writing "0" to it. In
addition, if an A/D conversion result is transferred from the A/D data register
using EI2OS/μDMAC, the interrupt request flag bit (ADCS:INT) is cleared by
EI2OS/μDMAC once the transfer of the A/D conversion result is completed.
Notes:
• For the A/D conversion data protection function, see Section "18.5.5 A/D
Conversion Data Protection Function".
• PAUS bit is not cleared automatically even when the pause state is canceled.
Write "0" to clear PAUS bit.
STS1, STS0:
A/D conversion
activation trigger
selection bits
These bits select the trigger (activation trigger) to activate the 8/10-bit A/D
converter.
• 00B: Software activation
• 01B: External pin trigger/software activation
• 10B: 16-bit reload timer 1/software activation
• 11B: External pin trigger/16-bit reload timer 1/software activation
Notes:
• When external pin trigger is selected (01B, 11B), A/D conversion starts when
an falling edge is detected at ADTG pin.
• When 16-bit reload timer is selected (10B, 11B), A/D conversion starts when
the output of the 16-bit reload timer 1 becomes "1".
Notes:
• When multiple activation triggers are set (settings other than STS1,
STS0=00B), 8/10-bit A/D converter will be activated by the first-generated
activation trigger.
• When changing the activation trigger setting, set while the operation of
peripheral functions which may generate an activation trigger is stopped (in
trigger inactive state).
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 18 8/10-BIT A/D CONVERTER
18.3 Configuration of 8/10-bit A/D Converter
MB90340E Series
Table 18.3-2 Function of A/D Control Status Register 1 (ADCS1) (3 / 3)
Bit name
bit9
STRT:
A/D conversion software
activation bit
bit8
Undefined bit
CM44-10143-5E
Function
This bit activates the 8/10-bit A/D converter by software.
When set to "1": Activates 8/10-bit A/D converter
• If an A/D conversion operation is paused in stop conversion mode, the operation
is restarted by writing "1" to STRT bit.
When set to "0": Ignored. No change
Notes:
• "0" is read when this bit is read by a RMW instruction
• When reading by an instruction other than RMW instruction, "1" is read
instead of a written value.
• Do not terminate the 8/10-bit A/D converter forcibly (BUSY=0) and activate
by software (STRT=1) simultaneously.
• Read : Always "1" is read
• Write : No effect
FUJITSU SEMICONDUCTOR LIMITED
413
CHAPTER 18 8/10-BIT A/D CONVERTER
18.3 Configuration of 8/10-bit A/D Converter
18.3.2
MB90340E Series
A/D Control Status Register 0 (ADCS0)
The A/D control status register 0 (ADCS0) provides the following settings:
• Selecting A/D conversion mode
• Selecting A/D conversion start channel and end channel
■ A/D Control Status Register 0 (ADCS0)
Figure 18.3-3 A/D Control Status Register 0 (ADCS0)
Address
bit 7
6
5
4
3
2
1
0
000068H MD1 MD0 S10
-
-
-
-
Reserved
R/W R/W R/W
-
-
-
-
R/W
Initial value
000XXXX0B
bit0
Reserved
0
bit5
S10
0
1
R/W : Readable/writable
- : Undefined bit
X : Undefined
: Initial value
414
Reserved bit
Always write "0" to this bit
Resolution selection bit
Set A/D conversion resolution to 10 bits
Set A/D conversion resolution to 8 bits
bit7 bit6
MD1 MD0
0
0
1
0
0
1
1
1
A/D conversion mode selection bits
Single conversion mode 1
Single conversion mode 2
Continuous conversion mode
Stop conversion mode
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 18 8/10-BIT A/D CONVERTER
18.3 Configuration of 8/10-bit A/D Converter
MB90340E Series
Table 18.3-3 Function of A/D Control Status Register 0 (ADCS0)
Bit name
Function
MD1, MD0:
A/D conversion mode
selection bits
These bits set the A/D conversion mode.
For details on how to use each mode, see Section "18.5 Operating Explanation of 8/
10-bit A/D Converter".
Single conversion mode 1 and single conversion mode 2:
• A/D conversion is continuously performed through analog inputs from the start
channel (ADSR : ANS4 to ANS0) to the end channel.
• A/D conversion operation stops when the A/D conversion of the end channel is
completed.
• See Section "18.5 Operating Explanation of 8/10-bit A/D Converter" on the
difference between single conversion modes 1 and 2.
Continuous conversion mode:
• A/D conversion for analog inputs from the start channel (ADSR: ANS4 to ANS0)
to the end channel (ADSR: ANE4 to ANE0) is performed continuously.
• After completing the A/D conversion of the end channel, it returns to the analog
input of the start channel and continues the A/D conversion.
Stop conversion mode:
• A/D conversion starts from the start channel (ADSR: ANS4 to ANS0). A/D
conversion operation stops when the A/D conversion for one channel is
completed. When an activation trigger is input while A/D conversion operation
pauses, the A/D conversion for the next channel is performed.
• A/D conversion operation pauses at the completion of A/D conversion for the end
channel. When an activation trigger is input while A/D conversion operation
pauses, the A/D conversion is continued by returning to the analog input for the
start channel.
Note:
If changing the conversion mode, perform in the stop state before A/D conversion
is started.
bit5
S10:
Resolution selection bit
This bit sets the A/D conversion resolution.
When set to "0": Sets the A/D conversion resolution to 10 bits of the A/D
conversion data bits D9 to D0.
When set to "1": Sets the A/D conversion resolution to 8 bits of the A/D
conversion data bits D7 to D0.
Note:
When changing S10 bit, perform in the stop state before A/D conversion is
started. If S10 bit is changed after A/D conversion is started, the conversion result
stored in the A/D conversion data bits (D9 to D0) will become invalid.
bit4
to
bit1
Undefined bits
Only reading is allowed. The initial value is "1".
bit0
Reserved bit
Always write "0" to this bit.
bit7,
bit6
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
415
CHAPTER 18 8/10-BIT A/D CONVERTER
18.3 Configuration of 8/10-bit A/D Converter
18.3.3
MB90340E Series
A/D Data Registers 0/1 (ADCR0/ADCR1)
The A/D data registers (ADCR0/ADCR1) are used to store digital values generated as a
result of a conversion. ADCR0 stores the lower 8 bits and ADCR1 stores the highest 2
bits of a conversion result. These registers are rewritten after each conversion is
completed, and normally the last conversion value is stored in them.
■ A/D Data Registers (ADCR0/ADCR1)
Figure 18.3-4 A/D Data Registers (ADCR0/ADCR1)
A/D data register 1
Address bit 15
ADCR1 00006BH
A/D data register 0
Address
ADCR0 00006AH
14
13
12
11
10
9
8
Initial value
-
-
-
-
-
D9
D8
XXXXXX00B
R
R
6
5
4
3
2
1
0
Initial value
D7
D6
D5
D4
D3
D2
D1
D0
00000000B
R
R
R
R
R
R
R
R
bit 7
R : Read only
X : Undefined
- : Undefined bit
Table 18.3-4 Function of A/D Data Registers (ADCR0/ADCR1)
Bit name
bit15
to
bit10
bit9
to
bit0
416
Function
Undefined bits
When reading, always "1" is read.
D9 to D0:
A/D conversion data bits
These bits store the result of an A/D conversion
When resolution is set to 10 bits (S10="0"):
Stores conversion data in 10 bits from D9 to D0
When resolution is set to 8 bits (S10="1"):
Stores conversion data in 8 bits from D7 to D0. At this time, the read values of
D9 to D8 become "1"
Notes:
• Writing to these registers is prohibited.
• Use a word instruction (MOVW) to read the conversion result stored in the A/
D conversion data bits (D9 to D0).
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 18 8/10-BIT A/D CONVERTER
18.3 Configuration of 8/10-bit A/D Converter
MB90340E Series
18.3.4
A/D Setting Register (ADSR0/ADSR1)
The A/D setting register (ADSR0/ADSR1) provides the following settings:
• Setting A/D conversion times (sampling time, compare time)
• Setting sampling channels (start channel, end channel)
• Displaying the current sampling channel
■ A/D Setting Register (ADSR0/ADSR1)
Figure 18.3-5 A/D Setting Register (ADSR0/ADSR1)
bit 15
14
13
12
11
10
9
7
8
6
5
4
3
2
1
0
Initial value
Address
00006CH ST2 ST1 ST0 CT2 CT1 CT0 ANS4 ANS3 ANS2 ANS1 ANS0 ANE4 ANE3 ANE2 ANE1 ANE0 0000000000000000B
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
bit4 to bit0
ANE4 to ANE0
11111B to 00000B
(Initial value: 00000B)
A/D conversion end channel selection bits
AN31 pin (*) to AN0 pin
bit9 to bit5
A/D conversion start channel selection bits
ANS4 to ANS0
Write
Read during
(inactive state) conversion
Read during
pause in stop
conversion mode
Channel number Channel number where the
AN31 pin* where
the conver- conversion was performed
to
AN0
pin
sion is running immediately before the pause
(Initial value: 00000B)
11111B to 00000B
bit12 bit11 bit10
CT2 CT1 CT0
0
0
0
0
1
1
1
1
0
0
1
1
0
0
1
1
0
1
0
1
0
1
0
1
bit15 bit14 bit13
ST2 ST1 ST0
R/W : Readable/writable
: Machine clock
: Initial value
φ
0
0
0
0
0
1
0
0
1
1
1
1
1
1
0
0
1
1
0
1
0
1
0
1
Compare time selection bits
22/φ (φ = 20 MHz: 1.1 μs)
33/φ (φ = 24 MHz: 1.4 μs)
44/φ (φ = 24 MHz: 1.8 μs)
66/φ (φ = 24 MHz: 2.75 μs)
88/φ (φ = 8 MHz: 11.0 μs)
132/φ (φ = 16 MHz: 8.25 μs)
176/φ (φ = 20 MHz: 8.8 μs)
264/φ (φ = 24 MHz: 11.0 μs)
Sampling time selection bits
4/φ (φ = 8 MHz: 0.5 μs)
6/φ (φ = 8 MHz: 0.75 μs)
8/φ (φ = 16 MHz: 0.5 μs)
12/φ (φ = 24 MHz: 0.5 μs)
24/φ (φ = 8 MHz: 3.0 μs)
36/φ (φ = 16 MHz: 2.25 μs)
48/φ (φ = 16 MHz: 3.0 μs)
128/φ (φ = 24 MHz: 5.3 μs)
*: Product without suffix C: AN15 to AN0 can be set. There is no pin AN16 or upper.
Product with suffix C: AN23 to AN0 can be set. There is no pin AN24 or upper.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
417
CHAPTER 18 8/10-BIT A/D CONVERTER
18.3 Configuration of 8/10-bit A/D Converter
MB90340E Series
Table 18.3-5 Function of A/D Setting Register (ADSR0/ADSR1) (1 / 2)
Bit name
bit15
to
bit13
bit12
to
bit10
bit9
to
bit5
418
Function
ST2 to ST0:
Sampling time selection
bits
These bits set the A/D conversion sampling time.
• These bits set the time from starting A/D conversion to holding the input analog
voltage via sampling & hold circuit.
• For the settings of these bits, see Table 18.3-6.
Notes:
• Analog voltage may not be captured correctly if disallowed setting is initiated.
• While A/D conversion is in process, do not set sample time.
CT2 to CT0:
Compare time selection
bits
These bits set the A/D conversion compare time.
• These bits set the time from A/D converting the analog input to store it in data bits
(D9 to D0).
• For the settings of these bits, see Table 18.3-7.
Note:
Analog voltage may not be captured correctly if disallowed setting is initiated.
ANS4 to ANS0:
A/D conversion start
channel selection bits
These bits set the channel at which an A/D conversion starts. If reading these bits,
you can verify the currently converted channel number if in the process of A/D
conversion, and the last A/D converted channel number if the A/D conversion is
completed or stopped. In addition, even if a value is set to these bits, the previous
A/D converted channel number instead of the set value will be read until an A/D
conversion starts. These bits are initialized to 00000B at reset.
Start channel < End channel:
An A/D conversion starts at the channel set by A/D conversion start channel
selection bits (ANS4 to ANS0) and ends at the channel set by A/D conversion
end channel selection bits (ANE4 to ANE0)
Start channel = End channel:
A/D conversion is performed only for one channel set by A/D conversion start
(= end) channel selection bits (ANS4 to ANS0 = ANE4 to ANE0)
Start channel > End channel:
Do not set this setting
Continuous conversion mode, stop conversion mode:
When an A/D conversion ends at the channel set by the A/D conversion end
channel selection bits (ANE4 to ANE0), it returns to the channel set by the A/
D conversion start channel selection bits (ANS4 to ANS0)
When reading (in a mode except stop conversion mode):
The channel number (31 to 0) under A/D conversion is read
When reading (in stop conversion mode):
When reading during a stop, the channel number A/D-converted immediately
before the stop is read
Notes:
• Do not set the A/D conversion start channel bits (ANS4 to ANS0) during A/D
conversion.
• When writing to this bit, use word access. If byte write or bit manipulation is
performed, an A/D conversion may start from an unexpected channel.
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
MB90340E Series
CHAPTER 18 8/10-BIT A/D CONVERTER
18.3 Configuration of 8/10-bit A/D Converter
Table 18.3-5 Function of A/D Setting Register (ADSR0/ADSR1) (2 / 2)
Bit name
bit4
to
bit0
ANE4 to ANE0:
A/D conversion end
channel selection bits
CM44-10143-5E
Function
These bits set the channel at which an A/D conversion ends.
Start channel < End channel:
An A/D conversion starts at the channel set by A/D conversion start channel
selection bits (ANS4 to ANS0) and ends at the channel set by A/D conversion
end channel selection bits (ANE4 to ANE0)
Start channel = End channel:
A/D conversion is performed only for one channel set by A/D conversion start
(= end) channel selection bits (ANS4 to ANS0 = ANE4 to ANE0)
Start channel > End channel:
Do not use this setting
Continuous conversion mode, stop conversion mode:
When an A/D conversion ends at the channel set by the A/D conversion end
channel selection bits (ANE4 to ANE0), it returns to the channel set by the
A/D conversion start channel selection bits (ANS4 to ANS0).
Notes:
• Do not set the A/D conversion end channel selection bits (ANE4 to ANE0)
during A/D conversion.
• After the A/D conversion start channel selection bits (ANS4, ANS3,ANS2,
ANS1, ANS0) are set, do not set the sampling time selection bits (ST2, ST1,
ST0), compare time selection bits (CT2, CT1, CT0) and A/D conversion end
channel selection bits (ANE4, ANE3, ANE2, ANE1, ANE0) using a readmodify-write instruction. Because the previous conversion channel is read
from ANS4, ANS3, ANS2, ANS1, ANS0 bits until a new A/D conversion
operation starts, the values of ANS4, ANS3, ANS2, ANS1, ANS0 bits may be
rewritten if ST2, ST1, ST0 bits, CT2, CT1, CT0 bits and ANE4, ANE3,
ANE2, ANE1, ANE0 bits are set using a read-modify instruction after setting
ANS4, ANS3, ANS2, ANS1, ANS0 bits.
FUJITSU SEMICONDUCTOR LIMITED
419
CHAPTER 18 8/10-BIT A/D CONVERTER
18.3 Configuration of 8/10-bit A/D Converter
MB90340E Series
■ Setting for Sampling Time (ST2 to ST0 Bits)
Table 18.3-6 Relationship between ST2 to ST0 Bits and Sampling Time
Setting example
(φ: internal operation frequency)
ST2
ST1
ST0
Sampling time setting
0
0
0
4 machine cycles
φ = 8 MHz: 0.5 μs
0
0
1
6 machine cycles
φ = 8 MHz: 0.75 μs
0
1
0
8 machine cycles
φ = 16 MHz: 0.5 μs
0
1
1
12 machine cycles
φ = 24 MHz: 0.5 μs
1
0
0
24 machine cycles
φ = 8 MHz: 3 μs
1
0
1
36 machine cycles
φ = 16 MHz: 2.25 μs
1
1
0
48 machine cycles
φ = 16 MHz: 3.0 μs
1
1
1
128 machine cycles
φ = 24 MHz: 5.3 μs
The sampling time must be set based on the drive impedance Rext connected to analog input. Refer to the
data sheet for each parameter.
• If Rext ≤ Rext max:
Set sampling time to STmin or more.
• If Rext > Rext max:
Set sampling time to ST or more of the formula below:
ST = (Rin + Rext) × Cin × 7
■ Setting for Compare Time (CT2 to CT0 Bits)
Table 18.3-7 Relationship between CT2 to CT0 Bits and Compare Time
Setting example
(φ: internal operation frequency)
CT2
CT1
CT0
Compare time setting
0
0
0
22 machine cycles
φ = 20 MHz: 1.1 μs
0
0
1
33 machine cycles
φ = 24 MHz: 1.4 μs
0
1
0
44 machine cycles
φ = 24 MHz: 1.8 μs
0
1
1
66 machine cycles
φ = 24 MHz: 2.75 μs
1
0
0
88 machine cycles
φ = 8 MHz: 11.0 μs
1
0
1
132 machine cycles
φ = 16 MHz: 8.25 μs
1
1
0
176 machine cycles
φ = 20 MHz: 8.8 μs
1
1
1
264 machine cycles
φ = 24 MHz: 11.0 μs
The compare time must be set in accordance with the analog supply voltage AVCC. Refer to the data sheet
for details.
420
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 18 8/10-BIT A/D CONVERTER
18.3 Configuration of 8/10-bit A/D Converter
MB90340E Series
18.3.5
Analog Input Enable Register (ADER5 to ADER7)
This register enables or disables analog input pins used for the 8/10-bit A/D converter.
■ Analog Input Enable Register (ADER5 to ADER7)
Figure 18.3-6 Analog Input Enable Register (ADER5 to ADER7)
bit 15
Address
14
13
12
11
10
9
8
Initial value
ADER5: 00000BH ADE15 ADE14 ADE13 ADE12 ADE11 ADE10 ADE9 ADE8 11111111B
R/W R/W R/W R/W R/W R/W R/W R/W
bit15 to bit8
ADE15 to ADE8 Analog input enable bits 15 to 8 (AN15 to AN8)
Disables analog input
0
1
Enables analog input
bit 7
Address
ADER6: 00000CH
6
5
4
3
2
1
0
Initial value
ADE7 ADE6 ADE5 ADE4 ADE3 ADE2 ADE1 ADE0 11111111B
R/W R/W R/W R/W R/W R/W R/W R/W
bit7 to bit0
Analog input enable bits 7 to 0 (AN7 to AN0)
ADE7 to ADE0
Disables analog input
0
1
Enables analog input
Address
bit 15
14
13
12
11
10
9
8
Initial value
ADER7: 00000DH ADE23 ADE22 ADE21 ADE20 ADE19 ADE18 ADE17 ADE16 11111111B
R/W R/W R/W R/W R/W R/W R/W R/W
R/W : Readable/writable
: Initial value
bit15 to bit8
ADE23 to ADE16 Analog input enable bits 23 to 6 (AN23 to AN16)
Disables analog input
0
1
Enables analog input
Table 18.3-8 Function of Port 5 Analog Input Enable Register (ADER5)
Bit name
bit15
to
bit8
ADE15 to ADE8:
Analog input enable
bit15 to bit8
Function
These bits enable or disable analog input of the A/D conversion analog input pins
AN15 to AN8 placed on port 5.
When set to "0": Disables analog input
When set to "1": Enables analog input
Table 18.3-9 Function of Port 6 Analog Input Enable Register (ADER6)
Bit name
bit7
to
bit0
ADE7 to ADE0:
Analog input enable
bit 7 to bit 0
CM44-10143-5E
Function
These bits enable or disable analog input of the A/D conversion analog input pins
AN7 to AN0 placed on port 6.
When set to "0": Disables analog input
When set to "1": Enables analog input
FUJITSU SEMICONDUCTOR LIMITED
421
CHAPTER 18 8/10-BIT A/D CONVERTER
18.3 Configuration of 8/10-bit A/D Converter
MB90340E Series
Table 18.3-10 Function of Port 7 Analog Input Enable Register (ADER7)
Bit name
bit15
to
bit8
ADE23 to ADE16:
Analog input enable
bit 23 to bit 16
Function
These bits enable or disable analog input of the A/D conversion analog input pins
AN23 to AN16 placed on port 7.
When set to "0": Disables analog input
When set to "1": Enables analog input
Notes:
• To use as an analog input pin, set it to analog input by writing "1" to the bit in the analog input
enable register corresponding to the pin to be used.
• Setting an analog input pin to ADERx=0 is prohibited. Always set to ADERx=1.
• Each analog input pin serves as a general-purpose I/O port and an input/output of peripheral
functions. The pin set to ADERx=1 automatically becomes an analog input pin regardless of the I/O
settings in port direction register (DDR5 to DDR7) and in each peripheral function, and cannot be
used for other purposes.
422
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 18 8/10-BIT A/D CONVERTER
18.4 Interrupt of 8/10-bit A/D Converter
MB90340E Series
18.4
Interrupt of 8/10-bit A/D Converter
The 8/10-bit A/D converter can generate an interrupt request when the conversion result
is set in the A/D data register (ADCR) after an A/D conversion is completed. The μDMAC
and the extended intelligent I/O service (EI2OS) can be used.
■ Interrupt of A/D Converter
When the A/D conversion of an analog input voltage is completed and the A/D result is stored in the A/D
data register (ADCR), the interrupt request flag bit in the A/D control status register (ADCS: INT) is set to
"1". When the interrupt request flag bit is set (ADCS: INT=1) with interrupt request output enabled
(ADCS: INTE=1), an interrupt request is generated.
■ Interrupt of 8/10-bit A/D Converter, and μDMAC and EI2OS
Reference:
See "CHAPTER 3 INTERRUPTS" for details of the interrupt number, interrupt control register,
and interrupt vector address. See "CHAPTER 4 μDMAC" for details of the DMA channel.
■ μDMAC and EI2OS of 8/10-bit A/D Converter
In the 8/10-bit A/D converter, the μDMAC or EI2OS function can be used to transfer the A/D conversion
result from the A/D data register (ADCR) to memory. For information on how to use the DMAC/ EI2OS
functions, see Section "18.5.4 Conversion Operation with μDMAC or EI2OS Function" and Section
"18.5.5 A/D Conversion Data Protection Function".
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
423
CHAPTER 18 8/10-BIT A/D CONVERTER
18.5 Operating Explanation of 8/10-bit A/D Converter
18.5
MB90340E Series
Operating Explanation of 8/10-bit A/D Converter
For A/D conversion operation of the 8/10-bit A/D converter, the following A/D conversion
modes are available. Each mode is set based on the setting of the A/D conversion mode
selection bits (ADCS: MD1, MD0) in the A/D control status register.
• Single conversion mode
• Continuous conversion mode
• Stop conversion mode
■ Single Conversion Mode (ADCS: MD1, MD0=00B or 01B)
• When an activation trigger is input, the analog inputs from the start channel (ADSR: ANS4 to ANS0) to
the end channel (ADSR: ANE4 to ANE0) are A/D-converted continuously.
• A/D conversion operation stops at the time of completing of the A/D conversion for the end channel.
Notes:
• In single conversion mode 1 (ADCS:MD1, MD0=00B), do not input an activation trigger during A/D
conversion or a pause* as this may cause a restart of the 8/10-bit A/D converter.
• In single conversion mode 2 (ADCS:MD1, MD0=01B), a restart of the 8/10-bit A/D converter will
not occur even if an activation trigger is input during A/D conversion or a pause*.
• To restart in either single conversion mode 1 or 2, follow the order indicated in Section "18.5.1
Single Conversion Mode".
*: The pause state is in a state which conversion is suspended due to the A/D conversion
protection function. For details, see Section "18.5.5 A/D Conversion Data Protection Function".
■ Continuous Conversion Mode (ADCS: MD1, MD0=10B)
• When an activation trigger is input, the analog inputs from the start channel (ADSR: ANS4 to ANS0) to
the end channel (ADSR: ANE4 to ANE0) are A/D-converted continuously.
• When A/D conversion for the end channel is completed, it is continued by returning to the analog input
of the start channel.
■ Stop Conversion Mode (ADCS: MD1, MD0=11B)
• When a start trigger is input, A/D conversion starts for the start channel (ADSR: ANS4 to ANS0). The
A/D conversion operation stops at the completion of A/D conversion for one channel. This state is
called the "stop state". When a start trigger is input while the A/D conversion operation stops, A/D
conversion is performed for the next channel.
• The A/D conversion operation stops at the completion of A/D conversion for the end channel. When a
start trigger is input while the A/D conversion operation stops, A/D conversion is continued by returning
to the analog input of the start channel.
424
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
MB90340E Series
18.5.1
Single Conversion Mode
CHAPTER 18 8/10-BIT A/D CONVERTER
18.5 Operating Explanation of 8/10-bit A/D Converter
In single conversion mode, A/D conversion is performed sequentially from the start
channel to the end channel. The A/D conversion operation stops at the completion of
the A/D conversion for the end channel.
■ Setting for Single Conversion Mode
To operate the 8/10-bit A/D converter in single conversion mode, the settings shown in Figure 18.5-1 are
required.
Figure 18.5-1 Setting for Single Conversion Mode
bit15 14 13 12 11 10
ADCS
9 bit8 bit7 6
5
4
3
2
1 bit0
BUSY INT INTE PAUS STS1 STS0 STRT − MD1 MD0 S10 −
−
−
−
0
ADCR
−
−
−
−
−
−
Reserved
0
D9 to D0 (Holds conversion results)
ADSR
ST2 ST1 ST0 CT2 CT1 CT0 ANS4 ANS3 ANS2 ANS1 ANS0 ANE4 ANE3 ANE2 ANE1 ANE0
ADER5
ADE15 ADE14 ADE13 ADE12 ADE11 ADE10 ADE9 ADE8
ADER7/
ADER6
ADE23 ADE22 ADE21 ADE20 ADE19 ADE18 ADE17 ADE16 ADE7 ADE6 ADE5 ADE4 ADE3 ADE2 ADE1 ADE0
− : Undefined
: Used bit
: Set the bit corresponding to the pin to be used as an analog input pin to "1"
0 : Set to "0"
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
425
CHAPTER 18 8/10-BIT A/D CONVERTER
18.5 Operating Explanation of 8/10-bit A/D Converter
MB90340E Series
■ Single Conversion Mode Operation and How to Use It
• When a start trigger is input, A/D conversion starts from the channel set by the A/D conversion start
channel selection bits (ANS4 to ANS0) and is performed continuously up to the channel set by the A/D
conversion end channel selection bits (ANE4 to ANE0).
• The A/D conversion operation stops at the completion of the A/D conversion for the channel set by the
A/D conversion end channel selection bits (ANE4 to ANE0).
• To terminate an A/D conversion operation forcibly, write "0" to the A/D conversion operating flag bit
(ADCS:BUSY) in the A/D control status register.
[If start channel and end channel are the same]
• If the start and end channels are set to the same channel number (ADSRS: ANS4 to ANS0=ADSR:
ANE4 to ANE0), A/D conversion for only one channel set as the start channel (= end channel) is
performed only once and terminated.
[Conversion order in single conversion mode]
Table 18.5-1 shows an example of the conversion order in single conversion mode.
Table 18.5-1 Conversion Order in Single Conversion Mode
Start channel
End channel
Conversion order in single conversion mode
AN0 pin
(ADSR: ANS=00000B)
AN3 pin
(ADSR: ANE=00011B)
AN0 → AN1 → AN2 → AN3 → End
AN3 pin
(ADSR: ANS=00011B)
AN3 pin
(ADSR: ANE=00011B)
AN3 → End
[Restart]
To restart A/D conversion during A/D conversion execution or a pause state, terminate the conversion
forcibly once and then restart it. Follow the procedure below:
1) Clear the A/D conversion operating flag bit (ADCS:BUSY)
2) Clear the interrupt request flag bit (ADCS:INT)
3) Set the A/D conversion software activation bit (ADCS:STRT)
426
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 18 8/10-BIT A/D CONVERTER
18.5 Operating Explanation of 8/10-bit A/D Converter
MB90340E Series
18.5.2
Continuous Conversion Mode
In continuous conversion mode, A/D conversion is performed sequentially from the
start channel to the end channel. When the A/D conversion for the end channel is
completed, the A/D conversion operation is continued by returning to the start channel.
■ Setting for Continuous Conversion Mode
To operate the 8/10-bit A/D converter in continuous conversion mode, the settings shown in Figure 18.5-2
are required.
Figure 18.5-2 Setting for Continuous Conversion Mode
bit15 14 13 12 11 10
ADCS
9 bit8 bit7 6
4
3
2
1 bit0
BUSY INT INTE PAUS STS1 STS0 STRT − MD1 MD0 S10 −
−
−
−
1
ADCR
−
−
−
−
−
−
5
0
Reserved
0
D9 to D0 (Holds conversion results)
ADSR
ST2 ST1 ST0 CT2 CT1 CT0 ANS4 ANS3 ANS2 ANS1 ANS0 ANE4 ANE3 ANE2 ANE1 ANE0
ADER5
ADE15 ADE14 ADE13 ADE12 ADE11 ADE10 ADE9 ADE8
ADER7/
ADER6
ADE23 ADE22 ADE21 ADE20 ADE19 ADE18 ADE17 ADE16 ADE7 ADE6 ADE5 ADE4 ADE3 ADE2 ADE1 ADE0
− : Undefined
: Used bit
: Set the bit corresponding to the pin to be used as an analog input pin to "1"
1 : Set to "1"
0 : Set to "0"
■ Continuous Conversion Mode Operation and How to Use It
• When a start trigger is input, an A/D conversion starts from the channel set by the A/D conversion start
channel selection bits (ANS4 to ANS0) and is performed continuously up to the channel set by the A/D
conversion end channel selection bits (ANE4 to ANE0).
• When the A/D conversion for the channel set by the A/D conversion end channel selection bits (ANE4
to ANE0) is completed, the A/D conversion is continued by returning to the channel set by the A/D
conversion start channel selection bits (ANS4 to ANS0).
• To terminate an A/D conversion forcibly, write "0" to the A/D conversion operating flag bit
(ADCS:BUSY) in the A/D control status register.
[If start channel and end channel are the same]
• If the start and end channels are set to the same channel (ADSR: ANS4 to ANS0=ADSR: ANE4 to
ANE0), the A/D is repeatedly converted for one channel set as the start channel.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
427
CHAPTER 18 8/10-BIT A/D CONVERTER
18.5 Operating Explanation of 8/10-bit A/D Converter
MB90340E Series
[Conversion order in continuous conversion mode]
Table 18.5-2 shows an example of the conversion order in continuous conversion mode.
Table 18.5-2 Conversion Order in Continuous Conversion Mode
Start channel
End channel
Conversion order in continuous conversion mode
AN0 pin
(ADSR: ANS=00000B)
AN3 pin
(ADSR: ANE=00011B)
AN0 → AN1 → AN2 → AN3 → AN0→ Repeat
AN3 pin
(ADSR: ANS=00011B)
AN3 pin
(ADSR: ANE=00011B)
AN3 → AN3 → Repeat
[Restart]
To restart A/D conversion during A/D conversion execution or a pause state, terminate the conversion
forcibly once and then restart it. Follow the procedure below:
1) Clear the A/D conversion operating flag bit (ADCS:BUSY)
2) Clear the interrupt request flag bit (ADCS:INT)
3) Set the A/D conversion software activation bit (ADCS:STRT)
428
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
MB90340E Series
18.5.3
Stop Conversion Mode
CHAPTER 18 8/10-BIT A/D CONVERTER
18.5 Operating Explanation of 8/10-bit A/D Converter
In stop conversion mode, A/D conversion is performed by repeatedly starting and
stopping for each channel. When a start trigger is input after an A/D conversion
operation stops at the completion of the A/D conversion for the end channel, the A/D
conversion is continued by returning to the start channel.
■ Setting for Stop Conversion Mode
To operate the 8/10-bit A/D converter in stop conversion mode, the settings shown in Figure 18.5-3 are
required.
Figure 18.5-3 Setting for Stop Conversion Mode
bit15 14 13 12 11 10
ADCS
9 bit8 bit7 6
4
3
2
1 bit0
BUSY INT INTE PAUS STS1 STS0 STRT − MD1 MD0 S10 −
−
−
−
1
ADCR
−
−
−
−
−
−
5
1
Reserved
0
D9 to D0 (Holds conversion results)
ADSR
ST2 ST1 ST0 CT2 CT1 CT0 ANS4 ANS3 ANS2 ANS1 ANS0 ANE4 ANE3 ANE2 ANE1 ANE0
ADER5
ADE15 ADE14 ADE13 ADE12 ADE11 ADE10 ADE9 ADE8
ADER7/
ADER6
ADE23 ADE22 ADE21 ADE20 ADE19 ADE18 ADE17 ADE16 ADE7 ADE6 ADE5 ADE4 ADE3 ADE2 ADE1 ADE0
− : Undefined
: Used bit
: Set the bit corresponding to the pin to be used as an analog input pin to "1"
1 : Set to "1"
0 : Set to "0"
■ Stop Conversion Mode Operation and How to Use It
• When a start trigger is input, an A/D conversion starts at the channel set by the A/D conversion start
channel selection bits (ANS4 to ANS0). The A/D conversion operation stops at the completion of the A/D
conversion for one channel. When a start trigger is input while the A/D conversion operation stops, A/D
conversion for the next channel is performed.
• The A/D conversion operation stops at the completion of the A/D conversion for the channel set by the
A/D conversion end channel selection bits (ANE4 to ANE0). When a start trigger is input while the A/D
conversion operation stops, the A/D conversion is continued by returning to the channel set by the A/D
conversion start channel selection bits (ANS4 to ANS0).
• In order to terminate an A/D conversion forcibly, write "0" to the A/D conversion operating flag bit
(ADCS:BUSY) in the A/D control status register.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
429
CHAPTER 18 8/10-BIT A/D CONVERTER
18.5 Operating Explanation of 8/10-bit A/D Converter
MB90340E Series
[If start channel and end channel are the same]
• If the start and end channels are set to the same channel (ADSR:ANS4 to ANS0=ADSR: ANE4 to
ANE0), A/D conversion for one channel set as the start channel (= end channel) and stop are repeated.
[Conversion order in stop conversion mode]
Table 18.5-3 shows an example of the conversion order in stop conversion mode.
Table 18.5-3 Conversion Order in Stop Conversion Mode
Start channel
End channel
Conversion order in stop conversion mode
AN0 pin
(ADSR: ANS=00000B)
AN3 pin
(ADSR: ANE=00011B)
AN0 → stop start → AN1 → stop start → AN2
→
stop start → AN3 → stop start → AN0 → repeat
AN3 pin
(ADSR: ANS=00011B)
AN3 pin
(ADSR: ANE=00011B)
AN3 → stop start → AN3 → stop start → repeat
[Restart]
To restart A/D conversion during A/D conversion execution or a pause state, terminate the conversion
forcibly once and then restart it. Follow the procedure below:
1) Clear the A/D conversion operating flag bit (ADCS:BUSY)
2) Clear the interrupt request flag bit (ADCS:INT)
3) Set the A/D conversion software activation bit (ADCS:STRT)
430
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 18 8/10-BIT A/D CONVERTER
18.5 Operating Explanation of 8/10-bit A/D Converter
MB90340E Series
18.5.4
Conversion Operation with μDMAC or EI2OS Function
The 8/10-bit A/D converter can transfer an A/D conversion result to memory by using the
μDMAC or EI2OS function.
■ Conversion Operation with μDMAC/EI2OS Function
Figure 18.5-4 shows the conversion operation flow when the μDMAC or EI2OS function is used.
Figure 18.5-4 Conversion Operation Flow When μDMAC/EI2OS Function Is Used
Activate A/D converter
Sample & hold
Start A/D conversion
End A/D conversion
Generate interrupt
Activate μDMAC or EI2OS
Transfer conversion result
Completed
a specified number of
times? *
NO
Interrupt clear
YES
Process interrupt
*: The number of times is determined by the DMA or EI2OS setting
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
431
CHAPTER 18 8/10-BIT A/D CONVERTER
18.5 Operating Explanation of 8/10-bit A/D Converter
18.5.5
MB90340E Series
A/D Conversion Data Protection Function
The data protection function is triggered when A/D conversion is performed while
interrupt request output is enabled.
■ Explanation of A/D Conversion Data Protection Function in 8/10-bit A/D Converter
The A/D conversion data protection function is to prevent unexpectedly failing to take some A/D
conversion data.
The 8/10-bit A/D converter has one A/D data register (ADCR1/ADCR0) for storing conversion data and
one successive approximation circuit for storing the data currently being A/D converted. During A/D
conversion execution, the 8/10-bit A/D converter stores conversion data by one bit in the successive
approximation circuit, and when the A/D conversion is completed, it stores the A/D conversion result in the
A/D data register.
The 8/10-bit A/D converter operations with/without using the A/D conversion data protection function are
shown below.
• When the interrupt request enable bit is set to (ADCS:INTE)=0, the data protection function will be
disabled. In this case, if A/D conversion is performed continuously, the 8/10-bit A/D converter stores
the conversion result in the A/D data register every time the converter ends the conversion. (This means
that the latest conversion data is always stored.)
• When the interrupt request enable bit is set to (ADCS:INTE)=1, the data protection function will be
valid. If A/D conversion is performed continuously in this state, the interrupt request flag bit is set to
ADCS:INT=1 when the first conversion is completed. Then, the next A/D conversion is performed. If
the conversion ends with INT=1 state, the 8/10-bit A/D converter enters "pause state" immediately
before it transfers the conversion result from the successive approximation circuit to the A/D data
register to prevent the conversion data from being overwritten. The pause flag bit (ADCS: PAUS) in the
A/D control status register is set to "1" at this time. If the interrupt request flag bit (ADCS:INT) is
cleared to "0" during a pause state, the data stored in the successive approximation circuit will be
transferred to the A/D data register (see Figure 18.5-5).
Figure 18.5-5 Operation of A/D Conversion Data Protection Function
A/D (1) conversion time
Sampling time
Compare time
A/D conversion data register ADCR
A/D conversion interrupt (INTbit)
Sampling time
A/D conversion data
protection function operation A/D (3) conversion time
Compare time
A/D (1) conversion result
INT=0
A/D conversion data protection function
(PAUSbit)
432
A/D (2) conversion time
INT=1
A/D (2) conversion result
INT clear
PAUS=0
PAUS=1
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
MB90340E Series
CHAPTER 18 8/10-BIT A/D CONVERTER
18.5 Operating Explanation of 8/10-bit A/D Converter
● A/D conversion data protection function for the case A/D conversion result is read by CPU
• After an analog input is A/D converted, the interrupt request flag bit (ADCS: INT) in the A/D control
status register is set to "1" when the A/D conversion result is stored in the A/D data register (ADCR).
• If the interrupt request flag bit (ADCS: INT) that was set at the completion of the previous A/D
conversion remains set at the end of the next A/D conversion, the A/D conversion operation pauses to
protect the data immediately before overwriting new data to the A/D data register, if interrupt request is
enabled (ADCS: INTE=1).
• Since interrupt request in the A/D control status register is enabled (ADCS: INTE=1), an interrupt
request is generated when the INT bit is set. When the INT bit is cleared, a pause state of the A/D
conversion operation will be canceled.
• If A/D conversion is performed continuously, the 8/10-bit A/D converter starts the next A/D conversion
operation. At this time, the pause flag bit (ADCS: PAUS) is not cleared to "0" automatically. In order to
clear, write "0" to this bit.
Notes:
• If interrupt request output is disabled (ADCS:INTE=0) during a pause state, this may start A/D
conversion and rewrite the data in the A/D data register.
• If A/D conversion is performed continuously for more than once, read the data stored in the A/D
data register before clearing the interrupt request flag bit (ADCS:INT). If the interrupt request flag
bit (ADCS:INT) is cleared before reading the data stored in the A/D data register when A/D
conversion is in a pause state, the first stored conversion data will be overwritten by the next
conversion data and destroyed.
● A/D conversion protection function for the case A/D conversion result is transferred by μDMAC/EI2OS
After an A/D conversion, if the next A/D conversion ends while the A/D conversion result is being
transferred from the A/D data register to memory using the DMA or EI2OS function, the A/D conversion
operation pauses to protect data immediately before it overwrites new data to the A/D data register. When
an A/D conversion operation pauses, the pause flag bit (ADCS: PAUS) in the A/D control status register is
set to "1".
When a memory transfer of an A/D conversion result is completed by using the μDMA or EI2OS function,
a pause state of A/D conversion will be cancelled. If A/D conversion is performed continuously, the A/D
conversion operation is restarted. At this time, the pause flag bit (ADCS: PAUS) is not cleared to "0"
automatically. In order to clear, write 0 to this bit.
Notes:
• Do not clear the interrupt request flag bit (ADCS: INT=0) from CPU when an A/D conversion
result is transferred to memory by using the μDMAC or EI2OS function. Otherwise the data in the
A/D data register in transfer process may be rewritten.
• Do not disable interrupt request output when an A/D conversion result is transferred to memory by
using the μDMAC or EI2OS function. If interrupt request output is disabled (ADCS:INTE=0) during
a pause state, this may start A/D conversion and rewrite the data in the A/D data register.
• Do not restart when an A/D conversion result is transferred to memory using the μDMAC or
EI2OS function. If the converter is restarted during a conversion pause state, the conversion result
may be destroyed.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
433
CHAPTER 18 8/10-BIT A/D CONVERTER
18.5 Operating Explanation of 8/10-bit A/D Converter
MB90340E Series
● Processing flow of A/D conversion data protection function when μDMAC/EI2OS is used
Figure 18.5-6 shows the processing flow of the A/D conversion data protection function when μDMAC/
EI2OS is used.
Figure 18.5-6 Processing Flow of A/D Conversion Data Protection Function when μDMAC/EI2OS is Used
Set μDMAC or EI2OS
Activate A/D continuous conversion
Complete the first conversion
Store data in A/D data register
Activate μDMAC or EI2OS
Complete the second conversion
μDMAC/ EI2OS end?
NO
Pause A/D
YES
Store data in A/D data register
Third conversion
Activate μDMAC or EI2OS
Continue
Complete all conversions
μDMAC/ EI2OS end?
NO
Pause A/D
YES
Activate μDMAC or EI2OS
Interrupt processing
Stop A/D conversion
Note: Flows for A/D converter operation during stop are omitted.
434
End
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 18 8/10-BIT A/D CONVERTER
18.6 Notes on Using 8/10-bit A/D Converter
MB90340E Series
18.6
Notes on Using 8/10-bit A/D Converter
Note the following points when using the 8/10-bit A/D converter.
■ Notes on Using 8/10-bit A/D Converter
● Analog input pin
• The analog input pins serve as general-purpose I/O ports of ports 5 to 7. When using the pin as an
analog input pin, switch the pin to analog input pin by setting the analog input enable register (ADER5
to ADER7).
•
When using the pin as an analog input pin, write "1" to the bit in the analog input enable register
(ADER5 to ADER7) corresponding to the pin to be used to set it to analog input enable.
•
If an intermediate-level signal is input to the pin being set as a general-purpose I/O port, input leakage
current will flow in the gate. When using the pin as an analog input pin, be sure to set the pin to analog
input enable.
● Note on the case of activating by internal timer or external trigger
• In order to activate the 8/10-bit A/D converter by internal timer output or external trigger, set the level
of the timer output and external trigger to the inactive side ("H" side for external trigger) when setting
the A/D activation trigger selection bits (ADCS: STS1, STS0) in the A/D control status register.
Holding the input value of the activation trigger at the active side may cause the converter to start
concurrently with the setting of the A/D activation trigger selection bits (ADCS: STS1, STS0) in the A/D
control status register.
● Order of turning on the 8/10-bit A/D converter power supply and analog input
• Be sure to turn on the digital power supply (VCC) before turning on the 8/10-bit A/D converter power
supply and analog inputs (products with 'C'-suffix: AN0 to AN23 pins/products without 'C'-suffix: AN0
to AN15 pins).
• Turn off the digital power supply after turning off the 8/10-bit A/D power supply and analog inputs.
• Turn on and off AVRH in order not to exceed AVCC. (There is no problem to turn on or off the analog
power supply and digital power supply concurrently.)
● Supply voltage of 8/10-bit A/D converter
• For latch-up prevention, the 8/10-bit A/D converter power supply (AVCC) must not exceed the voltage
of the digital power supply (VCC).
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
435
CHAPTER 18 8/10-BIT A/D CONVERTER
18.6 Notes on Using 8/10-bit A/D Converter
436
FUJITSU SEMICONDUCTOR LIMITED
MB90340E Series
CM44-10143-5E
CHAPTER 19
CLOCK MONITOR FUNCTION
This chapter explains the functions and operations of
the clock monitor.
19.1 Overview of Clock Monitor Function
19.2 Block Diagram of Clock Monitor Function
19.3 Configuration of Clock Monitor Function
19.4 Program Example of Clock Monitor Function
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
437
CHAPTER 19 CLOCK MONITOR FUNCTION
19.1 Overview of Clock Monitor Function
19.1
MB90340E Series
Overview of Clock Monitor Function
The clock monitor function outputs division clock of the machine clock for monitoring
from the clock monitor pin (CKOT).
■ Overview of Clock Monitor Function
• When the output enable bit of the clock output enable register is set to "1" (CLKR:CKEN=1), the clock
is output from the clock monitor pin (CKOT).
• The frequency of the clock to be output is set by the output frequency selection bit of the clock output
enable register (CLKR: FRQ2 to FRQ0).
Table 19.1-1 shows the frequency of the clock to be output using the clock monitor function.
Table 19.1-1 Output Frequency for Clock Monitor Function
FRQ2 to
FRQ0 Bit
Clock Output
Frequency
000B
φ=24MHz
φ=16MHz
φ=8MHz
Cycle
Frequency
Cycle
Frequency
Cycle
Frequency
φ/21
83 ns
12 MHz
125 ns
8 MHz
250 ns
4 MHz
001B
φ/22
167 ns
6 MHz
250 ns
4 MHz
500 ns
2 MHz
010B
φ/23
333 ns
3 MHz
500 ns
2 MHz
1.0 μs
1 MHz
011B
φ/24
667 ns
1.5 MHz
1.0 μs
1 MHz
2.0 μs
500 kHz
100B
φ/25
1.3 μs
750 kHz
2.0 μs
500 kHz
4.0 μs
250 kHz
101B
φ/26
2.7 μs
375 kHz
4.0 μs
250 kHz
8.0 μs
125 kHz
110B
φ/27
5.3 μs
187.5 kHz
8.0 μs
125 kHz
16.0 μs
62.5 kHz
111B
φ/28
10.7 μs
93.75 kHz
16.0 μs
62.5 kHz
32.0 μs
31.25 kHz
φ: Machine clock frequency
438
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 19 CLOCK MONITOR FUNCTION
19.2 Block Diagram of Clock Monitor Function
MB90340E Series
19.2
Block Diagram of Clock Monitor Function
The clock monitor function module consists of the following blocks:
• Prescaler
• Count clock selector
• Clock output enable register
■ Block Diagram of Clock Monitor Function
Figure 19.2-1 Block Diagram of Clock Monitor Function
Internal data bus
Prescaler
Count
clock
selector
Pin
CKOT
Output enable
Clock output enable
register (CLKR)
3
CKEN FRQ2 FRQ1 FRQ0
− : Undefined
φ : Machine clock frequency
● Prescaler
Divides the machine clock φ and provides it to the count clock selector.
● Count clock selector
Selects the clock to be output from 8 types of division clock.
● Clock output enable register
Enables the clock output and selects the output frequency.
■ Details of Pin
The following shows the detail of the pin of the clock monitor function:
CKOT pin: P81/CKOT
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
439
CHAPTER 19 CLOCK MONITOR FUNCTION
19.3 Configuration of Clock Monitor Function
19.3
MB90340E Series
Configuration of Clock Monitor Function
This section details the pins and registers of the clock monitor function.
■ Pin of Clock Monitor Function
The clock monitor pin (CKOT) serve as general-purpose I/O ports.
Table 19.3-1 shows the setting to be used in the pin function and clock monitor function.
Table 19.3-1 Pin of Clock Monitor Function
Pin Name
P81/
TOT0/
INT13R/
CKOT
440
Pin Function
General-purpose I/O ports /
16-bit reload timer input 0 /
External interrupt 13 /
Clock monitor output
Required Setting for Use of Clock Monitor Function
•
•
•
Reload timer output disabled (TMCSR0: OUTE=0)
External interrupt 13 disabled (ENIR1: EN13=0) or use P05 instead of
P81 (EISSR: INT13R=0)
Clock output enabled (CLKR: CKEN=1)
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 19 CLOCK MONITOR FUNCTION
19.3 Configuration of Clock Monitor Function
MB90340E Series
19.3.1
Clock output enable register (CLKR)
Clock output enable register (CLKR) enables the clock output and selects the output
frequency.
■ Clock Output Enable Register (CLKR)
Figure 19.3-1 Clock Output Enable Register (CLKR)
Address
7
6
5
4
00796CH
-
-
-
-
3
2
1
0
Initial value
CKEN FRQ2 FRQ1 FRQ0 XXXX0000B
R/W
R/W R/W R/W
bit2
bit1
bit0
FRQ2 FRQ1 FRQ0
Output Frequency Select Bit
0
0
0
φ/ 21
0
0
1
φ/ 22
0
1
0
φ/ 23
0
1
1
φ/ 24
1
0
0
φ/ 25
1
0
1
φ/ 26
1
1
0
φ/ 27
1
1
1
φ/ 28
bit3
CKEN
R/W
: Readable/writable
X
: Undefined
Output Enable Bit
0
General-purpose I/O port
1
Clock output
: Initial value
Table 19.3-2 Functions of Clock Output Enable Register (CLKR)
Bit name
Function
bit7
to
bit4
Undefined bit
Read : The value is undefined.
Write : No effect.
bit3
CKEN:
Output Enable Bit
Enables the output of clock monitor pin (CKOT).
When set to "1": Set to the clock monitor pin.
When set to "0": Set to general-purpose I/O port.
bit2
to
bit0
FRQ0, FRQ1, FRQ2:
Output frequency select bit
Sets the frequency of the clock to be output.
The division rate for the machine clock can be selected and set from 8 types.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
441
CHAPTER 19 CLOCK MONITOR FUNCTION
19.4 Program Example of Clock Monitor Function
19.4
MB90340E Series
Program Example of Clock Monitor Function
This section gives a program example of the clock monitor.
■ Program Example of Clock Monitor
● Processing specification
• When the machine clock is φ=24MHz, the clock at the frequency of 750 kHz is output from the CKOT
pin.
• The bits FRQ2 to FRQ0 are 100B (clock: φ/25).
● Coding example
CLKR
EQU
00796CH
;Clock output control register
;
;---------Main program--------------------------------------------CODE
CSEG
START:
;
;Stack pointer (SP), etc., already
;initialized
MOV
I:CLKR,#00001100B ;Clock output enabled, φ/25 set
;
•
Processing by user
•
CODE
ENDS
END
START
;---------Vector setting------------------------------------------VECT
CSEG ABS=0FFH
ORG
00FFDCH
;Set reset vector
DSL
START
DB
00H
;Set to single-chip mode
442
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 20
LIN-UART
This chapter explains the functions and operations of
LIN-UART.
20.1 Overview of LIN-UART
20.2 Configuration of LIN-UART
20.3 Pins of LIN-UART
20.4 Registers of LIN-UART
20.5 Interrupts of LIN-UART
20.6 Baud Rate of LIN-UART
20.7 Operation of LIN-UART
20.8 Notes on Using LIN-UART
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
443
CHAPTER 20 LIN-UART
20.1 Overview of LIN-UART
20.1
MB90340E Series
Overview of LIN-UART
The LIN (Local Interconnect Network)-UART is a general-purpose serial data
communication interface for synchronous or asynchronous (start-stop synchronization)
communication with external devices. In addition to a bidirectional communication
function (normal mode) and master/slave communication function (multiprocessor
mode: supports both master and slave operation), the LIN-UART also supports the
special functions used by the LIN bus.
■ Functions of LIN-UART
● Functions of LIN-UART
The LIN-UART is a general-purpose serial data communication interface for exchanging serial data with
other CPUs and peripheral devices. Table 20.1-1 lists the functions of the LIN-UART.
Table 20.1-1 Functions of LIN-UART (1 / 2)
Function
Data buffer
Full-duplex double-buffer
Serial input
The LIN-UART oversamples received data for 5 times to determine the received
value by majority (only asynchronous mode).
Transfer mode
• Clock synchronization (Select start/stop synchronization, or start/stop bit)
• Clock asynchronous (Start/stop bits available)
Baud rate
• Dedicated baud rate generator provided (made of a 15-bit reload counter)
• The external clock can be input and also be adjusted by the reload counter.
Data length
• 7 bits (not in synchronous or LIN mode)
• 8 bits
Signal type
NRZ (Non Return to Zero)
Start bit timing
Synchronization with the falling edge of the start bit in asynchronous mode.
Reception error detection
• Framing error
• Overrun error
• Parity error (Not supported in operation mode 1 and operation mode 3)
Interrupt request
• Reception interrupts (reception completed, reception error detected, LIN Synch
break detected)
• Transmit interrupts (transmit data empty)
• Interrupt request to ICU (LIN Synch field detected: LSYN)
• Extended intelligent I/O service (EI2OS) and DMA function can be supported
for both transmission and reception.
Master/slave mode communication
function (Multiprocessor mode)
Capable of 1 (master) to n (slaves) communication
(support both the master and slave system)
Synchronous mode
Master or slave function
444
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 20 LIN-UART
20.1 Overview of LIN-UART
MB90340E Series
Table 20.1-1 Functions of LIN-UART (2 / 2)
Function
Pin access
Serial I/O pin state can be read directly.
•
•
•
•
•
LIN bus option
Master device operation
Slave device operation
LIN Synch break detection
LIN Synch break generation
Detection of LIN Synch field start/stop edges connected to the input capture 0,
1, 6 and 7
Synchronous serial clock
Continuous output to the SCK pin is possible for synchronous communication
using the start/stop bits.
Clock delay option
Special synchronous clock mode for delaying the clock (used for SPI)
The LIN-UART operates in four different modes. The operating mode is selected by the MD0 and MD1
bits in the LIN-UART serial mode register (SMR). Modes 0 and 2 are used for bidirectional serial
communication; mode 1 for master/slave communication; and mode 3 for LIN master/slave
communication.
Table 20.1-2 LIN-UART Operating Modes
Data length
Operating mode
No parity
0
Normal mode
1
Multi processor mode
2
Normal mode
3
LIN mode
With parity
7 bits or 8 bits
Synchronous
method
Stop bit length
Data bit format
Asynchronous
1 bit or 2 bits
7 bits or 8 bits
+1*
—
8 bits
8 bits
—
Asynchronous
LSB first
MSB first
Synchronous
None,
1 bit, 2 bits
Asynchronous
1 bit
LSB first
— : Unavailable setting
* : "+1" is the address/data selection bit (AD) used for communication control in multiprocessor mode.
The MD1 and MD0 bits in the LIN-UART serial mode register (SMR) are used to select the following
LIN-UART operating modes.
Table 20.1-3 LIN-UART Operating Modes
CM44-10143-5E
MD1
MD0
Mode
Type
0
0
0
Asynchronous (Normal mode)
0
1
1
Asynchronous (Multiprocessor mode)
1
0
2
Synchronous (Normal mode)
1
1
3
Asynchronous (LIN mode)
FUJITSU SEMICONDUCTOR LIMITED
445
CHAPTER 20 LIN-UART
20.1 Overview of LIN-UART
MB90340E Series
Notes:
• Mode 1 supports both master and slave operation when the master and slave are connected.
• Mode 3 is fixed to communication format 8N-1, LSB first.
• When the mode is changed, the UART stops transmission/reception and waits until the next
communication starts.
■ LIN-UART Interrupts and EI2OS
Table 20.1-4 LIN-UART Interrupts and EI2OS
Interrupt control register
Channel
Interrupt No.
Vector table address
Register
name
Address
Lower
Upper
Bank
EI2OS
μDMAC
channel
LIN-UART0
reception
#35(23H)
ICR12
0000BCH
FFFF70H
FFFF71H
FFFF72H
*1
DRQ10*3
LIN-UART0
transmission
#36(24H)
ICR12
0000BCH
FFFF6CH
FFFF6DH
FFFF6EH
*2
DRQ11
LIN-UART1/3
reception
#37(25H)
ICR13
0000BDH
FFFF68H
FFFF69H
FFFF6AH
*1
DRQ12*3
LIN-UART1/3
transmission
#38(26H)
ICR13
0000BDH
FFFF64H
FFFF65H
FFFF66H
*2
DRQ13
LIN-UART2/4
reception
#39(27H)
ICR14
0000BEH
FFFF60H
FFFF61H
FFFF62H
*1
DRQ14*3
LIN-UART2/4
transmission
#40(28H)
ICR14
0000BEH
FFFF5CH
FFFF5DH
FFFF5EH
*2
DRQ15
*1: ICR12 to ICR14 are shared with multiple interrupt sources; therefore, they are only available when such sources are not used as
interrupts.
EI2OS stop function is available when a reception error is detected.
*2: ICR12 to ICR14 are shared with multiple interrupt sources; therefore, they are only available when such sources are not used as
interrupts.
*3: DMA stop function is available when a reception error is detected.
446
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
MB90340E Series
20.2
Configuration of LIN-UART
CHAPTER 20 LIN-UART
20.2 Configuration of LIN-UART
This section briefly outlines the blocks that form the LIN-UART.
■ LIN-UART Consists of the Following Blocks.
• Reload counter
• Reception control circuit
• Reception shift register
• Reception data register (RDR)
• Transmission control circuit
• Transmit shift register
• Transmit data register (TDR)
• Error detection circuit
• Oversampling circuit
• Interrupt generation circuit
• LIN Synch break/Synch Field detection circuit
• Bus idle detection circuit
• LIN-UART serial mode register (SMR)
• Serial control register (SCR)
• Serial status register (SSR)
• Extended communication control register (ECCR)
• Extended status control register (ESCR)
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
447
CHAPTER 20 LIN-UART
20.2 Configuration of LIN-UART
MB90340E Series
■ Block Diagram of LIN-UART
Figure 20.2-1 Block Diagram of LIN-UART
OTO,
EXT,
REST
CLK
PE
ORE FRE
Transmission clock
Reception clock
Reload
counter
SCKn
Interrupt
generation
circuit
Transmission
control circuit
Reception control, twice
Pin
SINn
Pin
Start bit
detection
circuit
Transmission
start circuit
Reception
bit counter
Transmission
bit counter
Reception
parity counter
Transmission
parity counter
Restart reception
reload counter
Oversampling
circuit
TIE
RIE
LBIE
LBD
RBI
TBI
Reception
IRQ
Transmission
TDRE
IRQ
SOTn
Pin
RDRF
SOTn
SINn
Internal signal
to capture
LIN break/
Synch Field
detection
circuit
To DMA/
EI2OS
SINn
Transmit
shift register
Reception
shift register
Transmission
start
Bus idle
detection
circuit
Error
detection
circuit
PE
ORE
FRE
LIN break
generation
circuit
RDRn
LBR
LBL1
LBL0
TDRn
RBI
LBD
TBI
Internal data bus
PE
ORE
FRE
RDRF
TDRE
BDS
RIE
TIE
SSRn
register
MD1
MD0
OTO
EXT
REST
UPCL
SCKE
SOE
SMRn
register
PEN
P
SBL
CL
A/D
CRE
RXE
TXE
SCRn
register
LBIE
LBD
LBL1
LBL0
SOPE
SIOP
CCO
SCES
LBR
ESCRn
register
MS
SCDE
SSM
ECCRn
register
RBI
TBI
n = 0, 1, 2, 3, 4
448
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 20 LIN-UART
20.2 Configuration of LIN-UART
MB90340E Series
■ Explanation of Each Block
● Reload counter
This block is a 15-bit reload counter serving as a dedicated baud rate generator. The block consists of a 15bit register for reload values; it generates the transmission/reception clock from the external or internal
clock. The count value in the transmission reload counter is read from BGRn1 and BGRn0.
● Reception control circuit
This block consists of a reception bit counter, a start bit detection circuit, and a reception parity counter.
The reception bit counter counts the reception data bits and sets a flag in the serial status register when one
data reception is completed according to the specified data length. If the reception interrupt is enabled at
this time, a reception interrupt request is generated. The start bit detection circuit detects a start bit in a
serial input signal. When a start bit is detected, the circuit sends a signal to the reload counter in
synchronization with the start bit falling edge. The reception parity counter calculates the parity of the
received data.
● Reception shift register
This register retrieves data received from the SINn pin while bit-shifting and transfers it to the RDR
register upon completion of reception.
● Reception data register (RDR)
This register retains the received data. Serial input data is converted and stored in the reception data
register.
● Transmission control circuit
This block consists of a transmission bit counter, a transmission start circuit, and a transmission parity
counter. The transmission bit counter counts the transmit data bits and sends 1 data item according to the
specified data length. A flag is set in the serial status register when the transmission bit counter starts
sending the data to be written. If the transmit interrupt is enabled at this time, a transmit interrupt request is
generated. The transmission start circuit starts transmission when data is written to the TDR. The
transmission parity counter generates a parity bit for data to be transmitted if the data is parity-checked.
● Transmit shift register
The data written to TDR is transferred to the transmit shift register, and output to the SOTn pin while bitshifting.
● Transmit data register (TDR)
This register sets the transmit data. The written data is converted to serial data and output.
● Error detection circuit
This circuit detects an error upon completion of reception, if any. If an error occurs, the corresponding error
flag is set.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
449
CHAPTER 20 LIN-UART
20.2 Configuration of LIN-UART
MB90340E Series
● Oversampling circuit
In asynchronous mode, the LIN-UART oversamples received data for 5 times to determine the received
value by majority. The LIN-UART stops during operation in synchronous mode.
● Interrupt generation circuit
This circuit controls all interrupt sources. An interrupt is generated immediately if the corresponding
interrupt enable bit has been set.
● LIN Synch break/Synch Field detection circuit
This circuit detects a LIN Synch break when the LIN master node transmits a message header. The LBD
flag is set when the LIN Synch break is detected. An internal signal (LSYN) is output to the capture in
order to detect the 1st and 5th falling edges of the LIN Synch Field and to measure the actual serial clock
synchronization transmitted by the master node.
● LIN Synch break generation circuit
This circuit generates a LIN Synch break with the specified length.
● Bus idle detection circuit
This circuit detects that no transmission or reception is in progress, and generates the TBI and RBI flag
bits.
● LIN-UART serial mode register (SMR)
Operating functions are as follows:
• Selects the LIN-UART operating mode
• Selects a clock input source
• Selects between 1-to-1 connection or reload counter connection for the external clock
• Resets a dedicated reload timer
• LIN-UART software reset (maintains register settings)
• Enables/disables output to the serial data pin
• Enables/disables output to the clock pin
● Serial control register (SCR)
Operating functions are as follows:
• Sets the availability of the parity bit
• Selects the parity bit
• Sets the stop bit length
• Sets the data length
• Selects the frame data format in mode 1
• Clears the error flag
• Enable/disable transmission
• Enable/disable reception
450
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 20 LIN-UART
20.2 Configuration of LIN-UART
MB90340E Series
● Serial status register (SSR)
Operating functions are as follows:
• Checks transmission/reception or error status
• Selects the transfer direction (LSB first or MSB first)
• Enables/disables reception interrupts
• Enables/disables transmit interrupts
● Extended status control register (ESCR)
• Enables/disables LIN Synch break interrupts
• Detects LIN Synch breaks
• Selects the LIN Synch break length
• Direct access to the SINn and SOTn pins
• Sets continuous clock output in LIN-UART synchronous clock mode
• Selects the sampling clock edge
● Extended communication control register (ECCR)
• Bus idle detection
• Synchronous clock setting
• LIN Synch break generation
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
451
CHAPTER 20 LIN-UART
20.3 Pins of LIN-UART
20.3
MB90340E Series
Pins of LIN-UART
This section lists and details the pins, interrupt sources and registers of LIN-UART.
■ Pins of LIN-UART
The LIN-UART pins also serve as general-purpose ports. Table 20.3-1 shows their functions and I/O
format as well as the settings for when the LIN-UART is used.
Table 20.3-1 Pins of LIN-UART
Pin name
Pin function
P82/SIN0
P85/SIN1
P50/SIN2
P12/SIN3
P15/SIN4
Port input/output,
serial data input
P83/SOT0
P86/SOT1
P51/SOT2
P13/SOT3
P16/SOT4
Port input/output,
serial data output
P84/SCK0
P87/SCK1
P52/SCK2
P14/SCK3
P17/SCK4
I/O format
Pull-up
selection
Standby
control
Settings required
to use the pin
Set to the input port
(DDR: corresponding bit = 0)
CMOS output,
CMOS/auto
motive input
P12 to P17:
With pull-up,
Others: No pullup
Available
Set to enable output
(SMRn: SOE = 1)
Set to the input port when inputting
clock
(DDR: corresponding bit = 0)
Port input/output,
serial clock
input/output
Set to enable output when
outputting clock
(SMRn: SCKE = 1)
See the Data Sheet "■ Electrical Characteristics - 3 DC Rating" for the rating.
452
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 20 LIN-UART
20.3 Pins of LIN-UART
MB90340E Series
■ Block Diagram of LIN-UART Pins
Figure 20.3-1 Block Diagram of LIN-UART Pins
Peripheral input
Port data register (PDR)
Peripheral output
Peripheral output enable
Internal data bus
PDR read
Output write
P-ch
PDR read
Pin
Port direction register (DDR)
N-ch
Direction latch
General-purpose I/O pin/SIN
General-purpose I/O pin/SCK
General-purpose I/O pin/SOT
DDR write
Standby control (SPL = 1)
DDR read
Standby control: Stop mode (SPL =1), watch mode (SPL =1), time-base timer mode (SPL =1)
Note: A peripheral I/O signal is input and output using a pin with a peripheral function.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
453
CHAPTER 20 LIN-UART
20.4 Registers of LIN-UART
20.4
MB90340E Series
Registers of LIN-UART
This section lists the registers of LIN-UART.
■ List of LIN-UART Registers
Figure 20.4-1 List of LIN-UART Registers
• LIN-UART0
Address:
bit15
bit8
bit7
bit0
000021H,
000020H
SCR0 (Serial control register)
SMR0 (Serial mode register)
000023H,
000022H
SSR0 (Serial status register)
RDR0/TDR0 (Reception data register / Transmit data register)
000025H,
000024H
ESCR0 (Extended status control register)
ECCR0 (Extended communication control register)
000027H,
000026H
BGR01 (Baud rate generator register)
BGR00 (Baud rate generator register)
• LIN-UART1
Address:
bit15
bit8
bit7
bit0
000029H,
000028H
SCR1 (Serial control register)
SMR1 (Serial mode register)
00002BH,
00002AH
SSR1 (Serial status register)
RDR1/TDR1 (Reception data register / Transmit data register)
00002DH,
00002CH
ESCR1 (Extended status control register)
ECCR1 (Extended communication control register)
00002FH,
00002EH
BGR11 (Baud rate generator register)
BGR10 (Baud rate generator register)
• LIN-UART2
Address:
bit15
bit8
bit7
bit0
0000D9H,
0000D8H
SCR2 (Serial control register)
SMR2 (Serial mode register)
0000DBH,
0000DAH
SSR2 (Serial status register)
RDR2/TDR2 (Reception data register / Transmit data register)
0000DDH,
0000DCH
ESCR2 (Extended status control register)
ECCR2 (Extended communication control register)
0000DFH,
0000DEH
BGR21 (Baud rate generator register)
BGR20 (Baud rate generator register)
• LIN-UART3
Address:
bit15
bit8
bit7
bit0
007951H,
007950H
SCR3 (Serial control register)
SMR3 (Serial mode register)
007953H,
007952H
SSR3 (Serial status register)
RDR3/TDR3 (Reception data register / Transmit data register)
007955H,
007954H
ESCR3 (Extended status control register)
ECCR3 (Extended communication control register)
007957H,
007956H
BGR31 (Baud rate generator register)
BGR30 (Baud rate generator register)
• LIN-UART4
Address:
bit15
bit8
bit7
bit0
007959H,
007958H
SCR4(Serial control register)
SMR4 (Serial mode register)
00795BH,
00795AH
SSR4 (Serial status register)
RDR4/TDR4 (Reception data register / Transmit data register)
00795DH,
00795CH
ESCR4 (Extended status control register)
ECCR4 (Extended communication control register)
00795FH,
00795EH
BGR41 (Baud rate generator register)
BGR40 (Baud rate generator register)
454
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 20 LIN-UART
20.4 Registers of LIN-UART
MB90340E Series
20.4.1
Serial Control Register (SCR)
The serial control register (SCR) is used to set parity, select the stop bit length and data
length, select the frame data format in mode 1, clear the reception error flag, and
enable/disable transmission/reception.
■ Serial Control Register (SCR)
Figure 20.4-2 Serial Control Register (SCR)
Address
bit15 bit14 bit13 bit12 bit11 bit10 bit9 bit8 bit7
SCR0 : 000021H PEN
P SBL CL
SCR1 : 000029H
R/W
R/W
R/W R/W
SCR2 : 0000D9H
SCR3 : 007951H
SCR4 : 007959H
Initial value
bit0
A/D CRE RXE TXE
R/W
W
00000000B
R/W R/W
bit8
TXE
Transmit enable bit
0
Disables transmission
1
Enables transmission
bit9
RXE
Reception enable bit
0
Disables reception
1
Enables reception
bit10
Reception error flag clear bit
CRE
Write
Read
0
No effect
1
Clears reception error flag
(PE, FRE, ORE)
"0" is always read
bit11
AD
Address/data format selection bit
0
Data frame
1
Address frame
bit12
CL
Data length selection bit
0
7-bit
1
8-bit
bit13
SBL
Stop bit length selection bit
0
1-bit
1
2-bit
bit14
P
Even parity
1
Odd parity
R/W
: Readable/Writable
bit15
W
: Write only
PEN
: Initial value
CM44-10143-5E
Parity selection bit
0
Parity enable bit
0
No parity
1
With parity
FUJITSU SEMICONDUCTOR LIMITED
455
CHAPTER 20 LIN-UART
20.4 Registers of LIN-UART
MB90340E Series
Table 20.4-1 Functions of Each Bit in Serial Control Register (SCR)
Bit name
Function
bit15
PEN:
Parity enable bit
Specifies whether or not to add (at transmission) and detect (at reception) a parity bit.
Note:
The parity bit is added only in operating mode 0, or in operating mode 2 with the
settings that start/stop is set (ECCR:SSM = 1).
This bit is fixed to "0" in operation mode 1 and operation mode 3 (LIN).
bit14
P:
Parity selection bit
Sets either odd parity (1) or even parity (0) if the parity bit has been selected
(SCR:PEN = 1).
bit13
SBL:
Stop bit length selection
bit
Sets the bit length of the stop bit (frame end mark in transmit data) in operating mode
0, 1 (asynchronous) or in operating mode 2 (synchronous) with the settings that start/
stop bit is set (ECCR:SSM = 1).
This bit is fixed to "0" in mode 3.
Note:
At reception, only the first bit of the stop bit is always detected.
bit12
CL:
Data length selection bit
Specifies the data length to be transmitted and received. This bit is fixed to "1" in
mode 2 and mode 3.
AD:
Address/data format
selection bit
Specifies the data format for the frame to be transmitted and received in
multiprocessor mode (mode 1). Write to this bit in master mode; read this bit in
slave.
• When set to "0": Set to data frame.
• When set to "1": Set to address data frame.
The value of last received data format is read.
Note:
See Section "20.8 Notes on Using LIN-UART" for using this bit.
CRE:
Reception error flag
clear bit
This bit clears the FRE, ORE, and PE flags in the serial status register (SSR).
• Writing "1": Clears the error flag.
• Writing "0": No effect.
Reading this bit always returns "0".
Note:
Clear the reception error flag after disabling reception (RXE=0). When the
reception error flag is cleared without disabling the reception, the reception is
interrupted once at that timing and than it restarts. Therefore, when the reception
is restarted, Incorrect data might be received.
bit11
bit10
bit9
RXE:
Reception enable bit
Enables or disables the reception of LIN-UART.
• Setting to "0": Disables reception.
• Setting to "1": Enables reception.
The LIN Synch break detection in mode 3 is not affected.
Notes:
•
•
456
When the reception is disabled (RXE = 0) during reception, the reception halts
immediately. In that case, the data is not guaranteed.
When the transmission is disabled (TXE = 0) during reception while ECCR:MS=0 in
operation mode 2, the reception (RXE=0) must also be disabled.
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 20 LIN-UART
20.4 Registers of LIN-UART
MB90340E Series
Table 20.4-1 Functions of Each Bit in Serial Control Register (SCR)
Bit name
bit8
TXE:
Transmit enable bit
Function
Enables or disables the transmission of LIN-UART.
• Setting to "0": Disables transmission.
• Setting to "1": Enables transmission.
Note:
•
•
CM44-10143-5E
When the transmission is disabled (TXE = 0) during transmission, the transmission
halts immediately. In that case, the data is not guaranteed.
Prior to enabling the transmission (TXE=1) while ECCR:MS=1 in operation mode 2,
serial clock must first be set to the mark level.
FUJITSU SEMICONDUCTOR LIMITED
457
CHAPTER 20 LIN-UART
20.4 Registers of LIN-UART
20.4.2
MB90340E Series
LIN-UART Serial Mode Register (SMR)
The LIN-UART serial mode register (SMR) is used to select the operating mode, specify
the baud rate clock, and enable/disable output to the serial data and clock pins.
■ LIN-UART Serial Mode Register (SMR)
Figure 20.4-3 Serial Mode Register (SMR)
Address
SMR0:000020H
SMR1:000028H
SMR2:0000D8H
SMR3:007950H
SMR4:007958H
bit15
bit8 bit7
bit6 bit5
bit4
bit2
bit3
bit1
bit0 Initial value
MD1 MD0 OTO EXT REST UPCL SCKE SOE 00000000B
R/W R/W R/W R/W W
W
R/W R/W
bit0
SOE
LIN-UART serial data output enable bit
0
General-purpose I/O port
1
LIN-UART serial data output pin
bit1
SCKE
LIN-UART serial clock output enable bit
0
General-purpose I/O port or LIN-UART clock input pin
1
LIN-UART serial clock output pin
bit2
LIN-UART programmable clear bit
UPCL
Write
0
No effect
1
LIN-UART reset
Read
"0" is always read
bit3
Reload counter restart bit
REST
Write
0
No effect
1
Restarts the reload counter
Read
"0" is always read
bit4
EXT
External serial clock source selection bit
0
Uses the baud rate generator (reload counter)
1
Uses the external serial clock source
bit5
OTO
R/W
: Readable/Writable
W
: Write only
1-to-1 external clock input enable bit
0
Uses the baud rate generator (reload counter)
1
Uses the external clock directly
bit7
bit6
MD1
MD0
0
0
Operating mode setting bit
Mode 0: Asynchronous normal
0
1
Mode 1: Asynchronous multiprocessor
1
0
Mode 2: Synchronous
1
1
Mode 3: Asynchronous LIN
: Initial value
458
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 20 LIN-UART
20.4 Registers of LIN-UART
MB90340E Series
Table 20.4-2 Functions of Each Bit in Serial Mode Register (SMR)
Bit name
Function
bit7,
bit6
MD1, MD0:
Operating mode
selection bits
These bits set the operating mode.
Note:
The operating mode must be set while LIN-UART is not in operation. Data
transmitted/received while setting the operating mode cannot be guaranteed of its
integrity.
If changing mode setting configuration after writing to the transmission data
register (TDR), TDR becomes write-disabled, and the transmission data empty
flag (SSR:TDRE) is set.
bit5
OTO:
1-to-1 external clock
enable bit
Writing "1" enables the external clock to be used directly as the LIN-UART serial
clock.
It is used for slave operation (ECCR:MS = 1) in operating mode 2.
When EXT = 0, the OTO bit is fixed to "0".
bit4
EXT:
External serial clock
selection bit
Selects a clock input.
Setting to "0" selects the clock of the internal baud rate generator (reload counter),
while setting to "1" selects the external serial clock source.
bit3
REST:
Reload counter restart bit
Writing "1" restarts the reload counter.
Writing "0" has no effect.
"0" is always read.
UPCL:
LIN-UART
programmable clear bit
(LIN-UART software
reset)
Writing "1" resets the LIN-UART immediately (LIN-UART software reset). Note
however that the register settings are maintained. At that time, transmission and
reception are suspended.
All of the transmit/reception interrupt sources (TDRE, RDRF, LBD, PE, ORE, FRE)
are reset. Reset the LIN-UART after the interrupt and transmission are disabled.
Also, the reception data register is cleared (RDR = 00H), and the reload counter is
restarted.
Writing "0" to this bit has no effect.
Reading this bit always returns "0".
Note:
Execute LIN-UART software reset (UPCL=1) when the TXE bit of the serial
control register (SCR) is "0".
SCKE:
LIN-UART serial clock
output enable bit
Controls the serial clock I/O port.
When "0" is written, the SCKn pin works as a general-purpose I/O port or a serial
clock input pin. When "1" is written, this pin serves as the serial clock output pin and
outputs the clock in operating mode 2.
When ECCR:MS=1, the SCKE bit is fixed to "0".
Note:
When the SCKn pin is used as a serial clock input (SCKE = 0), set the
corresponding DDR bits in the general-purpose I/O port as an input port. Also,
select the external clock (EXT = 1) by using the clock selection bit.
Reference:
When the SCKn pin is set as a serial clock output (SCKE = 1), this pin works as a
serial clock output pin regardless of the state of the general-purpose I/O port.
SOE:
LIN-UART serial data
output enable bit
Enables or disables output of serial data.
When "0" is set, the SOTn pin serves as a general-purpose I/O port. When "1" is set,
it works as a serial data output pin (SOTn).
Reference:
When set as a serial data output (SOE = 1), the SOTn pin works as a SOTn pin
regardless of the state of a general-purpose I/O port.
bit2
bit1
bit0
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
459
CHAPTER 20 LIN-UART
20.4 Registers of LIN-UART
20.4.3
MB90340E Series
Serial Status Register (SSR)
The serial status register (SSR) is used to check the status of transmission/ reception
or error, and to enable/disable interrupts.
■ Serial Status Register (SSR)
Figure 20.4-4 Serial Status Register (SSR)
Address
SSR0:000023H
SSR1:00002BH
SSR2:0000DBH
SSR3:007953H
SSR4:00795BH
bit15 bit14 bit13 bit12
bit0 Initial value
bit11 bit10 bit9 bit8 bit7
PE ORE FRE RDRF TDRE BDS RIE TIE
R
R
R
R
R
00001000B
R/W R/W R/W
bit8
TIE
Transmit interrupt enable bit
0
Disables transmit interrupts.
1
Enables transmit interrupts.
bit9
RIE
Reception interrupt enable bit
0
Disables reception interrupts.
1
Enables reception interrupts.
bit10
BDS
Transfer direction selection bit
0
LSB first (transfer from the least significant bit)
1
MSB first (transfer from the most significant bit)
bit11
TDRE
Transmit data empty flag bit
0
Transmit data register (TDR) contains data.
1
Transmit data register (TDR) is empty.
bit12
RDRF
Reception data full flag bit
0
Reception data register (RDR) is empty.
1
Reception data register (RDR) contains data.
bit13
FRE
Framing error flag bit
0
No framing error
1
Framing error exists.
bit14
ORE
Overrun error flag bit
0
No overrun error
1
Overrun error exists.
bit15
PE
R/W
: Readable/Writable
R
: Read only
Parity error flag bit
0
No parity error
1
Parity error exists.
: Initial value
460
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 20 LIN-UART
20.4 Registers of LIN-UART
MB90340E Series
Table 20.4-3 Functions of Each Bit in Serial Status Register (SSR) (1 / 2)
Bit name
Function
bit15
PE:
Parity error flag bit
• This bit is set to "1" when a parity error occurs during reception with PE = 1, and
cleared by writing "1" to the CRE bit in the LIN-UART serial control register
(SCR).
• Outputs a reception interrupt request when both PE bit and RIE bit are "1".
• When this flag is set, the data in the reception data register (RDR) is invalid.
bit14
ORE:
Overrun error flag bit
• This bit is set to "1" when an overrun occurs during reception, and cleared by
writing "1" to the CRE bit in the LIN-UART serial control register (SCR).
• Outputs a reception interrupt request when both ORE bit and RIE bit are "1".
• When this flag is set, the data in the reception data register (RDR) is invalid.
bit13
FRE:
Framing error flag bit
• This bit is set to "1" when a framing error occurs during reception, and cleared by
writing "1" to the CRE bit in the LIN-UART serial control register (SCR).
• Outputs a reception interrupt request when both FRE bit and RIE bit are "1".
• When this flag is set, the data in the reception data register (RDR) is invalid.
Note:
When SCR:SBL is 1, and a framing error is detected at the first or second bit
(stop bit), this bit is set to "1" regardless of which stop bit. Therefore, it is
necessary to determine whether the reception data is valid or invalid at the second
stop bit.
bit12
RDRF:
Reception data full flag
bit
• This flag shows the status of the reception data register (RDR).
• This bit is set to "1" when received data is loaded into RDR, and cleared to "0" by
reading the reception data register (RDR).
• Outputs a reception interrupt request when both RDRF bit and RIE bit are "1".
TDRE:
Transmit data empty flag
bit
• This flag shows the status of the transmit data register (TDR).
• This bit is set to "0" by writing the transmit data to TDR, and indicates that the
TDR has valid data. This bit is set to "1" when data is loaded into the transmit
shift register and the transmission starts, and indicates that the TDR does not have
valid data.
• Outputs a transmit interrupt request when both TDRE bit and TIE bit are "1".
• When the TDRE bit is "1", setting the LBR bit in the extended communication
control register (ECCR) to "1" changes the TDRE bit to "0". Then, the TDRE bit
goes back to "1" after LIN Synch break is generated.
Notes:
• The initial state is TDRE = 1.
• If operating mode (SMR.MD [1:0]) is set after TDRE=0 is initiated by writing
to the transmission data register (TDR), transmitted data becomes null, and
TDRE is set to "1".
BDS:
Transfer direction
selection bit
• Specifies whether the transfer serial data is transferred from the least significant
bit (LSB first, BDS = 0) or from the most significant bit (MSB first, BDS = 1).
It is fixed to "0" in mode 3.
Note:
Data values are exchanged between the upper and lower when reception data is
written to the reception data register (RDR). Consequently, if the BDS bit is
rewritten after reception data is written to RDR, the RDR data will be invalid.
bit11
bit10
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
461
CHAPTER 20 LIN-UART
20.4 Registers of LIN-UART
MB90340E Series
Table 20.4-3 Functions of Each Bit in Serial Status Register (SSR) (2 / 2)
Bit name
Function
bit9
RIE:
Reception interrupt
request enable bit
• Enables or disables the output of a reception interrupt request to the CPU.
• Outputs a reception interrupt request when both the RIE bit and the reception data
flag bit (RDRF) are "1", or when one or more error flag bits (PE, ORE, FRE) is
"1".
bit8
TIE:
Transmit interrupt
request enable bit
• Enables or disables the output of a transmit interrupt request to the CPU.
• Outputs a transmit interrupt request when both TIE bit and TDRE bit are "1".
462
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 20 LIN-UART
20.4 Registers of LIN-UART
MB90340E Series
20.4.4
Reception Data Register / Transmit Data Register
(RDR/TDR)
The reception and transmit data registers are located at the same address. If read, they
work as the reception data register; if written, they work as the transmit data register.
■ Bit Configuration of Reception Data Register / Transmit Data Register (RDR/TDR)
Figure 20.4-5 shows the bit configuration of the reception register.
Figure 20.4-5 Reception Data Register / Transmit Data Register (RDR/TDR)
Address
RDR0/TDR0: 000022H
RDR1/TDR1: 00002AH
RDR2/TDR2: 0000DAH
RDR3/TDR3: 007952H
RDR4/TDR4: 00795AH
bit
7
6
5
4
3
2
1
0
Initial value
00000000B [RDR]
11111111B [TDR]
R/W R/W R/W R/W R/W R/W R/W R/W
bit7 to bit0
R/W: Readable/Writable
R/W
Data register
Read
Reads from the reception data register
Write
Writes to the transmit data register
■ Reception Data Register (RDR)
The reception data register (RDR) is the data buffer register for the serial data reception.
The serial data signal sent to the serial input pin (SINn pin) is converted via a shift register and stored in the
reception data register (RDR).
If the data length is 7 bits, the upper 1 bit (RDR:D7) is "0".
The reception data full flag bit (SSR:RDRF) is set to "1" when received data is stored into the reception
data register (RDR). If the reception interrupt is enabled (SSR:RIE = 1), a reception interrupt request is
generated.
Read the reception data register (RDR) when the reception data full flag bit (SSR:RDRF) is "1". The
reception data full flag bit (SSR:RDRF) is automatically cleared to "0" by reading the reception data
register (RDR).
Also, the reception interrupt is cleared when the reception interrupt is enabled and no error occurs.
When the reception error occurs (any of SSR:PE, ORE, or FRE is "1"), the data in the reception data
register (RDR) is invalid.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
463
CHAPTER 20 LIN-UART
20.4 Registers of LIN-UART
MB90340E Series
■ Transmit Data Register (TDR)
The transmit data register (TDR) is the data buffer register for the serial data transmission.
If the data to be transmitted is written to the transmit data register (TDR) when transmission is enabled
(SCR:TXE = 1), the transmit data is transferred to the transmit shift register, converted to serial data, and
output from the serial data output pin (SOTn pin).
If the data length is 7 bits, the data in the upper 1 bit (TDR:D7) is invalid.
The transmit data empty flag (SSR:TDRE) is cleared to "0" when transmit data is written to the transmit
data register (TDR).
The transmit data empty flag (SSR:TDRE) is set to "1" after the data is transferred to the transmit shift
register and the transmission starts.
If the transmit data empty flag (SSR:TDRE) is "1", the next transmit data can be written. If the transmit
interrupt is enabled, a transmit interrupt is generated. Write the next transmit data by generating the
transmit interrupt, or when the transmit data empty flag (SSR:TDRE) is "1".
Note:
The transmit data register is a write-only register; the reception data register is a read-only register.
Since both registers are located at the same address, the write value and read value are different.
Thus, read-modify-write (RMW) instructions such as the INC/DEC instruction cannot be used.
464
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 20 LIN-UART
20.4 Registers of LIN-UART
MB90340E Series
20.4.5
Extended Status Control Register (ESCR)
The extended status control register (ESCR) has the settings for enabling/ disabling LIN
Synch break interrupt, LIN Synch break length selection, LIN Synch break detection,
direct access to the SINn and SOTn pins, continuous clock output in LIN-UART
synchronous clock mode and sampling clock edge.
■ Bit Configuration of Extended Status Control Register (ESCR)
Figure 20.4-6 shows the bit configuration of the extended status control register (ESCR). Table 20.4-4
shows the function of each bit.
Figure 20.4-6 Bit Configuration of Extended Status Control Register (ESCR)
Address
bit15 bit14 bit13 bit12 bit11 bit10 bit9 bit8 bit7
ESCR0 : 000025H
LBIE LBD LBL1 LBL0 SOPE SIOP CCO SCES
ESCR1 : 00002DH
ESCR2 : 0000DDH R/W R/W R/W R/W R/W R/W R/W R/W
ESCR3 : 007955H
ESCR4 : 00795DH
Initial
bit0 value
00000X00B
bit8
SCES
0
1
Sampling clock edge selection bit (mode 2)
Sampling at the rising edge of the clock (normal)
Sampling at the falling edge of the clock (inverted clock)
bit9
CCO
0
1
Continuous clock output enable bit (mode 2)
Disables continuous clock output
Enables continuous clock output
bit10
SIOP
0
1
Serial I/O pin access setting bit
Write (SOPE = 1)
Read
Fixes SOTn pin to "0"
Read the value of SINn pin
Fixes SOTn pin to "1"
bit11
SOPE
0
1
Serial output pin direct access enable bit
Disables serial output pin direct access
Enables serial output pin direct access
bit12
LBL0
0
1
0
1
bit13
LBL1
0
0
1
1
LIN Synch break length selection bits
13 bits
14 bits
15 bits
16 bits
bit14
LBD
0
1
R/W
X
: Readable/Writable
: Undefined
bit15
LBIE
0
1
LIN Synch break detection flag bit
Write
Read
Clears LIN Synch break
No LIN Synch break
detection flag
detection
With LIN Synch break
No effect
detection
LIN Synch break detection interrupt enable bit
Disables LIN Synch break detection interrupt
Enables LIN Synch break detection interrupt
: Initial value
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
465
CHAPTER 20 LIN-UART
20.4 Registers of LIN-UART
MB90340E Series
Table 20.4-4 Functions of Each Bit in Extended Status Control Register (ESCR)
Bit name
Function
LBIE:
LIN Synch break
detection interrupt
enable bit
This bit enables or disables LIN Synch break detection interrupts.
An interrupt is generated when the LIN Synch break detection flag (LBD) is "1" and
the interrupt is enabled (LBIE = 1).
This bit is fixed to "0" in mode 1 and mode 2.
bit14
LBD:
LIN Synch break
detection flag bit
This bit is set to "1" when the LIN Synch break is detected in operating mode 3 (the
serial input is "0" when bit width is 11 bits or more). Also, writing "0" clears the
LBD bit and the interrupt. Although the bit is always read as "1" when the RMW
instruction is executed, this does not indicate that a LIN Synch break has been
detected.
Note:
To detect a LIN Synch break, enable the LIN Synch break detection interrupt
(LBIE = 1), and then disable the reception (SCR:RXE = 0).
bit13,
bit12
LBL1/0:
LIN Synch break length
selection bits
These bits specify the bit length for the LIN Synch break generation time.
The LIN Synch break length for reception is always 11 bits.
bit11
SOPE:
Serial output pin direct
access enable bit*
Setting this bit to "1" when serial data output is enabled (SMR:SOE = 1) enables
direct writing to the SOTn pin.*
SIOP:
Serial I/O pin direct
access bit*
Normal read instruction always returns the value of the SINn pin.
When direct access to the serial output pin is enabled (SOPE = 1), the SOTn pin
reflects the value written to this bit.
Note:
The bit operation instruction returns the bit value of the SOTn pin in the read
cycle.*
CCO:
Continuous clock output
enable bit
If the SCKn pin is set to output clock when operating mode 2 and master setting are
selected, this will enable the continuous serial clock output from the SCKn pin.
Note:
When the CCO bit is "1", the SSM bit in the ECCR should be set to "1".
Set up the SCK pin to output clock (SMR:SCKE=1). If the CCO bit is set to "1",
add the start/stop bit (ECCR:SSM=1).
• This bit should be set to "0" while in operation mode 0, 1, 3, as well as under
slave setting in operation mode 2.
• While serial clock output is enabled (SMR:SCKE="1"), and the CCO and
SCES bits are set under the following circumstances, specified clock width
may not be output to serial clock output pin (SCK pin) immediately after
switching of serial clock output. Afterward, normal output is expected.
• The SCES bit is changed while the CCO bit is set to "1"
• The CCO bit and SCES bit are modified simultaneously
• The CCO bit is changed from "1" to "0"
SCES:
Sampling clock edge
selection bit
When SCES is set to "1" in operating mode 2 with the slave setting, the sampling
edge switches from the rising edge to the falling edge.
When the SCKn pin is set to output clock in operating mode 2 with the master setting
(ECCR:MS=0), the internal serial clock and the output clock signal are inverted.
This bit should be fixed to "0" in operating modes 0, 1, and 3.
Note:
When SCES bit is "1", it is prohibited to occur software reset. And
change this bit only when sending and receiving is disabled.
bit15
bit10
bit9
bit8
* : See Table 20.4-5.
466
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 20 LIN-UART
20.4 Registers of LIN-UART
MB90340E Series
Table 20.4-5 Interaction between SOPE and SIOP
SOPE
SIOP
0
R/W
No effect (but the write value is retained)
Return the SINn value
1
R/W
Write "0" or "1" to SOTn
Return the SINn value
0
RMW
No effect (but the write value is retained)
Return the SOTn value
1
RMW
Write "0" or "1" to SOTn
Return the SOTn value
CM44-10143-5E
Write to SIOP
FUJITSU SEMICONDUCTOR LIMITED
Read from SIOP
467
CHAPTER 20 LIN-UART
20.4 Registers of LIN-UART
20.4.6
MB90340E Series
Extended Communication Control Register (ECCR)
The extended communication control register (ECCR) is used for the bus idle detection,
the synchronous clock setting, and the LIN Synch break generation.
■ Bit Configuration of Extended Communication Control Register (ECCR)
Figure 20.4-7 shows the bit configuration of the extended communication control register (ECCR). Table
20.4-6 shows the function of each bit.
Figure 20.4-7 Bit Configuration of Extended Communication Control Register (ECCR)
Address
bit15
ECCR0:000024H
ECCR1:00002CH
ECCR2:0000DCH
ECCR3:007954H
ECCR4:00795CH
bit8 bit7
bit6
bit5
LBR
W
bit4
bit3
bit2
bit1
bit0
MS SCDE SSM
RBI
TBI
R/W R/W R/W
R
R
Initial value
X0000XXXB
bit0
TBI*
0
1
Transmit bus idle detection flag bit
In transmission
No transmission
bit1
RBI*
0
1
Reception bus idle detection flag bit
In reception
No reception
bit2
Undefined
The read value is "0".
Always write "0".
bit3
SSM
0
1
bit4
SCDE
0
1
bit5
MS
0
1
Start/stop enable bit (mode 2)
No start/stop bit
With start/stop bit
Serial clock delay enable bit (mode 2)
Disables clock delay
Enables clock delay
Master/slave function selection bit (mode 2)
Master mode (serial clock generation)
Slave mode (external serial clock reception)
bit6
LBR
0
R/W
R
W
X
: Readable/Writable
: Read only
: Write only
: Undefined
: Initial value
1
LIN Synch break generation bit
Write
Read
No effect
LIN Synch break
generation
"0" always read
bit7
Undefined
The read value is "0". Always write "0".
*: Not used when SSM is "0" in operating mode 2
468
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 20 LIN-UART
20.4 Registers of LIN-UART
MB90340E Series
Table 20.4-6 Functions of Each Bit in Extended Communication Control Register (ECCR)
Bit name
Function
bit7
Undefined
This bit is unused. The read value is undefined. Always write "0".
bit6
LBR:
Lin Synch break
generation bit
Setting this bit to "1" in mode 3 generates a LIN Synch break which has the length
specified by LBL0/LBL1 in the ESCR. Set the bit to "0" in mode 0.
MS:
Master/slave mode
selection bit
In mode 2, the master or slave can be selected.
When MS is set to "0" (master mode selected), a synchronous clock is generated.
When MS is set to "1" (slave mode selected), the external serial clock is received. In
modes 0, 1 and 3, it is fixed to "0".
Modify this bit only when the SCR:TXE bit is "0".
Note:
When slave mode is selected, set the clock source to the external clock to enable
the input of the external clock.
(SMR:SCKE=0, EXT=1, OTO=1)
SCDE:
Serial clock delay enable
bit
Setting the SCDE bit to "1" in the master mode operation during mode 2 outputs a
delayed serial clock as shown in Figure 20.7-5. This bit is effective in SPI.
In modes 0, 1 and 3, it is fixed to "0".
Note:
Use "0" under slave mode (MS=1) in operation mode 2. Setting this bit to "1" is
disabled while ESCR:CCO="1", and serial clock will not be delayed.
bit3
SSM:
Start/stop bit mode
enable bit
This bit adds the start/stop bit to the synchronous data format when set to "1" in
mode 2.
• When "0" is set: start/stop bit is not added.
• When "1" is set: upon transmitting, start/stop bit is added. Upon receiving, start
bit is detected, and receiving initiated. Stop bit is used to detect framing errors.
In modes 0, 1 and 3, it is fixed to "0".
bit2
Undefined
This bit is unused.
The read value is undefined.
Always write "0".
bit1
RBI:
Reception bus idle
detection flag bit
This bit is set to "1" when the SIN pin is set to "H" level and reception is not
performed. Do not use this bit in operating mode 2.
bit0
TBI:
Transmit bus idle
detection flag bit
This bit is set to "1" when there is no transmission at the SOTn pin. Use this bit under
master mode (MS=0) in operation mode 2.
bit5
bit4
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
469
CHAPTER 20 LIN-UART
20.4 Registers of LIN-UART
MB90340E Series
Baud Rate Generator Register 0, 1 (BGRn0/BGRn1)
20.4.7
The baud rate generator register 0, 1 (BGRn0/BGRn1) sets the division ratio of the serial
clock. Moreover, the count value in the transmit reload counter is read from this
generator.
■ Bit Configuration of Baud Rate Generator Register (BGRn0/BGRn1)
Figure 20.4-8 shows the bit configuration of the baud rate generator register (BGRn0/BGRn1).
Figure 20.4-8 Bit Configuration of Baud Rate Generator Register (BGRn0/BGRn1)
Address
bit15 bit14 bit13 bit12 bit11 bit10 bit9 bit8
BGR00: 000026H
BGR01: 000027H
BGR10: 00002EH
BGR11: 00002FH
BGR20: 0000DEH
BGR21: 0000DFH
BGR30: 007956H
BGR31: 007957H
BGR40: 00795EH
BGR41: 00795FH
bit7 bit6 bit5 bit4 bit3 bit2
bit1 bit0
Initial value
00000000B
00000000B
R 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
bit7 to bit0
Write
Read
Baud rate generator register n0
Write to reload counter bits 0 to 7.
Read transmit reload counter bits 0 to 7.
bit14 to bit8
Write
Read
Baud rate generator register n1
Write to reload counter bits 8 to 14.
Read transmit reload counter bits 8 to 14.
bit15
R/W : Readable/Writable
R
: Read only
n = 0, 1, 2, 3, 4
Undefined
The read value is "0". Writing has no effect on operation.
The baud rate generator register sets the division ratio of the serial clock.
BGRn1 is associated with the upper bits; BGRn0 is associated with the lower bits. The reload value of the
counter can be written and the transmit reload counter value can be read from them. Byte/word access is
also possible.
Writing a reload value other than "0" to the baud rate generator registers causes the reload counter to start
counting.
470
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 20 LIN-UART
20.5 Interrupts of LIN-UART
MB90340E Series
20.5
Interrupts of LIN-UART
The LIN-UART has reception interrupts and transmit interrupts, which are generated by
following interrupt sources.
• When received data is set in the reception data register (RDR), or when a reception
error occurs
• When transmit data is transferred from the transmit data register (TDR) to the
transmit shift register and the transmission starts
• When a LIN Synch break is detected
Each interrupt supports the extended intelligent I/O service (EI2OS) and DMA.
■ Interrupts of LIN-UART
Table 20.5-1 shows the interrupt control bits and interrupt sources of the LIN-UART.
Table 20.5-1 Interrupt Control Bits and Interrupt Sources of LIN-UART
TX/RX/
Capture
Interrupt
request
flag bit
Flag
register
Operating mode
Interrupt source
0
1
2
3
Interrupt
source
Enable bit
Reading reception data,
Writing "1" to
programmable reset bit
(SMR:UPCL)
RDRF
SSR
❍
❍
❍
❍
Writing reception data
to RDR
ORE
SSR
❍
❍
❍
❍
Overrun error
FRE
SSR
❍
❍
❍
Framing error
PE
SSR
❍
×
×
Parity error
❍
Detecting LIN Synch
ESCR:LBIE
break
Writing "0" to ESCR:LBD,
Writing "1" to
programmable reset bit
(SMR:UPCL)
Writing SSR:TIE transmit
data; writing "1" to LIN
Synch bread generation bit
(ECCR:LBR)
Disabling ICP0/ICP1/ICP6/
ICP7
SSR:RIE
RX
LBD
Input
capture
❍
ESCR
×
×
×
TDRE
SSR
❍
❍
❍
❍
Transmit register being
SSR:TIE
empty
ICP0/ICP1/
ICP6/ICP7
ICS01/
ICS67
×
×
×
❍
ICP0/ICP1/
ICP6/ICP7
ICS01/
ICS67
×
×
×
❍
1st falling edge in LIN ICS01:
Synch field
ICE0/ICE1
5th falling edge in LIN ICS67:
ICE6/ICE7
Synch field
TX
Clearing interrupt
request flag
Writing "1" to reception
error flag clear bit
(SCR:CRE),
Writing "1" to
programmable reset bit
(SMR:UPCL)
: Used bit
× : Unused bit
: Available only when ECCR:SSM=1
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
471
CHAPTER 20 LIN-UART
20.5 Interrupts of LIN-UART
MB90340E Series
● Reception interrupts
Each flag bit in the serial status register (SSR) is set to "1" when any of the following operation occurs in
reception mode:
Data reception completed
When the reception data is transferred from the reception shift register to the reception data
register (RDR) (RDRF = 1)
Overrun error
When RDRF is 1, and the next reception data is transferred from the reception shift register to
the reception data register (RDR) (ORE=1) without RDR being read by the CPU
Framing error
Stop bit reception error (FRE=1)
Parity error
Parity detection error (PE=1)
A reception interrupt request is generated if the reception interrupt is enabled (SSR:RIE=1) when any of the
above flag bits is "1".
The RDRF flag is automatically cleared to "0" by reading the reception data register (RDR). All of error
flags are cleared to "0" by writing "1" to the reception error flag clear bit (CRE) in the serial control register
(SCR).
Note:
By using CRE bit, clear the reception error flag after disabling reception (RXE=0). If the reception
error flag is cleared without disabling reception, the reception is interrupted once and then the
reception is resumed. By this operation, some data may not be received normally at the resume.
(This note is the same as the note for bit10 in Table19.4-1.)
● Transmit Interrupts
The transmit data register empty flag bit (TDRE) in the serial status register (SSR) is set to "1" when the
transmit data is transferred from the transmit data register (TDR) to the transmit shift register, and the
transmission starts. If the transmit interrupt is enabled (SSR:TIE=1) in this case, a transmit interrupt request
is generated.
Note:
Since the initial value of TDRE is "1" after hardware/software reset, an interrupt is generated
immediately after the TIE bit is set to "1". Moreover, the TDRE is cleared by writing data to the
transmit data register (TDR), or by writing "1" to the LIN Synch break generation bit (ECCR:LBR).
● LIN Synch break interrupts
This works for LIN slave operation in operation mode 3.
The LIN Synch break detection flag bit (LBD) in the extended status control register (ESCR) is set to "1"
when the bus (serial input) is "0" for 11 bits or longer. The LIN Synch break interrupt and the LBD flag are
cleared by writing "0" to the LBD flag. The LBD flag must be cleared before the capture interrupt is
472
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 20 LIN-UART
20.5 Interrupts of LIN-UART
MB90340E Series
generated in the LIN Synch field.
To detect a LIN Synch break, the reception must be disabled (SCR:RXE=0).
● LIN Synch field edge detection interrupt
This works for LIN slave operation in operation mode 3.
After a LIN Synch break is detected, the internal signal is set to "1" at the first falling edge of the LIN
Synch field, and set to "0" after the fifth falling edge. When the capture side is configured to input the
internal signal (ICU0/ICU1/ICU6/ICU7) and to detect both edges, an input capture interrupt is generated if
enabled.
The difference in the count values detected by the capture function corresponds to the 8 bits in the master
serial clock. The new baud rate can be calculated from this value.
When a falling edge of the start bit is detected, the reload counter restarts automatically.
■ LIN-UART Interrupts and EI2OS
Table 20.5-2 LIN-UART Interrupts and EI2OS
Interrupt control register
Channel
Vector table address
EI2OS
Interrupt No.
Register name
Address
Lower
Upper
Bank
DMA channel
LIN-UART0 reception
#35(23H)
ICR12
0000BCH
FFFF70H
FFFF71H
FFFF72H
*1
DRQ10*3
LIN-UART0 transmission
#36(24H)
ICR12
0000BCH
FFFF6CH
FFFF6DH
FFFF6EH
*2
DRQ11
LIN-UART1/3 reception
#37(25H)
ICR13
0000BDH
FFFF68H
FFFF69H
FFFF6AH
*1
DRQ12*3
LIN-UART1/3 transmission
#38(26H)
ICR13
0000BDH
FFFF64H
FFFF65H
FFFF66H
*2
DRQ13
LIN-UART2/4 reception
#39(27H)
ICR14
0000BEH
FFFF60H
FFFF61H
FFFF62H
*1
DRQ14*3
LIN-UART2/4 transmission
#40(28H)
ICR14
0000BEH
FFFF5CH
FFFF5DH
FFFF5EH
*2
DRQ15
*1: ICR12 to ICR14 are shared with multiple interrupt sources; therefore, they are only available when such sources are not used as
interrupts.
EI2OS stop function is available when a reception error is detected.
*2: ICR12 to ICR14 are shared with multiple interrupt sources; therefore, they are only available when such sources are not used as
interrupts.
*3: DMA stop function is available when a reception error is detected.
■ EI2OS Function of LIN-UART
LIN-UART has a circuit supporting the EI2OS. As a result, the EI2OS can be activated individually for
each reception/transmit interrupt.
● Reception
As the interrupt control register is also shared by transmit interrupts and other UART, the EI2OS is
available only when no other interrupts are enabled.
● Transmission
As the interrupt control register is also shared by reception interrupts and other UART, the EI2OS is
available only when no other interrupts are enabled.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
473
CHAPTER 20 LIN-UART
20.5 Interrupts of LIN-UART
20.5.1
MB90340E Series
Timing of Reception Interrupt Generation and Flag Set
Reception interrupts include a reception completion (SSR:RDRF) and an occurrence of
a reception error (SSR:PE, ORE, FRE).
■ Timing of Reception Interrupt Generation and Flag Set
Received data is stored in the reception data register (RDR) when the first stop bit is detected in mode 0, 1,
2 (SSM=1), 3, or when the last data bit is detected in mode 2 (SSM=0). Each error flag is set when a
reception is completed (SSR:RDRF=1), or when a reception error occurs (SSR:PE, ORE, FRE = 1). If the
reception interrupt is enabled (SSR:RIE=1) at this time, a reception interrupt is generated.
Note:
When a reception error occurs in each mode, the data in the reception data register (RDR) is invalid.
Figure 20.5-1 shows the timing of reception and flag set.
Figure 20.5-1 Timing of Reception and Flag Set
Reception data
(Mode 0/Mode 3)
ST
D0
D1
D2
…
D5
D6
D7/P
SP
ST
Reception data
(Mode 1)
ST
D0
D1
D2
…
D6
D7
A/D
SP
ST
D0
D1
D2
…
D4
D5
D6
D7
D0
Reception data
(Mode 2)
PE*1, FRE
RDRF
ORE*2
(RDRF = 1)
Reception interrupts generated
*1: PE flag is always "0" in mode 1 and mode 3.
*2: An overrun error occurs if the next data is transferred before received data is read (RDRF = 1).
ST: Start bit, SP: Stop bit, AD: Mode 1 (multiprocessor) address data selection bit
Note:
Figure 20.5-1 does not show all receptions in mode 0. It only shows examples for "7P1" and "8N1"
(P = "even parity" or "odd parity").
Figure 20.5-2 ORE Flag Set Timing
Reception data
RDRF
ORE
474
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 20 LIN-UART
20.5 Interrupts of LIN-UART
MB90340E Series
20.5.2
Timing of Transmit Interrupt Generation and Flag Set
Transmit interrupts are generated when the transmit data is transferred from the
transmit data register (TDR) to the transmit shift register and then the transmission
starts.
■ Timing of Transmit Interrupt Generation and Flag Set
When the data written to the transmit data register (TDR) is transferred to the transmit shift register and
then the transmission starts, the next data becomes writable (SSR:TDRE=1). If the transmit interrupt is
enabled (SSR:TIE=1) at this time, a transmit interrupt is generated.
TDRE bit is a read-only bit and cleared to "0" only by writing data to the transmit data register (TDR).
Figure 20.5-3 shows the timing of the transmission and flag set in each LIN-UART mode.
Figure 20.5-3 Timing of Transmission and Flag Set
Transmit interrupt generated
Transmit interrupt generated
Mode 0, Mode1, Mode2
(SSM=1)
or Mode 3: Write to TDR
TDRE
Serial output
ST D0 D1 D2 D3 D4 D5 D6 D7 P SP ST D0 D1 D2 D3 D4 D5 D6 D7 P SP
AD
AD
Transmit interrupt generated
Transmit interrupt generated
Mode 2 (SSM=0):
Write to TDR
TDRE
Serial output
D0 D1 D2 D3 D4 D5 D6 D7 D0 D1 D2 D3 D4 D5 D6 D7 D0 D1 D2 D3 D4
ST: Start bit, D0 to D7: Data bits, P: Parity (SSM=1 in modes 0 and 2), SP: Stop bit
AD: Address data selection bit (mode 1)
Note:
Figure 20.5-3 does not show all transmissions in mode 0. It only shows an example for "8p1"
(p = "even parity" or "odd parity").
No parity bit or address data selection bit are transmitted in mode 3, or in mode 2 with SSM=0.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
475
CHAPTER 20 LIN-UART
20.5 Interrupts of LIN-UART
MB90340E Series
■ Transmit Interrupt Request Generation Timing
If the TDRE flag is set to "1" when the transmit interrupt is enabled (SSR:TIE=1), a transmit interrupt
request is generated.
Note:
Since the TDRE bit is initially set to "1", a transmit interrupt is generated immediately after the
transmit interrupt is enabled (SSR:TIE=1). Be careful with the timing for enabling the transmit
interrupt since the TDRE bit can be cleared only by writing new data to the transmit data register
(TDR).
476
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
MB90340E Series
20.6
Baud Rate of LIN-UART
CHAPTER 20 LIN-UART
20.6 Baud Rate of LIN-UART
One of the following can be selected for the LIN-UART transmission/reception clock
source:
• Dedicated baud rate generator (reload counter)
• External clock input to the baud rate generator (reload counter)
• External clock (using the SCKn pin input clock directly)
■ LIN-UART Baud Rate Selection
The baud rate can be selected from the following three different rates. Figure 20.6-1 shows the baud rate
selection circuit.
● Baud rate derived from the internal clock divided by the dedicated baud rate generator (reload counter)
Two internal reload counters are provided and assigned to the transmit and reception serial clock
respectively. The baud rate is selected by setting a 15-bit reload value in the baud rate generator register 1,
0 (BGRn1, BGRn0).
The reload counter divides the internal clock by the specified value.
It is used in asynchronous mode and in synchronous mode (master).
To set the clock source, select the use of the internal clock and baud rate generator (SMR:EXT=0, OTO=0).
● Baud rate derived from the external clock divided by the dedicated baud rate generator (reload counter)
The external clock is used as the clock source for the reload counter.
The baud rate is selected by setting a 15-bit reload value in the baud rate generator register 1, 0 (BGRn1,
BGRn0).
The reload counter divides the external clock by the specified value.
It is used in asynchronous mode.
To set the clock source, select the use of the external clock and baud rate generator (SMR:EXT=1,
OTO=0).
This mode is available in case that an oscillator with a special frequency is divided for use.
● Baud rate by the external clock (1-to-1 mode)
The clock input from the clock input pin (SCKn) of the LIN-UART is used as the baud rate (synchronous
mode 2, slave operation (ECCR:MS=1)).
It is used in synchronous mode (slave).
To set the clock source, select the external clock and its direct use (SMR:EXT=1, OTO=1).
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
477
CHAPTER 20 LIN-UART
20.6 Baud Rate of LIN-UART
MB90340E Series
Figure 20.6-1 LIN-UART Baud Rate Selection Circuit
REST
Start bit
Falling edge
detection
Reload value: v
Reception
15-bit reload counter
Reception clock
Set
Rxc = 0?
Reload
FF
0
Reset
Rxc = v/2?
1
Reload value: v
CLK
0
SCKn
(External
clock input)
1
Transmit
15-bit reload counter
Counter value: TXC
EXT
Set
Txc = 0?
OTO
FF
Reload
0
Reset
Txc = v/2?
1
Transmit clock
Internal data bus
EXT
REST
OTO
SMRn
register
BGR14
BGR13
BGR12
BGR11
BGR10
BGR9
BGR8
BGRn1
register
BGR7
BGR6
BGR5
BGR4
BGR3
BGR2
BGR1
BGR0
BGRn0
register
n=0,1,2,3,4
478
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 20 LIN-UART
20.6 Baud Rate of LIN-UART
MB90340E Series
20.6.1
Baud Rate Setting
This section shows baud rate settings and the calculation result of serial clock
frequencies.
■ Baud Rate Calculation
The two 15-bit reload counters are set by the baud rate generator register 1, 0 (BGRn1, BGRn0).
The expressions for the baud rate are as follows.
Reload value:
v = (φ / b)-1
v: Reload value, b: Baud rate, φ: Machine clock or external clock frequency
Calculation example
Assuming that the machine clock is 16 MHz, the internal clock is used, and the baud rate is set to
19200 bps:
Reload value:
v=
(
16 × 106
19200
) -1 = 832
Thus, the actual baud rate can be calculated as follows.
b=
φ
(v + 1)
=
16 × 106
= 19207.6831
833
Note:
The reload counter halts if the reload value is set to "0". Therefore, the minimum division ratio should
be 2.
For transmission/reception in asynchronous mode, the reload value must be at least "4" in order to
determine the reception value by oversampling for 5 times.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
479
CHAPTER 20 LIN-UART
20.6 Baud Rate of LIN-UART
MB90340E Series
■ Reload Value and Baud Rate for Each Clock Speed
Table 20.6-1 shows the reload value and baud rate for each clock speed.
Table 20.6-1 Reload Value and Baud Rate
8 MHz
10 MHz
16 MHz
20 MHz
24 MHz
Baud rate
value
dev.
value
dev.
value
dev.
value
dev.
value
dev.
4M
—
—
—
—
—
—
—
—
5
0
2M
—
—
—
—
7
0
9
0
11
0
1M
7
0
9
0
15
0
19
0
23
0
500000
15
0
19
0
31
0
39
0
47
0
460800
—
—
—
—
—
—
—
—
51
-0.16
250000
31
0
39
0
63
0
79
0
95
0
230400
—
—
—
—
—
—
—
—
103
-0.16
153600
51
-0.16
64
-0.16
103
-0.16
129
-0.16
155
-0.16
125000
63
0
79
0
127
0
159
0
191
0
115200
68
-0.64
86
0.22
138
0.08
173
0.22
207
-0.16
76800
103
-0.16
129
-0.16
207
-0.16
259
-0.16
311
-0.16
57600
138
0.08
173
0.22
277
0.08
346
-0.06
416
0.08
38400
207
-0.16
259
-0.16
416
0.08
520
0.03
624
0
28800
277
0.08
346
< 0.01
554
-0.01
693
-0.06
832
-0.03
19200
416
0.08
520
0.03
832
-0.03
1041
0.03
1249
0
10417
767
< 0.01
959
< 0.01
1535
< 0.01
1919
< 0.01
2303
< 0.01
9600
832
0.04
1041
0.03
1666
0.02
2083
0.03
2499
0
7200
1110
< 0.01
1388
< 0.01
2221
< 0.01
2777
< 0.01
3332
< 0.01
4800
1666
0.02
2082
-0.02
3332
< 0.01
4166
< 0.01
4999
0
2400
3332
< 0.01
4166
< 0.01
6666
< 0.01
8332
< 0.01
9999
0
1200
6666
< 0.01
8334
0.02
13332
< 0.01
16666
< 0.01
19999
0
600
13332
< 0.01
16666
< 0.01
26666
< 0.01
—
—
—
—
300
26666
< 0.01
—
—
—
—
—
—
—
—
The unit of frequency deviation (dev.) is %.
Note:
The maximum baud rate for synchronous mode is 1/6 of the machine clock (value=5).
■ External Clock
The external clock is selected by writing "1" to the EXT bit in the LIN-UART serial mode register (SMR).
In the baud rate generator, the external clock can be used in the same way as the internal clock.
When slave operation is used in operation mode 2, select the 1-to-1 external clock input mode
(SMR:OTO=1). In this mode, the external clock input to SCKn is input directly to the UART serial clock.
Note:
The external clock signal is synchronized with the internal clock in the LIN-UART. Therefore, If the
external clock used cannot be synchronized, the LIN-UART operation becomes unstable.
480
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 20 LIN-UART
20.6 Baud Rate of LIN-UART
MB90340E Series
■ Reload Counter Operation
Figure 20.6-2 shows the operation of the 2 reload counters when the reload value is 832.
Figure 20.6-2 Operation of Reload Counter
Transmit/reception clock
Reload counter
001
000
832
831
830
829
828
827
413
412
411
410
Reload counter value
Transmit/reception clock
Reload counter
417
416
415
414
Note:
The falling edge of the serial clock signal is generated after the reload value divided by 2 ((v+1)/2) is
counted.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
481
CHAPTER 20 LIN-UART
20.6 Baud Rate of LIN-UART
20.6.2
MB90340E Series
Reload Counter
This block is a 15-bit reload counter serving as a dedicated baud rate generator. It
generates the transmit/reception clock from the external or internal clock.
The count value in the transmit reload counter can be read from the baud rate generator
registers (BGRn1, BGRn0).
■ Function of Reload Counter
There are two kinds of reload counters: transmit and reception. They work as the dedicated baud rate
generator. The block consists of a 15-bit register for reload values; it generates the transmit/reception clock
from the external or internal clock. The count value in the transmit reload counter can be read from the
baud rate generator registers (BGRn1, BGRn0).
● Count start
Writing a reload value other than "0" to the baud rate generator registers (BGRn1, BGRn0) causes the
reload counter to start counting.
● Restart
The reload counter restarts under the following conditions:
For both transmit/reception reload counters
• Writing to the baud rate generator registers (BGR1, BGR0)
• UART programmable reset (SMR:UPCL bit)
• Programmable restart (SMR:REST bit)
For reception reload counter
• Detection of the falling edge of the start bit in asynchronous mode
482
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 20 LIN-UART
20.6 Baud Rate of LIN-UART
MB90340E Series
Two reload counters restart at the next clock cycle when the REST bit in the serial mode register (SMR)
is set to "1".
This function enables the transmit reload counter to be used as a simple timer.
Figure 20.6-3 shows an example of using this function (when reload value is 100).
Figure 20.6-3 Example of Using a Simple Timer by Restarting the Reload Timer
Machine clock
Clock output of
reload counter
REST
Reload
counter
37
36
35 100 99
98
97
96
95
94
93
92
91
90
89
88
87
BGR0/BGR1
read
90
Data bus
: don't care
The number of machine cycles "cyc" after restart in this example is obtained by the following
expression.
cyc = v - c + 1 = 100 - 90 + 1 = 11
v: Reload value, c: Reload counter value
Note:
The reload counters also restart when the UART is reset by writing "1" to the SMR:UPCL bit.
• Automatic restart (reception reload counter only)
The reception reload counter is restarted when the falling edge of the start bit is detected in
asynchronous mode. This is the function to synchronize the reception shift register with the reception
data.
● Clearing the counter
When a reset occurs, the reload values in the baud rate generator registers (BGRn1, BGRn0) and the reload
counter are cleared to 00H, and the reload counter halts.
Although the counter value is temporarily cleared to 00H by the LIN-UART reset (writing "1" to
SMR:UPCL), the reload counter restarts since the reload value is retained. The counter value is not cleared
to 00H by the restart setting (writing "1" to SMR:REST), and the reload counter restarts.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
483
CHAPTER 20 LIN-UART
20.7 Operation of LIN-UART
20.7
MB90340E Series
Operation of LIN-UART
LIN-UART operates in mode 0 for bidirectional serial communication, in mode 1 for
master/slave multiprocessor communication, and in modes 2 and 3 for master/slave
bidirectional communication.
■ Operation of LIN-UART
● Operating mode
The LIN-UART has four operation modes (0 to 3), allowing the connections and the data transfer methods
between CPUs to be selected as listed in Table 20.7-1.
Table 20.7-1 LIN-UART Operating Modes
Data length
Operating mode
No parity
0
Normal mode
1
Multiprocessor mode
2
Normal mode
3
LIN mode
With parity
7 bits or 8 bits
7 bits or 8 bits + 1*
Stop bit length
Data bit format
1 bit or 2 bits
LSB first
MSB first
Asynchronous
—
8 bits
8 bits
Synchronization
method
—
Asynchronous
Synchronous
None, 1 bit, 2 bits
Asynchronous
1 bit
LSB first
—: Unavailable setting
*: "+1" is the address/data selection bit (AD) used for communication control in multiprocessor mode.
Note:
Both master and slave operation are supported in a system with master/slave connection in mode 1.
In mode 3, the communication format is fixed to 8N1, LSB first.
When the mode is switched, the UART stops all transitions and receptions and waits for the next
operation.
■ Inter-CPU Connection Method
You can select either external clock 1-to-1 connection (normal mode) or master/slave connection
(multiprocessor mode). In either method, data length, parity setting, synchronization type must be the same
between all CPUs and thus the operating mode must be selected as follows.
• 1-to-1 connection: Two CPUs must use the same method as in either operating mode 0 or 2. Select the
operating mode 0 for asynchronous method or the operating mode 2 for
synchronous method. Also, for the operating mode 2, set one CPU as the master and
the other as the slave.
• Master/slave connection: Select operating mode 1. Use the system as a master/slave system.
484
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 20 LIN-UART
20.7 Operation of LIN-UART
MB90340E Series
■ Synchronous Method
In asynchronous method, the reception clock is synchronized with the falling edge of the reception start bit.
In synchronous method, it can be synchronized by the master clock signal or the clock signal generated in
master operation.
■ Signaling
NRZ (Non Return to Zero).
■ Enabling Transmission/Reception
The LIN-UART uses the SCR:TXE bit and the SCR:RXE bit to control transmission and reception,
respectively. To disable transmission or reception, follow the procedure described below.
• If the reception is in progress, wait until the reception is completed, read the reception data register
(RDR), and then disable the reception.
• If the transmission is in progress, wait until the transmission is completed, and then disable the
transmission.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
485
CHAPTER 20 LIN-UART
20.7 Operation of LIN-UART
20.7.1
MB90340E Series
Operation of Asynchronous Mode (Operation Mode 0, 1)
When LIN-UART is used in operating mode 0 (normal mode) or operating mode 1
(multiprocessor mode), the transfer method is asynchronous.
■ Asynchronous Mode Operation
● Transmit/reception data format
Transmit/reception data always begins with a start bit ("L" level) followed by transmission/reception for a
specified data bit length, and ends with at least one stop bit ("H" level).
The bit transfer direction (LSB first or MSB first) is determined by the BDS bit in the serial status register
(SSR). When a parity is used, the parity bit is always placed between the last data bit and the first stop bit.
In operating mode 0, select 7-bit or 8-bit for the data length. You can select whether or not to use a parity.
Also, the stop bit length (1 or 2) can be selected.
In operating mode 1, the data length is 7-bit or 8-bit, the parity is not added, and the address/data bit is
added. The stop bit length (1 or 2) can be selected.
The bit length of transmit/reception frame is calculated as follows:
Length = 1 + d + p + s
(d = Number of data bits [7 or 8], p = parity [0 or 1],
s = Number of stop bits [1 or 2])
Figure 20.7-1 shows the data format in asynchronous mode.
486
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 20 LIN-UART
20.7 Operation of LIN-UART
MB90340E Series
Figure 20.7-1 Transmit/Reception Data Format (Operating Mode 0, 1)
[Operating mode 0]
ST D0
ST D0
D1 D2 D3 D4 D5 D6 D7 SP SP
P: Not
used
D1 D2 D3 D4 D5 D6 D7 SP
Data 8-bit
ST D0
D1 D2 D3 D4 D5 D6 D7
P
SP SP
P: Used
ST D0
D1 D2 D3 D4 D5 D6 D7
ST D0
D1 D2 D3 D4 D5 D6 SP SP
ST D0
D1 D2 D3 D4 D5 D6 SP
ST D0
D1 D2 D3 D4 D5 D6
P
SP
P: Not
used
Data 7-bit
P
SP SP
P: Used
ST D0
D1 D2 D3 D4 D5 D6
P
SP
ST D0
D1 D2 D3 D4 D5 D6 D7 A/D SP SP
ST D0
D1 D2 D3 D4 D5 D6 D7 A/D SP
ST D0
D1 D2 D3 D4 D5 D6 A/D SP SP
[Operating mode 1]
Data 8-bit
Data 7-bit
ST D0
ST
SP
P
AD
D1 D2 D3 D4 D5 D6 A/D SP
: Start bit
: Stop bit
: Parity bit
: Address/data bit
Note:
When the BDS bit in the serial status register (SSR) is set to "1" (MSB first), the bits are processed in
the order of D7, D6, …D1, D0 (P).
● Transmission
If the transmit data register empty flag bit (TDRE) in the serial status register (SSR) is "1", transmit data
can be written into the transmit data register (TDR). Writing data sets the TDRE flag to "0". If transmission
is enabled (TXE in the serial control register (SCR) is set to 1) at this time, the data is written to the
transmit shift register and the transmission is started sequentially from the start bit in the next serial clock
cycle.
An interrupt is generated if the TDRE flag is set when the transmit interrupt is enabled (TIE=1). Care must
be taken that as the TDRE initial value is "1", an interrupt is generated immediately after "1" is written to
TIE in that state.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
487
CHAPTER 20 LIN-UART
20.7 Operation of LIN-UART
MB90340E Series
When the data length is set to 7-bit (CL=0), the MSB in the TDR is an unused bit regardless of the transfer
direction selection bit (BDS) setting (LSB first or MSB first).
Note:
Since the initial value of transmit data empty flag bit (SSR:TDRE) is "1", an interrupt is generated as
soon as transmit interrupts are enabled (SSR:TIE=1).
● Reception
The reception is performed when reception is enabled (SCR:RXE=1). When the start bit is detected, 1
frame data is received according to the data format defined in the serial control register (SCR). If an error
occurs, the error flag (SSR:PE, ORE, FRE) is set. After the reception of the 1 frame data is completed, the
received data is transferred from the reception shift register to the reception data register (RDR), and the
reception data register full flag bit (SSR:RDRF) is set to "1". If the reception interrupt request is enabled
(SSR:RIE=1) at this time, a reception interrupt request is output.
To read the received data, check the error flag status after 1 frame data reception is completed and read the
received data from the reception data register (RDR) if the reception is normal. If a reception error occurs,
perform error processing.
When the received data is read, the reception data register full flag bit (SSR:RDRF) is cleared to "0".
When the data length is set to 7-bit (CL=0), the MSB in the TDR is an unused bit regardless of the transfer
direction select bit (BDS) setting (LSB first or MSB first).
Note:
Data in the LIN-UART reception data register (RDR) becomes valid when the reception data register
full flag bit (SSR:RDRF) is set to "1" and no error occurs (SSR:PE, ORE, FRE=0).
● Clock to be used
Internal or external clock is used. For the baud rate, select the baud rate generator (SMR:EXT = 0 or 1,
OTO = 0).
● Stop bit
You can select 1 or 2 stop bits at transmission. When 2 bits of the stop bit are selected, both of the stop bits
are detected during reception.
When the first stop bit is detected, the reception data register full flag (SSR:RDRF) is set to "1". When no
start bit is detected after that, the reception bus idle flag (ECCR:RBI) is set to "1", indicating that the
reception is not performed.
● Error detection
In mode 0, parity, overrun, and frame errors can be detected.
In mode 1, overrun and frame errors can be detected. Parity errors, on the other hand, cannot be detected.
488
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 20 LIN-UART
20.7 Operation of LIN-UART
MB90340E Series
● Parity
You can specify whether or not to add (at transmission) and detect (at reception) a parity bit.
The parity enable bit (SCR:PEN) can be used to determine whether or not to use a parity; the parity
selection bit (SCR:P) can be used to select the odd or even parity.
In operating mode 1, the parity cannot be used.
Figure 20.7-2 Transmission Data when Parity is Enabled
SIN
ST
SP
1 0 1 1 0 0 0 0 0
SOT
ST
Parity error occurs in
even parity during reception
(SCR:P = 0)
SP
Transmission of even parity
(SCR:P = 0)
SP
Transmission of odd parity
(SCR:P = 1)
1 0 1 1 0 0 0 0 1
SOT
ST
1 0 1 1 0 0 0 0 0
Data
Parity
ST: Start bit, SP: Stop bit, Parity used (PEN = 1)
Note: In operating mode 1, the parity cannot be used.
● Data signaling
NRZ data format.
● Data transfer method
LSB first or MSB first can be selected for the data bit transfer method.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
489
CHAPTER 20 LIN-UART
20.7 Operation of LIN-UART
20.7.2
MB90340E Series
Operation of Synchronous Mode (Operating Mode 2)
When LIN-UART is used in operating mode 2 (normal mode), the transfer method is
clock synchronous.
■ Operation of Synchronous Mode (Operating Mode 2)
● Transmit/reception data format
In synchronous mode, you can transmit and receive 8-bit data and select whether or not to include the start
bit and stop bit (ECCR:SSM). When the start/stop bit is included (ECCR:SSM = 1), you can select whether
or not to include the parity bit (SCR:PEN).
Figure 20.7-3 shows the data format in synchronous mode.
Figure 20.7-3 Transmit/Reception Data Format (Operating Mode 2)
Transmit/reception data
(ECCR:SSM=0,SCR:PEN=0)
D0 D1 D2 D3 D4 D5 D6 D7
*
Transmit/reception data
(ECCR:SSM=1,SCR:PEN=0)
ST D0 D1 D2 D3 D4 D5 D6 D7
SP
Transmit/reception data
(ECCR:SSM=1,SCR:PEN=1)
ST D0
P
SP
*
D1 D2 D3 D4 D5 D6 D7
SP
SP
*: When 2 stop bits are set (SCR:SBL = 1)
ST: Start bit, SP: Stop bit, P: Parity bit, LSB first
● Clock inversion function
When the SCES bit in the extended status control register (ESCR) is "1", the serial clock is inverted. In
slave mode, the LIN-UART samples data at the falling edge of the received serial clock. Note that, in
master mode, the mark level is set to "0" when the SCES bit is "1".
Figure 20.7-4 Transmit Data Format During Clock Inversion
Transmit/reception clock
(SCES = 0, CCO = 0):
Mark level
Transmit/reception clock
(SCES = 1, CCO = 0):
Mark level
Transmit/reception data
(SSM=1)
(No parity, 1 stop bit)
ST
SP
Data frame
● Start/stop bit
When the SSM bit in the extended communication control register (ECCR) is "1", the start and stop bits are
added as in asynchronous mode.
490
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 20 LIN-UART
20.7 Operation of LIN-UART
MB90340E Series
● Clock supply
In clock synchronous mode (normal), the number of the transmit/reception bits must be equal to the number
of the clock cycles. When the start/stop bit is enabled, the number of the added start/stop bits must be
equal, as well.
When the serial clock output is enabled (SMR:SCKE=1) in master mode (ECCR:MS=0), a synchronous
clock is output automatically at transmission/reception. When the serial clock output is disabled
(SMR:SCKE=0) or the slave mode is selected (ECCR:MS=1), the clock for each bit of transmit/reception
data must be supplied from the outside.
The clock signal must remain at the mark level as long as it is irrelevant to transmission/reception.
Setting the SCDE bit in the ECCR to "1", a delayed transmit clock is output as shown in Figure 20.7-5.
This function is required when the receiving device samples data at the rising or falling edge of the clock.
Figure 20.7-5 Transmission Clock Delay (SCDE=1)
Write transmit data
Reception data sample edge (SCES = 0)
Transmit/reception
clock (normal)
Mark level
Transmit/reception
clock (SCDE=1)
Transmit/reception
data
Mark level
Mark level
0
1
1
LSB
0
1
0
Data
0
1
MSB
When the SCES bit in the extended status register (ESCR) is "1", the LIN-UART clock is inverted, and
received data is sampled at the falling edge of the clock. At this time, the value of the serial data must be
enabled at the timing of the clock falling edge.
When the CCO bit in the ESCR is "1", the serial clock output from the SCKn pin is supplied continuously
in master mode. In this mode, add the start/stop bit (SSM=1) in order to clarify the beginning and end of
the data frame. Figure 20.7-6 shows the operation of this function.
Figure 20.7-6 Continuous Clock Supply (Mode 2)
Transmit/reception clock
(SCES = 0, CCO = 1):
Transmit/reception clock
(SCES = 1, CCO = 1):
Transmit/reception data
(SSM=1)
(No parity, 1 stop bit)
ST
SP
Data frame
Software reset is disabled while the sampling clock edge selection bit (ESCR:SCES) is set to "1".
• When switching the sampling clock edge selection bit (ESCR:SCES) from "0" to "1":
After disabling sending/receiving, and initiating software reset (SCR:UPCL=1), change the sampling
clock edge selection bit (ESCR:SCES) to "1".
• When switching the sampling clock edge selection bit (ESCR:SCES) from "1" to "0":
After disabling sending/receiving, and changing the sampling clock edge selection bit (ESCR:SCES) to
"0", initiate software reset (SCR:UPCL=1)."
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
491
CHAPTER 20 LIN-UART
20.7 Operation of LIN-UART
MB90340E Series
● Error detection
When the start/stop bits are disabled (ECCR:SSM=0), only overrun errors are detected.
● Paroity
Adding (at transmission) and detecting (at reception) of the parity bit can be specified. The parity enable bit
(SCR:PEN) determines parity on/off, while the parity selection bit (SCR:P) specifies odd/even parity.
Parity is disabled when the start/stop bit is not used.
● Stop bit
Upon transmission, the stop bit can be set to either 1-bit or 2-bit.
● Data signaling
NRZ data format.
● Data transfer method
LSB first or MSB first can be selected for the data bit transfer method.
492
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 20 LIN-UART
20.7 Operation of LIN-UART
MB90340E Series
● Communication settings for synchronous mode
To communicate in synchronous mode, the following settings are required.
• Baud rate generator register (BGR0/BGR1)
Set the dedicated baud rate reload counter to a required value.
• Serial mode register (SMR)
MD1, MD0 : 10B (Mode 2)
SCKE
: "1" . . . . . Use the dedicated baud rate reload counter.
"0" . . . . . Input external clock.
SOE
: "1" . . . . . Enable transmission/reception.
"0" . . . . . Enable reception only.
• Serial control register (SCR)
RXE, TXE : Set "1" to either one of them.
AD
: The value of this bit is disabled, as the address/data format selection function cannot be
used.
CL
: This bit is set to 8-bit length automatically, and its value is disabled.
CRE
: "1" . . . . . The error flag is cleared, and reception is suspended.
--- For SSM=0:
PEN, P, SBL: Since not used, parity bit and stop bit are disabled.
--- For SSM=1:
PEN : "1" . . . . . . . Add/detect parity bit,
"0" . . . . . . . Not use parity bit
P
"0" . . . . . . . Odd parity
: "1" . . . . . . . Even parity,
SBL : "1" . . . . . . . Stop bit length 2,
"0" . . . . . . . Stop bit length 1
• Serial status register (SSR)
BDS: "0" . . . . . . . LSB first,
"1" . . . . . . . MSB first
RIE : "1" . . . . . . . Enable reception interrupt, "0" . . . . . . . Disable reception interrupt
TIE : "1" . . . . . . . Enable transmit interrupt, "0" . . . . . . . Disable transmit interrupt
• Extended communication control register (ECCR)
SSM : "0" . . . . . . . Not use start/stop bit (normal)
"1" . . . . . . . Use start/stop bit (extended function)
MS : "0" . . . . . . . Master mode (serial clock output)
"1" . . . . . . . Slave mode (input serial clock from master device)
Note:
To start communication, write data into the transmit data register (TDR).
To only receive data, disable the serial output (SMR:SOE=0), and then write dummy data into the
TDR.
Enabling continuous clock and start/stop bit allows bidirectional communication as in asynchronous
mode.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
493
CHAPTER 20 LIN-UART
20.7 Operation of LIN-UART
20.7.3
MB90340E Series
Operation of LIN Function (Operating Mode 3)
In operating mode 3, the LIN-UART works as the LIN master and the LIN slave.
In operating mode 3, the data format is set to 8N1-LSB first.
■ Asynchronous LIN Mode Operation
● Operation as LIN master
In LIN mode, the master determines the baud rate for the entire bus, and the slave synchronizes to the
master. The baud rate is fixed to the requested value when the master starts operating after the initial
setting.
Writing "1" to the LBR bit in the extended communication control register (ECCR) outputs 13 to 16 bits at
the "L" level from the SOTn pin. These bits are the LIN Synch break indicating the beginning of a LIN
message.
The TDRE flag bit in the serial status register (SSR) is set to "0". After the break, it is set to "1" (initial
value), if no valid data is contained in the transmit data register (TDR). If the TIE bit in SSR is "1" at this
time, a transmit interrupt is output.
The length of the LIN break transmitted is set by the LBL0/LBL1 bits in ESCR as in the following table.
Table 20.7-2 LIN Break Length
LBL0
LBL1
Break length
0
0
13 bits
1
0
14 bits
0
1
15 bits
1
1
16 bits
Synch field is transmitted as byte data 55H following the LIN break. 55H can be written to the TDR after
the LBR bit is set to "1" even if the TDRE flag is "0".
● Operation as LIN slave
In LIN slave mode, the LIN-UART must synchronize to the baud rate for the master. The LIN-UART
generates a reception interrupt when LIN break interrupt is enabled (LBIE=1) even though reception is
disabled (RXE=0). The LBD bit in the ESCR is set to "1" at this time.
Writing "0" to the LBD bit clears the reception interrupt request flag.
For calculation of the baud rate, the following example shows the operation of the UART0. When the
UART0 detects the first falling edge of Synch field, the internal signal to be input to the input capture
(ICU0) is set to "H" to start ICU0. The internal signal should be "L" at the fifth falling edge. ICU0 must be
set to LIN mode (ICE01). Also, ICU0 interrupts must be enabled and set for the detection at both edges
(ICS01). The time for which the input signal to ICU0 is the value obtained by multiplying the baud rate by 8.
The baud rate setting value is calculated by the following expressions.
494
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 20 LIN-UART
20.7 Operation of LIN-UART
MB90340E Series
When the free-run timer is not overflowing: BGR value = { (b - a) × Fe / (8 × φ) } -1
When the free-run timer is overflowing: BGR value = { (max + b - a) × Fe / (8 × φ) } -1
max : Maximum value of free-run timer
a
: ICU data register value after the 1st interrupt
b
: ICU data register value after the 2nd interrupt
φ
: Machine clock frequency (MHz)
Fe : External clock frequency (MHz)
Calculation based on the internal baud rate generator in use (EXT=0),
and Fe=φ
Note:
Do not set the baud rate if the new BGR value calculated based on Synch field as above in LIN slave mode
involves an error over ±15%.
For the relationship between the UART and ICU, see Section "13.5 Operations of 16-bit Free-run Timer"
and Section "13.6 Input Capture Operations".
● LIN Synch break detection interrupt and flag
The LIN break detection (LBD) flag in ESCR is set to "1" when the LIN Synch break is detected in slave
mode. When the LIN break interrupt is enabled (LBIE=1), an interrupt is generated.
Figure 20.7-7 Timing of LIN Synch Break Detection and Flag Set
Serial clock cycle #
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Serial clock
Serial input
(LIN bus)
FRE
(RXE=1)
LBD
(RXE=0)
Reception interrupt occurs when RXE=1
Reception interrupt occurs when RXE=0
The above diagram shows the timing of the LIN Synch break detection and flag.
Since the data framing error (FRE) flag bit in SSR generates a reception interrupt 2 bits earlier than a LIN
break interrupt (for 8N1), set the RXE to "0" when a LIN break is used.
The LIN Synch break detection works only in operating mode 3.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
495
CHAPTER 20 LIN-UART
20.7 Operation of LIN-UART
MB90340E Series
Figure 20.7-8 shows the beginning of a typical LIN message and the LIN-UART operation.
Figure 20.7-8 UART Operation in LIN Slave Mode
Serial clock
Serial input
(LIN bus)
LBR cleared by CPU
LBD
ICU input
(LSYN)
Synch break (when set to 14 bits)
Synch field
● LIN bus timing
Figure 20.7-9 LIN Bus Timing and UART Signals
Previous serial clock
No clock
(Calculation frame)
Newly calculated serial clock
ICU count
LIN
bus
(SIN)
RXE
LBD
(IRQ0)
LBIE
ICU input
(LSYN)
IRQ(ICU)
RDRF
(IRQ0)
RIE
RDR read
by CPU
Reception interrupt enabled
LIN break starts
LIN break detected, interrupt generated
IRQ cleared by CPU (LBD->0)
LBIE disabled
IRQ (ICU)
IRQ cleared: ICU started
IRQ(ICU)
IRQ cleared: Baud rate calculated and set
Reception enabled
Falling edge of start bit
1 byte of reception data saved to RDR
RDR read by CPU
496
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
MB90340E Series
20.7.4
Serial Pin Direct Access
CHAPTER 20 LIN-UART
20.7 Operation of LIN-UART
Transmission pin (SOTn) or reception pin (SINn) can be accessed directly.
■ LIN-UART Pin Direct Access
The LIN-UART allows the programmer to directly access the serial I/O pins.
The status of the serial input pin (SINn) can be read by using the serial I/O pin direct access bit
(ESCR:SIOP).
You can set the value of the serial output pin (SOTn) arbitrarily when the serial output is enabled
(SMR:SOE=1) after direct write to the serial output pin (SOTn) is enabled (ESCR:SOPE=1), and then "0"
or "1" is written to the serial I/O pin direct access bit (ESCR:SIOP).
In LIN mode, this feature is used for reading transmitted data or for error handling when a LIN bus line
signal is physically incorrect.
Notes:
• Direct access is allowed only when transmission is not in progress (the transmit shift register is
empty).
• Before enabling transmission (SMR:SOE=1), write a value to the serial output pin direct access bit
(ESCR:SIOP). This prevents a signal of an unexpected level from being output since the SIOP bit
holds a previous value.
• While the value of the SINn pin is read by normal read, the value of the SOTn pin is read for the
SIOP bit by the RMW instructions.
• While SCR:TXE=1, and in transmission or under slave mode in operation mode 2, the SOTn pin
cannot be accessed directly regardless of the setting of this bit.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
497
CHAPTER 20 LIN-UART
20.7 Operation of LIN-UART
20.7.5
MB90340E Series
Bidirectional Communication Function (Normal Mode)
Normal serial bidirectional communication can be performed in operation mode 0 or 2.
Asynchronous communication can be selected in operating mode 0, while synchronous
communication can be selected in operating mode 2.
■ Bidirectional Communication Function
To operate the LIN-UART in normal mode (operating mode 0 or 2), the settings shown in Figure 20.7-10
are required.
Figure 20.7-10 Settings of LIN-UART Operating Modes 0 and 2
bit15 bit14 bit13 bit12 bit11 bit10 bit9
SCRn, SMRn
PEN
P
bit8
bit7 bit6
bit5
bit4
bit3
bit2
bit1
bit0
SBL CL A/D CRE RXE TXE MD1 MD0 OTO EXT REST UPCL SCKE SOE
Mode 0
Mode 2
SSRn, TDRn/RDRn
PE ORE FRE RDRF TDRE BDS RIE TIE
Mode 0
Mode 2
ESCRn, ECCRn
LBIE
LBD LBL1 LBL0 SOPE SIOP CCO SCES
Set conversion data (during writing)
Retain reception data (during reading)
LBR MS SCDE SSM
RBI TBI
Mode 0
Mode 2
: Used bit
: Unused bit
: Set "1"
: Set "0"
: Used when SSM = 1 (Synchronous start/stop bit mode)
: Bit automatically set correctly
n = 0, 1, 2, 3, 4
● Inter-CPU connection
For bidirectional communication, two CPUs are interconnected as shown in Figure 20.7-11.
Figure 20.7-11 Connection Example of Bidirectional Communication in LIN-UART Mode 2
SOT
SOT
SIN
Output
Input
SCK
SIN
SCK
CPU-1 (Master)
CPU-2 (Slave)
● Communication procedure
The communication is started from transmitting end at arbitrary timing when data is ready to be
transmitted. The receiving end returns ANS (per 1 byte in this example) regularly after the transmitted data
is received. Figure 20.7-12 shows an example of bidirectional communication flowchart.
498
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 20 LIN-UART
20.7 Operation of LIN-UART
MB90340E Series
Figure 20.7-12 Example of Bidirectional Communication Flowchart
(Transmitting end)
(Receiving end)
Start
Start
Set operating mode
(0 or 2)
Set operating mode (Match
with the transmitting end)
Communicate with 1 byte
data set in TDR
Data
transmission
NO
NO
Read and process
received data
CM44-10143-5E
YES
Received
data exists
YES
Received
data exists
Read and process
received data
Data
transmission
Transmit 1 byte data
(ANS)
FUJITSU SEMICONDUCTOR LIMITED
499
CHAPTER 20 LIN-UART
20.7 Operation of LIN-UART
20.7.6
MB90340E Series
Master/Slave Mode Communication Function
(Multiprocessor Mode)
Operating mode 1 allows communication between multiple CPUs connected in master/
slave mode. It can be used as a master or slave.
■ Master/Slave Mode Communication Function
To operate the LIN-UART in multiprocessor mode (operating mode 1), the settings shown in Figure 20.713 are required.
Figure 20.7-13 Settings of LIN-UART Operating Mode 1
bit15 bit14 bit13 bit12 bit11 bit10
SCRn, SMRn
PEN
P
SBL
CL
bit9
bit8
bit7
bit6
bit5
bit4
bit3
bit2
bit1
bit0
A/D CRE RXE TXE MD1 MD0 OTO EXT REST UPCL SCKE SOE
Mode 1
SSRn, TDRn/RDRn
PE ORE FRE RDRF TDRE BDS RIE
TIE
Set conversion data (during writing)
Retain reception data (during reading)
Mode 1
ESCRn, ECCRn
LBIE LBD LBL1 LBL0 SOPE SIOP CCO SCES
LBR MS SCDE SSM
RBI
TBI
Mode 1
: Used bit
: Unused bit
: Set "1"
: Set "0"
: Bit automatically set correctly
n = 0, 1, 2, 3, 4
● Inter-CPU connection
For master/slave mode communication, a communication system is configured by connecting between 1
master CPU and multiple slave CPUs with 2 common communication lines, as shown in Figure 20.7-14.
The LIN-UART can be used as the master or slave.
Figure 20.7-14 Connection Example of LIN-UART Master/Slave Mode Communication
SOT
SIN
Master CPU
SOT
SIN
Slave CPU#0
500
SOT
SIN
Slave CPU#1
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 20 LIN-UART
20.7 Operation of LIN-UART
MB90340E Series
● Function selection
For master/slave mode communication, select the operating mode and the data transfer method, as shown in
Table 20.7-3.
Table 20.7-3 Selection of Master/Slave Mode Communication Function
Operating mode
Master
CPU
Address Transmission/
reception
Data transmission/
reception
Mode 1
(AD bit
transmission/
reception)
Slave
CPU
Mode 1
(AD bit
transmission/
reception)
Data
Parity
Synchronous
method
Stop bit
Bit
direction
None
Asynchronous
1 bit or 2 bits
LSB first or
MSB first
AD = 1
+
7- or 8-bit address
AD = 1
+
7- or 8-bit address
● Communication procedure
Communication is started by transmitting address data from the master CPU. The address data, whose AD
bit is set as "1", determines the slave CPU to be the destination. Each slave CPU checks address data by
using a program, and communicates with the master CPU when the data matches an assigned address.
Figure 20.7-15 shows a flowchart for master/slave mode communication (multiprocessor mode).
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
501
CHAPTER 20 LIN-UART
20.7 Operation of LIN-UART
MB90340E Series
Figure 20.7-15 Master/Slave Mode Communication Flowchart
(Master CPU)
(Slave CPU)
Start
Start
Set to operating mode 1
Set to operating mode 1
Set SINn pin to serial
data input
Set SOTn pin to serial
data output
Set SINn pin to serial
data input
Set SOTn pin to port
input
Set 7 or 8 data bits
Set 1 or 2 stop bits
Set 7 or 8 data bits
Set 1 or 2 stop bits
Set "1" in AD bit
Enable transmission/
reception
Enable transmission/
reception
Receive bytes
Transmit address to
slave
AD bit = 1
NO
YES
Match with
slave address
Set "0" in AD bit
YES
Communicate with
master CPU
Communicate with
slave CPU
Terminate
communication?
NO
Terminate
communication?
NO
NO
YES
YES
Communicate
with another slave
CPU
NO
YES
Disable transmission/
reception
End
502
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 20 LIN-UART
20.7 Operation of LIN-UART
MB90340E Series
20.7.7
LIN Communication Function
For LIN-UART communication, a LIN device can be used in the LIN master system or the
LIN slave system.
■ LIN Master/Slave Mode Communication Function
Figure 20.7-16 shows the required settings for the LIN communication mode of LIN-UART (operating
mode 3).
Figure 20.7-16 Settings of LIN-UART Operating Mode 3
SCRn, SMRn
PEN
P
SBL CL
A/D CRE RXE TXE MD1 MD0 OTO EXT REST UPCLSCKE SOE
Mode 3
SSRn, TDRn/RDRn
PE ORE FRE RDRFTDRE BDS RIE TIE
Set conversion data (during writing)
Retain reception data (during reading)
Mode 3
ESCRx, ECCRx
LBIE LBD LBL1 LBL0 SOPE SIOP CCO SCES
LBR MS SCDESSM
RBI TBI
Mode 3
: Used bit
: Unused bit
: Set "1"
: Set "0"
: Bit automatically set correctly
n = 0, 1, 2, 3, 4
● LIN device connection
Figure 20.7-17 shows the communication system between 1 LIN master and LIN slave.
The LIN-UART can serve as the LIN master or LIN slave.
Figure 20.7-17 Example of LIN Bus System Communication
SOT
SOT
LIN bus
SIN
LIN master
CM44-10143-5E
SIN
Transceiver
Transceiver
FUJITSU SEMICONDUCTOR LIMITED
LIN slave
503
CHAPTER 20 LIN-UART
20.7 Operation of LIN-UART
20.7.8
MB90340E Series
Example Flowchart of LIN-UART LIN Communication
(Operating Mode 3)
This section shows example flowcharts of LIN-UART LIN communication.
■ LIN Master Device
Figure 20.7-18 LIN Master Flowchart
Start
Initial settings:
Set to operating mode 3
Enable serial data output, Set baud rate,
Set Synch break length
TXE = 1, TIE = 0, RXE = 1, RIE = 1
NO
Message?
(Reception) YES
YES
Wake up?
(0x80
reception)
NO
Receive
Data field?
RDRF = 1
Reception interrupt
RXE = 0
Enable Synch break interrupts
Transmit Synch break
ECCR: LBR = 1
Transmit Synch field:
TDR = 0x55
(Transmission)
RDRF = 1
Reception interrupt
Receive Data 1*1
YES
NO
Set transmit data 1,
TDR = Data 1,
Enable transmit
interrupts
TDRE = 1
Transmit interrupt
Receive Data N*1
Set transmit data N,
TDR = Data N,
Disable transmit
interrupts
LBD = 1
Synch break interrupt
RDRF = 1
Reception interrupt
Enable reception
LBD = 0
Disable Synch break
interrupts
Receive Data 1 *1
Read Data 1
RDRF = 1
Reception interrupt
RDRF = 1
Reception interrupt
Receive Synch field *1
Set Identify field: TDR = lD
Receive Data N *1
Read Data N
RDRF = 1
Reception interrupt
Receive ID field*1
No error?
NO
Process error*2
YES
*1: Process an error if it occurs.
*2: • If the FRE or ORE flag is set "1", write "1" to the SCR:CRE bit to clear the error flag.
• If the ESCR:LBD bit is set to "1", execute the UART reset.
Note: Detect an error in each process and handle it appropriately.
504
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 20 LIN-UART
20.7 Operation of LIN-UART
MB90340E Series
■ LIN Slave Device
Figure 20.7-19 LIN Slave Flowchart
Start
Initial settings:
Set to operating mode 3
Enable serial data output
TXE = 1, TIE = 0, RXE = 0, RIE = 1
Connect UART with ICU
Disable reception
Enable ICU interrupts
Enable Synch break
interrupts
(Reception)
ICU interrupt
Receive
Data field?
NO
(Transmission)
RDRF = 1
Reception interrupt
LBD = 1
Synch break interrupt
Clear Synch break detection
ESCR: LBD = 0
Disable Synch break
interrupts
YES
Set transmit data 1
TDR = Data 1
Enable transmit
interrupts
Receive Data 1*1
RDRF = 1
Reception interrupt
TDRE = 1
Transmit interrupt
Receive Data N*1
Set transmit data N,
TDR = Data N,
Disable transmit
interrupts
Read ICU data
Clear ICU interrupt flag
ICU interrupt
Disable reception
RDRF = 1
Reception interrupt
Read ICU data
Adjust baud rate
Enable reception
Clear ICU interrupt flag
Disable ICU interrupts
Receive Data 1 *1
Read Data 1
RDRF = 1
Reception interrupt
RDRF = 1
Reception interrupt
Receive Data N *1
Read Data N
Disable reception
Receive Identify
field*1
No error?
NO
Process error*2
YES
Sleep
mode?
NO
YES
Wake-up
received?
*1: Process an error if it occurs.
*2: • If the FRE or ORE flag is set "1", write "1" to the
SCR:CRE bit to clear the error flag.
• f the ESCR:LBD bit is set to "1", execute the UART
reset.
Note: Detect an error in each process and handle it
appropriately.
CM44-10143-5E
YES
NO
Wake-up
transmitted?
YES
FUJITSU SEMICONDUCTOR LIMITED
NO
Transmit wake-up code
505
CHAPTER 20 LIN-UART
20.8 Notes on Using LIN-UART
20.8
MB90340E Series
Notes on Using LIN-UART
This section shows notes on using the LIN-UART.
■ Notes on Using LIN-UART
● Enabling operation
The LIN-UART has the TXE (transmission) and RXE (reception) enable bit in the serial control register
(SCR) for transmission and reception, respectively. As both transmission and reception are disabled by
default (initial value), these operations must be enabled before transfer. Also, you can disable these
operations to stop transfer as required.
● Setting communication mode
The communication mode must be set while the LIN-UART is stopped. If the mode is set during
transmission/reception, the transmitted/received data is not guaranteed.
● Timing of enabling transmit interrupts
Since the default (initial) value of the transmit data empty flag bit (SSR:TDRE) is "1" (no transmit data,
transmit data write enabled), a transmit interrupt request is generated immediately when transmit interrupt
request is enabled (SSR:TIE=1). To prevent this, be sure to set the transmit data before setting the TIE flag
to "1".
● Changing operation setting
It is recommended to reset the LIN-UART after changing its settings, such as adding the start/stop bit or
changing the data format.
The correct operation settings are not guaranteed even if you reset the LIN-UART (SMR:UPCL=1) at the
same time as setting the LIN-UART serial mode register (SMR). Therefore, it is recommended to reset the
LIN-UART (SMR:UPCL=1) once again, after setting the bit in LIN-UART serial mode register (SMR).
● Using LIN function
Although the LIN functions are available in operating mode 3, the LIN format is automatically set in mode
3 (8-bit data, no parity, 1 stop bit, LSB first).
While the length of LIN break transmit bit is variable, the detection bit length is fixed to 11 bits
● Setting LIN slave
When starting LIN slave mode, be sure to set the baud rate before receiving the LIN Synch break in order
to ensure that at least 13 bits of the LIN Synch break is detected.
506
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 20 LIN-UART
20.8 Notes on Using LIN-UART
MB90340E Series
● Program compatibility
Although the LIN-UART resembles the old FJ-UART, there is no program compatibility between them.
Even when the same programming pattern is used, the register structure is different. Moreover, a reload
value is currently used to determine the baud rate setting, rather than selecting a preset value.
● Bus idle function
In operation mode 2, reception bus idle detection function cannot be used. Also, when slave mode is
selected (MS=1), transmit bus idle detection function is disabled as well.
● AD bit (Serial control register (SCR): Address/data format selection bit)
• The AD bit is used to select the address/data for transmission in write operation, and to read the AD bit
received last in read operation. Internally, the AD bit values for transmission and reception are stored in
separate registers.
The transmit AD bit value is read when RMW instructions are used. Otherwise, the received AD data is
read.
• At transmission, when the TDRE bit changes from "0" to "1", the transmit AD bit is also loaded to the
transmit shift register along with the data in the transmit data register (TDR). Therefore, set the transmit
AD bit before writing to the transmit data register (TDR).
● LIN-UART software reset
Execute the LIN-UART software reset (SMR:UPCL=1) when the TXE bit in the serial control register
(SCR) is "0".
● Synch break detection
In mode 3 (LIN mode), when Serial input more than 11 bits is "0", the LBD bit in the extended status
control register (ESCR) is set to "1" (Synch break detection) and the LIN-UART waits for the Synch field.
As a result, when Serial input more than 11 bits is "0", the LIN-UART recognizes that the Synch break is
input (LBD=1), and then waits for the Synch field.
In this case, execute the LIN-UART reset (SMR: UPCL=1).
● ESCR:LBD bit
After detection of LIN Synch break, write-accessing the ESCR register while at the same time the LBD bit
is set to "1", "1" cannot be set to the bit. In operation mode 3, setting of the ESCR register should therefore
be done at the time of initialization, or after the LBD bit is set to "1".
● ESCR:SCES bit
Software reset is disabled while the sampling clock edge selection bit (ESCR:SCES) is set to "1".
• Switching the sampling clock edge selection bit (ESCR:SCES) from "0" to "1":
After disabling sending/receiving, and initiating software reset (SCR:UPCL=1), change the sampling
clock edge selection bit (ESCR:SCES) to "1".
• Switching the sampling clock edge selection bit (ESCR:SCES) from "1" to "0":
After disabling sending/receiving, and changing the sampling clock edge selection bit (ESCR:SCES) to
"0", initiate software reset (SCR:UPCL=1).
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
507
CHAPTER 20 LIN-UART
20.8 Notes on Using LIN-UART
MB90340E Series
● Serial Communication
There is a possibility to receive wrong data due to the noise or other causes on the serial communication.
Therefore, design a printed circuit board so as to avoid noise. Retransmit the data if an error occurs because
of applying the checksum to the last data in consideration of receiving wrong data due to the noise.
● Handling framing errors
1) CRE resets reception state machine and next falling edge atSINn starts reception of new byte (See
Figure 20.8-1).
Therefore either set CRE bit immediately (within half bit time) after receiving errors to prevent data
stream desynchronization (See Figure 20.8-2) or wait an application dependent time after receiving
errors and set CRE, when SINn is idle.
2) Please note, that in case a framing error occurred (stop bit: SINn = 0 ) and next start bit (SINn = 0 )
follows immediately, this start bit is recognized regardless of no falling edge before (See Figure 20.8-3).
This is used to remain UART synchronized to the data stream and to detect that serial data input (SINn)
keeps "L" level (See Figure 20.8-3 above) by producing next framing errors. If this behavior is not
wanted, please disable the reception temporarily RXE = 1 → 0 → 1) after framing error. In this case,
reception goes on at next falling edge on SINn. (See Figure 20.8-3 below).
508
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 20 LIN-UART
20.8 Notes on Using LIN-UART
MB90340E Series
Figure 20.8-1 Timing of CRE Bit
CRE bit timing within ½ Bit Time of Stop Bit
Last Data Bit
Stop Bit
SIN
Start Bit
½ Bit Time
Sample
Point
Error
Flags
CRE
Reception State Machine is reset
Falling Edge detected: Receive new Frame
CRE bit timing out of ½ Bit Time of Stop Bit
Last Data Bit
Stop Bit
SIN
Start Bit
½ Bit Time
Sample
Point
Error
Flags
CRE
Falling Edge detected: Receive new Frame
Reception State Machine is reset,
Start Bit Condition is reset, actual
Reception is desynchronized
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
509
CHAPTER 20 LIN-UART
20.8 Notes on Using LIN-UART
MB90340E Series
Figure 20.8-2 Data Stream Desynchronization
Example for Desynchronization
SIN
CRE during
Start Bit
CRE
Reception is reset
RX read
Next falling Edge is
treated as Start Bit
1st Frame
1st desynchronized
Frame
2nd Frame
Missed Bits
510
FUJITSU SEMICONDUCTOR LIMITED
Begin of 2nd
desynchronized
Frame
Missed Bits
CM44-10143-5E
CHAPTER 20 LIN-UART
20.8 Notes on Using LIN-UART
MB90340E Series
Figure 20.8-3 Dominant Bus Operation
USART Dominant Bus Behaviour
Reception always enabled (RXE = 1)
SIN
FRE
CRE
Framing Error
occurs
Error is
cleared
Reception is ongoing Next Framing
regardless of no falling Error occurs
edge
Falling Edge is
next Start Bit
Edge
Reception disabled temporary (RXE = 1 0 1)
SIN
FRE
CRE
RXE
Framing Error
occurs
Reception is reset:
Waiting for falling
Edge
Error is
cleared
Reception is ongoing
regardless of no falling
edge
CM44-10143-5E
No further
Errors
FUJITSU SEMICONDUCTOR LIMITED
Falling Edge is
next Start Bit
Edge
511
CHAPTER 20 LIN-UART
20.8 Notes on Using LIN-UART
512
MB90340E Series
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 21
2
I C INTERFACE (400 kHz)
This chapter explains the functions and operations of
the high-speed I2C interface.
21.1 Overview of I2C Interface (400 kHz)
21.2 Registers of I2C Interface
21.3 Operations of I2C Interface
21.4 Programming Flowcharts
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
513
CHAPTER 21 I2C INTERFACE (400 kHz)
21.1 Overview of I2C Interface (400 kHz)
21.1
MB90340E Series
Overview of I2C Interface (400 kHz)
The I2C interface is a serial I/O port that supports internal IC BUS and operates as the
master/slave devices on I2C bus.
The MB90340E series provides two I2Cs. (only devices with suffix-"c". The MB90340E
series does not contain products without C-suffix.)
■ Features of I2C Interface (400 kHz)
The I2C interface (400 kHz) has the following features:
• Master/slave sending and receiving function
• Arbitration function
• Clock synchronization function
• General call addressing function
• Transfer direction detection function
• Function that generates and detects the re-activation condition
• Bus error detection function
• 7-bit master/slave addressing
• 10-bit master/slave addressing
• Interface for 7-bit and 10-bit slave address
• Disabling of acknowledgement for slave address reception (only in master mode)
• Address mask function to provide the interface for composite slave addresses (in 7-bit and 10-bit
modes)
• Transmission at up to 400 kbps
• Built-in noise filters for SDA/SCL
• Data reception at 400 kbps when the machine clock exceeds 6 MHz regardless of the prescaler setting
• Generation of transfer interrupts and bus error interrupts
• Lowering of speed by slave at the bit level and byte level
The I2C interface does not support the SCL clock stretching at the bit level because the interface can
receive the data in full scale at 400kbps when the machine clock exceeds 6 MHz regardless of the prescaler
setting. However, the clock stretching is executed at the byte level when SCL becomes "L" during the
interrupt (INT=1 in the IBCR register).
■ Block Diagram of I2C Interface
Figure 21.1-1 shows a block diagram of the I2C interface (400 kHz).
514
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 21 I2C INTERFACE (400 kHz)
21.1 Overview of I2C Interface (400 kHz)
MB90340E Series
Figure 21.1-1 Block Diagram of I2C Interface (400 kHz)
ICCR
I2C enable
EN
ICCR
2
CS4
Clock division 1
3 4 5 ... 32
CS3
5
CS2
5
Synchronous
Clock selector
CS1
CS0
IBSR
BB
RSC
LRB
Clock division 2 (divided by 12)
SCL duty cycle generator
Shift clock generator
Bus busy
Repeat activation
Bus observer
Last bit
Bus error
Send/receive
TRX
Address data
ADT
Internal data bus
AL
Arbitration loss detector
ICCR
NSF
Enable
IBCR
BER
BEIE
MCU
IRQ
Interrupt request
INTE
INT
Noise
filter
SCL
SDA
SCL
SDA
IBCR
SCC
MSS
ACK
Activation
Activate-stop condition
generator
Master
ACK enable
GC-ACK enable
ACK generator
GCAA
8
IBSR
AAS
IDAR
8
Slave
General call
GCA
ISMK
7-bit mode enable
ENSB
ITMK 10-bit mode enable
ENTB
Reception address length
RAL
10
Slave address
comparator
7
10
ITBA
ITMK
7
ISBA
ISMK
10
10
7
7
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
515
CHAPTER 21 I2C INTERFACE (400 kHz)
21.2 Registers of I2C Interface
21.2
MB90340E Series
Registers of I2C Interface
This section explains the function of the registers used in the I2C interface.
■ Register List of I2C Interface
Figure 21.2-1 shows a register list of the I2C interface.
Figure 21.2-1 Register List of I2C Interface
Bus control register (IBCR0/IBCR1)
Address: bit 15
IBCR0: 007971H
IBCR1: 007981H
14
13
12
11
10
9
8
BER BEIE SCC MSS ACK GCAA INTE INT
R/W R/W W
R/W R/W R/W R/W R/W
IBCR0/IBCR1
Initial value
00000000B
Bus status register (IBSR0/IBSR1)
Address: bit 7
IBSR0: 007970H
IBSR1: 007980H
6
5
BB
RSC
AL
R
R
R
4
3
2
1
0
IBSR0/IBSR1
LRB TRX AAS GCA ADT
Initial value
R
R
R
00000000B
10
9
8
ITBAH0/ITBAH1 (upper)
R
R
10-bit slave address register (ITBA0/ITBA1)
Address: bit 15
14
13
12
11
ITBAH0: 007973H
ITBAH1: 007983H
TA9 TA8
Initial value
R/W R/W
00000000B
Address:
0
6
5
4
3
2
1
bit 7
ITBAL0: 007972H
TA7
TA6
TA5
TA4
TA3
TA2
TA1
TA0
ITBAL1: 007982H
R/W R/W R/W R/W R/W R/W R/W R/W
ITBAL0/ITBAL1
(lower)
Initial value
00000000B
10-bit slave address mask register (ITMK0/ITMK1)
Address: bit 15
ITMKH0: 007975H
ITMKH1: 007985H
Address:
ITMKL0: 007974H
ITMKL1: 007984H
14
13
12
11
10
9
8
ENTB RAL
TM9 TM8
R/W R/W
R/W R/W
bit 7
6
5
4
3
2
1
0
ITMKH0/ITMKH1 (upper)
Initial value
00111111B
ITMKL0/ITMKL1 (lower)
TM7 TM6 TM5 TM4 TM3 TM2 TM1 TM0
Initial value
R/W R/W R/W R/W R/W R/W R/W R/W
11111111B
7-bit slave address register (ISBA0/ISBA1)
Address:
bit 7
ISBA0: 007976H
ISBA1: 007986H
R/W
W
R
—
6
5
4
3
2
1
0
ISBA0/ISBA1
SA6 SA5 SA4 SA3 SA2 SA1 SA0
Initial value
R/W R/W R/W R/W R/W R/W R/W
00000000B
: Readable/writable
: Write only
: Read only
: Undefined
(Continued)
516
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 21 I2C INTERFACE (400 kHz)
21.2 Registers of I2C Interface
MB90340E Series
(Continued)
7-bit slave address mask register (ISMK0/ISMK1)
Address:
bit 15
ISMK0: 007977H
ISMK1: 007987H
14
13
12
11
10
9
8
ENSB SM6 SM5 SM4 SM3 SM2 SM1 SM0
R/W R/W R/W R/W R/W R/W R/W R/W
ISMK0/ISMK1
Initial value
01111111B
Data register (IDAR0/IDAR1)
Address:
bit 7
IDAR0: 007978H
IDAR1: 007988H
6
5
4
3
2
1
0
D7 D6 D5 D4 D3 D2 D1 D0
R/W R/W R/W R/W R/W R/W R/W R/W
IDAR0/IDAR1
Initial value
00000000B
Clock control register (ICCR0/ICCR1)
Address:
bit 15
ICCR0: 00797BH
ICCR1: 00798BH
14
13
12
11
10
9
8
NSF EN CS4 CS3 CS2 CS1 CS0
R/W R/W R/W R/W R/W R/W R/W
ICCR0/ICCR1
Initial value
00011111B
R/W : Readable/writable
— : Undefined
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
517
CHAPTER 21 I2C INTERFACE (400 kHz)
21.2 Registers of I2C Interface
21.2.1
MB90340E Series
Bus Status Register (IBSR0, IBSR1)
This section explains the function of the bus status register (IBSR0, IBSR1).
■ Functions of the Bus Status Register (IBSR0, IBSR1)
The bus status register (IBSR0, IBSR1) has the following functions:
• Bus busy detection
• Re-activation condition detection
• Arbitration loss detection
• Acknowledgement detection
• Data transfer direction indication
• Addressing detection as slave
• General call address detection
• Address data transfer detection
■ Bit Function of the Bus Status Register (IBSR0, IBSR1)
This register is read-only. All bits of this register is controlled by hardware. All the bits are cleared when
the interface is not enabled (EN=0 in ICCR).
Figure 21.2-2 shows the bit configuration of the bus status register (IBSR0, IBSR1).
518
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 21 I2C INTERFACE (400 kHz)
21.2 Registers of I2C Interface
MB90340E Series
Figure 21.2-2 Bit Configuration of Bus Status Register (IBSR0, IBSR1)
Address:
bit 7
IBSR0: 007970H
IBSR1: 007980H
6
5
4
3
2
1
0
BB RSC AL LRB TRX AAS GCA ADT
R
R
R
R
R
R
R
R
IBSR0/IBSR1
Initial value
00000000B
bit0
ADT
0
1
Address data transfer bit
Received data is not an address data
(or the bus is open)
Received data is an address data
bit1
General call address reception bit
GCA
0 No general call address is detected
1 General call address is detected
bit2
AAS
Slave addressing bit
0 No addressing as slave
1 Received data is an address data
bit3
TRX
Transmission bit
0 Data transmission is not in progress
1 Data transmission is in progress
bit4
LRB
Reception bit
0 Reception is detected
1 Reception is not detected
bit5
AL
Arbitration lost detection flag bit
0 Arbitration loss is not detected
1 Arbitration loss is detected during master transmission
bit6
RSC
Re-activation condition detection flag bit
0 Re-activation condition is not detected
1 Re-activation condition is detected (bus busy)
R
: Read only
bit7
BB
Bus busy detection fag bit
0 Stop condition is detected (bus idle)
1 Activation condition is detected (bus busy)
: Initial value
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
519
CHAPTER 21 I2C INTERFACE (400 kHz)
21.2 Registers of I2C Interface
MB90340E Series
Table 21.2-1 Functions of Bus Status Register (IBSR0, IBSR1) (1 / 2)
Bit name
Function
bit7
BB:
Bus busy flag bit
This bit indicates the state of the I2C bus.
"0": Stop condition is detected (bus idle)
"1": Activation condition is detected (bus busy)
This bit is set to "1" when the activation condition is detected. It is reset when the
stop condition is detected.
bit6
RSC:
Re-activation condition
detection bit
This bit indicates the state of the re-activation condition.
"0": Re-activation condition is not detected
"1": Bus busy, re-activation condition is detected
This bit is cleared when the address data transfer ends (ADT=0) or when the stop
condition is detected.
AL:
Arbitration loss flag bit
This bit indicates the state of the arbitration loss.
"0": Arbitration loss is not detected
"1": Arbitration loss occurs during master transmission
This bit is cleared when writing "0" to the INT bit or "1" to the MSS bit of the IBCR
register.
Arbitration loss occurs if:
• The transmission data does not match the data on the SDA line at the rising edge
of SCL pin.
• Another master generates a re-activation condition in the first bit of the data byte.
• The interface cannot generate an activation or stop condition because the SCL pin
line is driven to "L" by another slave device.
LRB:
Reception detection bit
This bit is used to store an acknowledgement message from the receiving device to
the transmitter.
"0": Reception is detected
"1": Reception is not detected
This bit is changed if the hardware receives bit9 (response bit), and cleared if an
activation or stop condition is detected.
TRX:
Transmission operation
indication bit
This bit indicates the transmission operation during the data transfer.
"0": Data is not transmitted
"1": Data is being transmitted
• This bit is set to "1" if:
- An activation condition occurs in master mode.
- The first byte has been transferred, and read access is executed in slave mode,
or the data is being sent in master mode.
• This bit is set to "0" if:
- The bus is idle (BB=0 in IBSR).
- An arbitration loss occurs.
- "1" is written to the SCC bit in the master interrupt status (MSS=1, INT=1).
- The MSS bit is cleared in the master interrupt status (MSS=1, INT=1).
- Interface is run in slave mode and the last transferred byte is not detected.
- Interface is run in slave mode and the data is being received.
- Interface is run in master mode and the data is being read from the slave.
bit5
bit4
bit3
520
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
MB90340E Series
CHAPTER 21 I2C INTERFACE (400 kHz)
21.2 Registers of I2C Interface
Table 21.2-1 Functions of Bus Status Register (IBSR0, IBSR1) (2 / 2)
Bit name
Function
bit2
AAS:
Slave addressing
detection bit
This bit indicates the state of the slave addressing detection.
"0": The interface is not specified as a slave
"1": The interface is specified as a slave
This bit is cleared when a (re-)activation or stop condition is detected. This bit is set
when either 7-bit or 10-bit slave address or both of the slave addresses are detected.
bit1
GCA:
General call address
detection bit
This bit indicates the state of the general call address (00H) detection.
"0": General call address is not detected
"1": General call address is detected
This bit is cleared when a (re-)activation or stop condition is detected.
ADT:
Address data transfer
detection bit
This bit indicates the state of the address data transfer detection.
"0": Received data is not an address data (or the bus is open)
"1": Received data is an address data
This bit is set to "1" if an activation condition is detected. It is cleared after the
second byte if the 10-bit slave address header along with the write access is detected.
Otherwise, it is cleared after the first byte.
"After the first or second byte" means the following:
• "0" is written to the MSS bit during master interrupt (MSS=1, INT=1 in IBCR).
• "1" is written to the SCC bit during master interrupt (MSS=1, INT=1 in IBCR).
• The INT bit is cleared.
• All the bytes start to be transferred if the interface is not used as a master or slave
for the current transfer.
bit0
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
521
CHAPTER 21 I2C INTERFACE (400 kHz)
21.2 Registers of I2C Interface
21.2.2
MB90340E Series
Bus Control Register (IBCR0, IBCR1)
This section explains the function of the bus control register (IBCR0, IBCR1).
■ Functions of Bus Control Register (IBCR0, IBCR1)
The bus control register (IBCR0, IBCR1) has the following functions:
• Interrupt enable
• Interrupt generation
• Bus error detection
• Re-activation condition generation
• Master/slave mode selection
• General call acknowledgement generation enable
• Data byte acknowledgement generation enable
■ Bit Function of Bus Control Register (IBCR0, IBCR1)
The write access to this register occurs only if INT=1 or the transfer is started. When the ACK bit or
GCAA bit is changed, the bus error can occur. Therefore, user cannot perform the write access to this
register during the transfer operation. All the bits except BER and BEIE are cleared if the interface is not
enabled (EN=0 in ICCR).
Figure 21.2-3 shows the bit configuration of the bus control register (IBCR0, IBCR1).
522
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 21 I2C INTERFACE (400 kHz)
21.2 Registers of I2C Interface
MB90340E Series
Figure 21.2-3 Bit Configuration of Bus Control Register (IBCR0, IBCR1)
bit 15
Address:
IBCR0: 007971H
IBCR1: 007981H
14
13
12
11
10
9
8
BER BEIE SCC MSS ACK GCAA INTE INT
IBCR0/IBCR1
Initial value
00000000B
R/W R/W W R/W R/W R/W R/W R/W
bit8
INT
0
1
Interrupt flag bit
See Table 21.2-2
bit9
Interrupt enable bit
INTE
Interrupt disable bit
0
Interrupt enable bit
1
bit10
General call address acknowledgement bit
GCCA
No acknowledgement occurs
0
Acknowledgement occurs
1
bit11
ACK
0
1
Data byte acknowledgement setting bit
No acknowledgement occurs when a data byte is
received
Acknowledgement occurs when a data byte is
received
bit12
Master/slave selection bit
MSS
Slave mode
0
1
Master mode
(See Table 21.2-2 for details)
bit13
Repeated activation condition generation bit
SCC
N/A
0
1
Repeated activation condition occurs during the
master transfer
bit14
Bus error interrupt enable bit
BEIE
Bus error interrupt disabled
0
Bus error interrupt enabled
1
bit15
BER
R/W
W
: Readable/writable
0
: Write only
1
Bus error flag bit
Writing
Bus error interrupt is
cleared
N/A
Reading
No error is detected
An error is detected
: Initial value
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
523
CHAPTER 21 I2C INTERFACE (400 kHz)
21.2 Registers of I2C Interface
MB90340E Series
Table 21.2-2 Functions of Bus Control Register (IBCR0, IBCR1) (1 / 3)
Bit name
Function
This bit is the bus error interrupt flag. The bit is set by hardware and cleared by user.
For a read-modify-write access, "1" is always read.
Write access
"0": Bus error interrupt flag is cleared
"1": N/A
Read access
"0": No bus error is detected
"1": One of the following error states is detected:
If this bit is set, the EN bit of the ICCR register is cleared. The I2C interface is
stopped, and data transfer is halted. All the bits of the IBSR and IBCR registers
except BER and BEIE are cleared. The BER bit must be cleared before the interface
is enabled again.
• This bit is set to "1" if:
- An activation or stop condition is detected at an illegal location during the
transfer of the address data or bit2 to bit9 (acknowledgement bits).
- The 10-bit address header with 10-bit read access is received before the 10-bit
write access is performed.
• When the interface is enabled during the transfer, the detection of the first two
conditions shown above is enabled after the first stop condition is received, in
order to prevent an incorrect bus error report from being issued.
bit15
BER:
Bus error flag bit
bit14
BEIE:
Bus error interrupt
enable bit
This bit enables the bus error interrupt. Only user can change this bit.
"0": Bus error interrupt disabled
"1": Bus error interrupt enabled
If this bit is set to "1", occurrence of interrupt is enabled when the BER bit is set to
"1".
SCC:
Re-activation condition
occurrence bit
This bit is used to generate the re-activation condition. This bit is write-only and "0"
is always read.
"0": N/A
"1": Re-activation condition occurs in the master transfer.
If "1" is written to this bit in master mode (MSS=1, INT=1), a re-activation condition
is generated and the INT bit is automatically cleared.
bit13
524
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
MB90340E Series
CHAPTER 21 I2C INTERFACE (400 kHz)
21.2 Registers of I2C Interface
Table 21.2-2 Functions of Bus Control Register (IBCR0, IBCR1) (2 / 3)
Bit name
bit12
bit11
bit10
bit9
Function
MSS:
Master/slave mode
selection bit
This bit is the master/slave mode selection bit. Only user can set this bit. It can be
cleared by both user and hardware.
"0": Enters the slave mode.
"1": Enters the master mode and generates an activation condition to send the data
byte of the address IDAR register.
This bit is cleared when arbitration loss occurs during master transmission.
If "0" is written to this bit during setting a master interrupt (MSS=1, INT=1), the INT
bit is automatically cleared and a stop condition is generated to end the data transfer.
Note that the MSS bit is immediately reset and the stop condition can be checked by
polling the BB bit of the IBSR register.
• If "1" is written to this bit when the bus is idle (MSS=0, BB=0), an activation
condition is generated and the content (address data) of the IDAR register is sent.
• If "1" is written to this bit while the bus is busy (BB=1, TRX=0 in IBSR; MSS=0
in IBCR), the interface waits for the bus to be open and starts transmission.
• If the interface is specified as a slave for the address that is accompanied by a
write access (data reception), the transmission starts after the transfer ends and the
bus is open again. If the interface is transmitting the data as a slave (AAS=1,
TRX=1 in IBSR), the data transmission does not start even if the bus is open
again. It is important to check whether the interface is specified as a slave
(AAS=1 in IBSR) for the address, whether the data transmission has ended
normally (MSS=1 in IBCR), or whether the data byte transmission has failed
(AL=1 in IBSR) at the next interrupt.
ACK:
Data byte
acknowledgement bit
This bit enables an acknowledgement generation when a data byte is received. Only
user can change this bit.
"0": Acknowledgement does not occur when a data byte is received.
"1": Acknowledgement occurs when a data byte is received.
This bit is disabled when an address byte is received in slave mode. If the interface
detects a 7-bit or 10-bit slave address, it acknowledges whether the corresponding
enable bits (ITMK ENTB or ISMK ENTB) are set.
The write access to this bit occurs only if an interrupt is in progress (INT=1) or the
bus is idle (BB=0 in the IBSR register).
The write access to this bit is available only if the interface is enabled (EN=1 in the
ICCR register) and no bus error occurs (BER=0 in the IBCR register).
GCAA:
General call address
acknowledgement bit
This bit enables the acknowledgement generation when a general call address is
detected. Only user can change this bit.
"0": Acknowledgement does not occur when a general call address is detected.
"1": Acknowledgement occurs when a general call address is detected.
The write access to this bit occurs only if an interrupt is in progress (INT=1) or the
bus is idle (BB=0 in the IBSR register).
The write access to this bit is available only if the interface is enabled (EN=1 in the
ICCR register) and no bus error occurs (BER=0 in the IBCR register).
INTE:
Interrupt enable bit
This bit enables an interrupt generation. Only user can change this bit.
"0": Interrupts disabled
"1": Interrupt enabled
If this bit is set to "1", occurrence of interrupt is enabled when the INT bit is set to
"1" by hardware.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
525
CHAPTER 21 I2C INTERFACE (400 kHz)
21.2 Registers of I2C Interface
MB90340E Series
Table 21.2-2 Functions of Bus Control Register (IBCR0, IBCR1) (3 / 3)
bit8
526
Bit name
Function
INT:
Interrupt flag bit
This bit is the transfer end interrupt request flag. This bit is changed by hardware and
can be cleared by user. For a read-modify-write access, "1" is always read.
Write access
"0": Clears the transfer end interrupt request flag
"1": N/A
Read access
"0": The transfer is not ended, not related to the current transfer, or the bus is idle
"1": This bit is set to "1" when a 1-byte data transmission/reception, including an
acknowledgement bit, is completed, if the following conditions are met:
• Device is a bus master
• Device is specified as a slave for the address
• General call address was received
• Arbitration loss occurred
If the device is specified as a slave for the address, this bit is set after the address data
is received, including an acknowledgement bit (after the first byte for the 7-bit
address reception, or after the second byte for the 10-bit address reception).
If this bit is set to "1", the SCL line is maintained at the "L" level. If "0" is written to
this bit, the settings are cleared. Then, the SCL pin line is opened to transfer the next
byte, and a re-activation or stop condition is generated. This bit is cleared when "1" is
written to the SCC bit or the MSS bit is cleared.
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 21 I2C INTERFACE (400 kHz)
21.2 Registers of I2C Interface
MB90340E Series
■ Contention of SCC, MSS, and INT Bits
If data is simultaneously written to the SCC, MSS, and INT bits, contention occurs among the next-byte
transfer, re-activation condition generation, and stop condition generation. If this situation occurs, the
priorities are as follows:
• Next-byte transfer and stop condition generation: When "0" is written to the INT bit and "0" is written to
the MSS bit, writing of the MSS bit has precedence and a stop condition is generated.
• Next-byte transfer and re-activation condition generation: When "0" is written to the INT bit and "1" is
written to the SCC bit, writing of the SCC bit has precedence. A re-activation condition is generated,
and the content of the IDAR register is transmitted.
• Re-activation condition generation and stop condition generation: When "1" is written to the SCC bit
and "0" is written to the MSS bit, clearing of the MSS bit has precedence. A stop condition is generated
and the interface enters the slave mode.
When an instruction that generates a start condition is executed (set "1" to the MSS bit) at timing as shown
in Figure 21.2-4 and Figure 21.2-5, an arbitration loss detection (AL bit = 1) prevents an interrupt (INT bit
= 1) from being generated.
• Condition 1 in which an interrupt (INT bit = 1) does not occur upon detection of AL bit = 1
When an instruction that generates a start condition is executed (set "1" to the MSS bit in the IBCR
register) with no start condition detected (BB bit = 0) and with the SDA or SCL pin at the "L" level.
Figure 21.2-4 Diagram of Timing at Which an Interrupt Does Not Occur upon Detection of AL Bit = 1
SCL pin
"L"
SDA pin
"L"
1
I2C operation enable state (EN bit = 1)
Master mode setting (MSS bit = 1)
Arbitration loss detection (AL bit)
Bus busy (BB bit)
0
Interrupt (INT bit)
CM44-10143-5E
0
FUJITSU SEMICONDUCTOR LIMITED
527
CHAPTER 21 I2C INTERFACE (400 kHz)
21.2 Registers of I2C Interface
MB90340E Series
• Condition 2 in which an interrupt (INT bit = 1) does not occur upon detection of AL bit = 1
When an instruction that generates a start condition by enabling an I2C operation (EN bit = 1) is
executed (set "1" to the MSS bit in the IBCR register) with the I2C bus occupied by another master.
This is because, as shown in Figure 21.2-5, when the other master on the I2C bus starts communication
with I2C disabled (EN bit = 0), the I2C bus enters the occupied state with no start condition detected
(BB bit = 0).
Figure 21.2-5 Diagram of Timing at which an Interrupt does not Occur upon Detection of AL Bit = 1
Start condition
The INT bit interrupt does not
occur in the 9th clock cycle
Stop condition
SCL pin
SDA pin
Slave address
ACK
DAT
ACK
EN bit
MSS bit
AL bit
BB bit
0
0
INT bit
If a symptom as described above can occur, follow the procedure shown below for software processing:
1) Execute the instruction that generates a start condition (set "1" to the MSS bit)
2) Use, for example, the timer function to wait for the time for 3-bit data transmission at the I2C transfer
frequency set in the ICCR register.*
Example: I2C transfer frequency of 100 kHz
Time for 3-bit data transmission {1/(100 × 103)} × 3 = 30
3) Check the AL and BB bits in the IBSR register and, if the AL bit =1 and BB bit = 0, set the EN bit in
the ICCR register to "0" to initialize I2C. When AL bit is not "1" and BB bit is not "0", perform normal
processing.
528
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 21 I2C INTERFACE (400 kHz)
21.2 Registers of I2C Interface
MB90340E Series
A sample flow is given below:
Master mode setting
Set "1" to the MSS bit in the bus control register (IBCR)
Wait for the time for 3-bit data transmission at the I2C transfer
frequency set in the clock control register (ICCR)*
NO
BB bit = 0 and AL bit = 1
YES
Set the EN bit to "0" to initialize I2C
To normal process
*: If an arbitration loss is detected, the AL bit is "1" after the time for 3-bit data transmission at the I2C
transfer frequency has elapsed when the MSS bit is set to "1".
• Example in which an interrupt (INT bit = 1) occurs upon detection of AL bit = 1
When an instruction which generates a start condition is executed (setting "1" to the MSS bit) with "bus
busy" detected (BB bit = 1) and arbitration is lost, the INT bit interrupt occurs upon detection of AL bit
= 1.
Figure 21.2-6 Diagram of Timing at which an Interrupt Occurs upon Detection of AL Bit = 1
Start condition
Interrupt at the 9th clock
SCL pin
SDA pin
Slave address
ACK
DAT
EN bit
MSS bit
AL bit
Clear AL bit by software
BB bit
INT bit
CM44-10143-5E
Open SCL pin
clearing INT bit by software
FUJITSU SEMICONDUCTOR LIMITED
529
CHAPTER 21 I2C INTERFACE (400 kHz)
21.2 Registers of I2C Interface
21.2.3
MB90340E Series
10-Bit Slave Address Register
(ITBAH0/ITBAH1, ITBAL0/ITBAL1)
This register (ITBAH0/ITBAH1, ITBAL0/ITBAL1) specifies the 10-bit slave address.
■ Functions of 10-Bit Slave Address Register (ITBAH0/ITBAH1, ITBAL0/ITBAL1)
Write access to this register is available only if the interface is not enabled (EN=0 in ICCR).
Figure 21.2-7 shows the bit configuration of the 10-bit slave address register (ITBAH0/ITBAH1,
ITBAL0/ITBAL1).
Figure 21.2-7 Bit Configuration of 10-Bit Slave Address Register (ITBAH0/ITBAH1, ITBAL0/ITBAL1)
Address:
bit 15
14
13
12
11 10
ITBAH0: 007973 H
ITBAH1: 007983 H
9
8
TA9 TA8
R/W R/W
Address:
ITBAL0: 007972H
ITBAL1: 007982H
bit 7
6
5
4
3
2
1
0
ITBAH0/ITBAH1 (Upper)
Initial value
00000000B
ITBAL0/ITBAL1 (Lower)
TA7 TA6 TA5 TA4 TA3 TA2 TA1 TA0
Initial value
R/W R/W R/W R/W R/W R/W R/W R/W
00000000B
R/W : Readable/writable
— : Undefined
Table 21.2-3 Functions of 10-Bit Slave Address Register (ITBAH0/ITBAH1, ITBAL0/ITBAL1)
Bit name
bit15
to
bit10
bit9
to
bit0
Function
Undefined
"0" is always read from these bits.
TA9 to TA0:
10-bit slave address bits
If a 10-bit address is enabled (ENTB=1 in the ITMK register), the address data is
received in the slave mode and then compared with the ITBA register. An
acknowledgement is sent to the master after the address header of a 10-bit*1 with
write access is received. Then, 2nd received byte is compared with the ITBAL
register. If a match is detected, an acknowledgement signal is sent to the master
device and the AAS bit is set.
In addition, the interface generates a positive response when it receives the 10-bit
header*2 with read access after a re-activation condition is generated.
All bits of the slave address can be masked using the ITMK register. The received
10-bit slave address is written back to the ITBA register. This is valid only when the
AAS bit of the IBSR register is set to "1".
*
1: The bit sequence for the 10-bit header (write access) consists of 11110, TA9, TA8, and 0.
2: The bit sequence for the 10-bit header (read access) consists of 11110, TA9, TA8, and 1.
*
530
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 21 I2C INTERFACE (400 kHz)
21.2 Registers of I2C Interface
MB90340E Series
21.2.4
10-Bit Slave Address Mask Register (ITMK0, ITMK1)
This register includes the 10-bit slave address mask and 10-bit slave address enable bit.
■ Functions of 10-Bit Slave Address Mask Register (ITMK0, ITMK1)
Figure 21.2-8 shows the bit configuration of the 10-bit slave address mask register (ITMK0, ITMK1).
Figure 21.2-8 Bit Configuration of 10-Bit Slave Address Mask Register (ITMK0, ITMK1)
Address:
bit 15
14
13
12
11
10
9
8
ITMKH0/ITMKH1 (Upper)
Initial value
ITMKH0: 007975H
ITMKH1: 007985H
ENTB RAL
TM9 TM8
R/W R/W
R/W R/W
bit 7
Address:
ITMKL0: 007974H
ITMKL1: 007984H
6
5
4
3
2
1
0
TM7 TM6 TM5 TM4 TM3 TM2 TM1 TM0
00111111B
ITMKL0/ITMKL1 (Lower)
Initial value
11111111B
R/W R/W R/W R/W R/W R/W R/W R/W
R/W : Readable/writable
— : Undefined
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
531
CHAPTER 21 I2C INTERFACE (400 kHz)
21.2 Registers of I2C Interface
MB90340E Series
Table 21.2-4 Functions of 10-Bit Slave Address Mask Register (ITMK0, ITMK1)
Bit name
Function
ENTB:
10-bit slave address
enable bit
This bit enables a 10-bit slave address (and the reception response). Write access to
this bit is available only if the interface is not enabled (EN=0 in ICCR).
"0": 10-bit slave address disabled
"1": 10-bit slave address enabled
bit14
RAL:
Reception slave address
length
This bit indicates whether the interface is specified as a 7-bit or 10-bit slave for the
address. This bit is read-only.
"0": Specified as a 7-bit slave for the address
"1": Specified as a 10-bit slave for the address
If both the 10-bit and 7-bit slave addresses are enabled (ENTB=1, ENSB=1), this bit
can be used to determine whether the interface is specified as a 7-bit or 10-bit slave
for the address. The content is valid only if the AAS bit of the IBSR register is set to
"1". This bit is reset when the interface is disabled (EN=0 in ICCR).
bit13
to
bit10
Undefined
"1" is always read from these bits.
TM:
10-bit slave address
mask bits
This register is used to mask the 10-bit slave address of the interface. Write access to
these bits is available only if the interface is disabled (EN=0 in ICCR).
"0": Bits are not used for comparison of slave addresses
"1": Bits are used for comparison of slave addresses
These bits can be used to make the interface check for multiple 10-bit slave
addresses. Only the bit set as "1" in this register is used for comparison of 10-bit
slave addresses. The received slave address is written back to the ITBA register. The
slave address can be determined by reading the ITBA register when the AAS bit of
the IBSR register is "1".
Note:
If the address mask is changed after the interface is enabled, the slave address that
was previously received can be overwritten and the slave address should be set
again.
bit15
bit9
to
bit0
532
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 21 I2C INTERFACE (400 kHz)
21.2 Registers of I2C Interface
MB90340E Series
21.2.5
7-Bit Slave Address Register (ISBA0, ISBA1)
This register specifies the 7-bit slave address.
■ Functions of 7-Bit Slave Address Register (ISBA0, ISBA1)
Write access to this register is available only if the interface is not enabled (EN=0 in ICCR).
Figure 21.2-9 shows the bit configuration of the 7-bit slave address register (ISBA0, ISBA1).
Figure 21.2-9 Bit Configuration of 7-Bit Slave Address Register (ISBA0, ISBA1)
bit 7
Address:
ISBA0: 007976H
ISBA1: 007986H
6
5
4
3
2
1
0
ISBA0/ISBA1
SA6 SA5 SA4 SA3 SA2 SA1 SA0
R/W R/W R/W R/W R/W R/W R/W
Initial value
00000000B
R/W : Readable/writable
— : Undefined
Table 21.2-5 Functions of 7-Bit Slave Address Register (ISBA0, ISBA1)
Bit name
bit7
bit6
to
bit0
Function
Undefined
"0" is always read from this bit.
SA6 to SA0:
7-bit slave address bits
If a 7-bit address is enabled (ENSB=1 in the ISMK register), the address data is
received in the slave mode and then compared with the ISBA register. If a match is
detected, an acknowledgement signal is sent to the master device and the AAS bit is
set.
All bits of the slave address can be masked using the ISMK register. The received 7bit slave address is written back to the ISBA register. This is valid only when the
AAS bit of the IBSR register is set to "1".
The interface does not compare the received data and the content of this register
when a 10-bit header or a general call is received.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
533
CHAPTER 21 I2C INTERFACE (400 kHz)
21.2 Registers of I2C Interface
21.2.6
MB90340E Series
7-Bit Slave Address Mask Register (ISMK0, ISMK1)
This register includes the 7-bit slave address mask (ISMK0, ISMK1) and 7-bit mode
enable bit.
■ Functions of 7-Bit Slave Address Mask Register (ISMK0, ISMK1)
Write access to this register is available only if the interface is not enabled (EN=0 in ICCR).
Figure 21.2-10 shows the bit configuration of the 7-bit slave address mask register (ISMK0, ISMK1).
Figure 21.2-10 Bit Configuration of 7-Bit Slave Address Mask Register (ISMK0, ISMK1)
Address:
bit 15 14 13 12 11 10 9
8
ISMK0: 007977H
ISMK1: 007987H ENSB SM6 SM5 SM4 SM3 SM2 SM1 SM0
R/W R/W R/W R/W R/W R/W R/W R/W
ISMK0/ISMK1
Initial value
01111111B
R/W : Readable/writable
Table 21.2-6 Functions of 7-Bit Slave Address Mask Register (ISMK0, ISMK1)
Bit name
bit15
bit14
to
bit8
534
Function
ENSB:
7-bit address enable bit
This bit enables a 7-bit slave address (and the reception response).
0: 7-bit slave address disabled
1: 7-bit slave address enabled
SM:
7-bit slave address mask
bits
This register is used to mask the 7-bit slave address of the interface.
0: Bits are not used for comparison of slave addresses
1: Bits are used for comparison of slave addresses
These bits can be used to make the interface check for multiple 7-bit slave addresses.
Only the bit set as "1" in this register is used for comparison of 7-bit slave addresses.
The received slave address is written back to the ISBA register. The slave address
can be determined by reading the ISBA register when the AAS bit of the IBSR
register is "1".
Note:
If the address mask is changed after the interface is enabled, the slave address that
was previously received can be overwritten and the slave address should be set
again.
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 21 I2C INTERFACE (400 kHz)
21.2 Registers of I2C Interface
MB90340E Series
21.2.7
Data Register (IDAR0, IDAR1)
Data register (IDAR0, IDAR1) is used for the serial data transfer.
■ Functions of Data Register (IDAR0, IDAR1)
Figure 21.2-11 shows the bit configuration of the data register (IDAR0, IDAR1).
Figure 21.2-11 Bit Configuration of Data Register (IDAR0, IDAR1)
bit 7
Address:
IDAR0: 007978H
IDAR1: 007988H
6
D7 D6
5
4
3
2
1
0
D5 D4 D3 D2 D1 D0
R/W R/W R/W R/W R/W R/W R/W R/W
IDAR0/IDAR1
Initial value
00000000B
R/W : Readable/writable
Table 21.2-7 Functions of Data Register (IDAR0, IDAR1)
Bit name
bit7
to
bit0
D7 to D0:
Data bits
CM44-10143-5E
Function
The data register is used for serial data transfer. Data from MSB is transferred first.
Since the writing side of this register is configured as double buffers, the data written
when the bus is being used (BB=1) is loaded into the register for serial transfer.
When the INT bit of the IBCR register is cleared or the bus is idle (BB=0 in IBSR),
the data byte is loaded into the internal transfer register. Since the internal register is
directly read during reading, the received data value in this register is valid only if
INT=1 in the IBCR register.
FUJITSU SEMICONDUCTOR LIMITED
535
CHAPTER 21 I2C INTERFACE (400 kHz)
21.2 Registers of I2C Interface
21.2.8
MB90340E Series
Clock Control Register (ICCR0, ICCR1)
The clock control register (ICCR0, ICCR1) has the following functions:
• Test mode enable
• I/O pad noise filter enable
• I2C interface operation enable
• Serial clock frequency setting
■ Functions of Clock Control Register (ICCR0, ICCR1)
Figure 21.2-12 shows the bit configuration of the clock control register (ICCR0, ICCR1).
Figure 21.2-12 Bit Configuration of Clock Control Register (ICCR0, ICCR1)
Address:
ICCR0: 00797BH
ICCR1: 00798BH
bit 15
14
13
12
11
10
9
8
ICCR0/ICCR1
NSF EN CS4 CS3 CS2 CS1 CS0
Initial value
R/W R/W R/W R/W R/W R/W R/W
00011111B
R/W : Readable/writable
— : Undefined
536
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 21 I2C INTERFACE (400 kHz)
21.2 Registers of I2C Interface
MB90340E Series
Table 21.2-8 Functions of Clock Control Register (ICCR0, ICCR1)
Bit name
bit15
bit14
bit13
Function
Undefined
"0" is always read from this bit.
NSF:
I/O pad noise filter
enable bit
This bit enables the noise filter built in the SDA and SCL I/O pad.
0: Noise filter disabled
1: Noise filter enabled
This noise filter controls the single spike from the pulse width 0ns (minimum) to 1 to
1.5 cycles (maximum) of the internal bus. The maximum width of the spike wave
that can be controlled is determined by the phase relationship between the I2C signal
(SDA, SCL) and the machine clock. This bit should be set to "1" if the interface
transmits/receives the data at speed of 100 kbps or more.
EN:
Enable bit
This bit enables the operation of the I2C interface. Only user can set this bit. It can be
cleared by both user and hardware.
0: Interface disabled
1: Interface enabled
If this bit is set to "0", all bits of the IBSR and IBCR registers (except the BER and
BEIE bits) are cleared.
The module operation is disabled and the I2C line remains open. This bit is cleared
by hardware if the bus error occurs (BER=1 in IBCR).
Notes:
• If the interface is disabled, the transmission/reception is immediately stopped.
In this case, the I2C bus can be put in unfavorable situation.
• When the operation of the I2C interface is prohibited, sending and receiving is
stopped at once.
• Please prohibit operating after confirming the generation of the stop condition
(BB=0 of IBSR) when you prohibit the operation of the I2C interface after
written "0" to the MSS bit and the stop condition is generated (EN=0 of ICCR).
These bits set the serial bit transfer speed. These bits can be changed only if the
interface is disabled (EN=0) or the EN bit is cleared simultaneously at the time of
writing.
n
1
bit12
to
bit8
CS4 to CS0:
Clock prescaler bits
CS4 CS3 CS2 CS1 CS0
0
0
0
0
1 Bit rate: φ/28 (+1)
2
0
0
0
1
0
Bit rate: φ/40 (+1)
3
0
0
0
1
1
Bit rate: φ/52 (+1)
4
0
0
1
0
0
Bit rate: φ/64 (+1)
…
31
1
1
1
1
1
Bit rate: φ/400 (+1)
(+1): If the noise filter is enabled, add 1 to the divisor.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
537
CHAPTER 21 I2C INTERFACE (400 kHz)
21.2 Registers of I2C Interface
MB90340E Series
■ Clock Prescaler Setting
The values of CS0 to CS4 are calculated using the following formula:
φ
n × 12 + 16
φ
Bit rate =
n × 12 + 17
Bit rate =
n>0, φ: Machine clock, noise filter disabled
n>0, φ: Machine clock, noise filter disabled
Table 21.2-9 Prescaler Setting
n
CS4
CS3
CS2
CS1
CS0
1
0
0
0
0
1
2
0
0
0
1
0
3
0
0
0
1
1
1
1
1
•
31
Note:
1
•
•
1
Do not use n=0 for the prescaler setting, because it is a violation against the SDA/SCL timing.
■ General Clock Frequency
Table 21.2-10 shows the general machine clock frequency and the transmission bit transfer speed by the
prescaler setting.
Table 21.2-10 Relationship Between Prescaler Setting Value and Transmission Bit Transfer Speed
100 kbps
(Noise filter disabled)
Machine Clock
[MHz]
538
400 kbps
(Noise filter enabled)
n
Bit Transfer Speed
[kbps]
n
Bit Transfer Speed
[kbps]
24
19
98
4
369
20
16
96
3
377
16
12
100
2
390
40/3=13.3
10
98
2
325
12
9
96
2
292
64/6=10.6
8
94
1
367
10
7
100
1
344
8
6
90
1
275
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
MB90340E Series
21.3
Operations of I2C Interface
CHAPTER 21 I2C INTERFACE (400 kHz)
21.3 Operations of I2C Interface
The I2C bus consists of two bidirectional bus lines used for communication: one serial
data line (SDA) and one serial clock line (SCL). The I2C interface has two corresponding
open-drain I/O pins (SDA/SCL), enabling wired logic.
■ Activation Condition
If "1" is written to the MSS bit when the bus is open (BB=0 in IBSR, MSS=0 in IBCR) to place the I2C
interface in master mode and to generate an activation condition.
If "1" is written to this bit when the bus is idle (MSS=0, BB=0), an activation condition is generated and
the content (address data) of the IDAR register is sent.
If "1" is written to the SCC bit during interrupt when the bus is run in the master mode (MSS=1, INT=1 in
IBCR), a re-activation condition can be generated.
If "1" is written to the MSS bit when the bus is busy (BB=1, TRX=0 in IBSR; MSS=0, INT=0 in IBCR),
the interface waits for the bus to be open and starts transmission.
If the interface is specified as a slave for the address that is accompanied by a write access (data reception),
the transmission starts after the transfer ends and the bus is open again. If the interface is transmitting the
data as a slave, the data transmission does not start even if the bus is open again. It is important to check
whether the interface is specified as a slave (MSS=0 in IBCR, AAS=1 in IBSR) for the address, whether
the data byte transmission has ended normally (MSS=1 in IBCR), or whether the data byte transmission has
failed (AL=1 in IBSR) at the next interrupt.
Otherwise, writing "1" to the MSS or SCC bit has no effect.
■ Stop Condition
If "0" is written to the MSS bit in master mode (MSS=1, INT=1 in IBCR) to generate a stop condition and
to place the device in slave mode. Otherwise, writing "1" to the MSS bit has no effect.
After the MSS bit is cleared, the interface tries to generate a stop condition. However, a stop condition will
fail to be generated if the SCL line is driven to the "L" level. An interrupt is generated after the next byte is
transferred.
■ Slave Address Detection
In slave mode, BB is set to "1" after an activation condition is generated. The data sent from the master
device is received by the IDAR register.
After the 8-bit data is received, the content of the IDAR register is compared to the ISBA register using the
bit mask stored in ISMK if the ENSB bit in the ISMK register is "1". If the comparison result is a match,
the AAS bit is set to "1" and the acknowledgement signal is sent to the master. Then, bit0 of the received
data (bit0 of the IDAR register) is inverted and stored in the TRX bit.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
539
CHAPTER 21 I2C INTERFACE (400 kHz)
21.3 Operations of I2C Interface
MB90340E Series
If the ENTB bit in the ITMK register is "1" and the 10-bit address header (11110, TA9, TA8, 0) is detected,
the interface sends an acknowledgement signal to the master and stores the last inverted data bit in the TRX
register. No interrupt occurs. Then, the transferred byte is compared to the low-order byte of the ITBA
register (using the bit mask stored in ITMK). If the result is a match, an acknowledgement signal is sent to
the master, the AAS bit is set to "1", and an interrupt occurs.
If the interface has been specified as a slave for the address and a re-activation condition is detected, the
AAS bit is set to "1" and an interrupt occurs after the 10-bit address header (11110, TA9, TA8, 1) is
received.
10-bit and 7-bit addresses and its bit masks have its own registers. Setting "1" to the ENSB bit of ISMK
and the ENTB bit of ITMK enables the interface to check both of the addresses. The received slave address
length can be determined whether to be 7 bits or 10 bits by reading the RAL bit of the ITMK register (this
bit is valid only if the AAS bit is set to "1").
If the interface is to be used only as a master, set both of the bits to "0" can prevent a slave address from
being given to the interface.
All the slave address bits can be masked by setting the corresponding mask register (ITMK or ISMK).
■ Slave Address Mask
Only the bits set to "1" in the mask register (ITMK/ISMK) can be used for the address comparison. Other
bits are all ignored. The received slave address can be read from the ITBA register (RAL=1: for a 10-bit
address) or the ISBA register (RAL=0: for a 7-bit address) if the AAS bit is "1" in the IBSR register.
If the bit mask is cleared, the interface can be used as the bus monitor because it is always specified as a
slave for the address. Note that this feature does not become a real bus monitor because it generates an
acknowledgement when a slave address is received even though no other slave device is available.
■ Slave Addressing
In master mode, the BB and TRX bits are set to "1" after an activation condition is generated. The content
of the IDAR register is sent starting with MSB first. When an acknowledgement signal is received from the
slave device after the address data is sent, bit0 (bit0 of the IDAR register that is already sent) of the sent
data is inverted and stored in the TRX bit. The acknowledgement response of the slave can be checked
using the LRB bit of the IBSR register. This procedure also applies to the re-activation condition.
2 bytes must be sent for a 10-bit slave address for write access. The first byte is the 10-bit address header
consisting of 11110, TA9, TA8, 0, and the second byte that follows includes the low-order 8 bits of the 10bit slave address (TA7 to TA0).
The 10-bit slave is accessed for read, when the above byte sequence is sent and a re-activation condition
(SCC bit of IBCR) is generated as well as the read access 10-bit address header (11110, TA9, TA8, 1).
540
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 21 I2C INTERFACE (400 kHz)
21.3 Operations of I2C Interface
MB90340E Series
The address data bytes can be summarized as follows:
• 7-bit slave, write access : Activation condition - TA6 TA5 TA4 TA3 TA2 TA1 TA0 0
• 7-bit slave, read access : Activation condition - TA6 TA5 TA4 TA3 TA2 TA1 TA0 1
• 10-bit slave, write access: Activation condition - 1 1 1 1 0 TA9 TA8 0 - TA7 TA6 TA5 TA4 TA3 TA2
TA1 TA0
• 10-bit slave, read access : Activation condition - 1 1 1 1 0 TA9 TA8 1 - TA7 TA6 TA5 TA4 TA3 TA2
TA1 TA0 - re-activation - 1 1 1 1 0 TA9 TA8 1
■ Arbitration
If other master device is sending the data simultaneously when the data is being sent in the master mode,
the arbitration will occur. If the device sends the data value "1" and the data on the SDA line is the "L"
level, the device assumes arbitration to have been lost and sets the AL bit to "1". The AL bit is set to "1"
when neither an activation condition nor a stop condition can be generated for any reason even if the
interface detects an activation condition in the first bit of the data byte.
If the arbitration loss is detected, the MSS and TRX bits are cleared and the device enters the slave mode,
and it can determine that its own arbitration loss occurs when the device's slave address is sent.
■ Acknowledgement
The acknowledgement bit is sent from the receiver to the sender. The ACK bit of the IBCR register can be
used to specify whether an acknowledgement is sent when the data byte is received.
Even if an acknowledgement is not returned from the master during data transmission in slave mode (read
access from other master), the TRX bit is set to "0" and the device enters the reception mode. This allows
the master to generate a stop condition when the slave releases the SCL line.
In master mode, an acknowledgement from the slave can be checked by reading the LRB bit of the IBSR
register.
Note:
General call address transmission cannot be used in multi-master mode.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
541
CHAPTER 21 I2C INTERFACE (400 kHz)
21.4 Programming Flowcharts
21.4
MB90340E Series
Programming Flowcharts
This section provides programming example for transmission and reception to use the
I2C interface (400 kHz) module.
■ Example of Slave Addressing and Data Transmission
Figure 21.4-1 shows the sample flowcharts for the slave addressing and data transmission.
Figure 21.4-1 Sample Flowcharts for Slave Addressing and Data Transmission
7-bit slave addressing
Data transmission
Start
Start
Specify the writing
slave for the address
Clear the BER bit (if it is 1)
Interface enabled EN=1
IDAR = Data byte;
INT = 0
IDAR: = sl.address<<1+RW;
MSS : = 1; INT : = 0
NO
INT=1?
NO
INT=1?
YES
YES
YES
BER = 1?
YES Bus error
BER = 1?
NO
NO
AL = 1?
YES
ACK?
(LRB = 0?)
Transfer
resumed.
Check
whether it
is AAS
AL = 1?
YES
Transfer
resumed.
Check
whether it
is AAS
NO
ACK?
(LRB = 0?)
NO
NO
YES
YES
Data transmission
ready
The
last byte
transmitted?
YES
NO
No ACK from the slave.
Generate a re-activation
or stop condition
Transfer completed.
Re-activation condition
or stop condition
generated
542
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 21 I2C INTERFACE (400 kHz)
21.4 Programming Flowcharts
MB90340E Series
■ Example of Data Reception
Figure 21.4-2 shows the sample flowchart for the data reception.
Figure 21.4-2 Sample Flowchart for Data Reception
Start
Specify the reading slave for the address
Clear the ACK bit of IBCR if the data is
the last byte to be read from the slave;
INT: = 0
NO
INT = 1?
YES
BER= 1?
YES
Bus error
NO
NO
The
last byte
transmitted?
YES
Transfer completed.
Re-activation condition
or stop condition
generated
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
543
CHAPTER 21 I2C INTERFACE (400 kHz)
21.4 Programming Flowcharts
MB90340E Series
■ Example of Interrupt Handler
Figure 21.4-3 shows the sample flowchart for the interrupt handler.
Figure 21.4-3 Sample Flowchart for Interrupt Handler
Start
INT=1?
Interrupt
reception
from another
module
NO
YES
Bus error
BER = 1?
YES
GCA = 1?
YES
General call as
slave
NO
NO
YES
YES
AL = 1?
Record the transfer failure
and retry the transfer
YES
AAS = 1?
AL = 1?
NO
YES
Arbitration
loss.
Transfer
resumed
NO
No ACK from
the slave
YES Generate a
LRB = 1?
re-activation
or stop
condition
ADT = 1?
NO
Start to transfer new
data upon the next
INT.
If required, change
the ACK bit
NO
TRX = 1?
TRX = 1?
YES
YES
NO
NO
Read received byte
from the IDAR
register. If required,
change the ACK bit
Store the next sent
byte to the IDAR
register
Read received byte
from the IDAR
register. If required,
change the ACK bit
Store the next sent
byte to the IDAR
register or clear
MSS
Clear the INT bit
End
544
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 22
CAN CONTROLLER
This chapter explains the functions and overview of the
CAN controller.
22.1 Features of CAN Controller
22.2 Block Diagram of CAN Controller
22.3 List of Overall Control Registers
22.4 Classifying the CAN Controller Registers
22.5 Transmission of CAN Controller
22.6 Reception of CAN Controller
22.7 Reception Flowchart of CAN Controller
22.8 How to Use the CAN Controller
22.9 Procedure for Transmission by Message Buffer (x)
22.10 Procedure for Reception by Message Buffer (x)
22.11 Setting Configuration of Multi-level Message Buffer
22.12 Setting the Redirection of CAN1 RX/TX pin
22.13 CAN Direct Mode Register (CDMR)
22.14 Precautions when Using CAN Controller
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
545
CHAPTER 22 CAN CONTROLLER
22.1 Features of CAN Controller
22.1
MB90340E Series
Features of CAN Controller
The CAN (Controller Area Network) is the standard protocol for serial communication
between automobile controllers and is widely used in industrial applications.
■ Features of CAN Controller
● Conforms to CAN Specification Version 2.0 Part A and B
Supports transmission/reception in standard frame and extended frame formats
● Supports transmitting of data frames by receiving remote frames
● 16 transmitting/receiving message buffers
29-bit ID and 8-byte data
Multi-level message buffer configuration
● Supports full-bit comparison, full-bit mask and partial bit mask filtering.
Two acceptance mask registers in either standard frame format or extended frame formats
● Bit rate programmable from 10 kbps to 1 Mbps (A minimum 8 MHz machine clock is required if 1 Mbps
is used)
546
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 22 CAN CONTROLLER
22.2 Block Diagram of CAN Controller
MB90340E Series
22.2
Block Diagram of CAN Controller
Figure 22.2-1 shows a block diagram of the CAN controller.
■ Block Diagram of CAN Controller
Figure 22.2-1 Block Diagram of CAN Controller
TQ (Operating clock)
F2MC-16LX bus
Prescaler
1 to 64 frequency division
Clock
Bit timing generation
SYNC, TSEG1, TSEG2
PSC
TS1
BTR
TS2
RSJ
TOE
TS
RS
CSR
HALT
NIE
NT
Node status change
interrupt generation
IDLE, SUSPND,
transmit, receive,
ERR, OVRLD
Bus state
machine
Node status
change interrupt
NS1, 0
Error
control
RTEC
Tr ansmitting/receiving
sequencer
BVALR
TREQR
TBFx clear
Tr ansmitting
buffer x decision
TBFx
Data
counter
Error frame
generation
Acceptance
filter control
Overload
frame
generation
TDLC RDLC
TBFx
IDSEL
BITER, STFER,
CRCER, FRMER,
ACKER
TCANR
Output
driver
ARBLOST
TX
TRTRR
TCR
Stuffing
Tr ansmission
shift register
RFWTR
TBFx, set, clear
Tr ansmission
complete
interrupt
Tr ansmission complete
interrupt generation
TDLC
TIER
CRC
generation
ACK
generation
CRCER
RBFx, set
RDLC
RCR
Reception
complete
interrupt
Reception complete
interrupt generation
RIER
RBFx, TBFx, set, clear
STFER
CRC generation/error
check
Receive shift
register
Destuffing/stuffing
error check
RRTRR
RBFx, set
IDSEL
ROVRR
ARBLOST
AMSR
AMR0
0
1
Acceptance
filter
Receiving buffer x
decision
BITER
Bit error
check
ACKER
Acknowledgment
error check
AMR1
IDR0 to IDR15,
DLCR0 to
DLCR15,
DTR0 to DTR15
RAM
RBFx
RAM address
generation
Arbitration
check
FRMER
Form error
check
PH1
Input
latch
RX
RBFx, TBFx, RDLC, TDLC, IDSEL
LEIR
LDER
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
547
CHAPTER 22 CAN CONTROLLER
22.3 List of Overall Control Registers
22.3
MB90340E Series
List of Overall Control Registers
Table 22.3-1 to Table 22.3-4 list the overall control registers, the message buffers (ID
registers), and the message buffers (DLC registers and data registers).
■ List of Overall Control Registers
Table 22.3-1 List of Overall Control Registers (1 / 2)
Address
Register
548
CAN0
CAN1
CAN2
000070H
000080H
0000E0H
000071H
000081H
0000E1H
000072H
000082H
0000E2H
000073H
000083H
0000E3H
000074H
000084H
0000E4H
000075H
000085H
0000E5H
000076H
000086H
0000E6H
000077H
000087H
0000E7H
000078H
000088H
0000E8H
000079H
000089H
0000E9H
00007AH
00008AH
0000EAH
00007BH
00008BH
0000EBH
00007CH
00008CH
0000ECH
00007DH
00008DH
0000EDH
00007EH
00008EH
0000EEH
00007FH
00008FH
0000EFH
007B00H
007D00H
007F00H
007B01H
007D01H
007F01H
007B02H
007D02H
007F02H
007B03H
007D03H
007F03H
007B04H
007D04H
007F04H
007B05H
007D05H
007F05H
007B06H
007D06H
007F06H
007B07H
007D07H
007F07H
007B08H
007D08H
007F08H
007B09H
007D09H
007F09H
Abbreviation
Access
Message buffer
valid register
BVALR
R/W
00000000 00000000
Transmit request
register
TREQR
R/W
00000000 00000000
Transmit cancel
register
TCANR
W
00000000 00000000
Transmit complete
register
TCR
R/W
00000000 00000000
Receive complete
register
RCR
R/W
00000000 00000000
Remote request
receiving register
RRTRR
R/W
00000000 00000000
Receive overrun
register
ROVRR
R/W
00000000 00000000
Receive interrupt
enable register
RIER
R/W
00000000 00000000
Control status
register
CSR
R/W, R
00XXX000 0XXXX0X1
Last event
indicator register
LEIR
R/W
XXXXXXXX 000X0000
Receive/Transmit
error counter
RTEC
R
00000000 00000000
Bit timing
register
BTR
R/W
X1111111 11111111
IDE register
IDER
R/W
XXXXXXXX XXXXXXXX
FUJITSU SEMICONDUCTOR LIMITED
Initial Value
CM44-10143-5E
CHAPTER 22 CAN CONTROLLER
22.3 List of Overall Control Registers
MB90340E Series
Table 22.3-1 List of Overall Control Registers (2 / 2)
Address
Register
CAN0
CAN1
CAN2
007B0AH
007D0AH
007F0AH
007B0BH
007D0BH
007F0BH
007B0CH
007D0CH
007F0CH
007B0DH
007D0DH
007F0DH
007B0EH
007D0EH
007F0EH
007B0FH
007D0FH
007F0FH
007B10H
007D10H
007F10H
007B11H
007D11H
007F11H
007B12H
007D12H
007F12H
007B13H
007D13H
007F13H
007B14H
007D14H
007F14H
007B15H
007D15H
007F15H
007B16H
007D16H
007F16H
007B17H
007D17H
007F17H
007B18H
007D18H
007F18H
007B19H
007D19H
007F19H
007B1AH
007D1AH
007F1AH
007B1BH
007D1BH
007F1BH
Abbreviation
Access
Initial Value
Transmit RTR
register
TRTRR
R/W
00000000 00000000
Remote frame
receive waiting
register
RFWTR
R/W
XXXXXXXX XXXXXXXX
Transmit
interrupt enable
register
TIER
R/W
00000000 00000000
XXXXXXXX XXXXXXXX
Acceptance mask
select register
AMSR
R/W
XXXXXXXX XXXXXXXX
XXXXXXXX XXXXXXXX
Acceptance mask
register 0
AMR0
R/W
XXXXXXXX XXXXXXXX
XXXXXXXX XXXXXXXX
Acceptance mask
register 1
AMR1
R/W
XXXXXXXX XXXXXXXX
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
549
CHAPTER 22 CAN CONTROLLER
22.3 List of Overall Control Registers
MB90340E Series
■ List of Message Buffers (ID Registers)
Table 22.3-2 List of Message Buffers (ID Registers) (1 / 3)
Address
CAN0
CAN1
CAN2
007A00H
to
007A1FH
007C00H
to
007C1FH
007E00H
to
007E1FH
007A20H
007C20H
007E20H
007A21H
007C21H
007E21H
007A22H
007C22H
007E22H
007A23H
007C23H
007E23H
007A24H
007C24H
007E24H
007A25H
007C25H
007E25H
007A26H
007C26H
007E26H
007A27H
007C27H
007E27H
007A28H
007C28H
007E28H
007A29H
007C29H
007E29H
007A2AH
007C2AH
007E2AH
007A2BH
007C2BH
007E2BH
007A2CH
007C2CH
007E2CH
007A2DH
007C2DH
007E2DH
007A2EH
007C2EH
007E2EH
007A2FH
007C2FH
007E2FH
007A30H
007C30H
007E30H
007A31H
007C31H
007E31H
007A32H
007C32H
007E32H
007A33H
007C33H
007E33H
007A34H
007C34H
007E34H
007A35H
007C35H
007E35H
007A36H
007C36H
007E36H
007A37H
007C37H
007E37H
Register
Abbreviation
Access
Generalpurpose RAM
--
R/W
Initial Value
XXXXXXXX
to
XXXXXXXX
XXXXXXXX XXXXXXXX
ID register 0
IDR0
R/W
XXXXXXXX XXXXXXXX
XXXXXXXX XXXXXXXX
ID register 1
IDR1
R/W
XXXXXXXX XXXXXXXX
XXXXXXXX XXXXXXXX
ID register 2
IDR2
R/W
XXXXXXXX XXXXXXXX
XXXXXXXX XXXXXXXX
ID register 3
IDR3
R/W
XXXXXXXX XXXXXXXX
XXXXXXXX XXXXXXXX
ID register 4
IDR4
R/W
XXXXXXXX XXXXXXXX
XXXXXXXX XXXXXXXX
ID register 5
IDR5
R/W
XXXXXXXX XXXXXXXX
550
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 22 CAN CONTROLLER
22.3 List of Overall Control Registers
MB90340E Series
Table 22.3-2 List of Message Buffers (ID Registers) (2 / 3)
Address
Register
CAN0
CAN1
CAN2
007A38H
007C38H
007E38H
007A39H
007C39H
007E39H
007A3AH
007C3AH
007E3AH
007A3BH
007C3BH
007E3BH
007A3CH
007C3CH
007E3CH
007A3DH
007C3DH
007E3DH
007A3EH
007C3EH
007E3EH
007A3FH
007C3FH
007E3FH
007A40H
007C40H
007E40H
007A41H
007C41H
007E41H
007A42H
007C42H
007E42H
007A43H
007C43H
007E43H
007A44H
007C44H
007E44H
007A45H
007C45H
007E45H
007A46H
007C46H
007E46H
007A47H
007C47H
007E47H
007A48H
007C48H
007E48H
007A49H
007C49H
007E49H
007A4AH
007C4AH
007E4AH
007A4BH
007C4BH
007E4BH
007A4CH
007C4CH
007E4CH
007A4DH
007C4DH
007E4DH
007A4EH
007C4EH
007E4EH
007A4FH
007C4FH
007E4FH
007A50H
007C50H
007E50H
007A51H
007C51H
007E51H
007A52H
007C52H
007E52H
007A53H
007C53H
007E53H
007A54H
007C54H
007E54H
007A55H
007C55H
007E55H
007A56H
007C56H
007E56H
007A57H
007C57H
007E57H
Abbreviation
Access
Initial Value
XXXXXXXX XXXXXXXX
ID register 6
IDR6
R/W
XXXXXXXX XXXXXXXX
XXXXXXXX XXXXXXXX
ID register 7
IDR7
R/W
XXXXXXXX XXXXXXXX
XXXXXXXX XXXXXXXX
ID register 8
IDR8
R/W
XXXXXXXX XXXXXXXX
XXXXXXXX XXXXXXXX
ID register 9
IDR9
R/W
XXXXXXXX XXXXXXXX
XXXXXXXX XXXXXXXX
ID register 10
IDR10
R/W
XXXXXXXX XXXXXXXX
XXXXXXXX XXXXXXXX
ID register 11
IDR11
R/W
XXXXXXXX XXXXXXXX
XXXXXXXX XXXXXXXX
ID register 12
IDR12
R/W
XXXXXXXX XXXXXXXX
XXXXXXXX XXXXXXXX
ID register 13
IDR13
R/W
XXXXXXXX XXXXXXXX
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
551
CHAPTER 22 CAN CONTROLLER
22.3 List of Overall Control Registers
MB90340E Series
Table 22.3-2 List of Message Buffers (ID Registers) (3 / 3)
Address
Register
CAN0
CAN1
CAN2
007A58H
007C58H
007E58H
007A59H
007C59H
007E59H
007A5AH
007C5AH
007E5AH
007A5BH
007C5BH
007E5BH
007A5CH
007C5CH
007E5CH
007A5DH
007C5DH
007E5DH
007A5EH
007C5EH
007E5EH
007A5FH
007C5FH
007E5FH
Abbreviation
Access
Initial Value
XXXXXXXX XXXXXXXX
ID register 14
IDR14
R/W
XXXXXXXX XXXXXXXX
XXXXXXXX XXXXXXXX
ID register 15
IDR15
R/W
XXXXXXXX XXXXXXXX
552
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 22 CAN CONTROLLER
22.3 List of Overall Control Registers
MB90340E Series
■ List of Message Buffers (DLC Registers)
Table 22.3-3 List of Message Buffers (DLC Registers)
Address
CM44-10143-5E
CAN0
CAN1
CAN2
007A60H
007C60H
007E60H
007A61H
007C61H
007E61H
007A62H
007C62H
007E62H
007A63H
007C63H
007E63H
007A64H
007C64H
007E64H
007A65H
007C65H
007E65H
007A66H
007C66H
007E66H
007A67H
007C67H
007E67H
007A68H
007C68H
007E68H
007A69H
007C69H
007E69H
007A6AH
007C6AH
007E6AH
007A6BH
007C6BH
007E6BH
007A6CH
007C6CH
007E6CH
007A6DH
007C6DH
007E6DH
007A6EH
007C6EH
007E6EH
007A6FH
007C6FH
007E6FH
007A70H
007C70H
007E70H
007A71H
007C71H
007E71H
007A72H
007C72H
007E72H
007A73H
007C73H
007E73H
007A74H
007C74H
007E74H
007A75H
007C75H
007E75H
007A76H
007C76H
007E76H
007A77H
007C77H
007E77H
007A78H
007C78H
007E78H
007A79H
007C79H
007E79H
007A7AH
007C7AH
007E7AH
007A7BH
007C7BH
007E7BH
007A7CH
007C7CH
007E7CH
007A7DH
007C7DH
007E7DH
007A7EH
007C7EH
007E7EH
007A7FH
007C7FH
007E7FH
Register
Abbreviation
Access
DLC register 0
DLCR0
R/W
XXXXXXXX
DLC register 1
DLCR1
R/W
XXXXXXXX
DLC register 2
DLCR2
R/W
XXXXXXXX
DLC register 3
DLCR3
R/W
XXXXXXXX
DLC register 4
DLCR4
R/W
XXXXXXXX
DLC register 5
DLCR5
R/W
XXXXXXXX
DLC register 6
DLCR6
R/W
XXXXXXXX
DLC register 7
DLCR7
R/W
XXXXXXXX
DLC register 8
DLCR8
R/W
XXXXXXXX
DLC register 9
DLCR9
R/W
XXXXXXXX
DLC register 10
DLCR10
R/W
XXXXXXXX
DLC register 11
DLCR11
R/W
XXXXXXXX
DLC register 12
DLCR12
R/W
XXXXXXXX
DLC register 13
DLCR13
R/W
XXXXXXXX
DLC register 14
DLCR14
R/W
XXXXXXXX
DLC register 15
DLCR15
R/W
XXXXXXXX
FUJITSU SEMICONDUCTOR LIMITED
Initial Value
553
CHAPTER 22 CAN CONTROLLER
22.3 List of Overall Control Registers
MB90340E Series
■ List of Message Buffers (Data Registers)
Table 22.3-4 List of Message Buffers (Data Register) (1 / 2)
Address
554
Register
Abbreviation
Access
007E80H
to
007E87H
Data register 0
(8 bytes)
DTR0
R/W
XXXXXXXX
to
XXXXXXXX
007C88H
to
007C8FH
007E88H
to
007E8FH
Data register 1
(8 bytes)
DTR1
R/W
XXXXXXXX
to
XXXXXXXX
007A90H
to
007A97H
007C90H
to
007C97H
007E90H
to
007E97H
Data register 2
(8 bytes)
DTR2
R/W
XXXXXXXX
to
XXXXXXXX
007A98H
to
007A9FH
007C98H
to
007C9FH
007E98H
to
007E9FH
Data register 3
(8 bytes)
DTR3
R/W
XXXXXXXX
to
XXXXXXXX
007AA0H
to
007AA7H
007CA0H
to
007CA7H
007EA0H
to
007EA7H
Data register 4
(8 bytes)
DTR4
R/W
XXXXXXXX
to
XXXXXXXX
007AA8H
to
007AAFH
007CA8H
to
007CAFH
007EA8H
to
007EAFH
Data register 5
(8 bytes)
DTR5
R/W
XXXXXXXX
to
XXXXXXXX
007AB0H
to
007AB7H
007CB0H
to
007CB7H
007EB0H
to
007EB7H
Data register 6
(8 bytes)
DTR6
R/W
XXXXXXXX
to
XXXXXXXX
007AB8H
to
007ABFH
007CB8H
to
007CBFH
007EB8H
to
007EBFH
Data register 7
(8 bytes)
DTR7
R/W
XXXXXXXX
to
XXXXXXXX
007AC0H
to
007AC7H
007CC0H
to
007CC7H
007EC0H
to
007EC7H
Data register 8
(8 bytes)
DTR8
R/W
XXXXXXXX
to
XXXXXXXX
007AC8H
to
007ACFH
007CC8H
to
007CCFH
007EC8H
to
007ECFH
Data register 9
(8 bytes)
DTR9
R/W
XXXXXXXX
to
XXXXXXXX
007AD0H
to
007AD7H
007CD0H
to
007CD7H
007ED0H
to
007ED7H
Data register 10
(8 bytes)
DTR10
R/W
XXXXXXXX
to
XXXXXXXX
007AD8H
to
007ADFH
007CD8H
to
007CDFH
007ED8H
to
007EDFH
Data register 11
(8 bytes)
DTR11
R/W
XXXXXXXX
to
XXXXXXXX
007AE0H
to
007AE7H
007CE0H
to
007CE7H
007EE0H
to
007EE7H
Data register 12
(8 bytes)
DTR12
R/W
XXXXXXXX
to
XXXXXXXX
007AE8H
to
007AEFH
007CE8H
to
007CEFH
007EE8H
to
007EEFH
Data register 13
(8 bytes)
DTR13
R/W
XXXXXXXX
to
XXXXXXXX
CAN0
CAN1
CAN2
007A80H
to
007A87H
007C80H
to
007C87H
007A88H
to
007A8FH
FUJITSU SEMICONDUCTOR LIMITED
Initial Value
CM44-10143-5E
CHAPTER 22 CAN CONTROLLER
22.3 List of Overall Control Registers
MB90340E Series
Table 22.3-4 List of Message Buffers (Data Register) (2 / 2)
Address
CM44-10143-5E
Register
Abbreviation
Access
007EF0H
to
007EF7H
Data register 14
(8 bytes)
DTR14
R/W
XXXXXXXX
to
XXXXXXXX
007EF8H
to
007EFFH
Data register 15
(8 bytes)
DTR15
R/W
XXXXXXXX
to
XXXXXXXX
CAN0
CAN1
CAN2
007AF0H
to
007AF7H
007CF0H
to
007CF7H
007AF8H
to
007AFFH
007CF8H
to
007CFFH
FUJITSU SEMICONDUCTOR LIMITED
Initial Value
555
CHAPTER 22 CAN CONTROLLER
22.4 Classifying the CAN Controller Registers
22.4
MB90340E Series
Classifying the CAN Controller Registers
There are three types of CAN controller registers:
• Overall control registers
• Message buffer control registers
• Message buffers
■ Overall Control Registers
The overall control registers are the following four registers:
• Control status register (CSR)
• Last event indicator register (LEIR)
• Receive and transmit error counter (RTEC)
• Bit timing register (BTR)
■ Message Buffer Control Registers
The message buffer control registers are the following 14 registers:
• Message buffer valid register (BVALR)
• IDE register (IDER)
• Transmission request register (TREQR)
• Transmission RTR register (TRTRR)
• Remote frame receiving wait register (RFWTR)
• Transmission cancel register (TCANR)
• Transmission complete register (TCR)
• Transmission interrupt enable register (TIER)
• Reception complete register (RCR)
• Remote request receiving register (RRTRR)
• Receive overrun register (ROVRR)
• Reception interrupt enable register (RIER)
• Acceptance mask select register (AMSR)
• Acceptance mask registers 0 and 1 (AMR0 and AMR1)
■ Message Buffers
The message buffers are the following three registers:
• ID register x (x = 0 to 15) (IDR0 to IDR15)
• DLC register x (x = 0 to 15) (DLCR0 to DLCR15)
• Data register x (x = 0 to 15) (DTR0 to DTR15)
556
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 22 CAN CONTROLLER
22.4 Classifying the CAN Controller Registers
MB90340E Series
22.4.1
Configuration of Control Status Register (CSR)
The register indicates bus operation, node status, transmit output enable and transmit/
receive status. The lower 8 bits with the control status register (CSR) is prohibited from
executing any bit manipulation instructions (Read-Modify-Write instructions). Only in
the case of HALT bits unchanged, use any bit manipulation instructions without
problems (initialization of the macro instructions etc.).
■ Control Status Register (CSR) (Lower)
Figure 22.4-1 Control Status Register (Lower) (CSR: L)
Address:
bit 7
CAN0: 007B00 H
CAN1: 007D00H
CAN2: 007F00 H
6
5
4
3
2
1
0
TOE
-
-
-
-
NIE
Reserved
HALT
R/W
-
-
-
-
CSRn (lower)
Initial value
0 X X X X 0 X 1B
R/W W R/W
bit 0
HALT
Bus Operation stop bit
0
Write: Cancels bus operation stop
Read: Bus operation not in stop mode
1
Write: Stops bus operation
Read: Bus operation in stop mode
bit 1
Reserved
0
bit 2
NIE
Reserved bit
Do not write "1" to this bit
Node status transition interrupt output enable bit
0
Node status transition interrupt output disabled bit
1
Node status transition interrupt output enabled bit
bit 7
R/W
:
Readable/writable
W
:
Write only
X
:
Undefined value
-
:
Undefined
:
Initial value
CM44-10143-5E
TOE
Tr ansmit output enable bit
0
General-purpose I/O port
1
Transmit pin TX
n = 0, 1, 2
FUJITSU SEMICONDUCTOR LIMITED
557
CHAPTER 22 CAN CONTROLLER
22.4 Classifying the CAN Controller Registers
MB90340E Series
■ Control Status Register (CSR) (Upper)
Figure 22.4-2 Configuration of the Control Status Register (Upper) (CSR: H)
Address:
bit 15
CAN0: 007B01 H
CAN1: 007D01H
CAN2: 007F01 H
14
13
12
11
TS
RS
-
-
-
R
R
-
-
-
10
9
8
NT NS1 NS0
R/W R
CSRn (upper)
Initial value
00XXX000B
R
bit 9
NS1
bit 8
NS0
Node Status bits
0
0
Error active
0
1
Warning (error active)
1
0
Error passive
0
0
Bus off
bit 10
NT
Node status transition flag
0
No node status transition
1
Node status transition
bit 14
RS
Receive status bit
0
Message not being received
1
Message being received
bit 15
TS
558
R/W
:
Readable/writable
R
:
Read only
X
:
Undefined value
-
:
Undefined
:
Initial value
Tr ansmit status bit
0
Message not being transmitted
1
Message being transmitted
n = 0, 1, 2
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 22 CAN CONTROLLER
22.4 Classifying the CAN Controller Registers
MB90340E Series
22.4.2
Function of Control Status Register (CSR)
The operating status of the register’s each bit is confirmed by following;
• Setting "0" or "1"
• Function control by writing
• Read
■ Control Status Register (CSR) (Lower)
Table 22.4-1 Function of the Control Status Register (lCSR: L) (1 / 2)
Bit name
Function
bit7
TOE:
Transmit output
enable bit
This bit switches from a general-purpose I/O port to a transmit pin TX.
When setting to "0": General-purpose I/O port
When setting to "1": transmit pin TX
bit6 to bit3
Undefined bits
When reading: Value is undefined.
When writing: No effect
bit2
NIE:
Node status
transition
interrupt output
enable bit
This bit controls a node status transition interrupt generation when a node status is
transferred (CSR: NT = 1).
When setting to "0": Interrupt generation is disabled.
When setting to "1": Interrupt generation is enabled.
bit1
Reserved;
Reserved bit
This bit is always set to "0".
When reading: The value is always "0".
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
559
CHAPTER 22 CAN CONTROLLER
22.4 Classifying the CAN Controller Registers
MB90340E Series
Table 22.4-1 Function of the Control Status Register (lCSR: L) (2 / 2)
Bit name
Function
This bit controls the bus halt. The halt state of the bus can be checked by reading this
bit.
Writing to this bit
0: Cancels bus halt
1: Halt bus
Reading this bit
0: Bus operation not in stop state
1: Bus operation in stop state
bit0
560
HALT:
Bus operation
stop bit
Note:
When write 0 to this bit during the node status is Bus Off, ensure that 1 is written to this
bit.
Example program:
switch ( IO_CANCT0.CSR.bit.NS )
{
case 0 : /* error active */
break;
case 1 : /* warning */
break;
case 2 : /* error passive */
break;
default : /* bus off */
for ( i=0; ( i <= 500 ) &&( IO_CANCT0.CSR.bit.HALT == 0); i++);
IO_CANCT0.CSR.word = 0x0084; /* HALT = 0 */
break;
}
* The variable "i" is used for fail-safe.
For details, see Section "22.4.3 Notes on Using Bus Operation Stop Bit
(HALT = 1)"
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 22 CAN CONTROLLER
22.4 Classifying the CAN Controller Registers
MB90340E Series
■ Control Status Register (CSR) Upper
Table 22.4-2 Function of the Control Status Register (CSR: H)
Bit name
bit15
bit14
bit13 to
bit11
bit10
bit9, bit8
Function
TS:
Transmit status
bit
This bit indicates whether a message is being transmitted.
When reading:
"0": Message not being transmitted
"1": Message being transmitted
This bit is "0" even while error and overload frames are transmitted.
RS:
Receive status bit
This bit indicates whether a message is being received.
When reading:
"0": Message not being received
"1": Message being received
While a message is on the bus, this bit becomes "1". Therefore, this bit is also "1" while
a message is being transmitted. This bit does not necessarily indicates whether a
receiving message passes through the acceptance filter.
As a result, when this bit is "0", it implies that the bus operation is stopped (HALT = 0);
the bus is in the intermission/bus idle or a error/overload frame is on the bus.
Undefined bits
When reading: Value is undefined.
When writing: No effect
NT:
Node status
transition flag
If the node status is changed to increment, or from Bus Off to Error Active, this bit is set
to "1". The condition that this bit is set to "1" as follows. At this time, the interrupt is
generated for the node status interruption permission bit (NIE) = 1.
Warning (01B)
1) Error active (00B) →
Error passive (10B)
2) Warning (01B) →
3) Error passive (10B) →
Bus off (11B)
Error active (00B)
4) Bus off (11B) →
(Note: In parentheses, the value of the NS1 and NS0 bits is indicated.)
At Write:
"0": Cleared
"1": Not possible to set (No effect)
At Read by the read-modify-write instruction
Always read "1".
NS1, NS0:
Node status bits
These bits indicate the current node status via the combination.
See Section "22.4.3 Notes on Using Bus Operation Stop Bit (HALT = 1)" for details.
Table 22.4-3 Correspondence between NS1 and NS0 and Node Status
CM44-10143-5E
NS1
NS0
Node Status
0
0
Error active
0
1
Warning (error active)
1
0
Error passive
1
1
Bus off
FUJITSU SEMICONDUCTOR LIMITED
561
CHAPTER 22 CAN CONTROLLER
22.4 Classifying the CAN Controller Registers
MB90340E Series
Note:
Warning (error active) is included in the error active in CAN Specification 2.0B for the node status,
however, indicates that the transmit error counter or receive error counter has exceeded 96. The
node status transition diagram is shown in Figure 22.4-3.
Figure 22.4-3 Node Status Transition Diagram
Hardware reset
REC: Receive error counter
TEC: Transmit error counter
Error active
REC ≥ 96
or
TEC ≥ 96
REC < 96
and
TEC < 96
REC ≥ 128
or
TEC ≥ 128
Warning
(Error active)
After "0" has been written to the HALT bit of
the control status register (CSR),
continuous 11-bit High levels (recessive
bits) are input 128 times to the receive
input pin (RX).
REC < 128
and
TEC < 128
Error
passive
562
TEC ≥ 256
Bus off
(HALT =1)
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 22 CAN CONTROLLER
22.4 Classifying the CAN Controller Registers
MB90340E Series
22.4.3
Notes on Using Bus Operation Stop Bit (HALT = 1)
The bus operation stop bit is set by writing to the bit, hardware reset and the node
status. The stop operation of the bus operation is different according to the state of the
message buffer.
■ Conditions for Setting Bus Operation Stop (HALT = 1)
There are three conditions for setting bus operation stop (HALT = 1):
• Hardware reset
• When node status changed to bus off
• By writing "1" to HALT bit
Note:
The bus operation should be stopped by writing 1 to HALT before the F2MC-16LX is changed in lowpower consumption mode (stop mode and clock mode).
If transmission is in progress when "1" is written to HALT, the bus operation is stopped (HALT = 1)
after transmission is terminated. If reception is in progress when "1" is written to HALT, the bus
operation is stopped immediately (HALT = 1). If received messages are being stored in the message
buffer (x), stop the bus operation (HALT = 1) after storing the messages.
To check whether the bus operation has stopped, always read the HALT bit.
■ Conditions for Canceling Bus Operation Stop (HALT = 0)
• The condition for cancelling the bus operation stop (HALT=0) is writing "0" to HALT.
Notes:
• Canceling the bus operation stop after hardware reset or by writing "1" to HALT as above
conditions is performed after "0" is written to HALT and continuous 11-bit "H" levels (recessive
bits) have been input to the receive input pin (RX).
• Canceling the bus operation stop when the node status is changed to bus off as above conditions
is performed after "0" is written to HALT and continuous 11-bit "H" levels (recessive bits) have
been input 128 times to the receive input pin (RX). Then, the values of both transmit and receive
error counters reach "0" and the node status is changed to error active.
• When write "0" to HALT bit during the node status is Bus Off, ensure that "1" is written to this bit.
■ State during Bus Operation Stop (HALT = 1)
• The bus does not perform any operation, such as transmission and reception.
• The transmit output pin (TX) outputs a "H" level (recessive bit).
• The values of other registers and error counters are not changed.
Note:
The bit timing register (BTR) should be set during bus operation stop (HALT = 1).
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
563
CHAPTER 22 CAN CONTROLLER
22.4 Classifying the CAN Controller Registers
22.4.4
MB90340E Series
Last Event Indicator Register (LEIR)
This register indicates the last event.
The NTE, TCE, and RCE bits are exclusive. When the corresponding bit of the last event
is set to "1", other bits are set to "0s".
■ Last Event Indicator Register (LEIR)
Figure 22.4-4 Last Event Indicator Register (LEIR)
Address:
bit 7
CAN0: 007B02 H
CAN1: 007D02H
CAN2: 007F02 H
6
5
4
3
2
1
0
NTE TCE RCE
-
MBP3 MBP2 MBP1 MBP0
R/W R/W R/W
-
R/W R/W R/W R/W
LEIRn
Initial value
0 0 0 X 0 0 0 0B
bit 3
bit 2
bit 1
bit 0
MBP3
MBP2
MBP1
MBP0
0000BB to 1111B (initial value: "0000B")
Message buffer
pointer bits
Message Buffer
0 to 15
bit 5
RCE
Receive completion event bit
Read
Write
0
The last event has not received.
Bit cleared
1
The last event has received.
No effect
bit 6
TCE
Transmit completion event bit
Read
Write
0
The last event has not transmitted.
Bit cleared
1
The last event has transmitted.
No effect
bit 7
NTE
Node status transition event bit
Read
R/W
:
Readable/writable
X
:
Undefined value
-
:
Undefined
:
Initial value
Write
0
The last event is not node
status transmitted.
Bit cleared
1
The last event is node status
transmitted.
No effect
n = 0, 1, 2
564
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 22 CAN CONTROLLER
22.4 Classifying the CAN Controller Registers
MB90340E Series
■ Function of Last Event Indicator Register (LEIR)
Table 22.4-4 Function of Each Bit of the Last Event Indicator Register (1 / 2)
Bit name
Function
NTE:
Node status
transition event
bit
When this bit is "1", node status transition is the last event.
This bit is set to "1" after set either of bit of the control status register to "1"
(CSR:NTx=1).
This setting is not related to the setting of NIE bit of the control status register (CSR).
At Write:
"0": Cleared
"1": No effect
At read by the read-modify-write instruction:
Always read "1".
TCE:
Transmit
completion event
bit
When this bit is "1", it indicates that transmit completion is the last event.
This bit is set to "1" after set either of bit of the transmit completion register to "1"
(TCR:TCx=1).
• This setting is not related to the setting of the transmit complete interrupt enable
register (TIER).
• When this bit is "1", MBP3 to MBP0 bits show the message buffer number (x) to
complete the transmission of the message in the last event.
At Write:
"0": Cleared
"1": No effect
At read by the read-modify-write instruction:
Always read "1".
bit5
RCE:
Receive
completion event
bit
When this bit is "1", it indicates that receive completion is the last event.
This bit is set to "1" after set either of bit of the receive complete register to "1"
(RCR:RC0-to-RC15=1).
• This setting is not related to the setting of the receive complete interrupt enable
register (RIER).
• When this bit is "1", MBP3 to MBP0 bits show the message buffer number (x) to
complete the reception of the message in the last event.
At Write:
"0": Cleared
"1": No effect
At read by the read-modify-write instruction:
Always read "1".
bit4
Undefined
When reading: The value is undefined.
When writing: No effect
bit7
bit6
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
565
CHAPTER 22 CAN CONTROLLER
22.4 Classifying the CAN Controller Registers
MB90340E Series
Table 22.4-4 Function of Each Bit of the Last Event Indicator Register (2 / 2)
Bit name
bit3 to bit0
566
MBP3, MBP2,
MBP1, MBP0
Function
When TCE bit or RCE bit is "1", these bits show the message buffer number (x) to
generating of the corresponding last event. If the NTE bit is set to "1", these bits have no
meaning.
At Write:
"0": Cleared
"1": No effect
At read by the read-modify-write instruction:
Always read "1".
Note: If LEIR is accessed within an CAN interrupt handling, the event causing the
interrupt is not necessarily the same as indicated by LEIR. In the time from
interrupt request to the LEIR access by the interrupt handler there may occur
other CAN events.
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 22 CAN CONTROLLER
22.4 Classifying the CAN Controller Registers
MB90340E Series
22.4.5
Receive and Transmit Error Counters (RTEC)
The receive and transmit error counters indicate the counts for transmission errors and
reception errors defined in the CAN specifications. These registers can only be read.
■ Receive and Transmit Error Counters (RTEC)
Figure 22.4-5 Receive and Transmit Error Counters
Address:
CAN0: 007B05 H
CAN1: 007D05H
CAN2: 007F05 H
Address:
CAN0: 007B04 H
CAN1: 007D04H
CAN2: 007F04 H
bit 15
14
13
12
11
10
9
8
RTECn (upper)
TEC7 TEC6 TEC5 TEC4 TEC3 TEC2 TEC1 TEC0
R
R
R
R
R
R
R
R
bit 7
6
5
4
3
2
1
0
RTECn (lower)
REC7 REC6 REC5 REC4 REC3 REC2 REC1 REC0
R
R
R
R
R
R
R
R
Initial value
00000000B
Initial value
0 0 0 0 0 0 0 0B
n = 0, 1, 2
R: Read only
■ Functions of Receive and Transmit Error Counters (RTEC)
Table 22.4-5 Function of the Receive and Transmit Error Counters (RTEC)
Bit name
Function
bit15 to bit8
TEC7 to TEC0:
Transmit error
counter bits
These are transmit error counters.
TEC7 to TEC0 values indicate 0 to 7 when the counter value is more than 256, and
the subsequent increment is not counted for counter value. In this case, Bus Off is
indicated for the node status (NS1 and NS0 of control status register CSR = 11B).
bit7 to bit0
REC7 to REC0:
Receive error
counter bits
These are receive error counters.
REC7 to REC0 values indicate 0 to 7 when the counter value is more than 256, and
the subsequent increment is not counted for counter value. In this case, Error
Passive is indicated for the node status (NS1 and NS0 of control status register CSR
= 10B).
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
567
CHAPTER 22 CAN CONTROLLER
22.4 Classifying the CAN Controller Registers
22.4.6
MB90340E Series
Bit Timing Register (BTR)
Bit timing register (BTR) stores the prescaler and bit timing setting.
■ Bit Timing Register (BTR)
Figure 22.4-6 Bit Timing Register (BTR)
Address:
bit 15
CAN0: 007B07 H
CAN1: 007D07H
CAN2: 007F07 H
Address:
R/W
X
13
12
11
10
9
8
-
TS2.2 TS2.1 TS2.0 TS1.3 TS1.2 TS1.1 TS1.0
-
R/W R/W R/W R/W R/W R/W R/W
bit 7
CAN0: 007B06 H
CAN1: 007D06H
CAN2: 007F06 H
14
6
5
4
3
2
1
0
RSJ1 RSJ0 PSC5 PSC4 PSC3 PSC2 PSC1 PSC0
R/W R/W R/W R/W R/W R/W R/W R/W
: Readable/Writable
: Undefined value
BTRn (upper)
Initial value
X 1 1 1 1 1 1 1B
BTRn (lower)
Initial value
11111111B
n = 0, 1, 2
■ Function of Bit Timing Register (BTR)
Table 22.4-6 Function of Each Bit of the Bit Timing Register (BTR)
Bit name
Function
bit14
to
bit12
TS2.2 to TS2.0:
Time segment 2
setting bits 2 to 0
These bits define the number of the time quanta (TQ’s) by dividing [(TS2.2 to TS2.0)
+1] for the time segment 2 (TSEG2). The time segment 2 is equal to the phase buffer
segment 2 (PHASE_SEG2) in the CAN specification.
bit11
to
bit8
TS1.3 to TS1.0:
Time segment 1
setting bits 3 to 0
These bits define the number of the time quanta (TQ’s) by dividing [(TS1.3 to TS1.0)+1]
for the time segment 1 (TSEG1). The time segment 1 is equal to the propagation segment
(PROP_SEG) + phase buffer segment 1 (PHASE_SEG1) in the CAN specification.
bit7
bit6
RSJ1, RSJ0:
Resynchronization
jump width setting
bits 1, 0
These bits define the number of the time quanta (TQ’s) by dividing [(RSJ1 to RSJ0)+1]
for the resynchronization jump width (RSJW).
bit5
to
bit0
PSC5 to PSC0:
Prescaler setting bits
5 to 0
These bits define the time quanta (TQ) of the CAN controller by dividing system clock.
Note:
Set bit timing register (BTR) after stopping the bus operation (CSR: HALT=1). Release the bus
operation stop by writing "0" in the HALT bit of the control status register after the setting of bit timing
register (BTR) is ended.
568
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 22 CAN CONTROLLER
22.4 Classifying the CAN Controller Registers
MB90340E Series
22.4.7
Prescaler Setting by Bit Timing Register (BTR)
The setting of bit timing register (BTR) corresponds to the bit time segments of
prescaler in the CAN specification and the CAN controller.
■ Prescaler Settings
The bit time segments defined in the CAN specification and the CAN controller are shown in Figure
22.4-7 and Figure 22.4-8 respectively.
Figure 22.4-7 Bit Time Segment in CAN Specification
Nominal bit time
SYNC_SEG
PROP_SEG
PHASE_SEG1 PHASE_SEG2
Sample point
Figure 22.4-8 Bit Time Segment in CAN Controller
Nominal bit time
SYNC_SEG
TSEG1
TSEG2
Sample point
The relationship between PSC = PSC5 to PSC0, TS1 = TS1.3 to TS1.0, TS2 = TS2.2 to TS2.0, and RSJ =
RSJ1, RSJ0 is shown below.
TQ
BT
= (PSC + 1) x CLK
= SYNC_SEG + TSEG1 + TSEG2
= (1 + (TS1 + 1) + (TS2 +1)) x TQ
= (3 + TS1 +TS2) x TQ
RSJW = (RSJ + 1) x TQ
CLK: input clock
TQ: time quanta
BT: bit time
SYNC_SEG: synchronous segment
TSEG1 and TSEG2: time segment 1 and 2
resynchronization jump width [(RSJ1 and RSJ0) +1] frequency division
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
569
CHAPTER 22 CAN CONTROLLER
22.4 Classifying the CAN Controller Registers
MB90340E Series
For correct operation, the following conditions should be met.
For 1
PSC
TSEG1
TSEG1
TSEG2
TSEG2
For PSC = 0
TSEG1
TSEG2
TSEG2
63
2TQ
RSJW
2TQ
RSJW
5TQ
2TQ
RSJW
In order to meet the bit timing requirements defined in the CAN specification, additions have to be met,
e.g. the delay time has to be considered.
570
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 22 CAN CONTROLLER
22.4 Classifying the CAN Controller Registers
MB90340E Series
22.4.8
Message Buffer Valid Register (BVALR)
Message buffer valid register (BVALR) sets the validity of the message buffers or
displays their state.
■ Message Buffer Valid Register (BVALR)
Figure 22.4-9 Message Buffer Valid Register (BVALR)
Address:
CAN0: 000071 H
CAN1: 000081 H
CAN2: 0000E1 H
bit 15
14
13
12
11
10
9
8
BVAL15 BVAL14 BVAL13 BVAL12 BVAL11 BVAL10 BVAL9 BVAL8
BVALRn (upper)
Initial value
00000000B
R/W R/W R/W R/W R/W R/W R/W R/W
Address:
CAN0: 000070 H
CAN1: 000080 H
CAN2: 0000E0 H
bit 7
6
5
4
3
2
1
0
BVAL7 BVAL6 BVAL5 BVAL4 BVAL3 BVAL2 BVAL1 BVAL0
R/W R/W R/W R/W R/W R/W R/W R/W
BVALRn (lower)
Initial value
00000000B
n = 0, 1, 2
R/W : Readable/Writable
■ Function of Message Buffer Valid Register (BVALR)
0: Message buffer (x) invalid
1: Message buffer (x) valid
If the message buffer (x) is set to invalid, it will not transmit or receive messages.
If the buffer is set to invalid during transmission operating, it becomes invalid (BVALx = 0) after the
transmission is completed or terminated by an error.
If the buffer is set to invalid during reception operating, it immediately becomes invalid (BVALx = 0). If
received messages are stored in a message buffer (x), the message buffer (x) is invalid after storing the
messages.
Note:
x indicates a message buffer number (x = 0 to 15).
When invaliding a message buffer (x) by writing "0" to a bit (BVALx), execution of a bit manipulation
instruction is prohibited until the bit is set to "0".
To invalidate the message buffer (by setting the BVALR: BVAL0 to BVAL15=0) while the CAN
controller is operating for CAN communication (the read value of the CSR: HALT bit is "0" and the
CAN controller is operating for CAN bus communication to enable transmission and reception),
follow the procedure in Section "22.14 Precautions when Using CAN Controller".
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
571
CHAPTER 22 CAN CONTROLLER
22.4 Classifying the CAN Controller Registers
22.4.9
MB90340E Series
IDE register (IDER)
This register sets the frame format used by the message buffers (x) during
transmission/reception.
■ IDE Register (IDER)
Figure 22.4-10 IDE Register (IDER)
Address:
bit 15
CAN0: 007B09 H
CAN1: 007D09H
CAN2: 007F09 H
14
13
12
11
10
9
8
IDE15 IDE14 IDE13 IDE12 IDE11 IDE10 IDE9 IDE8
IDERn(upper)
Initial value
XXXXXXXXB
R/W R/W R/W R/W R/W R/W R/W R/W
Address:
bit 7
CAN0: 007B08 H
CAN1: 007D08H
CAN2: 007F08 H
6
5
4
3
2
IDE7 IDE6 IDE5 IDE4 IDE3 IDE2
1
0
IDE1 IDE0
R/W R/W R/W R/W R/W R/W R/W R/W
IDERn (lower)
Initial value
X X X X X X X XB
R/W : Readable/Writable
X : Undefined value
n = 0, 1, 2
0: The standard frame format (ID11 bits) is used for the message buffer (x).
1: The extended frame format (ID29 bits) is used for the message buffer (x).
Note:
This register should be set when the message buffer (x) is invalid (BVALx of the message buffer
valid register (BVALR) = 0). Setting when the buffer is valid (BVALx = 1) may cause unnecessary
received messages to be stored.
To invalidate the message buffer (by setting the BVALR: BVAL0 to BVAL15=0) while the CAN
controller is operating for CAN communication (the read value of the CSR: HALT bit is "0" and the
CAN controller is operating for CAN bus communication to enable transmission and reception),
follow the procedure in Section "22.14 Precautions when Using CAN Controller".
572
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 22 CAN CONTROLLER
22.4 Classifying the CAN Controller Registers
MB90340E Series
22.4.10 Transmission Request Register (TREQR)
Transmission request register (TREQR) sets transmission requests to the message
buffers (x) or displays their state.
■ Transmission Request Register (TREQR)
Figure 22.4-11 Transmission Request Register (TREQR)
Address:
CAN0: 000073 H
CAN1: 000083 H
CAN2: 0000E3 H
bit 15
14
13
12
11
10
9
8
TREQ15 TREQ14 TREQ13 TREQ12 TREQ11 TREQ10 TREQ9 TREQ8
TREQRn (upper)
Initial value
0 0 0 0 0 0 0 0B
R/W R/W R/W R/W R/W R/W R/W R/W
Address:
CAN0: 000072 H
CAN1: 000082 H
CAN2: 0000E2 H
bit 7
6
5
4
3
2
1
0
TREQ7 TREQ6 TREQ5 TREQ4 TREQ3 TREQ2 TREQ1 TREQ0
R/W R/W R/W R/W R/W R/W R/W R/W
TREQRn (lower)
Initial value
0 0 0 0 0 0 0 0B
R/W : Readable/Writable
n = 0, 1, 2
■ Functions of Transmission Request Register (TREQR)
When "1" is written to TREQx, transmission to the message buffer (x) starts. If RFWTx of the remote
frame receiving wait register (RFWTR) *1 is "0", transmission starts immediately. However, if RFWTx = 1,
transmission starts after waiting until a remote frame is received (RRTRx of the remote request receiving
register (RRTRR)*1 becomes "1"). Transmission starts *2 immediately even when RFWTx = 1, if RRTRx
is already 1 when 1 is written to TREQx.
*1: For TRTRR and RFWTR, see Sections "22.4.11 Transmission RTR Register (TRTRR)" and "22.4.12
Remote Frame Receiving Wait Register (RFWTR)".
*2: For cancellation of transmission, see Sections "22.4.13 Transmission Cancel Register (TCANR)" and
"22.4.14 Transmission Complete Register (TCR)".
Writing "0" to TREQx is ignored.
"0" is read when a read-modify-write instruction is performed.
If clearing (to "0") at completion of the transmit operation and setting by writing "1" are concurrent,
clearing is preferred.
If "1" is written to more than one bit, transmission is performed, starting with the lower-numbered message
buffer (x).
TREQx is "1" while transmission is pending, and becomes "0" when transmission is completed or canceled.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
573
CHAPTER 22 CAN CONTROLLER
22.4 Classifying the CAN Controller Registers
22.4.11
MB90340E Series
Transmission RTR Register (TRTRR)
This register sets the transmission RTR (Remote Transmission Request) bits for the
message buffers (x).
■ Transmission RTR Register (TRTRR)
Figure 22.4-12 Configuration of the Transmission RTR Register (TRTRR)
Address:
CAN0: 007B0BH
CAN1: 007D0BH
CAN2: 007F0BH
bit 15
14
13
12
11
10
9
8
TRTR15 TRTR14 TRTR13 TRTR12 TRTR11 TRTR10 TRTR9 TRTR8
TRTRRn (upper)
Initial value
0 0 0 0 0 0 0 0B
R/W R/W R/W R/W R/W R/W R/W R/W
Address:
CAN0: 007B0AH
CAN1: 007D0AH
CAN2: 007F0AH
bit 7
6
5
4
3
2
1
0
TRTR7 TRTR6 TRTR5 TRTR4 TRTR3 TRTR2 TRTR1 TRTR0
R/W R/W R/W R/W R/W R/W R/W R/W
TRTRRn (lower)
Initial value
0 0 0 0 0 0 0 0B
R/W : Readable/Writable
n = 0, 1, 2
■ Functions of Transmission RTR Register (TRTRR)
0: Transmit data frame.
1: Transmit remote frame.
574
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 22 CAN CONTROLLER
22.4 Classifying the CAN Controller Registers
MB90340E Series
22.4.12 Remote Frame Receiving Wait Register (RFWTR)
Remote frame receiving wait register (RFWTR) sets the conditions for starting
transmission when a request for data frame transmission is set (TREQx of the
transmission request register (TREQR) is "1" and TRTRx of the transmitting RTR
register (TRTRR) is "0").
■ Remote Frame Receiving Wait Register (RFWTR)
Figure 22.4-13 Remote Frame Receiving Wait Register (RFWTR)
Address:
CAN0: 007B0DH
CAN1: 007D0DH
CAN2: 007F0DH
bit 15
14
13
12
11
10
9
8
RFWT15 RFWT14 RFWT13 RFWT12 RFWT11 RFWT10 RFWT9 RFWT8
RFWTRn (upper)
Initial value
X X X X X X X XB
R/W R/W R/W R/W R/W R/W R/W R/W
Address:
CAN0: 007B0CH
CAN1: 007D0CH
CAN2: 007F0CH
bit 7
6
5
4
3
2
1
0
RFWT7 RFWT6 RFWT5 RFWT4 RFWT3 RFWT2 RFWT1 RFWT0
R/W R/W R/W R/W R/W R/W R/W R/W
RFWTRn (lower)
Initial value
XXXXXXXXB
R/W : Readable/Writable
X : Undefined value
n = 0, 1, 2
■ Functions of Remote Frame Receiving Wait Register (RFWTR)
0: Transmission starts immediately
1: Transmission starts after waiting until remote frame received (RRTRx of remote request receiving
register (RRTRR) becomes "1")
Notes:
• Transmission starts immediately if RRTRx is already "1" when a request for transmission is set.
• For remote frame transmission, do not set RFWTx to "1".
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
575
CHAPTER 22 CAN CONTROLLER
22.4 Classifying the CAN Controller Registers
22.4.13
MB90340E Series
Transmission Cancel Register (TCANR)
This register cancels a pending request for transmission to the message buffer (x).
■ Transmission Cancel Register (TCANR)
Figure 22.4-14 Transmission Cancel Register (TCANR)
Address:
CAN0: 000075 H
CAN1: 000085 H
CAN2: 0000E5 H
Address:
CAN0: 000074 H
CAN1: 000084 H
CAN2: 0000E4 H
bit 15
14
13
12
11
10
9
8
TCAN15 TCAN14 TCAN13 TCAN12 TCAN11 TCAN10 TCAN9 TCAN8
W
W
W
W
W
W
W
W
bit 7
6
5
4
3
2
1
0
TCAN7 TCAN6 TCAN5 TCAN4 TCAN3 TCAN2 TCAN1 TCAN0
W
W
W
W
W
W
W
W
TCANRn (upper)
Initial value
00000000 B
TCANRn (lower)
Initial value
00000000 B
n = 0, 1, 2
W : Write only
■ Functions of Transmission Cancel Register (TCANR)
When "1" is written to TCANx, this register cancels a pending request for transmission to the message
buffer (x).
At completion of cancellation, TREQx of the transmission request register (TREQR) becomes "0". Writing
"0" to TCANx is ignored.
This is a write-only register and its read value is always "0".
576
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 22 CAN CONTROLLER
22.4 Classifying the CAN Controller Registers
MB90340E Series
22.4.14 Transmission Complete Register (TCR)
At completion of transmission by the message buffer (x), the corresponding TCx
becomes "1".
If TIEx of the transmission complete interrupt enable register (TIER) is "1", an interrupt
occurs.
■ Transmission Complete Register (TCR)
Figure 22.4-15 Transmission Complete Register (TCR)
Address:
bit 15
CAN0: 000077 H
CAN1: 000087 H
CAN2: 0000E7 H
Address:
CAN0: 000076 H
CAN1: 000086 H
CAN2: 0000E6 H
14
13
12
11
10
9
8
TC15 TC14 TC13 TC12 TC11 TC10 TC9 TC8
TCRn (upper)
Initial value
00000000B
R/W R/W R/W R/W R/W R/W R/W R/W
bit 7
6
5
4
3
2
1
0
TC7 TC6 TC5 TC4 TC3 TC2 TC1 TC0
R/W R/W R/W R/W R/W R/W R/W R/W
TCRn (lower)
Initial value
00000000B
R/W : Readable/Writable
n = 0, 1, 2
■ Functions of Transmission Complete Register (TCR)
● Conditions for TCx = 0
• Write "0" to TCx.
• Write "1" to TREQx of the transmission request register (TREQR).
After the completion of transmission, write "0" to TCx to set it to "0". Writing "1" to TCx is ignored.
"1" is read when a read-modify-write instruction is performed.
Note:
If setting to "1" by completion of the transmit operation and clearing to "0" by writing occur at the
same time, the bit is set to "1".
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
577
CHAPTER 22 CAN CONTROLLER
22.4 Classifying the CAN Controller Registers
22.4.15
MB90340E Series
Transmission Interrupt Enable Register (TIER)
This register enables or disables the transmission interrupt by the message buffer (x).
The transmission interrupt is generated at transmission completion (when TCx of the
transmission complete register (TCR) is "1").
■ Transmission Interrupt Enable Register (TIER)
Figure 22.4-16 Transmission Interrupt Enable Register (TIER)
Address:
CAN0: 007B0FH
CAN1: 007D0FH
CAN2: 007F0F H
Address:
CAN0: 007B0EH
CAN1: 007D0EH
CAN2: 007F0EH
bit 15
14
13
12
11
10
9
8
TIE15 TIE14 TIE13 TIE12 TIE11 TIE10 TIE9 TIE8
TIERn (upper)
Initial value
00000000B
R/W R/W R/W R/W R/W R/W R/W R/W
bit 7
6
5
4
3
2
TIE7 TIE6 TIE5 TIE4 TIE3 TIE2
1
0
TIE1 TIE0
R/W R/W R/W R/W R/W R/W R/W R/W
TIERn (lower)
Initial value
00000000B
n = 0, 1, 2
R/W : Readable/Writable
■ Functions of Transmission Interrupt Enable Register (TIER)
0: Transmission interrupt disabled.
1: Transmission interrupt enabled.
578
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 22 CAN CONTROLLER
22.4 Classifying the CAN Controller Registers
MB90340E Series
22.4.16 Reception Complete Register (RCR)
At completion of storing received message in the message buffer (x), RCx becomes "1".
If RIEx of the reception complete interrupt enable register (RIER) is "1", an interrupt
occurs.
■ Reception Complete Register (RCR)
Figure 22.4-17 Reception Complete Register (RCR)
Address:
CAN0: 000079 H
CAN1: 000089 H
CAN2: 0000E9 H
Address:
CAN0: 000078 H
CAN1: 000088 H
CAN2: 0000E8 H
bit 15
14
13
12
11
10
9
8
RC15 RC14 RC13 RC12 RC11 RC10 RC9
RC8
RCRn (upper)
Initial value
00000000B
R/W R/W R/W R/W R/W R/W R/W R/W
bit 7
RC7
6
5
4
3
2
1
0
RC6
RC5
RC4
RC3
RC2
RC1
RC0
R/W R/W R/W R/W R/W R/W R/W R/W
RCRn (lower)
Initial value
00000000B
R/W : Readable/Writable
n = 0, 1, 2
■ Functions of Reception Complete Register (RCR)
● Conditions for RCx = 0
Write "0" to RCx.
After completion of handling received message, write "0" to RCx to set it to "0". Writing "1" to RCx is
ignored.
"1" is read when a read-modify-write instruction is performed.
Note:
If setting to "1" by completion of the receive operation and clearing to "0" by writing occur at the
same time, the bit is set to "1".
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
579
CHAPTER 22 CAN CONTROLLER
22.4 Classifying the CAN Controller Registers
22.4.17
MB90340E Series
Remote Request Receiving Register (RRTRR)
After a received remote frame is stored in the message buffer (x), RRTRx becomes "1"
(at the same time as RCx setting to "1").
■ Remote Request Receiving Register (RRTRR)
Figure 22.4-18 Remote Request Receiving Register (RRTRR)
Address:
bit 15
CAN0: 00007B H
CAN1: 00008B H
CAN2: 0000EBH
14
13
12
11
10
9
8
RRTR15 RRTR14 RRTR13 RRTR12 RRTR11 RRTR10 RRTR9 RRTR8
RRTRRn (upper)
Initial value
0 0 0 0 0 0 0 0B
R/W R/W R/W R/W R/W R/W R/W R/W
Address:
bit 7
CAN0: 00007A H
CAN1: 00008A H
CAN2: 0000EA H
6
5
4
3
2
1
0
RRTR7 RRTR6 RRTR5 RRTR4 RRTR3 RRTR2 RRTR1 RRTR0
R/W R/W R/W R/W R/W R/W R/W R/W
RRTRRn (lower)
Initial value
0 0 0 0 0 0 0 0B
n = 0, 1, 2
R/W : Readable/Writable
■ Functions of Remote Request Receiving Register (RRTRR)
● Conditions for RRTRx = 0
• Write "0" to RRTRx.
• After a received data frame is stored in the message buffer (x) (at the same time as RCx setting to "1").
• Transmission by the message buffer (x) is completed (TCx of the transmission complete register (TCR)
is "1").
Writing "1" to RRTRx is ignored.
"1" is read when a read-modify-write instruction is performed.
Note:
If setting to "1" by completion of the receive operation and clearing to "0" by writing occur at the
same time, the bit is set to "1".
580
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 22 CAN CONTROLLER
22.4 Classifying the CAN Controller Registers
MB90340E Series
22.4.18 Receive Overrun Register (ROVRR)
If RCx of the reception complete register (RCR) is "1" when completing storing of a
received message in the message buffer (x), ROVRx becomes "1", indicating that
reception has overrun.
■ Receive Overrun Register (ROVRR)
Figure 22.4-19 Receive Overrun Register (ROVRR)
Address:
CAN0: 00007DH
CAN1: 00008DH
CAN2: 0000EDH
bit 15
14
13
12
11
10
9
8
ROVR15 ROVR14 ROVR13 ROVR12 ROVR11 ROVR10 ROVR9 ROVR8
ROVRRn (upper)
Initial value
0 0 0 0 0 0 0 0B
R/W R/W R/W R/W R/W R/W R/W R/W
Address:
CAN0: 00007CH
CAN1: 00008CH
CAN2: 0000ECH
bit 7
6
5
4
3
2
1
0
ROVR7 ROVR6 ROVR5 ROVR4 ROVR3 ROVR2 ROVR1 ROVR0
R/W R/W R/W R/W R/W R/W R/W R/W
ROVRRn (lower)
Initial value
0 0 0 0 0 0 0 0B
R/W : Readable/Writable
n = 0, 1, 2
■ Functions of Overrun Register (ROVRR)
Writing "0" to ROVRx results in ROVRx = 0. Writing "1" to ROVRx is ignored. After checking that
reception has overrun, write "0" to ROVRx to set it to "0".
"1" is read when a read-modify-write instruction is performed.
Note:
If setting to "1" by completion of the receive overrun and clearing to "0" by writing occur at the same
time, the bit is set to "1".
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
581
CHAPTER 22 CAN CONTROLLER
22.4 Classifying the CAN Controller Registers
22.4.19
MB90340E Series
Reception Interrupt Enable Register (RIER)
Reception interrupt enable register (RIER) enables or disables the reception interrupt by
the message buffer (x).
The reception interrupt is generated at reception completion (when RCx of the reception
completion register (RCR) is "1").
■ Reception Interrupt Enable Register (RIER)
Figure 22.4-20 Reception Interrupt Enable Register (RIER)
Address:
CAN0: 00007F H
CAN1: 0000BFH
CAN2: 0000EFH
Address:
CAN0: 00007E H
CAN1: 0000BEH
CAN2: 0000EEH
bit 15
14
13
12
11
10
9
8
RIE15 RIE14 RIE13 RIE12 RIE11 RIE10 RIE9 RIE8
RIERn (upper)
Initial value
00000000B
R/W R/W R/W R/W R/W R/W R/W R/W
bit 7
6
5
4
3
2
1
0
RIE7 RIE6 RIE5 RIE4 RIE3 RIE2 RIE1 RIE0
R/W R/W R/W R/W R/W R/W R/W R/W
RIERn (lower)
Initial value
00000000B
R/W : Readable/Writable
n = 0, 1, 2
■ Functions of Reception Interrupt Enable Register (RIER)
0: Reception interrupt disabled.
1: Reception interrupt enabled.
582
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 22 CAN CONTROLLER
22.4 Classifying the CAN Controller Registers
MB90340E Series
22.4.20 Acceptance Mask Select Register (AMSR)
This register selects masks (acceptance mask) for comparison between the received
message ID’s and the message buffer (x) ID’s.
■ Acceptance Mask Select Register (AMSR)
Figure 22.4-21 Acceptance Mask Select Register (AMSR)
Address:
bit 7
CAN0: 007B10 H
CAN1: 007D10H
CAN2: 007F10 H
Address:
Address:
Address:
3
2
1
0
14
13
12
11
10
9
8
AMS AMS AMS AMS AMS AMS AMS AMS
7.1 7.0 6.1 6.0 5.1 5.0 4.1 4.0
R/W R/W R/W R/W R/W R/W R/W R/W
6
5
4
3
2
1
0
AMS AMS AMS AMS AMS AMS AMS AMS
11.1 11.0 10.1 10.0 9.1 9.0 8.1 8.0
AMSRn (Byte 0)
Initial value
XXXXXXXXB
AMSRn (Byte 1)
Initial value
XXXXXXXXB
AMSRn (Byte 2)
Initial value
XXXXXXXXB
R/W R/W R/W R/W R/W R/W R/W R/W
bit 15
CAN0: 007B13 H
CAN1: 007D13H
CAN2: 007F13 H
4
R/W R/W R/W R/W R/W R/W R/W R/W
bit 7
CAN0: 007B12 H
CAN1: 007D12H
CAN2: 007F12 H
5
AMS AMS AMS AMS AMS AMS AMS AMS
3.1 3.0 2.1 2.0 1.1 1.0 0.1 0.0
bit 15
CAN0: 007B11 H
CAN1: 007D11H
CAN2: 007F11 H
6
14
13
12
11
10
9
8
AMS AMS AMS AMS AMS AMS AMS AMS
15.1 15.0 14.1 14.0 13.1 13.0 12.1 12.0
R/W R/W R/W R/W R/W R/W R/W R/W
AMSRn (Byte 3)
Initial value
XXXXXXXXB
R/W : Readable/Writable
X : Undefined value
n = 0, 1, 2
■ Functions of Acceptance Mask Select Register (AMSR)
Table 22.4-7 Selection of acceptance Mask
AMSx.1
AMSx.0
0
0
Full-bit comparison
0
1
Full-bit mask
1
0
Acceptance mask register 0 (AMR0)
1
1
Acceptance mask register 1 (AMR1)
CM44-10143-5E
Acceptance Mask
FUJITSU SEMICONDUCTOR LIMITED
583
CHAPTER 22 CAN CONTROLLER
22.4 Classifying the CAN Controller Registers
MB90340E Series
Notes:
• AMSx.1 and AMSx.0 should be set when the message buffer (x) is invalid (BVALx of the message
buffer valid register (BVALR) is "0"). Setting when the buffer is valid (BVALx = 1) may cause
unnecessary received messages to be stored.
• To invalidate the message buffer (by setting the BVALR: BVAL bit to 0) while the CAN controller is
operating for CAN communication (the read value of the CSR: HALT bit is "0" and the CAN
controller is operating for CAN bus communication to enable transmission and reception), follow
the procedure in Section "22.14 Precautions when Using CAN Controller".
584
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 22 CAN CONTROLLER
22.4 Classifying the CAN Controller Registers
MB90340E Series
22.4.21 Acceptance Mask Registers 0, 1 (AMR0, AMR1)
There are two acceptance mask registers, AMR0 and AMR1, both of which are available
either in the standard frame format or extended frame format.
AM28 to AM18 (11 bits) are used for acceptance masks in the standard frame format and
AM28 to AM0 (29 bits) are used for acceptance masks in the extended format.
■ Acceptance Mask Registers 0, 1 (AMR0, AMR1)
Figure 22.4-22 Acceptance Mask Register 0 (AMR0)
Address:
CAN0: 007B14 H
CAN1: 007D14H
CAN2: 007F14 H
Address:
CAN0: 007B15 H
CAN1: 007D15H
CAN2: 007F15 H
Address:
CAN0: 007B16 H
CAN1: 007D16H
CAN2: 007F16 H
Address:
CAN0: 007B17 H
CAN1: 007D17H
CAN2: 007F17 H
bit 7
6
5
4
3
2
1
0
AM28 AM27 AM26 AM25 AM24 AM23 AM22 AM21
AMR0n (Byte 0)
Initial value
XXXXXXXXB
R/W R/W R/W R/W R/W R/W R/W R/W
bit 15
14
13
12
11
10
9
8
AM20 AM19 AM18 AM17 AM16 AM15 AM14 AM13
R/W R/W R/W R/W R/W R/W R/W R/W
bit 7
6
5
4
3
2
1
0
AM12 AM11 AM10 AM9 AM8 AM7 AM6 AM5
AMR0n (Byte 1)
Initial value
XXXXXXXXB
AMR0n (Byte 2)
Initial value
XXXXXXXXB
R/W R/W R/W R/W R/W R/W R/W R/W
bit 15
14
13
12
11
10
9
8
AM4 AM3 AM2 AM1 AM0
-
-
-
R/W R/W R/W R/W R/W
-
-
-
AMR0n (Byte 3)
Initial value
XXXXXXXX
B
n = 0, 1, 2
R/W
:
Readable/writable
X
-
:
:
:
Undefined value
Undefined
Used bit in standard frame format
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
585
CHAPTER 22 CAN CONTROLLER
22.4 Classifying the CAN Controller Registers
MB90340E Series
Figure 22.4-23 Configuration of the acceptance Mask Register 1 (AMR1)
Address:
CAN0: 007B18 H
CAN1: 007D18H
CAN2: 007F18 H
Address:
CAN0: 007B19 H
CAN1: 007D19H
CAN2: 007F19 H
Address:
CAN0: 007B1AH
CAN1: 007D1AH
CAN2: 007F1AH
bit 7
6
5
4
3
2
1
0
AM28 AM27 AM26 AM25 AM24 AM23 AM22 AM21
AMR1n (Byte 0)
Initial value
XXXXXXXXB
R/W R/W R/W R/W R/W R/W R/W R/W
bit 15
14
13
12
11
10
9
8
AM20 AM19 AM18 AM17 AM16 AM15 AM14 AM13
R/W R/W R/W R/W R/W R/W R/W R/W
bit 7
6
5
4
3
2
1
0
AM12 AM11 AM10 AM9 AM8 AM7 AM6 AM5
AMR1n (Byte 1)
Initial value
XXXXXXXXB
AMR1n (Byte 2)
Initial value
XXXXXXXXB
R/W R/W R/W R/W R/W R/W R/W R/W
Address:
CAN0: 007B1BH
CAN1: 007D1BH
CAN2: 007F1BH
bit 15
14
13
12
11
10
9
8
AM4 AM3 AM2 AM1 AM0
-
-
-
R/W R/W R/W R/W R/W
-
-
-
AMR1n (Byte 3)
Initial value
X X X X X X X XB
n = 0, 1, 2
R/W
X
-
:
:
:
:
Readable/Writable
Undefined value
Undefined
Used bit in standard frame format
■ Functions of Acceptance Mask Registers 0, 1 (AMR0, AMR1)
● 0: Compare
Compare the bit of the acceptance code (ID register IDRx for comparing with the received message ID)
corresponding to this bit with the bit of the received message ID. If there is no match, no message is
received.
● 1: Mask
Mask the bit of the acceptance code ID register (IDRx) corresponding to this bit. No comparison is made
with the bit of the received message ID.
Note:
AMR0 and AMR1 should be set when all the message buffers (x) selecting AMR0 and AMR1 are
invalid (BVALx of the message buffer valid register (BVALR) is "0"). Setting when the buffers are
valid (BVALx = 1) may cause unnecessary received messages to be stored.
To invalidate the message buffer (by setting the BVALR: BVAL0 to BVAL15=0) while the CAN
controller is operating for CAN communication (the read value of the CSR: HALT bit is "0" and the
CAN controller is operating for CAN bus communication to enable transmission and reception),
follow the procedure in Section "22.14 Precautions when Using CAN Controller".
586
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
MB90340E Series
22.4.22 Message Buffers
CHAPTER 22 CAN CONTROLLER
22.4 Classifying the CAN Controller Registers
There are 16 message buffers. Message buffer x (x = 0 to 15) consists of an ID register
(IDRx), DLC register (DLCRx), and data register (DTRx).
■ Message Buffers
● Register Configuration
• ID register x (x = 0 to 15) (IDRx)
This register is a ID register of the message buffer. This register memorizes acceptance code setting,
transmission message ID setting, and reception ID.
• DLC register x (x = 0 to 15) (DLCRx)
This register stores the DLC of the message buffer. This register sets the data length of the message when
a data frame and a remote frame are transmitted and the data length of the message when a data frame or
a remote frame is received.
• Data register x (x = 0 to 15) (DTRx)
This register is a data register of the message buffer. This register memorizes the setting of the reception
message data or the transmission message data.
● The message buffer (x) is used both for transmission and reception.
● The lower-numbered message buffers are assigned higher priority.
• At transmission, when a request for transmission is made to more than one message buffer, transmission
is performed, starting with the lowest-numbered message buffer (See Section "22.5 Transmission of
CAN Controller").
• At reception, when the received message ID passes through the acceptance filter (mechanism for
comparing the acceptance-masked ID of received message and message buffer) of more than one
message buffer, the received message is stored in the lowest-numbered message buffer (See Section
"22.6 Reception of CAN Controller").
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
587
CHAPTER 22 CAN CONTROLLER
22.4 Classifying the CAN Controller Registers
MB90340E Series
● Message buffer that can be used as multi level message buffer
When the same acceptance filter is set in more than one message buffer, the message buffers can be used as
a multi-level message buffer. This provides allowance for receiving time.
(See Section "22.10 Procedure for Reception by Message Buffer (x)").
Note:
A write operation to message buffers and general-purpose RAM areas should be performed in words
to even addresses only. A write operation in bytes causes undefined data to be written to the upper
byte at writing to the lower byte. Writing to the upper byte is ignored.
When the BVALx bit of the message buffer valid register (BVALR) is "0" (Invalid), the message
buffers x (IDRx, DLCRx, and DTRx) can be used as general-purpose RAM.
During the receive/transmit operation of the CAN controller, the CAN Controller write/read to/from the
message buffers. If the CPU tries to write/read to/from the message buffers in this period, the CPU
has to wait a maximum time of 64 machine cycles.
This is also true for the general-purpose RAM area (Address: 007A00H to 007A1FH, 007C00H to
007C1FHH, and 007E00H to 007E1FH).
588
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 22 CAN CONTROLLER
22.4 Classifying the CAN Controller Registers
MB90340E Series
22.4.23 ID Register x (x = 0 to 15) (IDR0 to IDR15)
ID register x (x = 0 to 15) (IDR0 to IDR15) is the ID register for message buffer (x).
■ ID Register x (x = 0 to 15) (IDR0 to IDR15)
Figure 22.4-24 ID Registers x (x = 0 to 15) (IDR0 to IDR15)
Address:
CAN0: 007A20 H + 4xx
CAN1: 007C20H + 4xx
CAN2: 007E20 H + 4xx
Address:
CAN0: 007A21 H + 4xx
CAN1: 007C21H + 4xx
CAN2: 007E21 H + 4xx
Address:
CAN0: 007A22 H + 4 × x
CAN1: 007C22H + 4 × x
CAN2: 007E22 H + 4 × x
Address:
CAN0: 007A23 H + 4 × x
CAN1: 007C23H + 4 × x
CAN2: 007E23 H + 4 × x
bit 7
6
5
4
3
2
1
0
ID28 ID27 ID26 ID25 ID24 ID23 ID22 ID21
IDRxn (Byte 0)
Initial value
XXXXXXXXB
R/W R/W R/W R/W R/W R/W R/W R/W
bit 15
14
13
12
11
10
9
8
ID20 ID19 ID18 ID17 ID16 ID15 ID14 ID13
R/W R/W R/W R/W R/W R/W R/W R/W
bit 7
6
5
4
ID12 ID11 ID10 ID9
3
2
1
ID8 ID7 ID6
IDRxn (Byte 1)
Initial value
XXXXXXXXB
0
IDRxn (Byte 2)
ID5
Initial value
XXXXXXXXB
R/W R/W R/W R/W R/W R/W R/W R/W
bit 15
14
13
12
11
10
9
8
IDRxn (Byte 3)
ID4 ID3
ID2
ID1
ID0
-
-
-
R/W R/W R/W R/W R/W
-
-
-
Initial value
X X X X XX X X B
R/W : Readable/Writable
X : Undefined value
- : Undefined
: Used bit in standard frame format
x = 0, ... , 15
n = 0, 1, 2
■ Functions of ID Registers x (x = 0 to 15) (IDR0 to IDR15)
When using the message buffer (x) in the standard frame format (IDEx of the IDE register (IDER) = 0), use
11 bits of ID28 to ID18. When using the buffer in the extended frame format (IDEx = 1), use 29 bits of
ID28 to ID0.
ID28 to ID0 have the following functions:
• Set acceptance code (ID for comparing with the received message ID).
• Set transmitted message ID.
Note:
In the standard frame format, setting 1s to all bits of ID28 to ID22 is prohibited.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
589
CHAPTER 22 CAN CONTROLLER
22.4 Classifying the CAN Controller Registers
MB90340E Series
• Store the received message ID.
Notes:
• All received message ID bits are stored (even if bits are masked). In the standard frame format,
ID17 to ID0 stores image of old message left in the receive shift register.
• A write operation to this register should be performed in words. A write operation in bytes causes
undefined data to be written to the upper byte at writing to the lower byte. Writing to the upper
byte is ignored.
• This register should be set when the message buffer (x) is invalid (BVALx of the message buffer
valid register (BVALR) is "0"). Setting when the buffer is valid (BVALx = 1) may cause
unnecessary received messages to be stored.
• To invalidate the message buffer (by setting the BVALR: BVAL bit to 0) while the CAN controller is
operating for CAN communication (the read value of the CSR: HALT bit is "0" and the CAN
controller is operating for CAN bus communication to enable transmission and reception), follow
the procedure in Section "22.14 Precautions when Using CAN Controller".
590
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 22 CAN CONTROLLER
22.4 Classifying the CAN Controller Registers
MB90340E Series
22.4.24 DLC Register x (x = 0 to 15) (DLCR0 to DLCR15)
DLC register x (x = 0 to 15) (DLCR0 to DLCR15) is the DLC register for message buffer
(x).
■ DLC Register x (x = 0 to 15) (DLCR0 to DLCR15)
Figure 22.4-25 DLC Registers x (x = 0 to 15) (DLCR0 to DLCR15)
Address:
CAN0: 007A60 H + 2 × x
CAN1: 007C60H + 2 × x
CAN2: 007E60 H + 2 × x
bit 7
6
5
4
3
2
1
0
-
-
-
-
DLC3 DLC2 DLC1 DLC0
-
-
-
- R/W R/W R/W R/W
DLCRnx (lower)
Initial value
X X X XX X X X B
R/W : Readable/Writable
X : Undefined value
- : Undefined
x = 0, ... , 15
n = 0, 1, 2
■ Functions of DLC Registers x (x = 0 to 15) (DLCR0 to DLCR15)
● Transmission
• Set the data length (byte count) of a transmitted message when a data frame is transmitted (TRTRx of
the transmitting RTR register (TRTRR) is "0").
• Set the data length (byte count) of a requested message when a remote frame is transmitted (TRTRx =
1).
Note:
Setting other than 0000B to 1000B (0 to 8 bytes) is prohibited.
● Reception
• Store the data length (byte count) of a received message when a data frame is received (RRTRx of the
remote frame request receiving register (RRTRR) is "0").
• Store the data length (byte count) of a requested message when a remote frame is received (RRTRx =
1).
Note:
A write operation to this register should be performed in words. A write operation in bytes causes
undefined data to be written to the upper byte at writing to the lower byte. Writing to the upper byte is
ignored.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
591
CHAPTER 22 CAN CONTROLLER
22.4 Classifying the CAN Controller Registers
22.4.25
MB90340E Series
Data Register x (x = 0 to 15) (DTR0 to DTR15)
Data register x (x = 0 to 15) (DTR0 to DTR15) is the data register for message buffer (x).
This register is used only in transmitting and receiving a data frame but not in
transmitting and receiving a remote frame.
■ Data Register x (x = 0 to 15) (DTR0 to DTR15)
Figure 22.4-26 Data Registers x (x = 0 to 15) (DTR0 to DTR15)
Address:
CAN0: 007A80 H + 8 × x
CAN1: 007C80H + 8 × x
CAN2: 007E80 H + 8 × x
bit 7
D7
6
5
4
3
2
1
0
DTRxn (Byte 0)
D6
D5
D4
D3
D2
D1
D0
Initial value
XXXXXXXXB
R/W R/W R/W R/W R/W R/W R/W R/W
Address:
CAN0: 007A81 H + 8 × x
CAN1: 007C81H + 8 × x
CAN2: 007E81 H + 8 × x
bit 15
D7
14
13
12
D6
D5
D4
11
D3
10
9
8
DTRxn (Byte 1)
D2
D1
D0
Initial value
XXXXXXXXB
R/W R/W R/W R/W R/W R/W R/W R/W
Address:
CAN0: 007A82 H + 8 × x
CAN1: 007C82H + 8 × x
CAN2: 007E82 H + 8 × x
bit 7
6
5
4
3
2
1
0
D7
D6
D5
D4
D3
D2
D1
D0
DTRxn (Byte 2)
Initial value
XXXXXXXXB
R/W R/W R/W R/W R/W R/W R/W R/W
Address:
CAN0: 007A83 H + 8 × x
CAN1: 007C83H + 8 × x
CAN2: 007E83 H + 8 × x
bit 15
14
13
12
D7
D6
D5
D4
11
D3
10
9
8
DTRxn (Byte 3)
D2
D1
D0
Initial value
XXXXXXXXB
R/W R/W R/W R/W R/W R/W R/W R/W
Address:
CAN0: 007A84 H + 8 × x
CAN1: 007C84H + 8 × x
CAN2: 007E84 H + 8 × x
bit 7
D7
6
5
4
3
2
1
0
DTRxn (Byte 4)
D6
D5
D4
D3
D2
D1
D0
Initial value
XXXXXXXXB
R/W R/W R/W R/W R/W R/W R/W R/W
Address:
CAN0: 007A85 H + 8 × x
CAN1: 007C85H + 8 × x
CAN2: 007E85 H + 8 × x
bit 15
14
13
12
11
10
9
8
D7
D6
D5
D4
D3
D2
D1
D0
R/W R/W R/W R/W R/W R/W R/W R/W
Address:
bit 7
CAN0: 007A86 H + 8 × x
CAN1: 007C86H + 8 × x
CAN2: 007E86 H + 8 × x
D7
6
5
4
3
2
1
0
D6
D5
D4
D3
D2
D1
D0
DTRxn (Byte 5)
Initial value
XXXXXXXXB
DTRxn (Byte 6)
Initial value
XXXXXXXXB
R/W R/W R/W R/W R/W R/W R/W R/W
Address:
CAN0: 007A87 H + 8 × x
CAN1: 007C87H + 8 × x
CAN2: 007E87 H + 8 × x
bit 15
14
13
12
11
10
9
8
D7
D6
D5
D4
D3
D2
D1
D0
R/W R/W R/W R/W R/W R/W R/W R/W
R/W : Readable/Writable
X : Undefined value
592
DTRxn (Byte 7)
Initial value
XXXXXXXXB
x = 0, 1, ... , 15
n = 0, 1, 2
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 22 CAN CONTROLLER
22.4 Classifying the CAN Controller Registers
MB90340E Series
■ Functions of Data Registers x (x = 0 to 15) (DTR0 to DTR15)
● Sets transmitted message data (any of 0 to 8 bytes).
Data is transmitted in the order of BYTE0, BYTE1, ..., BYTE7, starting with the MSB.
● Stores received message data.
Data is stored in the order of BYTE0, BYTE1, ..., BYTE7, starting with the MSB.
Even if the received message data is less than 8 bytes, the remaining bytes of the data register (DTRx), to
which data are stored, are undefined.
Note:
A write operation to this register should be performed in words. A write operation in bytes causes
undefined data to be written to the upper byte at writing to the lower byte. Writing to the upper byte is
ignored.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
593
CHAPTER 22 CAN CONTROLLER
22.5 Transmission of CAN Controller
22.5
MB90340E Series
Transmission of CAN Controller
When "1" is written to TREQx of the transmission request register (TREQR),
transmission by the message buffer (x) starts. At this time, TREQx becomes 1 and TCx
of the transmission complete register (TCR) becomes 0.
■ Starting Transmission of the CAN Controller
If RFWTx of the remote frame receiving wait register (RFWTR) is "0", transmission starts immediately. If
RFWTx is "1", transmission starts after waiting until a remote frame is received (RRTRx of the remote
request receiving register (RRTRR) becomes "1").
If a request for transmission is made to more than one message buffer (more than one TREQx is "1"),
transmission is performed, starting with the lowest-numbered message buffer.
Message transmission to the CAN bus (by the transmit output pin TX) starts when the bus is idle.
If TRTRx of the transmission RTR register (TRTRR) is "0", a data frame is transmitted. If TRTRx is "1", a
remote frame is transmitted.
If the message buffer competes with other CAN controllers on the CAN bus for transmission and
arbitration fails, or if an error occurs during transmission, the message buffer waits until the bus is idle and
repeats retransmission until it is successful.
■ Canceling a Transmission Request from the CAN Controller
● Canceling by transmission cancel register (TCANR)
A transmission request for message buffer (x) having not executed transmission during transmission
pending can be canceled by writing "1" to TCANx of the transmission cancel register (TCANR). At
completion of cancellation, TREQx becomes "0".
● Canceling by storing received message
The message buffer (x) having not executed transmission despite transmission request also performs
reception.
If the message buffer (x) has not executed transmission despite a request for transmission of a data frame
(TRTRx = 0 or TREQx = 1), the transmission request is canceled after storing received data frames passing
through the acceptance filter (TREQx = 0).
Note:
A transmission request is not canceled by storing remote frames (TREQx = 1 remains unchanged).
If the message buffer (x) has not executed transmission despite a request for transmission of a remote frame
(TRTRx = 1 or TREQx = 1), the transmission request is canceled after storing received remote frames
passing through the acceptance filter (TREQx = 0).
Note:
The transmission request is canceled by storing either data frames or remote frames.
594
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 22 CAN CONTROLLER
22.5 Transmission of CAN Controller
MB90340E Series
■ Completing Transmission of the CAN Controller
When transmission is successful, RRTRx becomes "0", TREQx becomes "0", and TCx of the transmission
complete register (TCR) becomes "1".
If the transmission complete interrupt is enabled (TIEx of the transmission interrupt enable register (TIER)
is "1"), an interrupt occurs.
■ Transmission Flowchart of the CAN Controller
Figure 22.5-1 Transmission Flowchart of the CAN Controller
Transmission request
(TREQx := 1)
TCx := 0
0
TREQx?
1
0
RFWTx?
1
0
RRTRx?
1
If there are any other message buffers
meeting the above conditions, select
the lowest-numbered message buffer.
NO
Is the bus idle?
YES
0
1
TRTRx?
A data frame is transmitted.
A remote frame is transmitted.
NO
Is transmission
successful?
YES
TCANx?
1
RRTRx : = 0
TREQx := 0
TCx
:= 1
TREQx := 0
1
TIEx ?
0
0
A transmission complete
interrupt occurs.
End of transmission
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
595
CHAPTER 22 CAN CONTROLLER
22.6 Reception of CAN Controller
22.6
MB90340E Series
Reception of CAN Controller
Reception starts when the start of data frame or remote frame (SOF) is detected on the
CAN bus.
■ Acceptance Filtering
The received message in the standard frame format is compared with the message buffer (x) set in the
standard frame format (IDEx of the IDE register (IDER) is "0"). The received message in the extended
frame format is compared with the message buffer (x) set in the extended frame format (IDEx is "1").
If all the bits set to compare by the acceptance mask agree after comparison between the received message
ID and acceptance code (ID register (IDRx) for comparing with the received message ID), the received
message passes to the acceptance filter of the message buffer (x).
■ Storing Received Message
When the receive operation is successful, received messages are stored in a message buffer (4) including
IDs passed through the acceptance filter.
When receiving data frames, received messages are stored in the ID register (IDRx), DLC register
(DLCRx), and data register (DTRx).
Even if received message data is less than 8 bytes, some data is stored in the remaining bytes of the DTRx
and its value is undefined.
When receiving remote frames, received messages are stored only in the IDRx and DLCRx, and the DTRx
remains unchanged.
If there is more than one message buffer including IDs passed through the acceptance filter, the message
buffer x in which received messages are to be stored is determined according to the following rules.
• The order of priority of the message buffer x (x = 0 to 15) rises as its number lower; in other words,
message buffer 0 is given the highest and the message buffer 15 is given the lowest priority.
• Basically, message buffers with the RCx bit in the receive completion register (RCR) set to "0" are
preferred in storing received messages.
• If the bits of the acceptance mask select register (AMSR) are set to all bits compare (for message buffers
with the AMSx.1 and AMSx.0 bits set to 00B), received messages are stored irrespective of the value of
the RCx bit of the RCR.
• If there are message buffers with the RCx bit of the RCR set to "0", or with the bits of the AMSR set to
all bits compare, received messages are stored in the lowest-number (highest-priority) message buffer x.
• If there are no message buffers above-mentioned, received messages are stored in a lower-number
message buffer x.
• Message buffers should be arranged in ascending numeric order. The lowest message buffers should be
with all bits compare, then AMR0 or AMR1 masks. And The highest message buffers should be with all
bits mask.
596
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 22 CAN CONTROLLER
22.6 Reception of CAN Controller
MB90340E Series
Figure 22.6-1 shows a flowchart for determining the message buffer (x) where received messages are to be
stored. It is recommended that message buffers be arranged in the following order: message buffers in
which each AMSR bit is set to all bits compare, message buffers using AMR0 or AMR1, and message
buffers in which each AMSR bit is set to all bits mask.
Figure 22.6-1 Flowchart Determining Message Buffer (x) Where Received Messages Stored
Start
Are message buffers with RCx set to "0"
or with AMSx.1 and AMSx.0 set to "00B"
found?
NO
YES
Select the lowest-numbered
message buffer from above
message buffer.
Select the lowest-numbered
message buffer.
End
■ Receive Overrun
When the received message is stored in the message buffer (x) with the corresponding RCx bit of the
reception compare register (RCR) being already set to 1, it will result in receive overrun. In this case, the
corresponding ROVRx bit in the receive overrun register ROVRR is set to "1".
■ Processing for Reception of Data Frame and Remote Frame
● Processing for reception of data frame
RRTRx of the remote request receiving register (RRTRR) becomes "0".
TREQx of the transmission request register (TREQR) becomes "0" immediately before storing the received
message. A transmission request for message buffer (x) having not executed transmission will be canceled.
Note:
A request for transmission of either a data frame or remote frame is canceled.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
597
CHAPTER 22 CAN CONTROLLER
22.6 Reception of CAN Controller
MB90340E Series
● Processing for reception of remote frame
RRTRx becomes "1".
If TRTRx of the transmitting RTR register (TRTRR) is "1", TREQx becomes "0". As a result, the request
for transmitting remote frame to message buffer having not executed transmission will be canceled.
Notes:
• A request for data frame transmission is not canceled.
• For cancellation of a transmission request, see Section "22.5 Transmission of CAN Controller".
■ Completing Reception
RCx of the reception complete register (RCR) becomes "1" after storing the received message.
If a reception interrupt is enabled (RIEx of the reception interrupt enable register (RIER) is "1"), an
interrupt occurs.
Note:
This CAN controller will not receive any messages transmitted by itself.
598
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 22 CAN CONTROLLER
22.7 Reception Flowchart of CAN Controller
MB90340E Series
22.7
Reception Flowchart of CAN Controller
Figure 22.7-1 shows a reception flowchart of the CAN controller.
■ Reception Flowchart of the CAN Controller
Figure 22.7-1 Reception Flowchart of the CAN Controller
Detection of start of data frame
or remote frame (SOF)
NO
Is any message buffer (x) passing to
the acceptance filter found?
YES
NO
Is reception
successful?
YES
Determine message buffer (x) where received messages to be stored.
Store the received message
in the message buffer (x).
1
RCx?
0
Data frame
ROVRx := 1
Remote frame
Received message?
RRTRx := 0
RRTRx := 1
1
TRTRx?
0
TREQx := 0
RCx := 1
RIEx ?
0
1
A reception interrupt
occurs.
End of reception
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
599
CHAPTER 22 CAN CONTROLLER
22.8 How to Use the CAN Controller
22.8
MB90340E Series
How to Use the CAN Controller
The following settings are required to use the CAN controller:
• Bit timing
• Frame format
• ID
• Acceptance filter
• Low-power consumption mode
■ Setting Bit Timing
The bit timing register (BTR) should be set during bus operation stop (when the bus operation stop bit
(HALT) of the control status register (CSR) is "1").
After the setting completion, write "0" to HALT to cancel bus operation stop.
■ Setting Frame Format
Set the frame format used by the message buffer (x). When using the standard frame format, set IDEx of
the IDE register (IDER) to "0". When using the extended frame format, set IDEx to "1".
This setting should be made when the message buffer (x) is invalid (BVALx of the message buffer valid
register (BVALR) is "0"). Setting when the buffer is valid (BVALx = 1) may cause unnecessary received
messages to be stored.
■ Setting ID
Set the message buffer (x) ID to ID28 to ID0 of ID register (IDRx). The message buffer (x) ID need not be
set to ID17 to ID0 in the standard frame format. The message buffer (x) ID is used as a transmission
message at transmission and is used as an acceptance code at reception.
This setting should be made when the message buffer (x) is invalid (BVALx of the message buffer valid
register (BVALR) is "0"). Setting when the buffer is valid (BVALx = 1) may cause unnecessary received
messages to be stored.
■ Setting Acceptance Filter
The acceptance filter of the message buffer (x) is set by an acceptance code and acceptance mask. It should
be set when the acceptance message buffer (x) is invalid (BVALx of the message buffer valid register
(BVALR) is "0"). Setting when the buffer is valid (BVALx = 1) may cause unnecessary received messages
to be stored.
Set the acceptance mask used in each message buffer (x) by the acceptance mask select register (AMSR).
The acceptance mask registers (AMR0 and AMR1) should also be set if used (For the setting details, see
Sections "22.4.20 Acceptance Mask Select Register (AMSR)" and "22.4.21 Acceptance Mask Registers 0,
1 (AMR0, AMR1)").
The acceptance mask should be set so that a transmission request may not be canceled when unnecessary
received messages are stored. For example, it should be set to a full-bit comparison if only one specific ID
is used for the transmission.
600
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 22 CAN CONTROLLER
22.8 How to Use the CAN Controller
MB90340E Series
■ Setting Low-power Consumption Mode
To set the F2MC-16LX in a low-power consumption mode (stop and watch mode, etc.), write "1" to the bus
operation stop bit (HALT) of the control status register (CSR), and then check that the bus operation has
stopped (HALT = 1).
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
601
CHAPTER 22 CAN CONTROLLER
22.9 Procedure for Transmission by Message Buffer (x)
22.9
MB90340E Series
Procedure for Transmission by Message Buffer (x)
After setting the bit timing, frame format, ID, and acceptance filter, set BVALx to "1" to
activate the message buffer (x).
■ Procedure for Transmission by Message Buffer (x)
● Setting transmit data length code
Set the transmit data length code (byte count) to DLC3 to DLC0 of the DLC register (DLCRx).
For data frame transmission (when TRTRx of the transmission RTR register (TRTRR) is "0"), set the data
length of the transmitted message.
For remote frame transmission (when TRTRx = 1), set the data length (byte count) of the requested
message.
Note:
Setting other than 0000B to 1000B (0 to 8 bytes) is prohibited.
● Setting transmit data (only for transmission of data frame)
For data frame transmission (when TRTRx of the transmission register (TRTRR) is "0"), set data as the
count of byte transmitted in the data register (DTRx).
Note:
Transmit data should be written while the TREQx bit of the transmission request register (TREQR)
set to "0". There is no need for setting the BVALx bit of the message buffer valid register (BVALR) to
"0". Setting the BVALx bit to "0" may cause incoming remote frame to be lost.
● Setting transmission RTR register
For data frame transmission, set TRTRx of the transmission RTR register (TRTRR) to "0".
For remote frame transmission, set TRTRx to "1".
602
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 22 CAN CONTROLLER
22.9 Procedure for Transmission by Message Buffer (x)
MB90340E Series
● Setting conditions for starting transmission (only for transmission of data frame)
Set RFWTx of the remote frame receiving wait register (RFWTR) to "0" to start transmission immediately
after a request for data frame transmission is set (TREQx of the transmission request register (TREQR) is
"1" and TRTRx of the transmission RTR register (TRTRR) is "0").
Set RFWTx to "1" to start transmission after waiting until a remote frame is received (RRTRx of the
remote request receiving register (RRTRR) becomes "1") after a request for data frame transmission is set
(TREQx = 1 and TRTRx = 0).
Note:
Remote frame transmission cannot be made, if RFWTx is set to "1".
● Setting transmission complete interrupt
When generating a transmission complete interrupt, set TIEx of the transmission interrupt enable register
(TIER) to "1".
When not generating a transmission complete interrupt, set TIEx to "0".
● Setting transmission request
For a transmission request, set TREQx of the transmission request register (TREQR) to "1".
● Canceling transmission request
When canceling a pending request for transmission to the message buffer (x), write "1" to TCANx of the
transmission cancel register (TCANR).
Check TREQx. For TREQx = 0, transmission cancellation is terminated or transmission is completed.
Check TCx of the transmission complete register (TCR). For TCx = 0, transmission cancellation is
terminated. For TCx = 1, transmission is completed.
● Processing for completion of transmission
If transmission is successful, TCx of the transmission complete register (TCR) becomes "1".
If the transmission complete interrupt is enabled (TIEx of the transmission interrupt enable register (TIER)
is "1"), an interrupt occurs.
After checking the transmission completion, write "0" to TCx to set it to "0". This cancels the transmission
complete interrupt.
In the following cases, the pending transmission request is canceled by receiving and storing a message.
• Request for data frame transmission by reception of data frame
• Request for remote frame transmission by reception of data frame
• Request for remote frame transmission by reception of remote frame
Request for data frame transmission is not canceled by receiving and storing a remote frame. ID and DLC,
however, are changed by the ID and DLC of the received remote frame. Note that the ID and DLC of data
frame to be transmitted become the value of received remote frame.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
603
CHAPTER 22 CAN CONTROLLER
22.10 Procedure for Reception by Message Buffer (x)
22.10
MB90340E Series
Procedure for Reception by Message Buffer (x)
After setting the bit timing, frame format, ID, and acceptance filter, make the settings
described below.
■ Procedure for Reception by Message Buffer (x)
● Setting reception interrupt
To enable reception interrupt, set RIEx of the reception interrupt enable register (RIER) to "1".
To disable reception interrupt, set RIEx to "0".
● Starting reception
When starting reception after setting, set BVALx of the message buffer valid register (BVALR) to "1" to
make the message buffer (x) valid.
● Processing for reception completion
If reception is successful after passing to the acceptance filter, the received message is stored in the
message buffer (x) and RCx of the reception complete register (RCR) becomes "1". For data frame
reception, RRTRx of the remote request receiving register (RRTRR) becomes "0". For remote frame
reception, RRTRx becomes "1".
If a reception interrupt is enabled (RIEx of the reception interrupt enable register (RIER) is "1"), an
interrupt occurs.
After checking the reception completion (RCx = 1), process the received message.
After completion of processing the received message, check ROVRx of the reception overrun register
(ROVRR).
If ROVRx = 0, the processed received message is valid. Write "0" to RCx to set it to "0" (the reception
complete interrupt is also canceled) to terminate reception.
If ROVRx = 1, a reception overrun occurred and the next message may have overwritten the processed
message. In this case, received messages should be processed again after setting the ROVRx bit to "0" for
clearing by writing "0" to it.
Figure 22.10-1 shows an example of receive interrupt handling.
604
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 22 CAN CONTROLLER
22.10 Procedure for Reception by Message Buffer (x)
MB90340E Series
Figure 22.10-1 Example of Receive Interrupt Handling
Interrupt with RCx = 1
Read received messages.
A: = ROVRx
ROVRx := 0
A = 0?
NO
YES
RCx := 0
End
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
605
CHAPTER 22 CAN CONTROLLER
22.11 Setting Configuration of Multi-level Message Buffer
22.11
MB90340E Series
Setting Configuration of Multi-level Message Buffer
If the receptions are performed frequently, or if several different ID’s of messages are
received, in other words, if there is insufficient time for handling messages, more than
one message buffer can be combined into a multi-level message buffer to provide
allowance for processing time of the received message by CPU.
■ Setting Configuration of Multi-level Message Buffer
To provide a multi-level message buffer, the same acceptance filter must be set in the combined message
buffers.
If the bits of the acceptance mask select register (AMSR) are set to all bits compare ((AMSx.1, AMSx.0) =
(0, 0)), multi-level message configuration of message buffers is not allowed. This is because all bits
compare causes received messages to be stored irrespective of the value of the RCx bit of the receive
completion register (RCR), so received messages are always stored in lower-numbered (higher-priority)
message buffers even if all bits compare and identical acceptance code (ID register (IDRx)) are specified
for more than one message buffer. Therefore, all bits compare and identical acceptance code should not be
specified for more than one message buffer.
Figure 22.11-1 shows operational examples of multi-level message buffers.
606
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 22 CAN CONTROLLER
22.11 Setting Configuration of Multi-level Message Buffer
MB90340E Series
Figure 22.11-1 Examples of Operation of Multi-level Message Buffer
Initialization
AMS15, AMS14, AMS13
AMSR 10 10 10
Select AMR0.
.. .
AM28 to AM18
AMR0
ID28 to ID18
Message buffer 13
Message buffer 14
Message buffer 15
0000 1111 111
0101 0000 000
0101 0000 000
0101 0000 000
RC15, RC14, RC13
IDE
.. .
0
.. .
RCR 0
0
0
.. .
0
.. .
ROVRR 0
0
0
.. .
0
.. .
ROVR15, ROVR14, ROVR13
Mask
Message receiving
The received message is stored in message buffer 13.
IDE
ID28 to ID18
Message receiving
0101 1111 000
0
.. .
Message buffer 13
0101 1111 000
0
.. .
RCR 0
0
1
.. .
ROVRR 0
0
0
.. .
Message buffer 14
0101 0000 000
0
.. .
Message buffer 15
0101 0000 000
0
.. .
Message receiving
The received message is stored in message buffer 14.
Message receiving
0101 1111 001
0
.. .
Message buffer 13
0101 1111 000
0
.. .
RCR 0
1
1
.. .
0
.. .
ROVRR 0
0
0
.. .
0
.. .
Message buffer 14
Message buffer 15
Message receiving
0101 1111 001
0101 0000 000
The received message is stored in message buffer 15.
Message receiving
0101 1111 010
0
.. .
Message buffer 13
0101 1111 000
0
.. .
RCR 1
1
1
.. .
Message buffer 14
0101 1111 001
0
.. .
ROVRR 0
0
0
.. .
Message buffer 15
0101 1111 010
0
.. .
Message receiving
The received message is stored in message buffer 13.
Message receiving
0101 1111 011
0
.. .
Message buffer 13
0101 1111 011
0
.. .
RCR 1
1
1
.. .
Message buffer 14
0101 1111 001
0
.. .
ROVRR 0
0
1
.. .
Message buffer 15
0101 1111 010
0
.. .
Note:
Four messages are received with the same acceptance filter set in message buffers 13, 14 and 15.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
607
CHAPTER 22 CAN CONTROLLER
22.12 Setting the Redirection of CAN1 RX/TX pin
22.12
MB90340E Series
Setting the Redirection of CAN1 RX/TX pin
CAN1 can be changed the redirection CAN1 RX/TX pin (RX1/TX1) to RX0/TX0 pin
by the CANSWR register.
■ CAN1 Switching Register (CANSWR)
Figure 22.12-1 CAN1 RX/TX Pin Switching Register (CANSWR)
Address:
bit 15 14
CAN1: 00796F H
R/W
X
-
:
:
:
13
12
11
10
9
8
CANSWR
-
-
-
-
-
-
RXS TXS
01 01
-
-
-
-
-
-
R/W R/W
Initial value
XXXX0000
B
Readable/Writable
Undefined value
Undefined
Table 22.12-1 Function of Each Bit of the CAN Switch Register (CANSWR)
Bit name
bit15 to
bit10
Function
Undefined
Always write "0" to these bits.
bit9
RXS01:
Reception pin
switch 0/1
If "0" is written to this bit, input of CAN1 is inputted from RX1 pin. (initial value)
If "1" is written to this bit, input of CAN1 is inputted from RX0 pin.
bit8
TXS01:
Transmission pin
switch 0/1
If "0" is written to this bit, output of CAN1 is outputted from TX1 pin. (initial value)
If "1" is written to this bit, output of CAN1 is outputted from TX0 pin.
Figure 22.12-2 Node Status Transition Diagram
CAN0
TX
TX0
Switched by TXS01
of CANSWR
RX0
RX
CAN0
RX
CAN1
Switched by RXS01
of CANSWR
VCC
CAN1
608
TX
TX1
RX1
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 22 CAN CONTROLLER
22.13 CAN Direct Mode Register (CDMR)
MB90340E Series
22.13 CAN Direct Mode Register (CDMR)
To operate CAN normally, this register must be set correctly.
■ CAN Direct Mode Register (CDMR)
Figure 22.13-1 Configuration of the CAN Direct Mode Register (CDMR)
Address:
CAN0: 00796E H
R/W
X
-
:
:
:
bit 15
14
-
-
-
-
13
12
11
10
9
-
-
-
-
-
8
-
-
-
-
- R/W
CDMR
DIRECT
Initial value
XXXXXXX0
B
Readable/Writable
Undefined value
Undefined
■ CAN Direct Mode Register Contents
Table 22.13-1 Function of the DIRECT Bit of the CAN Direct Mode Register
Bit name
Function
bit7 to bit1
Undefined
-
bit0
DIRECT:
direct mode bit
If the clock modulation is set (CMCR:PMOD=1), the bit should be set to "0". (Initial value)
If the clock modulation is not set (CMCR:PMOD=0), the bit should be set to "1"
Note:
Do not use clock modulator, CAN and μDMAC at the same time. If CAN and μDMAC are used at the
same time, make sure that the DIRECT bit in this register is set to "1".
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
609
CHAPTER 22 CAN CONTROLLER
22.14 Precautions when Using CAN Controller
22.14
MB90340E Series
Precautions when Using CAN Controller
Use of the CAN controller requires the following precautions.
■ Precautions for Disabling Message Buffers by BVAL Bits
When the message buffer is disabled by using the BVAL bit, CAN controller may not perform the proper
receive/transmit operation.
This section explains how to prevent such phenomenon.
● Condition
When the following two conditions occur at the same time, the CAN controller will not perform to transmit
messages normally.
• CAN controller is participating in the CAN communication. (i.e. The read value of the CSR: HALT bit
is "0" and CAN controller is ready to transmit and receive messages)
• Message buffers are read and written when BVAL bits disable the message buffers by the setting of
BVAL bits.
● Work around
Operation for suppressing transmission request
Do not use BVAL bit for suppressing transmission request, use TCAN bit instead of it.
Operation for composing transmission message
Be sure to disable the message buffer by using the BVAL bit when setting the ID register or IDE
register for composing the transmission message.
In this case, perform the either of the following operations before disabling the message buffer by
writing "0" to BVAL bit.
•
Read the transmission request bit (TREQ) to check that there is no transmit request (TREQ = 0)
•
Read the transmission complete bit (TC) to check that transmission has been completed (TC = 1)
If transmit request was made in advance, be sure to verify that there is no pending transmit request
before invaliding the message buffer.
Never write "0" to BVAL bit until you check that transmit operation is not performed.
a) Cancel the transmission request (TCANx=1;), if necessary
b) and wait for the transmission completion (while (TREQx=1);) by polling or interrupt.
Only after that the transmission buffer can be disabled (BVALx=0;).
Note:
For case a), if transmission of that buffer has already started, canceling the request is ignored and
disabling the buffer is delayed until the end of the transmission.
610
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 22 CAN CONTROLLER
22.14 Precautions when Using CAN Controller
MB90340E Series
■ Setting of the CAN Direct Mode
The DIRECT bit of the CAN direct mode register CDMR should be set as follows, depending on the setting
of the clock modulator. If the DIRECT bit is not set correctly, the CAN controller does not operate
normally.
● Not using the clock modulator
• The clock modulator control register CMCR: PMOD bit ..0 (initial value)
• The CAN direct mode register CDMR: DIRECT bit .........1
● Using the clock modulator
Do not use clock modulator, CAN and μDMAC at the same time. If CAN and μDMAC are used at the
same time, make sure that the DIRECT bit in CAN direct mode register CDMR is set to "1".
Note:
To use the CAN controller, make the settings shown above, "Not using the clock modulator".
■ Notes on Using μDMAC and CAN controllers Simultaneously
•
When the CAN controller is operable (CSR:HALT=0, and any of the BVALR:BVALx bits or
TREQR:TREQx bits = 1), the μDMAC cannot be used to access the message buffer of the CAN
controller by read or write operation.
•
To access the message buffer of the CAN controller by read or write operation using the μDMAC, make
sure beforehand that the CAN controller is stopped (all of the BVALR:BVALx bits = 0, and also all of
the TREQR:TREQx bits = 0 or CSR:HALT=1).
•
If CAN and μDMAC are used at the same time, make sure that the DIRECT bit in CAN direct mode
register CDMR is set to "1" and clock modulator is off.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
611
CHAPTER 22 CAN CONTROLLER
22.14 Precautions when Using CAN Controller
612
FUJITSU SEMICONDUCTOR LIMITED
MB90340E Series
CM44-10143-5E
CHAPTER 23
ADDRESS MATCH
DETECTION FUNCTION
This chapter describes the functions and operations of
the address match detection function.
23.1 Overview of Address Match Detection Function
23.2 Block Diagram of Address Match Detection Function
23.3 Configuration of Address Match Detection Function
23.4 Explanation of Operation of Address Match Detection Function
23.5 Program Example of Address Match Detection Function
Code: CM44-00110-2E
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
613
CHAPTER 23 ADDRESS MATCH DETECTION FUNCTION
23.1 Overview of Address Match Detection Function
23.1
MB90340E Series
Overview of Address Match Detection Function
The address match detection function is a function that compulsorily replaces the
instruction with the INT9 instruction by the program, when the instruction address to be
executed with CPU matches to the address set in the detection address setting register,
and diverges to the interrupt processing program. Since the address match detection
function can use the INT9 interrupt for instruction processing, the program can be
corrected by patch processing.
■ Overview of Address Match Detection Function
• The address of the instruction to be processed next to the instruction currently processed by the program
is always held in the address latch through the internal data bus. The address match detection function
always compares the value of the address held in the address latch with that of the address set in the
detection address setting registers. When these compared values match, the next instruction to be
processed by the CPU is forcibly replaced with the INT9 instruction, and the interrupt processing
program is executed.
• There are 6 detection address setting registers (PADR0 to PADR5), each of which has an interrupt
enable bit. The generation of an interrupt due to a match between the address held in the address latch
and the address set in the detection address setting registers can be enabled or disabled for each register.
614
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 23 ADDRESS MATCH DETECTION FUNCTION
23.2 Block Diagram of Address Match Detection Function
MB90340E Series
23.2
Block Diagram of Address Match Detection Function
The address match detection module consists of the following blocks:
• Address latch
• Address detection control register (PACSR0/PACSR1)
• Detection address setting registers (PADR0 to PADR5)
■ Block Diagram of Address Match Detection Function
Figure 23.2-1 shows the block diagram of the address match detection function.
Figure 23.2-1 Block Diagram of Address Match Detection Function
Address latch
Comparator
INT9 instruction
(INT9 interrupt generation)
Detection address setting register 0
PADR0 (24-bit)
Detection address setting register 1
Detection address setting register 5
…
…
…
Internal data bus
PADR1 (24-bit)
PADR5 (24-bit)
PACSR0
Reserved
Reserved
AD2E
Reserved
AD1E
Reserved
AD0E
Reserved
AD3E
Reserved
Address detection control register 0 (PACSR0)
PACSR1
Reserved
Reserved
AD5E
Reserved
AD4E
Reserved
Address detection control register 1 (PACSR1)
Reserved: Be sure to set to "0"
● Address latch
The address latch stores the value of the address output to the internal data bus.
● Address detection control register (PACSR0/PACSR1)
The address detection control register enables or disables output of an interrupt at an address match.
● Detection address setting registers (PADR0 to PADR5)
The detection address setting registers set the address that is compared with the value of the address latch.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
615
CHAPTER 23 ADDRESS MATCH DETECTION FUNCTION
23.3 Configuration of Address Match Detection Function
23.3
MB90340E Series
Configuration of Address Match Detection Function
This section lists and details the registers used by the address match detection function.
■ List of Registers and Initial Values of Address Match Detection Function
Figure 23.3-1 List of Registers and Initial Values of Address Match Detection Function
bit
Address detection control register 0 (PACSR0)
bit
Address detection control register 1 (PACSR1)
bit
Detection address setting register 0 (PADR0): Lower
bit
Detection address setting register 0 (PADR0): Medium
bit
Detection address setting register 0 (PADR0): Upper
bit
Detection address setting register 1 (PADR1): Lower
bit
Detection address setting register 1 (PADR1): Medium
bit
Detection address setting register 1 (PADR1): Upper
bit
Detection address setting register 2 (PADR2): Lower
bit
Detection address setting register 2 (PADR2): Medium
bit
Detection address setting register 2 (PADR2): Upper
bit
Detection address setting register 3 (PADR3): Lower
bit
Detection address setting register 3 (PADR3): Medium
bit
Detection address setting register 3 (PADR3): Upper
bit
Detection address setting register 4 (PADR4): Lower
bit
Detection address setting register 4 (PADR4): Medium
bit
Detection address setting register 4 (PADR4): Upper
bit
Detection address setting register 5 (PADR5): Lower
bit
Detection address setting register 5 (PADR5): Medium
bit
Detection address setting register 5 (PADR5): Upper
7
0
15
0
7
x
15
x
7
x
15
x
7
x
15
x
7
x
15
x
7
x
7
x
15
x
7
x
15
x
7
x
15
x
7
x
15
x
7
x
6
0
14
0
6
x
14
x
6
x
14
x
6
x
14
x
6
x
14
x
6
x
6
x
14
x
6
x
14
x
6
x
14
x
6
x
14
x
6
x
5
0
13
0
5
x
13
x
5
x
13
x
5
x
13
x
5
x
13
x
5
x
5
x
13
x
5
x
13
x
5
x
13
x
5
x
13
x
5
x
4
0
12
0
4
x
12
x
4
x
12
x
4
x
12
x
4
x
12
x
4
x
4
x
12
x
4
x
12
x
4
x
12
x
4
x
12
x
4
x
3
0
11
0
3
x
11
x
3
x
11
x
3
x
11
x
3
x
11
x
3
x
3
x
11
x
3
x
11
x
3
x
11
x
3
x
11
x
3
x
2
0
10
0
2
x
10
x
2
x
10
x
2
x
10
x
2
x
10
x
2
x
2
x
10
x
2
x
10
x
2
x
10
x
2
x
10
x
2
x
1
0
9
0
1
x
9
x
1
x
9
x
1
x
9
x
1
x
9
x
1
x
1
x
9
x
1
x
9
x
1
x
9
x
1
x
9
x
1
x
0
0
8
0
0
x
8
x
0
x
8
x
0
x
8
x
0
x
8
x
0
x
0
x
8
x
0
x
8
x
0
x
8
x
0
x
8
x
0
x
x: Undefined
616
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 23 ADDRESS MATCH DETECTION FUNCTION
23.3 Configuration of Address Match Detection Function
MB90340E Series
23.3.1
Address Detection Control Register (PACSR0/PACSR1)
The address detection control register enables or disables output of an interrupt at an
address match. When an address match is detected if output of an interrupt at an
address match is enabled, the INT9 interrupt is output.
■ Address Detection Control Register 0 (PACSR0)
Figure 23.3-2 Address Detection Control Register 0 (PACSR0)
Address
bit 7
6
5
4
3
2
1
0
ReReReReRe00009EH served served AD2E served AD1E served AD0E served
R/W R/W R/W R/W R/W R/W R/W R/W
Initial value
00000000B
bit 0
Reserved
0
Reserved bit
Be sure to set the value to "0".
bit 1
AD0E
Address match detection enable bit 0
0
Disables address match detection in PADR0
1
Enables address match detection in PADR0
bit 2
Reserved
0
Reserved bit
Be sure to set the value to "0".
bit 3
AD1E
Address match detection enable bit 1
0
Disables address match detection in PADR1
1
Enables address match detection in PADR1
bit 4
Reserved
0
Reserved bit
Be sure to set the value to "0".
bit 5
AD2E
Address match detection enable bit 2
0
Disables address match detection in PADR2
1
Enables address match detection in PADR2
bit 6
Reserved
0
Reserved bit
Be sure to set the value to "0".
bit 7
Reserved
R/W : Readable/Writable
0
Reserved bit
Be sure to set the value to "0".
: Initial value
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
617
CHAPTER 23 ADDRESS MATCH DETECTION FUNCTION
23.3 Configuration of Address Match Detection Function
MB90340E Series
Table 23.3-1 Functions of Address Detection Control Register 0 (PACSR0)
Bit name
bit7,
bit6
Function
Reserved bits
Be sure to set these bits to "0".
bit5
AD2E:
Address match detection
enable bit 2
The address match detection operation with the detection address setting register 2 (PADR2) is
enabled or disabled.
When set to "0": Disables the address match detection operation.
When set to "1": Enables the address match detection operation.
When the value of detection address setting registers 2 (PADR2) matches with the value of
address latch at enabling the address match detection operation (AD2E=1), the INT9
instruction is immediately executed.
bit4
Reserved bit
Be sure to set this bit to "0".
bit3
AD1E:
Address match detection
enable bit 1
The address match detection operation with the detection address setting register 1 (PADR1) is
enabled or disabled.
When set to "0": Disables the address match detection operation.
When set to "1": Enables the address match detection operation.
When the value of detection address setting registers 1 (PADR1) matches with the value of
address latch at enabling the address match detection operation (AD1E=1), the INT9
instruction is immediately executed.
bit2
Reserved bit
Be sure to set this bit to "0".
bit1
AD0E:
Address match detection
enable bit 0
The address match detection operation with the detection address setting register 0 (PADR0) is
enabled or disabled.
When set to "0": Disables the address match detection operation.
When set to "1": Enables the address match detection operation.
When the value of detection address setting registers 0 (PADR0) matches with the value of
address latch at enabling the address match detection operation (AD0E=1), the INT9
instruction is immediately executed.
bit0
Reserved bit
Be sure to set this bit to "0".
618
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 23 ADDRESS MATCH DETECTION FUNCTION
23.3 Configuration of Address Match Detection Function
MB90340E Series
■ Address Detection Control Register 1 (PACSR1)
Figure 23.3-3 Address Detection Control Register 1 (PACSR1)
Address
bit 15
00003BH
14
13
12
11
10
9
8
ReReReReReserved served AD5E served AD4E served AD3E served
R/W R/W R/W R/W R/W R/W R/W R/W
Initial value
00000000B
bit 8
Reserved
0
Reserved bit
Be sure to set the value to "0".
bit 9
AD3E
Address match detection enable bit 3
0
Disables address match detection in PADR3
1
Enables address match detection in PADR3
bit 10
Reserved
0
Reserved bit
Be sure to set the value to "0".
bit 11
AD4E
Address match detection enable bit 4
0
Disables address match detection in PADR4
1
Enables address match detection in PADR4
bit 12
Reserved
0
Reserved bit
Be sure to set the value to "0".
bit 13
AD5E
Address match detection enable bit 5
0
Disables address match detection in PADR5
1
Enables address match detection in PADR5
bit 14
Reserved
0
Reserved bit
Be sure to set the value to "0".
bit 15
Reserved
R/W : Readable/Writable
0
Reserved bit
Be sure to set the value to "0".
: Initial value
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
619
CHAPTER 23 ADDRESS MATCH DETECTION FUNCTION
23.3 Configuration of Address Match Detection Function
MB90340E Series
Table 23.3-2 Functions of Address Detection Control Register 1 (PACSR1)
Bit name
bit15,
bit14
Function
Reserved bits
Be sure to set these bits to "0".
bit13
AD5E:
Address match detection
enable bit 5
The address match detection operation with the detection address setting register 5 (PADR5) is
enabled or disabled.
When set to "0": Disables the address match detection operation.
When set to "1": Enables the address match detection operation.
When the value of detection address setting registers 5 (PADR5) matches with the value of
address latch at enabling the address match detection operation (AD5E=1), the INT9
instruction is immediately executed.
bit12
Reserved bit
Be sure to set this bit to "0".
bit11
AD4E:
Address match detection
enable bit 4
The address match detection operation with the detection address setting register 4 (PADR4) is
enabled or disabled.
When set to "0": Disables the address match detection operation.
When set to "1": Enables the address match detection operation.
When the value of detection address setting registers 4 (PADR4) matches with the value of
address latch at enabling the address match detection operation (AD4E=1), the INT9
instruction is immediately executed.
bit10
Reserved bit
Be sure to set this bit to "0".
bit9
AD3E:
Address match detection
enable bit 3
The address match detection operation with the detection address setting register 3 (PADR3) is
enabled or disabled.
When set to "0": Disables the address match detection operation.
When set to "1": Enables the address match detection operation.
When the value of detection address setting registers 3 (PADR3) matches with the value of
address latch at enabling the address match detection operation (AD3E=1), the INT9
instruction is immediately executed.
bit8
Reserved bit
Be sure to set this bit to "0".
620
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 23 ADDRESS MATCH DETECTION FUNCTION
23.3 Configuration of Address Match Detection Function
MB90340E Series
23.3.2
Detection Address Setting Registers (PADR0 to PADR5)
The value of an address to be detected is set in the detection address setting registers.
When the address of the instruction processed by the program matches the address set
in the detection address setting registers, the next instruction is forcibly replaced with
the INT9 instruction, and the interrupt processing program is executed.
■ Detection Address Setting Registers (PADR0 to PADR5)
Figure 23.3-4 Detection Address Setting Registers (PADR0 to PADR5)
Address
PADR5: Upper
PADR2: Upper
PADR5: Medium
PADR2: Medium
PADR5: Lower
PADR2: Lower
PADR4: Upper
PADR1: Upper
PADR4: Medium
PADR1: Medium
PADR4: Lower
PADR1: Lower
0079F8 H
0079E8H
bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 Initial value
D23 D22 D21 D20 D19 D18 D17 D16 XXXXXXXX B
0079F7 H
0079E7H
R/W R/W R/W R/W R/W R/W R/W R/W
bit15 bit14 bit13 bit12 bit11 bit10 bit9 bit8
D15 D14 D13 D12 D11 D10 D9
D8
Initial value
0079F6 H
0079E6H
R/W R/W R/W R/W R/W R/W R/W R/W
bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0
D7
D6
D5
D4 D3
D2
D1
D0
Initial value
R/W R/W R/W R/W R/W R/W R/W R/W
bit15 bit14 bit13 bit12 bit11 bit10 bit9 bit8
0079F5 H
0079E5H
0079F4 H
0079E4H
0079F3 H
0079E3H
D23 D22
D21
D20 D19 D18
D17
D16
D13
D12 D11 D10
D9
D8
R/W R/W R/W R/W R/W R/W R/W R/W
bit15 bit14 bit13 bit12 bit11 bit10 bit9 bit8
D7
D6
D5
D4 D3
D2
D1
D0
R/W R/W R/W R/W R/W R/W R/W R/W
bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0
PADR3: Upper
PADR0: Upper
PADR3: Medium
PADR0: Medium
PADR3: Lower
PADR0: Lower
0079F2 H
0079E2H
0079F1 H
0079E1H
0079F0 H
0079E0H
D23 D22
D21
D20 D19 D18
D17
XXXXXXXX B
Initial value
XXXXXXXX B
R/W R/W R/W R/W R/W R/W R/W R/W
bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0
D15 D14
XXXXXXXX B
D16
Initial value
XXXXXXXX B
Initial value
XXXXXXXX B
Initial value
XXXXXXXX B
R/W R/W R/W R/W R/W R/W R/W R/W
bit15 bit14 bit13 bit12 bit11 bit10 bit9 bit8
D15 D14 D13 D12 D11 D10 D9
D8
Initial value
R/W R/W R/W R/W R/W R/W R/W R/W
bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0
D7
D6
D5
D4 D3
D2
D1
D0
Initial value
XXXXXXXX B
XXXXXXXX B
R/W R/W R/W R/W R/W R/W R/W R/W
R/W : Readable/Writable
X
: Undefined
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
621
CHAPTER 23 ADDRESS MATCH DETECTION FUNCTION
23.3 Configuration of Address Match Detection Function
■ Functions of Detection Address Setting Registers
MB90340E Series
• There are 6 detection address setting registers (PADR0 to PADR5) that consist of a upper byte (bank),
medium byte, and lower byte, totaling 24 bits.
Table 23.3-3 Address Setting of Detection Address Setting Registers
Register name
Interrupt output
enabled
Address setting
upper
Detection address
setting register 0
(PADR0)
Detection address
setting register 1
(PADR1)
Detection address
setting register 2
(PADR2)
Detection address
setting register 3
(PADR3)
Detection address
setting register 4
(PADR4)
Detection address
setting register 5
(PADR5)
622
PACSR0:
AD0E
PACSR0:
AD1E
PACSR0:
AD2E
PACSR1:
AD3E
PACSR1:
AD4E
PACSR1:
AD5E
Set the upper 8 bits of detection address 0 (bank)
medium
Set the middle 8 bits of detection address 0
Lower
Set the lower 8 bits of detection address 0
upper
Set the upper 8 bits of detection address 1 (bank)
medium
Set the middle 8 bits of detection address1
Lower
Set the lower 8 bits of detection address 1
upper
Set the upper 8 bits of detection address 2 (bank)
medium
Set the middle 8 bits of detection address 2
Lower
Set the lower 8 bits of detection address 2
upper
Set the upper 8 bits of detection address 3 (bank)
medium
Set the middle 8 bits of detection address 3
Lower
Set the lower 8 bits of detection address 3
upper
Set the upper 8 bits of detection address 4 (bank)
medium
Set the middle 8 bits of detection address 4
Lower
Set the lower 8 bits of detection address 4
upper
Set the upper 8 bits of detection address 5 (bank)
medium
Set the middle 8 bits of detection address 5
Lower
Set the lower 8 bits of detection address 5
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 23 ADDRESS MATCH DETECTION FUNCTION
23.3 Configuration of Address Match Detection Function
MB90340E Series
• In the detection address setting registers (PADR0 to PADR5), starting address (first byte) of instruction
to be replaced with the INT9 instruction should be set.
Figure 23.3-5 Setting of Starting Address of Instruction Code to be Replaced with INT9 Instruction
Set to detection address (High: FFH, Middle: 00H, Low: 1FH)
Address
FF001CH:
FF001FH:
FF0022H:
Instruction code
A8 00 00
4A 00 00
4A 80 08
Mnemonic
MOVW
MOVW
MOVW
RW0,#0000
A,#0000
A,#0880
Notes:
• When an address other than the first byte is set to the detection address setting registers (PADR0
to PADR5), the instruction code is not replaced with the INT9 instruction and a program of an
interrupt processing is not be performed. When the address is set to the second byte or
subsequent, the address specified by the instruction code is replaced with 01H (INT9 instruction
code) and, which may cause malfunction.
• The detection address setting registers (PADR0 to PADR5) should be set after disabling the
address match detection (PACSR: ADnE=0) of the corresponding address match control
registers. If the detection address setting registers are changed without disabling the address
match detection, the address match detection function will work immediately after an address
match occurs during writing address, which may cause malfunction.
• The address match detection function can be used only for addresses of the internal ROM area. If
addresses of the external memory area are set, the address match detection function will not work
and the INT9 instruction will not be executed.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
623
CHAPTER 23 ADDRESS MATCH DETECTION FUNCTION
23.4 Explanation of Operation of Address Match Detection
Function
23.4
MB90340E Series
Explanation of Operation of Address Match Detection
Function
If the addresses of the instructions executed in the program match those set in the
detection address setting registers (PADR0 to PADR5), the address match detection
function will replace the first instruction code executed by the CPU with the INT9 (01H)
instruction to branch to the interrupt processing program.
■ Operation of Address Match Detection Function
Figure 23.4-1 shows the operation of the address match detection function.
Figure 23.4-1 Operation of Address Match Detection Function
Program execution
Address
Address of the instruction to
be executed by program
matches detection address
setting register 0
FF001CH:
FF001FH:
FF0022H:
Instruction code
A8 00 00
4A 00 00
4A 80 08
Mnemonic
MOVW
MOVW
MOVW
RW0,#0000
A,#0000
A,#0880
Replaced with the INT9 instruction (01H)
■ Setting Detection Address
• Disable the detection address setting register 0 (PADR0) where the detection address is set for address
match detection (PACSR0: AD0E=0).
• Set the detection address in the detection address setting register 0 (PADR0). Set FFH at the upper bits,
00H at the medium bits, and 1FH at the lower bits of the detection address setting register 0 (PADR0).
• Enable the detection address setting register 0 (PADR0) where the detection address is set for address
match detection (PACSR0: AD0E=1).
■ Program Execution
• If the address of the instruction to be executed in the program matches the set detection address, the first
instruction code at the matched address is replaced with the INT9 instruction code (01H).
• INT9 instruction is executed. INT9 interrupt is generated and then interrupt processing program is
executed.
624
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 23 ADDRESS MATCH DETECTION FUNCTION
23.4 Explanation of Operation of Address Match Detection Function
MB90340E Series
23.4.1
Example of Using Address Match Detection Function
This section gives an example of patch processing for program correction using the
address match detection function.
■ System Configuration and E2PROM Memory Map
● System configuration
Figure 23.4-2 gives an example of the system configuration using the address match detection function.
Figure 23.4-2 Example of System Configuration Using Address Match Detection Function
Serial E2PROM
interface
MCU
E2PROM
F2MC-16LX
Storing patch program
Pull-up resistor
SIN
CM44-10143-5E
Connector (UART)
Fetching patch program from the outside
FUJITSU SEMICONDUCTOR LIMITED
625
CHAPTER 23 ADDRESS MATCH DETECTION FUNCTION
23.4 Explanation of Operation of Address Match Detection
Function
2
MB90340E Series
■ E PROM Memory Map
Figure 23.4-3 shows the allocation of the patch program and data to store the patch program in E2PROM.
Figure 23.4-3 Allocation of E2PROM Patch Program and Data
E2PROM
address
PADR0
PADR1
0 0 0 0H
Patch program byte count
0 0 0 1H
Detection address 0 (Low)
0 0 0 2H
Detection address 0 (Middle)
0 0 0 3H
Detection address 0 (High)
0 0 0 4H
Patch program byte count
0 0 0 5H
Detection address 1 (Low)
0 0 0 6H
Detection address 1 (Middle)
0 0 0 7H
Detection address 1 (High)
•
•
•
PADR5
For patch program 1
•
•
•
0 0 1 4H
Patch program byte count
0 0 1 5H
Detection address 5 (Low)
0 0 1 6H
Detection address 5 (Middle)
0 0 1 7H
Detection address 5 (High)
0 0 2 0H
0 0 3 0H
•
•
•
0070
For patch program 0
For patch program 5
Patch program 0 (main body)
Patch program 1 (main body)
•
•
•
H
Patch program 5 (main body)
● Patch program byte count
The total byte count of the patch program (main body) is stored. If the byte count is 00H, it indicates that no
patch program is provided.
● Detection address (24 bits)
The address where the instruction code is replaced with the INT9 instruction code due to program error is
stored. This address is set in the detection address setting registers (PADR0 to PADR5).
● Patch program (main body)
The program executed by the INT9 interrupt processing when the program address matches the detection
address is stored. Patch program 0 is allocated from any predetermined address. Patch program 1 is
allocated from the address indicating <starting address of patch program 0 + total byte count of patch
program 0>.
It is much the same for the correction program 2 to 5.
626
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 23 ADDRESS MATCH DETECTION FUNCTION
23.4 Explanation of Operation of Address Match Detection Function
MB90340E Series
■ Setting and Operation State
● Initial setting
All the E2PROM data are cleared to 00H.
● Occurrence of program error
• By using the connector (UART), information about the patch program is transmitted to the MCU from
the outside according to the allocation of the E2PROM patch program and data.
• The MCU stores the information received from outside in the E2PROM.
● Reset sequence
• After reset, the MCU reads the byte count of the E2PROM patch program to check the presence or
absence of the patch program.
• If the byte count of the patch program is not 00H, the upper, medium and lower bits at detection
addresses 0 to 5 are read and set in the detection address setting registers 0 to 5 (PADR0 to PADR5).
The patch program (main body) is read according to the byte count of the patch program and written to
RAM in MCU.
• The patch program (main body) is allocated to the address where the patch program is executed in the
INT9 interrupt processing by the address match detection function.
• Address match detection operation is enabled (PACSR: AD0E=1, AD1E=1 ... AD5E=1).
● INT9 interrupt processing
• Interrupt processing is performed by the INT9 instruction. This series has no interrupt request flag by
address match detection. Therefore, if the stack information in the program counter is discarded, the
detection address cannot be checked. When checking the detection address, check the value of program
counter stacked in the interrupt processing routine.
• The patch program is executed, branching to the normal program.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
627
CHAPTER 23 ADDRESS MATCH DETECTION FUNCTION
23.4 Explanation of Operation of Address Match Detection
Function
MB90340E Series
■ Operation of Address Match Detection Function at Storing Patch Program in E2PROM
Figure 23.4-4 shows the operation of the address match detection function at storing the patch program in
E2PROM.
Figure 23.4-4 Operation of Address Match Detection Function at Storing Patch Program in E2PROM
000000H
(3)
Patch program
RAM
Detection address setting registers
(1)
Detection address setting
(reset sequence)
E2PROM
Serial E2PROM
interface
• Patch program byte
count
• Address for address
detection
• Patch program
ROM
(2)
(4)
Program error
FFFFFFH
(1) Execution of detection address setting of reset sequence and normal program
(2) Branch to patch program which expanded in RAM with INT9 interrupt processing by address match
detection
(3) Patch program execution by branching of INT9 processing
(4) Execution of normal program which branches from patch program
628
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 23 ADDRESS MATCH DETECTION FUNCTION
23.4 Explanation of Operation of Address Match Detection Function
MB90340E Series
■ Flow of Patch Processing for Patching Program
Figure 23.4-5 shows the patch processing flow of the patch program using the address match detection
function.
Figure 23.4-5 Flow of Patch Processing for Patch Program
000000H
I/O area
0000H
E2PROM
Patch program byte count: 80H
000100H
Register/RAM area
0001H
Detection address (Lower): 00H
000400H
Patch program
0002H
Detection address (Medium): 80H
000480H
RAM area
0003H
Detection address (Upper): FFH
MCU (This series)
RAM
Stack area
0010H
Patch program
000900H
Detection address setting
register
0090H
FFFFH
FF0000H
Program error
FF8000H
ROM
FF8050H
FFFFFFH
Reset
YES
INT9
E2PROM: Read 00H
Branch to patch program
JMP 000400H
E2PROM :
0000H = 0
Execution of patch
program
000400H to 000480H
NO
End of patch program
JMP FF8050H
Read detection address
E2PROM:
0001H to 0003H
↓
MCU: Set to PADR0
Read patch program
E2PROM:
0010H to 008FH
↓
MCU:
000400H to 000047FH
Enable address match
detection
(PACSR: AD0E = 1)
Execution of normal
program
NO
CM44-10143-5E
Program address =
PADR0
YES
INT9
FUJITSU SEMICONDUCTOR LIMITED
629
CHAPTER 23 ADDRESS MATCH DETECTION FUNCTION
23.5 Program Example of Address Match Detection Function
23.5
MB90340E Series
Program Example of Address Match Detection Function
This section gives a program example for the address match detection function.
■ Program Example of Address Match Detection Function
● Processing specifications
If the address of the instruction to be executed by the program matches the address set in the detection
address setting register (PADR0), the INT9 instruction is executed.
● Coding example
PACSR0 EQU
PADRL EQU
00009EH
0079E0H
PADRM
EQU
0079E1H
PADRH
EQU
0079E2H
;Address detection
;Detection address
;(Low)
;Detection address
;(Middle)
;Detection address
;(High)
control register 0
setting register 0
setting register 0
setting register 0
;
;---------Main program----------------------------------------------CODE
CSEG
START:
;Assume that the items such as the
;stack pointer (SP) have been
;initialized.
MOV
PADRL,#00H
;Set address detection register 0
;(Low)
MOV
PADRM,#00H
;Set address detection register 0
;(Middle)
MOV
PADRH,#00H
;Set address detection register 0
;(High)
;
MOV
I:PACSR0,#00000010B ;Enable address match
•
User processing
•
LOOP:
•
User processing
•
BRA
LOOP
;---------Interrupt program-----------------------------------------WARI:
•
630
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
MB90340E Series
CHAPTER 23 ADDRESS MATCH DETECTION FUNCTION
23.5 Program Example of Address Match Detection Function
User processing
•
RETI
;Returns from interrupt processing
CODE
ENDS
;---------Vector setting--------------------------------------------VECT
CSEG ABS=0FFH
ORG
00FFD8H
DSL
WARI
ORG
00FFDCH
;Sets reset vector
DSL
START
DB
00H
;Sets to single chip mode
VECT
ENDS
END
START
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
631
CHAPTER 23 ADDRESS MATCH DETECTION FUNCTION
23.5 Program Example of Address Match Detection Function
632
FUJITSU SEMICONDUCTOR LIMITED
MB90340E Series
CM44-10143-5E
CHAPTER 24
ROM MIRRORING FUNCTION
SELECT MODULE
This chapter explains the functions and operations of
the ROM mirroring function select module.
24.1 Overview of ROM Mirroring Function Select Module
24.2 ROM Mirroring Function Select Register (ROMM)
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
633
CHAPTER 24 ROM MIRRORING FUNCTION SELECT MODULE
24.1 Overview of ROM Mirroring Function Select Module
24.1
MB90340E Series
Overview of ROM Mirroring Function Select Module
The ROM mirroring function select module provides a setting so that ROM data in the
FF bank can be read by access to the 00 bank.
■ Block Diagram of ROM Mirroring Function Select Module
Figure 24.1-1 Block Diagram of ROM Mirroring Function Select Module
ROM Mirroring Function Select Register (ROMM)
Internal data bus
ReReReReReReReserved served served served served served served
MI
Address
Address area
00 bank
FF bank
Data
ROM
■ Access to FF Bank by ROM Mirroring Function
Figure 24.1-2 shows the location in memory when the ROM mirroring function allows access to the 00
bank to read ROM data in the FF bank.
Figure 24.1-2 Access to FF Bank by ROM mirror Function
008000H
00 bank
ROM mirror area
00FFFFH
F80000H
MB90F345E/CE/
ES/CES
FC0000H
FE0000H
FEFFFFH
FF0000H
FF8000H
FFFFFFH
634
FF bank
(ROM mirror target area)
MB90(F)346E/CE/
ES/CES
MB90341E/CE/ES/CES
MB90348E/CE/ES/CES
MB90(F)347E/CE/
ES/CES
MB90(F)342E/CE/
ES/CES
MB90(F)349E/CE/
ES/CES
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 24 ROM MIRRORING FUNCTION SELECT MODULE
24.1 Overview of ROM Mirroring Function Select Module
MB90340E Series
■ Memory Space with ROM Mirroring Function Enabled/Disabled
Figure 24.1-3 shows the availability of access to memory space when the ROM mirroring function is
enabled or disabled.
Figure 24.1-3 Memory Space with ROM Mirroring Function Enabled/Disabled
Single chip
Internal ROM/
external bus
External ROM/
external bus
ROM area
ROM area
ROM area
(image of
FF bank)
ROM area
(image of FF
bank)
Extended I/O area
Extended I/O area
FFFFFFH
Address #1
010000 H
008000 H
007900 H
Extended I/O area
: Internal
Address #2
RAM
000100 H
0000F0H
000000 H
Generalpurpose register
RAM
Generalpurpose register
RAM
: External
: Access disabled
I/O
I/O
I/O
Generalpurpose register
Product name
MB90F345E/CE/ES/CES
Address #1
F80000H
Address #2
005100H
MB90(F)346E/CE/ES/CES
FF0000H
000900H
MB90(F)347E/CE/ES/CES
FE0000H
001900H
MB90341E/CE/ES/CES, MB90348E/CE/ES/CES
FE0000H
004000H
MB90(F)342E/CE/ES/CES, MB90(F)349E/CE/ES/CES
FC0000H
004000H
MB90V340E-101/102
F80000H
007900H
■ List of Registers and Reset Values of ROM Mirroring Function Select Module
Figure 24.1-4 List of Registers and Reset Values of ROM Mirroring Function Select Module
bit
ROM mirroring function select register
(ROMM)
15
14
13
12
11
10
9
8
×
×
×
×
×
×
×
1
×: Undefined
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
635
CHAPTER 24 ROM MIRRORING FUNCTION SELECT MODULE
24.2 ROM Mirroring Function Select Register (ROMM)
24.2
MB90340E Series
ROM Mirroring Function Select Register (ROMM)
The ROM mirroring function select register enables or disables the ROM mirroring
function. When the ROM mirroring function is enabled, ROM data in the FF bank can be
read by access to the 00 bank.
■ ROM Mirroring Function Select Register (ROMM)
Figure 24.2-1 ROM Mirroring Function Select Register (ROMM)
Address
15
14
13
12
11
10
9
8
MI
00006FH
Initial value
XXXXXXX1B
W
bit8
W
X
: Write only
MI
: Undefined
0
ROM mirroring function disabled
: Undefined
1
ROM mirroring function enabled
ROM mirroring function select bit
: Initial value
Table 24.2-1 Functions of ROM Mirroring Function Select Register (ROMM)
Bit name
bit15
to
bit9
bit8
Function
Undefined bits
Read : The value is undefined.
Write : No effect.
MI:
ROM mirroring
function select bit
This bit enables or disables the ROM mirroring function.
When set to "0" : Disables ROM mirroring function.
When set to "1" : Enables ROM mirroring function.
• When the ROM mirroring function is enabled (MI=1), the data at
ROM addresses FF8000H to FFFFFFH can be read by accessing
the addresses 008000H to 00FFFFH.
Note:
While the ROM area at addresses 008000H to 00FFFFH is being used, access to the ROM mirroring
function select register (ROMM) is prohibited.
636
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 25
FLASH MEMORY
This chapter explains the functions and operation of the
0.5M/1M/2M/4M-bit flash memory.
The following three methods are available for writing
data to and erasing data from the flash memory:
1) Parallel programmer
2) Serial programmer
3) Executing programs to write/erase data
This chapter explains "3) Executing programs to write/
erase data".
25.1 Outline of Flash Memory
25.2 Block Diagram of Flash Memory
25.3 Sector Configuration of Flash Memory
25.4 Flash Memory Control Status Register (FMCS)
25.5 Starting the Flash Memory Automatic Algorithm
25.6 Confirming the Automatic Algorithm Execution State
25.7 Writing Data to and Erasing Data from Flash Memory
25.8 Flash Security Feature
25.9 Notes on Using Flash Memory
25.10 Example of Flash Memory Program
25.11 Writing Data to or Erasing Data from External Pins
Code: CM44-00111-2E
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
637
CHAPTER 25 FLASH MEMORY
25.1 Outline of Flash Memory
25.1
MB90340E Series
Outline of Flash Memory
The flash memory is mapped to the FFH to F8H banks in the CPU memory map. The
flash memory enables read-access and program-access from the CPU in the same way
as mask ROM. Instructions from the CPU can be used to write data to and erase data
from the flash memory. Internal CPU control therefore enables rewriting of the flash
memory while it is mounted. As a result, improvements in programs and data can be
performed efficiently.
■ Features of Flash Memory
• Use of automatic program algorithm (Equivalent to Embedded Algorithm)
• Erase pause/restart function provided
• Detection for completion of writing/erasing data using data polling or toggle bit functions
• Detection for completion of writing/erasing data using CPU interrupts
• Sector erase function (any combination of sectors)
• Minimum of 10,000 writing/erasing data operations
• Flash read cycle time (min.): 2 machine cycle
638
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 25 FLASH MEMORY
25.1 Outline of Flash Memory
MB90340E Series
■ Volumes and Products of Flash Memory
As for the flash memory, either 0.5M-bit flash memory, 1M-bit flash memory, 2M-bit flash memory, or
4M-bit flash memory is installed according to the product.
● 0.5M-bit flash memory
• Built-in product:
MB90F346E(S), MB90F346CE(S)
• volume:
64 Kbytes/32 Kwords
• Sector configuration: 32K + 16K + 8K × 2
• Allocated bank:
FFH bank
● 1M-bit flash memory
• Built-in product:
MB90F347E(S), MB90F347CE(S)
• volume:
128 Kbytes/64 Kwords
• Sector configuration: 64K + 32K + 16K + 8K × 2
• Allocated bank:
FEH to FFH bank
● 2M-bit flash memory
• Built-in product:
MB90F342E(S), MB90F342CE(S), MB90F349E(S), MB90F349CE(S)
• volume:
256 Kbytes/128 Kwords
• Sector configuration: 64K × 3 + 32K + 16K + 8K × 2
• Allocated bank:
FCH to FFH bank
● 4M-bit flash memory
• Built-in product:
MB90F345E(S), MB90F345CE(S)
• volume:
512 Kbytes/256 Kwords
• Sector configuration: 64K × 6 + 32K × 2 + 16K × 2 + 8 K × 4
• Allocated bank:
F8H to FFH bank
■ Writing Data to/Erasing Data from Flash Memory
The flash memory cannot write data or erase data, and read data at the same time. That is, when data is
written to or erased from the flash memory, the program in the flash memory must first be copied to RAM.
The entire process is then executed in RAM so that data is simply written to or erased from the flash
memory. This eliminates the need for the program to access the flash memory from the flash memory itself.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
639
CHAPTER 25 FLASH MEMORY
25.2 Block Diagram of Flash Memory
25.2
MB90340E Series
Block Diagram of Flash Memory
This section shows a block diagram of the entire flash memory.
■ Block Diagram of Flash Memory
A block diagram of the entire flash memory is shown in Figure 25.2-1 where the flash memory interface
circuit is included.
Figure 25.2-1 Block Diagram of Flash Memory
Flash memory
interface circuit
Port 0
Port 1
Port 2
Port 3
Port 4
Port 5
BYTE
F2MC-16LX
bus
Flash memory
BYTE
CE
CE
OE
OE
WE
WE
AQ0 to AQ17
AQ0 to AQ18
AQ-1
DQ0 to DQ15
DQ0 to DQ15
INT
RY/BY
Write enable interrupt
signal (to CPU)
RY/BY
RESET
External reset signal
640
FUJITSU SEMICONDUCTOR LIMITED
RY/BY
Write enable signal
CM44-10143-5E
CHAPTER 25 FLASH MEMORY
25.3 Sector Configuration of Flash Memory
MB90340E Series
25.3
Sector Configuration of Flash Memory
This section shows the sector configuration of the flash memory.
■ Sector Configuration of Flash Memory
Figure 25.3-1, Figure 25.3-2, Figure 25.3-3, and Figure 25.3-4 show the sector configuration of the 0.5M/
1M/2M/4M-bit flash memory. The addresses in the figure indicate the high-order and low-order addresses
of each sector.
Figure 25.3-1 Sector Configuration of the 0.5M-bit Flash Memory
SA3 (16 K bytes)
SA2 (8 K bytes)
SA1 (8 K bytes)
CPU
address
Programmer
address*
FFFFFFH
7FFFFH
FFBFFFH
7BFFFH
FF9FFFH
79FFFH
FF7FFFH
77FFFH
FF0000H
70000H
SA0 (32 K bytes)
*: The programmer address corresponds with CPU address for writing data to a flash memory with parallel
programmer. Use the programmer address for writing/erasing data with a general-purpose programmer.
Figure 25.3-2 Sector Configuration of the 1M-bit Flash Memory
CPU
address
SA4 (16 K bytes)
SA3 (8 K bytes)
SA2 (8 K bytes)
Programmer
address*
FFFFFFH
7FFFFH
FFBFFFH
7BFFFH
FF9FFFH
79FFFH
FF7FFFH
77FFFH
FEFFFFH
6FFFFH
FE0000H
60000H
SA1 (32 K bytes)
SA0 (64 K bytes)
*: The programmer address corresponds with CPU address for writing data to a flash memory with parallel
programmer. Use the programmer address for writing/erasing data with a general-purpose programmer.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
641
CHAPTER 25 FLASH MEMORY
25.3 Sector Configuration of Flash Memory
MB90340E Series
Figure 25.3-3 Sector Configuration of the 2M-bit Flash Memory
CPU
address
SA6 (16 K bytes)
SA5 (8 K bytes)
SA4 (8 K bytes)
SA3 (32 K bytes)
Programmer
address*
FFFFFFH
7FFFFH
FFBFFFH
7BFFFH
FF9FFFH
79FFFH
FF7FFFH
77FFFH
FEFFFFH
6FFFFH
FDFFFFH
5FFFFH
FCFFFFH
4FFFFH
FC0000H
40000H
SA2 (64 K bytes)
SA1 (64 K bytes)
SA0 (64 K bytes)
*: The programmer address corresponds with CPU address for writing data to a flash memory with parallel
programmer. Use the programmer address for writing/erasing data with a general-purpose programmer.
642
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 25 FLASH MEMORY
25.3 Sector Configuration of Flash Memory
MB90340E Series
Figure 25.3-4 Sector Configuration of the 4M-bit Flash Memory
CPU
address
Programmer
address*
FFFFFFH
7FFFFH
FFBFFFH
7BFFFH
FF9FFFH
79FFFH
FF7FFFH
77FFFH
FEFFFFH
6FFFFH
FDFFFFH
5FFFFH
FCFFFFH
4FFFFH
FBFFFFH
3FFFFH
FBBFFFH
3BFFFH
FB9FFFH
39FFFH
FB7FFFH
37FFFH
FAFFFFH
2FFFFH
F9FFFFH
1FFFFH
F8FFFFH
0FFFFH
F80000H
00000H
SA13 (16 K bytes)
SA12 (8 K bytes)
SA11 (8 K bytes)
SA10 (32 K bytes)
SA9 (64 K bytes)
SA8 (64 K bytes)
SA7 (64 K bytes)
SA6 (16 K bytes)
SA5 (8 K bytes)
SA4 (8 K bytes)
SA3 (32 K bytes)
SA2 (64 K bytes)
SA1 (64 K bytes)
SA0 (64 K bytes)
*: The programmer address corresponds with CPU address for writing data to a flash memory with parallel
programmer. Use the programmer address for writing/erasing data with a general-purpose programmer.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
643
CHAPTER 25 FLASH MEMORY
25.4 Flash Memory Control Status Register (FMCS)
25.4
MB90340E Series
Flash Memory Control Status Register (FMCS)
The flash memory control status register (FMCS) functions are described below.
■ Flash Memory Control Status Register (FMCS)
Figure 25.4-1 Flash Memory Control Status Register (FMCS)
Address:
0000AEH
7
6
5
INTE
RDYINT
WE
4
3
2
1
0
Re-
Re-
Re-
Re-
Initial value
RDY served served served served
R/W R/W R/W R
000X0000B
R/W R/W R/W R/W
bit0
Reserved bit
Reserved
0
Be sure to set "0".
bit1
Reserved bit
Reserved
0
Be sure to set "0".
bit2
Reserved bit
Reserved
0
Be sure to set "0".
bit3
Reserved bit
Reserved
0
Be sure to set "0".
bit4
RDY
Flash memory data write/erase status bit
0
Data write/erase operation executing
1
Data write/erase operation completed
bit5
WE
Flash memory write enable bit
0
Write operation of flash memory area disabled
1
Write operation of flash memory area enabled
bit6
RDYINT
Flash memory interrupt flag bit
Reading
Writing
0
No interrupt request
Clearing RDYINT bit
1
Operation completed (with interrupt request)
No effect
bit7
INTE
R/W : Readable/writable
R
: Read only
X
: Undefined
: Initial value
644
Flash memory interrupt enable bit
0
Disable interrupt at data write/erase completion
1
Enable interrupt at data write/erase completion
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 25 FLASH MEMORY
25.4 Flash Memory Control Status Register (FMCS)
MB90340E Series
Table 25.4-1 Function Description in the Control Status Register (FMCS)
Bit name
Function
INTE:
Flash memory interrupt
enable bit
This bit enables or disables an interrupt request output upon completion of the flash memory
data write/erase operation.
When "1" is set, setting "1" in the flash memory operation flag bit (FMCS:RDYINT=1)
causes an interrupt request to be output.
RDYINT:
Flash memory interrupt flag
bit
This bit is the interrupt request flag set by the end of the automatic algorithm for the flash
memory data write/erase operation.
When the flash memory automatic algorithm ends upon completion of the flash memory data
write/erase operation, this bit is set to "1".
• When interrupt upon completion of writing data to or erasing data from the flash memory
is enabled (FMCS:INTE=1), setting this bit to "1" causes an interrupt request to be
generated.
When "0" is set, this bit is cleared.
When "1" is set, operation is not affected.
When using the read-modify-write (RMW) instruction, "1" is always read out.
bit5
WE:
Flash memory write enable
bit
This bit enables or disables writing to flash memory area.
This bit is set before starting the data writing to/erasing flash memory command.
When "0" is set, write/erase signal is not generated by executing the F9/FC/FE to FF bank
write/erase command sequence.
When "1" is set, write/erase to flash memory is enabled after executing the F9/FC/FE to FF
bank write/erase command sequence.
• When performing no data write/erase operation, set this bit to "0" to avoid write to flash
memory in mistake.
bit4
RDY:
Flash memory data write/
erase status bit
This bit shows status of writing data to or erasing data from the flash memory.
• While this bit is "0", flash memory data write/erase operation is disabled.
• Even while this bit is "0", a reset command such as sector erase pause is accepted. When
data write/erase operation is ended, "1" is set.
bit3
to
bit0
Reserved: Reserved bits
Be sure to set these bits to "0".
bit7
bit6
Note:
This register can be accessed only with byte-access.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
645
CHAPTER 25 FLASH MEMORY
25.5 Starting the Flash Memory Automatic Algorithm
25.5
MB90340E Series
Starting the Flash Memory Automatic Algorithm
Four types of commands are available for starting the flash memory automatic
algorithm: Reset, Data Write, Chip Erase, and Sector Erase. Control of suspend and
restart is enabled for Sector Erase.
■ Command Sequence Table
Table 25.5-1 lists the commands used for flash memory data write/erase operations. Always use word
access to write to the flash memory area. The high-order bytes indicated by "XX" in the command sequence
are ignored at this time.
Table 25.5-1 Command Sequence Table
Command
sequence
Write
access
1st write cycle
Address
2nd write cycle
Data
3rd write cycle
4th write cycle
5th write cycle
6th write cycle
Address
Data
Address
Data
Address
Data
Address
Data
Address
Data
—
—
—
—
—
—
—
—
—
Reset*
1
FxXXXX XXF0
—
Reset*
4
FxAAAA XXAA
Fx5554
XX55 FxAAAA XXF0
—
—
—
—
—
—
Data write
4
FxAAAA XXAA
Fx5554
XX55 FxAAAA XXA0
PA
(even)
PD
(word)
—
—
—
—
Chip erase
6
FxAAAA XXAA
Fx5554
XX55 FxAAAA XX80 FxAAAA XXAA
Fx5554
XX55 FxAAAA XX10
Sector erase
6
FxAAAA XXAA
Fx5554
XX55 FxAAAA XX80 FxAAAA XXAA
Fx5554
XX55
SA
(even)
Sector erase suspend
Writing address FxXXXX data (xxB0H) suspends erasing during sector erase.
Sector erase restart
Writing address FxXXXX data (xx30H) restarts erasing after erasing is suspended during sector erase.
XX30
Notes:
•
The addresses Fx in the table should be used as the access target bank values for operations. This means FF/FE for 1M-bit flash
memory, FF to FC for 2M-bit flash memory, and FF to F8 for 4M-bit flash memory.
• The addresses in the table are the values in the CPU memory map. All addresses and data are represented using hexadecimal notation.
However, X is an optional value.
• PA: Write address. Only even addresses can be specified.
• SA: Sector address. See Section "25.2 Block Diagram of Flash Memory".
• PD: Write data. Only word data can be specified.
*: Both of the two types of Reset commands can reset the flash memory to read mode.
646
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 25 FLASH MEMORY
25.6 Confirming the Automatic Algorithm Execution State
MB90340E Series
25.6
Confirming the Automatic Algorithm Execution State
The data write/erase operation of the flash memory is controlled using the automatic
algorithm. The flash memory has the hardware sequence flags for posting its internal
operating state and completion of operation. When the automatic algorithm is executing,
the hardware sequence flags can be read out by the read operation for the flash memory
area.
■ Hardware Sequence Flags
The hardware sequence flags are configured from the four-bit output of DQ7, DQ6, DQ5, and DQ3. The
functions of these bits are those of the data polling flag (DQ7), toggle bit flag (DQ6), timing limit exceeded
flag (DQ5), and sector erase timer flag (DQ3). The hardware sequence flags can therefore be used to
confirm that data writing or chip/sector erase has been completed or that added erase commands are valid.
The hardware sequence flags can be referred by read-accessing the addresses of the target sectors in the
flash memory after setting of the command sequence (see Table 25.5-1 in Section "25.5 Starting the Flash
Memory Automatic Algorithm"). Table 25.6-1 lists the bit assignments of the hardware sequence flags.
Table 25.6-1 Bit Assignments of Hardware Sequence Flags
Bit No.
7
6
5
4
Hardware sequence flags
DQ7
DQ6
DQ5
−
3
2
1
0
DQ3
−
−
−
To determine whether data writing or chip/sector erasing is being executed, the hardware sequence flags or
the RDY bit of the flash memory control register (FMCS) can be checked. After data writing/erasing has
terminated, the state returns to the read/reset state. When creating a program, use one of the flags to
confirm that data writing/erasing has terminated. Then, perform the next processing operation, such as data
read. In addition, the hardware sequence flags can be used to confirm whether a second or subsequent
sector erase code write is valid.
Table 25.6-2 lists the functions of the hardware sequence flags.
Table 25.6-2 Hardware Sequence Flag Functions
State
State change for
normal operation
DQ7
DQ6
DQ5
DQ3
Data write →Write completed
(write address specified)
DQ7 →
DATA:7
Toggle →
DATA:6
0→
DATA:5
0→
DATA:3
Chip/sector erase →Erase completed
0→
DATA:7
Toggle →
DATA:6
0→
DATA:5
1→
DATA:3
Sector erase time-out →Erase started
0
Toggle
0
0 →1
Erase →Sector erase suspended
(sector being erased)
0 →1
Toggle →
1
0
1 →0
Sector erase suspend →Erase restarted
(sector being erased)
1 →0
1→
Toggle
1
0 →1
DATA:7
DATA:6
DATA:5
DATA:3
DQ7
Toggle
1
0
0
Toggle
1
1
Sector erase suspended (sector not being
erased)
Abnormal operation
CM44-10143-5E
Write
Chip/sector erase
FUJITSU SEMICONDUCTOR LIMITED
647
CHAPTER 25 FLASH MEMORY
25.6 Confirming the Automatic Algorithm Execution State
25.6.1
MB90340E Series
Data Polling Flag (DQ7)
The data polling flag (DQ7) is the hardware sequence flag which uses the data polling
function to post that the automatic algorithm is being executed or has terminated.
■ Data Polling Flag (DQ7)
Table 25.6-3 and Table 25.6-4 list the state transitions of the data polling flag.
Table 25.6-3 Data Polling Flag State Transitions (State Change for Normal Operation)
Operating state
Data write →
Completed
Chip/sector
erase →
Completed
Sector erase
time-out →
Started
Sector erase →
Erase suspend
(sector being
erased)
Sector erase
suspend →
Restarted
(sector being
erased)
Sector erase
suspended
(sector not being
erased)
DQ7
DQ7 →DATA:7
0 →DATA:7
0
0 →1
1 →0
DATA:7
Table 25.6-4 Data Polling Flag State Transitions (State Change for Abnormal Operation)
Operating state
Data write operation
Chip/sector erase operation
DQ7
DQ7
0
● Write
Read-access during execution of the automatic algorithm for data write operation causes the flash memory
to output the opposite data of bit7 last written, regardless of the value at the address specified by the
address signal. Read-access at the end of the automatic algorithm causes the flash memory to output bit7 of
the read value of the address specified by the address signal.
● Sector erase
For a sector erase, read-access during execution of automatic algorithm causes the flash memory to output
"0" from the sector currently being erased. Read-access at the end of a sector erase causes the flash memory
to output "1".
● Chip erase
For a chip erase, read-access during execution of automatic algorithm causes the flash memory to output
"0" regardless of the value at the address specified by the address signal. Read-access at the end of a chip
erase causes the flash memory to output "1".
● Sector erase suspend
Read-access for an access from sector erase suspend causes the flash memory to output "1" if the address
specified by the address signal belongs to the sector being erased. The flash memory outputs bit7 (DATA:
7) of the read value at the address specified by the address signal if the address specified by the address
signal does not belong to the sector being erased. Referencing this flag together with the toggle bit flag
(DQ6) enables a decision to be made on whether the flash memory is in the sector erase suspended state
and which sector is being erased.
648
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
MB90340E Series
CHAPTER 25 FLASH MEMORY
25.6 Confirming the Automatic Algorithm Execution State
Note:
When the automatic algorithm is being started, read-access to the specified address is ignored.
Since termination of the data polling flag (DQ7) can be accepted for a data read and other bits
output, data read after the automatic algorithm has terminated should be performed after readaccess has confirmed that data polling has terminated.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
649
CHAPTER 25 FLASH MEMORY
25.6 Confirming the Automatic Algorithm Execution State
25.6.2
MB90340E Series
Toggle Bit Flag (DQ6)
Like the data polling flag (DQ7), the toggle bit flag (DQ6) is the hardware sequence flag
which uses the toggle bit function to post that the automatic algorithm is being executed
or has terminated.
■ Toggle Bit Flag (DQ6)
Table 25.6-5 and Table 25.6-6 list the state transitions of the toggle bit flag.
Table 25.6-5 Toggle Bit Flag State Transitions (State Change for Normal Operation)
Operating state
DQ6
Data write →
Completed
Chip/sector erase
→Completed
Toggle →DATA:6 Toggle → DATA:6
Sector erase
time-out →
Started
Sector erase →
Erase suspend
(sector being
erased)
Sector erase
suspend →
Restarted
(sector being
erased)
Sector erase
suspended
(sector not being
erased)
Toggle
Toggle → 1
1 → Toggle
DATA:6
Table 25.6-6 Toggle Bit Flag State Transitions (State Change for Abnormal Operation)
Operating state
Data write operation
Chip/sector erase operation
DQ6
Toggle
Toggle
● Write and chip/sector erase
Continuous read-access during execution of the automatic algorithm for data write or chip/sector erase
operation causes the flash memory to toggle the "1" or "0" state alternately for every read cycle, regardless
of the value at the address specified by the address signal. Continuous read-access at the end of the
automatic algorithm causes the flash memory to stop toggling bit6 and output bit6 (DATA: 6) of the read
value of the address specified by the address signal.
● Sector erase suspend
Read-access during a sector erase suspend causes the flash memory to output "1" if the address specified by
the address signal belongs to the sector being erased. The flash memory outputs bit6 (DATA: 6) of the read
value at the address specified by the address signal if the address specified by the address signal does not
belong to the sector being erased.
650
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 25 FLASH MEMORY
25.6 Confirming the Automatic Algorithm Execution State
MB90340E Series
25.6.3
Timing Limit Exceeded Flag (DQ5)
The timing limit exceeded flag (DQ5) is the hardware sequence flag used to post that
execution of the automatic algorithm has exceeded the time (internal pulse count)
prescribed in the flash memory.
■ Timing Limit Exceeded Flag (DQ5)
Table 25.6-7 and Table 25.6-8 list the state transitions of the timing limit exceeded flag.
Table 25.6-7 Timing Limit Exceeded Flag State Transitions (State Change for Normal Operation)
Operating
state
Data write →
Completed
Chip/sector
erase →
Completed
DQ5
0 → DATA:5
0 →DATA:5
Sector erase
time-out →
Started
Sector erase
→ Erase
suspend
(sector being
erased)
Sector erase
suspend →
Restarted
(sector being
erased)
Sector erase
suspended
(sector not
being erased)
0
0
0
DATA:5
Table 25.6-8 Timing Limit Exceeded Flag State Transitions (State Change for Abnormal
Operation)
Operating state
Data write operation
Chip/sector erase operation
DQ5
1
1
● Write and chip/sector erase
Read-access after the automatic algorithm activation for data write or chip/sector erase operation causes the
flash memory to output "0" if the time is within the prescribed time (time required for data write/erase) or
to output "1" if the prescribed time has been exceeded. Because this is done regardless of whether the
automatic algorithm is being executed or has terminated, it is possible to determine whether data write/
erase was successful or unsuccessful. That is, when this flag outputs "1", data writing can be determined to
have been unsuccessful if the automatic algorithm is still being executed by the data polling function or
toggle bit function.
For example, writing "1" to a flash memory address where "0" has been written will cause the fail state to
occur. In this case, the flash memory will lock and execution of the automatic algorithm will not terminate.
In rare cases, it may terminate normally with writing "1". As a result, valid data will not be output from the
data polling flag (DQ7). In addition, the toggle bit flag (DQ6) will exceed the time limit without stopping
the toggle operation and the timing limit exceeded flag (DQ5) will output "1". Note that this state indicates
that the flash memory is not faulty, but has not been used correctly. When this state occurs, execute the
Reset command.
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
651
CHAPTER 25 FLASH MEMORY
25.6 Confirming the Automatic Algorithm Execution State
25.6.4
MB90340E Series
Sector Erase Timer Flag (DQ3)
The sector erase timer flag (DQ3) is the hardware sequence flag used to post whether
the automatic algorithm is being executed during the sector erase time-out period after
the Sector Erase command has been started.
■ Sector Erase Timer Flag (DQ3)
Table 25.6-9 and Table 25.6-10 list the state transitions of the sector erase timer flag.
Table 25.6-9 Sector Erase Timer Flag State Transitions (State Change for Normal Operation)
Operating
state
Data write →
Completed
Chip/sector
erase →
Completed
DQ3
0 →DATA:3
1 →DATA:3
Sector erase
time-out →
Started
Sector erase
→ Erase
suspend
(sector being
erased)
Sector erase
suspend →
Restarted
(sector being
erased)
Sector erase
suspended
(sector not
being erased)
0 →1
1 →0
0 →1
DATA:3
Table 25.6-10 Sector Erase Timer Flag State Transitions (State Change for Abnormal
Operation)
Operating state
Data write operation
Chip/sector erase operation
DQ3
0
1
● Sector erase
Read-access after the automatic algorithm for sector erase operation has been started causes the flash
memory to output "0" if the automatic algorithm is being executed during the sector erase time-out period,
regardless of the value at the address specified by the address signal of the sector that issued the command.
The flash memory outputs "1" if the sector erase time-out period has been exceeded.
When the data polling function or toggle bit function indicates that the automatic algorithm is being
executed, internally controlled erase has already started if this flag is "1". Continuous write of the sector
erase codes or commands other than the Sector Erase Suspend command will be ignored until erase is
terminated.
If this flag is "0", the flash memory will accept write of additional sector erase codes. To confirm this, it is
recommended that the state of this flag be checked before continuing to write sector erase codes. If this flag
is "1" after the second state check, it is possible that additional sector erase codes may not be accepted.
● Sector erase
Read-access during execution of sector erase suspend causes the flash memory to output "1" if the address
specified by the address signal belongs to the sector being erased. The flash memory outputs bit3 (DATA:
3) of the read value of the address specified by the address signal if the address specified by the address
signal does not belong to the sector being erased.
652
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 25 FLASH MEMORY
25.7 Writing Data to and Erasing Data from Flash Memory
MB90340E Series
25.7
Writing Data to and Erasing Data from Flash Memory
This section describes each operation procedure of flash memory Reset, Data Write,
Chip Erase, Sector Erase, Sector Erase Suspend, and Sector Erase Restart when a
command that starts the automatic algorithm is issued.
■ Detailed Explanation of Flash Memory Data Write/Erase Operation
The flash memory can be executed by issuing a command sequence (see Table 25.5-1 in Section "25.5
Starting the Flash Memory Automatic Algorithm") for a write access to perform Reset, Data Write, Chip
Erase, Sector Erase, Sector Erase Suspend, or Sector Erase Restart operations. Each write access must be
performed continuously. In addition, whether the automatic algorithm has terminated can be determined
using the data polling or other function. At normal termination, the flash memory is returned to the read/
reset state.
Each operation of the flash memory is described in the following order:
• Setting the read/reset state
• Writing data
• Erasing all data (erasing chips)
• Erasing optional data (erasing sectors)
• Suspending sector erase
• Restarting sector erase
CM44-10143-5E
FUJITSU SEMICONDUCTOR LIMITED
653
CHAPTER 25 FLASH MEMORY
25.7 Writing Data to and Erasing Data from Flash Memory
25.7.1
MB90340E Series
Setting Flash Memory to the Read/Reset State
This section describes the procedure for issuing the Read/Reset command to set the
flash memory to the read/reset state.
■ Setting the Flash Memory to the Read/Reset State
The flash memory is set to the read/reset state by sending the Reset command in the command sequence
table (see Table 25.5-1) continuously to the target sector in the flash memory area.
The Reset command has two types of command sequences that execute the first and third bus operations.
However, there are no essential differences between these command sequences.
The read/reset state is the initial state of the flash memory. When power is supplied on and when a
command terminates normally, the flash memory is set to the read/reset state. In the read/reset state, other
commands wait for input.
In the read/reset state, data is read by regular read-access. As with the mask ROM, program access from the
CPU is enabled. The Reset command is used to initialize the automatic algorithm in such cases as when a
command does not terminate normally.
654
FUJITSU SEMICONDUCTOR LIMITED
CM44-10143-5E
CHAPTER 25 FLASH MEMORY
25.7 Writing Data to and Erasing Data from Flash Memory
MB90340E Series
25.7.2
Writing Data