The following document contains information on Cypress products. FUJITSU SEMICONDUCTOR CONTROLLER MANUAL CM71-10143-5E FR60 32-BIT MICROCONTROLLER MB91313A Series HARDWARE MANUAL FR60 32-BIT MICROCONTROLLER MB91313A 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 Preface ■ Purpose of This Document and Intended Reader Thank you very much for your continued patronage of Fujitsu Semiconductor products. FR family is a line of single-chip microcontrollers based on the 32-bit high-performance RISC CPU while integrating a variety of I/O resources for embedded control applications which require high-performance, high-speed CPU processing. This manual describes the functions and operation of the MB91313A series for engineers who actually use this semiconductor to design products. Please read this manual first. FR, the abbreviation of FUJITSU RISC controller, is a line of products of FUJITSU SEMICONDUCTOR LIMITED. ■ Trademark The company names and brand names herein are the trademarks or registered trademarks of their respective owners. i ■ Organization of This Manual This manual consists of the following 19 chapters and appendix. CHAPTER 1 OVERVIEW This chapter explains the features and basic specification of the MB91313A series. CHAPTER 2 CPU AND CONTROL BLOCK This chapter provides the CPU core of the FR family, covering its architecture, specifications, and instructions. CHAPTER 3 EXTERNAL BUS INTERFACE This chapter explains the features, block diagram, I/O pins, and registers of the external bus interface. CHAPTER 4 I/O PORTS This chapter gives an overview of I/O ports and describes their register configuration and functions. CHAPTER 5 16-BIT RELOAD TIMER This chapter explains an overview, register configuration/functions and operations of the 16-bit reload timer. CHAPTER 6 PPG (PROGRAMMABLE PULSE GENERATOR) This chapter gives an outline of the PPG (Programmable Pulse Generator) timer and explains the register configuration and functions and the timer operations. CHAPTER 7 16-BIT PULSE WIDTH COUNTER This chapter gives an overview of the 16-bit pulse width counter and explains the register configuration and functions and the counter operation. CHAPTER 8 MULTIFUNCTION TIMER This chapter gives an overview of the multifunction timer and explains the register configuration and functions and the timer operation. CHAPTER 9 OTHER TIMERS This chapter explains the main oscillation stabilization wait timer, interval timer, and watch timer. CHAPTER 10 INTERRUPT CONTROLLER This chapter gives an overview of the interrupt controller and explains its register configuration/functions and its operations. CHAPTER 11 EXTERNAL INTERRUPT CONTROL UNIT This chapters gives an overview of the external interrupt control unit and describes its register configuration/functions and its operations. CHAPTER 12 DELAY INTERRUPT MODULE This chapter explains the overview of the delay interrupt module, configuration/functions of the registers, and operations of the module. ii CHAPTER 13 BIT SEARCH MODULE This chapter explains the overview of the bit search module, configurations/functions of the registers, and operations of the module. CHAPTER 14 10-BIT A/D CONVERTER This chapter gives an overview of the 10-bit A/D converter, register configuration and functions, and 10bit A/D converter operation. CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE This chapter describes the functions and operations of the multi function serial interface. CHAPTER 16 DMAC (DMA CONTROLLER) This chapter gives an overview of the DMA controller (DMAC) and describes its register configuration and its operations. CHAPTER 17 REMOTE CONTROL RECEPTION This chapter describes the functions and operations of HDMI-CEC reception, ACK automatic a response, and the remote control reception. CHAPTER 18 FLASH MEMORY This chapter provides an outline of flash memory and explains its register configuration, register functions, and operations. CHAPTER 19 MB91313A SERIAL PROGRAMMING CONNECTION This chapter explains the serial programming connection for MB91313A. APPENDIX This appendix explains the details not covered in the main topics and other referential information for programming about the I/O map, interrupt vector, pin status of the CPU state, notes and instructions list when using the little endian area. iii • • • • • • • 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 CONTENTS CHAPTER 1 1.1 1.2 1.3 1.4 1.5 1.6 1.7 OVERVIEW ................................................................................................... 1 Features .............................................................................................................................................. 2 Block Diagram .................................................................................................................................... 5 Pin Assignment ................................................................................................................................... 6 Package Dimensions .......................................................................................................................... 7 List of Pin Functions ........................................................................................................................... 8 I/O Circuit Types ............................................................................................................................... 16 Precautions on Handling the Device ................................................................................................. 19 CHAPTER 2 CPU AND CONTROL BLOCK ................................................................... 25 2.1 Memory Space .................................................................................................................................. 26 2.2 Internal Architecture .......................................................................................................................... 28 2.3 Instructions ....................................................................................................................................... 32 2.4 Programming Model ......................................................................................................................... 34 2.4.1 General-purpose Register ........................................................................................................... 35 2.4.2 Dedicated Register ...................................................................................................................... 36 2.5 Data Structure ................................................................................................................................... 43 2.6 Branch Instruction ............................................................................................................................. 45 2.6.1 Operation with a Delay Slot ......................................................................................................... 46 2.6.2 Operation with No Delay Slot ...................................................................................................... 48 2.7 EIT (Exception, Interruption, and Trap) ............................................................................................ 49 2.7.1 EIT Interrupt Levels ..................................................................................................................... 50 2.7.2 ICR (Interrupt Control Register) ................................................................................................... 52 2.7.3 SSP (System Stack Pointer) ........................................................................................................ 53 2.7.4 TBR (Table Base Register) ......................................................................................................... 54 2.7.5 Multiple EIT Processing ............................................................................................................... 58 2.7.6 Operations of EIT ........................................................................................................................ 60 2.8 Reset (Device Initialization) .............................................................................................................. 64 2.8.1 Reset Level .................................................................................................................................. 65 2.8.2 Reset Sources ............................................................................................................................. 66 2.8.3 Reset Sequence .......................................................................................................................... 68 2.8.4 Oscillation Stabilization Wait Time .............................................................................................. 69 2.8.5 Reset Operation Modes ............................................................................................................... 71 2.9 Clock Generation Control ................................................................................................................. 73 2.9.1 PLL Control .................................................................................................................................. 74 2.9.2 Oscillation Stabilization Wait and PLL Lock Wait Time ............................................................... 76 2.9.3 Clock Distribution ......................................................................................................................... 78 2.9.4 Clock Division .............................................................................................................................. 80 2.9.5 Block Diagram of Clock Generation Control Block ...................................................................... 81 2.9.6 Registers of Clock Generation Control Block .............................................................................. 82 2.9.7 Peripheral Circuits in Clock Control Block ................................................................................. 102 2.10 Device State Control ....................................................................................................................... 106 2.10.1 Low-power Consumption Mode ................................................................................................. 110 v 2.11 Operating Mode .............................................................................................................................. 115 CHAPTER 3 3.1 3.2 3.3 3.4 3.5 3.6 3.7 Overview of External Bus Interface ................................................................................................ Explanation of Registers of External Bus Interface ........................................................................ Chip Select Area ............................................................................................................................. Address/Data Multiplex Interface .................................................................................................... DMA Access ................................................................................................................................... Register Setting Procedure ............................................................................................................. Note on Using External Bus Interface ............................................................................................. CHAPTER 4 4.1 4.2 4.3 4.4 4.5 4.6 4.7 6.1 6.2 6.3 16-BIT PULSE WIDTH COUNTER .......................................................... 191 MULTIFUNCTION TIMER ........................................................................ 201 Overview of the Multifunction Timer ............................................................................................... 202 Registers of the Multifunction Timer ............................................................................................... 204 Multifunction Timer Operation ......................................................................................................... 212 CHAPTER 9 9.1 PPG (PROGRAMMABLE PULSE GENERATOR) .................................. 177 Overview of the PWC Timer ........................................................................................................... 192 Operation of the PWC Timer .......................................................................................................... 198 CHAPTER 8 8.1 8.2 8.3 164 165 166 169 170 171 175 176 Outline of the PPG Timer ................................................................................................................ 178 Operation of the PPG Timer ........................................................................................................... 186 Precautions on Using the PPG Timer ............................................................................................. 189 CHAPTER 7 7.1 7.2 142 144 145 146 160 161 162 16-BIT RELOAD TIMER ........................................................................... 163 Overview of 16-Bit Reload Timer .................................................................................................... Registers of 16-Bit Reload Timer .................................................................................................... Control Status Register (TMCSR) ............................................................................................. 16-Bit Timer Register (TMR) ..................................................................................................... 16-Bit Reload Register (TMRLR) ............................................................................................... Operations of 16-Bit Reload Timer ................................................................................................. Operating Status of Counter ........................................................................................................... Notes on Using 16-Bit Reload Timer .............................................................................................. CHAPTER 6 118 121 132 133 136 139 140 I/O PORTS ................................................................................................ 141 Overview of I/O Ports ...................................................................................................................... Settings of Port Data Registers ...................................................................................................... Settings of Data Direction Registers ............................................................................................... Settings of Extra Port Control Registers ......................................................................................... Pull-up Control Register .................................................................................................................. External Bus, I2C Bridge, ADER Control Register .......................................................................... Noise Filter Control Register for I2C ............................................................................................... CHAPTER 5 5.1 5.2 5.2.1 5.2.2 5.2.3 5.3 5.4 5.5 EXTERNAL BUS INTERFACE ................................................................ 117 OTHER TIMERS ....................................................................................... 217 Main Oscillation Stabilization Wait Timer ........................................................................................ 218 vi 9.2 Watch Timer ................................................................................................................................... 225 CHAPTER 10 INTERRUPT CONTROLLER ................................................................... 231 10.1 Overview of Interrupt Controller ...................................................................................................... 10.2 Registers of Interrupt Controller ...................................................................................................... 10.2.1 ICR (Interrupt Control Register) ................................................................................................. 10.2.2 HRCL (Hold Request Cancel Request Register) ....................................................................... 10.3 Operations of Interrupt Controller ................................................................................................... 232 235 236 238 239 CHAPTER 11 EXTERNAL INTERRUPT CONTROL UNIT ............................................. 243 11.1 Overview of External Interrupt Control Unit .................................................................................... 11.2 Registers of External Interrupt Control Unit .................................................................................... 11.2.1 Interrupt Enable Register (ENIR) ............................................................................................... 11.2.2 External Interrupt Source Register (EIRR) ................................................................................ 11.2.3 External Interrupt Request Level Setting Register (ELVR) ........................................................ 11.3 Operations of External Interrupt Control Unit .................................................................................. 244 245 246 247 248 250 CHAPTER 12 DELAY INTERRUPT MODULE ................................................................ 253 12.1 12.2 12.3 Overview of Delay Interrupt Module ............................................................................................... 254 Registers of Delay Interrupt Module ............................................................................................... 255 Operations of Delay Interrupt Module ............................................................................................. 256 CHAPTER 13 BIT SEARCH MODULE ........................................................................... 257 13.1 13.2 13.3 Overview of Bit Search Module ...................................................................................................... 258 Registers of Bit Search Module ...................................................................................................... 259 Operations of Bit Search Module .................................................................................................... 261 CHAPTER 14 10-BIT A/D CONVERTER ........................................................................ 265 14.1 Overview of the 10-Bit A/D Converter ............................................................................................. 266 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE ................................................ 273 15.1 Overview of the Multi Function Serial Interface .............................................................................. 15.2 Functions of UART (Asynchronous Multi Function Serial Interface) ............................................... 15.3 Registers of UART (Asynchronous Multi Function Serial Interface) ............................................... 15.3.1 Serial Control Register (SCR) ................................................................................................... 15.3.2 Serial Mode Register (SMR) ...................................................................................................... 15.3.3 Serial Status Register (SSR) ..................................................................................................... 15.3.4 Extended Communication Control Register (ESCR) ................................................................. 15.3.5 Reception/Transmission Data Registers (RDR/TDR) ................................................................ 15.3.6 Baud Rate Generator Registers 1, 0 (BGR1/BGR0) ................................................................. 15.3.7 FIFO Control Register 1 (FCR1) ................................................................................................ 15.3.8 FIFO Control Register 0 (FCR0) ................................................................................................ 15.3.9 FIFO Byte Register (FBYTE) ..................................................................................................... 15.4 Interrupts of UART .......................................................................................................................... 15.4.1 Reception Interrupt Generation and Flag Set Timing ................................................................ 15.4.2 Interrupt Generation and Flag Set Timing When Using Reception FIFO .................................. 15.4.3 Transmission Interrupt Generation and Flag Set Timing ........................................................... vii 275 277 278 280 282 284 287 289 293 295 297 300 302 304 305 307 15.4.4 Interrupt Generation and Flag Set Timing When Using Transmission FIFO ............................. 308 15.5 Operations of UART ....................................................................................................................... 309 15.6 UART Dedicated Baud Rate Generator .......................................................................................... 314 15.6.1 Baud Rate Setting ..................................................................................................................... 315 15.7 Setting Procedure and Program Flow for Operating Mode 0 (Asynchronous Normal Mode) ......... 319 15.8 Setting Procedure and Program Flow for Operating Mode 1 (Asynchronous Multiprocessor Mode) ......................................................................................................................................................... 321 15.9 Notes on UART Mode ..................................................................................................................... 325 15.10 Overview of CSIO (Clock Synchronous Multi Function Serial Interface) ........................................ 326 15.11 Registers of CSIO (Clock Synchronous Multi Function Serial Interface) ........................................ 327 15.11.1 Serial Control Register (SCR) ................................................................................................... 328 15.11.2 Serial Mode Register (SMR) ...................................................................................................... 330 15.11.3 Serial Status Register (SSR) ..................................................................................................... 332 15.11.4 Extended Communication Control Register (ESCR) ................................................................. 334 15.11.5 Reception Data Register/Transmission Data Register (RDR/TDR) ........................................... 336 15.11.6 Baud Rate Generator Registers 1, 0 (BGR1/BGR0) ................................................................. 340 15.11.7 FIFO Control Register 1 (FCR1) ................................................................................................ 342 15.11.8 FIFO Control Register 0 (FCR0) ................................................................................................ 344 15.11.9 FIFO Byte Register (FBYTE) ..................................................................................................... 347 15.12 Interrupts of CSIO (Clock Synchronous Multi Function Serial Interface) ........................................ 349 15.12.1 Reception Interrupt Generation and Flag Set Timing ................................................................ 350 15.12.2 Interrupt Generation and Flag Set Timing When Using Reception FIFO .................................. 351 15.12.3 Transmission Interrupt Generation and Flag Set Timing ........................................................... 353 15.12.4 Interrupt Generation and Flag Set Timing When Using Transmission FIFO ............................. 354 15.13 Operations of CSIO (Clock Synchronous Multi Function Serial Interface) ..................................... 355 15.14 CSIO Dedicated Baud Rate Generator ........................................................................................... 367 15.14.1 Baud Rate Setting ..................................................................................................................... 368 15.15 Setting Procedure and Program Flow for CSIO (Clock Synchronous Multi Function Serial Interface) ......................................................................................................................................................... 371 15.16 Notes on CSIO Mode ...................................................................................................................... 373 15.17 Overview of the I2C Interface .......................................................................................................... 374 15.18 Registers of the I2C Interface ......................................................................................................... 375 15.18.1 I2C Bus Control Register (IBCR) ............................................................................................... 376 15.18.2 Serial Mode Register (SMR) ...................................................................................................... 381 15.18.3 Serial Status Register (SSR) ..................................................................................................... 383 15.18.4 I2C Bus Status Register (IBSR) ................................................................................................. 386 15.18.5 Reception/Transmission Data Registers (RDR/TDR) ................................................................ 390 15.18.6 Baud Rate Generator Registers 1, 0 (BGR1/BGR0) ................................................................. 392 15.18.7 7-bit Slave Address Mask Register (ISMK) ............................................................................... 393 15.18.8 7-bit Slave Address Register (ISBA) ......................................................................................... 394 15.18.9 FIFO Control Register 1 (FCR1) ................................................................................................ 395 15.18.10 FIFO Control Register 0 (FCR0) ................................................................................................ 397 15.18.11 FIFO Byte Register (FBYTE) ..................................................................................................... 400 15.19 Interrupts of the I2C Interface ......................................................................................................... 402 15.20 Operations of I2C Interface Communication ................................................................................... 404 15.20.1 Master Mode .............................................................................................................................. 405 15.20.2 Slave Mode ................................................................................................................................ 424 15.20.3 Bus Error ................................................................................................................................... 428 viii 15.21 Dedicated Baud Rate Generator .................................................................................................... 429 15.22 Examples of I2C Flowchart ............................................................................................................. 431 15.23 Notes on I2C Mode ......................................................................................................................... 443 CHAPTER 16 DMAC (DMA CONTROLLER) .................................................................. 445 16.1 16.2 16.3 16.4 16.5 16.6 Overview of DMA Controller ........................................................................................................... Operations of DMA Controller ......................................................................................................... Setting of Transfer Request ............................................................................................................ Transfer Sequence ......................................................................................................................... Operation Flowcharts ...................................................................................................................... Data Bus ......................................................................................................................................... 446 463 465 466 477 479 CHAPTER 17 REMOTE CONTROL RECEPTION .......................................................... 481 17.1 Overview of Remote Control Reception ......................................................................................... 17.2 Register of Remote Control Reception ........................................................................................... 17.2.1 Remote Control Reception Control Register (RCCR) ............................................................... 17.2.2 Remote Control Reception Interrupt Control Register (RCST) .................................................. 17.2.3 Device Address Configuration Registers 1, 2 (RCADR1, RCADR2) ......................................... 17.2.4 Start Bit High Width Configuration Register (RCSHW) ............................................................. 17.2.5 "H" Width Configuration Register A (RCDAHW) ........................................................................ 17.2.6 "H" Width Configuration Register B (RCDAHW) ........................................................................ 17.2.7 Data Storage Registers (RCDTHH, RCDTHL, RCDTLH, RCDTLL) .......................................... 17.2.8 Clock Division Configuration Register (RCCKD) ....................................................................... 17.3 Explanation of Operations and Setting Procedure Examples ......................................................... 482 483 484 486 489 490 491 492 493 494 495 CHAPTER 18 FLASH MEMORY ..................................................................................... 499 18.1 Outline of Flash Memory ................................................................................................................. 18.2 Flash Memory Registers ................................................................................................................. 18.2.1 Flash Control Status Register (FLCR) ....................................................................................... 18.2.2 Wait Register (FLWC) ............................................................................................................... 18.3 Flash Memory Access Modes ......................................................................................................... 18.4 Automatic Algorithm of Flash Memory ............................................................................................ 18.5 Execution Status of the Automatic Algorithm .................................................................................. 18.6 Data Writing to and Erasing from Flash Memory ............................................................................ 18.6.1 Read/Reset Status .................................................................................................................... 18.6.2 Data Writing ............................................................................................................................... 18.6.3 Erasing Data (Chip Erase) ......................................................................................................... 18.6.4 Erasing Data (Sector Erase) ...................................................................................................... 18.6.5 Temporary Sector Erase Stop ................................................................................................... 18.6.6 Sector Erase Restart ................................................................................................................. 18.7 Restrictions on Data Polling Flag (DQ7) and How to Avoid Erroneous Judgment ......................... 18.8 Restriction and Notes ..................................................................................................................... 500 504 505 507 509 511 515 519 520 521 523 524 526 527 528 531 CHAPTER 19 MB91313A SERIAL PROGRAMMING CONNECTION ........................... 533 19.1 19.2 19.3 Basic Configuration of Serial Programming .................................................................................... 534 Example of Serial Programming Connection .................................................................................. 536 System Configuration of Flash Microcontroller Programmer .......................................................... 537 ix 19.4 Additional Notes .............................................................................................................................. 538 APPENDIX ......................................................................................................................... 539 APPENDIX A APPENDIX B APPENDIX C APPENDIX D I/O Map ................................................................................................................................ Vector Table ......................................................................................................................... Pin Status In Each CPU State ............................................................................................. Instruction Lists .................................................................................................................... 540 551 554 566 INDEX................................................................................................................................... 581 x Main changes in this edition Page Section - - Change Results Changed Series name. MB91313/A → MB91313A 5 CHAPTER 1 OVERVIEW 1.2 Block Diagram Changed Figure 1.2-1. 6 CHAPTER 1 OVERVIEW 1.3 Pin Assignment Corrected Figure 1.3-1. 10 CHAPTER 1 OVERVIEW 1.5 List of Pin Functions Corrected Table 1.5-1. I/O circuit type of pin number 32, 33 D/B → B 20 CHAPTER 1 OVERVIEW 1.7 Precautions on Handling the Device Added The explanation. Turning on/off these power supplies (VDDI/Analog/VDDE) simultaneously causes no problem. 23 Deleted "● External interrupt INT17, INT19 (MB91F313 only)". 166 CHAPTER 5 16-BIT RELOAD TIMER 5.2.1 Control Status Register (TMCSR) Corrected Figure 5.2-2. 325 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.9 Notes on UART Mode Added Item. 373 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.16 Notes on CSIO Mode Added Item. 431 to 442 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE Corrected Flowchart. 15.22 Examples of I2C Flowchart 443, 444 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE Added Item. 15.23 Notes on I2C Mode 499 to 531 CHAPTER 18 FLASH MEMORY The overall revision. The vertical lines marked in the left side of the page show the changes. xi xii CHAPTER 1 OVERVIEW This chapter explains the features and basic specification of the MB91313A series. 1.1 Features 1.2 Block Diagram 1.3 Pin Assignment 1.4 Package Dimensions 1.5 List of Pin Functions 1.6 I/O Circuit Types 1.7 Precautions on Handling the Device CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 1 CHAPTER 1 OVERVIEW 1.1 Features 1.1 MB91313A Series Features The FR family is a line of microcontrollers based on a 32-bit high-performance RISC CPU and integrating a variety of I/O resources for embedded control applications which require high-performance, high-speed processing by the CPU. The microcontrollers are equipped with the multiple channels of the communication macro and most suitable for embedded applications such as television control. ■ FR CPU • 32-bit RISC, load/store architecture, 5-stage pipeline • Operating frequency of 33 MHz [PLL used: 16.5-MHz oscillation frequency: multiply by 2] • 16-bit fixed-length instructions (basic instructions), one instruction per cycle • Memory-to-memory transfer, bit manipulation, barrel shift, and other instructions ... Instructions appropriate for embedded applications • Function entry/exit instructions, multi-register load/store instructions ... Instructions compatible with high-level languages • Register interlock function ... Facilitating assembly-language coding • Built-in multiplier/instruction-level support: Signed 32-bit multiplication ... 5 cycles Signed 16-bit multiplication ... 3 cycles • Interrupts (saving of PC and PS) ... 6 cycles, 16 priority levels • Harvard architecture enabling simultaneous execution of program access and data access • 4 words queuing in CPU enabling advanced fetch of instructions • Instruction-compatible with the FR family ■ Simplified External Bus Interface Setting in the program enables the 8-bit or 16-bit multiplex bus to run. • Maximum operating frequency of 16.5 MHz • 8-/16- bit data/address multiplex I/O • Totally independent 4-area chip select output that can be defined at a minimum of 64 KB • Basic bus cycle ... 3 cycles • Automatic wait cycle generator that can be programmed for each area • Unused data/address/control signal pins can be used for general-purpose I/O ■ Built-in Memory • Flash memory 544 KB, RAM/32 KB 2 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 1 OVERVIEW 1.1 Features MB91313A Series ■ DMAC (DMA Controller) • 5 channels • 2 transfer sources: internal peripheral/software • Addressing mode: 20/24-bit full address specifications (increase/decrease/fixed) • Transfer mode: burst transfer/step transfer/block transfer • Transfer data size: can be selected from 8, 16, or 32 bits ■ Bit Search Module (Used by REALOS) Searches for the position of the first bit varying between 1 and 0 in the MSB of a word. ■ 16-bit Reload Timer (Including One Channel for REALOS) • 6 channels • Internal clock: selectable from among results of dividing the machine clock frequency by 2, 8, and 32 ■ Multi Function Serial Interface • 11 channels • Full-duplex double buffer • 4 types communication mode: asynchronous (start-stop synchronous), clock-synchronous communication (maximum 8.25 Mbps), I2C standard mode (maximum 100 kbps), and I2C high-speed mode (maximum 400 kbps) • Parity selectable from enabled or disabled • Built-in baud rate generator for each channel • Various error detection functions: parity, frame, overrun • External clock that can be used as transfer clock • ch.0 to ch.2 : the DMA transfer / the FIFO function with 16 bytes for each of the transmission and reception • ch.8 to ch.10 : 5-V tolerant. • ch.8 : the open drain output • I2C bridge function (among 0 channel, 1 channel, and 2 channel) • SPI mode ■ Interrupt Controller • Total of 24 external interrupts (external interrupt pins INT23 to INT0) • Interrupts from internal peripherals • Programmable priority level (16 levels) • Available for wakeup in STOP mode ■ 10-bit A/D Converter • 10 channels • Successive approximation type: conversion time : approximately 7.94 μs • Conversion modes: single conversion mode and scan conversion mode • Activation sources: software and external trigger CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 3 CHAPTER 1 OVERVIEW 1.1 Features MB91313A Series ■ PPG • 4 channels • 16-bit counter, 16-bit data register with buffer to set the cycle • Internal clock: selectable from among results of dividing the machine clock frequency by 1, 4, 16, and 64 • Automatic cycle setting supported with the DMA transfer • Remote control transmission support function • Open drain output ■ PWC • 1 channel (1 input) • 16-bit up counter • Simplified LOWPASS filter ■ Multifunction Timer • • • • • • 4 channels Removes the noise, if lower than specified clock, using the Low Pass filter Pulse width can be measured using 7 types of clock signal Event count function from pin input Interval timer function using 7 types of clock and external input clock Built-in HSYNC counter mode ■ HDMI-CEC/Remote Control Reception • 2 channels • HDMI-CEC reception function (with automatic ACK response function) • Remote control reception function (with 4 byte reception buffers) ■ Other Interval Timers • Watch timer (32 kHz, Max 60 s count) • Watchdog timer ■ I/O Ports Maximum 86 ports ■ Other Features • • • • • Built-in oscillation circuit as a clock source INITX provided as a reset pin Watchdog timer and software resets available Supporting stop mode and sleep mode as low-power consumption modes Gear function - Built-in time-base timer - 5 V tolerant I/O (for a part of pins) • Package: LQFP-120, 0.5 mm pitch, 16 mm × 16 mm • CMOS technology: 0.18 μm • Power supply voltage 3.3±0.3 V, 1.8±0.15 V, 2 power supply units • I2C license Purchase of Fujitsu I2C components conveys a license under the Philips I2C Patent Rights to use, these components in an I2C system provided that the system conforms to the I2C Standard Specification as defined by Philips. 4 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 1 OVERVIEW 1.2 Block Diagram MB91313A Series 1.2 Block Diagram Figure 1.2-1 shows a block diagram of MB91313A Series. ■ Block Diagram of MB91313A Series Figure 1.2-1 Block Diagram of MB91313A Series FR CPU core 32 32 FLASH 544 KB Bit search RAM 32 KB Bus converter 32 ↔ 16 Adapter DMA Controller 5 channels Simplified external I/F 8/16-bit multiplex bus Clock control Interrupt controller External interrupt 24 channels Port CM71-10143-5E Multi function serial interface 11 channels PWC 1 channel PPG 4 channels A/D converter 10 channels HDMI-CEC/ Remote control reception 2 channels Multifunction Reload timer timer 6 channels 4 channels FUJITSU SEMICONDUCTOR LIMITED 5 CHAPTER 1 OVERVIEW 1.3 Pin Assignment 1.3 MB91313A Series Pin Assignment Figure 1.3-1 shows the pin assignment of MB91313A Series. ■ Pin Assignment of MB91313A Series Figure 1.3-1 Pin Assignment of MB91313A Series 120 119 118 117 116 115 114 113 112 111 110 109 108 107 106 105 104 103 102 101 100 99 98 97 96 95 94 93 92 91 VDDE P22/SCK0/SCL0(I2Cbridge) P21/SOT0/SDA0(I2Cbridge) P20/SIN0 P57/WR1 P56/WR0 P55/RD P54/AS P53/CS3/PPG3 P52/CS2/PPG2 P51/CS1/PPG1 P50/CS0/PPG0 P17/AD15 P16/AD14/SCK7/SCL7 P15/AD13/SOT7/SDA7 P14/AD12/SIN7 P13/AD11/SCK6/SCL6 P12/AD10/SOT6/SDA6 P11/AD09/SIN6 P10/AD08/SCK5/SCL5 P07/AD07/SOT5/SDA5/INT15 P06/AD06/SIN5/INT14 P05/AD05/SCK4/SCL4/INT13 P04/AD04/SOT4/SDA4/INT12 P03/AD03/SIN4/INT11 P02/AD02/SCK3/SCL3/INT10 P01/AD01/SOT3/SDA3/INT9 P00/AD00/SIN3/INT8 VDDI VSS - TOP VIEW - 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 VDDE IBREAK ICLK ICS2 ICS1 ICS0 ICD3 ICD2 ICD1 ICD0 TRSTX PC7/TRG1 PC6/TRG0 PC5/PPGB PC4/PPGA PC3 PC2/SCK9/SCL8 PC1/SOT9/SDA9 PC0/SIN9 PE7/SCK8/SCL8/INT7 PE6/SOT8/SDA8/INT6 PE5/SIN8/INT5 PE4/PPG3/INT4 MD2 MD1 MD0 VDDI X0 X1 VSS VSS PF0/RCIN0 PF1/RCIN1 PF2/RCACK0 PF3/RCACK1 PF4 PF5 PF6 PF7 VDDE VSS AVSS AVRH AVCC PD0/AN0 PD1/AN1 PD2/AN2 PD3/AN3 PD4/AN4 PD5/AN5 PD6/AN6 PD7/AN7 PE0/AN8/INT0 PE1/AN9/PPG0/INT1 PE2/PPG1/INT2/ATRG PE3/PPG2/INT3 VDDE INITX X0A X1A 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 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 31 32 33 34 35 36 37 38 39 40 41 VSS VDDI P23/SIN1 P24/SOT1/SDA1(I2Cbridge) P25/SCK1/SCL1(I2Cbridge) P26/SIN2 P27/SOT2/SDA2(I2Cbridge) P30/SCK2/SCL2(I2Cbridge) P31/TOT0 P32/TOT1 P33/TOT2 P34/TIN0 P35/TIN1 P36/TIN2 P37/RIN P40/TMO0/INT16 P41/TMO1/INT17 P42/TMO2/INT18 P43/TMO3/INT19 P44/TMI0/INT20 P45/TMI1/INT21/SIN10 P46/TMI2/INT22/SOT10/SDA10 P47/TMI3/INT23/SCK10/SCL10 P60/TOT3/TRG2 P61/TOT4/TRG3 P62/TOT5/RDY P63/TIN3/CLK P64/TIN4 P65/TIN5 VDDE (FPT-120-M21) 6 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 1 OVERVIEW 1.4 Package Dimensions MB91313A Series 1.4 Package Dimensions Figure 1.4-1 shows the package dimensions of MB91313A Series. Figure 1.4-1 Package Dimensions of MB91313A Series 120-pin plastic LQFP Lead pitch 0.50 mm Package width × package length 16.0 × 16.0 mm Lead shape Gullwing Sealing method Plastic mold Mounting height 1.70 mm MAX Weight 0.88 g Code (Reference) P-LFQFP120-16×16-0.50 (FPT-120P-M21) 120-pin plastic LQFP (FPT-120P-M21) Note 1) * : These dimensions do not include resin protrusion. Resin protrusion is +0.25(.010) MAX(each side). Note 2) Pins width and pins thickness include plating thickness. Note 3) Pins width do not include tie bar cutting remainder. 18.00±0.20(.709±.008)SQ +0.40 * 16.00 –0.10 .630 +.016 –.004 SQ 90 61 91 60 0.08(.003) Details of "A" part +0.20 1.50 –0.10 +.008 (Mounting height) .059 –.004 INDEX 0~8° 120 LEAD No. 1 30 0.50(.020) C "A" 31 0.22±0.05 (.009±.002) 0.08(.003) M 0.145 .006 2002-2010 FUJITSU SEMICONDUCTOR LIMITED F120033S-c-4-7 +0.05 –0.03 +.002 –.001 0.60±0.15 (.024±.006) 0.10±0.05 (.004±.002) (Stand off) 0.25(.010) Dimensions in mm (inches). Note: The values in parentheses are reference values. Please check the latest package dimensions at the following URL. http://edevice.fujitsu.com/package/en-search/ CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 7 CHAPTER 1 OVERVIEW 1.5 List of Pin Functions MB91313A Series 1.5 List of Pin Functions Table 1.5-1 lists the pin functions of MB91313A Series. ■ Pin Functions of MB91313A Series Table 1.5-1 List of Pin Functions (1 / 8) Pin No. Pin name I/O circuit type *1 1 VSS - GND pin 2 VDDI - 1.8 V power supply pin 3 P23 SIN1 D P24 4 SOT1/SDA1 (I2C bridge) 6 SCK1/SCL1 (I2C bridge) P26 SIN2 L SOT2/SDA2 (I2C bridge) D 9 10 11 12 13 14 SCK2/SCL2 (I2C bridge) P31 TOT0 P32 TOT1 P33 TOT2 P34 TIN0 P35 TIN1 P36 TIN2 Serial data output pin I2C data I/O pin Clock pulse I/O pin for serial communication I2C clock I/O pin General-purpose port Serial data input pin General-purpose port L P30 8 Serial data input pin General-purpose port L P27 7 General-purpose port General-purpose port P25 5 8 Function Serial data output pin I2C data I/O pin General-purpose port L D D D D D D Clock pulse I/O pin for serial communication I2C clock I/O pin General-purpose port Output pin for reload timer General-purpose port Output pin for reload timer General-purpose port Output pin for reload timer General-purpose port Event input pin for reload timer General-purpose port Event input pin for reload timer General-purpose port Event input pin for reload timer FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 1 OVERVIEW 1.5 List of Pin Functions MB91313A Series Table 1.5-1 List of Pin Functions (2 / 8) Pin No. 15 Pin name P37 RIN I/O circuit type *1 D P40 16 17 18 19 20 21 TMO0 B 24 PWC input pin Multifunction timer output pin INT16 External interrupt request input pin P41 General-purpose port TMO1 B Multifunction timer output pin INT17 External interrupt request input pin P42 General-purpose port TMO2 B Multifunction timer output pin INT18 External interrupt request input pin P43 General-purpose port TMO3 B Multifunction timer output pin INT19 External interrupt request input pin P44 General-purpose port TMI0 B Multifunction timer input pin INT20 External interrupt request input pin P45 General-purpose port TMI1 INT21 B Multifunction timer input pin External interrupt request input pin SIN10 Serial data input pin P46 General-purpose port INT22 Multifunction timer input pin B External interrupt request input pin SOT10/SDA10 Serial data output pin I2C data I/O pin P47 General-purpose port TMI3 23 General-purpose port General-purpose port TMI2 22 Function INT23 Multifunction timer input pin B External interrupt request input pin SCK10/SCL10 Clock pulse input/output pin for serial communication I2C clock I/O pin P60 General-purpose port TOT3 TRG2 CM71-10143-5E C Output pin for reload timer PPG trigger input pin FUJITSU SEMICONDUCTOR LIMITED 9 CHAPTER 1 OVERVIEW 1.5 List of Pin Functions MB91313A Series Table 1.5-1 List of Pin Functions (3 / 8) Pin No. Pin name I/O circuit type *1 P61 25 26 27 TOT4 General-purpose port C 29 PPG trigger input pin P62 General-purpose port TOT5 C Output pin for reload timer RDY External ready input pin P63 General-purpose port TIN3 C P64 TIN4 P65 TIN5 Event input pin for reload timer External clock output pin C C General-purpose port Event input pin for reload timer General-purpose port Event input pin for reload timer 30 VDDE - 3.3 V power supply 31 VSS - GND pin 32 33 34 35 PF0 RCIN0 PF1 RCIN1 PF2 RCACK0 PF3 RCACK1 B B D D General-purpose port HDMI-CEC/Remote control 0 I/O pin General-purpose port HDMI-CEC/Remote control 1 I/O pin General-purpose port HDMI-CEC/Remote control 0ACK output pin General-purpose port HDMI-CEC/Remote control 1ACK output pin 36 PF4 D General-purpose port 37 PF5 D General-purpose port 38 PF6 D General-purpose port 39 PF7 D General-purpose port 40 VDDE - 3.3 V power supply 41 VSS - GND pin 42 AVSS - A/D converter GND pin 43 AVRH - A/D converter reference voltage pin 44 AVCC - A/D converter power supply pin 45 46 10 Output pin for reload timer TRG3 CLK 28 Function PD0 AN0 PD1 AN1 L L General-purpose port pin A/D converter analog input pin General-purpose port A/D converter analog input pin FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 1 OVERVIEW 1.5 List of Pin Functions MB91313A Series Table 1.5-1 List of Pin Functions (4 / 8) Pin No. 47 48 49 50 51 52 Pin name PD2 I/O circuit type *1 L AN2 PD3 L AN3 PD4 L AN4 PD5 L AN5 PD6 L AN6 PD7 L AN7 PE0 53 54 AN8 L A/D converter analog input pin General-purpose port A/D converter analog input pin General-purpose port A/D converter analog input pin General-purpose port A/D converter Analog input pin General-purpose port A/D converter Analog input pin General-purpose port A/D converter Analog input pin A/D converter Analog input pin INT0 External interrupt request input pin PE1 General-purpose port AN9 PPG0 *2 L PPG1 A/D converter Analog input pin Output pin for PPG External interrupt request input pin PE2 56 General-purpose port General-purpose port INT1 55 Function General-purpose port *2 B INT2 Output pin for PPG External interrupt request input pin ATRG Trigger input pin for A/D converter PE3 General-purpose port PPG2 *2 B INT3 Output pin for PPG External interrupt request input pin 57 VDDE - 3.3 V power supply 58 INITX G Initial reset pin 59 X0A A Sub clock input pin 60 X1A A Sub clock output pin 61 VSS - GND pin 62 X1 A Main clock output pin 63 X0 A Main clock input pin 64 VDDI - 1.8 V power supply 65 MD0 F Mode pin 66 MD1 F Mode pin CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 11 CHAPTER 1 OVERVIEW 1.5 List of Pin Functions MB91313A Series Table 1.5-1 List of Pin Functions (5 / 8) Pin No. 67 Pin name MD2 I/O circuit type *1 F PE4 68 69 70 71 PPG3 *2 B External interrupt request input pin PE5 General-purpose port SIN8 B 75 76 77 78 79 12 Serial data input pin INT5 External interrupt request input pin PE6 General-purpose port SOT8/SDA8 B External interrupt request input pin I2C data I/O pin INT6 Serial data output pin PE7 General-purpose port SCK8/SCL8 B PC0 SIN9 SOT9/SDA9 SCK9/SCL9 PC3 PC4 PPGA PC5 PPGB PC6 TRG0 PC7 TRG1 Clock pulse input/output pin for serial communication I2C clock I/O pin External interrupt request input pin B General-purpose port Serial data input pin General-purpose port B PC2 74 Output pin for PPG INT4 PC1 73 Mode pin General-purpose port INT7 72 Function Serial data output pin I2C data I/O pin General-purpose port B Clock pulse input/output pin for serial communication I2C clock I/O pin B General-purpose port B B B B General-purpose port Output pin for PPG General-purpose port Output pin for PPG General-purpose port PPG trigger input General-purpose port PPG trigger input 80 TRSTX G Reset pin for development tool 81 ICD0 K Data pin for development tool 82 ICD1 K Data pin for development tool 83 ICD2 K Data pin for development tool 84 ICD3 K Data pin for development tool FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 1 OVERVIEW 1.5 List of Pin Functions MB91313A Series Table 1.5-1 List of Pin Functions (6 / 8) Pin No. Pin name I/O circuit type *1 Function 85 ICS0 H Status pin for development tool 86 ICS1 H Status pin for development tool 87 ICS2 H Status pin for development tool 88 ICLK H Clock pin for development tool 89 IBREAK I Break pin for development tool 90 VDDE - 3.3 V power supply 91 VSS - GND pin 92 VDDI - 1.8 V power supply P00 93 94 95 96 97 98 AD00 SIN3 General-purpose port C External address/data bus I/O pin Serial data input pin INT8 External interrupt request input pin P01 General-purpose port AD01 External address/data bus I/O pin SOT3/SDA3 C Serial data output pin I2C data I/O pin INT9 External interrupt request input pin P02 General-purpose port AD02 External address/data bus I/O pin SCK3/SCL3 C Clock pulse input/output pin for serial communication I2C clock I/O pin INT10 External interrupt request input pin P03 General-purpose port AD03 SIN4 C External address/data bus I/O pin Serial data input pin INT11 External interrupt request input pin P04 General-purpose port AD04 External address/data bus I/O pin SOT4/SDA4 C Serial data output pin I2C data I/O pin INT12 External interrupt request input pin P05 General-purpose port AD05 External address/data bus I/O pin SCK4/SCL4 INT13 CM71-10143-5E C Clock pulse input/output pin for serial communication I2C clock I/O pin External interrupt request input pin FUJITSU SEMICONDUCTOR LIMITED 13 CHAPTER 1 OVERVIEW 1.5 List of Pin Functions MB91313A Series Table 1.5-1 List of Pin Functions (7 / 8) Pin No. Pin name I/O circuit type *1 P06 99 100 101 102 103 104 105 106 107 AD06 SIN5 General-purpose port C 14 External address/data bus I/O pin Serial data input pin INT14 External interrupt request input pin P07 General-purpose port AD07 External address/data bus I/O pin SOT5/SDA5 C Serial data output pin I2C data I/O pin INT15 External interrupt request input pin P10 General-purpose port AD08 C External address/data bus I/O pin SCK5/SCL5 Clock pulse input/output pin for serial communication I2C clock I/O pin P11 General-purpose port AD09 C External address/data bus I/O pin SIN6 Serial data input pin P12 General-purpose port AD10 C External address/data bus I/O pin SOT6/SDA6 Serial data output pin I2C data I/O pin P13 General-purpose port AD11 C External address/data bus I/O pin SCK6/SCL6 Clock pulse input/output pin for serial communication I2C clock I/O pin P14 General-purpose port AD12 C External address/data bus I/O pin SIN7 Serial data input pin P15 General-purpose port AD13 C External address/data bus I/O pin SOT7/SDA7 Serial data output pin I2C data I/O pin P16 General-purpose port AD14 C P17 AD15 External address/data bus I/O pin Clock pulse input/output pin for serial communication I2C clock I/O pin SCK7/SCL7 108 Function C General-purpose port External address/data bus I/O pin FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 1 OVERVIEW 1.5 List of Pin Functions MB91313A Series Table 1.5-1 List of Pin Functions (8 / 8) Pin No. Pin name I/O circuit type *1 P50 109 110 General-purpose port CS0X C Output pin for PPG P51 General-purpose port CS1X C *2 General-purpose port CS2X PPG2 C *2 113 114 115 116 117 General-purpose port CS3X C *2 P54 ASX P55 RDX P56 WR0X P57 WR1X P20 SIN0 SOT0/SDA0 (I2C bridge) External chip select pin Output pin for PPG C C C C D P21 118 External chip select pin Output pin for PPG P53 PPG3 External chip select pin Output pin for PPG P52 112 External chip select pin PPG0 *2 PPG1 111 Function General-purpose port External address strobe output pin General-purpose port External read strobe output pin General-purpose port External data bus write strobe output pin General-purpose port External data bus write strobe output pin General-purpose port Serial data input pin General-purpose port L P22 Serial data output pin I2C data I/O pin General-purpose port 119 SCK0/SCL0 (I2C bridge) L Clock pulse input/output pin for serial communication I2C clock I/O pin 120 VDDE - 3.3 V power supply pin *1 : For the I/O circuit type, refer to "1.6 I/O Circuit Types". *2 : For PPG0, PPG1, PPG2, PPG3 on pins 54, 55, 56, 68, and on pins 109, 110, 111, 112 respectively, select and use each one of them via PFR. For the PFR, refer to "CHAPTER 4 I/O PORTS". CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 15 CHAPTER 1 OVERVIEW 1.6 I/O Circuit Types 1.6 MB91313A Series I/O Circuit Types Table 1.6-1 lists the I/O circuit types of MB91313A series. ■ I/O Circuit Types Table 1.6-1 I/O Circuit Types (1 / 3) Type A Circuit type Remarks X1 Clock input Oscillation circuit Built-in feedback resistor X0-X1: 1MΩ X0A-X1A: None X0 STANDBY CONTROL B P-ch Digital output N-ch Digital output • CMOS level output IOH = 4 mA • CMOS level hysteresis input VIH = 0.7 × VDDE • Standby control supported • 5 V tolerant Digital input STANDBY CONTROL C Pull-up Control P-ch P-ch Digital output N-ch Digital output • CMOS level output IOH = 4mA • CMOS level hysteresis input VIH = 0.8 × VDDE • Standby control supported • Pull-up control supported • Pull-up resistor available (33 kΩ) Digital input STANDBY CONTROL 16 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 1 OVERVIEW 1.6 I/O Circuit Types MB91313A Series Table 1.6-1 I/O Circuit Types (2 / 3) Type Circuit type Remarks D P-ch Digital output N-ch Digital output • CMOS level output IOH = 4 mA • CMOS level hysteresis input VIH = 0.8 × VDDE • Standby control supported • Pull-up resistor not available Digital input STANDBY CONTROL F • CMOS level input • Standby control not supported P-ch N-ch Digital input G • CMOS hysteresis input • Pull-up resistor available P-ch P-ch N-ch Digital input H CMOS level output P-ch Digital output N-ch Digital output I • CMOS hysteresis input • Pull-down resistor available • Standby control not supported P-ch N-ch N-ch Digital input CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 17 CHAPTER 1 OVERVIEW 1.6 I/O Circuit Types MB91313A Series Table 1.6-1 I/O Circuit Types (3 / 3) Type Circuit type Remarks K N-ch P-ch Digital output N-ch Digital output • • • • CMOS level output CMOS level input Standby control not supported Pull-down resistor available • • • • CMOS level output CMOS level hysteresis input Standby control supported Analog input with switch Digital input L P-ch Digital output N-ch Digital output Analog input CONTROL Digital input STANDBY CONTROL O Pull-up control P-ch P-ch Digital output N-ch Digital output • CMOS level output IOH=4mA • CMOS input (external bus IF) • CMOS level hysteresis input (port, resource) VIH=0.8 × VDDE • Standby control supported • Pull-up control supported • Pull-up resistor available(33kΩ) Port input Resource input External bus input STANDBY CONTROL 18 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E MB91313A Series 1.7 CHAPTER 1 OVERVIEW 1.7 Precautions on Handling the Device Precautions on Handling the Device This section contains information on the prevention of latch-ups, pin processing, handling of circuits, input at power-on and so on. ■ Preventing a Latch-up A latch-up can occur if, on a CMOS IC, a voltage higher than VDDE and VDDI or a voltage lower than VSS is applied to an input or output pin or a voltage higher than the rating is applied between VDDE pin or VDDI pin and VSS. A latch-up, if it occurs, significantly increases the power supply current and may cause thermal destruction of an element. When you use a CMOS IC, be very careful not to exceed the maximum rating. ■ Unused Input Pins Do not leave an unused input pin open, since it may cause a malfunction. Handle by, for example, using a pull-up or pull-down resistor. ■ Power Supply Pins In MB91313A series, devices including multiple of VDDE pins, VDDI pins and VSS pins are designed as follows; pins necessary to be at the same potential are interconnected internally to prevent malfunctions such as latch-up. All of the power supply pin and GND pin must be externally connected to the power supply and ground respectively in order to reduce unnecessary radiation, to prevent strobe signal malfunctions due to the ground level rising and to follow the total output current ratings. Furthermore, the VDDE pins, VDDI pins and VSS pins of the MB91313A series must be connected to the current supply source via a low impedance. It is also recommended to connect a ceramic capacitor of approximately 0.1μF as a bypass capacitor between VDDE pins, VDDI pins and VSS pins near this device. ■ Crystal Oscillator Circuit Noise in proximity to the X0 and X1 (X0A, X1A) pins can cause the device to operate abnormally. Printed circuit boards should be designed so that the X0 (X0A) and X1 (X1A) pins, and crystal oscillator, as well as bypass capacitors connected to ground, are located near the device and ground. It is recommended that the printed circuit board artwork be designed such that the X0 and X1 pins or X0A and X1A pins are surrounded by ground plane for the stable operation. Please request the oscillator manufacturer to evaluate the oscillational characteristics of the crystal and this device. ■ Mode Pins (MD0 to MD2) When using mode pins, connect them directly to power supply pin or GND pin. To prevent the device from entering test mode accidentally due to noise, minimize the lengths of the patterns between each mode pin and power supply pin or GND pin on the printed circuit board as possible and connect them with low impedance. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 19 CHAPTER 1 OVERVIEW 1.7 Precautions on Handling the Device MB91313A Series ■ Operation at Power-On Ensure that the INITX pin is reset and the settings are initialized (INIT) immediately after the power is turned on. Maintain the "L" level input to the INITX pin during the stabilization wait time immediately after the power on to ensure the stabilization wait time as required by the oscillator circuit (the stabilization wait time is reset to the minimum value when INIT is asserted using the INITX pin). ■ Note on Oscillator Input at Power-On At power-on, ensure that the clock is input until the oscillator stabilization wait time has elapsed. ■ Notes on the Turning On/Off VDDI Pin (1.8 V Internal Power Supply) and VDDE Pin (3.3 V External Pin Power Supply) Do not apply only VDDE pin (external power supply) voltage continuously (more than one minute) while the VDDI pin (internal power supply) is disconnected as it will adversely affect the reliability of the LSI. When the VDDE pin (external power supply) returns from the off state to the on state, the circuit may not be able to maintain its internal state, for example, due to power supply noise. Power on VDD pin (internal power supply) → VDDE pin (external power supply) → Analog→ Signal Power off Signal → Analog→ VDDE pin (external power supply) → VDDI pin (internal power supply) Turning on/off these power supplies (VDDI/Analog/VDDE) simultaneously causes no problem. When the power is turned on, the states of the output pins may remain undefined until the internal power supply becomes stable. ■ Notes on Using an External Clock When using the external clock as a general rule you should simultaneously supply X0 (X0A) and X1 (X1A) pins. And also, the clock signal to X0 (X0A) should be supplied a clock signal with the reverse phase to X1 (X1A) pins. However, in this case the stop mode (oscillation stop mode) must not be used (This is because the X1 (X1A) pin stops at "H" output in STOP mode). Furthermore, supply a clock to X0 (X0A) pin only if the device is operating in less than 12.5 MHz. Figure 1.7-1 Using an External Clock (Normal Method) X0, X0A X1, X1A MB91313A series Cannot be used in STOP mode (oscillation stop mode). Figure 1.7-2 Using an External Clock (available at 12.5 MHz or less) X0, X0A Open Note: 20 X1, X1A MB91313A series : When operating at a frequency of 10 MHz, the delay between the X0 (X0A) and X1 signals should be less than 15 ns. FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 1 OVERVIEW 1.7 Precautions on Handling the Device MB91313A Series ■ AVCC Pin The MB91313A has a built-in A/D converter. A capacitor of approximately 0.1μF must be connected between the AVCC pin and AVSS pin. AVCC 0.1μF MB91313A series AVSS ■ Notes when not Using the Emulator To operate the evaluation MCU on the user system without connecting the emulator, treat each input pin on the evaluation MCU connected to the emulator interface on the user system as shown below. Note that switching circuits or other measures may be needed on the user system. Table 1.7-1 Emulator Interface Pin Treatment Evaluation MCU Pin Name Pin Connection TRSTX Connect to the reset output circuit on the user system. INITX Connect to the reset output circuit on the user system. Other Pins Open ■ Notes on Selecting PLL Clocks If the crystal oscillator is disconnected or the clock input stops while the PLL clock is selected, the microcontroller may continue to operate at the free-running frequency of the self-oscillating circuit within the PLL. However, this operation is not guaranteed. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 21 CHAPTER 1 OVERVIEW 1.7 Precautions on Handling the Device MB91313A Series ■ Restrictions ● Clock control block When an "L" level is input to the INITX pin, ensure that it is maintained for the duration of the oscillation stabilization wait time. ● Bit Search Module The bit search data register for 0-detection (BSD0), bit search data register for 1-detection (BSD1), and bit search data register for change point detection (BSDC) can be accessed in word. ● I/O Ports Ports can only be accessed in byte. ● Low Power Consumption Mode • To place the device in standby mode, use the synchronous standby mode (set with bit 8 (SYNCS bit) of the timebase counter control register, TBCR) and be sure to use the following sequence : (LDI#value_of_standby, r0) (LDI#_STCR, R12) STB R0, @R12 LDUB @R12, R0 LDUB @R12, R0 NOP NOP NOP NOP NOP ; value_of_standby is the data to write to STCR ; _STCR is the address of STCR (481H) ; Write to the standby control register (STCR) ; Read STCR for synchronous standby ; Perform an additional dummy read of STCR ; 5 × NOP for timing adjustment • Do not perform any of the following actions when using the monitor debugger. - Set a breakpoint within the sequence of instructions shown above - Perform step execution of the sequence of instructions shown above 22 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 1 OVERVIEW 1.7 Precautions on Handling the Device MB91313A Series ● Notes on the PS register Some instructions write to the PS register in advance before executing. When a debugger is being used, execution may break within an interrupt handler routine, or the values of the flags within the PS register may be updated due to exception processing. However, the microcontroller is designed to reprocess correctly after returning from the EIT, and to execute before and after the EIT proceeds according to the specifications. • In any following situation, the previous instructions before a DIV0U or DIV0S instruction may take the processing in (1) to (3). - A user interrupt or NMI is accepted - Step execution is performed - A break occurs due to a data event or by being selected from the emulator menu 1. The D0 and D1 flags are updated in advance. 2. The EIT handling routine (user interrupt/NMI or emulator) is executed. 3. Upon returning from the EIT, the DIV0U or DIV0S instruction is executed and the D0/D1 flags are updated back to the same value as in step (1). • If any of the OR CCR, ST ILM, or MOV Ri, PS instructions are executed to enable a user interrupt or NMI interrupt source when that interrupt has occurred, the following operation will be performed. 1. The PS register is updated in advance. 2. The EIT handling routine (user interrupt/NMI or emulator) is executed. 3. Upon returning from the EIT, the above instructions are executed and the PS registers are updated back to the same value as in step (1). ● Watchdog timer The watchdog timer has a function to monitors the program to check that it delays a reset within a certain period of time, and resets the CPU if the program runs out of control and fails to delay the reset. Once the watchdog timer has been enabled, it keeps running until reset. As an exception, the reset is automatically delayed in conditions where the execution of the CPU program stops. It is possible that the watchdog timer will not be triggered if these conditions arise as a result of the system running out of control. In that case, please reset (INIT) using the external INITX pin. ● Notes on using the A/D converter Do not supply a voltage higher than the VDDE pin to the AVCC pin. ● Software reset in synchronous mode When using the software reset in synchronous mode, the following two conditions should be satisfied before setting the SRST bit in STCR (standby control register) to "0". • The interrupt enable flag (I-Flag) is set to interrupts disabled (I-Flag = 0) . • The NMI is not being used. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 23 CHAPTER 1 OVERVIEW 1.7 Precautions on Handling the Device 24 FUJITSU SEMICONDUCTOR LIMITED MB91313A Series CM71-10143-5E CHAPTER 2 CPU AND CONTROL BLOCK This chapter provides the CPU core of the FR family, covering its architecture, specifications, and instructions. CM71-10143-5E 2.1 Memory Space 2.2 Internal Architecture 2.3 Instructions 2.4 Programming Model 2.5 Data Structure 2.6 Branch Instruction 2.7 EIT (Exception, Interruption, and Trap) 2.8 Reset (Device Initialization) 2.9 Clock Generation Control 2.10 Device State Control 2.11 Operating Mode FUJITSU SEMICONDUCTOR LIMITED 25 CHAPTER 2 CPU AND CONTROL BLOCK 2.1 Memory Space 2.1 MB91313A Series Memory Space The logical address space of the FR family is 4GB (232 locations) and the CPU performs linear access. ■ Direct Addressing Area The following area of the address space is used for I/O. This area is called the direct addressing area and the operand address can be specified directly in the instruction. A direct area varies depending on the size of the accessed data as follows. byte data access : 000H to 0FFH half word data access : 000H to 1FFH word data access : 000H to 3FFH ■ FR Family Memory Map Figure 2.1-1 shows the memory map of the FR family. The FR family has a 32-bit linear address space. Figure 2.1-1 FR Family Memory Map 00000000H Byte data 00000100H Half word data 00000200H Direct Addressing Area Word data 00000400H 000FFC00H Vector table 000FFFFFH Initial area FFFFFFFFH ● Initial Area of the Vector Table The area from "000FFC00H" to "000FFFFFH" is used as the initial area of the EIT vector table. The vector table to be used during EIT processing can be placed at any address by rewriting TBR. However, the table will be relocated to this address when initialized by a reset. 26 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 2 CPU AND CONTROL BLOCK 2.1 Memory Space MB91313A Series ■ Memory Map of MB91313A Series Figure 2.1-2 shows the memory map. Figure 2.1-2 Memory Map of MB91313A Series Single chip mode Internal ROM external bus mode I/O I/O I/O I/O Access prohibited Access prohibited Internal RAM 32 Kbytes Internal RAM 32 Kbytes Direct addressing area 00000000H 00000400H 00010000H 00038000H See "APPENDIX A I/O Map". 00040000H Access prohibited Access prohibited 00050000H External area 00078000H Internal Flash 544 Kbytes 00100000H 00200000H 007FFFFFH FFFFFFFFH CM71-10143-5E Internal Flash 544 Kbytes Access prohibited Access prohibited External area Access prohibited FUJITSU SEMICONDUCTOR LIMITED 27 CHAPTER 2 CPU AND CONTROL BLOCK 2.2 Internal Architecture 2.2 MB91313A Series Internal Architecture As well as adopting a RISC architecture, the FR family CPU is a high performance core featuring advanced instructions for embedded applications. ■ Features of Internal Architecture • Adoption of a RISC architecture Basic instruction: one instruction = one cycle • 32-bit architecture General-purpose registers: 32 bits × 16 registers • Linear memory space of 4 GB • Multipliers provided 32-bit by 32-bit multiplication: 5 cycles 16-bit by 16-bit multiplication: 3 cycles • Reinforced interrupt processing function High-speed response speed (6 cycles) Multiple interruption supported Level mask function (16 levels) • Reinforced instruction for I/O operation Memory-to-memory transfer instruction Bit manipulation instruction • Basic instruction word length: 16 bits • Low-power consumption Sleep mode / Stop mode Gear function 28 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 2 CPU AND CONTROL BLOCK 2.2 Internal Architecture MB91313A Series ■ Structure of Internal Architecture The CPU of the FR family uses the Harvard architecture with separate instruction bus and data bus. A 32-bit ←→ 16-bit bus converter is connected to the 32-bit bus (F-bus) to provide an interface between the CPU and peripherals. A Harvard ←→ Princeton bus converter is connected to the I-bus and D-bus to provide an interface between the CPU and the bus controller. Figure 2.2-1 Structure of Internal Architecture FR-CPU I-bus Built-in RAM Built-in ROM D-bus 32 32 32 32 Harvard ⇔ Princeton bus converter F-bus 32 32 X-bus 32 32 Real Bus 24 Address 32-bit 16-bit Bus converter Bus controller 16 16 R-bus Peripheral resource, port ■ CPU The 32-bit RISC architecture of the FR family has been compactly implemented in this CPU. A 5-stage instruction pipeline system is used to enable the execution of one instruction per cycle. The pipeline is composed of the following stages. Figure 2.2-2 shows the configuration of the instruction pipeline. • Instruction fetch (IF) : Outputs an instruction address and fetches the instruction. • Instruction decode (ID) : Decodes the fetched instruction. It also reads from a register. CM71-10143-5E • Execution (EX) : Executes an arithmetic operation. • Memory access (MA) : Accesses the memory for load or store operation. • Write-back (WB) : Writes the arithmetic operation result (or loaded memory data) to a register. FUJITSU SEMICONDUCTOR LIMITED 29 CHAPTER 2 CPU AND CONTROL BLOCK 2.2 Internal Architecture MB91313A Series Figure 2.2-2 Instruction Pipeline CLK Instruction 1 WB Instruction 2 MA WB Instruction 3 EX MA WB Instruction 4 ID EX MA WB Instruction 5 IF ID EX MA WB IF ID EX MA Instruction 6 WB Instructions are always executed in the correct order. This means that if Instruction A enters the pipeline before Instruction B, Instruction A always reaches the write-back stage before Instruction B does. As a rule, the execution speed of instructions is based on one instruction per cycle. However, more than one cycle are required to execute instructions such as load/store instructions with memory wait, branch instructions without a delay slot, and multi-cycle instructions. Moreover, the execution speed of an instruction also decreases, when the supply of the instruction is delayed. ■ 32-bit ←→ 16-bit Bus Converter The 32-bit ←→ 16-bit bus converter provides an interface between the F-bus (high-speed 32-bit access) and the R-bus (16-bit access) to enable data access from the CPU to the built-in peripheral circuits. When 32-bit access is performed from the CPU to the R-bus, the bus converter converts 32-bit access into two sets of 16-bit access. Some built-in peripheral circuits have access-width restrictions. 30 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 2 CPU AND CONTROL BLOCK 2.2 Internal Architecture MB91313A Series ■ Harvard ←→ Princeton Bus Converter The Harvard ←→ Princeton bus converter adjusts instruction access from the CPU to data access to provide a seamless interface with an external bus. The CPU is structured in the Harvard architecture in which the instruction bus exists independently from the data bus. On the other hand, the bus controller, which controls the external bus, is structured in the single-bus-based Princeton architecture. This bus converter assigns an order of priority for the instruction access from the CPU and data access to control access to the bus controller. This mechanism allows the external bus access order to be always optimized. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 31 CHAPTER 2 CPU AND CONTROL BLOCK 2.3 Instructions 2.3 MB91313A Series Instructions The FR family supports not only a regular RISC instruction set but also logic operations, bit manipulation and direct addressing instructions, which are optimized for embedded applications. The instruction set is listed in "APPENDIX D Instruction Lists". Each instruction is 16-bit long (some are 32 or 48-bit long) to ensure excellent efficiency in memory usage. The instruction set can be divided into the following function groups: • Arithmetic Operation • Load and Store • Branching • Arithmetic Operation and Bit Manipulation • Direct Addressing • Others ■ Arithmetic Operation There are the standard arithmetic operation instructions (addition, subtraction and comparison) and shift instructions (logic shift and arithmetic operation shift) available. For addition and subtraction, the following operations are also possible: operation with carry, used for multi-word operation; and operation with an unchanged flag value, useful for address calculation. The provided instructions also include 32-bit-by-32-bit and 16-bit-by-16-bit multiplication instructions, 32bit-by-32-bit step division instructions as well as immediate transfer instructions that set an immediate value in a register, and register-to-register transfer instructions. All arithmetic operation instructions are performed using general-purpose registers and multiplication and division registers in the CPU. ■ Load and Store Load and store instructions are used to read from and write to external memory. They are also used to read from and write to peripheral circuits (I/O) on the chip. The load and store instructions are provided with three access lengths: byte, half-word, and word length. In addition to the general register-indirect memory addressing, some instructions support register-indirect memory addressing with the displacement or register increment/decrement feature. ■ Branching Branch instructions are used for branching, calling, interrupting and returning purposes. Some have a delay slot while the others do not, enabling instruction optimization for each application. The branch instructions are detailed later in the chapter. 32 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 2 CPU AND CONTROL BLOCK 2.3 Instructions MB91313A Series ■ Arithmetic Operation and Bit Manipulation The logic operation instruction can be used to perform a logic operation such as AND, OR, EOR between general-purpose registers or between a general-purpose register and the memory (and I/O). The bit manipulation instruction can be used to directly manipulate the content of the memory (and I/O). General register indirect memory addressing is supported. ■ Direct Addressing The direct addressing instruction is used to provide access between I/O and a general-purpose register or between I/O and the memory. I/O address can be specified directly in the instruction, rather than indirectly by a register, to enable high-speed, highly efficient access. Some instructions support register-indirect memory addressing with the register increment/decrement feature. ■ Overview of Other Instructions Other instructions are used to set a flag in the PS register, perform stack operation, and add sign/zero extension. They also include function entry/exit instructions supporting high-level language as well as register multi-load/store instructions. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 33 CHAPTER 2 CPU AND CONTROL BLOCK 2.4 Programming Model 2.4 MB91313A Series Programming Model This section explains the programming model, general-purpose registers and dedicated registers of the FR family. ■ Basic Programming Model Figure 2.4-1 shows the basic programming model of the FR family. Figure 2.4-1 Basic Programming Model 32 bits [Initial value] XXXX XXXXH R0 … R1 … … … … General-purpose Register R13 AC R14 FP R15 SP PC Program status PS Table base register TBR Return pointer RP System stack pointer SSP Multiplication/division register 34 R12 Program counter User stack pointer … … … − ILM … XXXX XXXXH − 0000 0000H SCR CCR USP MDH MDL FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 2 CPU AND CONTROL BLOCK 2.4 Programming Model MB91313A Series 2.4.1 General-purpose Register Registers R0 to R15 are general-purpose registers. They are used as accumulators for various types of arithmetic operations and as memory access pointers. ■ General-purpose Register Figure 2.4-2 shows the configuration of a general-purpose register. Figure 2.4-2 Configuration of General-purpose Register 32 bits [Initial value] R0 XXXX XXXXH R1 R12 R13 R14 AC FP XXXX XXXXH R15 SP 0000 0000H Of the 16 registers, the following are intended for special applications; therefore, they have some advanced instructions. • R13: Virtual accumulator (AC) • R14: Frame pointer (FP) • R15: Stack pointer (SP) The initial value at a reset is undefined for R0 to R14, but defined as "00000000H" (SSP value) for R15. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 35 CHAPTER 2 CPU AND CONTROL BLOCK 2.4 Programming Model 2.4.2 MB91313A Series Dedicated Register A dedicated register is used for a specific purpose. The FR family is provided with the following dedicated register: • PS (Program Status) • CCR (Condition Code Register) • SCR (System Condition code Register) • ILM (Interrupt Level Mask register) • PC (Program Counter) • TBR (Table Base Register) • RP (Return Pointer) • SSP (System Stack Pointer) • USP (User Stack Pointer) • MDH, MDL (Multiply & Divide register) ■ PS (Program Status) PS is a register that retains the program status and divided into three parts: ILM, SCR and CCR. All of the undefined bits are reserved. Reading them always returns "0". Writing is invalid. The register configuration of PS (Program Status) is shown below. bit 31 20 16 ILM 36 10 8 7 SCR FUJITSU SEMICONDUCTOR LIMITED 0 CCR CM71-10143-5E CHAPTER 2 CPU AND CONTROL BLOCK 2.4 Programming Model MB91313A Series ■ CCR (Condition Code Register) The register configuration of CCR (Condition Code Register) is shown below. bit 7 6 5 4 3 2 1 0 [Initial value] - - S I N Z V C --00XXXXB [bit5] S: Stack flag This bit selects the stack pointer to be used as R15. Value Description 0 SSP is used as R15. The value is automatically set to "0" when EIT occurs. (Note that the value before the bit was cleared is saved on the stack.) 1 USP is used as R15. •It is cleared to "0" by a reset. •Set it to "0" when executing the RETI instruction. [bit4] I: Interrupt enable flag This bit enables and disables a user interrupt request. Value Description 0 Disables user interrupt. Cleared to "0" when INT instruction is executed. (Note that the value before the bit was cleared is saved on the stack.) 1 Enables user interrupt. Controls the masking of a user interrupt request using the value retained in ILM. •It is cleared to "0" by a reset. [bit3] N: Negative flag This bit indicates the sign when the arithmetic operation result is represented as a complement integer for "2". Value Description 0 Indicates that the operation has resulted in a positive value. 1 Indicates that the operation has resulted in a negative value. •The initial state at a reset is undefined. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 37 CHAPTER 2 CPU AND CONTROL BLOCK 2.4 Programming Model MB91313A Series [bit2] Z: Zero flag This bit indicates whether the operation result is "0". Value Description 0 Indicates that the operation has resulted in a value other than "0". 1 Indicates that the operation has resulted in "0". •The initial state at a reset is undefined. [bit1] V: Overflow flag This bit assumes the operand used in an operation as a complement integer for "2" and indicates whether an overflow has occurred due to the operation. Value Description 0 Indicates that no overflow has occurred due to the operation. 1 Indicates that an overflow has occurred due to the operation. •The initial state at a reset is undefined. [bit0] C: Carry flag This bit indicates whether an operation has resulted in a carry or borrow from the most significant bit. Value Description 0 Indicates that neither a carry nor borrow has occurred. 1 Indicates that either a carry or borrow has occurred. •The initial state at a reset is undefined. 38 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 2 CPU AND CONTROL BLOCK 2.4 Programming Model MB91313A Series ■ SCR (System Condition code Register) The register configuration of SCR (System Condition code Register) is shown below. bit 10 9 8 [Initial value] D1 D0 T XX0B [bit10, bit9] D1, D0: Step division flag These bits hold the intermediate data obtained when step division is executed. Do not modify these bits while division processing is being executed. To perform other processing while executing a step division, save and restore the value of the PS register to ensure that the step division is restarted. •The initial state at a reset is undefined. •To set these bits, execute the DIV0S instruction with the dividend and the divisor to be referenced. •To forcibly clear these bits, execute the DIV0U instruction. •Do not perform the process before EIT branching in the EIT processing routine, which simultaneously accepts DIV0S/DIV0U instruction, user interrupt and NMI. •The D0 and D1 bits in the PS register may not indicate the correct value if the operation is stopped by break or step execution immediately before the DIV0S/DIV0U instruction. Note, however, that the correct value will be calculated after return. [bit8] T: Step trace trap flag This flag specifies whether the step trace trap is to be enabled. Value Description 0 Disables the step trace trap. 1 Enables the step trace trap. With this setting, all the user NMI and user interrupts are prohibited. •This bit is initialized to "0" by a reset. •The step trace trap function is used by an emulator. When used by the emulator, this function cannot be used in the user program. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 39 CHAPTER 2 CPU AND CONTROL BLOCK 2.4 Programming Model MB91313A Series ■ ILM (Interrupt Level Mask Register) The register configuration of ILM is shown below. bit 20 19 18 17 16 [Initial value] ILM4 ILM3 ILM2 ILM1 ILM0 01111B This register retains an interrupt level mask value. The CPU accepts only interrupt requests sent to it with an interrupt level higher than the level indicated by the ILM. The highest level is 0 (00000B) and the lowest level is 31 (11111B). There are restrictions on the values that can be set by the program. • If the original value is between 16 and 31: The new value must be between 16 and 31. If an instruction that sets a value between 0 and 15 is executed, the specified value plus 16 is transferred. • If the original value is between 0 and 15: An arbitrary value between 0 and 31 may be set. This register is initialized to 15 (01111B) by a reset. ■ PC (Program Counter) The register configuration of PC (Program Counter) is shown blow. bit 31 0 PC [Initial value] XXXXXXXXH [bit31 to bit0] These bits indicate the address of the instruction executed with the program counter. Bit0 is set to "0", when PC is updated with the execution of an instruction. When an odd-numbered location is specified as the branch target address, bit0 is invalid; therefore, an instruction must be placed at the address with a multiple of "2". The initial value after a reset is undefined. ■ TBR (Table Base Register) The register configuration of TBR (Table Base Register) is shown below. bit 31 0 TBR [Initial value] 000FFC00H TBR is used to retain the start address of the vector table to be used for EIT processing. The initial value at a reset is "000FFC00H". 40 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 2 CPU AND CONTROL BLOCK 2.4 Programming Model MB91313A Series ■ RP (Return Pointer) The register configuration of RP (Return Pointer) is shown below. bit 31 0 RP [Initial value] XXXXXXXXH RP retains the address used for returning from the sub routine. When the CALL instruction is executed, the PC value is transferred to the RP. When the RET instruction is executed, the content of RP is transferred to PC. The initial value after a reset is undefined. ■ SSP (System Stack Pointer) The register configuration of SSP (System Stack Pointer) is shown below. bit 31 0 SSP [Initial value] 00000000H SSP stands for system stack pointer. It serves as R15 when the S flag is set to "0". The SSP can also be specified by direct instruction. Moreover, it can be used as a stack pointer to specify the stack that will save the PS and PC when EIT occurs. The initial value at a reset is "00000000H". ■ USP (User Stack Pointer) The register configuration of USP (User Stack Pointer) is shown below. bit 31 0 USP [Initial value] XXXXXXXXH USP stands for user stack pointer. It serves as R15 when the S flag is set to "1". USP can also be specified by direct instruction. The initial value after a reset is undefined. It cannot be used with the RETI instruction. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 41 CHAPTER 2 CPU AND CONTROL BLOCK 2.4 Programming Model MB91313A Series ■ MDH, MDL (Multiply & Divide Register) The register configuration of the Multiply & Divide register is shown below. bit 31 0 MDH MDL This register is used for multiplication and division. Each is 32-bit long. The initial value after a reset is undefined. • For multiplication: The 64-bit operation result from a 32-bit-by-32-bit multiplication is stored in the multiplication/division result storage register in the following format. MDH : Upper 32 bits MDL : Lower 32 bits For a 16-bit-by-16-bit multiplication, the result is stored in the following format. MDH : Undefined MDL : Result of 32 bits • For division: The dividend is stored in MDL when the calculation starts. When a division is performed by executing DIV0S/DIV0U, DIV1, DIV2, DIV3 or DIV4S instruction, the result is stored in MDL and MDH. MDH : Remainder MDL : Quotient 42 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 2 CPU AND CONTROL BLOCK 2.5 Data Structure MB91313A Series 2.5 Data Structure This section explains the data structure of the FR family. ■ Bit Ordering The FR family has adopted a little endian system for bit ordering. Figure 2.5-1 shows the data arrangement for bit ordering. Figure 2.5-1 Data Arrangement for Bit Ordering bit 31 29 30 27 28 25 26 23 24 21 22 19 20 17 18 15 16 13 14 11 12 9 10 7 8 5 6 3 4 1 2 MSB 0 LSB ■ Byte Ordering The FR family has adopted a big endian system for byte ordering. Figure 2.5-2 shows the data arrangement for byte ordering. Figure 2.5-2 Data Arrangement for Byte Ordering Memory MSB bit 31 23 15 7 LSB 0 10101010 11001100 11111111 00010001 bit 7 0 Location n 10101010 Location (n+1) 11001100 Location (n+2) 11111111 Location (n+3) 00010001 CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 43 CHAPTER 2 CPU AND CONTROL BLOCK 2.5 Data Structure MB91313A Series ■ Word Alignment ● Program access The program for the FR family must be placed at the address with a multiple of 2. Bit0 in the PC is set to "0" when the PC is updated with the execution of an instruction. When an odd-numbered location is specified as the branch target address, bit0 is invalid; therefore, an instruction must be placed at the address with a multiple of "2". There is no exception for the use of an odd-numbered address. ● Data access In the FR family, addresses are aligned forcibly, depending on the width of the data to be accessed, as shown below. Word access: The address has a multiple of "4". (The lowest 2 bits are forcibly set to "00".) Half word access: The address has a multiple of "2". (The lowest bit is forcibly set to "0".) Byte access: - In word and half-word data access, some bits are forcibly set to "0" only for the calculation result of the effective address. In the addressing mode @(R13, Ri), for example, the register before addition is used as it is (even when the least significant bit is "1"), and the low bits of the addition result are masked. In other words, the register before the calculation is not masked. [Example] LD @(R13, R2), R0 R13 00002222H R2 00000003H +) Addition result Address pin 44 00002225H Low 2 bits forcibly masked 00002224H FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 2 CPU AND CONTROL BLOCK 2.6 Branch Instruction MB91313A Series 2.6 Branch Instruction This section explains the branch instructions of the FR family. ■ Overview of Branch Instructions In the FR family, a branch instruction can be specified to operate either with or without a delay slot. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 45 CHAPTER 2 CPU AND CONTROL BLOCK 2.6 Branch Instruction 2.6.1 MB91313A Series Operation with a Delay Slot This section explains the branch instruction operation with a delay slot. ■ Instruction for Operation with a Delay Slot The instructions listed below perform operation with a delay slot. JMP:D @Ri CALL:D label12 CALL: @Ri RET:D BRA:D label9 BNO:D label9 BEQ:D label9 BNE:D label9 BC:D label9 BNC:D label9 BN:D label9 BP:D label9 BV:D label9 BNV:D label9 BLT:D label9 BGE:D label9 BLE:D label9 BGT:D label9 BLS:D label9 BHI:D label9 ■ Operating Explanation of Operation with a Delay Slot In the operation with a delay slot, branching occurs after the instruction placed immediately after the branch instruction (called "delay slot") is executed before the instruction at the branch target is executed. The dummy execution speed is 1 cycle because the instruction with a delay slot is executed before branching. However, if a valid instruction cannot be placed in the delay slot, a NOP instruction must be placed instead. [Example] ; Alignment of instructions ADD R1, R2 ; BRA:D LABEL ; Branch instruction MOV R2, R3 ; Delay slot …… executed before branching … LABEL: ST R3, @R4 ; Branch target In case of a conditional branch instruction, the instruction placed in the delay slot is executed regardless of whether the branch condition is satisfied. In case of delayed branch instructions, the execution order of some instructions appears to be inverted. This is however only applicable to the updating of PC. Other operations (updating/referencing a register, etc.) are executed in the order as described. The following section provides specific details. 1) Ri, which is referenced by the JMP:D @Ri / CALL:D @Ri instruction, is not affected even when updated by the instruction in the delay slot. [Example] LDI:32 #Label, R0 JMP:D @R0 LDI:8 #0, ; Branch to Label R0 ; Branch target address not affected … 46 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 2 CPU AND CONTROL BLOCK 2.6 Branch Instruction MB91313A Series 2) RP, which is referenced by the RET:D instruction, is not affected even when updated by the instruction in the delay slot. [Example] RET:D MOV ; Branch to the preset address indicated by RP R8, RP ; Return operation not affected … 3) The flag referenced by the Bcc:D rel instruction is also not affected by the instruction in the delay slot. [Example] ADD #1, R0 BC:D Overflow AND CCR #0 ; Flag change ; Branching based on the execution result of the above instruction ; This flag update is not referenced by the above branch instruction. … 4) When RP is referenced by the instruction in the delay slot of the CALL:D instruction, the updated content is read by the CALL:D instruction. [Example] CALL:D Label MOV RP, ; RP update and branching R0 ; RP of the execution result in the CALL:D above is transferred … ■ Restrictions on the Operation with a Delay Slot ● Instructions that can be placed in the delay slot Only the instructions which meet the following conditions can be executed in the delay slot. • 1-cycle instruction • Not a branch instruction • Instruction that does not affect the operation even if the order is changed The "1-cycle instruction" refers to an instruction with "1", "a", "b", "c" or "d" indicated in the column for the number of cycles on the instruction list. ● Step trace trap Step trace trap does not occur between the execution of a branch instruction with a delay slot and the delay slot. ● Interrupt and NMI Neither an interrupt nor NMI can be accepted between the execution of a branch instruction with a delay slot and the delay slot. ● Undefined instruction exception If the delay slot contains an undefined instruction, no undefined instruction exception occurs. In this case, the undefined instruction operates as a NOP instruction. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 47 CHAPTER 2 CPU AND CONTROL BLOCK 2.6 Branch Instruction 2.6.2 MB91313A Series Operation with No Delay Slot This section explains the operation with no delay slot specified for a branch instruction. ■ Instructions that Operate without a Delay Slot The instructions listed below perform branching without a delay slot. JMP @Ri CALL label12 CALL @Ri RET BRA label9 BNO label9 BEQ label9 BNE label9 BC label9 BNC label9 BN label9 BP label9 BV label9 BNV label9 BLT label9 BGE label9 BGT BLS label9 BHI label9 BLE label9 label9 ■ Explanation of Operation without a Delay Slot The operation without a delay slot is executed strictly according to the order of instructions as arranged. The immediately following instruction is never executed before branching. [Example] ; Alignment of instructions ADD R1, R2 ; BRA LABEL ; Branch instruction (no delay slot) MOV R2, R3 ; Not executed … LABEL: ST R3, @R4 ; Branch target The number of execution cycles for a branch instruction without a delay slot is 2 cycles for branching, and 1 cycle for no branching. As a branch instruction without a delay slot cannot contain an appropriate instruction in a delay slot, it can have higher instruction code efficiency than a branch instruction with a delay slot, which describes NOP. High execution speed and code efficiency can be both achieved by selecting the operation with a delay slot when a valid instruction can be placed in the delay slot, and selecting the operation without a delay slot otherwise. 48 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 2 CPU AND CONTROL BLOCK 2.7 EIT (Exception, Interruption, and Trap) MB91313A Series 2.7 EIT (Exception, Interruption, and Trap) EIT, which is the generic term for "Exception", "Interrupt", and "Trap", indicates that the current program is suspended due to an event generated when another program is being executed while the current one is still running. The exception is an event which occurs in relation to the context under execution. Execution continues from the instruction that caused the exception. The interruption is an event which occurs without any relation to the context under execution. The event source is hardware. The trap is an event which occurs in relation to the context under execution. Some traps, such as system calls, are specified by the program. Execution continues from the instruction after the instruction that caused the trap. ■ Features of EIT • Interruption supporting multiple interrupt • Level mask function for interruption (15 levels available to the user) • Trap instruction (INT) • EIT for activating an emulator (hardware/software) ■ EIT Sources The following are used as EIT sources: • Reset • User interrupt (internal resource and external interrupts) • NMI • Delayed interrupt • Undefined instruction exception • Trap instruction (INT) • Trap instruction (INTE) • Step trace trap • Coprocessor absence trap • Coprocessor Error Trap Note: There are EIT-related restrictions on the delay slot of a branch instruction. For details, see "2.6 Branch Instruction". ■ Returning from EIT RETI instruction CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 49 CHAPTER 2 CPU AND CONTROL BLOCK 2.7 EIT (Exception, Interruption, and Trap) 2.7.1 MB91313A Series EIT Interrupt Levels The interrupt levels range from 0 to 31, which are managed by 5 bits. ■ EIT Interrupt Levels Table 2.7-1 shows the interrupt levels. Table 2.7-1 Interrupt Levels Level Interrupt resource Binary Decimal 00000 0 (Reserved for system) … … … … … … 00011 3 (Reserved for system) 00100 4 00101 5 (Reserved for system) … … … … … … 01110 14 (Reserved for system) 01111 15 NMI (for user) 10000 16 Interrupt 10001 17 Interrupt … … … … … … 11110 30 Interrupt 11111 31 — { INTE instruction Step trace trap Remarks If the original value of ILM is between 16 and 31, the value of this range cannot be set in the ILM by the program. When ILM is set, a user interrupt is disabled. When ICR is set, an interrupt is disabled. The operation is enabled at levels 16 to 31. The interrupt level does not affect the undefined interrupt exception, coprocessor absent trap, coprocessor error trap or INT instruction. It also does not change ILM. 50 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 2 CPU AND CONTROL BLOCK 2.7 EIT (Exception, Interruption, and Trap) MB91313A Series ■ I Flag I flag is used to enable or disable interrupts. It is provided as bit4 in CCR of the PS register. Value Description 0 Interrupts disabled Cleared to "0" when INT instruction is executed. (Note that the value before the bit was cleared is saved on the stack.) 1 Interrupt enabled The masking of the interrupt request is controlled by the value retained in ILM. ■ ILM ILM is a PS register (bit20 to bit16) that retains the interrupt level mask value. The CPU accepts only interrupt requests sent to it with an interrupt level higher than the level indicated by the ILM. The highest level is 0 (00000B) and the lowest level is 31 (11111B). There are restrictions on the values that can be set by the program. If the original value is between 16 and 31, a new value may be set between 16 and 31. If an instruction that sets a value between 0 and 15 is executed, the specified value plus 16 is transferred. If the original value is between 0 and 15, an arbitrary value between 0 and 31 may be set. ST ILM instruction is used to set an arbitrary value. ■ Level Masking for Interrupt/NMI When NMI or interrupt request is generated, the interrupt level for the interrupt source (see Table 2.7-1) is compared with the level mask value retained in ILM. Then, if the following condition is satisfied in level strength, it will be masked and the request will not be accepted. Interrupt level for interrupt source ≥ Level mask value CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 51 CHAPTER 2 CPU AND CONTROL BLOCK 2.7 EIT (Exception, Interruption, and Trap) 2.7.2 MB91313A Series ICR (Interrupt Control Register) ICR is a register located in the interrupt controller and used to set a certain level to each interrupt request. ICR is provided to support the input of various interrupt requests. ICR is mapped in the I/O space and accessed from the CPU via a bus. ■ Bit Configuration of ICR The bit configuration of ICR is shown below. bit 7 6 5 4 3 2 1 0 - - - ICR4 R ICR3 R/W ICR2 R/W ICR1 R/W ICR0 R/W Initial value ---111111B [bit4] ICR4 ICR4 is always set to "1". [bit3 to bit0] ICR3 to ICR0 These are lower 4 bits of the interrupt level of the corresponding interrupt source. They are readable and writable. Combined with bit4, ICR can be used to set any value between 16 and 31. ■ ICR Mapping Table 2.7-2 lists the assignment of interrupt sources, interrupt control registers, and interrupt vectors. Table 2.7-2 Interrupt Sources, Interrupt Control Registers and Interrupt Vectors Interrupt Control Register Interrupt Source Corresponding Interrupt Vector No. No. Address Address Hexadecimal Decimal IRQ00 ICR00 00000440H 10H 16 TBR+3BCH IRQ01 ICR01 00000441H 11H 17 TBR+3B8H IRQ02 ICR02 00000442H 12H 18 TBR+3B4H … … … … … … … … … … … … IRQ45 ICR45 0000046DH 3DH 61 TBR+308H IRQ46 ICR46 0000046EH 3EH 62 TBR+304H IRQ47 ICR47 0000046FH 3FH 63 TBR+300H • TBR initial value: "000FFC00H" • For details, see "CHAPTER 10 INTERRUPT CONTROLLER" 52 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 2 CPU AND CONTROL BLOCK 2.7 EIT (Exception, Interruption, and Trap) MB91313A Series 2.7.3 SSP (System Stack Pointer) SSP (System Stack Pointer) is used as the pointer that indicates the stack for saving and restoring data at the acceptance of EIT or return. ■ SSP (System Stack Pointer) The register configuration of SSP (System Stack Pointer) is shown below. bit 31 0 [Initial value] 00000000H SSP The content is stored by data of SSP-8 during EIT processing and data of SSP-8 is stored to it during return from the EIT executed by the RETI instruction. The initial value at a reset is "00000000H". SSP (System Stack Pointer) also serves as R15 (general-purpose register) when the S flag in CCR is set to "0". ■ Interrupt Stack This is the area indicated by SSP (System Stack Pointer), where the PC and PS values are saved and restored. After an interrupt, the PC is stored at the address indicated by SSP (System Stack Pointer), and the PS at the address (SSP + 4). Figure 2.7-1 shows an example of the interrupt stack. Figure 2.7-1 Interrupt Stack [Before interrupt] SSP 80000000H [After interrupt] SSP 7FFFFFF8H Memory 80000000H 7FFFFFFCH 7FFFFFF8H CM71-10143-5E 80000000H 7FFFFFFCH 7FFFFFF8H FUJITSU SEMICONDUCTOR LIMITED PS PC 53 CHAPTER 2 CPU AND CONTROL BLOCK 2.7 EIT (Exception, Interruption, and Trap) 2.7.4 MB91313A Series TBR (Table Base Register) TBR (Table Base Register) indicates the start address of the EIT vector table. ■ TBR (Table Base Register) The register configuration of TBR is shown below. bit 31 0 [Initial value] 000FFC00H TBR The vector address is calculated by adding the TBR (Table Base Register) and offset value determined for each EIT source. The initial value at a reset is "000FFC00H". ■ EIT Vector Table The EIT vector area is the 1 KB area starting from the address indicated by TBR. Each vector consists of 4 bytes. The relationship between the vector number and vector address is as follows. vctadr = TBR + vctofs = TBR + (3FCH - 4 × vct) vctadr : Vector address vctofs : Vector offset vct : Vector number The lower 2 bits of the addition result are always treated as "00". The initial area of the vector table by a reset is the area between "000FFC00H" and "000FFFFFH". Special functions are assigned to some vectors. Table 2.7-3 shows the vector table on the architecture. Table 2.7-3 Vector Table (1 / 4) Interrupt No. Interrupt Source Decimal Hexadecimal Interrupt Level Offset TBR Default Address Reset *1 0 00 - 3FCH 000FFFFCH Mode vector *1 1 01 - 3F8H 000FFFF8H System-reserved 2 02 - 3F4H 000FFFF4H System-reserved 3 03 - 3F0H 000FFFF0H System-reserved 4 04 - 3ECH 000FFFECH *1: Even when the TBR value is modified, the fixed addresses "000FFFFCH" and "000FFFF8H" are used for the reset vector and mode vector respectively. 54 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 2 CPU AND CONTROL BLOCK 2.7 EIT (Exception, Interruption, and Trap) MB91313A Series Table 2.7-3 Vector Table (2 / 4) Interrupt No. Interrupt Source Decimal Hexadecimal Interrupt Level Offset TBR Default Address System-reserved 5 05 - 3E8H 000FFFE8H System-reserved 6 06 - 3E4H 000FFFE4H Coprocessor absence trap 7 07 - 3E0H 000FFFE0H Coprocessor error trap 8 08 - 3DCH 000FFFDCH INTE instruction 9 09 - 3D8H 000FFFD8H System-reserved 10 0A - 3D4H 000FFFD4H System-reserved 11 0B - 3D0H 000FFFD0H Step trace trap 12 0C - 3CCH 000FFFCCH NMI request (tool) 13 0D - 3C8H 000FFFC8H Undefined instruction exception 14 0E - 3C4H 000FFFC4H NMI request 15 0F 15(FH) fixed 3C0H 000FFFC0H External interrupt 0 16 10 ICR00 3BCH 000FFFBCH External interrupt 1 17 11 ICR01 3B8H 000FFFB8H External interrupt 2 18 12 ICR02 3B4H 000FFFB4H External interrupt 3 19 13 ICR03 3B0H 000FFFB0H External interrupt 4 20 14 ICR04 3ACH 000FFFACH External interrupt 5 21 15 ICR05 3A8H 000FFFA8H External interrupt 6 22 16 ICR06 3A4H 000FFFA4H External interrupt 7 23 17 ICR07 3A0H 000FFFA0H Reload timer 0 24 18 ICR08 39CH 000FFF9CH Reload timer 1 25 19 ICR09 398H 000FFF98H Reload timer 2 26 1A ICR10 394H 000FFF94H Maskable interrupt source *2 27 1B ICR11 390H 000FFF90H Maskable interrupt source *2 28 1C ICR12 38CH 000FFF8CH Maskable interrupt source *2 29 1D ICR13 388H 000FFF88H Maskable interrupt source *2 30 1E ICR14 384H 000FFF84H Maskable interrupt source *2 31 1F ICR15 380H 000FFF80H Maskable interrupt source *2 32 20 ICR16 37CH 000FFF7CH Maskable interrupt source *2 33 21 ICR17 378H 000FFF78H Maskable interrupt source *2 34 22 ICR18 374H 000FFF74H Maskable interrupt source *2 35 23 ICR19 370H 000FFF70H Maskable interrupt source *2 36 24 ICR20 36CH 000FFF6CH Maskable interrupt source *2 37 25 ICR21 368H 000FFF68H Maskable interrupt source *2 38 26 ICR22 364H 000FFF64H Maskable interrupt source *2 39 27 ICR23 360H 000FFF60H *2: The maskable interrupt source is defined for each model. For the vector table used in this model, see Appendix B-1. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 55 CHAPTER 2 CPU AND CONTROL BLOCK 2.7 EIT (Exception, Interruption, and Trap) MB91313A Series Table 2.7-3 Vector Table (3 / 4) Interrupt No. Interrupt Source Decimal Hexadecimal Interrupt Level Offset TBR Default Address Maskable interrupt source *2 40 28 ICR24 35CH 000FFF5CH Maskable interrupt source *2 41 29 ICR25 358H 000FFF58H Maskable interrupt source *2 42 2A ICR26 354H 000FFF54H Maskable interrupt source *2 43 2B ICR27 350H 000FFF50H Maskable interrupt source *2 44 2C ICR28 34CH 000FFF4CH Maskable interrupt source *2 45 2D ICR29 348H 000FFF48H Maskable interrupt source *2 46 2E ICR30 344H 000FFF44H Overflow of time-base timer 47 2F ICR31 340H 000FFF40H Maskable interrupt source *2 48 30 ICR32 33CH 000FFF3CH Maskable interrupt source *2 49 31 ICR33 338H 000FFF38H Maskable interrupt source *2 50 32 ICR34 334H 000FFF34H Maskable interrupt source *2 51 33 ICR35 330H 000FFF30H Maskable interrupt source *2 52 34 ICR36 32CH 000FFF2CH Maskable interrupt source *2 53 35 ICR37 328H 000FFF28H Maskable interrupt source *2 54 36 ICR38 324H 000FFF24H Maskable interrupt source *2 55 37 ICR39 320H 000FFF20H Maskable interrupt source *2 56 38 ICR40 31CH 000FFF1CH Maskable interrupt source *2 57 39 ICR41 318H 000FFF18H Maskable interrupt source *2 58 3A ICR42 314H 000FFF14H Maskable interrupt source *2 59 3B ICR43 310H 000FFF10H Maskable interrupt source *2 60 3C ICR44 30CH 000FFF0CH Maskable interrupt source *2 61 3D ICR45 308H 000FFF08H Maskable interrupt source *2 62 3E ICR46 304H 000FFF04H Delayed interrupt source bit 63 3F ICR47 300H 000FFF00H Reserved for system (used in REALOS) 64 40 - 2FCH 000FFEFCH Reserved for system (used in REALOS) 65 41 - 2F8H 000FFEF8H System-reserved 66 42 - 2F4H 000FFEF4H System-reserved 67 43 - 2F0H 000FFEF0H System-reserved 68 44 - 2ECH 000FFEECH System-reserved 69 45 - 2E8H 000FFEE8H System-reserved 70 46 - 2E4H 000FFEE4H System-reserved 71 47 - 2E0H 000FFEE0H System-reserved 72 48 - 2DCH 000FFEDCH System-reserved 73 49 - 2D8H 000FFED8H System-reserved 74 4A - 2D4H 000FFED4H *2: The maskable interrupt source is defined for each model. For the vector table used in this model, see Appendix B-1. 56 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 2 CPU AND CONTROL BLOCK 2.7 EIT (Exception, Interruption, and Trap) MB91313A Series Table 2.7-3 Vector Table (4 / 4) Interrupt No. Interrupt Source Decimal Hexadecimal Interrupt Level Offset TBR Default Address System-reserved 75 4B - 2D0H 000FFED0H System-reserved 76 4C - 2CCH 000FFECCH System-reserved 77 4D - 2C8H 000FFEC8H System-reserved 78 4E - 2C4H 000FFEC4H System-reserved 79 4F - 2C0H 000FFEC0H Used for INT instruction 80 to 255 50 to FF - 2BCH to 000H 000FFEBCH to 000FFC00H CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 57 CHAPTER 2 CPU AND CONTROL BLOCK 2.7 EIT (Exception, Interruption, and Trap) 2.7.5 MB91313A Series Multiple EIT Processing When more than one EIT source occur at the same time, the CPU selects and accepts only one source. After executing the EIT sequence, it detects another EIT source to continue the operation. When acceptable EIT sources can no longer be detected, the CPU executes the instruction of the handler for the last accepted EIT source. For this reason, the following 2 elements determine the handler execution sequence for EIT sources that occur at the same time. • Priority order for accepting EIT sources • Masking condition for other sources when one is accepted ■ Priority Levels for Accepting EIT Sources The priority level for accepting EIT sources is the level used to select the source for executing the EIT sequence in which PS and PC are saved, PC is updated (if necessary), and other sources are masked. The handler of the first accepted source is not necessarily executed first. Table 2.7-4 shows the priority levels for accepting EIT sources and the masking condition for other sources. Table 2.7-4 Priority Levels for Accepting EIT Sources and Masking Condition for Other Sources Acceptance priority Source Masking of Other Sources 1 Reset Discard other sources. 2 Undefined instruction exception Cancel 3 INTE instruction ILM=4 Discard other sources. 4 INT instruction I flag=0 5 Coprocessor absence trap Coprocessor error trap 6 User interrupt ILM= Level of accepted source 7 NMI (for user) ILM=15 (This product has no NMI.) 8 NMI (for emulator) ILM=4 9 Step trace trap ILM=4 – Table 2.7-5 shows the execution sequence of the handlers of EIT sources that occur at the same time, in conjunction with the masking process for the other sources after one is accepted. 58 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 2 CPU AND CONTROL BLOCK 2.7 EIT (Exception, Interruption, and Trap) MB91313A Series Table 2.7-5 Execution Sequence of EIT Handlers Handler execution order Source 1 Reset* 2 Undefined instruction exception 3 INTE instruction* 4 Step trace trap 5 NMI (for user. Note that this product has no NMI.) 6 INT instruction 7 User interrupt 8 Coprocessor absence trap, Coprocessor error trap *: Other sources are discarded. Figure 2.7-2 shows an example of the multiple EIT processing. Figure 2.7-2 Multiple EIT Processing Main routine Handler of NMI Handler of INT instruction Priority level (High) NMI occurs (1) Executed first (Low) INT instruction is executed (2) Executed next CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 59 CHAPTER 2 CPU AND CONTROL BLOCK 2.7 EIT (Exception, Interruption, and Trap) 2.7.6 MB91313A Series Operations of EIT This section explains various types of operations in the FR family. In the following explanation, "PC" for the origin of transfer refers to the address of the instruction that detected each EIT source. Depending on the instruction which has detected EIT, the "address of the next instruction" varies as follows. • LDI:32 → PC + 6 • LDI:20, COPOP, COPLD, COPST, COPSV → PC + 4 • Other instructions → PC + 2 ■ Operation of User Interrupt and NMI When a user interrupt or user NMI interrupt request is generated, the following sequence is used to determine whether or not to accept the request. [Determining whether or not to accept interrupt request] 1) The interrupt levels of requests generated at the same time are compared, and the request with the highest level (the smallest numeric value) is selected and retained. For the level used for the comparison, the value held in the corresponding ICR is used for a maskable interrupt and the predefined constant is used for the NMI. 2) If multiple requests holding the same level are generated, the request with the smallest interrupt number is selected. 3) When the interrupt level is the same as the level mask value or greater, the interrupt request is masked and is not accepted. When the interrupt level is lower than the level mask value, go to 4). 4) If the I flag is "0" when the selected interrupt request is intended for a maskable interrupt, the interrupt request is masked and is not accepted. If the I flag is "1", go to 5). If the selected interrupt request is intended for NMI, go to 5) regardless of the value of the I flag. 5) When the above conditions are met, the interrupt request is accepted at a boundary between instruction processing sessions. If a user interrupt/NMI request is accepted upon the detection of an EIT request, the CPU operates as described below, using the interrupt number corresponding to the accepted interrupt request. Note: What is contained in parentheses represents a register-specified address. [Operation] 1) SSP − 4 → SSP 2) PS → (SSP) 3) SSP − 4 → SSP 4) Address of next instruction → (SSP) 5) Interrupt level of accepted request → ILM 6) "0" → S flag 7) (TBR + Vector offset of accepted interrupt request) → PC 60 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 2 CPU AND CONTROL BLOCK 2.7 EIT (Exception, Interruption, and Trap) MB91313A Series A new EIT is detected before executing the first instruction of the handler upon the completion of the interrupt sequence. If an acceptable EIT has been generated at this point, the CPU moves to the EIT processing sequence. If the OR CCR, ST ILM, MOV Ri or PS instruction is executed to enable an interrupt while a user interrupt or NMI source is being generated, the above instruction may be executed twice, before and after the interrupt handler. Note however that this does not affect the operation as it is only the same value that is set twice. Do not perform the process before EIT branching in the EIT processing routine. ■ Operation of INT Instruction INT #u8: Branches to the interrupt handler for the vector indicated by u8. [Operation] 1) SSP − 4 → SSP 2) PS → (SSP) 3) SSP − 4 → SSP 4) PC + 2 → (SSP) 5) "0" → I flag 6) "0" → S flag 7) (TBR + 3FCH-4 × u8) → PC ■ Operation of INTE Instruction INTE: Branches to the interrupt handler for the vector #9. [Operation] 1) SSP − 4 → SSP 2) PS → (SSP) 3) SSP − 4 → SSP 4) PC + 2 → (SSP) 5) "00100" → ILM 6) "0" → S flag 7) (TBR + 3D8H) → PC Do not use the INTE instruction during the processing routine for the INTE instruction and step trace trap. Also, EIT is not generated by INTE during the step execution. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 61 CHAPTER 2 CPU AND CONTROL BLOCK 2.7 EIT (Exception, Interruption, and Trap) MB91313A Series ■ Operation of Step Trace Trap A trap occurs on the execution of each instruction and execution breaks, if the T flag in SCR of PS is set to enable the step trace function. [Conditions for Step Trace Trap Detection] 1) T flag =1 2) Not a delayed branch instruction 3) During the execution of processing routine other than for INTE instruction and step trace trap When the above conditions are met, execution breaks at a boundary of instruction operation. [Operation] 1) SSP − 4 → SSP 2) PS → (SSP) 3) SSP − 4 → SSP 4) Address of next instruction → (SSP) 5) "00100B" → ILM 6) "0" → S flag 7) (TBR + 3CCH) → PC When the T flag is set to enable step trace trap, user NMI and user interrupt are disabled. Moreover, EIT is not generated by the INTE instruction. In the FR family, a trap is generated from the instruction following the instruction that set the T flag. ■ Operation of Undefined Instruction Exception An undefined instruction exception occurs when an undefined instruction is detected during instruction decoding. [Conditions for detecting undefined instruction exception] 1) Undefined instruction detected during instruction decoding 2) Placed outside a delay slot (Not immediately after a delayed branch instruction) When the above conditions are met, an undefined instruction exception occurs and execution breaks. [Operation] 1) SSP − 4 → SSP 2) PS → (SSP) 3) SSP − 4 → SSP 4) PC → (SSP) 5) "0" → S flag 6) (TBR + 3C4H) → PC The address saved as the PC is the address of the instruction that has detected the undefined instruction exception. 62 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 2 CPU AND CONTROL BLOCK 2.7 EIT (Exception, Interruption, and Trap) MB91313A Series ■ Coprocessor Absence Trap A coprocessor absent trap occurs, if a coprocessor instruction is executed to use an unmounted coprocessor. [Operation] 1) SSP − 4 → SSP 2) PS → (SSP) 3) SSP − 4 → SSP 4) Address of next instruction → (SSP) 5) "0" → S flag 6) (TBR + 3E0H) → PC ■ Coprocessor Error Trap A coprocessor error trap occurs, if an error occurs while using a coprocessor and then a coprocessor instruction is executed to operate that coprocessor. [Operation] 1) SSP − 4 → SSP 2) PS → (SSP) 3) SSP − 4 → SSP 4) Address of next instruction → (SSP) 5) "0" → S flag 6) (TBR + 3DCH) → PC ■ Operation of RETI Instruction The RETI instruction is used to return from the EIT processing routine. [Operation] 1) (R15) → PC 2) R15 + 4 → R15 3) (R15) → PS 4) R15 + 4 → R15 The RETI instruction must be executed when the S flag is "0". CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 63 CHAPTER 2 CPU AND CONTROL BLOCK 2.8 Reset (Device Initialization) 2.8 MB91313A Series Reset (Device Initialization) This section explains the reset operation, or initialization, of this model. ■ Overview of Reset (Device Initialization) If a reset source occurs, the device stops all the programs and hardware operations, and initializes the state. This state is called the reset state. When a reset source no longer exists, the device starts programs and hardware operations from their initial state. The series of operations from the reset state to the start of operations is called the reset sequence. 64 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 2 CPU AND CONTROL BLOCK 2.8 Reset (Device Initialization) MB91313A Series 2.8.1 Reset Level The reset operations of the FR family are classified into two levels, each of which has different reset sources and initialization operations. This section explains these reset levels. ■ Setting Initialization Reset (INIT) The highest-level reset, which initializes all settings, is called a settings initialization reset (INIT). The settings initialization reset (INIT) mainly initializes the following items: [Items initialized in a settings initialization reset (INIT)] •Device operation mode (bus mode and external bus width settings) •All internal clock settings (clock source selection, PLL control, and division ratio setting) •All settings on external bus CS0 area •Any other settings for pin condition •All the items initialized by operation initialization reset (RST) For more information, see the description of each of these functions. After power-on, be sure to apply the settings initialization reset (INIT) at the INITX pin. ■ Operation Initialization Reset (RST) A normal-level reset that initializes the operation of a program is called an operation initialization reset (RST). During a settings initialization reset (INIT), an operation initialization reset (RST) also occurs at the same time. The operation initialization reset (RST) mainly initializes the following items: [Items initialized by an operation initialization reset (RST)] •Program operation •CPU and internal buses •Register settings of peripheral circuits •I/O port settings •All settings on external bus CS0 area For more information, see the description of each of these functions. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 65 CHAPTER 2 CPU AND CONTROL BLOCK 2.8 Reset (Device Initialization) 2.8.2 MB91313A Series Reset Sources This section explains the reset sources and the reset levels in this model. To determine reset sources that have occurred in the past, read the RSRR (reset source register). For more information about registers and flags described in this section, see Section "2.9.5 Block Diagram of Clock Generation Control Block" and "2.9.6 Registers of Clock Generation Control Block". ■ INITX Pin Input (Settings Initialization Reset Pin) The INITX pin, which is an external pin, is used as the settings initialization reset pin. A settings initialization reset (INIT) request is generated while the Low level is being input to this pin. A settings initialization reset (INIT) request is cleared by inputting the High level to this pin. If a settings initialization reset (INIT) is generated in response to a request from this pin, INIT (bit15) of RSRR (reset source register) is set. Because a settings initialization reset (INIT) in response to a request from this pin has the highest interrupt level among all reset sources, it has precedence over any other input, operation, or state. After power-on, be sure to apply the settings initialization reset (INIT) at the INITX pin. Immediately after turning the power on, in addition, hold the "L" level input to the INITX pin during the stabilization wait time required for the oscillation circuit to reserve the regulator stabilization wait time. (INIT at the INITX pin initializes the oscillation stabilization wait time to the minimum value.) • Reset source : "L" level input to external INITX pin • Source of clearing : "H" level input to external INITX pin • Generation level : Setting initialization reset (INIT) • Corresponding flag: bit15:INIT ■ STCR:SRST Bit Writing (Software Reset) If "0" is written to SRST (bit4) of STCR (standby control register), a software reset request occurs. A software reset request is an operation initialization reset (RST) request. When the request is accepted and a operation initialization reset (RST) is generated, the software reset request is cleared. If an operation initialization reset (RST) is generated due to a software reset request, the SRST (bit11) in RSRR (reset source register) is set. An operation initialization reset (RST) is generated due to a software reset request only after all bus access has stopped and if SYNCR (bit9) of TBCR (time base counter control register) has been set (synchronization reset mode). Thus, depending on the bus usage status, a long time is required before an operation initialization reset (RST) occurs. Please refer to the limitations of the bit9:SYNCR bit of TBCR (time-base counter control register) for the use of reset of the software of the synchronous mode. 66 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 2 CPU AND CONTROL BLOCK 2.8 Reset (Device Initialization) MB91313A Series Note: For using software reset on the synchronous mode, see the limitations of the bit9:SYNCR bit of TBCR (time-base counter control register). • Reset source: Writing "0" to SRST (bit4) of STCR (standby control register) • Source of clearing: Generation of an operation initialization reset (RST) • Generation level: Operation initialization reset (RST) • Corresponding flag: bit11:SRST ■ Watchdog Reset Writing to the RSRR (watchdog timer control register) starts the watchdog timer. Unless "A5H" / "5AH" is written to the WPR (watchdog reset postpone register) within the cycle specified in WT1 (bit9) and WT0 (bit8) in RSRR, a watchdog reset request occurs. A watchdog reset request is a settings initialization reset (INIT) request. If, after the request is accepted, a settings initialization reset (INIT) occurs or an operation initialization reset (RST) occurs, the watchdog reset request is cleared. If a settings initialization reset (INIT) is generated due to a watchdog reset request, WDOG (bit13) in RSRR (reset source register) is set. Note that, if a settings initialization reset (INIT) is generated due to a watchdog reset request, the oscillation stabilization wait time is not initialized. • Reset source: Setting cycle of the watchdog timer elapses • Source of clearing: Generation of a settings initialization reset (INIT) or an operation initialization reset (RST) • Generation level: Setting initialization reset (INIT) • Corresponding flag: bit13:WDOG CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 67 CHAPTER 2 CPU AND CONTROL BLOCK 2.8 Reset (Device Initialization) 2.8.3 MB91313A Series Reset Sequence When a reset source no longer exists, the device starts to execute the reset sequence. A reset sequence has different operations depending on the reset level. This section explains the operations of the reset sequence for different reset levels. ■ Setting Initialization Reset (INIT) Clear Sequence If a settings initialization reset (INIT) request is cleared, the following operations are performed one step at a time for the device. 1) Clear the settings initialization reset (INIT) and enter the oscillation stabilization wait state. 2) For the oscillation stabilization wait time (set with OS1 (bit3), OS0 (bit2) in STCR), maintain the operation initialization reset (RST) state and stop the internal clock. 3) In the operation initialization reset (RST) state, start internal clock operation. 4) Clear the operation initialization reset (RST) and enter the normal operating state. 5) Read the mode vector from address 000FFFF8H. 6) Write the mode vector to the MODR (mode register) at address 000007FDH. 7) Read the reset vector from address 000FFFFCH. 8) Write the reset vector to the PC (program counter). 9) The program starts execution from the address loaded in the PC (program counter). ■ Operation Initialization Reset (RST) Clear Sequence If an operation initialization reset (RST) request is cleared, the following operations are performed one step at a time for the device. 1) Clear the operation initialization reset (RST) and enter the normal operating state. 2) Read the mode vector from address 000FFFF8H. 3) Write the mode vector to the MODR (mode register) at address 000007FDH. 4) Read the reset vector from address 000FFFFCH. 5) Write the reset vector to the PC (program counter). 6) The program starts execution from the address loaded in the PC (program counter). 68 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 2 CPU AND CONTROL BLOCK 2.8 Reset (Device Initialization) MB91313A Series 2.8.4 Oscillation Stabilization Wait Time If a device returns from the state in which the original oscillation was or may have been stopped, the device automatically enters the oscillation stabilization wait state. This function prevents the use of oscillator output after starting before oscillation has stabilized. For the oscillation stabilization wait time, neither an internal nor an external clock is supplied; only the built-in time base counter runs until the stabilization wait time set in the STCR (standby control register) has elapsed. This section explains the oscillation stabilization wait operation. ■ Sources of an Oscillation Stabilization Wait The following lists sources of an oscillation stabilization wait. ● Clearing of a settings initialization reset (INIT) The device enters the oscillation stabilization wait state if a settings initialization reset (INIT) is cleared for a variety of reasons. When the oscillation stabilization wait time has elapsed, the device enters the operation initialization reset (RST) state. ● Returning from stop mode The device enters the oscillation stabilization wait state immediately after stop mode is cleared. However, if it is cleared by a settings initialization reset (INIT) request, the device enters the settings initialization reset (INIT) state. Then, after the settings initialization reset (INIT) is cleared, the device enters the oscillation stabilization wait state. When the oscillation stabilization wait time has elapsed, the device enters the state corresponding to the source that cleared stop mode. • Return due to input of a valid external interrupt request (including NMI) and generation of a watch timer/a main oscillation stabilization wait time interrupt: The device enters the normal operating state. • Return due to a settings initialization reset (INIT) request: The device enters the operation initialization reset (RST) state. ● Returning from an abnormal state when PLL is selected If, while the device is operating with PLL as the source clock, an abnormal condition* occurs in PLL control, the device automatically enters an oscillation stabilization wait state to assure the PLL lock time. When the oscillation stabilization wait time has elapsed, the device enters the normal operating state. *: The multiplication rate is changed while PLL is working, or an incorrect bit such as a bit equivalent to PLL operation enable bit is generated. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 69 CHAPTER 2 CPU AND CONTROL BLOCK 2.8 Reset (Device Initialization) MB91313A Series ● Generating a watchdog reset when the main oscillation stops in sub clock If, while the device is operating with sub clock as the source clock, a watchdog reset is generated when the main oscillation is stopped by OSCDS1 (bit8) of OSCCR (oscillation control register), the device automatically enters an oscillation stabilization wait state immediately after a reset (INIT) is cleared. When the oscillation stabilization wait time has elapsed, the device enters the operation initialization reset (RST) state. Note that an oscillation stabilization wait is not generated when the OSCDS1 bit of the sub clock is "0" and the device is in the main clock mode. ■ Selecting an Oscillation Stabilization Wait Time The oscillation stabilization wait time is measured with the built-in time base counter. If a source for an oscillation stabilization wait occurs and the device enters the oscillation stabilization wait state, the built-in time base counter is initialized and then it starts to measure the oscillation stabilization wait time. Using the OS1 (bit3) and OS0 (bit2) of STCR (standby control register), select and set one of the four types of oscillation stabilization wait time. Once selected, a setting is initialized only if a settings initialization reset (INIT) is generated due to the external INITX pin. The oscillation stabilization wait time that has been set before a reset is maintained if a settings initialization reset (INIT) is generated or an operation initialization reset (RST) is generated due to a watchdog reset. 70 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 2 CPU AND CONTROL BLOCK 2.8 Reset (Device Initialization) MB91313A Series 2.8.5 Reset Operation Modes Two modes for an operation initialization reset (RST) are provided: normal (asynchronous) reset mode and synchronous reset mode. The operation initialization reset mode is selected with SYNCR (bit9) of TBCR (time base counter control register). This setting is initialized only by a settings initialization reset (INIT). A settings initialization reset (INIT) always results in an asynchronous reset. ■ Normal Reset Operation Normal reset operation refers to entering the operation initialization reset (RST) state immediately after an operation initialization reset (RST) request occurs. If a reset (RST) request is accepted, the device immediately enters the reset (RST) state regardless of the operating state of the internal bus. The result of bus access performed at the time of transition to each status is not guaranteed. However, these requests can certainly be accepted. If the SYNCR (bit9) of TBCR (time base counter control register) is set to "0", normal reset mode is selected. The initial value after a settings initialization reset (INIT) is normal reset mode. ■ Synchronous Reset Operation Synchronous reset operation refers to entering the operation initialization reset (RST) state after all the bus accesses have stopped when an operation initialization reset (RST) request is generated. If a reset (RST) request is accepted, the device does not enter the reset (RST) state while internal bus access is in progress. If the above request is accepted, a sleep request is issued to the internal buses. If all the buses stop and enter the sleep state, the device enters the operation initialization reset (RST) state. The result of all bus accesses is guaranteed because all the bus accesses are stopped at the time of transition to each state. If bus access does not stop for some reason, no requests can be accepted while the bus access is in progress. (Even in this case, the settings initialization reset (INIT) is immediately valid.) Bus access may not stop in the following cases: • A RDY (ready request) continues to be input to the external extended bus interface and bus wait is valid. (In the following cases, the device eventually enters another state but only after a long time.) CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 71 CHAPTER 2 CPU AND CONTROL BLOCK 2.8 Reset (Device Initialization) MB91313A Series References: • Please refer to the limitations of the bit9:SYNCR bit of TBCR (time-base counter control register) for the use of reset of the software of the synchronous mode. • The DMA controller, which stops transfer when a request is accepted, does not delay transition to another state. • If the SYNCR (bit9) of TBCR (time base counter control register) is set to "1", synchronous reset mode is selected. • For using software reset on the synchronous mode, see the limitations of the bit9:SYNCR bit of TBCR (time-base timer counter control register). The initial value returns to normal reset mode after a settings initialization reset (INIT). 72 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 2 CPU AND CONTROL BLOCK 2.9 Clock Generation Control MB91313A Series 2.9 Clock Generation Control This section explains the clock generation control. ■ Generating Internal Operating Clock The internal operating clock is generated as follows: • Selecting the source clock: The clock supply source is selected. • Generating the base clock: The base clock is generated by dividing the source clock by 2 or using PLL oscillation. • Generating each internal clock: The base clock is divided to generate 4 types of operating clocks to be supplied to each block. The following section explains how to generate and control each clock. For detail of the registers and flags in the following explanation, See Section "2.9.5 Block Diagram of Clock Generation Control Block" and "2.9.6 Registers of Clock Generation Control Block". ■ Selecting the Source Clock This section explains how the source clock is selected. The source clock is the source oscillation generated in the built-in oscillation circuit by connecting an oscillator to the X0/X1 and X0A/X1A external oscillator pin inputs. All clock sources including the external bus clock are supplied from within this model. The external oscillator pins and built-in oscillation circuit can use 2 types of clocks (main clock and sub clock) and also switch between them during operation at any time. • Main clock : Generated from the X0 and X1 pin inputs and intended for use as the high-speed clock. • Sub clock : Generated from the X0A and X1A pin inputs and intended for use as the low-speed clock. The main and sub clocks are multiplied by using the independently controllable built-in main PLL. The internal base clock can be selectively generated from the following source clocks. • Main clock divided by 2 • Main clock multiplied using the main PLL • Sub clock as it is φ is the base clock that is generated from the source clock divided by two or by using PLL oscillation. Therefore, the system base clock is a clock generated in the above-mentioned internal base clock generation. Selection of the source clock is controlled by the clock source control register (CLKR) setting. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 73 CHAPTER 2 CPU AND CONTROL BLOCK 2.9 Clock Generation Control 2.9.1 MB91313A Series PLL Control The PLL oscillation circuit for the main clock can be controlled by enabling or disabling its operation (oscillation) and setting the multiplication rate. Each control operation is performed by setting the clock source control register (CLKR). This section explains the control operations. ■ Enabling PLL Operation PLL1EN (bit10) in CLKR (clock source control register) is used to enable/disable the oscillation operation of the main PLL. PLL2EN (bit11) in CLKR (clock source control register) is used to enable/disable the oscillation operation of the sub clock. Both the PLL1EN and PLL2EN bits are initialized to "0" after a setting initialization reset (INIT) and the PLL oscillation operation is stopped. While it is stopped, the PLL output cannot be selected as the source clock. Once program operation has started, set the multiplication rate for the PLL to be used as the clock source and enable its operation, and then wait for the PLL lock wait time to elapse before switching the source clock. In this case, it is recommended to use the time-base timer interrupt for the PLL lock wait time. The PLL cannot be halted while the PLL output is selected as the source clock. (Writing to the register is ignored.) When you wish to stop the PLL in such case as changing to stop mode, select the main clock divided by 2 as the source clock before halting the PLL. Note that if OSCD1 (bit0) and OSCD2 (bit1) in STCR (standby control register) are set so that oscillation is stopped during stop mode, the corresponding PLL is automatically stopped when moving to stop mode. Therefore, it is not necessary to set the bits again to stop the operation. Afterwards, when returning from the stop mode, PLL automatically begins the oscillation operation. The PLL does not stop automatically if the oscillation is set to continue during stop mode. In this case, stop the operation before changing to stop mode if necessary. 74 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 2 CPU AND CONTROL BLOCK 2.9 Clock Generation Control MB91313A Series ■ PLL Multiplication Rate The multiplication rate for the main PLL is set by PLL1S2, PLL1S1 and PLL1S0 (bit14 to bit12) in CLKR (clock source control register). All the bits are initialized to "0" after a setting initialization reset (INIT). [Setting PLL multiplication rate] When changing the PLL multiplication rate from its initial value, change it before or at the same time as enabling the PLL operation after the program operation starts. Then wait for the PLL lock wait time to elapse before switching the source clock. In this case, it is recommended to use the time-base timer interrupt for the PLL lock wait time. If you wish to change the PLL multiplication rate during operation, first change the source clock to any clock other than the corresponding PLL. Then wait for the PLL lock wait time to elapse before switching the source clock, as described above. The PLL multiplication rate setting can be changed while the PLL is in use. In this case, however, it automatically enters the oscillation stabilization wait state after the multiplication rate setting is rewritten, and the program operation is stopped until the set oscillation stabilization wait time elapses. The program operation does not stop when the clock source is switched to a clock other than the PLL. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 75 CHAPTER 2 CPU AND CONTROL BLOCK 2.9 Clock Generation Control 2.9.2 MB91313A Series Oscillation Stabilization Wait and PLL Lock Wait Time If the operation of the clock selected as the source clock is not stable, an oscillation stabilization wait time is required. (See "2.8.4 Oscillation Stabilization Wait Time".) After the PLL starts operating, a wait time is required until the PLL locks in order to allow the output to stabilize at the specified frequency. This section explains the wait time used in various situations. ■ Wait Time after Power-up After power-up, it is necessary to input "L" level to the INITX pin input (setting initialization reset pin). In this state, as none of the PLL's are allowed to operate, it is not required to consider a lock wait time. ■ Wait Time after Setting Initialization When a setting initialization reset (INIT) is released, the device goes to the oscillation stabilization wait state. The set oscillation stabilization wait time is internally generated. In this state, as none of the PLL's are allowed to operate, it is not required to consider a lock wait time. ■ Wait Time after Enabling PLL Operation If you enable the PLL in the stop state to operate after the program operation starts, the output of that PLL cannot be used until the lock wait time elapses. If the corresponding PLL is not selected as the source clock, the program can be executed even during the lock wait time. It is recommended to use the time-base timer interrupt for the PLL lock wait time. ■ Wait Time after Changing PLL Multiplication Rate Even if you change the multiplication rate setting of the currently operating PLL after the program operation starts, the output of that PLL must not be used until the lock wait time elapses. If the corresponding PLL is not selected as the source clock, the program can be executed even during the lock wait time. The time-base timer interrupt can be used for the PLL lock wait time. 76 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 2 CPU AND CONTROL BLOCK 2.9 Clock Generation Control MB91313A Series ■ Wait Time after Returning from Stop Mode After the program operation starts, the oscillation stabilization wait time set by the program is generated internally after the device moves to stop mode and then returns from that mode. If the device is set to halt the oscillation circuit for the clock selected as the source clock during stop mode, the longer of the oscillation stabilization wait time for the oscillation circuit and the lock wait time for the PLL in use is required as the wait time. Therefore, set the oscillation stabilization wait time before changing to stop mode. If the device is set not to halt the oscillation circuit for the clock selected as the source clock during stop mode, the PLL is not halted automatically. Accordingly, no oscillation stabilization wait time is required unless you halt the PLL. It is recommended to set the oscillation stabilization wait time to the minimum value before changing to stop mode. ■ Wait Time after Switching from the Sub Clock to the Main Clock When using the PLL after switching from the sub clock to the main clock, the output of that PLL must not be used regardless of the value of PLL1EN (bit2) in CLKR (clock source register), until the lock wait time elapses. If the corresponding PLL is not selected as the source clock, the program can be executed even during the lock wait time. It is recommended to use the time-base timer interrupt for the PLL lock wait time. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 77 CHAPTER 2 CPU AND CONTROL BLOCK 2.9 Clock Generation Control 2.9.3 MB91313A Series Clock Distribution The operating clock for each function is generated based on the base clock generated from the source clock. There are 3 different internal operating clocks in total, and each clock can set its own division ratio, independently from the other clocks. ■ CPU Clock (CLKB) This clock is used for the CPU, internal memory and internal bus. The circuits which use this clock are listed below: • CPU • Built-in RAM and built-in ROM • Bit Search Module • I-bus, D-bus, X-bus, F-bus • DMA controller • DSU The maximum operable frequency is 33 MHz. Therefore, do not set any frequency combination of the multiplication rate and division ratio that will exceed this frequency. ■ Peripheral Clock (CLKP) This clock is used for peripheral circuits and peripheral bus. The circuits which use this clock are listed below: • Peripheral bus • Clock control block (bus interface component only) • Interrupt controller • Peripheral I/O port • I/O port bus • External interrupt input • UART • 16-bit timer • A/D converter • Free-run timer • Reload timer • Up/down counter • Input capture • Output compare • I2C interface • PPG 78 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 2 CPU AND CONTROL BLOCK 2.9 Clock Generation Control MB91313A Series The maximum operable frequency is 33 MHz. Therefore, do not set any frequency combination of the multiplication rate and division ratio that will exceed this frequency. ■ External Bus Clock (CLKT) This clock is used for external extended bus interfaces. The circuits which use this clock are listed below: • External extended bus interface • External CLK output The maximum operable frequency is 16.5 MHz. Therefore, do not set any frequency combination of the multiplication rate and division ratio that will exceed this frequency. Note: The processing performance of CPU is influenced from the setting of flash memory wait register (FLWC). Adjust the setting of this register to the best value and use it. See Section "18.2.2 Wait Register (FLWC)". CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 79 CHAPTER 2 CPU AND CONTROL BLOCK 2.9 Clock Generation Control 2.9.4 MB91313A Series Clock Division Each internal operating clock can independently set its own division ratio from the base clock from the other clocks. This function allows the most suitable operating frequency to be provided to each circuit. ■ Setting Division Ratio The division ratio is set by DIVR0 (basic clock division setting register 0) and DIVR1 (basic clock division setting register 1). Each register contains 4 setting bits which correspond to each of the operating clocks, and the value "register setting + 1" is used as the division ratio for the base clock of that particular clock. Even when the division ratio is set to an odd number, Duty is always 50%. If the setting is modified, the modified division ratio becomes valid from the rising edge of the next clock signal. ■ Initializing the Division Ratio Setting Even when an operation initialization reset (RST) occurs, the division ratio setting is not initialized and the setting before the occurrence of the reset is maintained. The setting is initialized only when a setting initialization reset (INIT) occurs. In the initial state, the division ratio is "1" for all except the peripheral clock (CLKP). Therefore, make sure to set the division ratio before changing the source clock to a faster one. Note: The maximum operable frequency is defined for each clock. Operation is not guaranteed if a frequency, in combination with the source clock selection, PLL multiplication rate setting and division ratio setting, is set to exceed the maximum frequency. In particular, take care to follow the correct order in conjunction with modifying the source clock selection setting. 80 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 2 CPU AND CONTROL BLOCK 2.9 Clock Generation Control MB91313A Series 2.9.5 Block Diagram of Clock Generation Control Block Figure 2.9-1 shows a block diagram of the clock generation control block. For details of the registers shown in the diagram, see "2.9.6 Registers of Clock Generation Control Block". ■ Block Diagram of Clock Generation Control Block Figure 2.9-1 Block Diagram of Clock Generation Control Block [Clock generation unit] X1 X0A X1A (CLKB) Peripheral clock (CLKP) External bus clock (CLKT ) CLKR register Oscillation circuit PLL Oscillation circuit 1/2 Real time clock Selector X0 External bus clock division CPU clock Stop control Main clock oscillation stabilization wait timer (if sub-clock is selected) Peripheral clock division b u s Selector CPU clock division R Selector Selector DIVR0, 1 registers Base clock ( φ) [Stop/Sleep control unit] Watch timer Stop state Internal interrupt STGR register State transition control circuit Internal reset Sleep state Reset generation FF Reset generation FF Internal reset (RST) Internal reset (INIT) [Reset source circuit] INITX pin RSRR register [Watchdog control unit] WPR register Watchdog FF CTBR register Time base counter Counter clock Selector TBCR register Overflow detection FF Interrupt enable CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED Time base timer interrupt request 81 CHAPTER 2 CPU AND CONTROL BLOCK 2.9 Clock Generation Control 2.9.6 MB91313A Series Registers of Clock Generation Control Block This section explains the registers in the clock generation control block. ■ RSRR: Reset Source Register/Watchdog Timer Control Register The register configuration of the reset source register and watchdog timer control register is shown below. RSRR bit Address: 000480H Initial value (INITX pin) Initial value (INIT) Initial value (RST) *: R/W: R: X: 15 14 13 12 11 10 9 8 INIT (R) 1 * X Reserved WDOG (R) 0 * X Reserved SRST Reserved (R) 0 X X (R) 0 X * (R) 0 * X WT1 (R/W) 0 0 0 WT0 (R/W) 0 0 0 (R) 0 * X Initialized by a source. Readable/writable Read only Undefined value RSRR retains the source of the most recently generated reset, sets the watchdog timer cycle and controls its activation. When this register is read, the retained reset source is cleared after read. If more than one reset occur before the register is read, reset source flags are accumulated, and as a result, the multiple flags are set. Writing to this register activates the watchdog timer. After that, the watchdog timer continues to operate until a reset (RST) occurs. [bit15] INIT: External reset generation flag This bit indicates whether the INITX pin input has generated a reset (INIT). Value Description 0 INITX pin input has not generated INIT. 1 INITX pin input has generated INIT. •INIT is cleared to "0" immediately after reading. •It is readable. Writing has no effect on the bit value. [bit14] Reserved: Reserved bit This is a reserved bit. 82 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 2 CPU AND CONTROL BLOCK 2.9 Clock Generation Control MB91313A Series [bit13] WDOG: Watchdog reset generation flag It indicates whether the watchdog timer has generated a reset (INIT). Value Description 0 Watchdog timer has not generated INIT. 1 Watchdog timer has generated INIT. •This bit is cleared to "0" at a reset (INIT) by the INITX pin input upon power-up or immediately after reading. •It is readable. Writing has no effect on the bit value. [bit12] Reserved: Reserved bit This is a reserved bit. [bit11] SRST: Software reset generation flag This bit indicates whether a reset (RST) has been generated by writing to the SRST bit in the STCR register (software reset). Value Description 0 Software reset has not generated RST. 1 Software reset has generated RST. •This bit is cleared to "0" at a reset (INIT) by the INITX pin input upon power-up or immediately after reading. •It is readable. Writing has no effect on the bit value. Please refer to the limitations of bit9:SYNCR bit of TBCR (time-base counter control register) when using software reset of the synchronous mode. [bit10] Reserved: Reserved bit This is a reserved bit. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 83 CHAPTER 2 CPU AND CONTROL BLOCK 2.9 Clock Generation Control MB91313A Series [bit9, bit8] WT1, WT0: Watchdog timer interval time selection bits These bits are used to select the cycle for the watchdog timer. Based on the value written to the bits, the watchdog timer cycle is selected from the 4 options shown in the following table. Minimum interval for writing to WPR, required to prevent a watchdog reset from being generated Time from when the last 5AH is written to WPR to when a watchdog reset is generated 0 φ × 220 (Initial value) φ × 220 to φ × 221 0 1 φ × 222 φ × 222 to φ × 223 1 0 φ × 224 φ × 224 to φ × 225 1 1 φ × 226 φ × 226 to φ × 227 WT1 WT0 0 (φ: Cycle of system base clock) •These bits are initialized to "00B" by a reset (RST). •They are readable. Writing is allowed only once after a reset (RST); succeeding write operations are not valid. 84 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 2 CPU AND CONTROL BLOCK 2.9 Clock Generation Control MB91313A Series ■ STCR: Standby Control Register The configuration of the standby control register is shown below. STCR bit 7 6 Address: 000481H STOP SLEEP 5 4 3 2 HIZ SRST OS1 OS0 1 0 OSCD2 OSCD1 (R/W) (R/W) (R/W) (R/W) (R/W) (R/W) (R/W) (R/W) Initial value (INITX pin) 0 0 1 1 0 0 1 1 Initial value (INIT) 0 0 1 1 X X 1 1 Initial value (RST) 0 0 X 1 X X X X R/W: Readable/writable STCR controls the operating mode of the device. STCR is used to place the device in one of the 2 standby modes (stop/sleep) and stop the pin operation and oscillation during stop mode as well as to set the oscillation stabilization wait time and issue a software reset. Note: To place the device in a standby mode, use the synchronous standby mode, set in SYNCS (bit8) of TBCR (time-base counter control register) and be sure to follow the sequence shown below. (LDI#value_of_standby,R0) ; "value_of_standby" is the data written to STCR. (LDI#_STCR,R12) ; "_STCR" is the address of STCR (481H). STB R0,@R12 ; Writing to the standby control register (STCR) LDUB @R12,R0 ; Reading from STCR for synchronous standby LDUB @R12,R0 ; Another dummy read from STCR NOP ; NOP (for timing adjustment) × 5 NOP NOP NOP NOP [bit7] STOP: STOP mode bit This bit directs the device to enter stop mode. If "1" is written to SLEEP (bit6) and this bit at the same time, the device enters stop mode, as the STOP mode bit has higher priority. Value Description 0 Device does not enter stop mode [Initial value]. 1 Device enters stop mode. •This bit is initialized to "0" by a reset (RST) or an event that recovers the device from stop mode. •This bit is readable and writable. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 85 CHAPTER 2 CPU AND CONTROL BLOCK 2.9 Clock Generation Control MB91313A Series [bit6] SLEEP: SLEEP mode bit This bit directs the device to enter sleep mode. If "1" is written to STOP (bit7) and this bit at the same time, the device enters stop mode, as the STOP bit (bit7) has higher priority. Value Description 0 Device does not enter sleep mode [Initial value]. 1 Device enters sleep mode. •This bit is initialized to "0" by a reset (RST) or an event that recovers the device from sleep mode. •This bit is readable and writable. [bit5] HIZ: Hi-Z mode bit This bit controls the pin state in stop mode. Value Description 0 Retains the pin state before transition to stop mode 1 Sets the pin output to high impedance during stop mode [Initial value]. •This bit is initialized to "1" by a reset (INIT). •This bit is readable and writable. [bit4] SRST: Software reset bit SRST directs the issue of a software reset (RST). Value Description 0 Issues a software reset. 1 Does not issue a software reset [Initial value]. •This bit is initialized to "1" by a reset (RST). •This bit is readable and writable. Reading always returns "1". •For using software reset on the synchronous mode, see the limitations of the bit9:SYNCR bit of TBCR (time-base counter control register). 86 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 2 CPU AND CONTROL BLOCK 2.9 Clock Generation Control MB91313A Series [bit3, bit2] OS1, OS0: Oscillation stabilization wait time selection bits These bits set the oscillation stabilization wait time after a reset (INIT) or after the device returns from stop mode. Based on the value written to the bits, the oscillation stabilization wait time is selected from the 4 options shown in the following table. OS1 OS0 Oscillation Stabilization Wait Time Source Oscillation: 16.5 MHz Sub Clock Oscillation: 32 kHz 0 0 φ × 21 [Initial value] 0.242 μs 125 μs 0 1 φ × 211 0.248 ms 128 ms 1 0 φ × 216 7.94 ms 4s 1 1 φ × 222 508 ms 262 s φ represents the cycle of the system base clock. Here, it is twice the cycle of the input source oscillation. •These bits are initialized to "00B" by a reset (INIT) from the INITX pin input. •These bits are readable and writable. [bit1] OSCD2: Sub clock oscillation stop bit OSCD2 stops the sub clock oscillation in stop mode. Value Description 0 Does not stop sub clock oscillation during stop mode. 1 Stops sub clock oscillation during stop mode [Initial value]. •This bit is initialized to "1" by a reset (INIT). •This bit is readable and writable. [bit0] OSCD1: Main clock oscillation stop bit OSCD1 stops the oscillation of the main clock in stop mode. Value Description 0 Does not stop the main clock oscillation during stop mode. 1 Stops main clock oscillation during stop mode [Initial value]. •This bit is initialized to "1" by a reset (INIT). •This bit is readable and writable. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 87 CHAPTER 2 CPU AND CONTROL BLOCK 2.9 Clock Generation Control MB91313A Series ■ TBCR: Time-Base Counter Control Register The configuration of the time-base counter control register is shown below. TBCR bit 15 14 13 12 11 10 TBIE R/W 0 TBC2 R/W X TBC1 R/W X TBC0 R/W X Reserved Initial value (INIT) TBIF R/W 0 Initial value (RST) 0 0 X X X X Address: 000482H R/W X 9 8 SYNCR SYNCS R/W R/W 0 0 X X R/W: Readable/writable TBCR controls interrupts such as time-base timer interrupts. TBCR is used to enable time-base timer interrupts, select the interrupt interval time, and set option function of reset operation. [bit15] TBIF: Time-base timer interrupt flag TBIF is a time-base timer interrupt flag. It indicates that the time-base counter has exceeded the specified interval time (set by bit13 to bit11: TBC2 to TBC0). A time-base timer interrupt request is generated, if this bit is set to "1" while TBIE (bit14) is enabled to generate an interrupt (TBIE=1). Clearing source Writing "0" through instruction Setting source: Expiration of the set interval time (Detecting the falling edge of the output of the time-base counter) •This bit is initialized to "0" by a reset (RST). •It is readable and writable. For write operation, however, only "0" can be written. Writing "1" does not change the bit value. •Reading by read-modify-write (RMW) instruction always returns "1". [bit14] TBIE: Time-base timer interrupt enable bit TBIE enables the output of a time-base timer interrupt request. TBIE controls the output of an interrupt request due to the expiration of the interval time of the timebase counter. If TBIF (bit15) is set to "1" when this bit is "1", a time-base timer interrupt request is generated. Value Description 0 Disables the output of time-base timer interrupt request. [Initial value] 1 Enables the output of time-base timer interrupt request. •This bit is initialized to "0" by a reset (RST). •This bit is readable and writable. 88 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 2 CPU AND CONTROL BLOCK 2.9 Clock Generation Control MB91313A Series [bit13 to bit11] TBC2, TBC1, TBC0: Time-base timer counter selection bits These bits set the interval time for the time-base counter used in the time-base timer. Based on the value written to these bits, the interval time is selected from the 8 options shown on the following table. TBC2 TBC1 TBC0 Timer interval time When source oscillation = 16.5 MHz, and PLL = multiply-by-2 Sub clock = 32 kHz 0 0 0 φ × 211 62.1 μs 61.4 ms 0 0 1 φ × 212 124.1 μs 123 ms 0 1 0 φ × 213 248.2 μs 246 ms 0 1 1 φ × 222 127 ms 126 s 1 0 0 φ × 223 254 ms 256 s 1 0 1 φ × 224 508 ms 512 s 1 1 0 φ × 225 1017 ms 1024 s 1 1 1 φ × 226 2034 ms 2048 s φ: Cycle of system base clock •The initial value is undefined. Always set a value before enabling an interrupt. •These bits are readable and writable. [bit10] Reserved: Reserved bit This is a reserved bit. The read value is undefined. Writing has no effect on operation. [bit9] SYNCR: Synchronous reset enable bit SYNCR enables the synchronous reset operation. It is used to select which should be performed if an operation initialization reset (RST) request occurs: Normal reset operation in which a reset (RST) immediately performed; or synchronous reset in which an operation initialization reset (RST) is performed after all the bus accesses stop. Value Description 0 Normal reset operation [Initial value] 1 Synchronous reset operation •This bit is initialized to "0" by a reset (INIT). •This bit is readable and writable. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 89 CHAPTER 2 CPU AND CONTROL BLOCK 2.9 Clock Generation Control MB91313A Series Note: Meet the following requirement before setting "0" to the SRST bit of STCR (standby control register) at using software reset of the synchronous mode. • Set the interrupt enable flag (I-Flag) to interrupt disabled (I-Flag=0). • Do not used NMI. [bit8] SYNCS: Synchronous standby enable bit SYNCS enables the synchronous standby operation. It is used to select one of the following operations, which is should be performed if an standby request (either sleep or stop mode request) occurs: Normal standby operation, in which the device enters standby mode only by writing to the control bit in the STCR register; or synchronous standby operation in which the device enters standby mode by reading the STCR register after writing to the control bit in the STCR register. Value Description 0 Normal standby operation [Initial value] 1 Synchronous standby operation •This bit is initialized to "0" by a reset (INIT). •This bit is readable and writable. Note: Please set the synchronous standby operation by setting "1" to this bit at changing to the standby mode. 90 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 2 CPU AND CONTROL BLOCK 2.9 Clock Generation Control MB91313A Series ■ CTBR: Time-Base Counter Clear Register The configuration of the time-base counter clear register is shown below. CTBR bit Address: 000483H Initial value W: 7 6 5 4 3 2 1 0 D7 (W) X D6 (W) X D5 (W) X D4 (W) X D3 (W) X D2 (W) X D1 (W) X D0 (W) X Write only CTBR is used to initialize the time-base counter. When "A5H" and "5AH" are written to this register consecutively, all the bits of the time-base counter are cleared to "0" immediately after "5AH" is written. There is no time limit between writing "A5H" and "5AH". However, if data other than "5AH" is written after "A5H" is written, clear operation will not be performed even when "5AH" is written, unless "A5H" is written again. The read value of this register is undefined. Note: When this register is used to clear the time-base counter, there will be temporary fluctuations in the oscillation stabilization wait interval, watchdog timer cycle, and time-base timer cycle. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 91 CHAPTER 2 CPU AND CONTROL BLOCK 2.9 Clock Generation Control MB91313A Series ■ CLKR: Clock Source Control Register The configuration of the clock source control register is shown below. CLKR bit Address: 000484H 15 14 13 12 11 10 9 8 PLL1S2 PLL1S1 PLL1S0 PLL2EN PLL1EN CLKS1 CLKS0 (R/W) (R/W) (R/W) (R/W) (R/W) (R/W) (R/W) (R/W) 0 0 0 0 0 0 0 0 X X X X X X X X Reserved Initial value (INIT) Initial value (RST) R/W: Readable/writable CLKR selects the clock source to be used as the system base clock and controls the PLL. This register is used to select one out of the three available clock sources. It is also used to enable the operation of the dual clock PLL (operation of both main clock and sub clock) and select the multiplication rate. [bit15] Reserved: Reserved bit This is a reserved bit. Be sure to set the bit to "0". [bit14 to bit12] PLL1S2, PLL1S1, PLL1S0: PLL multiplication rate selection bits These bits are used to select the multiplication rate for the main PLL. The multiplication rate for the main PLL is selected from 8 options. Do not rewrite this bit while the main PLL is selected as the clock source. The maximum operable frequency is 33 MHz. Therefore, do not set any higher frequency. This bit is initialized to "000B" by a reset (INIT). Main PLL multiplication rate PLL1S2 PLL1S1 PLL1S0 0 0 0 × 1 (equal) φ = 60.6 ns (16.5 MHz) 0 0 1 × 2 (multiply-by-2) φ = 30.3 ns (33 MHz) 0 1 0 × 3 (multiply-by-3) φ = 20.2 ns (49.5 MHz) 0 1 1 × 4 (multiply-by-4) Setting disabled 1 0 0 × 5 (multiply-by-5) Setting disabled 1 0 1 × 6 (multiply-by-6) Setting disabled 1 1 0 × 7 (multiply-by-7) Setting disabled 1 1 1 × 8 (multiply-by-8) Setting disabled Source oscillation: 16.5 [MHz] φ: Cycle of system base clock These bits are readable and writable. 92 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 2 CPU AND CONTROL BLOCK 2.9 Clock Generation Control MB91313A Series [bit11] PLL2EN: Sub clock selection enable bit PLL2EN is a selection enable bit for the sub clock. Do not rewrite this bit while the sub clock is selected as the clock source. Also, do not select the sub clock as the clock source while this bit is set to "0" (due to the settings of bit9 and bit8: CLKS1 and CLKS0). If OSCD2 (bit1) in STCR is "1", the sub clock will be stopped during stop mode, even when PLL2EN is "1". The operation will be enabled again after return from stop mode. Value Description 0 Disables sub clock selection. [Initial value] 1 Enables sub clock selection. •This bit is initialized to "0" by a reset (INIT). •This bit is readable and writable. [bit10] PLL1EN: Main PLL enable bit PLL1EN is an operation enable bit for the main PLL. Do not rewrite this bit while the main PLL is selected as the clock source. Also, do not select the main PLL as the clock source while this bit is set to "0" (due to the settings of bit9 and bit8: CLKS1 and CLKS0). If OSCD1 (bit0) in STCR is "1", the main PLL will be stopped during stop mode, even when PLL1EN is "1". The operation will be enabled again after return from stop mode. Value Description 0 Stops main PLL. [Initial value] 1 Enables main PLL operation. •This bit is initialized to "0" by a reset (INIT). •This bit is readable and writable. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 93 CHAPTER 2 CPU AND CONTROL BLOCK 2.9 Clock Generation Control MB91313A Series [bit9, bit8] CLKS1, CLKS0: Clock source selection bits These bits set the clock source to be used. Based on the value written to the bits, the clock source is selected from the 3 options shown in the following table. Note that the value of CLKS0 (bit8) cannot be modified while CLKS1 (bit9) is "1". Unchangeable combination Changeable combination "00B"→"11B" "00B"→"01B" or "10B" "01B"→"10B" "01B"→"11B" or "00B" "10B"→"01B" or "11B" "10B"→"00B" "11B"→"00B" or "10B" "11B"→"01B" For the above reason, write "01" first, then write "11" to switch from the post-INIT state to the sub clock selection. CLKS1 CLKS0 Clock source setting 0 0 Source oscillation input from X0/X1 divided by 2 [Initial value] 0 1 Source oscillation input from X0/X1 divided by 2 1 0 Main PLL 1 1 Sub clock •This bit is initialized to "00B" by a reset (INIT). •These bits are readable and writable. 94 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 2 CPU AND CONTROL BLOCK 2.9 Clock Generation Control MB91313A Series ■ WPR: Watchdog Reset Generation Delay Register The configuration of the watchdog reset generation delay register is shown below. WPR bit Address: 000485H Initial value W: 7 6 5 4 3 2 1 0 D7 (W) X D6 (W) X D5 (W) X D4 (W) X D3 (W) X D2 (W) X D1 (W) X D0 (W) X Write only WPR is a register used to delay the generation of a watchdog reset. When "A5H" and "5AH" are written to this register consecutively, flip-flop for detecting the watchdog timer is cleared immediately after "5AH" is written, to delay the generation of a watchdog reset. There is no time limit between writing "A5H" and "5AH". However, if data other than "5AH" is written after "A5H" is written, clear operation will not be performed even when "5AH" is written, unless "A5H" is written again. Table 2.9-1 shows the relationship between the time interval pertaining to the generation of watchdog resets and the RSRR register value. Unless the writing of both pieces of the data is completed within this interval, a watchdog reset is generated. The time spent until the generation of a watchdog reset and the writing interval required to inhibit the generation vary depending on the state of WT1 (bit9) and WT0 (bit8) in the RSRR register. Table 2.9-1 Time Interval of Watchdog Reset Generation Minimum interval for writing to WPR, required to prevent a watchdog reset to be generated by RSRR Time from when the last 5AH is written to WPR to when a watchdog reset is generated WT1 WT0 0 0 φ × 220 [Initial value] φ × 220 to φ × 221 0 1 φ × 222 φ × 222 to φ × 223 1 0 φ × 224 φ × 224 to φ × 225 1 1 φ × 226 φ × 226 to φ × 227 φ represents the cycle of system base clock. WT1 and WT0 are bit9 and bit8 of RSRR, used to set the cycle of the watchdog timer. When the CPU is not in operation, such as during stop mode, sleep mode and DMA transfer, clear operation is performed automatically. Therefore, once such condition occurs, a watchdog reset is delayed automatically. However, a watchdog reset is not postponed when an external bus hold request (BRQ) has been accepted. To hold the external bus for a long time, enter sleep mode and then input a hold request (BRQ). The read value of this register is undefined. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 95 CHAPTER 2 CPU AND CONTROL BLOCK 2.9 Clock Generation Control MB91313A Series ■ DIVR0: Basic Clock Division Setting Register 0 The configuration of the basic clock division setting register 0 is shown below. DIVR0 bit Address: 000486H Initial value (INIT) Initial value (RST) 15 14 13 12 11 10 9 8 B3 (R/W) 0 X B2 (R/W) 0 X B1 (R/W) 0 X B0 (R/W) 0 X P3 (R/W) 0 X P2 (R/W) 0 X P1 (R/W) 1 X P0 (R/W) 1 X R/W: Readable/writable DIVR0 is a register used to control the division ratio of the base clock for each internal clock. This register sets the division ratio between the CPU and the clock of the internal bus (CLKB), a peripheral circuit and peripheral bus clock (CLKP). Note: The maximum operable frequency is defined for each clock. Operation is not guaranteed if a frequency, in combination with the source clock selection, PLL multiplication rate setting and division ratio setting, is set to exceed the maximum frequency. In particular, take care to follow the correct order in conjunction with modifying the source clock selection setting. When a setting of this register is changed, the new division ratio becomes valid from the next clock rate. 96 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 2 CPU AND CONTROL BLOCK 2.9 Clock Generation Control MB91313A Series [bit15 to bit12] B3, B2, B1, B0: CLKB division selection bits These bits are used to set the division ratio for the CPU clock (CLKB). They set the clock division ratio for the CPU, internal memory and internal bus. Based on the value written to these bits, the division ratio (clock frequency) of the base clock for the CPU and internal bus is selected from the 16 options shown in the following table. The maximum operable frequency is 33 MHz. Therefore, do not set any division ratio that will cause this frequency to be exceeded. Clock division ratio Clock frequency: When source oscillation is 16.5 MHz, and PLL is multiplied by 2 B3 B2 B1 B0 0 0 0 0 φ 33.0 MHz [Initial value] 0 0 0 1 φ × 2 (divided-by-2) 16.5 MHz 0 0 1 0 φ × 3 (divided-by-3) 11 MHz 0 0 1 1 φ × 4 (divided-by-4) 8.25 MHz 0 1 0 0 φ × 5 (divided-by-5) 6.6 MHz 0 1 0 1 φ × 6 (divided-by-6) 5.5 MHz 0 1 1 0 φ × 7 (divided-by-7) 4.71 MHz 0 1 1 1 φ × 8 (divided-by-8) 4.13 MHz … … … … 1 1 1 1 … φ × 16 (divided-by-16) … 2.06 MHz φ: Cycle of system base clock •These bits are initialized to "0000B" by a reset (INIT). •These bits are readable and writable. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 97 CHAPTER 2 CPU AND CONTROL BLOCK 2.9 Clock Generation Control MB91313A Series [bit11 to bit8] P3, P2, P1, P0: CLKP division selection bits These bits are used to set the division ratio for the peripheral clock (CLKP). They set the division ratio for the clock used for peripheral circuits and peripheral bus. Based on the value written to these bits, the division ratio (clock frequency) of the base clock for the peripheral circuit and peripheral bus clocks is selected from the 16 options shown in the following table. The maximum operable frequency is 33 MHz. Therefore, do not set any division ratio that will cause this frequency to be exceeded. Clock division ratio Clock frequency: When source oscillation is 16.5 MHz, and PLL is multiplied by 2 P3 P2 P1 P0 0 0 0 0 φ 33.0 MHz 0 0 0 1 φ × 2 (divided-by-2) 16.5 MHz 0 0 1 0 φ × 3 (divided-by-3) 11 MHz 0 0 1 1 φ × 4 (divided-by-4) 0 1 0 0 φ × 5 (divided-by-5) 6.6 MHz 0 1 0 1 φ × 6 (divided-by-6) 5.5 MHz 0 1 1 0 φ × 7 (divided-by-7) 4.71 MHz 0 1 1 1 φ × 8 (divided-by-8) 4.13 MHz … … … … 1 1 1 1 … φ × 16 (divided-by-16) 8.25 MHz [Initial value] … 2.06 MHz φ: Cycle of system base clock •These bits are initialized to "0011B" by a reset (INIT). •These bits are readable and writable. 98 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 2 CPU AND CONTROL BLOCK 2.9 Clock Generation Control MB91313A Series ■ DIVR1: Basic Clock Division Setting Register 1 The configuration of the basic clock division setting register 1 is shown below. DIVR1 bit Address: 000487H Initial value (INIT) Initial value (RST) 7 6 5 4 T3 (R/W) 0 X T2 (R/W) 0 X T1 (R/W) 0 X T0 (R/W) 0 X 3 2 1 0 Reserved Reserved Reserved Reserved (R/W) 0 X (R/W) 0 X (R/W) 0 X (R/W) 0 X R/W: Readable/writable DIVR1 is a register used to control the division ratio of the base clock for each internal clock. This register sets the division ratio of the clock for an external expansion bus interface (CLKT). Note: The maximum operable frequency is defined for each clock. Operation is not guaranteed if a frequency, in combination with the source clock selection, PLL multiplication rate setting and division ratio setting, is set to exceed the maximum frequency. In particular, take care to follow the correct order in conjunction with modifying the source clock selection setting. When a setting of this register is changed, the new division ratio becomes valid from the next clock rate. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 99 CHAPTER 2 CPU AND CONTROL BLOCK 2.9 Clock Generation Control MB91313A Series [bit7 to bit4] T3, T2, T1, T0: CLKT division selection bits These bits are used to set the division ratio for the external bus clock (CLKT). They set the clock division ratio for the external extended bus interface. Based on the value written to these bits, the division ratio (clock frequency) of the base clock for the external expansion bus interface is selected from the 16 options shown in the following table. The maximum operable frequency is 16.5 MHz. Therefore, do not set any division ratio that will cause this frequency to be exceeded. Clock division ratio Clock frequency: When source oscillation is 16.5 MHz, and PLL is multiplied by 2 T3 T2 T1 T0 0 0 0 0 φ 33.0 MHz [Initial value] 0 0 0 1 φ × 2 (divided-by-2) 16.5 MHz 0 0 1 0 φ × 3 (divided-by-3) 11 MHz 0 0 1 1 φ × 4 (divided-by-4) 8.25 MHz 0 1 0 0 φ × 5 (divided-by-5) 6.6 MHz 0 1 0 1 φ × 6 (divided-by-6) 5.5 MHz 0 1 1 0 φ × 7 (divided-by-7) 4.71 MHz 0 1 1 1 φ × 8 (divided-by-8) 4.13 MHz … … … … 1 1 1 1 … φ × 16 (divided-by-16) … 2.06 MHz φ: Cycle of system base clock •These bits are initialized to "0000B" by a reset (INIT). •These bits are readable and writable. [bit3 to bit0] Reserved: Reserved bits These are reserved bits. 100 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 2 CPU AND CONTROL BLOCK 2.9 Clock Generation Control MB91313A Series ■ OSCCR: Oscillation Control Register The configuration of the oscillation control register is shown below. OSCCR bit Address: 00048AH Initial value (INIT) Initial value (RST) 15 14 13 12 11 10 9 8 Reserved Reserved Reserved Reserved Reserved Reserved Reserved OSCDS1 (R/W) X X (R/W) X X (R/W) X X (R/W) X X (R/W) X X (R/W) X X (R/W) X X (R/W) 0 X R/W: Readable/writable OSCCR is a register used to control the main oscillation during sub clock operation. [bit15 to bit9] Reserved: Reserved bits These are reserved bits. [bit8] OSCDS1: Main oscillation stop control bit (in sub clock operation mode) OSCDS1 is used to stop the main oscillation while the sub clock is selected. Writing "1" to this bit stops the main oscillation when the sub clock is selected as the clock source. "1" cannot be written to this bit when the main clock is selected. Do not select the main clock while this bit is "1". Set it to "0" and wait until the main oscillation stabilizes before switching to the main clock. In this case, maintain the oscillation stabilization wait time using the main oscillation stabilization wait timer. Moreover, the main oscillation stabilization wait time is required when the clock source is switched to the main clock by INIT. At this point, the operation after return is not guaranteed unless the settings of OS1 and OS0 (bit3 and bit2) in STCR (standby control register) satisfy the main oscillation stabilization wait time. In the above case, set OS1 and OS0 in STCR to a value that will satisfy both the sub clock oscillation stabilization wait time and the main oscillation stabilization wait time. For information about the oscillation stabilization waiting, see "2.9.2 and PLL Lock Wait Time". Value Oscillation Stabilization Wait Description 0 Does not stop main oscillation during execution of sub clock [Initial value]. 1 Stop main oscillation during execution of sub clock. •This bit is initialized to "0" by a reset (INIT). •This bit is readable and writable. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 101 CHAPTER 2 CPU AND CONTROL BLOCK 2.9 Clock Generation Control 2.9.7 MB91313A Series Peripheral Circuits in Clock Control Block This section explains the peripheral circuit functions contained in the clock control block. ■ Time-Base Counter The clock control block includes a 26-bit time-base counter which runs on the system base clock. In addition to measuring the oscillation stabilization wait time (see "2.8.4 Time"), the time-base counter is used for the following applications. Oscillation Stabilization Wait • Watchdog timer: The bit output of the time-base counter is used to measure the watchdog timer for detecting system hang-up. • Time-base timer: The output of the time-base counter is used to generate interval interrupts. ● Watchdog timer The watchdog timer detects program hang-up, using the output of the time-base counter. When the generation of a watchdog reset is no longer delayed during the set interval by an event such as program hang-up, a setting initialization reset (INIT) request is generated as a watchdog reset. [Activating the watchdog timer and setting the cycle] The watchdog timer is activated when RSRR (reset source register/watchdog timer control register) is written to for the first time after a reset (RST). At this point, WT1 and WT0 (bit9 and bit8) are used to set the interval time for the watchdog timer. For setting the interval time, only the time set in the initial write operation becomes valid. Any succeeding write attempts are ignored. [Delaying the generation of watchdog reset] Once the watchdog timer is activated, data must be written periodically to WPR (watchdog reset generation delay register) in the order of "A5H" and "5AH", using the program. This procedure initializes the flag for generating a watchdog reset. [Generating watchdog reset] The flag for generating a watchdog reset is set at the falling edge of the output of the time-base counter in the set interval. If the flag has been set when the second falling edge is detected, a setting initialization reset (INIT) request is generated as a watchdog reset. 102 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 2 CPU AND CONTROL BLOCK 2.9 Clock Generation Control MB91313A Series [Stopping the watchdog timer] Once the watchdog timer is activated, it cannot be stopped until an operation initialization reset (RST) is generated. The watchdog timer can be stopped under the following condition in which an operation initialization reset (RST) is generated, and it does not function until reactivated by program operation. •Operation initialization reset (RST) state •Setting initialization reset (INIT) state •Oscillation stabilization wait reset (RST) state [Suspending the watchdog timer (automatically delayed generation)] While the CPU's program operation is stopped, the watchdog timer once initializes the flag for generating a watchdog reset to delay the generation of such reset. "Suspended program operation" refers to specific operations listed below. •Sleep state •Stop state •Oscillation stabilization wait RUN state •Break when emulator debugger and monitor debugger is used •Period from execution of INTE instruction to execution of RETI instruction •Step trace trap (Break for each instruction when T flag in PS register is set to "1") •Data to cache memory at instruction cache control register (ISIZE, ICHCR) or RAM mode When the time-base counter is cleared, the flag for generating a watchdog reset is also initialized at the same time, and the generation of a watchdog reset is postponed. Note that a watchdog reset may not be generated if system hang-up results in the above state. In that case, perform a reset (INIT) from the external INITX pin. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 103 CHAPTER 2 CPU AND CONTROL BLOCK 2.9 Clock Generation Control MB91313A Series ● Time-base timer The time-base timer is a timer that generates interval interrupts using the output of the time-base counter. The timer is suitable for measuring relatively long times, up to {base clock × 227} cycles such as for the PLL lock wait time and sub clock oscillation stabilization wait time. A time-base timer interrupt request is generated when the falling edge of the output of the time-base counter corresponding to the set interval is detected. [Activating the time-base timer and setting the interval] The time-base timer sets the interval time using TBC2, TBC1 and TBC0 (bit13 to bit11) in TBCR (timebase counter control register). The falling edge of the output of the time-base counter corresponding to the set interval is always detected. Therefore, after setting the interval time, clear TBIF (bit15) first, then set TBIE (bit14) to "1" to enable the output of an interrupt request. When changing the interval time, disable the output of an interrupt request by setting TBIE (bit14) to "0" beforehand. The time-base counter always continues to count without being affected by the above settings. To achieve the accurate interval interrupt time, clear the time-base counter before enabling interrupts. Otherwise, an interrupt request may be generated immediately after interrupts are enabled. [Clearing the time-base counter by program] When "A5H" and "5AH" are written to the time-base counter clear register (CTBR) in that order, all the bits of the time-base counter are cleared to "0" immediately after "5AH" is written. There is no time limit between writing "A5H" and "5AH". However, if data other than "5AH" is written after "A5H" is written, clear operation will not be performed even when "5AH" is written, unless "A5H" is written again. When this time-base counter is cleared, the flag for generating a watchdog reset is also initialized simultaneously, and the generation of a watchdog reset is postponed temporarily. [Clearing the time-base counter by the device state] When the device enters the following state, all the bits of the time-base counter are cleared to "0". •Stop state •Setting initialization reset (INIT) state Particularly in stop state, a time-base timer interval interrupt may occur unintentionally, as the time-base counter is used to measure the oscillation stabilization wait time. Therefore, disable time-base timer interrupts and do not use the time-base timer before selecting stop mode. In any other state, an operation initialization reset (RST) is generated automatically. Consequently, timebase timer interrupts are disabled automatically. 104 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 2 CPU AND CONTROL BLOCK 2.9 Clock Generation Control MB91313A Series ● Main oscillation stabilization wait timer (when sub clock is selected) This is a 26-bit timer that is synchronized with the main clock to count up, without being affected by the clock source selection or division setting. The timer is used to measure the main oscillation stabilization wait time during sub clock operation. The main oscillation can be controlled in sub clock operation by OSCDS1 (bit8) in OSCCR (oscillation control register). This timer is used to measure the oscillation stabilization wait time, when the main oscillation is stopped and then restarted. Use the following procedure to switch to the main clock operation from the sub clock operation with the main clock being stopped. 1) Clear the main oscillation stabilization wait timer. 2) Set OSCDS1 (bit8) in OSCCR (oscillation control register) to "0" to start the main oscillation. 3) Use the main oscillation stabilization wait timer to wait until the main clock becomes stable. 4) Once the main clock stabilizes, use CLKS1 and CLKS0 (bit9 and bit8) in CLKR (clock source register) to switch from the sub clock to the main clock. Note: If the clock is switched to the main clock without waiting until it becomes stable, an unstable clock signal will be supplied; therefore, the resulting operation will not be guaranteed. Always wait until the clock stabilizes before switching to the main clock. For details about the main oscillation stabilization wait timer, see "9.1 Wait Timer". CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED Main Oscillation Stabilization 105 CHAPTER 2 CPU AND CONTROL BLOCK 2.10 Device State Control 2.10 MB91313A Series Device State Control This section explains various states of this model and how they are controlled. ■ Device States Figure 2.10-1 shows the device states and each of the transitions of the FR family. Figure 2.10-1 Device States 1 2 3 4 5 6 7 8 9 10 INITX pin = 0 (INIT) INITX pin = 1 (INIT released) Oscillation stabilization wait completed Reset (RST) released Software reset (RST) Sleep (instruction written) Stop (instruction written) Interrupt External interrupt requiring no clock Main clock → sub clock switched (instruction written) 11 Sub clock → main clock switched (instruction written) 12 Watchdog reset (INIT) 13 Sub clock sleep (instruction written) Highest ↓ ↓ ↓ ↓ Lowest Power-on 1 Priority order of transition requests Setting initialization reset (INIT) Oscillation stabilization wait completed Operation initialization reset (RST) Interrupt request Stop Sleep Setting initialization (INIT) 2 Main clock mode 1 Main oscillation stabilization wait reset 1 Main stop 9 3 1 Oscillation stabilization wait RUN 3 Program reset (RST) 7 1 6 Main sleep 5 4 12 Main RUN 8 1 1 10 Sub clock mode 1 Sub clock sleep Oscillation stabilization wait RUN 12 Sub RUN 13 3 1 1 11 8 7 5 1 4 Program reset (RST) 1 9 Sub clock stop (watch state *2) Sub clock stop (watch state *2) *1: To switch the clock source between the main clock and sub clock, switch CLKS1 and CLKS0 (bit1, bit0) in the CLKR (clock source register) while a stable supply of the switched clock is maintained in operation mode. *2: To stop anything other than the watch timer (watch state), place the device in stop mode while OSCD2 (bit1) in the STCR (standby control register) is set to "0" and OSCD1 (bit0) is set to "1" in the sub clock operation state (they can be written simultaneously). 106 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 2 CPU AND CONTROL BLOCK 2.10 Device State Control MB91313A Series ■ Operational States of Device This model is provided with the following device operational states: ● RUN state (normal operation) In this state, the program is being executed. All internal clocks are supplied to keep all circuits operable. Only the clock for the 16-bit peripheral bus, however, is stopped unless the bus is accessed. In this state, a state transition request is accepted. If synchronous reset mode is selected, however, state transition operations different from normal reset mode are used for some requests. For details, see "■ Synchronous Reset Operation" section of "2.8.5 Reset Operation Modes". ● Sleep state In this state, the program is stopped. The device is placed in this state by program operation. Only the execution of the program by the CPU is stopped, while the peripheral circuits are maintained operable. The built-in memory and internal/external buses remain stopped unless requested by the DMA controller. When a valid interrupt request is generated, this state is released and the device enters the RUN state (normal operation). When a setting initialization reset (INIT) request is generated, the device enters the setting initialization reset (INIT) state. When an operation initialization reset (RST) request is generated, the device enters the operation initialization reset (RST) state. ● Stop state In this state, the device is stopped. The device is placed in this state by program operation. In the stop state, all the internal circuits are stopped. The internal clocks are all stopped and the oscillation circuit and PLL can be stopped by setting. Also, the external pins can be set to the same high impedance by setting (except some pins). The device enters the oscillation stabilization wait RUN state when a specific (non-clock-based) valid interrupt occurs or when a main oscillation stabilization wait timer interrupt request is generated during oscillation operation. When a setting initialization reset (INIT) request is generated, the device enters the setting initialization reset (INIT) state. When an operation initialization reset (RST) request is generated, the device enters the oscillation stabilization wait reset (RST) state. ● Oscillation stabilization wait RUN state In this state, the device is stopped. The device enters this state when returning from the stop state. All the internal circuits except the clock generation control block (time-base counter and device state control component) are stopped. While all the internal clocks are stopped, the oscillation circuit and the PLL which has been enabled to operate are in operation. This state releases the high impedance control of the external pins used in the stop state. The device enters the RUN state (normal operation) when the set oscillation stabilization wait time has elapsed. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 107 CHAPTER 2 CPU AND CONTROL BLOCK 2.10 Device State Control MB91313A Series When a setting initialization reset (INIT) request is generated, the device enters the setting initialization reset (INIT) state. When an operation initialization reset (RST) request is generated, the device enters the oscillation stabilization wait reset (RST) state. ● Oscillation stabilization wait reset (RST) state In this state, the device is stopped. The device enters this state after returning from the stop state or setting initialization reset (INIT) state. All the internal circuits except the clock generation control block (time-base counter and device state control component) are stopped. While all the internal clocks are stopped, the oscillation circuit and the PLL which has been enabled to operate are in operation. This state releases the high impedance control of the external pins used in the stop state. It outputs an operation initialization reset (RST) to the internal circuits. The device enters the oscillation stabilization wait reset (RST) state when the set oscillation stabilization wait time has elapsed. When a setting initialization reset (INIT) request is generated, the device enters the setting initialization reset (INIT) state. ● Operation initialization reset (RST) state In this state, the program is initialized. The device enters this state once the operation initialization reset (RST) request is accepted or the oscillation stabilization wait reset (RST) state ends. The execution of the program by the CPU is stopped and the program counter is initialized. Most peripheral circuits are initialized. All the internal clocks, the oscillation circuit and the PLL which has been enabled to operate are in operation. It outputs an operation initialization reset (RST) to the internal circuits. When the operation initialization reset (RST) request is lost, the device enters the RUN state (normal operation) to execute the operation initialization reset sequence. If the device has just returned from the setting initialization reset (INIT) state, it will execute the setting initialization reset sequence. When a setting initialization reset (INIT) request is generated, the device enters the setting initialization reset (INIT) state. ● Setting initialization reset (INIT) state In this state, all settings are initialized. The device enters this state once the settings initialization reset (INIT) request is accepted or the hardware standby state ends. The execution of the program by the CPU is stopped and the program counter is initialized. All the peripheral circuits are initialized. Although the oscillation circuit is in operation, the PLL stops operation. All the internal clocks are stopped while the "L" level is being input to the external INITX pin. In other times, they operate. A setting initialization reset (INIT) and operation initialization reset (RST) are output to the internal circuits. When the setting initialization reset (INIT) request is lost, this state is released and the device enters the oscillation stabilization wait reset (RST) state. After that, the device goes through the operation initialization reset (RST) state and executes the setting initialization reset sequence. 108 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 2 CPU AND CONTROL BLOCK 2.10 Device State Control MB91313A Series ● Priority order of state transition requests In any state, the device follows the priority order of the state transition requests, shown below. Note that some requests can be generated only in a particular state; therefore, they are only valid in that state. [Highest] Setting initialization reset (INIT) request ↓ Oscillation stabilization wait time completed (This occurs only in oscillation stabilization wait reset state and oscillation stabilization wait RUN state) ↓ Operation initialization reset (RST) request ↓ Valid interrupt request (Generated only in RUN, sleep and stop state) ↓ Stop mode request (register written) (Generated only in RUN state) [Lowest] CM71-10143-5E Sleep mode request (register written) (Generated only in RUN state) FUJITSU SEMICONDUCTOR LIMITED 109 CHAPTER 2 CPU AND CONTROL BLOCK 2.10 Device State Control 2.10.1 MB91313A Series Low-power Consumption Mode Of all the operational states available in this model, this section explains the low-power consumption modes as well as how to use them. This model is provided with the following low-power consumption modes: • Sleep Mode The device is set to sleep mode by writing to a register. • Stop Mode The device is set to stop mode by writing to a register. Each mode is explained below. ■ Sleep Mode When "1" is written to the SLEEP bit (bit6) in STCR (standby control register), sleep mode is selected and the device enters sleep mode. After that, the device remains in sleep state until an event allowing the device to recover from sleep state occurs. When "1" is written to both the STOP bit (bit7) in STCR (standby control register) and this bit, the STOP bit (bit7) has higher priority; therefore, the device enters the stop state. For information about the sleep state, also see the "■ Operational States of Device" section of "2.10 Device State Control". [Transition to sleep mode] To place the device in a sleep mode, use the synchronous standby mode, set in SYNCS (bit8) of TBCR (time-base counter control register) and be sure to follow the sequence shown below. (LDI #value_of_sleep,R0) ; "value_of_sleep" is the data written to STCR. (LDI #_STCR,R12) ; "_STCR" is the address of STCR (481H). STB ; Writing to the standby control register (STCR) R0,@R12 LDUB@R12,R0 ; Reading from STCR for synchronous standby LDUB@R12,R0 ; Another dummy read from STCR NOP ; NOP (for timing adjustment) × 5 NOP NOP NOP NOP [Circuits that stop in sleep state] •Execution of program by CPU •Bit search module (It however operates during DMA transfer.) •Various types of built-in memory (It however operates during DMA transfer.) •Internal/external buses (They however operate during DMA transfer.) 110 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 2 CPU AND CONTROL BLOCK 2.10 Device State Control MB91313A Series [Circuits that do not stop in sleep state] •Oscillation circuit •PLL enabled to operate •Clock generation control block •Interrupt controller •Peripheral circuits •DMA controller •DSU •Main oscillation stabilization wait timer [Events that recover the device from sleep state] •Generation of a valid interrupt request When an interrupt request holding an interrupt level other than for disabling interrupt (1FH) is generated, the device is released from sleep mode and enters the RUN state (normal state). To maintain the device in sleep mode even when an interrupt request is generated, set the relevant ICR to disable interrupts (1FH) for the interrupt level. •Generation of a setting initialization reset (INIT) request When a setting initialization reset (INIT) request is generated, the device enters the setting initialization reset (INIT) state unconditionally. •Generation of an operation initialization reset (RST) request When an operation initialization reset (RST) request is generated, the device enters the operation initialization reset (RST) state unconditionally. For information about the priority order of the sources, see "2.10 Device State Control". [Synchronous standby operation] If "1" is set for bit8:SYNCS bit of the time base counter control register (TBCR), synchronous standby operation is enabled. In this case, the device does not enter the sleep state only by writing to the SLEEP bit. After the write operation, the STCR register must also be read from in order to set the device to the sleep state. When using sleep mode, always use the sequence described in [Transition to sleep mode]. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 111 CHAPTER 2 CPU AND CONTROL BLOCK 2.10 Device State Control MB91313A Series ■ Stop Mode When "1" is written to the STOP bit (bit7) in STCR (standby control register), stop mode is selected and the device enters the stop state. After that, the device remains in the stop state, until an event allowing the device to recover from the stop state occurs. When "1" is written to both the SLEEP bit (bit6) in STCR (standby control register) and this bit, the STOP bit (bit7) has higher priority; therefore, the device enters the stop state. For information about the stop state, also see the "■ Operational States of Device" section of "2.10 Device State Control". [Stop mode transition] Use the following sequences sifter using the synchronous standby mode (TBCR: Set by time base counter control register bit8 CYNCS bit) when putting in the stop mode. (LDI #value_of_stop,R0) ; "value_of_stop" is the data written to STCR. (LDI #_STCR,R12) ; "_STCR" is the address of STCR (481H). STB ; Writing to the standby control register (STCR) R0,@R12 LDUB @R12,R0 ; Reading from STCR for synchronous standby LDUB @R12,R0 ; Another dummy read from STCR NOP ; NOP (for timing adjustment) × 5 NOP NOP NOP NOP Furthermore, set the I flag, ILM and ICR to ensure that branching into the interrupt handler which is a return source occurs after returning to the standby mode. [Circuits that halt in stop state] •Oscillation circuit that has been set to stop: The oscillation circuit for the sub clock that is in the stop state is set to halt, when OSCD2 (bit1) in STCR (standby control register) is set to "1". In this case, the watch timer also halts. The oscillation circuit for the main clock that is in the stop state is set to halt, when OSCD1 (bit0) in STCR (standby control register) is set to "1". In this case, the main oscillation stabilization wait timer also halts. •PLL that is connected to the oscillation circuit either disabled to operate or set to halt: When OSCD2 (bit1) in STCR (standby control register) is set to "1", the PLL for the sub clock that is in the stop state is set to halt, even if PLL2EN (bit11) in CLKR (clock source control register) is set to "1". When OSCD1 (bit0) in STCR (standby control register) is set to "1", the PLL for the main clock that is in the stop state is set to halt, even if PLL1EN (bit10) in CLKR (clock source control register) is set to "1". •All the internal circuits except the [Circuits that do not halt in stop state] 112 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 2 CPU AND CONTROL BLOCK 2.10 Device State Control MB91313A Series [Circuits that do not halt in stop state] •Oscillation circuits that are not set to halt: The oscillation circuit for the sub clock that is in the stop state does not halt, when OSCD2 (bit1) in STCR (standby control register) is set to "0". In this case, the watch timer also does not halt. The oscillation circuit for the main clock that is in the stop state does not halt, when OSCD1 (bit0) in STCR (standby control register) is set to "0". In this case, the main oscillation stabilization wait timer also does not halt. •PLL that is connected to the oscillation circuit which is enabled to operate and not set to halt: When OSCD2 (bit1) in STCR (standby control register) is set to "0", the PLL for the sub clock that is in the stop state does not halt, if PLL2EN (bit11) in CLKR (clock source control register) is set to "1". When OSCD1 (bit0) in STCR (standby control register) is set to "0", the PLL for the main clock that is in the stop state does not halt, if PLL1EN (bit10) in CLKR (clock source control register) is set to "1". [High-impedance control of pins in stop state] The pin outputs in the stop state are set to high impedance, if the HIZ bit (bit5) in STCR (standby control register) is set to "1". For information about the pins subject to this control feature, see "APPENDIX C Pin Status In Each CPU State". The pin outputs in the stop state retain the value used before the transition to the stop state, if the HIZ bit (bit5) in STCR (standby control register) is set to "0". For details, see "APPENDIX C Pin Status In Each CPU State". [Events that recover the device from stop state] •Generation of a specific (non-clock-based) valid interrupt request: Only the following are valid: external interrupt input pin (INTn pin), main oscillation stabilization wait timer interrupt during main oscillation, and watch interrupt during sub clock oscillation. When an interrupt request holding an interrupt level other than for disabling interrupt (1FH) is generated, the device is released from stop mode and enters the RUN state (normal state). To maintain the device in stop mode even when an interrupt request is generated, set the relevant ICR to disable interrupts (1FH) for the interrupt level. •Main oscillation stabilization wait timer interrupt: If a main oscillation stabilization wait timer interrupt request is generated, either when OSCDS1 (bit8) in OSCCR (oscillation control register) is set to "0" with the sub clock being selected, or when OSCD1 (bit0) in STCR (standby control register) is set to "0" with the main clock being selected, the device is released from stop mode and enters the RUN state (normal state). To maintain the device in stop mode even when an interrupt request is generated, stop the main oscillation stabilization wait timer or disable the interrupt enable bit of the main oscillation stabilization wait timer. •Generation of a setting initialization reset (INIT) request: When a setting initialization reset (INIT) request is generated, the device enters the setting initialization reset (INIT) state unconditionally. •Generation of an operation initialization reset (RST) request: When an operation initialization reset (RST) request is generated, the device enters the operation initialization reset (RST) state unconditionally. For information about the priority order of the sources, see the "■ Operational States of Device" section of "2.10 Device State Control". CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 113 CHAPTER 2 CPU AND CONTROL BLOCK 2.10 Device State Control MB91313A Series [Clock source selection in stop mode] Select the main clock divided by 2 as the source clock before setting stop mode. For details, see "2.9 Clock Generation Control", especially "2.9.1 PLL Control" in that section. Note that the same restrictions as in normal operation apply when setting the division ratio. 114 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 2 CPU AND CONTROL BLOCK 2.11 Operating Mode MB91313A Series 2.11 Operating Mode This section explains the operating modes of the FR family. ■ Operating Mode The operating modes include bus mode and access mode. ● Bus Modes Bus mode is a mode that controls the operations of the internal ROM and external access function. It is selected based on the content of the mode setting pins (MD2, MD1, and MD0). ● Access Mode Access mode is a mode that controls the external data bus width. It is selected by the WTH1 and WTH0 bits in the mode register and the DBW0 bit in ACR0 to ACR3 (Area Configuration Register). ■ Bus Mode 0 (Single-chip Mode) In this mode, the internal I/O, F-bus RAM and F-bus ROM are enabled, but access to other areas is disabled. The external pins serve as either a peripheral or general-purpose port. They do not function as bus pins. ■ Bus Mode 1 (Internal ROM / External Bus Mode) In this mode, the internal I/O, F-bus RAM and F-bus ROM are enabled, and access to an externally accessible area is handled as access to an external space. Some external pins serve as bus pins. ■ Mode Setting In the FR family, each operating mode is set by the mode pins (MD2, MD1, and MD0) and the mode register (MODR). ● Mode pins 3 pins (MD2, MD1, and MD0) are used for specification related to mode vector fetch. Table 2.11-1 lists specification pertaining to mode vector fetch. Table 2.11-1 Mode Vector Fetch Related Specification Mode pins MD2, MD1, MD0 Mode name Reset vector access area 000B Internal ROM mode vector Internal Note that settings other than as specified above are prohibited. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 115 CHAPTER 2 CPU AND CONTROL BLOCK 2.11 Operating Mode MB91313A Series ● Mode register (MODR) The data written to the mode register by mode vector fetch is called mode data. See Section "2.8.3 Sequence" for information about mode vector fetch. Reset Once the mode register (MODR) is set, the device runs in the operating mode set according to this register. The mode register is set by any reset source. It cannot be written from the user program. Reference: Nothing exists in the address (0007FFH) of the mode register of the conventional FR family. It can however be rewritten in emulator mode. In this case, use an 8-bit data transfer instruction. It cannot be written by a 16/32-bit transfer instruction. The details of the mode register are as follows. [Register's Detail Explanation] MODR bit Address:0007FDH 7 6 5 4 3 2 Reserved Reserved Reserved Reserved Reserved Reserved 1 0 Initial value XXXXXXXXB WTH1 WTH0 Operating mode [bit7 to bit2] Reserved bits Always set them to "000001B". Operation is not guaranteed if a value other than "000001B" is set. [bit1, bit0] WTH1, WTH0 (Bus width specification bits) These bits specify the bus width for external bus mode. In external bus mode, this value is set in the DBW0 bit in ACR0 (CS0 area). 116 WTH1 WTH0 Function 0 0 8-bit bus width External bus mode 0 1 16-bit bus width External bus mode 1 0 1 1 − Single-chip mode FUJITSU SEMICONDUCTOR LIMITED Remarks Setting disabled Single-chip mode CM71-10143-5E CHAPTER 3 EXTERNAL BUS INTERFACE This chapter explains the features, block diagram, I/O pins, and registers of the external bus interface. 3.1 Overview of External Bus Interface 3.2 Explanation of Registers of External Bus Interface 3.3 Chip Select Area 3.4 Address/Data Multiplex Interface 3.5 DMA Access 3.6 Register Setting Procedure 3.7 Note on Using External Bus Interface CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 117 CHAPTER 3 EXTERNAL BUS INTERFACE 3.1 Overview of External Bus Interface 3.1 MB91313A Series Overview of External Bus Interface The external bus interface controller controls the interface between the LSI's internal buses and external memory and I/O devices. ■ Features • Address/data multiplex bus (8-bit/16-bit width) • Four independent banks (chip select areas) can be set, and chip select for each bank can be output. CS0X and CS1X, in units of 64K/128K/256K/512KB, can be set to the space assigned to the external bus areas up to "003FFFFFH" CS2X and CS3X, in units of 1M/2M/4M/8MB, can be set to the space between "00400000H" and "00FFFFFFH". Boundaries may be limited depending on the size of the area. • In each chip select area, the following functions can be set independently: Enabling and disabling of the chip select area (disabled areas cannot be accessed) Setting of the access timing type to support various kinds of memory Detailed access timing setting (individual setting of the access type such as the wait cycle) Setting of the data bus width (8-bit/16-bit) • A different detailed timing can be set for each access timing type For the same type of access timing, a different setting can be made in each chip select area Auto-wait can be set to up to seven cycles (asynchronous SRAM, ROM, FLASH, and I/O area) The bus cycle can be extended by external RDY input (asynchronous SRAM, ROM, FLASH, and I/O area) Various kinds of idle/recovery cycles and setting delays can be inserted • Pins that are not used by the external interface can be used as general-purpose I/O ports through settings 118 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 3 EXTERNAL BUS INTERFACE 3.1 Overview of External Bus Interface MB91313A Series ■ Block Diagram Figure 3.1-1 Block Diagram of External Bus Interface Internal Address Bus 32 Internal Data Bus 32 A-Out Write Buffer Switch Read Buffer Switch M U X External Data Bus Data Block Address Block +1 or +2 Address Buffer A-Out Comparator ASR ASZ External Pin Control Division CS0X to CS3X RDX WR0X, WR1X ASX All Block Control Register & Control RDX CLK ■ I/O Pins I/O pins are external bus interface pins. <Multiplex bus interface> AD15 to AD00 CS0X, CS1X, CS2X, CS3X ASX, CLK RDX WR0X, WR1X RDY CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 119 CHAPTER 3 EXTERNAL BUS INTERFACE 3.1 Overview of External Bus Interface MB91313A Series ■ Register List Figure 3.1-2 Register List of External Bus Interface Address bit31 24 23 16 15 8 7 000640H ASR0 ACR0 000644H ASR1 ACR1 000648H ASR2 ACR2 00064CH ASR3 ACR3 000650H Reserved bit Reserved bit 000654H Reserved bit Reserved bit 000658H Reserved bit Reserved bit 00065CH Reserved bit Reserved bit 000660H AWR0 AWR1 000664H AWR2 AWR3 000668H Reserved bit Reserved bit 00066CH Reserved bit Reserved bit 0 000670H Reserved bit Reserved bit Reserved bit Reserved bit 000674H Reserved bit Reserved bit Reserved bit Reserved bit 000678H Reserved bit Reserved bit Reserved bit Reserved bit 00067CH Reserved bit Reserved bit Reserved bit Reserved bit 000680H CSER Reserved bit Reserved bit Reserved bit 000684H Reserved bit Reserved bit Reserved bit Reserved bit 000688H Reserved bit Reserved bit Reserved bit Reserved bit 00068CH Reserved bit Reserved bit Reserved bit Reserved bit 0007F8H Reserved bit Reserved bit Reserved bit Reserved bit 0007FCH Reserved bit Reserved bit Reserved bit Reserved bit Reserved: Reserved register. Be sure to set "0" at write. 120 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 3 EXTERNAL BUS INTERFACE 3.2 Explanation of Registers of External Bus Interface MB91313A Series 3.2 Explanation of Registers of External Bus Interface This section describes the configuration and functions of the registers used for external bus interface. ■ ASR0 to ASR3 (Area Select Register) Figure 3.2-1 Bit Configuration of ASR (Area Select Register) ASR0 Address bit 15 … 8 7 6 ... 1 0 000640H Reserved … Reserved A23 A22 ... A17 A16 ASR1 Address bit 15 … 8 7 6 1 0 000644H Reserved … Reserved A23 A22 A17 A16 ASR2 Address bit 15 … 8 7 6 1 0 000648H Reserved … Reserved A23 A22 A17 A16 ASR3 Address bit 15 … 8 7 6 1 0 00064CH Reserved … Reserved A23 A22 A17 A16 ... ... ... Initial value When INIT When RST Access 0000H 0000H R/W 00XXH 00XXH R/W 00XXH 00XXH R/W 00XXH 00XXH R/W R/W: Readable/writable [bit15 to bit8] Reserved: Reserved bits Be sure to set these bits to "00H". [bit7 to bit0] A23 to A16 ASR0 to ASR3 (Area Select Register 0 to 3) specify the start address of each chip select area in CS0X to CS3X. The start address can be set in the high-order 8 bits of A[23:16]. Each chip select area starts with the address set in this register and covers the range set by the ASZ[1:0] bit of the ACR0 to ACR3 registers. The boundary of each chip select area obeys the setting of the ASZ[1:0] bit of the ACR0 to ACR3 registers. For example, if an area of 1M bytes is set by the ASZ[1:0] bit, the low-order four bits of the ASR0 to ASR3 registers are ignored and only A[23:20] bit are valid. The ASR0 register is initialized to "00H" by INIT and RST. ASR1 to ASR3 are not initialized by INIT and RST and are therefore undefined. After starting the LSI operation, be sure to set the corresponding ASR register before enabling each chip select area with the CSER register. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 121 CHAPTER 3 EXTERNAL BUS INTERFACE 3.2 Explanation of Registers of External Bus Interface MB91313A Series ■ ACR0 to ACR3 (Area Configuration Register) Figure 3.2-2 Bit Configuration of ACR (Area Configuration Register) ACR0H bit 000642H 15 14 Reserved Reserved 13 12 11 10 9 8 ASZ1 ASZ0 Reserved DBW0 5 4 3 2 1 0 WREN Reserved TYP3 TYP2 TYP1 TYP0 13 12 11 10 9 8 ASZ1 ASZ0 Reserved DBW0 5 4 3 2 WREN Reserved TYP3 TYP2 13 12 11 10 ASZ1 ASZ0 Reserved DBW0 5 4 3 2 1 0 WREN Reserved TYP3 TYP2 TYP1 TYP0 13 12 11 10 9 8 ASZ1 ASZ0 Reserved DBW0 5 4 3 2 1 0 WREN Reserved TYP3 TYP2 TYP1 TYP0 Reserved Reserved Initial value When INIT When RST Access 00110X00B 00110X00B R/W 00000000B 00000000B R/W 00XX0X00B 00XX0X00B R/W 00X0XXXXB 00X0XXXXB R/W 00XX0X00B 00XX0X00B R/W 00X0XXXXB 00X0XXXXB R/W 00XX0X00B 00XX0X00B R/W 00X0XXXXB 00X0XXXXB R/W ACR0L bit 000643H 7 6 Reserved Reserved ACR1H bit 000646H 15 14 Reserved Reserved Reserved Reserved ACR1L bit 000647H 7 6 Reserved Reserved 1 0 Reserved Reserved ACR2H bit 00064AH 15 14 Reserved Reserved 9 8 Reserved Reserved ACR2L bit 00064BH 7 6 Reserved Reserved ACR3H bit 00064EH 15 14 Reserved Reserved Reserved Reserved ACR3L bit 00064FH 7 6 Reserved Reserved R/W: Readable/Writable ACR0 to ACR3 (Area Configuration Register 0 to 3) set the functions of each chip select area. [bit15, bit14] Reserved: Reserved bits Be sure to set these bits to "00B". 122 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 3 EXTERNAL BUS INTERFACE 3.2 Explanation of Registers of External Bus Interface MB91313A Series [bit13, bit12] ASZ1, ASZ0 = Area Size Bit [1:0] The size of each chip select area is set as follows: Register ASZ1 ASZ0 ASR0/ ASR1 ASR2/ ASR3 Size of Each Chip Select Area 0 0 64 KB (00010000H byte, ASR A[23:16] bit is valid) 0 1 128 KB (00020000H byte, ASR A[23:17] bit is valid) 1 0 256 KB (00040000H byte, ASR A[23:18] bit is valid) 1 1 512 KB (00080000H byte, ASR A [23:19] bit is valid) 0 0 1 MB (00100000H byte, ASR A[23:20] bit is valid) 0 1 2 MB (00200000H byte, ASR A[23:21] bit is valid) 1 0 4 MB (00400000H byte, ASR A[23:22] bit is valid) 1 1 8 MB (00800000H byte, ASR A[23] bit is valid) Setting Only CS0X and CS1X are valid Only CS2X and CS3X are valid ASZ[1:0] are used to set the size of each area by modifying the number of bits for address comparison to a value different from ASR. Thus, an ASR contains bits that are not compared. The ASZ[1:0] bit of ACR0 are initialized to "11B" by RST. Despite this setting, however, the CS0 area just after RST is executed is specially set from "00000000H" to "00FFFFFFH" (setting of entire area). The entire-area setting is reset after the first write to ACR0 and an appropriate size is set as indicated in the table shown above. [bit11] Reserved: Reserved bit Be sure to set this bit to "0". [bit10] DBW0 = Data Bus Width[0] Data bus width of each chip select area is set as follows: DBW0 Data Bus Width 0 8 Bit 1 16 Bit (Byte Access) (Half Word Access) The same values as those of the WTH bits of the mode vector are written automatically to bits DBW0 of ACR0 during the reset sequence. [bit9 to bit6] Reserved: Reserved bits Be sure to set these bits to "0000B". CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 123 CHAPTER 3 EXTERNAL BUS INTERFACE 3.2 Explanation of Registers of External Bus Interface MB91313A Series [bit5] WREN = WRite ENable This bit sets enabling and disabling of writing to each chip select area. WREN Write enable/disable 0 Disable write 1 Enable write If an area for which write operations are disabled is accessed for a write operation from the internal bus, the access is ignored and no external access at all is performed. Set the WREN bit of areas for which write operations are required, such as data areas, to "1". [bit4] Reserved: Reserved bit Be sure to set this bit to "0". [bit3 to bit0] TYP3 to TYP0 = TYPe select Access type of each chip select area is set as follows: TYP3 TYP2 TYP1 TYP0 Access type 0 x x Normal access (asynchronous SRAM, I/O, single ROM/FLASH) 1 x x Address data multiplex access (8/16-bit bus width only) x 0 Disable WAIT insertion by the RDY pin x 1 Enable WAIT insertion by the RDY pin 0 x Use the WR0X and WR1X pins as write strobes 1 x Setting disabled 0 Setting disabled 1 Setting disabled 0 x 0 0 0 1 0 Setting disabled 0 1 1 Setting disabled 1 0 0 Setting disabled 1 0 1 Setting disabled 1 1 0 Setting disabled 1 1 1 Mask area setting (The access type is the same as that of the overlapping area) *1 1 124 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 3 EXTERNAL BUS INTERFACE 3.2 Explanation of Registers of External Bus Interface MB91313A Series Set the access type as the combination of all bits. See the section of operation explanation for details on how each access type works. *1: CS area mask setting function If you want to set an area some of whose operation settings are changed for a certain CS area (referred to as the base setting area), you can set ACR:TYP[3:0]=1111 in another CS area so that the area can function as a mask setting area. If you do not use the mask setting function, disable any overlapping area settings for multiple CS areas. Access operations to the mask setting area are as follows: -CSnX corresponding to a mask setting area is not asserted. -CSnX corresponding to a base setting area is asserted. -For the following ACR settings, the settings on the mask setting area side are valid: Bit [10] DBW0 : Bus width setting Bit [5] WREN : Write-enable setting * *:For this setting only, a setting that is different from that of the base setting area is not allowed. -For the following ACR setting, the setting on the base setting area side is valid: Bit [3:0] TYP[3:0] : Access type setting -For the AWR settings, the settings on the mask setting area side are valid. A mask setting area can be set for only part of another CS area (base setting area). You cannot set a mask setting area for an area without a base setting area. Do not overlap multiple mask setting areas. Use care when setting ASR and the ACR:ASZ[1:0] bit. (Restrictions) A write-enable setting cannot be implemented by a mask. Write-enable settings in the base CS area and the mask setting area must be identical. If write operations to a mask setting area are disabled, the area is not masked and operates as a base CS area. If write operations to the base CS area are disabled but are enabled to the mask setting area, the area has no base, resulting in malfunctions. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 125 CHAPTER 3 EXTERNAL BUS INTERFACE 3.2 Explanation of Registers of External Bus Interface MB91313A Series ■ AWR0 to AWR3 (Area Wait Register) Figure 3.2-3 Bit Configuration of AWR (Area Wait Register) AWR0H Address bit 000660H AWR0L Address bit 000661H AWR1H Address bit 000662H AWR1L Address bit 000663H AWR2H Address bit 000664H AWR2L Address bit 000665H AWR3H Address bit 000666H AWR3L Address bit 000667H 15 14 13 12 11 10 9 8 Reserved W14 W13 W12 7 6 5 4 3 2 1 0 Reserved W06 Reserved W04 Reserved W02 W01 W00 15 14 13 12 11 10 9 8 Reserved W14 W13 W12 7 6 5 4 3 2 1 0 Reserved W06 Reserved W04 Reserved W02 W01 W00 15 14 13 12 11 10 9 8 Reserved W14 W13 W12 7 6 5 4 3 2 1 0 Reserved W06 Reserved W04 Reserved W02 W01 W00 15 14 13 12 11 10 9 8 Reserved W14 W13 W12 7 6 5 4 3 2 1 0 Reserved W06 Reserved W04 Reserved W02 W01 W00 Reserved Reserved Reserved Reserved Reserved Reserved Reserved Reserved Reserved Reserved Reserved Reserved Reserved Reserved Reserved Reserved Initial value Access When INIT When RST 01110000B 01110000B R/W 01011011B 01011011B R/W 0XXX0000B 0XXX0000B R/W 0X0X1XXXB 0X0X1XXXB R/W 0XXX0000B 0XXX0000B R/W 0X0X1XXXB 0X0X1XXXB R/W 0XXX0000B 0XXX0000B R/W 0X0X1XXXB 0X0X1XXXB R/W R/W: Readable/writable AWR0 to AWR3 specify various kinds of wait timing for each chip select area. The function of each bit changes according to the access type (TYP[3:0] bit) setting of the ACR0 to ACR3 registers. 126 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 3 EXTERNAL BUS INTERFACE 3.2 Explanation of Registers of External Bus Interface MB91313A Series ■ Normal Access or a Address/Data Multiplex Access Operation A chip select area determined by either of the following settings for the access type (TYP[3:0] bit) of ACR0 to ACR3 registers becomes the area for normal access or a address/data multiplex access operation. TYP3 TYP2 TYP1 TYP0 Access type 0 0 x x Normal access (asynchronous SRAM, I/O, single ROM/FLASH) 0 1 x x Address data multiplex access (8/16-bit bus width only) The following lists the functions of each AWR0 to AWR3 bit for a normal access or address/data multiplex access area. Since the initial values of registers other than AWR0 are undefined, set them to their initial values before enabling each area with the CSER register. [bit15] Reserved: Reserved bit Be sure to set this bit to "0". [Bit 14 to Bit 12] W14 to W12 = First Access Wait Cycle These bits set the number of auto-wait cycles to be inserted into the first access cycle of each cycle. The initial value of the CS0 area is set to 7 (wait). The initial values of other areas are undefined. W14 W13 W12 First access wait cycle 0 0 0 Auto-wait cycle 0 0 0 1 Auto-wait cycle 1 … … 1 1 0 Auto-wait cycle 6 1 1 1 Auto-wait cycle 7 [bit11 to bit7] Reserved: Reserved bits Always set them to "00000B". CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 127 CHAPTER 3 EXTERNAL BUS INTERFACE 3.2 Explanation of Registers of External Bus Interface MB91313A Series [bit6] W06 = Read → Write Idle Cycle The read → write idle cycle is set to prevent collision of read data and write data on the data bus when a write cycle follows a read cycle. During an idle cycle, all chip select signals are negated and the data terminals maintain the high impedance state. If a write cycle follows a read cycle or an access operation to another chip select area occurs after a read cycle, the specified idle cycle is inserted. Read → write idle cycles W06 0 0 cycle 1 1 cycle [bit5] Reserved: Reserved bit Be sure to set the bit to "0". [bit4] W04 = Write Recovery Cycle The write recovery cycle is set to control the access to a device in which the interval of access subsequently after write access is limited. During a write recovery cycle, all chip select signals are negated and the data terminals maintain the high impedance state. If the write recovery cycle is set to "1" or more, a write recovery cycle is always inserted after write access. W04 Write recovery cycles 0 0 cycle 1 1 cycle [bit3] Reserved: Reserved bit Be sure to set the bit to "1". 128 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 3 EXTERNAL BUS INTERFACE 3.2 Explanation of Registers of External Bus Interface MB91313A Series [bit2] W02 = Address → CSX Delay The address → CSX delay setting is made when a certain type of setup is required for the address when CSX falls or CSX edges are needed for successive accesses to the same chip select area. Set the address and set the delay from ASX output to CS0X to CS3X output. Address → CSX delay W02 0 No delay 1 Delay If no delay is selected by setting "0", assertion of CS0X to CS3X starts at the same timing that ASX is asserted. If successive accesses are made to the same chip select area at this time, assertion of CS0 to CS3X may continue without a change between two access operations. If delay is specified by selecting "1", assertion of CS0X to CS3X starts when the external memory clock SYSCLK output rises. If successive accesses are made to the same chip select area at this point, CS0X to CS3X are negated at a timing between two access operations. If CSX delay is selected, one setup cycle is inserted before asserting the read/write strobe after assertion of the delayed CSX (operation is the same as the CSX → RDX/WRX setup setting of W01). [bit1] W01 = CSnX → RDX/WRX Setup Delay Cycle The CSnX → RDX/WRX setup extension cycle is set to extend the period before the read/write strobe is asserted after CSnX is asserted. At least one setup extension cycle is inserted before the read/write strobe is asserted after CSnX is asserted. CSnX → RDX/WRX setup delay cycle W01 0 0 cycle 1 1 cycle If 0 cycle is selected by setting "0", RDX/WR0X and WR1X are output at the earliest when the external memory clock SYSCLK output rises just after CSn is asserted. WR0X and WR1X may be delayed 1 cycle or more depending on the internal bus state. If 1 cycle is selected by setting "1", RDX/WR0X and WR1X are always output 1 cycle or more later. When successive accesses are made within the same chip select area without negating CSnX, a setup extension cycle is not inserted. If a setup extension cycle for determining the address is required, set the W02 bit and insert the address → CSnX delay. Since CSnX is negated for each access operation, the setup extension cycle is enabled. If the CSnX delay set by W02 is inserted, this setup cycle is always enabled regardless of the setting of the W01 bit. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 129 CHAPTER 3 EXTERNAL BUS INTERFACE 3.2 Explanation of Registers of External Bus Interface MB91313A Series [bit0] W00 = RDX/WRX → CSnX Hold Extension Cycle The RDX/WRX → CSnX hold extension cycle is set to extend the period before negating CSnX after the read/write strobe is negated. One hold extension cycle is inserted before CSnX is negated after the read/write strobe is negated. RDX/WRX → CSnX hold extension cycle W00 0 0 cycle 1 1 cycle If 0 cycle is selected by setting "0", CS0X to CS3X are negated after the hold delay from the rising edge of external memory clock SYSCLK output after RDX/WR0X and WR1X are negated. If 1 cycle is selected by setting "1", CS0X to CS3X are negated one cycle later. When making successive accesses within the same chip select area without negating CSnX, the hold extension cycle is not inserted. If a hold extension cycle for determining the address is required, set the W02 bit and insert the address → CSnX delay. Since CSnX is negated for each access operation, the hold extension cycle is enabled. 130 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 3 EXTERNAL BUS INTERFACE 3.2 Explanation of Registers of External Bus Interface MB91313A Series ■ CSER (Chip Select Enable Register) Figure 3.2-4 Bit Configuration of CSER (Chip Select Enable register) Address bit 000680H 31 30 29 28 Reserved Reserved Reserved Reserved 27 26 25 CSE3 CSE2 CSE1 Initial value When INIT When RST 24 CSE0 00000001B 00000001B Access R/W The chip select enable register enables and disables each chip select area. [bit31 to bit28] Reserved: Reserved bits Be sure to set these bits to "0000B". [bit27 to bit24] CSE3 to CSE0 = Chip Select Area Enable (Chip Select Enable 0 to 3) These bits are the chip select area enable bits for CS0X to CS3X. The initial value is "0001B", which enables only the CS0 area. When "1" is written, a chip select area operates according to the settings of ASR0 to ASR3, ACR0 to ACR3, and AWR0 to AWR3. Before setting this register, be sure to make all settings required for the corresponding chip select areas. CM71-10143-5E CSE3 to CSE0 Area control 0 Disable 1 Enable CSE bit Corresponding CSX Bit [24]: CSE0 CS0X Bit [25]: CSE1 CS1X Bit [26]: CSE2 CS2X Bit [27]: CSE3 CS3X FUJITSU SEMICONDUCTOR LIMITED 131 CHAPTER 3 EXTERNAL BUS INTERFACE 3.3 Chip Select Area 3.3 MB91313A Series Chip Select Area In the external bus interface, a total of four chip select areas can be set. ■ Example of Chip Select Area Setting The address space for each area is in ASR0 to ASR3 (Area Select Register) and ACR0 to ACR3 (Area Configuration Register). CS0X and CS1X can be set in the space assigned to external bus areas between "00000000H" and "003FFFFFH" in units of 64K/128K/256K/512KB. CS2X and CS3X can be set in the space between "00400000H" to "00FFFFFFH" in units of 1M/2M/4M/8MB. When bus access is made to an area specified by these registers, the corresponding chip select signals, CS2X and CS3X, are activated ("L" output) during the access cycle. ● Example of ASR and ASZ[1:0] settings 1. ASR1=0010H ACR1 → ASZ[1:0]=00B Chip select area 1 is assigned to "00100000H" to "0010FFFFH". 2. ASR2=0040H ACR2 → ASZ[1:0]=00B Chip select area 2 is assigned to "00400000H" to "004FFFFFH". 3. ASR3=0081H ACR3 → ASZ[1:0]=11B Chip select area 3 is assigned to "00800000H" to "00FFFFFFH". Since 8 MB is set for ACR → ASZ[1:0] at this point, the unit for boundaries is 8 MB and ASR3[22:16] are ignored. Before there is any writing to ACR0 after a reset, "00000000H" to "00FFFFFFH" is assigned to the chip select area 0. Note: Set the chip select areas so that there is no overlap. Figure 3.3-1 Setting Example of Chip Select Area (Initial value) 00000000H (Example) 00000000H 00100000H Area 1 64 KB 00400000H Area 2 1 MB 00800000H Area 3 8 MB Area 0 00FFFFFFH 132 00FFFFFFH FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 3 EXTERNAL BUS INTERFACE 3.4 Address/Data Multiplex Interface MB91313A Series 3.4 Address/Data Multiplex Interface This section indicates the timing of operation of the address/data multiplex interface. ■ Without External Wait (TYP[3:0]=0100B, AWR=0008H) Figure 3.4-1 Timing Chart of Address/Data Multiplex Interface (Without External Wait) SYSCLK AD[15:0] Address[15:0] ASX CSnX RDX Read AD[15:0] Address[15:0] Data[15:0] WRnX Write AD[15:0] Address[15:0] Data[15:0] • Making a setting such as TYP[3:0]=01xxB in the ACR register enables the address/data multiplex interface to be set. • If the address/data multiplex interface is set, set 8 bits or 16 bits for the data bus width (DBW0 bit). • In the address/data multiplex interface, the total of 3 cycles of 2 address output cycles + 1 data cycle becomes the basic number of access cycles. • In the address output cycles, ASX is asserted as the output address latch signal. However, when the CSnX → RDX/WRnX setup delay (AWR:W01) is set to "0", the multiplex address output cycle consists of only one cycle as shown in the figure above. Since the address cannot be directly latched at the rising edge of ASX, fetch the address at the rising edge of MCLK of the cycle in which "L" is asserted for ASX. When the address is directly latched at the rising edge of ASX, see "Setting of CSnX → RDX/ WRnX setup". • As with a normal interface, the address indicating the start of access is output to AD[15:0] during the time division bus cycle. Use this address if you want to use an address more than 8/16 bits in the address/data multiplex interface. • As with the normal interface, auto-wait (AWR:W14 to W12), read → write idle cycle (AWR:W06), write recovery (AWR:W04), address → CSnX delay (AWR:W02), CSnX → RDX/WRX setup delay (AWR:W01), and RDX/WRX → CSnX hold delay (AWR:W00) can be set. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 133 CHAPTER 3 EXTERNAL BUS INTERFACE 3.4 Address/Data Multiplex Interface MB91313A Series ■ With External Wait (TYP[3:0]=0101B, AWR=1008H) Figure 3.4-2 Timing Chart of Address/Data Multiplex Interface (With External Wait) SYSCLK AD[15:0] Address[15:0] ASX CSnX RDX Read AD[15:0] Address[15:0] Data[15:0] WRnX Write AD[15:0] Data15:0] Address[15:0] External wait Clear RDY Making a setting such as TYP[3:0]=01x1B in the ACR register enables RDY input in the address/data multiplex interface. 134 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 3 EXTERNAL BUS INTERFACE 3.4 Address/Data Multiplex Interface MB91313A Series ■ Setting of CSX → RDX/WRX Setup (TYP[3:0]=0101B, AWR=100BH) Figure 3.4-3 Timing Chart of Address/Data Multiplex Interface (Setting of CSX → RDX/WRX Setup) SYSCLK AD[15:0] Address[15:0] ASX CSnX RDX Read AD[15:0] Address[15:0] Data[15:0] Address[15:0] Data[15:0] WRnX Write AD[15:0] Setting "1" for the CSnX → RDX/WRnX setup delay (AWR:W01) enables the multiplex address output cycle to be extended by 1 cycle as shown in the figure above, allowing the address to be latched directly to the rising edge of ASX. Use this setting if you want to use ASX as an ALE (Address Latch Enable) strobe without using SYSCLK. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 135 CHAPTER 3 EXTERNAL BUS INTERFACE 3.5 DMA Access 3.5 MB91313A Series DMA Access This section indicates the timing of operation of the DMA access. ■ 2-Cycle Transfer (The Timing is the Same as for Internal RAM → External I/O, RAM, External I/O, RAM → Internal RAM.) (TYP[3:0]=0000B, AWR=0008H) Figure 3.5-1 2-Cycle Transfer (Internal RAM → External I/O, RAM) (When no wait is set on the I/O side) SYSCLK AD[15:0] I/O address ASX CSnX (I/O side) WRnX AD[15:0] The bus access is the same as that of the interface for non-DMAC transfer. 136 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 3 EXTERNAL BUS INTERFACE 3.5 DMA Access MB91313A Series ■ 2-Cycle Transfer (External → I/O) (TYP[3:0]=0000B, AWR=0008H) Figure 3.5-2 2-Cycle Transfer (External → I/O) (When memory and I/O wait are not set) SYSCLK AD[15:0] Memory address idle I/O address ASX CSnX RDX CSnX WRnX AD[15:0] The bus access is the same as that of the interface for non-DMAC transfer. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 137 CHAPTER 3 EXTERNAL BUS INTERFACE 3.5 DMA Access MB91313A Series ■ 2-Cycle Transfer (I/O → External) (TYP[3:0]=0000B, AWR=0008H) Figure 3.5-3 2-Cycle Transfer (I/O → External) (When memory and I/O wait are not set) SYSCLK AD[15:0] I/O address idle Memory address ASX CSnX WRnX CSnX RDX AD[15:0] The bus access is the same as that of the interface for non-DMAC transfer. 138 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 3 EXTERNAL BUS INTERFACE 3.6 Register Setting Procedure MB91313A Series 3.6 Register Setting Procedure This section explains the procedure of the register used in the external bus interface. ■ Register Setting Procedure For setting procedure concerning with external bus interface, follow the principle described below. 1. Before rewriting the contents of a register, be sure to set the CSER register so that the corresponding area is set "0". If you change the settings while "1" is set, access before and after the change cannot be guaranteed. 2. Use the following procedure to change a register: (1) Set "0" for the CSER bit corresponding to the applicable area. (2) Set both ASR and ACR at the same time using word access. When accessing ASR and ACR using half word, set ACR after setting ASR. (3) Set AWR. (4) Set the CSER bit corresponding to the applicable area. 3. The CS0X area is enabled after a reset is released. If the area is used as a program area, the register contents need to be rewritten while the CSER bit is "1". In this case, make the settings described in (2) to (3) above in the initial state with a low-speed internal clock. Then, switch the clock to a high-speed clock. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 139 CHAPTER 3 EXTERNAL BUS INTERFACE 3.7 Note on Using External Bus Interface 3.7 MB91313A Series Note on Using External Bus Interface This section explains the note on using the external bus interface. ■ Notes on Using External Bus Interface To mix the area where WR0X and WR1X are used as write strobes (TYP[3:0]=0X0XB) and area where WRnX is used as write strobe (TYP[3:0]=0X1XB), be sure to set the following items for all the areas to be used. (1) Set one or more read → write idle cycles (AWR:W06=1). (2) Set one or more write recovery cycles (AWR:W04=1). These restrictions do not apply if the area where WR0X and WR1X are used as write strobes (TYP[3:0]=0X0XB) is specified but WR0X and WR1X is unavailable (only ROM is connected). The restrictions do not apply if the area where WRX is used as write strobe (TYP[3:0]=0X1XB) is specified and both address → RDX/WRX setup cycle (W01=1) and RDX/WRX → address hold cycle (W00=1) are set. <Reason for the Restrictions> In the area where TYP[3:0]=0X1XB is set and WRnX is used as write strobe, the WR0X/WR1X pins are in form of the byte enable (UBX/LBX) output. In this case, the byte enable output generates the enable signal for each byte location at the same timing as the address and CSX output. Therefore, if an access is made to an area where the WR0X/WR1X pins are used as asynchronous write strobes before or after the operation, the area may not satisfy the AC standard between CSX and WR0X/WR1X, resulting into an error writing. If a read → write idle cycle and write recovery cycle are set, CSX is not asserted (the "H" level is maintained) in these cycles, so the AC standard is satisfied. The restriction does not apply if there is a space for the AC standard (setup and hold) between CSX and WR0X/WR1X in the area where the WR0X/WR1X pins are used as asynchronous write strobes. 140 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 4 I/O PORTS This chapter gives an overview of I/O ports and describes their register configuration and functions. 4.1 Overview of I/O Ports 4.2 Settings of Port Data Registers 4.3 Settings of Data Direction Registers 4.4 Settings of Extra Port Control Registers 4.5 Pull-up Control Register 4.6 External Bus, I2C Bridge, ADER Control Register 4.7 Noise Filter Control Register for I2C CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 141 CHAPTER 4 I/O PORTS 4.1 Overview of I/O Ports 4.1 MB91313A Series Overview of I/O Ports This section gives an overview of the I/O ports of the MB91313A series. ■ Basic Block Diagram of Ports It can be used as an I/O port if the settings are made so that the external bus interfaces or peripherals corresponding to the pins do not use the pins for input/output. Figure 4.1-1 shows a basic block diagram of ports. Figure 4.1-1 Basic Block Diagrams of Ports R-bus CMOS External bus interface input CMOS Schmitt Peripheral input 0 PDR read PCR External bus control output Peripheral output 1 PullUp control Output MUX 33 kΩ Output driver Pin Peripheral output PDR DDR PFR Port Direction control EPFR 142 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 4 I/O PORTS 4.1 Overview of I/O Ports MB91313A Series ■ General Specifications of Ports • Each port has a port data register (PDR) to store output data. A reset does not initialize the PDR register. • Each port has a data direction register (DDR) to switch its data direction between input and output. A reset switches the data direction of all ports to input (DDR=00H). - Port input mode (PFR=0 & EPFR=0 & DDR=0) PDR read :Reads the level at the corresponding external pin. PDR write:Writes a set value to the port data register. - Port output mode (PFR=0 & EPFR=0 & DDR=1) PDR read :Reads a value from the port data register. PDR write:Writes a set value to the port data register to output it to the corresponding external pin. - Peripheral output mode (other settings than PFR=0 & EPFR=0) PDR read :Reads the output value from the peripheral when DDR=0. Reads a value from the port data register when DDR=1. PDR write:Writes a set value to the port data register. - The read-modify-write (RMW) instruction for a port data register reads the register set value irrespective of the state of the corresponding port. - Barring some unique circumstance, the input to a peripheral is always connected to a pin. Usually, use the port input mode for input to a peripheral. • Each port has the pull-up control register, and can set the pull-up of 33 kΩ per pin. • The ports have the port function register (PFR), and some have the extended port function register (EPFR). They mainly control the peripheral output. • In the external bus mode, the pin assigned to the external bus interface invalidates the setting of DDR and PFR, and the function of the bus interface is prioritized. When these pins are used as the generalpurpose port/peripheral output in the external bus mode, set the EPFR and disable the function of the bus interface. • In STOP mode, input is fixed to "0". Note, however, that the external interrupt inputs to their respective pins are not fixed and can be used as interrupts when the interrupts are enabled (with the ENIR bit set and the PFR/EPFR/DDR register selecting the input pins). • Two-way signals of peripherals (the I2C function SOT and SCK of UART) are enabled by the PFR register. For switching between input and output, see the chapter for the relevant peripheral. Notes: • If using the pins as an input resource, make sure that PFR=0 and DDR=0 (port input mode). • There is no register switched between general-purpose port input and peripheral input. The value input via an external pin is always passed to the general-purpose port and peripheral circuit. Even with the DDR output setting, the value output to the outside is always propagated to the general-purpose port and peripheral circuit. For use as a peripheral input, use PER, EPER and DDR input and enable each peripheral’s input signal. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 143 CHAPTER 4 I/O PORTS 4.2 Settings of Port Data Registers 4.2 MB91313A Series Settings of Port Data Registers This section explains the configuration and functions of the port data register. Each port has a port data register (PDR) to store output data. A reset does not initialize the PDR register. ■ Configuration of Port Data Register (PDR) The following figure shows the configuration of the port data register (PDR). Figure 4.2-1 Configuration of Port Data Register (PDR) Address bit PDR0 000000H PDR1 000001H PDR2 000002H PDR3 000003H PDR4 000004H PDR5 000005H PDR6 000006H PDRC 00000CH PDRD 00000DH PDRE 00000EH PDRF 00000FH 7 PDR07 PDR17 PDR27 PDR37 PDR47 PDR57 PDRC7 PDRD7 PDRE7 PDRF7 R/W 6 PDR06 PDR16 PDR26 PDR36 PDR46 PDR56 PDRC6 PDRD6 PDRE6 PDRF6 R/W 5 PDR05 PDR15 PDR25 PDR35 PDR45 PDR55 PDR65 PDRC5 PDRD5 PDRE5 PDRF5 R/W 4 PDR04 PDR14 PDR24 PDR34 PDR44 PDR54 PDR64 PDRC4 PDRD4 PDRE4 PDRF4 R/W 3 PDR03 PDR13 PDR23 PDR33 PDR43 PDR53 PDR63 PDRC3 PDRD3 PDRE3 PDRF3 R/W 2 PDR02 PDR12 PDR22 PDR32 PDR42 PDR52 PDR62 PDRC2 PDRD2 PDRE2 PDRF2 R/W 1 PDR01 PDR11 PDR21 PDR31 PDR41 PDR51 PDR61 PDRC1 PDRD1 PDRE1 PDRF1 R/W 0 PDR00 PDR10 PDR20 PDR30 PDR40 PDR50 PDR60 PDRC0 PDRD0 PDRE0 PDRF0 R/W Initial value XXXXXXXXB XXXXXXXXB XXXXXXXXB XXXXXXXXB XXXXXXXXB XXXXXXXXB --XXXXXXB XXXXXXXXB XXXXXXXXB XXXXXXXXB XXXXXXXXB PDR0 to PDR6, PDRC to PDRF are the I/O data registers for the I/O port. Input/output is controlled by the corresponding DDR0 to DDR6 and DDRC to DDRF. The read-modify-write (RMW) instruction for a port data register reads the register set value irrespective of the state of the corresponding port. 144 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 4 I/O PORTS 4.3 Settings of Data Direction Registers MB91313A Series 4.3 Settings of Data Direction Registers This section explains the configuration and functions of the data direction register. ■ Configuration of Data Direction Register The following figure shows the configuration of the data direction register (DDR). Figure 4.3-1 Configuration of Data Direction Register (DDR) Address bit DDR0 000400H DDR1 000401H DDR2 000402H DDR3 000403H DDR4 000404H DDR5 000405H DDR6 000406H DDRC 00040CH DDRD 00040DH DDRE 00040EH DDRF 00040FH 7 DDR07 DDR17 DDR27 DDR37 DDR47 DDR57 DDRC7 DDRD7 DDRE7 DDRF7 R/W 6 DDR06 DDR16 DDR26 DDR36 DDR46 DDR56 DDRC6 DDRD6 DDRE6 DDRF6 R/W 5 DDR05 DDR15 DDR25 DDR35 DDR45 DDR55 DDR65 DDRC5 DDRD5 DDRE5 DDRF5 R/W 4 DDR04 DDR14 DDR24 DDR34 DDR44 DDR54 DDR64 DDRC4 DDRD4 DDRE4 DDRF4 R/W 3 DDR03 DDR13 DDR23 DDR33 DDR43 DDR53 DDR63 DDRC3 DDRD3 DDRE3 DDRF3 R/W 2 DDR02 DDR12 DDR22 DDR32 DDR42 DDR52 DDR62 DDRC2 DDRD2 DDRE2 DDRF2 R/W 1 DDR01 DDR11 DDR21 DDR31 DDR41 DDR51 DDR61 DDRC1 DDRD1 DDRE1 DDRF1 R/W 0 DDR00 DDR10 DDR20 DDR30 DDR40 DDR50 DDR60 DDRC0 DDRD0 DDRE0 DDRF0 R/W Initial value 00000000B 00000000B 00000000B 00000000B 00000000B 00000000B --000000B 00000000B 00000000B 00000000B 00000000B • Each port has a data direction register (DDR) to switch its data direction between input and output. A reset switches the data direction of all ports to input (DDR=00H). - Port input mode (PFR=0 & EPFR=0 & DDR=0) PDR read : Reads the level at the corresponding external pin. PDR write: Writes a set value to the port data register. - Port output mode (PFR=0 & EPFR=0 & DDR=1) PDR read : Reads a value from the port data register. PDR write: Writes a set value to the port data register to output it to the corresponding external pin. - Peripheral output mode (PFR=1) PDR read : Reads the output value from the corresponding peripheral. PDR write: Writes a set value to the port data register. - Barring some unique circumstance, the input to a peripheral is always connected to a pin. Usually, use the port input mode for input to a peripheral. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 145 CHAPTER 4 I/O PORTS 4.4 Settings of Extra Port Control Registers 4.4 MB91313A Series Settings of Extra Port Control Registers This section describes the functions of port functions registers. ■ Port 0 Port 0 is controlled by PFR0 and EPFR0. In the external bus 16-bit mode, port 0 is AD[7:0] of the bus interface. In other mode, it is assigned to Multi Function serial interface ch.3 to ch.5. Select the input pin in each resource for selectable input signals. Figure 4.4-1 Configuration of Extra Port Control Register (Port 0) Address bit 7 6 5 4 3 2 1 0 Initial value PFR0 000420H PFR07 PFR06 PFR05 PFR04 PFR03 PFR02 PFR01 PFR00 00000000B EPFR0 000520H EPFR07 EPFR06 EPFR05 EPFR04 EPFR03 EPFR02 EPFR01 EPFR00 00000000B R/W R/W R/W R/W R/W R/W R/W R/W 146 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 4 I/O PORTS 4.4 Settings of Extra Port Control Registers MB91313A Series Table 4.4-1 Function of Extra Port Control Register (Port 0) Bit bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 CM71-10143-5E PFR EPFR 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 Function General-purpose port Setting disabled Multi Function Serial Interface5 SOT5 output / SDA5 I/O pin Setting disabled General-purpose port Setting disabled Setting disabled Setting disabled General-purpose port Setting disabled Multi Function Serial Interface4 SCK4 I/O / SCL4 I/O pin Setting disabled General-purpose port Setting disabled Multi Function Serial Interface4 SOT4 output / SDA4 I/O pin Setting disabled General-purpose port Setting disabled Setting disabled Setting disabled General-purpose port Setting disabled Multi Function Serial Interface3 SCK3 I/O / SCL3 I/O pin Setting disabled General-purpose port Setting disabled Multi Function Serial Interface3 SOT3 output / SDA3 I/O pin Setting disabled General-purpose port Setting disabled Setting disabled Setting disabled FUJITSU SEMICONDUCTOR LIMITED 147 CHAPTER 4 I/O PORTS 4.4 Settings of Extra Port Control Registers MB91313A Series ■ Port 1 Port 1 is controlled by PFR1 and EPFR1. In the external bus 8/16-bit mode, port 1 is AD[15:7] of the bus interface. In other mode, it is assigned to multi function serial interface ch.5 to ch.7. Select the input pin in each resource for selectable input signals. Figure 4.4-2 Configuration of Extra Port Control Register (Port 1) Address bit 7 6 5 4 3 2 1 0 Initial value PFR1 000421H PFR17 PFR16 PFR15 PFR14 PFR13 PFR12 PFR11 PFR10 00000000B EPFR1 000521H EPFR17 EPFR16 EPFR15 EPFR14 EPFR13 EPFR12 EPFR11 EPFR10 00000000B R/W R/W R/W R/W R/W R/W R/W R/W Table 4.4-2 Function of Extra Port Control Register (Port 1) Bit bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 148 PFR EPFR 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 Function General-purpose port Setting disabled Setting disabled Setting disabled General-purpose port Setting disabled Multi Function Serial Interface7 SCK7 I/O / SCL7 I/O pin Setting disabled General-purpose port Setting disabled Multi Function Serial Interface7 SOT7 output / SDA7 I/O pin Setting disabled General-purpose port Setting disabled Setting disabled Setting disabled General-purpose port Setting disabled Multi Function Serial Interface6 SCK6 I/O / SCL6 I/O pin Setting disabled General-purpose port Setting disabled Multi Function Serial Interface6 SOT6 output / SDA6 I/O pin Setting disabled General-purpose port Setting disabled Setting disabled Setting disabled General-purpose port Setting disabled Multi Function Serial Interface5 SCK5 I/O / SCL5 I/O pin Setting disabled FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 4 I/O PORTS 4.4 Settings of Extra Port Control Registers MB91313A Series ■ Port 2 Port 2 is controlled by PFR2 and EPFR2. It is assigned to multi function serial interface ch.0 to ch.2. Select the input pin in each resource for selectable input signals. Figure 4.4-3 Configuration of Extra Port Control Register (Port 2) Address bit 7 6 5 4 3 2 1 0 Initial value PFR2 000422H PFR27 PFR26 PFR25 PFR24 PFR23 PFR22 PFR21 PFR20 00000000B EPFR2 000522H EPFR27 EPFR26 EPFR25 EPFR24 EPFR23 EPFR22 EPFR21 EPFR20 11111111B R/W R/W R/W R/W R/W R/W R/W R/W Table 4.4-3 Function of Extra Port Control Register (Port 2) Bit bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 PFR EPFR 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 Function General-purpose port Setting disabled Multi Function Serial Interface2 SOT2 output / SDA2 I/O pin Setting disabled General-purpose port Setting disabled Setting disabled Setting disabled General-purpose port Setting disabled Multi Function Serial Interface1 SCK1 I/O SCL1 I/O pin Setting disabled General-purpose port Setting disabled Multi Function Serial Interface1 SOT1 output / SDA1 I/O pin Setting disabled General-purpose port Setting disabled Setting disabled Setting disabled General-purpose port Setting disabled Multi Function Serial Interface0 SCK0 I/O SCL0 I/O pin Setting disabled General-purpose port Setting disabled Multi Function Serial Interface0 SOT0 output / SDA0 I/O pin Setting disabled General-purpose port Setting disabled Setting disabled Setting disabled When the external bus is not set, it is invalid if it is set to external address output, and the port becomes a general-purpose port. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 149 CHAPTER 4 I/O PORTS 4.4 Settings of Extra Port Control Registers MB91313A Series ■ Port 3 Port 3 is controlled by PFR3 and EPFR3. It is assigned to multi function serial interface ch.2, reload timer 0/1/2 and PWC. Select the input pin in each resource for selectable input signals. Figure 4.4-4 Configuration of Extra Port Control Register (Port 3) Address bit 7 6 5 4 3 2 1 0 Initial value PFR3 000423H PFR37 PFR36 PFR35 PFR34 PFR33 PFR32 PFR31 PFR30 00000000B EPFR3 000523H EPFR37 EPFR36 EPFR35 EPFR34 EPFR33 EPFR32 EPFR31 EPFR30 11111111B R/W R/W R/W R/W R/W R/W R/W R/W Table 4.4-4 Function of Extra Port Control Register (Port 3) Bit bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 PFR EPFR 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 Function General-purpose port Setting disabled Setting disabled Setting disabled General-purpose port Setting disabled Setting disabled Setting disabled General-purpose port Setting disabled Setting disabled Setting disabled General-purpose port Setting disabled Setting disabled Setting disabled General-purpose port Setting disabled Output of reload timer TOT2 Setting disabled General-purpose port Setting disabled Output of reload timer TOT1 Setting disabled General-purpose port Setting disabled Output of reload timer TOT0 Setting disabled General-purpose port Setting disabled Multi Function Serial Interface2 SCK2 I/O SCL2 I/O pin Setting disabled When the external bus is not set, it is invalid if it is set to external address output, and the port becomes a general-purpose port. 150 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 4 I/O PORTS 4.4 Settings of Extra Port Control Registers MB91313A Series ■ Port 4 Port 4 is controlled by PFR4 and EPFR4. It is assigned to the multifunction timer. Select the input pin in each resource for selectable input signals. Figure 4.4-5 Configuration of Extra Port Control Register (Port 4) Address bit 7 6 5 4 3 2 1 0 Initial value PFR4 000424H PFR47 PFR46 PFR45 PFR44 PFR43 PFR42 PFR41 PFR40 00000000B EPFR4 000524H EPFR47 EPFR46 EPFR45 EPFR44 EPFR43 EPFR42 EPFR41 EPFR40 11111111B R/W R/W R/W R/W R/W R/W R/W R/W Table 4.4-5 Configuration of Extra Port Control Register (Port 4) Bit bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 PFR EPFR 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 Function General-purpose port Setting disabled Multi Function Serial Interface10 SCK10 I/O / SCL10 I/O pin Setting disabled General-purpose port Setting disabled Multi Function Serial Interface10 SOT10 I/O / SDA10 I/O pin Setting disabled General-purpose port Setting disabled Setting disabled Setting disabled General-purpose port Setting disabled Setting disabled Setting disabled General-purpose port Setting disabled TMO3 output Setting disabled General-purpose port Setting disabled TMO2 output Setting disabled General-purpose port Setting disabled TMO1 output Setting disabled General-purpose port Setting disabled TMO0 output Setting disabled When the external bus is not set, it is invalid if it is set to external address output, and the port becomes a general-purpose port. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 151 CHAPTER 4 I/O PORTS 4.4 Settings of Extra Port Control Registers MB91313A Series ■ Port 5 Port 5 is controlled by PFR5 and EPFR5. In the external bus mode, it is control pin for the bus interface (CSnX, ASX, RDX, WRnX). In other mode, it is assigned to PPG0 to PPG3. Select the input pin in each resource for selectable input signals. Figure 4.4-6 Configuration of Extra Port Control Register (Port 5) Address bit 7 6 5 4 3 2 1 0 Initial value PFR5 000425H PFR57 PFR56 PFR55 PFR54 PFR53 PFR52 PFR51 PFR50 00000000B EPFR5 000525H EPFR57 EPFR56 EPFR55 EPFR54 EPFR53 EPFR52 EPFR51 EPFR50 11111111B R/W R/W R/W R/W R/W R/W R/W R/W Table 4.4-6 Function of Extra Port Control Register (Port 5) Bit bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 PFR EPFR 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 Function General-purpose port Write strobe 1 (WR1X) output (Enabled when the external bus is set) Setting disabled Setting disabled General-purpose port Write strobe 0 (WR0X) output (Enabled when the external bus is set) Setting disabled Setting disabled General-purpose port Read strobe (RDX) output (Enabled when the external bus is set) Setting disabled Setting disabled General-purpose port Address strobe (ASX) output (Enabled when the external bus is set) Setting disabled Setting disabled General-purpose port Chip select 3 (CS3X) output (Enabled when the external bus is set) PPG3 output Setting disabled General-purpose port Chip select 2 (CS2X) output (Enabled when the external bus is set) PPG2 output Setting disabled General-purpose port Chip select 1 (CS1X) output (Enabled when the external bus is set) PPG1 output Setting disabled General-purpose port Chip select 0 (CS0X) output (Enabled when the external bus is set) PPG0 output Setting disabled When the external bus is not set, it is invalid if it is set to external control output, and the port becomes a general-purpose port. 152 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 4 I/O PORTS 4.4 Settings of Extra Port Control Registers MB91313A Series ■ Port 6 Port 6 is controlled by PFR6 and EPFR6. In the external bus mode, it is control pin for the bus interface (RDY, CLK). In other mode, it is assigned to reload timer. Select the input pin in each resource for selectable input signals. Figure 4.4-7 Configuration of Extra Port Control Register (Port 6) Address bit PFR6 000426H EPFR6 000526H 7 R/W 6 R/W 5 4 3 2 1 0 Initial value PFR65 PFR64 PFR63 PFR62 PFR61 PFR60 --000000B EPFR65 EPFR64 EPFR63 EPFR62 EPFR61 EPFR60 --001000B R/W R/W R/W R/W R/W R/W Table 4.4-7 Function of Extra Port Control Register (Port 6) Bit bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 PFR EPFR 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 Function Ignored Ignored Ignored Ignored Ignored Ignored Ignored Ignored General-purpose port Setting disabled Setting disabled Setting disabled General-purpose port Setting disabled Setting disabled Setting disabled General-purpose port CLK output (Enabled when the external bus is set) Setting disabled Setting disabled General-purpose port RDY input TOT5 output Setting disabled General-purpose port Setting disabled TOT4 output Setting disabled General-purpose port Setting disabled TOT3 output Setting disabled When the external bus is not set, it is invalid if it is set to external control output, and the port becomes a general-purpose port. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 153 CHAPTER 4 I/O PORTS 4.4 Settings of Extra Port Control Registers MB91313A Series ■ Port C Port C is controlled by PFRC and EPFRC. It is also used for PPG and multi function serial interface ch.9. Figure 4.4-8 Configuration of Extra Port Control Register (Port C) Address bit 7 6 5 4 3 2 1 0 Initial value PFRC 00042CH PFRC7 PFRC6 PFRC5 PFRC4 PFRC3 PFRC2 PFRC1 PFRC0 00000000B EPFRC 00052CH EPFRC7 EPFRC6 EPFRC5 EPFRC4 EPFRC3 EPFRC2 EPFRC1 EPFRC0 00000000B R/W R/W R/W R/W R/W R/W R/W R/W Table 4.4-8 Function of Extra Port Control Register (Port C) Bit bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 154 PFR EPFR 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 Function General-purpose port Setting disabled Setting disabled Setting disabled General-purpose port Setting disabled Setting disabled Setting disabled General-purpose port Setting disabled PPGB (PPG2 & PPG3) output Setting disabled General-purpose port Setting disabled PPGA (PPG0 & PPG1) output Setting disabled General-purpose port Setting disabled Setting disabled Setting disabled General-purpose port Setting disabled Multi Function Serial Interface9 SCK9 I/O SCL9 I/O pin Setting disabled General-purpose port Setting disabled Multi Function Serial Interface9 SOT9 input / SDA9 I/O pin Setting disabled General-purpose port Setting disabled Setting disabled Setting disabled FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 4 I/O PORTS 4.4 Settings of Extra Port Control Registers MB91313A Series ■ Port D Port D is controlled by PFRD and EPFRD. It is also used for an analog input of the A/D converter. The port setting is disabled if the corresponding bit is set in the ADER register, and the port becomes an analog input pin. In this case, all the input values to the pin are handled as "0". Select the input pin in each resource for selectable input signals. Figure 4.4-9 Configuration of Extra Port Control Register (Port D) Address bit 7 6 5 4 3 2 1 0 Initial value 00042D 00000000 PFRD H PFRD7 PFRD6 PFRD5 PFRD4 PFRD3 PFRD2 PFRD1 PFRD0 B EPFRD 00052DH EPFRD7 EPFRD6 EPFRD5 EPFRD4 EPFRD3 EPFRD2 EPFRD1 EPFRD0 00000000B R/W R/W R/W R/W R/W R/W R/W R/W Table 4.4-9 Function of Extra Port Control Register (Port D) Bit bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 CM71-10143-5E PFR EPFR 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 Function General-purpose port Setting disabled Setting disabled Setting disabled General-purpose port Setting disabled Setting disabled Setting disabled General-purpose port Setting disabled Setting disabled Setting disabled General-purpose port Setting disabled Setting disabled Setting disabled General-purpose port Setting disabled Setting disabled Setting disabled General-purpose port Setting disabled Setting disabled Setting disabled General-purpose port Setting disabled Setting disabled Setting disabled General-purpose port Setting disabled Setting disabled Setting disabled FUJITSU SEMICONDUCTOR LIMITED 155 CHAPTER 4 I/O PORTS 4.4 Settings of Extra Port Control Registers MB91313A Series Note: By default, the ADER register is set to A/D analog input. If using other function than analog input, clear the settings of the ADER register. 156 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 4 I/O PORTS 4.4 Settings of Extra Port Control Registers MB91313A Series ■ Port E Port E is controlled by PFRE and EPFRE. It is also used for an analog input and PPG of the multi function serial interface ch.8 and A/D converter. The port setting is disabled if the corresponding bit is set in the ADER register, and the port becomes an analog input pin. In this case, all the input values to the pin are handled as "0". Select the input pin in each resource for selectable input signals. Figure 4.4-10 Configuration of Extra Port Control Register (Port E) Address bit 7 6 5 4 3 2 1 0 Initial value PFRE 00042EH PFRE7 PFRE6 PFRE5 PFRE4 PFRE3 PFRE2 PFRE1 PFRE0 00000000B EPFRE 00052EH EPFRE7 EPFRE6 EPFRE5 EPFRE4 EPFRE3 EPFRE2 EPFRE1 EPFRE0 00000000B R/W R/W R/W R/W R/W R/W R/W R/W Table 4.4-10 Function of Extra Port Control Register (Port E) Bit bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 CM71-10143-5E PFR EPFR 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 Function General-purpose port Setting disabled Multi Function Serial Interface8 SCK8 I/O SCL8 I/O pin Multi Function Serial Interface8 SCK8 / SOL8 pseudo open drain output General-purpose port Setting disabled Multi Function Serial Interface8 SOT8 output / SDA8 I/O pin Multi Function Serial Interface8 SOT8 / SDA8 pseudo open drain output General-purpose port Setting disabled Setting disabled Setting disabled General-purpose port Setting disabled PPG3 output UART PPG3 pseudo open drain output General-purpose port Setting disabled PPG2 output UART PPG2 pseudo open drain output General-purpose port Setting disabled PPG1 output UART PPG1 pseudo open drain output General-purpose port Setting disabled PPG0 output UART PPG0 pseudo open drain output General-purpose port Setting disabled Setting disabled Setting disabled FUJITSU SEMICONDUCTOR LIMITED 157 CHAPTER 4 I/O PORTS 4.4 Settings of Extra Port Control Registers MB91313A Series ■ Port F Port E is controlled by PFRF and EPFRF. It is also used for an analog input of the CEC and remote control 0, 1. Figure 4.4-11 Configuration of Extra Port Control Register (Port F) Address bit 7 6 5 4 3 2 1 0 Initial value PFRF 00042FH PFRF7 PFRF6 PFRF5 PFRF4 PFRF3 PFRF2 PFRF1 PFRF0 00000000B EPFRF 00052FH EPFRF7 EPFRF6 EPFRF5 EPFRF4 EPFRF3 EPFRF2 EPFRF1 EPFRF0 00000000B R/W R/W R/W R/W R/W R/W R/W R/W Table 4.4-11 Function of Extra Port Control Register (Port F) Bit bit7 bit6 bit5 bit4 bit3 bit2 PFR EPFR 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 1 1 0 1 0 Function General-purpose port Setting disabled Setting disabled Setting disabled General-purpose port Setting disabled Multi Function Serial Interface SOT input / SDA I/O pin Setting disabled General-purpose port Setting disabled Setting disabled Setting disabled General-purpose port Setting disabled Setting disabled Setting disabled General-purpose port Setting disabled HDMI-CEC1 ACK output* Setting disabled General-purpose port Setting disabled HDMI-CEC0 ACK output* 1 1 Setting disabled 0 0 General-purpose port 0 1 Setting disabled bit1 1 0 HDMI-CEC1 input/output (pseudo open drain) 1 1 Setting disabled 0 0 General-purpose port 0 1 Setting disabled bit0 1 0 HDMI-CEC0 input/output (pseudo open drain) 1 1 Setting disabled *: The ACK output is only available on the MB91F313A. This setting is prohibited on the MB91F313. 158 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E MB91313A Series CHAPTER 4 I/O PORTS 4.4 Settings of Extra Port Control Registers Note: Only set HDMI-CEC input/output mode when using HDMI-CEC mode. Set as a general-purpose port and set as an input in the DDRF register when using remote control reception mode. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 159 CHAPTER 4 I/O PORTS 4.5 Pull-up Control Register 4.5 MB91313A Series Pull-up Control Register Pins can be added with a 33 kΩ pull-up resistor. This function can be controlled by software using the bit for each pin. ■ Pull-up Control The pull-up function is controlled by the port pull-up control register (PCR). Pin pull-up control is disabled automatically in the following cases: • Port in the output state • STOP mode output Hi-Z is selected ■ Port Pull-Up Control Register Table 4.5-1 shows the settings of port pull-up/pull-down control registers. The setting of each bit is valid only with the corresponding PCR bit set. Ports P07 to P00, P17 to P10, P57 to P50, and P65 to P60 can be available for the pull-up control. Each port has the corresponding bit. Table 4.5-1 Settings of Port Pull-up/Pull-down Control Registers Port Pull-Up/Pull-Down Control Register Bit PCRxy 0 (Initial Value) 1 No pull-up Pull-up Figure 4.5-1 Configuration of Port Pull-Up Control Register Address bit 7 6 5 4 PCR0 000500H PCR07 PCR06 PCR05 PCR04 PCR1 000501H PCR17 PCR16 PCR15 PCR14 PCR5 000505H PCR57 PCR56 PCR55 PCR54 PCR6 000506H PCR65 PCR64 160 3 PCR03 PCR13 PCR53 PCR63 2 PCR02 PCR12 PCR52 PCR62 1 PCR01 PCR11 PCR51 PCR61 FUJITSU SEMICONDUCTOR LIMITED 0 PCR00 PCR10 PCR50 PCR60 Initial value 00000000B 00000000B 00000000B --000000B CM71-10143-5E CHAPTER 4 I/O PORTS 4.6 External Bus, I2C Bridge, ADER Control Register MB91313A Series 4.6 External Bus, I2C Bridge, ADER Control Register This function enables the external bus. This function can be controlled by software using the bit for each pin. ■ ADER: External Bus, I2C Bridge, ADER Control Register Figure 4.6-1 Configuration of External Bus, I2C Bridge, ADER Control Register Address bit 000570H bit 15 14 13 12 EXT 11 10 9 8 Initial value I2CBR12 I2CBR01 ADER9 ADER8 00000011B 7 6 5 4 3 2 1 0 ADER7 ADER6 ADER5 ADER4 ADER3 ADER2 ADER1 ADER0 11111111B [bit15 to bit12] EXT: External bus control Writing "1010B" to this bit enables the external bus function. The procedure is as follows: •Set the necessary functions in the PFR and EPFR register from port 2 to 5. •Set the external bus interface (640H to 687H). •Writing "1010B" to this bit enables the external bus. •The data bus of port 0 and 1 corresponds to the mode register setting and the bus width specified in the external bus interface. •8-bit bus width: Port 1 is the data bus. •16-bit bus width: Port 1 and 0 are the data bus. •It serves as a single chip unless this register is set. Therefore, set 8 bit or 16 bit of the data bus width for the mode register. [bit11,bit10] I2CBR12,I2CBR01: I2C bridge function Setting this bit (=1) enables the I2C pin to be bridged. •If set I2CBR12, P24=P27 and P25=P30 are short-circuited inside the chip. •If set I2CBR01, P21=P24 and P22=P25 are short-circuited inside the chip. •If set both, P21=P24=P27 and P22=P25=P30 are short-circuited inside the chip. [bit9 to bit0] ADER9 to ADER0: A/D input enable The PD0 to PD7, PE0, and PE1 pins are also used for the A/D converter input. Set the corresponding bit if used for the A/D analog input. Setting this bit (=1) fixes the input gate inside the chip to "0". If using other function than analog input, clear this bit (=0). With this register, be sure to use half word (16 bit) for access. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 161 CHAPTER 4 I/O PORTS 4.7 Noise Filter Control Register for I2C 4.7 MB91313A Series Noise Filter Control Register for I2C This section explains the noise filter control register for I2C. ■ NSF: Noise Filter Control Register for I2C Figure 4.7-1 Configuration of Noise Filter Control Register for I2C Address 000578H bit 15 bit 7 NSF7 14 6 NSF6 13 5 NSF5 12 4 NSF4 11 3 NSF3 10 NSF10 2 NSF2 9 NSF9 1 NSF1 8 NSF8 0 NSF0 Initial value -----000B 00000000B [bit10 to bit0] NSF10 to NSF0: Noise filter enable bit for I2C NSFn Operation 0 Noise filter disabled 1 Noise filter enabled (n = 0 to 10) Set the value to "1" only if used with 100 kbps or faster environment. With this register, be sure to use half word (16 bit) for access. 162 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 5 16-BIT RELOAD TIMER This chapter explains an overview, register configuration/functions and operations of the 16-bit reload timer. 5.1 Overview of 16-Bit Reload Timer 5.2 Registers of 16-Bit Reload Timer 5.3 Operations of 16-Bit Reload Timer 5.4 Operating Status of Counter 5.5 Notes on Using 16-Bit Reload Timer CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 163 CHAPTER 5 16-BIT RELOAD TIMER 5.1 Overview of 16-Bit Reload Timer 5.1 MB91313A Series Overview of 16-Bit Reload Timer The 16-bit reload timer consists of a 16-bit down counter, a 16-bit reload register, a prescaler for creating internal count clock, and a control register. ■ Overview of 16-Bit Reload Timer This series has three built-in channels (0 to 2), for the 16-bit reload timer. ch.0 to ch.2 can activate the DMA transfer via interrupt. The input clock can be selected from three internal clocks (machine clock divided by 2, 8, and 32) and an external clock. The output pin (TOUT) provides a toggle output waveform each time an underflow occurs (in reload mode), or a rectangular wave that indicates that counting is in progress (in one shot mode). The input pin (TIN) can be used for event input in the external event count mode, and trigger or gate input in the internal clock mode. The external event count function, when used in the reload mode, can be used as a clock frequency divider for the external clock mode. ■ Block Diagram Figure 5.1-1 shows a block diagram of the 16-bit reload timer. Figure 5.1-1 Block Diagram of 16-Bit Reload Timer 16-bit reload register (TMRLR) Reload R-bus 16-bit down counter (TMR) RELD UF OUTL OUT CTL Count enable INTE AND Clock selector CSL1 CSL0 EXCK Prescaler Prescaler clear UF CNTE IRQ TRG to port IN CTL MOD2 MOD1 MOD0 External trigger select External trigger input φ 164 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 5 16-BIT RELOAD TIMER 5.2 Registers of 16-Bit Reload Timer MB91313A Series 5.2 Registers of 16-Bit Reload Timer This section explains the configurations and functions of the registers used by the 16bit reload timer. ■ Register List of 16-Bit Reload Timer Figure 5.2-1 Register List of 16-Bit Reload Timer bit 15 14 13 12 Reserved Reserved Reserved Reserved 11 10 9 8 CSL1 CSL0 MOD2 MOD1 Control status register (TMCSR) bit 7 6 5 4 3 2 1 0 MOD0 Reserved OUTL RELD INTE UF CNTE TRG bit15 bit0 16-bit timer register (TMR) bit15 bit0 16-bit reload register (TMRLR) CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 165 CHAPTER 5 16-BIT RELOAD TIMER 5.2 Registers of 16-Bit Reload Timer 5.2.1 MB91313A Series Control Status Register (TMCSR) The control status register (TMCSR) controls the operating modes and interrupts of the 16-bit reload timer. ■ Bit Configuration of Control Status Register (TMCSR) Figure 5.2-2 Bit Configuration of Control Status Register (TMCSR) TMCSR Address bit 15 ch.0 00004EH ch.1 000056H ch.2 00005EH 14 13 12 Reserved Reserved Reserved Reserved 11 10 9 8 Initial value CSL1 CSL0 MOD2 MOD1 00000000B R R R R R/W R/W R/W R/W 7 6 5 4 3 2 1 0 Initial value MOD0 Reserved OUTL RELD INTE UF CNTE TRG 00000000B R/W R/W R/W R/W R/W R/W R/W R/W bit R/W : Readable/Writable R: Read only Rewrite the bit other than UF, CNTE, and TRG bits if CNTE=0. The control status register (TMCSR) supports simultaneous writing. The following explains bit functions of control status register (TMCSR). [bit15 to bit12] Reserved: Reserved bits The read value is always "0000B". [bit11, bit10] CSL1, CSL0 (Count clock SeLect) These bits are the count clock select bits. Table 5.2-1 shows the clock sources that can be selected using these bits. Countable edges used when external event count mode is set are set by the MOD1 and MOD0 bits. Table 5.2-1 Clock Sources Set Using the CSL Bits CSL1 CSL0 Clock Source (φ: Machine Clock) 0 0 φ/21 0 1 φ/23 1 0 φ/25 1 1 External clock (event) Note: 166 The minimum pulse width required for an external clock is 2T (T: Peripheral machine clock cycle). FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 5 16-BIT RELOAD TIMER 5.2 Registers of 16-Bit Reload Timer MB91313A Series [bit9 to bit7] MOD2, MOD1, MOD0 (MODe) These bits set the operating modes and functions of the I/O pin. The MOD2 bit selects the functions of the input pin. If this bit is "0", the input pin becomes the trigger input pin. When a valid edge is input, the contents of the reload register are loaded into the counter and the count operation is continued. Setting this bit to "1" enters the gate count mode. The input pin becomes the gate input, and the count operation is performed only when a valid level is being input. The MOD1 and MOD0 bits set the pin function for each mode. Table 5.2-2 and Table 5.2-3 show the settings of the MOD2, MOD1, and MOD0 bits. Table 5.2-2MOD2, MOD1, and MOD0 Setting Method 1 (in Internal Clock Mode (CSL0, CSL1=00B, 01B, 10B)) MOD2 MOD1 MOD0 Input Pin Function Valid Edge, Level 0 0 0 Trigger disabled - 0 0 1 0 1 0 0 1 1 1 × 0 Rising edge Trigger input Falling edge Both edges "L" level Gate input 1 × 1 "H" level Table 5.2-3MOD2, MOD1, and MOD0 Setting Method 2 (in Event Count Mode (CSL0, CSL1=11B)) MOD2 MOD1 MOD0 Input Pin Function Valid Edge, Level 0 0 - - 0 1 1 0 1 1 Rising edge × Note: Event input Falling edge Both edges × in this table represents any value. [bit6] Reserved: Reserved bit The read value is always "0". CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 167 CHAPTER 5 16-BIT RELOAD TIMER 5.2 Registers of 16-Bit Reload Timer MB91313A Series [bit5] OUTL This bit sets the output level of the TOUT pin. The pin level is reversed depending on whether this bit is "0" or "1". This bit, bit4 (RELD bit), and the corresponding bit of the PFR register of the I/O port are combined to specify the output waveform. Table 5.2-4 shows the setting of a combination of these bits. Table 5.2-4 Setting of PFR, RELD, and OUTL PFR OUTL RELD 0 × × General-purpose port 1 0 0 Rectangular wave of "H" during counting 1 1 0 Rectangular wave of "L" during counting 1 0 1 Toggle output of "L" at count start 1 1 1 Toggle output of "H" at count start Note: Output waveform PFR is the corresponding bit of the PFR register of the I/O port [bit4] RELD This bit is the reload enable bit."1" turns on the reload mode. As soon as the counter value underflows from "0000H" → "FFFFH", the contents of the reload register are loaded into the counter and the count operation is continued. If this bit is set to "0", the count operation is stopped when the counter value underflows from "0000H" → "FFFFH". [bit3] INTE This bit is an interrupt request enable bit. If the INTE bit is set to "1," an interrupt request is generated when the UF bit is set to "1."If it is set to "0", no interrupt request is generated. [bit2] UF This bit is the timer interrupt request flag. This bit is set to "1" when the counter value underflows from "0000H" → "FFFFH". Writing "0" clears the flag. Writing "1" to this bit has no effect on the operations. For a read-modify-write (RMW) instruction, "1" is always read. [bit1] CNTE This bit is the count enable bit of the timer. Write "1" to this bit to enter the activation trigger wait state. Writing "0" to this bit stops the count operation. [bit0] TRG This bit is the software trigger bit. Writing "1" to this bit generates a software trigger, loads the contents of the reload register into the counter, and starts the count operation. Writing "0" to this bit has no effect on the operations. Reading value is always "0". The trigger input to this register is valid only if CNTE=1. 168 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 5 16-BIT RELOAD TIMER 5.2 Registers of 16-Bit Reload Timer MB91313A Series 5.2.2 16-Bit Timer Register (TMR) The 16-bit timer register (TMR) can be used to read the count value of the 16-bit timer. The initial value is undefined. Be sure to read this register using a 16-bit data transfer instruction. ■ Bit Configuration of 16-Bit Timer Register (TMR) Figure 5.2-3 shows the bit configuration of the 16-bit timer register (TMR). Figure 5.2-3 Bit Configuration of 16-Bit Timer Register (TMR) TMR bit0 ~ ~ ~ ~ Address: ch.0 00004AH bit15 ch.1 000052H ch.2 00005AH R Initial value X R X R X R X ... ... R X R X R X R X R X R: Read only CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 169 CHAPTER 5 16-BIT RELOAD TIMER 5.2 Registers of 16-Bit Reload Timer 5.2.3 MB91313A Series 16-Bit Reload Register (TMRLR) The 16-bit reload register (TMRLR) holds the initial value of a counter. The initial value is undefined. Be sure to write the value to this register using a 16-bit data transfer instruction. ■ Bit Configuration of 16-Bit Reload Register (TMRLR) Figure 5.2-4 shows the bit configuration of the 16-bit reload register (TMRLR). Figure 5.2-4 Bit Configuration of 16-Bit Reload Register (TMRLR) TMRLR bit0 ~ ~ ~ ~ Address: ch.0 000048H bit15 ch.1 000050H ch.2 000058H W Initial value X W X W X W X ... ... W X W X W X W X W X W: Write only 170 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 5 16-BIT RELOAD TIMER 5.3 Operations of 16-Bit Reload Timer MB91313A Series 5.3 Operations of 16-Bit Reload Timer This section explains the following operations of the 16-bit reload timer: • Internal clock operation • Underflow operation • Input pin function operation • Output pin function operation ■ Internal Clock Operation If the timer operates with a division clock of the internal clock, one of the clocks created by dividing the machine clock by 2, 8, or 32 can be selected as the clock source. The external input pin can be used for the trigger input or gate input depending on the register setting. To start the count operation as soon as counting is enabled, write "1" to the CNTE and TRG bits of the control status register. Trigger input due to the TRG bit is always valid regardless of the operating mode, when the timer is running (CNTE=1). Figure 5.3-1 shows the activation and operations of the counter. Time as long as T (T: peripheral clock machine cycle) is required after the counter activation trigger is input and before the data of the reload register is actually loaded into the counter. Figure 5.3-1 Activation and Operations of the Counter Count clock Reload data Counter -1 -1 -1 Data load CNTE (bit) TRG (bit) T CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 171 CHAPTER 5 16-BIT RELOAD TIMER 5.3 Operations of 16-Bit Reload Timer MB91313A Series ■ Underflow Operation Underflow is an event in which the counter value changes from "0000H" to "FFFFH". Thus, an underflow occurs at the count of [Reload register setting value +1]. If the RELD bit of the control status register (TMCSR) is set to "1" when an underflow occurs, the contents of the 16-bit reload register (TMRLR) are loaded into the counter and the count operation is continued. If the RELD bit is set to "0", the counter stops at "FFFFH". The underflow sets the UF bit of the control status register (TMCSR). If the INTE bit is set to "1," an interrupt request is generated. Figure 5.3-2 shows the timing chart of the underflow operation. Figure 5.3-2 Timing Chart of the Underflow Operation When [RDRF=1] Count clock Counter 0000H Reload data 0000H FFFFH -1 -1 -1 Data load Underflow set When [RELD=0] Count clock Counter Underflow set 172 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 5 16-BIT RELOAD TIMER 5.3 Operations of 16-Bit Reload Timer MB91313A Series ■ Operation of Input Pin Function (in Internal Clock Mode) If an internal clock is selected as the clock source, the TIN pin can be used as the trigger input or gate input. ● Operation of Trigger Input If the pin is used as the trigger input when a valid edge is input, the contents of the 16-bit reload register (TMRLR) are loaded into the counter, the internal prescaler is cleared, and the count operation is started. Input the pulse with 2T (T is peripheral clock machine cycle) or more for TIN. Figure 5.3-3 shows the timing chart of the trigger input operation. Figure 5.3-3 Timing Chart of the Trigger Input Operation Count clock TIN Rising edge detection Prescaler clear Counter -1 Reload data -1 -1 -1 Load 2T to 2.5T ● Operation of Gate Input If the pin is used as the gate input, the count operation is performed only while the valid level, set by the MOD0 bit of the control status register (TMCSR), is input from the TIN pin. In this case, the count clock keeps operating. In the gate mode, the software trigger is available, regardless of the gate level. The pulse width for the TIN pin should be 2T (T is peripheral clock machine cycle) or more. Figure 5.3-4 shows the timing chart of the gate input operation. Figure 5.3-4 Timing Chart of the Gate Input Operation Count clock When the MOD0 bit = 1 (Count during input of "H") TIN Counter -1 -1 -1 ■ External Event Count Operation If an external clock is selected, the TIN pin becomes the external event input pin, and the valid edge set by the register is counted. The pulse width for the TIN pin should be 2T (T is peripheral clock machine cycle) or more. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 173 CHAPTER 5 16-BIT RELOAD TIMER 5.3 Operations of 16-Bit Reload Timer MB91313A Series ■ Output Pin Function Operation The TOT pin provides a toggle output that is inverted by an underflow (in reload mode), or a pulse output that indicates that counting is in progress (in one shot mode). The output polarity can be set using the OUTL bit of the control status register (TMCSR). If OUTL=0, toggle output is "0" for the initial value, and the one-shot pulse output is "1" while the count operation is in progress. If OUTL=1, the output waveform is reversed. Figure 5.3-5 shows the timing chart of the output pin function operation. Figure 5.3-5 Timing Chart of the Output Pin Function Operation When [RELD=1, OUTL=0] Count activation Underflow Inverted at OUTL=1 TOUT GeneralCNTE purpose port Activation trigger When [RELD=0, OUTL=0] Count activation Underflow TOUT Inverted at OUTL=1 GeneralCNTE purpose port Activation trigger Activation trigger waiting state ■ Other Operations Ch.0 to ch.2 of the 16-bit reload timer can be used to activate the DMA transfer with its interrupt request signal. The DMA controller clears the interrupt flag of the reload timer at the time of the reception of a transfer request. 174 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 5 16-BIT RELOAD TIMER 5.4 Operating Status of Counter MB91313A Series 5.4 Operating Status of Counter The counter state is determined by the CNTE bit of the control status register (TMCSR) and the WAIT signal, which is an internal signal. The states that can be set include the stop state, when CNTE=0 and WAIT=1 (STOP state); the activation trigger wait state, when CNTE=1 and WAIT=1 (WAIT state); and the operation state, when CNTE=1 and WAIT=0 (RUN state). ■ Operating Status of Counter Figure 5.4-1 shows the transition of each state. Figure 5.4-1 Counter State Transition Reset State transition by hardware State transition by register access STOP CNTE=0, WAIT=1 TIN: Input disabled TOUT: General-purpose port Counter: Holds the value when it stops Undefined just after reset CNTE=0 WAIT CNTE=0 CNTE=1 CNTE=1 TRG=0 TRG=1 CNTE=1, WAIT=1 RUN TIN: Only trigger input enabled CNTE=1, WAIT=0 TIN:Serves as TIN TOUT: Initial value output TOUT:Serves as TOUT RELD·UF Counter: Holds the value when it stops Counter: operation Undefined just after reset and until data is loaded TRG=1 TRG=1 RELD·UF LOAD Trigger from TIN CM71-10143-5E CNTE=1, WAIT=0 Loads contents of reload register into counter FUJITSU SEMICONDUCTOR LIMITED Load completed 175 CHAPTER 5 16-BIT RELOAD TIMER 5.5 Notes on Using 16-Bit Reload Timer 5.5 MB91313A Series Notes on Using 16-Bit Reload Timer This section explains the precautions when using the 16-bit reload timer. ■ Notes on Using 16-Bit Reload Timer ● Internal prescaler The internal prescaler is enabled if a trigger (software or external trigger) is applied while bit1 (timer enable: CNTE) of the control status register (TMCSR) is set to "1". Even if used only with the gate count mode, be sure to assign a trigger before inputting the valid gate level. It is recommended that "1" is written to bit0 (TRG) of the TMCSR register when setting CNTE. ● Timing of setting and clearing the interrupt request flag If the device attempts to set and clear the interrupt request flag at the same time, the flag is set and the clear operation becomes ineffective. ● 16-bit timer register (TMR) / 16-bit reload register (TMRLR) If the device attempts to write to the 16-bit timer register and reload the data into the 16-bit reload register at the same time, old data is loaded into the counter. New data is loaded into the counter only in the next reload timing. ● 16-bit timer register (TMR) If the device attempts to load and count the 16-bit timer register at the same time, the load (reload) operation takes precedence. 176 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 6 PPG (PROGRAMMABLE PULSE GENERATOR) This chapter gives an outline of the PPG (Programmable Pulse Generator) timer and explains the register configuration and functions and the timer operations. 6.1 Outline of the PPG Timer 6.2 Operation of the PPG Timer 6.3 Precautions on Using the PPG Timer CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 177 CHAPTER 6 PPG (PROGRAMMABLE PULSE GENERATOR) 6.1 Outline of the PPG Timer 6.1 MB91313A Series Outline of the PPG Timer The PPG timer can efficiently output highly accurate PWM waveforms. The MB91313A series has four channels of the PPG timer. ■ Characteristics of PPG Timer • Each channel consists of a 16-bit down counter, 16-bit data register with a cycle setting buffer, 16-bit compare register with a duty setting buffer, and pin control block. • One of the four count clocks can be selected for the 16-bit down counter: Peripheral clocks: φ, φ/4, φ/16, and φ/64 • A reset or counter borrow can initialize the counter value to "FFFFH". • Each channel has PPG output (PPG0 to PPG3). • Registers Cycle setting register : Data register for reload with buffer Data is transferred from the buffer when an activation trigger signal is detected and a counter borrow occurs. The PPG output is inverted when a counter borrow occurs. Duty setting register : Compare register with buffer PPG output is inverted when the value of this register and the counter value match. • Pin control Set to "1" when the duty matches (priority). Reset to "0" when a counter borrow occurs. Output-value fixed mode is available to facilitate output of all-L (or H). The polarity can be specified. • An interrupt request can be generated as one of the following combinations: Activation of PPG timer (software trigger or trigger input) Generation of counter borrow (cycle match) Generation of duty match Generation of counter borrow (cycle match) or duty match • Restart during operation can be set. • Remote control sending is supported. 178 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 6 PPG (PROGRAMMABLE PULSE GENERATOR) 6.1 Outline of the PPG Timer MB91313A Series ■ Registers Figure 6.1-1 Registers of PPG Address bit15 bit0 000120H PDUT0 R ch.0 Duty setting register 000122H PCSR0 W ch.0 Cycle setting register 000124H PTMR0 W ch.0 Timer register 000126H 000127H PCNH0 PCNL0 R/W ch.0 Control status register 000128H PDUT1 R ch.1 Duty setting register 00012AH PCSR1 W ch.1 Cycle setting register 00012CH PTMR1 W ch.1 Timer register 00012EH PCNH1 PCNL1 R/W ch.1 Control status register 000130H PDUT2 R ch.2 Duty setting register 000132H PCSR2 W ch.2 Cycle setting register 000134H PTMR2 W ch.2 Timer register 000136H PCNH2 PCNL2 R/W ch.2 Control status register 000138H PDUT3 R ch.3 Duty setting register 00013AH PCSR3 W ch.3 Cycle setting register 00013CH PTMR3 W ch.3 Timer register 00013EH CM71-10143-5E PCNH3 PCNL3 R/W ch.3 Control status register FUJITSU SEMICONDUCTOR LIMITED 179 CHAPTER 6 PPG (PROGRAMMABLE PULSE GENERATOR) 6.1 Outline of the PPG Timer MB91313A Series ■ Block Diagram Figure 6.1-2 Overall Block Diagram TRG input External TRG0 PPG0 PPG timer ch.0 PPGA TRG input External TRG1 PPG1 PPG timer ch.1 TRG input External TRG2 PPG2 PPG timer ch.2 PPGB TRG input External TRG3 PPG3 PPG timer ch.3 Figure 6.1-3 Block Diagram for One Channel of PPG Timer PCSR PDUT Prescaler 1/1 1/4 CK Load CMP 1/16 16-bit down counter 1/64 Start Borrow PPG mask Peripheral clock S Q PPG output R Interrupt select Reverse bit Enable TRG input Edge detection IRQ Software trigger 180 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 6 PPG (PROGRAMMABLE PULSE GENERATOR) 6.1 Outline of the PPG Timer MB91313A Series ■ Control Status Register Figure 6.1-4 Bit Configuration of Control Status Register PCNH bit 15 14 13 12 11 Address: ch.0 000126H CNTE STGR MDSE RTRG CKS1 ch.1 00012EH R/W R/W R/W R/W ch.2 000136H R/W 0 0 0 0 0 ch.3 00013EH × × × 10 9 CKS0 PGMS 8 - R/W R/W - ← Attribute 0 × 0 - ← Initial value ← Rewrite during operation PCNL bit 7 6 Address: ch.0 000127H EGS1 EGS0 ch.1 00012FH R/W ch.2 000137H R/W 0 0 ch.3 00013FH × × 5 4 3 2 1 0 IREN IRQF IRS1 IRS0 - OSEL R/W R/W R/W R/W - 0 0 0 × 0 × - R/W ← Attribute 0 × ← Initial value ← Rewrite during operation R/W: Readable/writable -: Unused [bit15] CNTE: Timer enable bit This bit enables operation of the 16-bit down counter. 0 Disabled (initial value) 1 Enabled [bit14] STGR: Software trigger bit Writing 1 into this bit applies software trigger. The read value is always 0. [bit13] MDSE: Mode select bit This bit is used to select either the PWM mode in which continuous pulses are output or the one-shot mode in which a single pulse is output. 0 PWM mode (initial value) 1 One-shot mode [bit12] RTRG: Restart select bit This bit enables a restart resulting from a software trigger or trigger input. CM71-10143-5E 0 Restart disabled (initial value) 1 Restart enabled FUJITSU SEMICONDUCTOR LIMITED 181 CHAPTER 6 PPG (PROGRAMMABLE PULSE GENERATOR) 6.1 Outline of the PPG Timer MB91313A Series [bit11, bit10] CKS1, CKS0: Count clock select bit These bits are used to select the count clock of the 16-bit down counter. CKS1 CKS0 Cycle 0 0 φ (initial value) 0 1 φ/4 1 0 φ/16 1 1 φ/64 φ: Peripheral machine clock [bit9] PGMS: PPG Output mask select bit Writing 1 into this bit allows PPG output to be masked to 0 or 1, regardless of mode, cycle, and duty settings. PPG output when write "1" to PGMS Polarity PPG output Ordinary polarity L output Reverse polarity H output For all-H output in ordinary polarity mode and all-L output in reverse polarity mode, specify the same value in the cycle setting register and duty setting register in order to output the above mask value with the polarity reversed. [bit8] This bit is undefined. [bit7, bit6] EGS1, EGS0: Trigger input edge select bit These bits are used to select an effective edge for PPG input. Regardless of the mode that is selected, writing "1" to the bit of a software trigger enables the software trigger. 182 EGS1 EGS0 Edge selection 0 0 Not effective (initial value) 0 1 Rising edge 1 0 Falling edge 1 1 Both edges FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 6 PPG (PROGRAMMABLE PULSE GENERATOR) 6.1 Outline of the PPG Timer MB91313A Series [[bit5] IREN: Interrupt request enable bit 0 Disabled (initial value) 1 Enabled [bit4] IRQF: Interrupt request flag bit If bit5:IREN, is enabled and an interrupt source selected in bit3, bit2:IRS1 and IRS0, occurs then this bit is set and an interrupt request is generated and issued to the CPU. This bit is cleared if "0" is written to it. This bit remains unchanged if "1" is written to it. The read value by a read-modify-write (RMW) instruction is always "1", regardless of the bit value. [bit3, bit2] IRS1, IRS0: Interrupt resource select bit These bits are used to select a source that sets bit4:IRQF. IRS1 IRS0 Interrupt resource 0 0 Software trigger or trigger input (initial value) 0 1 Occurrence of a counter borrow (cycle match) 1 0 Occurrence of a duty match 1 1 Occurrence of a counter borrow (cycle match) or duty match [bit1] Unused bit [bit0] OSEL: PPG output polarity specification bit This bit sets the polarity of the PPG output. The followings show the combination results for this bit and bit9:PGMS. CM71-10143-5E PGMS OSEL PPG output 0 0 Ordinary polarity (initial value) 0 1 Reverse polarity 1 0 Output fixed to "L" 1 1 Output fixed to "H" Polarity After reset Ordinary polarity "L" output Reverse polarity "H" output Duty match FUJITSU SEMICONDUCTOR LIMITED Counter borrow 183 CHAPTER 6 PPG (PROGRAMMABLE PULSE GENERATOR) 6.1 Outline of the PPG Timer MB91313A Series ■ PCSR (PPG Cycle Setting Register) Figure 6.1-5 Bit Configuration of PCSR (PPG Cycle Setting Register) PCSR bit Address: ch.0 000122H ch.1 00012AH ch.2 000132H ch.3 00013AH 15 14 13 12 11 10 9 8 W W W W W W W W ← Attribute × × × × × × × × ← Initial value bit 7 6 5 4 3 2 1 0 W W W W W W W W ← Attribute × × × × × × × × ← Initial value W: Write only The PPG cycle setting register (PCSR) is a register with a buffer for setting a cycle. Transfers from the buffer are performed with counter borrow. When initializing or rewriting the cycle setting register, be sure to write to the duty setting register after the writing of the cycle setting register. This register must be accessed using 16-bit data. ■ PDUT (PPG Duty Setting Register) Figure 6.1-6 Bit Configuration of PDUT (PPG Duty Setting Register) PDUT bit Address: ch.0 000120H ch.1 000128H ch.2 000130H ch.3 000138H 15 14 13 12 11 10 9 8 W W W W W W W W ← Attribute × × × × × × × × ← Initial value bit 7 6 5 4 3 2 1 0 W W W W W W W W ← Attribute × × × × × × × × ← Initial value W: Write only The PPG duty setting register (PDUT) is a register with buffer for setting a duty. Transfers from the buffer are performed with counter borrow. When the same value is set in the cycle setting register and the duty setting register, all-H is output in ordinary polarity mode and all-L is output in reverse polarity mode. Do not specify a smaller value in PCSR than that in PDUT. Otherwise, PPG output becomes undefined. This register must be accessed using 16-bit data. 184 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 6 PPG (PROGRAMMABLE PULSE GENERATOR) 6.1 Outline of the PPG Timer MB91313A Series ■ PTMR (PPG Timer Register) Figure 6.1-7 Bit Configuration of PTMR (PPG Timer Register) PTMR bit Address: ch.0 000124H ch.1 00012CH ch.2 000134H ch.3 00013CH 15 14 13 12 11 10 9 8 R R R R R R R R ← Attribute 1 1 1 1 1 1 1 1 ← Initial value bit 7 6 5 4 3 2 1 0 R R R R R R R R ← Attribute 1 1 1 1 1 1 1 1 ← Initial value R: Read only The PPG timer register (PTMR) is a register used to read the value of the 16-bit down counter. This register must be accessed using 16-bit data. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 185 CHAPTER 6 PPG (PROGRAMMABLE PULSE GENERATOR) 6.2 Operation of the PPG Timer 6.2 MB91313A Series Operation of the PPG Timer This section describes the PPG timer operation. ■ Timing Charts for PWM Operation Figure 6.2-1 PWM Operation Timing Chart (When reactivation is disabled) Rising edge detection Trigger ignored Activation trigger m n 0 PPG (1) (2) (1) = T (n+1) ms (2) = T (m+1) ms T : Count clock cycle m : PCSR value n : PDUT value Figure 6.2-2 PWM Operation Timing Chart (When reactivation is enabled) Rising edge detection Restart by trigger Activation trigger m n 0 PPG (1) (2) (1) = T (n+1) ms (2) = T (m+1) ms T : Count clock cycle m: PCSR value n : PDUT value ● PWM mode In PWM mode, the PPG timer can output pulses continuously after an activation trigger signal is detected. The output pulse cycle can be controlled with the PCSR value, and the duty ratio can be controlled with the PDUT value. Note: 186 After data is written to PCSR, be sure to write data to PDUT. FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E MB91313A Series CHAPTER 6 PPG (PROGRAMMABLE PULSE GENERATOR) 6.2 Operation of the PPG Timer ■ Timing Charts for One-Shot Operation Figure 6.2-3 Timing Charts for One-Shot Operation (When restart is disabled) Rising edge detection Trigger ignored Activation trigger m n 0 PPG (1) (2) T : Count clock cycle m : PCSR value n : PDUT value (1) = T (n+1) ms (2) = T (m+1) ms Figure 6.2-4 Timing Charts for One-Shot Operation (When restart is enabled) Rising edge detection Restart by trigger Activation trigger m n 0 PPG (1) (2) (1) = T (n+1) ms (2) = T (m+1) ms T : Count clock cycle m : PCSR value n : PDUT value ● One-shot mode In one-shot mode, the PPG timer can output a single pulse of an arbitrary width when triggered. When reactivation is enabled, the PPG timer reloads the counter value after an edge is detected during operation. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 187 CHAPTER 6 PPG (PROGRAMMABLE PULSE GENERATOR) 6.2 Operation of the PPG Timer MB91313A Series ■ Interrupt Sources and Timing Chart (with PPG Output Set for Ordinary Polarity) Figure 6.2-5 Interrupt Sources and Timing Chart Activation trigger 2.5T maximum Load Clock Count value X 0003 H 0002 H 0001 H 0000 H 0003 H PPG Interrupt Effective edge Duty match Counter borrow It takes at most 2.5T (T stands for the count clock cycle) to load a count value after an activation trigger is input. ■ Examples of Methods of All-L and All-H PPG Output Figure 6.2-6 Methods of All-L and All-H PPG Output PPG Reduce the duty. When using an interrupt by borrow, set the PGMS (mask bit) to "1". If the PGMS (mask bit) is set to "0" during use of an interrupt by borrow, the PWM waveform can be output without generating glitches. PPG Increase the duty. When using an interrupt by compare match, write to the duty setting register the same values as that in the cycle setting register. 188 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 6 PPG (PROGRAMMABLE PULSE GENERATOR) 6.3 Precautions on Using the PPG Timer MB91313A Series 6.3 Precautions on Using the PPG Timer This section gives notes on using the PPG timer. ■ Precautions on Using the PPG Timer • If the device attempts to set and clear the interrupt request flag at the same time, the flag is set and the clear operation becomes ineffective. • The settings of bit11 and bit10 (count clock select bits CKS1 and CKS0) of the PPG control register are reflected immediately after data is written to the bits. Change the settings of the bits when counting stops. • If the device attempts to load and count the PPG down counter (PPGC: 16-bit down counter) at the same time, the load operation takes precedence. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 189 CHAPTER 6 PPG (PROGRAMMABLE PULSE GENERATOR) 6.3 Precautions on Using the PPG Timer 190 FUJITSU SEMICONDUCTOR LIMITED MB91313A Series CM71-10143-5E CHAPTER 7 16-BIT PULSE WIDTH COUNTER This chapter gives an overview of the 16-bit pulse width counter and explains the register configuration and functions and the counter operation. 7.1 Overview of the PWC Timer 7.2 Operation of the PWC Timer CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 191 CHAPTER 7 16-BIT PULSE WIDTH COUNTER 7.1 Overview of the PWC Timer 7.1 MB91313A Series Overview of the PWC Timer The 16-bit pulse width counter uses a 16-bit up counter to measure the pulse width of externally input signals. The 16-bit pulse width counter consists of a 16-bit up counter, three 8-bit control registers, a PWC data register, PWC upper data register, and a low-pass filter (LPF). • Interrupt request generation during data register transfer ■ Registers of the 16-Bit Pulse Width Counter Address bit15 0000D0H bit8 bit7 bit0 PWCCL 0000D4H PWCCH PWC control register PWCD 0000D8H PWC data register PWCC2 0000DCH Reserved PWC control register PWCUD PWC upper value setting register ■ Block Diagram Figure 7.1-1 PWC Block Diagram Upper value register Count clock Count clear Overflow LPF RIN 16 bit Counter Upper value Count clock 5 Control circuit 4 Captuer Register Sampling interval Flag set Control bit PWCD Sampling interval selection Count clock selection PWCCH PWCCL IRQ Internal bus 192 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 7 16-BIT PULSE WIDTH COUNTER 7.1 Overview of the PWC Timer MB91313A Series ■ PWC Control Register (PWCCL) Figure 7.1-2 Bit Configuration of PWC Control Register (PWCCL) PWCCL Address bit 7 6 5 4 3 2 1 0 Initial value INT INTE OVFL OVFLE - - Reserved ST 0000 --00B R/W R/W R/W R/W - - - R/W 0000D0H R/W: Readable/writable -: Unused [bit7] INT This bit is a flag that indicates that capture data has been transferred to the PWC data register. When a capture data transfer interrupt request is enabled (bit6: INTE = 1) and this bit is set, an interrupt request is generated. The read modify write (RMW) instruction is read as "1". 0 Interrupt source is cleared. 1 Capture data is available. [bit6] INTE This bit is the capture data transfer request interrupt enable bit. 0 Interrupt request is disabled. 1 Interrupt request is enabled. [bit5] OVFL This bit is a flag that indicates that the 16-bit up counter has overflowed from FFFFH to 0000H. When an overflow interrupt request is enabled (bit4: OVFLE = 1) and this bit is set, an interrupt request is generated. The read modify write (RMW) instruction is read as "1". 0 Interrupt source is cleared. 1 An overflow occurs. [bit4] OVFLE This bit is the overflow interrupt request enable bit. CM71-10143-5E 0 Interrupt request is disabled. 1 Interrupt request is enabled. FUJITSU SEMICONDUCTOR LIMITED 193 CHAPTER 7 16-BIT PULSE WIDTH COUNTER 7.1 Overview of the PWC Timer MB91313A Series [bit3, bit2] Unused bits [bit1] Reserved: Reserved bit This bit is a reserved bit. Be sure to write "0" at writing. [bit0] ST This bit is the PWC start bit. 0 PWC stops. 1 PWC operates. ■ PWC Control Register (PWCCH) Figure 7.1-3 Bit Configuration of PWC Control Register (PWCCH) PWCCH Address bit 0000D0H 7 6 5 4 3 2 1 0 Initial value TEST1 TEST0 - CSLF1 CSLF0 CS2 CS1 CS0 00-00000B R/W R/W - R/W R/W R/W R/W R/W R/W: Readable/writable -: Unused [bit7, bit6] TEST1, TEST0 These bits are test bits. Be sure to write "0" at writing. [bit5] Unused bit [bit4, bit3] CSLF1, CSLF0 These bits are used to select the LPF sampling interval from the followings. CSLF1 CSLF0 Sampling Interval 0 0 φ × 26 0 1 φ × 28 1 0 φ × 210 1 1 φ × 212 (φ is the cycle of the system base clock.) 194 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 7 16-BIT PULSE WIDTH COUNTER 7.1 Overview of the PWC Timer MB91313A Series [bit2, bit1, bit0] CS2, CS1, CS0 These bits are used to select the internal count clock as shown below. CS2 CS1 CS0 Count clock selection 0 0 0 φ 0 0 1 φ × 26 0 1 0 φ × 28 0 1 1 φ × 210 1 0 0 φ × 212 (φ is the cycle of the system base clock.) ■ PWC Data Register (PWCD) Figure 7.1-4 Bit Configuration of PWC Data Register (PWCD) PWCD Address bit 15 14 13 12 11 10 9 8 Initial value XXXXXXXXB 0000D4H bit R R R R R R R R 7 6 5 4 3 2 1 0 Initial value XXXXXXXXB R R R R R R R R R: Read only The PWC data register (PWCD) stores the measured value of the pulse width. Only the edge of input signal is captured the capture value. When the overflow is performed and the upper value is exceeded, this register does not capture. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 195 CHAPTER 7 16-BIT PULSE WIDTH COUNTER 7.1 Overview of the PWC Timer MB91313A Series ■ PWC Control Register 2 (PWCC2) Figure 7.1-5 Bit Configuration of PWC Control Register 2 (PWCC2) PWCC2 Address bit 0000D8H 7 6 5 4 3 2 1 0 Initial value UPINT UPINTE LOW - - - - - 000-----B R/W R/W R/W - - - - - R/W: Readable/writable -: Undefined [bit7] UPINT This bit is a flag that indicates that the setting value of upper register has counted. When the upper value interrupt request is enabled (bit6: UPINTE=1) and this bit is set, an interrupt request is generated. The read modify write (RMW) instruction is read as "1". 0 Interrupt source is cleared. (Initial value) 1 Upper value over count is available. [bit6] UPINTE This bit is an upper value interrupt request enable bit. Set to this bit to "1" and compare the counter value and the upper setting register. 0 Interrupt request is disabled. (Initial value) 1 Interrupt request is enabled. [bit5] LOW The bit represents that the capture value in the data register is indicated "L" width. 0 "H" width measurement is completed (Initial value) 1 "L" width measurement is completed. [bit4 to bit0] Unused bit 196 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 7 16-BIT PULSE WIDTH COUNTER 7.1 Overview of the PWC Timer MB91313A Series ■ PWC Upper Value Setting Register (PWCUD) Figure 7.1-6 Bit Configuration of PWC Upper Value Setting Register (PWCUD) PWCUD Address bit 15 14 13 12 11 10 9 8 Initial value XXXXXXXXB 0000DCH bit R/W R/W R/W R/W R/W R/W R/W R/W 7 6 5 4 3 2 1 0 Initial value XXXXXXXXB R/W R/W R/W R/W R/W R/W R/W R/W R/W: Readable/writable This register stores the upper value of a pulse width measurement. This register is corresponding to each width regardless of H and L width, the pulse which exceeds the upper value is measured and the UPINT bit of PWCC2 register is set. When this register exceeds the counter value, the count is continued and is not stopped. Therefore the initial value of this register is undefined, writing "1" to the UPINTE bit of PWCC2 register, and write the upper value before compare it. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 197 CHAPTER 7 16-BIT PULSE WIDTH COUNTER 7.2 Operation of the PWC Timer 7.2 MB91313A Series Operation of the PWC Timer The 16-bit pulse width counter consists of a 16-bit up counter, three 8-bit control registers, a PWC data register, PWC upper value setting register, and an LPF. This counter measures the pulse width. One of five count clocks can be selected. The basic operation is described below. ■ Operation Overview ● Pulse width count operation The PWC captures the counter value and clears the counter at the rising and falling edge of the RIN signal. The cleared counter continues counting unchanged. When the count value is captured, the PWC generates an interrupt. When the counter value changes from FFFFH to 0000H, the PWC generates an overflow interrupt. Figure 7.2-1 shows the operation of the 16-bit pulse width counter. Figure 7.2-1 PWC Operation ST (operation enable) RIN input The upper value interrupt is set, but not captured. Rising edge Falling edge FFFFH Upper value mmmmH Count value 0000H PWCD * xxxxH aaaaH bbbbH ccccH ddddH eeeeH INT * UPINT * OVFL * LOW * * : These are internal signals. Note: 198 The first edge (ST=1) is not captured after the operation enables. FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 7 16-BIT PULSE WIDTH COUNTER 7.2 Operation of the PWC Timer MB91313A Series ■ Count Clock Selection One of five count clocks can be selected. Selectable count clock is shown as follow. Count clock selection PLL frequency multiply by 2 (33 MHz) PLL off (Source oscillation 16.5 MHz) CS2 CS1 CS0 0 0 0 CLKP 30 ns 61 ns 0 0 1 φ × 26 * 1.9 μs 3.8 μs 0 1 0 φ × 28 * 7.8 μs 15.5 μs 0 1 1 φ × 210 * 31.0 μs 62.1 μs 1 0 0 φ × 212 * 124.1 μs 248.2 μs (CLKP is the peripheral clock. φ is the cycle of the system base clock.) ■ LPF Sampling Intervals The LPF sampling intervals can be selected as follow. Sampling interval PLL frequency multiply by 2 (33 MHz) PLL off (Source oscillation 16.5 MHz) CSLF1 CSLF0 0 0 φ × 26 * 1.9 μs 3.8 μs 0 1 φ × 28 * 7.8 μs 15.5 μs 1 0 φ × 210 * 31.0 μs 62.1 μs 1 1 φ × 212 * 124.1 μs 248.2 μs (φ is the cycle of the system base clock.) *: Caution of setting The PWC operation clock is CLKP. The count clock and the LFP sampling clock operate using φ. Therefore, it does not operate correctly when the PWC operation clock is not faster than the count clock and the LFP sampling clock. Cycle: PWC operation clock × 4 < count clock PWC operation clock × 4 < keep the LFP sampling clock condition. Example: at CLKP: 33 MHz → 30 ns × 4 < count clock (φ × 26: 1.9 μs) No problem at CLKP: 16.5 MHz → 61 ns × 4 < count clock (φ × 26: 1.9 μs) No problem at CLKP: 8.25 MHz → 121 ns × 4 < count clock (φ × 26: 1.9 μs) No problem at CLKP: 4.13 MHz → 242 ns × 4 < count clock (φ × 26: 1.9 μs) No problem at CLKP: 0.26 MHz → 3879 ns × 4 < count clock (φ × 26: 1.9 μs) Setting prohibited CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 199 CHAPTER 7 16-BIT PULSE WIDTH COUNTER 7.2 Operation of the PWC Timer MB91313A Series Figure 7.2-2 LFP Operation "L" is eliminated. "H" is eliminated. Input signal Sampling clock Internal LFP output "H" is eliminated. "L" is eliminated. Input signal Sampling clock Internal LFP output ■ Interrupt Request Generation The 16-bit pulse width counter can generate the following three interrupt requests: • Capture data transfer interrupt request When capture data is transferred to the PWC data register, the interrupt flag is set. When interrupt requests are enabled, an interrupt request is generated. • Counter overflow interrupt request When the counter value overflows from FFFFH to 0000H during measurement, the overflow flag is set. When interrupt requests are enabled, an interrupt request is generated. Capture is not performed in overflow. • Interrupt request which counts exceeding the value of upper register during counting When the counter value is larger than the upper setting register during measurement, the flag is set. When interrupt requests are enabled, an interrupt request is generated. 200 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 8 MULTIFUNCTION TIMER This chapter gives an overview of the multifunction timer and explains the register configuration and functions and the timer operation. 8.1 Overview of the Multifunction Timer 8.2 Registers of the Multifunction Timer 8.3 Multifunction Timer Operation CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 201 CHAPTER 8 MULTIFUNCTION TIMER 8.1 Overview of the Multifunction Timer 8.1 MB91313A Series Overview of the Multifunction Timer The multifunction timer consists of four channels for a 16-bit up counter. The multifunction timer has the following features: • A low-pass filter reduces noise that is below the amplitude of the set clock. • The pulse width can be measured according to settings using seven types of clock signals. • An event count from pin input is available. • An interval timer that uses seven types of clocks and external input clocks is available. • An HSYNC counter is available. ■ Registers Figure 8.1-1 Registers List of Multifunction Timer Address 202 0000F0H T0LPCR T0CCR (R/W) 0000F2H T0TCR T0R (R/W) 0000F4H T0DRR (R/W) 0000F6H T0CRR (R/W) 0000F8H T1LPCR T1CCR (R/W) 0000FAH T1TRR T1R (R/W) 0000FCH T1DRR (R/W) 0000FEH T1CRR (R/W) 000100H T2LPCR T2CCR (R/W) 000102H T2TRR T2R (R/W) 000104H T2DRR (R/W) 000106H T2CRR (R/W) 000108H T3LPCR T3CCR (R/W) 00010AH T3TRR T3R (R/W) 00010CH T3DRR (R/W) 00010EH T3CRR (R/W) 000110H TMODE (R/W) FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 8 MULTIFUNCTION TIMER 8.1 Overview of the Multifunction Timer MB91313A Series ■ Block Diagram Figure 8.1-2 Block Diagram of the Multifunction Timer (Simple) Synchronization Divider TO C CLKP CKI CK Event counter 16bit Counter CNT CPIB Edge detection EN CLR Interval register Synchronization CPIA Capture register LPF Interrupt Division CLKP OUT Figure 8.1-3 Block Diagram of the Multifunction Timer (Universal) HCNTMD CKI TMO0 TMI0 TO Ch.0 CPIA OUT CPIB CKI TMO1 TMI1 TO Ch.1 CPIA CPIB CKI TMO2 TMI2 TO Ch.2 CPIA CPIB CKI TMO3 TMI3 TO Ch.3 CPIA CPIB CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 203 CHAPTER 8 MULTIFUNCTION TIMER 8.2 Registers of the Multifunction Timer 8.2 MB91313A Series Registers of the Multifunction Timer ■ TxLPCR (Low-Pass Filter Control Register) Figure 8.2-1 Bit Configuration of TxLPCR (Low-Pass Filter Control Register) TxLPCR Address bit ch.0 0000F0H ch.1 0000F8H ch.2 000100H ch.3 000108H 15 14 13 12 11 10 9 8 Initial value - - - - - FCx1 FCx0 FxEN -----000B - - - - - R/W R/W R/W R/W: Readable/writable -: Unused The low-pass filter control register (TxLPCR) sets the low-pass filter for input pins. The low-pass filter control register (TxLPCR) can be 8-bit accessed. Because this filter reduces noise logically, the delay between the output waveform and the input waveform is the noise reduction width plus two cycles. [bit15 to bit11] Unused bits [bit10, bit9] FCx1, FCx0 (filter clock select flag) These bits are used to select the operating clock for the LPF. Table 8.2-1 Operating Clock Selection FCx1 FCx0 Clock cycle Noise reduction width (@33MHz) 0 0 φ × 22 0.12 μs [Initial value] 0 1 φ × 23 0.24 μs 1 0 φ × 24 0.48 μs 1 1 φ × 25 0.97 μs [bit8] FxEN (filter enable flag) This bit specifies whether the filter is used. 204 0 The filter is not used [initial value]. 1 The filter is used. FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 8 MULTIFUNCTION TIMER 8.2 Registers of the Multifunction Timer MB91313A Series ■ TxCCR (Capture Control Register) Figure 8.2-2 Bit Configuration of TxCCR (Capture Control Register) TxCCR Address bit ch.0 0000F1H ch.1 0000F9H ch.2 000101H ch.3 000109H 7 6 5 4 3 2 1 0 Initial value CPF Reserved CPST CPED CPIE CPOV CPMD CPIS 0-000000B R/W - R/W R/W R/W R/W R/W R/W R/W: Readable/writable -: Unused The capture control register (TxCCR) sets the count, edge, and interrupt in capture mode. The capture control register can be 8-bit accessed. If this register is written to during operation (entire register ST = 1), the timer operation is unpredictable. Be sure to rewrite this register when it is stopped (ST = 0). [bit7] CPF (capture edge detection flag) This bit indicates that the capture end edge has been detected. 0 No capture edge [initial value] 1 Capture edge Writing "1" to this bit has no effect. Note: If data is written to this flag from the hardware and the CPU at the same time, writing from the hardware has priority. [bit6] Reserved: Reserved bit [bit5] CPST (capture start edge select flag) This bit sets the polarity of the capture start edge. 0 Rising edge [initial value] 1 Falling edge Note: When you specify the same edge as the polarity of capture end edge for a value of this bit, capture is restarted after the next edge from the end edge. [bit4] CPED (capture end edge select flag) This bit sets the polarity of the capture end edge. CM71-10143-5E 0 Rising edge [initial value] 1 Falling edge FUJITSU SEMICONDUCTOR LIMITED 205 CHAPTER 8 MULTIFUNCTION TIMER 8.2 Registers of the Multifunction Timer MB91313A Series [bit3] CPIE (capture interrupt enable flag) This bit enables capture interrupt at capture end. 0 Capture interrupts are disabled [initial value] 1 Capture interrupts are enabled When this bit and CPF are both set to "1", an interrupt is sent to the CPU. [bit2] CPOV (capture overflow detection flag) This bit indicates that the counter has detected an overflow from FFFFH to 0000H in the free-run mode of capture mode. 0 No capture overflow [initial value] 1 Capture overflow Notes: • Writing "1" to this bit has no effect. • If data is written to this bit from the hardware and the CPU at the same time, writing from the hardware has priority. [bit1] CPMD (capture count mode flag) This bit sets the count mode of the capture counter. 0 Free-run mode [initial value] 1 Upper-limit compare mode [bit0] CPIS (capture input select flag) This bit is used to select the input signal for capture. 206 0 CPIA input is used [initial value]. 1 CPIB input is used. FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 8 MULTIFUNCTION TIMER 8.2 Registers of the Multifunction Timer MB91313A Series ■ TxTCR (Timer Setting Register) Figure 8.2-3 Bit Configuration of TxTCR (Timer Setting Register) TxTCR Address bit ch.0 0000F2H ch.1 0000FAH ch.2 000102H ch.3 00010AH 15 14 13 12 11 10 9 8 Initial value TCF TSES TCC TIE CINV TCS2 TCS1 TCS0 00000000B R/W R/W R/W R/W R/W R/W R/W R/W R/W: Readable/writable The timer setting register (TxTCR) controls the timer operation. The timer setting register (TxTCR) can be 8-bit accessed. If this register is rewritten during operation (entire register ST = 1), the timer operation is unpredictable. Be sure to rewrite this register when it is stopped (ST = 0). [bit15] TCF (timer compare match detection flag) This bit indicates that a timer compare match has been detected. 0 No compare match [initial value] 1 Compare match Notes: • Writing "1" to this bit has no effect. • If data is written to this bit from the hardware and the CPU at the same time, writing data from the hardware has priority. [bit14] TSES (timer start edge select flag) This bit sets the start edge of the timer. 0 Rising edge [initial value] 1 Falling edge [bit13] TCC (timer count clear setting flag) This bit specifies that the counter is cleared when a timer compare match is detected. CM71-10143-5E 0 Count clear [initial value] 1 No count clear FUJITSU SEMICONDUCTOR LIMITED 207 CHAPTER 8 MULTIFUNCTION TIMER 8.2 Registers of the Multifunction Timer MB91313A Series [bit12] TIE (timer interrupt enable flag) This bit enables timer interrupts. 0 Timer interrupts are disabled [initial value]. 1 Timer interrupts are enabled. When this bit and TCF are both set to "1", an interrupt is sent to the CPU. [bit11] CINV (timer clock invert flag) This bit inverts the timer input clock signal from the external pin. 0 The count increments at the rising edge of the clock [initial value]. 1 The count increments at the falling edge of the clock. [bit10 to bit8] TCS2 to TCS0 (timer clock select flag) These bits are used to select the timer clock. Note: To use the event count mode, set these bits to "111B". TCS bit 208 Clock and source to be selected TCS2 TCS1 TCS0 Division ratio Cycle (@33MHz) 0 0 0 φ × 23 0.24 μs 0 0 1 φ × 25 0.96 μs 0 1 0 φ × 27 3.88 μs 0 1 1 φ × 29 15.5 μs 1 0 0 φ × 210 31.0 μs 1 0 1 φ × 212 124.1 μs 1 1 0 φ × 214 496.5 μs 1 1 1 External clock FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 8 MULTIFUNCTION TIMER 8.2 Registers of the Multifunction Timer MB91313A Series ■ TxR (Entire Timer Control Register) Figure 8.2-4 Bit Configuration of TxR (Entire Timer Control Register) TxR Address bit ch.0 0000F3H ch.1 0000FBH ch.2 000103H ch.3 00010BH 7 6 5 4 3 2 1 0 Initial value - - - TST2 TST1 MD1 MD0 ST ---00000B - - - R/W R/W R/W R/W R/W R/W: Readable/writable -: Unused The entire timer control register (TxR) controls the entire timer operation. The entire timer control register (TxR) can be 8-bit accessed. [bit7 to bit5] Unused bits [bit4, bit3] TST2, TST1 (test bits) Always write 0 to these bits. [bit2, bit1] MD1, MD0 (timer select flag) These bits are used to select the timer operation. MD1 MD0 Selection mode 0 0 Interval timer [initial value] 0 1 Event count 1 0 Capture 1 1 Setting prohibited [bit0] ST (timer operation start flag) 0 Timer operation is disabled [initial value]. 1 Timer operation is enabled. Set CPIE or TIE to "0" before ST=0. When ST=0 and the interrupt factor occurs at the same time, even though ST=0, the interrupt occurs. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 209 CHAPTER 8 MULTIFUNCTION TIMER 8.2 Registers of the Multifunction Timer MB91313A Series ■ TxDRR (Timer Compare Data Register) Figure 8.2-5 Bit Configuration of TxDRR (Timer Compare Data Register) TxDRR Address bit ch.0 0000F4H ch.1 0000FCH ch.2 000104H ch.3 00010CH bit 15 14 13 12 11 10 9 8 Initial value D15 D14 D13 D12 D11 D10 D9 D8 XXXXXXXXB R/W R/W R/W R/W R/W R/W R/W R/W 7 6 5 4 3 2 1 0 Initial value D7 D6 D5 D4 D3 D2 D1 D0 XXXXXXXXB R/W R/W R/W R/W R/W R/W R/W R/W R/W: Readable/writable The timer compare data register (TxDRR) stores timer compare data. The timer compare data register (TxDRR) compares data in this register and the value of the timer counter and then indicates whether there is a compare match. To use this register, set the interval time in the timer mode and the event count in the external event mode. Enter the upper count limit in capture mode. This register cannot be 8-bit accessed. Setting "0" in this register results in 216 counts. ■ TxCRR (Capture Data Register) Figure 8.2-6 Bit Configuration of TxCRR (Capture Data Register) TxCRR Address bit ch.0 0000F6H ch.1 0000FEH ch.2 000106H ch.3 00010EH bit 15 14 13 12 11 10 9 8 Initial value D15 D14 D13 D12 D11 D10 D9 D8 XXXXXXXXB R/W R/W R/W R/W R/W R/W R/W R/W 7 6 5 4 3 2 1 0 Initial value D7 D6 D5 D4 D3 D2 D1 D0 XXXXXXXXB R/W R/W R/W R/W R/W R/W R/W R/W R/W: Readable/writable The capture data register (TxCRR) is used to read the captured value. This register can be written to enter the initial value. This register cannot be 8-bit accessed. 210 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 8 MULTIFUNCTION TIMER 8.2 Registers of the Multifunction Timer MB91313A Series ■ TMODE Figure 8.2-7 Bit Configuration of TMODE TMODE Address bit 000110H 15 14 13 12 11 10 9 8 Reserved Reserved Reserved Reserved Reserved Reserved Reserved Reserved bit R/W R/W R/W R/W R/W R/W R/W R/W 7 6 5 4 3 2 1 0 Reserved Reserved Reserved Reserved Reserved R/W R/W R/W R/W R/W HCNTMD R/W Reserved Reserved R/W Initial value 00000000B Initial value 00000000B R/W R/W: Readable/writable TMODE is a register to set the HSYNC counter mode. This register is allowed an access with 16-bit. [bit15 to bit3] Reserved: Reserved bits These bits are reserved. Write "0" to these bits. [bit2] HCNTMD: This bit sets the HSYNC counter mode. 0: Normal mode 1: HSYNC counter mode The counter ch.0 is used in the HSYNC counter mode. When input HSYNC to TMI0 and VSYNC to TMI1, the counter is used to set to the capture mode. Be sure to specify different edge for capture start and end edges. [bit1, bit0] Reserved: Reserved bits These bits are reserved. Write "0" to these bits. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 211 CHAPTER 8 MULTIFUNCTION TIMER 8.3 Multifunction Timer Operation 8.3 MB91313A Series Multifunction Timer Operation The multifunction timer has the following operating modes: • Interval timer • Event count • Capture mode This section gives an overview of operation in each mode. The initial value of the toggle output of this module is 0 in all modes. ■ Interval Timer Mode In the interval timer mode, the multifunction timer has functions that use the clock selected from the seven types of clock sources for the timer count and toggle output and generate an interrupt if the counter value and the compare register value match. The following figure shows the multifunction timer operating state in interval timer mode. Figure 8.3-1 Operating State in Interval Timer Mode FFFFH Compare register value Counter value 0000H Pin output Interrupt An interrupt is generated at the pin output edge. 212 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 8 MULTIFUNCTION TIMER 8.3 Multifunction Timer Operation MB91313A Series ■ Event Count Mode In the event count mode, the multifunction timer detects the pin input edge and counts the edges the specified number of times. When the counter value and the compare register value match, TCF is set to "1". If TIE is set to "1" at this time, an interrupt is generated. When a compare match is detected, the counter can be cleared. Figure 8.3-2 Operating State in Event Count Mode Clock Pin input Edge detection Compare register 2 0 Counter 4 2 3 4 3 Toggle output An output signal is output when a compare match is detected. CM71-10143-5E This signal enables an interrupt to be generated and the counter to be cleared. FUJITSU SEMICONDUCTOR LIMITED 213 CHAPTER 8 MULTIFUNCTION TIMER 8.3 Multifunction Timer Operation MB91313A Series ■ Capture Mode In the capture mode, the width between the rising or falling edges of an external pin input can be measured. The clock for measurement can be selected from the seven types of clock sources. The start and end edges can be selected from either the rising or falling edge. In free-run mode, the count value is captured when the end edge is reached. In the upper-limit compare mode, an upper limit is input if the count value and the upper-limit compare value match before the end edge is reached. Otherwise, the captured value at the end edge is input. The following figure shows an example of starting the count at the rising edge and ending it at the falling edge in free-run mode. Figure 8.3-3 Operating State in Capture Mode External input FFFFH Counter value 0000H Capture register XXXXH 7777H The value at this point is captured. 214 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 8 MULTIFUNCTION TIMER 8.3 Multifunction Timer Operation MB91313A Series ■ Low-Pass Filter This module contains a low-pass filter for each external pin input. This filter enables logical reduction of noise in four types of widths. Figure 8.3-4 Noise Reduction of Low-Pass Filter Filter clock Input signal Capture signal State 0 1 0 1 2 2 1 2 1 0 1 0 1 2 Output signal This noise is eliminated. Filter clock Input signal Capture signal State 0 0 1 0 Output signal This noise is eliminated. CM71-10143-5E All noise except signals that continue for at least two cycles of the filter clock is eliminated. FUJITSU SEMICONDUCTOR LIMITED 215 CHAPTER 8 MULTIFUNCTION TIMER 8.3 Multifunction Timer Operation 216 FUJITSU SEMICONDUCTOR LIMITED MB91313A Series CM71-10143-5E CHAPTER 9 OTHER TIMERS This chapter explains the main oscillation stabilization wait timer, interval timer, and watch timer. 9.1 Main Oscillation Stabilization Wait Timer 9.2 Watch Timer CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 217 CHAPTER 9 OTHER TIMERS 9.1 Main Oscillation Stabilization Wait Timer 9.1 MB91313A Series Main Oscillation Stabilization Wait Timer The main oscillation stabilization wait timer is a 23-bit counter that is synchronized with the main clock to count up. It includes an interval timer function that continues to generate interrupts in regular time intervals. This timer uses the main clock to secure the oscillation stabilization wait time, when the main oscillation is temporarily suspended during sub clock operation and restarted using OSCDS1 (bit8) in OSCCR (oscillation control register). ■ Interval Times of the Main Oscillation Stabilization Wait Timer Table 9.1-1 shows types of the interval times. The following 3 interval times are available for selection. Table 9.1-1 Interval Times of Main Oscillation Stabilization Wait Timer Main clock cycle Interval time 211/FCL (124 μs) 1/FCL (approx. 60 ns) 216/FCL (3.9 ms) 222/FCL (254 ms) Note: 218 FCL represents the main clock oscillation frequency (at FCL = 16.5 MHz). FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 9 OTHER TIMERS 9.1 Main Oscillation Stabilization Wait Timer MB91313A Series ■ Block Diagram of the Main Oscillation Stabilization Wait Timer Figure 9.1-1 shows a block diagram of the main oscillation stabilization wait timer. Figure 9.1-1 Block Diagram of Main Oscillation Stabilization Wait Timer Counter for the main oscillation stabilization wait timer FCL 0 1 2 3 4 5 6 7 8 10 15 22 21 22 23 24 25 26 27 28 29 211 216 223 (124 μs) Interval timer selector (3.9 ms) (254 ms) Counter clear circuit Reset (INIT) Interval timer interrupt Main oscillation stabilization wait timer control register (OSCR) WIF WIE WEN Reserved Reserved WS1 WS0 WCL FCL: Source oscillation of main clock Number in ( ) is the cycle when the source oscillation of the main clock is 16.5 MHz ● Main oscillation stabilization wait timer This timer is a 23-bit up-counter that uses the source oscillation of the main clock for its count clock. ● Counter clear circuit This circuit clears the counter at a reset (INIT), other than the OSCR register setting (WCL=0). ● Interval timer selector Out of 3 different division outputs of the counter for the main oscillation stabilization wait timer, this circuit selects one to be used for the interval timer. The falling edge of the selected division output is used as the interrupt source. ● Main oscillation stabilization wait register (OSCR) This register selects the interval time, clears the counter, controls interrupts and checks the interrupt state. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 219 CHAPTER 9 OTHER TIMERS 9.1 Main Oscillation Stabilization Wait Timer MB91313A Series ■ Explanation of the Main Oscillation Stabilization Wait Timer Register The configuration of the main oscillation stabilization wait timer register is shown below. Figure 9.1-2 Bit Configuration of Main Oscillation Stabilization Wait Control Register OSCR Address bit 15 14 13 WIF WIE WEN R/W R/W R/W R/W Initial value (INIT) 0 0 0 Initial value (RST) X X X 000490H 12 11 10 9 8 WS1 WS0 WCL R/W R/W R/W R/W 0 0 0 0 0 X X X X X Reserved Reserved R/W: Readable/writable [bit15] WIF: Timer interrupt flag WIF is the flag for main oscillation stabilization wait interrupt requests. It is set to "1" at the falling edge of the selected division output for the interval timer. A main oscillation stabilization interrupt request is output, when this bit and the interrupt request enable bit are set to "1". Value Description 0 No request for main oscillation stabilization interrupt [Initial value] 1 Request for main oscillation stabilization interrupt • This bit is initialized to "0" by a reset (INIT). • This bit is readable and writable. For write operation, however, only "0" can be written. Writing "1" does not change the bit value. • Reading by read-modify-write (RMW) instruction always returns "1". [bit14] WIE: Timer interrupt enable bit WIE enables/disables the output of an interrupt request to the CPU. A main oscillation stabilization interrupt request is output, when this bit and the main oscillation stabilization interrupt request flag bit are set to "1". Value Description 0 Disables the output of main oscillation stabilization interrupt request. [Initial value] 1 Enables the output of main oscillation stabilization interrupt request. • This bit is initialized to "0" by a reset (INIT). • This bit is readable and writable. 220 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 9 OTHER TIMERS 9.1 Main Oscillation Stabilization Wait Timer MB91313A Series [bit13] WEN: Timer operation enable bit WEN enables the timer operation. When this bit is set to "1", the timer performs count operation. Value Description 0 The timer stops. [Initial value] 1 The timer operates. • This bit is initialized to "0" by a reset (INIT). • This bit is readable and writable. [bit12, bit11] Reserved: Reserved bits These are reserved bits. Write "0" on writing (writing "1" is disabled). Read value is undefined. [bit10, bit9] WS1, WS0:Timer interval time selection bits These bits select the cycle for the interval timer. The cycle is selected from the following 3 output bits of the counter for the main oscillation stabilization wait timer. Interval timer cycle (When FCL = 16.5 MHz) WS1 WS0 0 0 Prohibited setting [Initial value] 0 1 211/FCL (124 μs) 1 0 216/FCL (3.9 ms) 1 1 222/FCL (254 ms) • These bits are initialized to "00B" by a reset (INIT). • These bits are readable and writable. • To use the main oscillation stabilization wait time timer, write data to this register. [bit8] WCL: Timer clear bit When "0" is written to WCL, the oscillation stabilization wait timer is cleared to "0". For write operation, only "0" can be written. Writing "1" has no effect on operation. • Reading always returns "1". CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 221 CHAPTER 9 OTHER TIMERS 9.1 Main Oscillation Stabilization Wait Timer MB91313A Series ■ Main Oscillation Stabilization Wait Interrupt The counter for the main oscillation stabilization wait timer counts on the main clock, and sets the main oscillation stabilization wait interrupt request flag (WIF) to "1" when the set interval time has elapsed. In this case, if the interrupt request enable bit has been enabled (WIE=1), an interrupt request is generated to the CPU. However, if the oscillation of the main clock is stopped (see the next section "■ Operation of the Main Oscillation Stabilization Wait Timer"), the count operation also stops. As a result, no main oscillation stabilization wait interrupt is generated. To clear an interrupt request, write "0" to the WIF flag in the interrupt processing routine. Note that WIF is set at the falling edge of the specified division output, regardless of the WIE value. Note: When enabling the output of an interrupt request (WIE=1) after reset release or modifying WS1,WS0 bit, always clear WIF and WCL at the same time (WIF=WCL=0). References: • When WIF is set to "1", an interrupt request is generated as soon as WIE is enabled from the disabled state (0 → 1). • WIF is not set, if the counter is cleared (WPCR:WCL=1) at the same time as an overflow occurs at the selected bit. ■ Operation of Interval Timer Function The counter for the main oscillation stabilization wait timer counts up on the main clock. Under the following conditions, however, the count operation stops because the oscillation of the main clock stops. • When WEN is set to "0" • If the device enters stop mode when the main oscillation is set to stop in stop mode (bit0:OSCD1 in the standby control register STCR = 1), the count operation stops during stop mode. OSCD1 is initialized to "1" at a reset (INIT). Therefore, to operate the main oscillation stabilization wait timer even during stop mode, set OSCD2 to "0" before the device enters standby mode. • When OSCDS1 (bit8) in OSCCR (oscillation control register) is set to "1" in sub clock mode, the main oscillation stops and the timer also stops the count operation. When the counter is cleared (WCL=0), it starts count operation from "000000H". Once it reaches "7FFFFFH", it goes back to "000000H" and continues to count. When a falling edge is generated at the selected division output for the interval timer, the main oscillation stabilization wait interrupt request bit (WIF) is set to "1". This means that a main oscillation stabilization wait timer interrupt request is generated at every selected interval time, based on the cleared time. 222 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 9 OTHER TIMERS 9.1 Main Oscillation Stabilization Wait Timer MB91313A Series ■ Operation of Clock Supply Function The time-base counter is used to secure the oscillation stabilization wait timer after INIT or stop mode. However, to secure the oscillation stabilization wait time for the main clock when the sub clock is selected as the clock source, the main oscillation stabilization wait timer is used, as it operates on the main clock regardless of the clock source selection. To perform the main clock oscillation stabilization wait from the main oscillation stop state in the sub clock operation, follow the procedure described below. 1) Set the time required to stabilize the oscillation of the main clock in WT1 and WT0 and clear the counter to "0" (WT1 and WT0 =oscillation stabilization wait time; write "0" to WCL). To perform processing after the completion of oscillation stabilization wait by an interrupt, also initialize the interrupt flag (write "0" to WIF and WIE). 2) Start the oscillation of the main clock (write "1" to OSCDS1 (bit8) in OSCCR). 3) Wait until the WIF flag is set to "1" by program. 4) Make sure that the WIF flag has been set to "1" and then perform the processing after the completion of the oscillation stabilization wait. If interrupts are enabled, an interrupt occurs when WIF is set to "1". In this case, perform the processing after the completion of the oscillation stabilization wait in the interrupt routine. Also, when switching from the sub clock to main clock, make sure that WIF has been set to "1" beforehand, as described in 4). (If the clock is switched to the main clock without waiting until the oscillation stabilizes, an unstable clock signal is supplied through the device, and the succeeding operation is not guaranteed.) ■ Operation of the Main Oscillation Stabilization Wait Timer Figure 9.1-3 shows the state of the counter during transition to the main clock when the main oscillation stabilization wait timer is activated. Figure 9.1-3 State of Counter during Transition to Main Clock when Main Oscillation Stabilization Wait Timer is Activated 7FFFFFH Counter value Main clock oscillation stabilization wait time • Clear the timer (WCL=1) * When not "0" • Set the interval time (WS1, WS0=11B) • Start the main oscillation (OSCCR:OSCDS1=0) WIF (interrupt request) Cleared in interrupt routine WIE (interrupt masking) Clock mode Sub clock Main clock Change from sub clock to main clock CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 223 CHAPTER 9 OTHER TIMERS 9.1 Main Oscillation Stabilization Wait Timer MB91313A Series ■ Notes on Using the Main Oscillation Stabilization Wait Timer The oscillation stabilization wait time should be used for reference only, as the oscillation cycle is unstable immediately after the oscillation starts. While the oscillation of the main clock is stopped, the counter is also stopped. Consequently, no main oscillation stabilization interrupt occurs. Therefore, to perform any processing using a main oscillation stabilization interrupt, do not stop the main oscillation. If the WIF flag set request and the clearing to "0" from the CPU occur simultaneously, the flag set request will have higher priority; therefore, the clearing to "0" will be cancelled. 224 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 9 OTHER TIMERS 9.2 Watch Timer MB91313A Series 9.2 Watch Timer The watch timer is a 21-bit free-run counter that is synchronized with the sub clock to count up. It includes an interval timer function that continues to generate interrupts in regular time intervals. ■ Interval Time of Watch Timer The following 7 interval times are available for selection. Table 9.2-1 Interval Time of Watch Timer Sub clock cycle Interval time 213/FCL (0.25 s) 214/FCL (0.50 s) 215/FCL (1.00 s) 1/FCL (approx. 30.5 μs) 216/FCL (2.00 s) 15×215/FCL (15 s) 15×216/FCL (30 s) 15×217/FCL (60 s) Note: FCL is the sub clock oscillation frequency (at FCL = 32.768 kHz). CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 225 CHAPTER 9 OTHER TIMERS 9.2 Watch Timer MB91313A Series ■ Block Diagram of Watch Timer Figure 9.2-1 Block Diagram of Watch Timer Counter for watch timer 0 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 9 2 FCL 2 2 2 2 2 2 2 9 10 11 12 13 14 15 10 2 2 11 2 12 2 13 2 14 2 15 2 15 to 18 19 20 × 15 216 217 16 2 (0.25 s) (0.5 s) (1.0 s) Interval timer selector (2.0 s) (15 s) (30 s) (60 s) Reset (INIT) Counter clear circuit Watch interrupt Watch timer control register (WPCR) WIF WIE Reserved Reserved WS2 WS1 WS0 WCL FCL: Sub clock source oscillation Number in ( ) is the cycle when the source oscillation of the sub clock is 32.768 kHz [Watch timer] This timer is a 21-bit up-counter that uses the source oscillation of the sub clock for its count clock. [Counter clear circuit] This circuit clears the counter at a reset (INIT), other than the WPCR register setting (WCL=0). [Interval timer selector] Out of 4 different division outputs of the counter for the watch timer, this circuit selects one to be used for the interval timer. The falling edge of the selected division output is used as the interrupt source. [Watch timer control register (WPCR)] This register selects the interval time, clears the counter, controls interrupts and checks the interrupt state. 226 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 9 OTHER TIMERS 9.2 Watch Timer MB91313A Series ■ Registers of Watch Timer Figure 9.2-2 Bit Configuration of Registers of Watch Timer WPCR Address bit 15 14 13 00048CH WIF WIE Initial value (INIT) R/W 0 R/W 0 W 0 Initial value (RST) X X X 12 11 10 9 8 WS2 WS1 WS0 WCL W 0 R/W 0 R/W 0 R/W 0 W 0 X X X X X Reserved Reserved R/W: Readable/writable W: Write only [bit15] WIF (Watch timer Interrupt Flag) This bit is the watch interrupt request flag. It is set to "1" at the falling edge of the selected division output for the interval timer. A watch interrupt request is output, when this bit and the interrupt request enable bit are set to "1". 0 No watch interrupt request (initial value) 1 Watch interrupt request • This bit is initialized to "0" by a reset (INIT). • This bit is readable and writable. For write operation, however, only "0" can be written. Writing "1" does not change the bit value. Reading by read-modify-write (RMW) instruction always returns "1". [bit14] WIE (Watch timer Interrupt Enable) WIE enables/disables the output of an interrupt request to the CPU. A watch interrupt request is output, when this bit and the watch interrupt request flag bit are set to "1". 0 Watch interrupt request output disabled (initial value) 1 Watch interrupt request output enabled • This bit is initialized to "0" by a reset (INIT). • This bit is readable and writable. [bit13 to bit12] Reserved: Reserved bits These are reserved bits. Write "0" on writing (writing "1" is disabled). Read value is undefined. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 227 CHAPTER 9 OTHER TIMERS 9.2 Watch Timer MB91313A Series [bit11 to bit9] WS2 to WS0 (Watch timer interval Select 2 to 0) These bits select the cycle for the interval timer. The cycle is selected from the following 7 output bits of the counter for the watch timer. WS1 WS0 WS0 Interval timer cycle (When FCL = 32.768 kHz) 0 0 0 213 / FCL (0.25 s) (Initial value) 0 0 1 214 / FCL (0.50 s) 0 1 0 215 / FCL (1.00 s) 0 1 1 216 / FCL (2.0 s) 1 0 0 15×215 / FCL (15 s) 1 0 1 15×216 / FCL (30 s) 1 1 0 15×217 / FCL (60 s) 1 1 1 Setting disabled • These bits are initialized to "000B" by a reset (INIT). • These bits are readable and writable. [bit8] WCL (Watch timer CLear) When "0" is written to WCL, the watch timer is cleared to "0". • For write operation, only "0" can be written. Writing "1" has no effect on operation. • Reading always returns "1". ■ Watch Interrupt The counter for the watch timer counts on the sub clock, and sets the watch interrupt request flag (WIF) to "1" when the set interval time has elapsed. In this case, if the interrupt request enable bit has been enabled (WIE=1), an interrupt request is generated to the CPU. However, if the oscillation of the sub clock is stopped (see "■ Operation of Interval Timer Function"), the count operation also stops. As a result, no watch interrupt is generated. To clear an interrupt request, write "0" to the WIF flag in the interrupt processing routine. Note that WIF is set at the falling edge of the specified division output, regardless of the WIE value. Note: When enabling the output of an interrupt request (WIE=1) after reset release or modifying WS1,WS0 bit, always clear WIF and WCL at the same time (WIF=WCL=0). • When WIF is set to "1", an interrupt request is generated as soon as WIE is enabled from the disabled state (0 → 1). • WIF is not set, if the counter is cleared (WPCR:WCL=1) at the same time as an overflow occurs at the selected bit. 228 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 9 OTHER TIMERS 9.2 Watch Timer MB91313A Series ■ Operation of Interval Timer Function The counter for the watch timer always counts up during the sub clock oscillation. Under the following conditions, however, the count operation stops because the oscillation of the sub clock stops. • When PLL2EN (bit11) of the clock source register CLKR is "0". PLL2EN is initialized to "0" at reset (INIT). When using the watch timer, write "1" to PLL2EN to start the oscillation of the sub clock. • If the device enters stop mode when the sub oscillation is set to stop in stop mode (OSCD2 (bit1) in the standby control register STCR = 1), the count operation stops during stop mode. In this model, OSCD2 is initialized to "1" at a reset (INIT). Therefore, to operate the watch timer even during stop mode, set OSCD2 to "0" before the device enters standby mode. When the counter is cleared (WCL=0), it starts count operation from "000000H". Once it reaches "1FFFFFH", it goes back to "000000H" and continues to count. When a falling edge is generated at the selected division output for the interval timer, the watch interrupt request bit (WIF) is set to "1". This means that a watch interrupt request is generated at every selected interval time, based on the cleared time. ■ Operation of Clock Supply Function The time-base counter is used to secure the oscillation stabilization wait time after INIT or stop mode. However, to secure the oscillation stabilization wait time for the sub clock when the main clock is selected as the clock source, this watch timer is used, as it operates on the sub clock regardless of the clock source selection. To perform the sub clock oscillation stabilization wait from the main clock operation, follow the procedure described below: 1) Set the interval time of the watch timer to 1 s (when FCL = 32.768 kHz) and clear the counter to "0". (Write "011" to WS2 to WS0, and "0" to WCL) To perform processing after the completion of oscillation stabilization wait by an interrupt, also initialize the interrupt flag (write "0" to WIF and "1" to WIE). 2) Start the oscillation of the sub clock (write "1" to PLL2EN (bit11) in CLKR). 3) Wait until the WIF flag is set to "1" by program. 4) Make sure that the WIF flag has been set to "1" and then perform the processing after the completion of the oscillation stabilization wait. If interrupts are enabled, an interrupt occurs when WIF is set to "1". In this case, perform the processing after the completion of the oscillation stabilization wait in the interrupt routine. Also, when switching from the main clock to sub clock, make sure that WIF has been set to "1" beforehand, as described in 4). (If the clock is switched to the sub clock without waiting until the oscillation stabilizes, an unstable clock signal is supplied through the device, and the succeeding operation is not guaranteed.) CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 229 CHAPTER 9 OTHER TIMERS 9.2 Watch Timer MB91313A Series ■ Operations of Watch Timer The following shows the state of the counter when activating the watch timer, when making a transition to the sub clock, and when making a transition to the stop mode in the sub clock operation. 1FFFFF H Counter value 004000 H Oscillation stabilization wait time for the sub clock Interval time Cleared in Cleared in Cleared in • Clear the timer (WCL=1) * When not "0" interrupt interrupt interrupt • Set the interval time (WS2 to WS0=011B) routine routine routine • Activate sub clock oscillation (CLKR:PLL2EN=1) WIF Clock source Main clock Sub clock Stop * Clock mode RUN RUN Instruction for transition to stop mode • Change the interval time (WS2 to WS0=010B) • Change from the main clock to sub clock *: When STCR:OSCD2=0 (the oscillation is not stopped when stopped) is set ■ Notes on Using Watch Timer • The oscillation stabilization wait time should be used for reference only, as the oscillation cycle is unstable immediately after the oscillation starts. • While the oscillation of the sub clock is stopped, the watch timer is also stopped. Consequently, no watch interrupt occurs. Therefore, to perform any processing using a watch interrupt, do not stop the oscillation of sub clock. • If the WIF flag set request and the clearing to "0" from the CPU occur simultaneously, the flag set request will have higher priority; therefore, the clearing to "0" will be cancelled. 230 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 10 INTERRUPT CONTROLLER This chapter gives an overview of the interrupt controller and explains its register configuration/ functions and its operations. 10.1 Overview of Interrupt Controller 10.2 Registers of Interrupt Controller 10.3 Operations of Interrupt Controller CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 231 CHAPTER 10 INTERRUPT CONTROLLER 10.1 Overview of Interrupt Controller 10.1 MB91313A Series Overview of Interrupt Controller The interrupt controller receives and arbitrates interrupts. ■ Hardware Configuration of the Interrupt Controller This module consists of the following components: • ICR register • Interrupt priority judgment circuit • Interrupt level and interrupt number (vector) generation unit • Hold request cancel request generation unit ■ Major Functions of the Interrupt Controller This module has the following major functions: • Priority judgment (by interrupt level and number) • Transmission of the interrupt level of the interrupt source selected by priority judgment (to the CPU) • Transmission of the interrupt number of the interrupt source selected by priority judgment (to the CPU) • Generation of a request to the bus master to cancel a hold request 232 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 10 INTERRUPT CONTROLLER 10.1 Overview of Interrupt Controller MB91313A Series ■ Register List of Interrupt Controller Figure 10.1-1 lists the registers of the interrupt controller. Figure 10.1-1 List of Interrupt Controller Registers Address bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 000440H - - - ICR4 ICR3 ICR2 ICR1 ICR0 ICR00 000441H - - - ICR4 ICR3 ICR2 ICR1 ICR0 ICR01 000442H - - - ICR4 ICR3 ICR2 ICR1 ICR0 ICR02 000443H - - - ICR4 ICR3 ICR2 ICR1 ICR0 ICR03 000444H - - - ICR4 ICR3 ICR2 ICR1 ICR0 ICR04 000445H - - - ICR4 ICR3 ICR2 ICR1 ICR0 ICR05 000446H - - - ICR4 ICR3 ICR2 ICR1 ICR0 ICR06 000447H - - - ICR4 ICR3 ICR2 ICR1 ICR0 ICR07 000448H - - - ICR4 ICR3 ICR2 ICR1 ICR0 ICR08 000449H - - - ICR4 ICR3 ICR2 ICR1 ICR0 ICR09 00044AH - - - ICR4 ICR3 ICR2 ICR1 ICR0 ICR10 00044BH - - - ICR4 ICR3 ICR2 ICR1 ICR0 ICR11 00044CH - - - ICR4 ICR3 ICR2 ICR1 ICR0 ICR12 00044DH - - - ICR4 ICR3 ICR2 ICR1 ICR0 ICR13 00044EH - - - ICR4 ICR3 ICR2 ICR1 ICR0 ICR14 00044FH - - - ICR4 ICR3 ICR2 ICR1 ICR0 ICR15 000450H - - - ICR4 ICR3 ICR2 ICR1 ICR0 ICR16 000451H - - - ICR4 ICR3 ICR2 ICR1 ICR0 ICR17 000452H - - - ICR4 ICR3 ICR2 ICR1 ICR0 ICR18 000453H - - - ICR4 ICR3 ICR2 ICR1 ICR0 ICR19 000454H - - - ICR4 ICR3 ICR2 ICR1 ICR0 ICR20 000455H - - - ICR4 ICR3 ICR2 ICR1 ICR0 ICR21 000456H - - - ICR4 ICR3 ICR2 ICR1 ICR0 ICR22 000457H - - - ICR4 ICR3 ICR2 ICR1 ICR0 ICR23 000458H - - - ICR4 ICR3 ICR2 ICR1 ICR0 ICR24 000459H - - - ICR4 ICR3 ICR2 ICR1 ICR0 ICR25 00045AH - - - ICR4 ICR3 ICR2 ICR1 ICR0 ICR26 00045BH - - - ICR4 ICR3 ICR2 ICR1 ICR0 ICR27 00045CH - - - ICR4 ICR3 ICR2 ICR1 ICR0 ICR28 00045DH - - - ICR4 ICR3 ICR2 ICR1 ICR0 ICR29 00045EH - - - ICR4 ICR3 ICR2 ICR1 ICR0 ICR30 00045FH - - - ICR4 ICR3 ICR2 ICR1 ICR0 ICR31 000460H - - - ICR4 ICR3 ICR2 ICR1 ICR0 ICR32 000461H - - - ICR4 ICR3 ICR2 ICR1 ICR0 ICR33 000462H - - - ICR4 ICR3 ICR2 ICR1 ICR0 ICR34 000463H - - - ICR4 ICR3 ICR2 ICR1 ICR0 ICR35 000464H - - - ICR4 R ICR3 R/W ICR2 R/W ICR1 R/W ICR0 R/W ICR36 (Continued) CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 233 CHAPTER 10 INTERRUPT CONTROLLER 10.1 Overview of Interrupt Controller MB91313A Series (Continued) Address bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 000465H - - - ICR4 ICR3 ICR2 ICR1 ICR0 ICR37 000466H - - - ICR4 ICR3 ICR2 ICR1 ICR0 ICR38 000467H - - - ICR4 ICR3 ICR2 ICR1 ICR0 ICR39 000468H - - - ICR4 ICR3 ICR2 ICR1 ICR0 ICR40 000469H - - - ICR4 ICR3 ICR2 ICR1 ICR0 ICR41 00046AH - - - ICR4 ICR3 ICR2 ICR1 ICR0 ICR42 00046BH - - - ICR4 ICR3 ICR2 ICR1 ICR0 ICR43 00046CH - - - ICR4 ICR3 ICR2 ICR1 ICR0 ICR44 00046DH - - - ICR4 ICR3 ICR2 ICR1 ICR0 ICR45 00046EH - - - ICR4 ICR3 ICR2 ICR1 ICR0 ICR46 00046FH - - - ICR4 R ICR3 R/W ICR2 R/W ICR1 R/W ICR0 R/W ICR47 - - - LVL4 LVL3 LVL2 LVL1 LVL0 HRCL R R/W R/W R/W R/W Address: 000045H ■ Interrupt Controller Block Diagram Figure 10.1-2 is a block diagram of the interrupt controller. Figure 10.1-2 Interrupt Controller Block Diagram WAKEUP (1 when the level ≠ 11111B) UNMI Priority judgment NMI processing Level 4 to 0 5 Level/ vector generation Level judgment ICR00 RI00 • • • Vector judgment • • • ICR47 6 HLDREQ cancel request MHALTI VCT5 to VCT0 RI47 ( DLYIRQ) R-bus 234 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 10 INTERRUPT CONTROLLER 10.2 Registers of Interrupt Controller MB91313A Series 10.2 Registers of Interrupt Controller This section describes the register configuration and functions of the interrupt controller. ■ Details of Interrupt Controller Registers The interrupt controller has the following two types of registers: • ICR (Interrupt Control Register) • HRCL (Hold Request Cancel Request Register) CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 235 CHAPTER 10 INTERRUPT CONTROLLER 10.2 Registers of Interrupt Controller 10.2.1 MB91313A Series ICR (Interrupt Control Register) An interrupt control register (ICR) is provided for each interrupt input to set the interrupt level of the corresponding interrupt request. ■ Interrupt Control Register (ICR) The interrupt control register (ICR) consists of the following bits: Figure 10.2-1 Bit Configuration of Interrupt Control Register (ICR) ICR Address 000440H to 00046FH bit 7 6 5 4 3 2 1 0 Initial value - - - ICR4 ICR3 ICR2 ICR1 ICR0 ---11111B R R/W R/W R/W R/W R/W: Readable/writable R: Read only -: Unused [bit4 to bit0] ICR4 to ICR0 These bits are interrupt level setting bits to specify the interrupt level of the corresponding interrupt request. The CPU masks the interrupt request if the interrupt level set in this register is greater than or equal to the level mask value set in the ILM register of the CPU. The bits are initialized to "11111B" at a reset. 236 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 10 INTERRUPT CONTROLLER 10.2 Registers of Interrupt Controller MB91313A Series Table 10.2-1 lists the available settings of the interrupt level setting bits and their respective interrupt levels. Table 10.2-1 Available Settings of Interrupt Level Setting Bits and Corresponding Interrupt Levels ICR4* ICR3 ICR2 ICR1 ICR0 0 0 0 0 0 0 0 1 1 1 0 14 0 1 1 1 1 15 1 0 0 0 0 16 1 0 0 0 1 17 1 0 0 1 0 18 1 0 0 1 1 19 1 0 1 0 0 20 1 0 1 0 1 21 1 0 1 1 0 22 1 0 1 1 1 23 1 1 0 0 0 24 1 1 0 0 1 25 1 1 0 1 0 26 1 1 0 1 1 27 1 1 1 0 0 28 1 1 1 0 1 29 1 1 1 1 0 30 1 1 1 1 1 31 *: ICR4 is fixed to be "1"; "0" cannot be written to it. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED Interrupt level System-reserved NMI Highest level available (High) (Low) Interrupts disabled 237 CHAPTER 10 INTERRUPT CONTROLLER 10.2 Registers of Interrupt Controller MB91313A Series HRCL (Hold Request Cancel Request Register) 10.2.2 The hold request cancel request register (HRCL) is a level setting register for generating a request to cancel a hold request. ■ Hold Request Cancel Request Register (HRCL) The hold request cancel request register (HRCL) consists of the following bits: Figure 10.2-2 Bit Configuration of Hold Request Cancel Request Register (HRCL) HRCL Address bit 00000045H 7 6 5 4 3 2 1 0 Initial value - - - LVL4 LVL3 LVL2 LVL1 LVL0 0--11111B - - - R R/W R/W R/W R/W R/W: Readable/writable R: Read only -: Unused [bit4 to bit0] LVL4 to LVL0 These bits set the interrupt level for generating a request to the bus master to cancel a hold request. If an interrupt request with a higher priority level than the interrupt level set in this register occurs, a request to cancel the hold request is issued to the bus master. The LVL4 bit is fixed to be "1"; "0" cannot be written to it. 238 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 10 INTERRUPT CONTROLLER 10.3 Operations of Interrupt Controller MB91313A Series 10.3 Operations of Interrupt Controller This section describes the operations of the interrupt controller. ■ Determining the Priority This module selects the highest-priority interrupt among any interrupt sources that occur simultaneously and outputs its interrupt level and interrupt number to the CPU. The criteria for determining the priority of interrupt sources are as follows. • Interrupt source whose interrupt level is not 31 (31 indicates "interrupt disabled") • Interrupt source with the lowest interrupt level value • Interrupt source with the smallest interrupt number while satisfying the above If no interrupt source is selected by the above criteria, 31 (11111B) is output as the interrupt level. The interrupt number in this case is indeterminate. For information on relationship between the interrupt sources, interrupt numbers, and interrupt levels, see "APPENDIX B Vector Table". ■ Hold Request Cancel Request If you want to process high- priority interrupts during a CPU hold (during DMA transfer), the module that generated the hold request needs to cancel the request. Use the HRCL register to set the reference interrupt level at which a request to cancel is to be generated. ● Generation criteria If an interrupt source with a higher priority level than the level set in the HRCL register occurs, a request to cancel the hold request is generated. If interrupt level in HRCL register > level of interrupt after priority judgment, then generate cancel request. If interrupt level in HRCL register ≤ level of interrupt after priority judgment, then do not generate cancel request. The cancel request remains active until the interrupt source that generated the cancel request is cleared and therefore no DMA transfer occurs during this time. Always clear the associated interrupt source. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 239 CHAPTER 10 INTERRUPT CONTROLLER 10.3 Operations of Interrupt Controller MB91313A Series ● Possible levels The values able to be set in the HRCL register are "10000B" to "11111B", the same as in the ICR. If "11111B" is set, a cancel request is generated for all interrupt levels. Table 10.3-1 shows the interrupt level settings for generating a request to cancel a hold request. Table 10.3-1 Interrupt Level Settings That Generate a Hold Request Cancel Request 16 None 17 Interrupt level 16 18 Interrupt levels 16 and 17 ~ Interrupt levels that generate a cancel request ~ HRCL register 31 Interrupt levels 16 to 30 [Initial value] Once a reset occurs, DMA transfer is inhibited for all interrupt levels. As this means that no DMA transfer will be performed when an interrupt occurs, set the required value in the HRCL register. ■ Returning from Standby (Stop or Sleep) Mode The function for using an interrupt request to return from stop mode is performed by this module. If even one interrupt request from a peripheral (with interrupt level other than "11111B") occurs, a request to return from stop mode is issued to the clock control unit. As the priority judgment unit restarts operation once the clock supply starts after recovery from stop mode, the CPU is able to execute instructions until the priority judgment unit produces a result. The same operation occurs when returning from sleep mode. Access to the registers in this module remains possible even in sleep mode. Note: Set the interrupt level for interrupt sources that you do not want to cause the device to return from stop or sleep mode to "11111B" in the corresponding peripheral control register. 240 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 10 INTERRUPT CONTROLLER 10.3 Operations of Interrupt Controller MB91313A Series ■ Example of Using the Function to Generate a Request to Cancel a Hold Request (HRCR) If you want the CPU to perform high-priority processing during DMA transfer, you need to cancel the hold state by requesting the DMA to cancel its hold request. This example uses an interrupt to cause the DMA to cancel its hold request and to give priority to CPU operation. ● Control registers (1) HRCL (Hold request cancel level setting register): this module: If an interrupt with a higher-priority level than the interrupt level set in this register occurs, a request to cancel the hold request is passed to the DMA. Set the level to use as the criterion. (2) ICR: this module: Set an interrupt level with a higher priority than the level set in the HRCL register in the ICRs of the interrupt sources you want to use. ● Hardware configuration Figure 10.3-1 shows the flow of each signal for a hold request. Figure 10.3-1 Hold Request Signal Flow This module IRQ Bus access request MHALTI I-unit DHREQ DMA B-unit DHREQ : D-bus hold request CPU DHACK : D-bus hold acknowledge IRQ (ICR) : Interrupt request MHALTI : Hold request cancel request (HRCL) DHACK ● Sequence Figure 10.3-2 shows the interrupt level for a higher priority level than the level set in the HRCL register. Figure 10.3-2 Interrupt Level: HRCL < ICR (LEVEL) RUN CPU Bus access request DHREQ Bus hold Interrupt processing (1) (2) Bus hold (DMA transfer) Example of interrupt routine (1) Clear interrupt source to DHACK (2) RETI IRQ LEVEL MHALTI CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 241 CHAPTER 10 INTERRUPT CONTROLLER 10.3 Operations of Interrupt Controller MB91313A Series When an interrupt request occurs and the interrupt level changes, the MHALTI signal to the DMA goes active if the new level has a higher priority than the level set in the HRCL register. This causes the DMA to cancel access requests and the CPU to return from the hold state and start processing the interrupt. Figure 10.3-3 shows the interrupt level for multiple interrupts. Figure 10.3-3 Interrupt Level: HRCL < ICR (Interrupt I) < ICR (Interrupt II) RUN Bus hold Interrupt processing II Interrupt I CPU Bus access request (3) (4) Interrupt processing I (1) Bus hold (DMA transfer) (2) DHREQ DHACK IRQ1 IRQ2 LEVEL MHALTI [Example of interrupt routine] (1), (3) Clear interrupt source to (2), (4) RETI The above example shows the case when a higher priority interrupt occurs during execution of interrupt routine I. DHREQ remains low while the interrupt with an interrupt level higher than the interrupt level set in the HRCL register is present. Note: Pay due attention to the relationship between the interrupt levels set in the HRCL register and ICRs. 242 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 11 EXTERNAL INTERRUPT CONTROL UNIT This chapters gives an overview of the external interrupt control unit and describes its register configuration/ functions and its operations. 11.1 Overview of External Interrupt Control Unit 11.2 Registers of External Interrupt Control Unit 11.3 Operations of External Interrupt Control Unit CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 243 CHAPTER 11 EXTERNAL INTERRUPT CONTROL UNIT 11.1 Overview of External Interrupt Control Unit 11.1 MB91313A Series Overview of External Interrupt Control Unit The external interrupt control unit is a block to control an external interrupt request input to the INT pin. The external interrupt to be detected can be selected from among the following four: • "H" level • "L" level • Rising edge • Falling edge These levels can be used for the STOP restore. ■ List of Registers of External Interrupt Control Unit The registers of the external interrupt control unit are listed below. Address 000040H to 0000C0H 0000C4H bit31 24 23 16 15 EIRR0 ENIR0 EIRR1 EIRR2 ENIR1 ENIR2 87 1 ELVR0 | ELVR1 ELVR2 ■ Block Diagram of External Interrupt Control Unit Figure 11.1-1 is a block diagram of the external interrupt control unit. Figure 11.1-1 Block Diagram of External Interrupt Control Unit R-bus 8 24 Interrupt enable register Gate 24 Source FF Edge detection circuit INT0 to INT23 8 Interrupt source register 16 Request level setting register 244 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 11 EXTERNAL INTERRUPT CONTROL UNIT 11.2 Registers of External Interrupt Control Unit MB91313A Series 11.2 Registers of External Interrupt Control Unit This section describes the register configuration and functions of the external interrupt control unit. ■ Details of Registers of External Interrupt Control Unit The external interrupt control unit has the following three types of registers: • Interrupt Enable Register (ENIR) • External Interrupt Source Register (EIRR) • External Interrupt Request Level Setting Register (ELVR) CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 245 CHAPTER 11 EXTERNAL INTERRUPT CONTROL UNIT 11.2 Registers of External Interrupt Control Unit 11.2.1 MB91313A Series Interrupt Enable Register (ENIR) The interrupt enable register (ENIR) controls the masking of the external interrupt request output. ■ Interrupt Enable Register (ENIR) The interrupt enable register consists of the following bits: Figure 11.2-1 Bit Configuration of Interrupt Enable Register (ENIR) ENIR0 Address bit 000041H 23 22 21 20 19 18 17 16 Initial value EN7 EN6 EN5 EN4 EN3 EN2 EN1 EN0 00000000B R/W R/W R/W R/W R/W R/W R/W R/W 15 14 13 12 11 10 9 8 Initial value EN15 EN14 EN13 EN12 EN11 EN10 EN9 EN8 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 Initial value EN23 EN22 EN21 EN20 EN19 EN18 EN17 EN16 00000000B R/W R/W R/W R/W R/W R/W R/W R/W ENIR1 Address bit 0000C1H ENIR2 Address bit 0000C5H R/W: Readable/writable When "1" is written to a bit in this register, the interrupt request output corresponding to the bit is enabled (for example, EN0 controls the enabling of INT0), and the interrupt request is output to the interrupt controller. The pin corresponding to the bit to which "0" is written holds the interrupt source but does not generate a request to the interrupt controller. 246 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 11 EXTERNAL INTERRUPT CONTROL UNIT 11.2 Registers of External Interrupt Control Unit MB91313A Series 11.2.2 External Interrupt Source Register (EIRR) The external interrupt source register (EIRR) is a register to indicate that a corresponding external interrupt request exists when read, and to clear a content of the flip-flop showing this request when written. ■ External Interrupt Source Register (EIRR) The external interrupt source register consists of the following bits: Figure 11.2-2 Bit Configuration of External Interrupt Source Register (EIRR) EIRR0 Address bit 000040H 23 22 21 20 19 18 17 16 Initial value ER7 ER6 ER5 ER4 ER3 ER2 ER1 ER0 00000000B R/W R/W R/W R/W R/W R/W R/W R/W 15 14 13 12 11 10 9 8 Initial value ER15 ER14 ER13 ER12 ER11 ER10 ER9 ER8 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 Initial value ER23 ER22 ER21 ER20 ER19 ER18 ER17 ER16 00000000B R/W R/W R/W R/W R/W R/W R/W R/W EIRR1 Address bit 0000C0H EIRR2 Address bit 0000C4H R/W: Readable/writable The operation performed when this EIRR register is read depends on the read value as follows. When a bit contains "1", it indicates that there is an external interrupt request at the pin corresponding to that bit. Writing "0" to a bit in this register clears the request flip-flop of that bit. Writing "1" is ignored. When this bit is read to a read-modify-write (RMW) instruction, "1" is always read. Depending on the pin state, the bit value of the external interrupt source register can be "1" even if "0" is written to the corresponding bit of the external interrupt enable register. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 247 CHAPTER 11 EXTERNAL INTERRUPT CONTROL UNIT 11.2 Registers of External Interrupt Control Unit 11.2.3 MB91313A Series External Interrupt Request Level Setting Register (ELVR) The external interrupt request level setting register (ELVR) is a register to select request detections. ■ External Interrupt Request Level Setting Register (ELVR) The external interrupt request level setting register (ELVR) consists of the following bits. Figure 11.2-3 Bit Configuration of External Interrupt Request Level Setting Register (ELVR) ELVR0 Address bit 000042H Address bit 000043H 15 14 13 12 11 10 9 8 Initial value LB7 LA7 LB6 LA6 LB5 LA5 LB4 LA4 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 Initial value LB3 LA3 LB2 LA2 LB1 LA1 LB0 LA0 00000000B R/W R/W R/W R/W R/W R/W R/W R/W 15 14 13 12 11 10 9 8 Initial value LB15 LA15 LB14 LA14 LB13 LA13 LB12 LA12 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 Initial value LB11 LA11 LB10 LA10 LB9 LA9 LB8 LA8 00000000B R/W R/W R/W R/W R/W R/W R/W R/W 15 14 13 12 11 10 9 8 Initial value LB23 LA23 LB22 LA22 LB21 LA21 LB20 LA20 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 Initial value LB19 LA19 LB18 LA18 LB17 LA17 LB16 LA16 00000000B R/W R/W R/W R/W R/W R/W R/W R/W ELVR1 Address bit 0000C2H Address bit 0000C3H ELVR2 Address bit 0000C6H Address 0000C7H bit R/W: Readable/writable 248 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 11 EXTERNAL INTERRUPT CONTROL UNIT 11.2 Registers of External Interrupt Control Unit MB91313A Series In the ELVR register, two bits are assigned to each interrupt channel, which results in the settings shown in the table below. When each bit in the EIRR register is cleared while the level is in the request input level, the corresponding bit is set again as long as the input is at active level. Table 11.2-1 shows assignment of ELVR. Table 11.2-1 Assignment of ELVR LBx, LAx Operation 00 "L" level indicates the presence of a request. [Initial value] 01 "H" level indicates the presence of a request. 10 A rising edge indicates the presence of a request. * 11 A falling edge indicates the presence of a request. * *: The setting to INT16-to-INT23 is disabled. Note: Any request level can be set for restoring from STOP. (INT0 to INT15) Notes: • If external interrupt request level is changed, internal interrupt request may be occurred. So clear the external interrupt register after changing the external interrupt request level. When you want to clear the external interrupt request level register once. • Edge detection is not available for the INT17 and INT19 channels. Always set these channels to use level detection. This restriction does not apply to the MB91F313A. • All request levels are able to be set after recovery from STOP (except for INT17 and INT19). This restriction does not apply to the MB91F313A. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 249 CHAPTER 11 EXTERNAL INTERRUPT CONTROL UNIT 11.3 Operations of External Interrupt Control Unit 11.3 MB91313A Series Operations of External Interrupt Control Unit This section describes the operations of the external interrupt control unit. ■ Operations of an External Interrupt If, after a request level and an enable register are set, a request defined in the ELVR register is input to the corresponding pin, this module generates an interrupt request signal to the interrupt controller. The interrupt controller identifies the priorities of interrupts simultaneously generated within the interrupt controller and, if it determines that the interrupt request from this resource has the highest priority, the corresponding interrupt generates. Figure 11.3-1 shows the external interrupt operation. Figure 11.3-1 External Interrupt Operation External interrupt ELVR Resource request Interrupt controller ICRyy EIRR ENIR CPU IL CMP ICRxx CMP ILM Source ■ Operating Procedure for an External Interrupt Set up the registers located inside the external interrupt control unit as follows: 1. Set the general-purpose I/O port served dual use as external interrupt input pin as the input port. 2. Disable the target bit in the enable interrupts register (ENIR). 3. Set the target bit in the external interrupt request level setting register (ELVR). 4. Read the external interrupt request level setting register (ELVR). 5. Clear the target bit in the enable interrupts register (ENIR). 6. Enable the target bit in the enable interrupts register (ENIR). However, simultaneous writing of 16-bit data is allowed for steps 5. and 6. Before setting a register in this module, you must disable the enable register. In addition, before enabling the enable register, you must clear the interrupt source register. This procedure is required to prevent an interrupt source from occurring by mistake while a register is being set or an interrupt is enabled. 250 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 11 EXTERNAL INTERRUPT CONTROL UNIT 11.3 Operations of External Interrupt Control Unit MB91313A Series ■ External Interrupt Request Level If the request level is an edge request, a pulse width of at least 3 machine cycles (peripheral clock machine cycles) is required to detect an edge. When the request input level is a level setting, the required pulse width is a minimum of 3 machine cycles. While the interrupt input pin is holding its active level, the interrupt request to the interrupt controller keeps on being generated even with the external interrupt source register cleared. If the request input level is a level setting, a request input is entered from outside and is then cancelled, the request to the interrupt controller remains active because a source holding circuit exists internally. The external interrupt source register must be cleared to cancel a request to the interrupt controller. Figure 11.3-2 illustrates the clearing of the source holding circuit when a level is set. Figure 11.3-2 Clearing the Source Holding Circuit When a Level is Set Interrupt input Level detection Source FF (source holding circuit) Enable gate Interrupt controller Holds a source unless it is cleared. Figure 11.3-3 shows an interrupt source and an interrupt request to the interrupt controller when interrupts are enabled. Figure 11.3-3 Interrupt Source with Interrupts Enables and Interrupt Request to Interrupt Controller R-bus 8 24 Interrupt enable register Gate 24 Source FF Edge detection circuit INT0 to INT23 8 Interrupt source register 16 Request level setting register CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 251 CHAPTER 11 EXTERNAL INTERRUPT CONTROL UNIT 11.3 Operations of External Interrupt Control Unit 252 FUJITSU SEMICONDUCTOR LIMITED MB91313A Series CM71-10143-5E CHAPTER 12 DELAY INTERRUPT MODULE This chapter explains the overview of the delay interrupt module, configuration/functions of the registers, and operations of the module. 12.1 Overview of Delay Interrupt Module 12.2 Registers of Delay Interrupt Module 12.3 Operations of Delay Interrupt Module CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 253 CHAPTER 12 DELAY INTERRUPT MODULE 12.1 Overview of Delay Interrupt Module 12.1 MB91313A Series Overview of Delay Interrupt Module The delay interrupt module generates an interrupt for switching tasks. Using this module, software can generate or release an interrupt request for the CPU. ■ Register List of Delay Interrupt Module Register list of the delay interrupt module is as follows: DICR Address 000044H bit 7 6 5 4 3 2 1 0 - - - - - - - DLYI R/W R/W: Readable/writable -: Undefined ■ Block Diagram of Delay Interrupt Module Figure 12.1-1 shows a block diagram of the delay interrupt module. Figure 12.1-1 Block Diagram of Delay Interrupt Module R-bus Interrupt request 254 DLYI FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 12 DELAY INTERRUPT MODULE 12.2 Registers of Delay Interrupt Module MB91313A Series 12.2 Registers of Delay Interrupt Module This section explains the register configurations/functions of the delay interrupt module. ■ DICR (Delay Interrupt Module Register) DICR controls the delay interrupt. The bit configuration of the delay interrupt module register (DICR) is as follows: DICR Address bit 000044H 7 6 5 4 3 2 1 0 Initial value - - - - - - - DLYI -------0B R/W R/W: Readable/writable -: Undefined [bit0] DLYI DLYI Description 0 No release and request of delay interrupt source [Initial value] 1 Generated delay interrupt source This bit controls generating and releasing of the corresponding interrupt sources. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 255 CHAPTER 12 DELAY INTERRUPT MODULE 12.3 Operations of Delay Interrupt Module 12.3 MB91313A Series Operations of Delay Interrupt Module The delay interrupt is an interrupt generated for switching tasks.Use this function to allow a software program to generate an interrupt request for the CPU or to release an interrupt request. ■ Interrupt Number A delay interrupt is assigned to the interrupt source corresponding to the largest interrupt number. In this model, a delay interrupt is assigned to interrupt number 63 (3FH). ■ DLYI Bit of DICR Writing "1" to this bit generates a delay interrupt source.Writing "0" clears a delay interrupt source. This bit is the same as the interrupt source flag for a normal interrupt. Therefore, clear this bit and switch tasks in the interrupt routine. 256 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 13 BIT SEARCH MODULE This chapter explains the overview of the bit search module, configurations/functions of the registers, and operations of the module. 13.1 Overview of Bit Search Module 13.2 Registers of Bit Search Module 13.3 Operations of Bit Search Module CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 257 CHAPTER 13 BIT SEARCH MODULE 13.1 Overview of Bit Search Module 13.1 MB91313A Series Overview of Bit Search Module The bit search module searches for "0", "1", or any points of change for data written to the input register and then returns the detected bit locations. ■ Register List of Bit Search Module Register list of the bit search module is as follows: bit31 Address: 0003F0H bit0 BSD0 0 Detection data register Address: 0003F4H BSD1 1 Detection data register Address: 0003F8H BSDC Change point detection data register Address: 0003FCH BSRR Detection result register ■ Block Diagram of Bit Search Module Figure 13.1-1 shows a block diagram of the bit search module. Figure 13.1-1 Block Diagram of Bit Search Module D-bus Input latch Address decoder Detection mode 1 detection data Bit search circuit Detection result 258 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 13 BIT SEARCH MODULE 13.2 Registers of Bit Search Module MB91313A Series 13.2 Registers of Bit Search Module This section explains the register configurations/functions of the bit search module. ■ 0 Detection Data Register (BSD0) 0 detection is performed for written value. Shown below is the configuration of the 0 detection data register (BSD0): Figure 13.2-1 Bit Configuration of 0 Detection Data Register (BSD0) Address bit31 bit0 0003F0H Read/write Initial value W XXXXXXXXH The initial value after a reset is undefined. Read value is undefined. Use a 32-bit length data transfer instruction for data transfer (Do not use 8-bit or 16-bit length data transfer instructions). ■ 1 Detection Data Register (BSD1) Shown below is the configuration of the 1 detection data register (BSD1): Figure 13.2-2 Bit Configuration of 1 Detection Data Register (BSD1) Address bit31 bit0 0003F4H Read/write Initial value R/W XXXXXXXXH Use a 32-bit length data transfer instruction for data transfer (Do not use 8-bit or 16-bit length data transfer instructions). • Writing: "1" detection is performed for the written value. • Reading: Saved data of the internal state in the bit search module is read. This register is used to save and restore to the original state when the bit search module is used by, for example, an interrupt handler. Even though data is written to the 0 detection, change point detection, or data register, the data can be saved and restored only by using the 1 detection data register. The initial value after a reset is undefined. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 259 CHAPTER 13 BIT SEARCH MODULE 13.2 Registers of Bit Search Module MB91313A Series ■ Change Point Detection Data Register (BSDC) Point of change is detected in the written value. Shown below is the configuration of the change point detection data register (BSDC): Figure 13.2-3 Bit Configuration of Change Point Detection Data Register (BSDC) Address bit31 bit0 0003F8H Read/write Initial value W XXXXXXXXH The initial value after a reset is undefined. Read value is undefined. Use a 32-bit length data transfer instruction for data transfer (Do not use 8-bit or 16-bit length data transfer instructions). ■ Detection Result Register (BSRR) The result of 0 detection, 1 detection, or change point detection is read. Which detection result is to be read is determined by the data register that has been written to last. Register configuration of the detection result register (BSRR) is as follows: Figure 13.2-4 Bit Configuration of Detection Result Register (BSRR) Address bit31 bit0 0003FCH Read/write Initial value 260 R XXXXXXXXH FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 13 BIT SEARCH MODULE 13.3 Operations of Bit Search Module MB91313A Series 13.3 Operations of Bit Search Module This section explains the operations of the bit search module. ■ 0 Detection The bit search module scans data written to the 0 detection data register from MSB to LSB and returns the location where the first "0" is detected. The detection result can be obtained by reading the detection result register. The relationship between the detected location and the return value is described in Table 13.3-1. If "0" is not found (that is, the value is FFFFFFFFH), 32 is returned as the search result. [Execution example] Written data Read value (decimal) 11111111111111111111000000000000B (FFFFF000H) → 20 11111000010010011110000010101010B (F849E0AAH) → 5 10000000000000101010101010101010B (8002AAAAH) → 1 11111111111111111111111111111111B (FFFFFFFFH) → 32 ■ 1 Detection The bit search module scans data written to the 1 detection data register from MSB to LSB and returns the location where the first "1" is detected. The detection result can be obtained by reading the detection result register. The relationship between the detected location and the return value is described in Table 13.3-1. If "1" is not found (that is, the value is 00000000H), 32 is returned as the search result. [Execution example] Written data CM71-10143-5E Read value (decimal) 00100000000000000000000000000000B (20000000H) → 2 00000001001000110100010101100111B (01234567H) → 7 00000000000000111111111111111111B (0003FFFFH) → 14 00000000000000000000000000000001B (00000001H) → 31 00000000000000000000000000000000B (00000000H) → 32 FUJITSU SEMICONDUCTOR LIMITED 261 CHAPTER 13 BIT SEARCH MODULE 13.3 Operations of Bit Search Module MB91313A Series ■ Change Point Detection The bit search module scans data written to the change point detection data register from bit30 to LSB for comparison with the MSB value. The first location where a value that is different from that of the MSB is detected is returned. The detection result can be obtained by reading the detection result register. The relationship between the detected location and the return value is described in Table 13.3-1. If a change point is not detected, 32 is returned. In change point detection, "0" is never returned as a result. [Execution example] Written data Read value (decimal) 00100000000000000000000000000000B (20000000H) → 2 00000001001000110100010101100111B (01234567H) → 7 00000000000000111111111111111111B (0003FFFFH) → 14 00000000000000000000000000000001B (00000001H) → 31 00000000000000000000000000000000B (00000000H) → 32 11111111111111111111000000000000B (FFFFF000H) → 20 11111000010010011110000010101010B (F849E0AAH) → 5 10000000000000101010101010101010B (8002AAAAH) → 1 11111111111111111111111111111111B (FFFFFFFFH) → 32 Table 13.3-1 shows the bit locations and return values (decimal). Table 13.3-1 Bit Locations and Return Values (Decimal) Detected Bit Location Return Value Detected Bit Location Return Value Detected Bit Location Return Value Detected Bit Location Return Value 31 0 23 8 15 16 7 24 30 1 22 9 14 17 6 25 29 2 21 10 13 18 5 26 28 3 20 11 12 19 4 27 27 4 19 12 11 20 3 28 26 5 18 13 10 21 2 29 25 6 17 14 9 22 1 30 24 7 16 15 8 23 0 31 Does not exist 32 262 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 13 BIT SEARCH MODULE 13.3 Operations of Bit Search Module MB91313A Series ■ Process of Save/Restore If it is necessary to save and restore the internal state of the bit search module, such as when the bit search module is used in an interrupt handler, use the following procedure: 1) Read the 1 detection data register and save its content (save). 2) Use the bit search module. 3) Write the data saved in 1) to the 1 detection data register (restore). With the above operation, the value obtained when the detection result register is read the next time corresponds to the value written to the bit search module before 1). If the data register written to last is the 0 detection or change point detection register, the value is restored correctly with the above procedure. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 263 CHAPTER 13 BIT SEARCH MODULE 13.3 Operations of Bit Search Module 264 FUJITSU SEMICONDUCTOR LIMITED MB91313A Series CM71-10143-5E CHAPTER 14 10-BIT A/D CONVERTER This chapter gives an overview of the 10-bit A/D converter, register configuration and functions, and 10- bit A/D converter operation. 14.1 Overview of the 10-Bit A/D Converter CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 265 CHAPTER 14 10-BIT A/D CONVERTER 14.1 Overview of the 10-Bit A/D Converter 14.1 MB91313A Series Overview of the 10-Bit A/D Converter The 10-bit successive approximation A/D converter has two operation modes: conversion start by software and conversion start by external trigger. ■ Features of the 10-Bit A/D Converter • Conversion time: 7.94 μs (sampling: 5.91 μs, conversion: 2.03 μs) when fch is @33MHz • A/D conversion result register available for each channel • Channel scan function ■ Registers Address 000020H 266 bit15 bit0 ADCTH ADCTL A/D Converter control register 000022H ADCH Software conversion analog input select register 000024H ADAT0 A/D conversion result register ch.0 000026H ADAT1 A/D conversion result register ch.1 000028H ADAT2 A/D conversion result register ch.2 00002AH ADAT3 A/D conversion result register ch.3 00002CH ADAT4 A/D conversion result register ch.4 00002EH ADAT5 A/D conversion result register ch.5 000030H ADAT6 A/D conversion result register ch.6 000032H ADAT7 A/D conversion result register ch.7 000034H ADAT8 A/D conversion result register ch.8 000036H ADAT9 A/D conversion result register ch.9 000038H TEST A/D converter test register (access prohibited) FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 14 10-BIT A/D CONVERTER 14.1 Overview of the 10-Bit A/D Converter MB91313A Series ■ Block Diagram Figure 14.1-1 A/D Converter Block Diagram BUFFER× 10 Internal data bus D/A Converter Comparator MPX AN9 AN8 AN7 AN6 AN5 AN4 AN3 AN2 AN1 AN0 Control Logic S/H A/D ch & Status Control Logic External pin ATRG CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED IRQ 267 CHAPTER 14 10-BIT A/D CONVERTER 14.1 Overview of the 10-Bit A/D Converter MB91313A Series ■ A/D Converter Control Register (ADCTH, ADCTL) Figure 14.1-2 Bit Configuration of A/D Converter Control Register (ADCTH, ADCTL) ADCTH Address bit 15 14 13 12 11 10 9 8 Initial value - - - - - - TRG STR 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 Initial value ASS3 ASS2 ASS1 ASS0 BUSY - INT INTE 00000000B R/W R/W R/W R/W R/W R/W R/W R/W 000020H ADCTL Address 000021H bit R/W: Readable/writable [bit15 to bit10] Unused bits The read value of these bits are always "000000B". [bit9] TRG 0 Start by external pin trigger is prohibited. 1 Start by external pin trigger When this bit is set to "1", A/D conversion is started when a rising edge is detected at external pin (ATRG) input. This bit is ignored if an edge is detected during A/D conversion. [bit8] STR This bit is the A/D conversion start bit. 0 No effect 1 Software start/restart (write during conversion) The read value of this bit is always "0". [bit7 to bit4] ASS3 to ASS0 These bits enable reading of the selected analog channel. This bit enables reading of effective data when [bit3] BUSY = 1. 268 0000B to 1001B Selected channel Others Setting disabled FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 14 10-BIT A/D CONVERTER 14.1 Overview of the 10-Bit A/D Converter MB91313A Series [bit3] BUSY This bit is a flag that indicates A/D conversion is in progress. 0 A/D conversion is not in progress. 1 A/D conversion is in progress. [bit2] Unused bit The read value of this bit is always "0". [bit1] INT This bit is the A/D conversion end flag. 0 No conversion, or conversion is in progress. 1 Conversion is completed. [bit0] INTE This bit is the A/D conversion interrupt enable bit. 0 Interrupt is disabled. 1 Interrupt is enabled. When INT and INTE are both set to "1", an interrupt request is generated. ■ Software Conversion Analog Input Select Register Figure 14.1-3 Bit Configuration of Software Conversion Analog Input Select Register ADCH Address bit 000022H Address bit 000022H 15 14 13 12 11 10 9 8 Initial value - - - - - - i9 i8 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 Initial value i7 i6 i5 i4 i3 i2 i1 i0 00000000B R/W R/W R/W R/W R/W R/W R/W R/W R/W:Readable/writable [bit15 to bit10] Unused bits The read value of these bits are always "0". CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 269 CHAPTER 14 10-BIT A/D CONVERTER 14.1 Overview of the 10-Bit A/D Converter MB91313A Series [bit9 to bit0] i9 to i0 These bits are the software conversion analog input select bits. 0 Input is not selected. 1 Input is selected. If multiple inputs are selected, data is sequentially converted for all selected inputs. ■ A/D Conversion Result Register (Channels 0 to 9) Figure 14.1-4 Bit Configuration of A/D Conversion Result Register (Channels 0 to 9) ADAT0 to ADAT9 Address bit 000022H Address 000022H bit 15 14 13 12 11 10 9 8 Initial value - - - - - - d9 d8 00000000B R R R R R R R R 7 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 R: Read only [bit15 to bit10] Reserved The read value of these bits are always "000000B". [bit9 to bit0] d9 to d0 These bits store the A/D conversion result for the channels. ■ A/D Conversion Started by Software To perform A/D conversion started by software, select the required channel from analog input pins AN0 to AN9. Write "1" to the corresponding bit of the ADCH register to enable A/D conversion. (1) Single channel If only one channel is selected as the analog input pin for conversion, writing "1" to the STR bit of the ADCTH register starts software-started conversion and sets the BUSY bit of the ADCH register to "1". Writing "1" to the STR bit again during conversion initializes the converter and restarts conversion. After A/D conversion ends, the BUSY bit of the ADCH register is reset to "0" and the INT bit of the ADCTL register is set to "1". These status bits can be read to determine whether conversion has ended. To generate an interrupt to complete conversion, set the INTE bit of the ADCTL register to "1" beforehand. (2) Multiple channels (scan conversion) If multiple channels are selected as the analog input pins for conversion, the converter performs A/D conversion for the first selected channel and then stores the conversion result in the register corresponding to the channel. The converter then repeats this process for the remaining selected channels. 270 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 14 10-BIT A/D CONVERTER 14.1 Overview of the 10-Bit A/D Converter MB91313A Series Writing 1 to the corresponding bit of the ADCH register to select the channel for conversion and writing "1" to the STR bit of the ADCH register start conversion and set the BUSY bit of the ADCTL register to "1". The channels are converted sequentially from 0 to 9. If a channel is not selected in the ADCH register, the converter skips that channel and starts conversion for the next selected channel. Writing "1" to the STR bit again during conversion initializes the converter and restarts conversion for the selected channels in the order of 0 to 9. When A/D conversion for all selected channels ends, the BUSY bit of the ADCTL register is reset to "0" and the INT bit of the ADCTL register is set to "1". To generate an interrupt to complete conversion, set the INTE bit of the ADCTL register to "1" beforehand. The results of A/D conversion are stored in the registers of individual channels. ■ A/D Conversion Started by External Trigger If external trigger start is enabled (ADCTH: TRG = 1), detection of a rising edge at external pin (ATRG) input starts A/D conversion. If the signal for A/D conversion by software is received when the external trigger is enabled, conversion is also started. If a rising edge is detected again at external pin (ATRG) input during A/D conversion, conversion is initialized and restarts the operation from the beginning. Note: When entering the stop mode in the low-power consumption mode, be sure to confirm that A/D conversion is not in progress. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 271 CHAPTER 14 10-BIT A/D CONVERTER 14.1 Overview of the 10-Bit A/D Converter 272 FUJITSU SEMICONDUCTOR LIMITED MB91313A Series CM71-10143-5E CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE This chapter describes the functions and operations of the multi function serial interface. 15.1 Overview of the Multi Function Serial Interface 15.2 Functions of UART (Asynchronous Multi Function Serial Interface) 15.3 Registers of UART (Asynchronous Multi Function Serial Interface) 15.4 Interrupts of UART 15.5 Operations of UART 15.6 UART Dedicated Baud Rate Generator 15.7 Setting Procedure and Program Flow for Operating Mode 0 (Asynchronous Normal Mode) 15.8 Setting Procedure and Program Flow for Operating Mode 1 (Asynchronous Multiprocessor Mode) 15.9 Notes on UART Mode 15.10 Overview of CSIO (Clock Synchronous Multi Function Serial Interface) 15.11 Registers of CSIO (Clock Synchronous Multi Function Serial Interface) 15.12 Interrupts of CSIO (Clock Synchronous Multi Function Serial Interface) 15.13 Operations of CSIO (Clock Synchronous Multi Function Serial Interface) 15.14 CSIO Dedicated Baud Rate Generator 15.15 Setting Procedure and Program Flow for CSIO (Clock Synchronous Multi Function Serial Interface) 15.16 Notes on CSIO Mode CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 273 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE MB91313A Series 15.17 Overview of the I2C Interface 15.18 Registers of the I2C Interface 15.19 Interrupts of the I2C Interface 15.20 Operations of I2C Interface Communication 15.21 Dedicated Baud Rate Generator 15.22 Examples of I2C Flowchart 15.23 Notes on I2C Mode 274 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.1 Overview of the Multi Function Serial Interface MB91313A Series 15.1 Overview of the Multi Function Serial Interface This section describes the overview of multi function serial interface. ■ Interface Mode The multi function serial interface can select the following interface modes depending on the operating mode setting: • UART0 (asynchronous normal multi function serial interface) • UART1 (asynchronous multiprocessor multi function serial interface) • CSIO (clock synchronous multi function serial interface) (capable of supporting SPI) • I2C (I2C bus interface) ■ Switching the Interface Modes When communicating with each multi function serial interface, set the operating mode in the registers shown in Table 15.1-1 before starting the communication. Figure 15.1-1 Bit Configuration of Serial Mode Register (SMR) SMR bit 7 6 5 4 3 2 1 0 Initial value MD2 MD1 MD0 - WUCR SBL SCKE SOE 000-0000B R/W R/W R/W - R/W R/W R/W R/W R/W: Readable/writable -: Undefined Table 15.1-1 Switching the Interface Modes MD2 MD1 MD0 Interface mode 0 0 0 UART0 (asynchronous normal multi function serial interface) 0 0 1 UART1 (asynchronous multiprocessor multi function serial interface) 0 1 0 CSIO (clock synchronous multi function serial interface) (capable of supporting SPI) 1 0 0 I2C (I2C bus interface) Note: Any mode other than those above is prohibited to set. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 275 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.1 Overview of the Multi Function Serial Interface MB91313A Series Notes: • If you switch the mode while transmission/reception operation using 1 multi function serial interface, the transmission/reception operation cannot be guaranteed. • Set the operating mode first because the other registers will be initialized once the operating mode has been changed. However, when SCR and SMR are written at the same time by 16-bit writing, the written contents will be reflected on SCR. ■ Transmission and Reception FIFO (Ch.0, Ch.1 and Ch.2) 16-byte transmission FIFO and 16-byte reception FIFO are provided to ch.0, ch.1 and ch.2. Read the number of stages of FIFO described from here on as 16-byte. Since FIFO will not be provided other than ch.0, ch.1 and ch.2, ignore the description about FIFO and refer to the description when FIFO is not used. 276 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E MB91313A Series 15.2 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.2 Functions of UART (Asynchronous Multi Function Serial Interface) Functions of UART (Asynchronous Multi Function Serial Interface) UART (asynchronous multi function serial interface) is a general-purpose serial data communication interface for asynchronous communication with external devices. UART supports bidirectional communication function (normal mode), master/slave communication function (multiprocessor mode: supports both master/slave). In addition, it has the transmission/reception FIFO. ■ Functions of UART (Asynchronous Multi Function Serial Interface) Function 1 Data 2 Serial input 3 Transfer format 4 Baud rate 5 Data length 6 Signal method 7 Start bit detection 8 Performs oversampling 3 times and determines the reception value by majority decision of the sampling values Asynchronous • Dedicated baud rate generator (15-bit reload counter configuration) • External clock input can be adjusted with the reload counter • 5 to 9 bits (normal mode) and 7 or 8 bits (multiprocessor mode) NRZ (Non Return to Zero), invert NRZ • Synchronizes with the start bit falling edge (for NRZ method) • Synchronizes with the start bit rising edge (for invert NRZ method) • Framing error Reception error detection • Overrun error • Parity error* 9 Interrupt request 10 Master/slave communication function (multiprocessor mode) 11 • Full-duplex, double buffering (when FIFO is not used) • Transmission/reception FIFO (maximum size 16-byte each) (when FIFO is used) FIFO options • Reception interrupt (reception completion, framing error, overrun error, and parity error*) • Transmission interrupt (transmission data empty, transmission bus idle) • Transmission FIFO interrupt (when the transmission FIFO is empty) • Both transmission/reception have the extended intelligent I/O service (EI2OS) and DMA function 1: n communication (1 = master, n = slaves) is enabled (supports both master and slave systems) • Transmission/reception FIFO are provided (maximum size: transmission FIFO 16-byte, reception FIFO 16-byte) • Transmission FIFO and reception FIFO can be selected • Transmission data can be retransmitted • Reception FIFO interrupt timing can be changed from the software • Independent FIFO reset support *: Parity error is enabled in normal mode only. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 277 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.3 Registers of UART (Asynchronous Multi Function Serial Interface) MB91313A Series Registers of UART (Asynchronous Multi Function Serial Interface) 15.3 This section shows the register list of UART (asynchronous multi function serial interface). ■ Register List of UART (Asynchronous Multi Function Serial Interface) Table 15.3-1 Register List of UART (Asynchronous Multi Function Serial Interface) Address bit15 bit8 bit7 bit0 000X0H 000X1H SCR (serial control register) SMR (serial mode register) 000X2H 000X3H SSR (serial status register) ESCR (extended communication control register) UART 000X4 H 000X5H RDR1/TDR1 (transmission and reception data register 1) RDR0/TDR0 (transmission and reception data register) 000X6H 000X7H BGR1 (baud rate generator register 1) BGR0 (baud rate generator register 0) 000X8H 000X9H 000YAH 000YBH FCR1 (FIFO control register 1) FCR0 (FIFO control register 0) 000YCH 000YDH FBYTE2 (FIFO2 byte register) FBYTE1 (FIFO1 byte register) FIFO - - (X = 06H, 07H, 08H, 09H, 0AH, 0BH, 1BH, 1CH, 1DH, 1EH, 1FH, Y = 06H, 07H, 08H) Table 15.3-2 Bit Arrangement of UART (Asynchronous Multi Function Serial Interface) bit15 bit14 bit13 bit12 bit11 bit10 bit9 bit8 bit7 bit6 bit5 bit4 bit3 bit2 bit1 SCR/SMR UPCL - - SSR/ESCR REC - PE L0 D4 D3 D2 D1 D0 B4 B3 B2 B1 B0 FLST FLD FSET FCL2 FCL1 FE2 FE1 FD15 FD14 FD13 FD12 FD11 FD10 FD9 FD8 FD7 FD6 FD5 FD4 FD3 FD2 FD1 FD0 EXT B14 B13 B12 B11 B10 INV PEN D8(AD) D7 D6 D5 B8 B7 B6 B5 - FCR1/FCR0 FTST1 FTST0 278 B9 - SOE L1 - - SBL BDS SCKE L2 - FBYTE2/ FBYTE1 FRE ORE RDRF TDRE TBI - P TDR (RDR) BGR1/BGR0 RIE TIE TBIE RXE TXE MD2 MD1 MD0 bit0 - - FLSTE FRIIE FDRQ FTIE FSEL - FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.3 Registers of UART (Asynchronous Multi Function Serial Interface) MB91313A Series ■ Operating Modes UART (asynchronous multi function serial interface) operates in 2 different modes. MD2, MD1, and MD0 in the serial mode register (SMR) are used to select the operating mode. Table 15.3-3 Operating Mode of UART (Asynchronous Multi Function Serial Interface) Operating mode CM71-10143-5E MD2 MD1 MD0 Type 0 0 0 0 UART0 (asynchronous normal mode) 1 0 0 1 UART1 (asynchronous multiprocessor mode) FUJITSU SEMICONDUCTOR LIMITED 279 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.3 Registers of UART (Asynchronous Multi Function Serial Interface) 15.3.1 MB91313A Series Serial Control Register (SCR) Serial control register (SCR) can enable/disable the transmission and reception, the transmission and reception interrupt, transmission bus idle interrupt, and perform UART reset. ■ Serial Control Register (SCR) Figure 15.3-1 shows the bit configuration of the serial control register (SCR), and Table 15.3-4 shows the function of each bit. Figure 15.3-1 Bit Configuration of Serial Control Register (SCR) SCR bit 15 ch.0 000060H UPCL ch.1 000070H ch.2 000080H R/W ch.3 000090H ch.4 0000A0H ch.5 0000B0H ch.6 0001B0H ch.7 0001C0H ch.8 0001D0H ch.9 0001E0H ch.A 0001F0H 14 13 12 11 10 9 8 Initial value − − RIE TIE TBIE RXE TXE 0--00000B − − R/W R/W R/W R/W R/W TXE 0 1 Transmission enable bit Disables transmission Enables transmission RXE 0 1 Reception enable bit Disables reception Enables reception TBIE Transmission bus idle interrupt enable bit Disables transmission bus idle interrupt 0 1 Enables transmission bus idle interrupt TIE 0 1 Transmission interrupt enable bit Disables transmission interrupt Enables transmission interrupt RIE 0 1 Reception interrupt enable bit Disables reception interrupt Enables reception interrupt Unused bits Read the values are undefined. Writing has no effect on operation. UPCL R/W : Readable/writable 0 1 Programmable clear bit Write Read No effect Always read "0" Programmable clear : Initial value 280 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E MB91313A Series CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.3 Registers of UART (Asynchronous Multi Function Serial Interface) Table 15.3-4 Function Description of Each Bit in the Serial Control Register (SCR) Bit name Function bit15 UPCL: Programmable clear bit Initializes the internal state of UART. When "1" is set: • UART is directly reset (software reset). However, the register setting is retained. The UART that is under transmission/reception status is immediately disconnected. • Baud rate generator reloads the value set in BGR1/BGR0 register and restarts. • All transmission and reception interrupt sources (PE, FRE, ORE, RDRF, TDRE, and TBI) are initialized (000011B). When "0" is set: There is no effect. When reading, "0" is always returned. Notes: • Execute programmable clear after you disable an interrupt. • When using FIFO, disable FIFO (FE2, FE1 = 0) before you execute programmable clear. bit14, bit13 Unused bits When reading : Values are undefined. When writing : No effect. bit12 RIE: Reception interrupt enable bit • Enables/disables the output of a reception interrupt request to the CPU. • A reception interrupt request is output when RIE bit and the reception data flag bit (RDRF) are "1" or when any of the error flag bits (PE, ORE, FRE) is set to "1". bit11 TIE: Transmission interrupt enable bit • Enables/disables the output of a transmission interrupt request to the CPU. • A transmission interrupt request is output when TIE bit and the TDRE bit are "1". bit10 TBIE: Transmission bus idle interrupt enable bit • Enables/disables the output of a transmission bus idle interrupt request to the CPU. • A transmission bus idle interrupt request is output when TBI bit and the TBIE bit are "1". bit9 Enables/disables the reception operation of UART. • When "0" is set: Disables the reception operation. • When "1" is set: Enables the reception operation. RXE: Notes: Reception operation enable • Even if the reception operation is enabled (RXE = 1), it will not start until the start bit bit falling edge (for NRZ format (INV = 0)) is input (For invert NRZ format (INV=1), it will not start until the rising edge is input). • The reception operation is immediately stopped if you disable it (RXE = 0) while receiving. bit8 TXE: Transmission operation enable bit CM71-10143-5E Enables/disables the transmission operation of UART. When "0" is set: Disables the transmission operation. When "1" is set: Enables the transmission operation. Note: The transmission operation is immediately stopped if you disable it (TXE = 0) while transmitting. FUJITSU SEMICONDUCTOR LIMITED 281 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.3 Registers of UART (Asynchronous Multi Function Serial Interface) 15.3.2 MB91313A Series Serial Mode Register (SMR) Serial mode register (SMR) can set the operating mode, select transfer direction, data length and stop bit length, and enable/disable the output to the pin of the serial data and clock. ■ Serial Mode Register (SMR) Figure 15.3-2 shows the bit configuration of the serial mode register (SMR), and Table 15.3-5 shows the function of each bit. Figure 15.3-2 Bit Configuration of Serial Mode Register (SMR) SMR bit 7 6 5 ch.0 000061H MD0 MD2 MD1 ch.1 000071H ch.2 000081H R/W R/W R/W ch.3 000091H ch.4 0000A1H ch.5 0000B1H ch.6 0001B1H ch.7 0001C1H ch.8 0001D1H ch.9 0001E1H ch.A 0001F1H 4 − 3 2 1 0 Initial value SBL BDS SCKE SOE 000−0000B R/W R/W R/W R/W R/W SOE 0 1 Serial data output enable bit Disables SOT output Enables SOT output SCKE Serial clock output enable bit Disables SCK output or Enables SCK input Enables SCK output 0 1 BDS 0 1 SBL 0 1 Transfer direction selection bit LSB first (transferred with the lowest bit) MSB first (transferred with the highest bit) Stop bit length selection bit 1-bit 2-bit Undefined bit Read value is undefined. Writing has no effect on operation. R/W : Readable/writable : Initial value MD2 MD1 MD0 Operating mode setting bits 0 0 0 Operating mode 0 (asynchronous normal mode) 0 0 1 Operating mode 1 (asynchronous multiprocessor mode) 0 1 0 Operating mode 2 (clock synchronous mode) 1 0 0 Operating mode 4 (I2C mode) Note: This chapter explains the register and operation in the operating modes 0 and 1. 282 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E MB91313A Series CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.3 Registers of UART (Asynchronous Multi Function Serial Interface) Table 15.3-5 Function Description of Each Bit in the Serial Mode Register (SMR) Bit name Function bit7 to bit5 MD2, MD1, MD0: Operating mode setting bits Sets the operating mode of the asynchronous multifunction multi function serial interface. "000B": Sets to the operating mode 0 (asynchronous normal mode) "001B": Sets to the operating mode 1 (asynchronous multiprocessor mode) "010B": Sets to the operating mode 2 (clock synchronous mode) "100B": Sets to the operating mode 4 (I2C mode) This chapter explains the register and operation in the operating mode 0 (asynchronous normal mode) and 1 (asynchronous multiprocessor mode). Notes: • Any setting other than those above is disabled. • When switching the operating mode, execute the programmable clear (SCR:UPCL =1) before switching it. • Set the operating mode, and then set each register. bit4 Unused bit When reading : Value is undefined. When writing : No effect. bit3 SBL: Stop bit length selection bit Specifies the bit length of the stop bit (frame end mark of the transmission data). When "0" is set: Sets the stop bit to 1-bit. When "1" is set: Sets the stop bit to 2-bit. Notes: • When receiving, only the first bit of the stop bit is always detected. • Specify this bit when the transmission is disabled (TXE = 0). bit2 BDS: Transfer direction selection bit Specifies whether the transfer serial data is transferred with the lowest bit (LSB first, BDS = 0) or the highest bit (MSB first, BDS = 1). Note: Specify this bit when the transmission/reception are disabled (TXE = RXE= 0). bit1 Controls the I/O port of the serial clock. When "0" is set: Enables SCK "H" output or SCK input. SCKE: When using as SCK input, set the general-purpose I/O port as an input Serial clock output enable port. In addition, select the external clock by using the external clock bit selection bit (BGR:EXT = 1). When "1" is set: Enables SCK output. bit0 SOE: Serial data output enable bit Enables/disables the output of the serial data. When "0" is set: Enables SOT "H" output. When "1" is set: Enables SOT output. Note: Set the operating mode first because the other registers will be initialized once the operating mode has been changed. However, when SCR and SMR are written at the same time by 16-bit writing, the written contents will be reflected on SCR. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 283 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.3 Registers of UART (Asynchronous Multi Function Serial Interface) 15.3.3 MB91313A Series Serial Status Register (SSR) Serial status register (SSR) verifies the transmission/reception status and the reception error flag, and also clears the reception error flag. ■ Serial Status Register (SSR) Figure 15.3-3 shows the bit configuration of the serial status register (SSR), and Table 15.3-6 shows the function of each bit. Figure 15.3-3 Bit Configuration of Serial Status Register (SSR) SSR bit 15 ch.0 000062H ch.1 000072H REC ch.2 000082H R/W ch.3 000092H ch.4 0000A2H ch.5 0000B2H ch.6 0001B2H ch.7 0001C2H ch.8 0001D2H ch.9 0001E2H ch.A 0001F2H 14 13 12 − PE FRE − R R 11 10 9 8 ORE RDRF TDRE TBI R R R Initial value 0-000011B R TBI 0 1 Transmission bus idle flag bit Transmitting No transmission operation TDRE 0 1 Transmission data empty flag bit Transmission data register (TDR) has data Transmission data register is empty RDRF Reception data full flag bit Reception data register (RDR) is empty 0 1 Reception data register (RDR) has data ORE 0 1 Overrun error flag bit No overrun error There is an overrun error FRE 0 1 Framing error flag bit No framing error There is a framing error PE 0 1 Parity error flag bit No parity error There is a parity error Unused bit Read value is undefined. Writing has no effect on operation. REC 0 R/W R - : Readable/writable : Read only : Undefined 1 Reception error flag clear bit Write Read No effect Always reads "0" Clears reception error flags (PE, FRE, ORE) : Initial value 284 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E MB91313A Series CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.3 Registers of UART (Asynchronous Multi Function Serial Interface) Table 15.3-6 Function Description of Each Bit in the Serial Status Register (SSR) (1 / 2) Bit name Function bit15 REC: Reception error flag clear bit Clears PE, FRE and ORE flags in the serial status register (SSR). • Writing "1" to this bit clears the error flags. • Writing "0" has no effect. When reading, "0" is always returned. bit14 Unused bit When reading : Value is undefined. When writing : No effect. PE: Parity error flag bit (only operating mode 0 functions) • SMR: If PEN = 1 and when a parity error occurs while receiving, this bit is set to "1". When you write "1" to REC bit in the serial status register (SSR), this bit is cleared. • A reception interrupt request is output when PE bit and SCR: RIE bit are "1". • Data in the reception data register (RDR) is invalid if this flag is set. • When this bit is set while using the reception FIFO, the enable bit in the reception FIFO will be cleared and the reception data will not be stored into the reception FIFO. FRE: Framing error flag bit • When a framing error occurs while receiving, this bit is set to "1". When you write "1" to REC bit in the serial status register (SSR), this bit is cleared. • A reception interrupt request is output when FRE bit and RIE bit are "1". • Data in the reception data register (RDR) is invalid if this flag is set. • When this bit is set while using the reception FIFO, the enable bit in the reception FIFO will be cleared and the reception data will not be stored into the reception FIFO. bit11 ORE: Overrun error flag bit • When an overrun error occurs while receiving, this bit is set to "1". When you write "1" to REC bit in the serial status register (SSR), this bit is cleared. • A reception interrupt request is output when ORE bit and RIE bit are "1". • Data in the reception data register (RDR) is invalid if this flag is set. • When this bit is set while using the reception FIFO, the enable bit in the reception FIFO will be cleared and the reception data will not be stored into the reception FIFO. bit10 • Indicates the status of the reception data register (RDR). • When the reception data is loaded to RDR, this bit is set to "1". If the reception data register (RDR) is read, this bit is cleared to "0". • A reception interrupt request is output when RDRF bit and RIE bit are "1". • When using the reception FIFO, RDRF is set to "1" when the reception FIFO has received a predefined number of data. RDRF: • When using the reception FIFO, if the reception FIFO idle detection enable bit Reception data full flag bit (FCR1:FRIIE) is "1" and the reception idle state continues over 8 clocks of the baud rate clock (because the reception FIFO has not received a predefined number of data and some data still remains in the reception FIFO), RDRF is set to "1". If you read the RDR while counting 8 clocks, the counter is reset to "0" and start counting 8 clocks all over again. • When using the reception FIFO, this bit is cleared to "0" when the reception FIFO gets empty. bit13 bit12 CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 285 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.3 Registers of UART (Asynchronous Multi Function Serial Interface) MB91313A Series Table 15.3-6 Function Description of Each Bit in the Serial Status Register (SSR) (2 / 2) Bit name Function • Indicates the status of the transmission data register (TDR). • When you write a transmission data to TDR, this bit becomes "0" to indicate that there is some valid data. When the data is loaded to the transmission shift register to start transmission, this bit becomes "1" to indicate that there is no valid data in TDR. • A transmission interrupt request is output when TIE bit and the TDRE bit are "1". • If you set UPCL bit in the serial control register (SCR) to "1", TDRE bit becomes "1". • For more information about set/reset timing of TDRE bit when using the transmission FIFO, see "15.4.2 Interrupt Generation and Flag Set Timing When Using Reception FIFO". bit9 TDRE: Transmission data empty flag bit bit8 • Indicates that UART is not processing the transmission operation. • This bit becomes "0" when transmission data is written to the transmission data register (TDR). TBI: • This bit becomes "1" when the transmission data register is empty (TDRE = 1) and Transmission bus idle flag the transmission operation is not in progress. bit • If you set "1" to UPCL bit in the serial control register (SCR), TBI bit becomes "1". • A transmission interrupt request is output when this bit is "1" and the transmission bus idle interrupt is enabled (SCR:TBIE = 1). 286 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.3 Registers of UART (Asynchronous Multi Function Serial Interface) MB91313A Series 15.3.4 Extended Communication Control Register (ESCR) Extended communication control register (ESCR) can set the transmission/reception data length, enable/disable the parity bit, select the parity bit, and specify the inversion of the serial data format. ■ Bit Configuration of Extended Communication Control Register (ESCR) Figure 15.3-4 shows the bit configuration of the extended communication control register (ESCR), and Table 15.3-7 shows the function of each bit. Figure 15.3-4 Bit Configuration of Extended Communication Control Register (ESCR) ESCR bit ch.0 000063H ch.1 000073H ch.2 000083H ch.3 000093H ch.4 0000A3H ch.5 0000B3H ch.6 0001B3H ch.7 0001C3H ch.8 0001D3H ch.9 0001E3H ch.A 0001F3H R/W - 7 6 5 4 3 2 1 0 Initial value − − INV PEN P L2 L1 L0 --000000B − − R/W R/W R/W R/W R/W R/W L2 0 0 0 0 1 : Readable/writable : Undefined L1 0 0 1 1 0 L0 0 1 0 1 0 Data length selection bits 8-bit length 5-bit length 6-bit length 7-bit length 9-bit length P 0 1 Parity selection bit Even parity Odd parity PEN 0 1 Parity enable bit Parity disabled Parity enabled INV 0 1 Invert serial data format bit NRZ format Invert NRZ format Undefined bits Read values are undefined. Writing has no effect on operation. : Initial value CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 287 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.3 Registers of UART (Asynchronous Multi Function Serial Interface) MB91313A Series Table 15.3-7 Function Description of Each Bit in the Extended Communication Control Register (ESCR) Bit name Function bit7, bit6 Unused bits When reading : Values are undefined. When writing : No effect. bit5 INV: Invert serial data format bit Specifies whether the serial data format should be NRZ format or invert NRZ format. bit4 PEN: Parity enable bit (only operating mode 0 functions) Specifies whether to provide (when transmitting) and detect (when receiving) a parity bit. • When "0" is set: Does not add a parity bit. • When "1" is set: Adds a parity bit. Note: This bit is internally fixed to "0" in the operating mode 1. bit3 P: Parity selection bit (only operating mode 0 functions) When parity is enabled (ESCR:PEN = 1), this bit selects even parity "0" or odd parity "1". • When "0" is set: Selects even parity. • When "1" is set: Selects odd parity. L2 to L0: Data length selection bits Specifies the data length of the transmission/reception data. • When "000B" is set: Sets the data length to 8-bit. • When "001B" is set: Sets the data length to 5-bit. • When "010B" is set: Sets the data length to 6-bit. • When "011B" is set: Sets the data length to 7-bit. • When "100B" is set: Sets the data length to 9-bit. Notes: • Any setting other than those above is disabled. • Sets the data length to 7-bit or 8-bit when using the operating mode 1. Any setting other than this is disabled. bit2 to bit0 288 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.3 Registers of UART (Asynchronous Multi Function Serial Interface) MB91313A Series 15.3.5 Reception/Transmission Data Registers (RDR/TDR) Reception/transmission data registers are arranged in the same address. When reading, it functions as the reception data register and when writing, it functions as the transmission data register. If the FIFO operating is enabled, RDR/TDR address works as FIFO reading/writing address. ■ Reception Data Register (RDR) Figure 15.3-5 shows the bit configuration of the reception data register (RDR). Figure 15.3-5 Bit Configuration of the Reception Data Register (RDR) RDR ch.0 000064H ch.2 000084H ch.4 0000A4H ch.6 0001B4H ch.8 0001D4H ch.A 0001F4H R: Read only ch.1 ch.3 ch.5 ch.7 ch.9 000074H bit15........... bit8 000094H D8 0000B4H 0001C4H R 0001E4H bit7 D7 bit6 D6 bit5 D5 bit4 D4 bit3 D3 bit2 D2 bit1 D1 R R R R R R R bit0 Initial value D0 00000000B R Reception data register (RDR) is a 9-bit data buffer register for serial data reception. • A serial data signal transmitted to the serial input pin (SIN pin) is converted at the shift register and then stored in this reception data register (RDR). • As described below, "0" is set in the upper bits depending on the data length. Data length D8 D7 D6 D5 D4 D3 D2 D1 D0 9-bit X X X X X X X X X 8-bit 0 X X X X X X X X 7-bit 0 0 X X X X X X X 6-bit 0 0 0 X X X X X X 5-bit 0 0 0 0 X X X X X (X represents the received data bit) • When the received data is stored in the reception data register (RDR), the reception data full flag bit (SSR:RDRF) is set to "1". If the reception interrupt is enabled (SSR:RIE = 1), a reception interrupt request occurs. • Read the reception data register (RDR) when the reception data full flag bit (SSR:RDRF) is "1". If the reception data register (RDR) is read, the reception data full flag bit (SSR:RDRF) is automatically cleared to "0". CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 289 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.3 Registers of UART (Asynchronous Multi Function Serial Interface) MB91313A Series • If a reception error has occurred (any of PE, ORE or FRE in SSR is "1"), the data in the reception data register (RDR) becomes invalid. • For the operating mode 1 (multiprocessor mode), the operation becomes 7-bit or 8-bit length and the received AD bit is stored into D8 bit. • For 9-bit length transfer and the operating mode 1, RDR reading is performed by 16-bit access. Notes: • When using the reception FIFO, RDRF is set to "1" if the reception FIFO has received a predefined number of data. • When using the reception FIFO, RDRF is cleared to "0" if the reception FIFO gets empty. • When a reception error occurs (any of PE, ORE or FRE in SSR is "1") while using the reception FIFO, the enable bit in the reception FIFO will be cleared and the received data will not be stored into the reception FIFO. 290 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.3 Registers of UART (Asynchronous Multi Function Serial Interface) MB91313A Series ■ Transmission Data Register (TDR) Figure 15.3-6 shows the bit configuration of the transmission data register (TDR). Figure 15.3-6 Bit Configuration of the Transmission Data Register (TDR) TDR ch.0 000064H ch.2 000084H ch.4 0000A4H ch.6 0001B4H ch.8 0001D4H ch.A 0001F4H W: Write only ch.1 ch.3 ch.5 ch.7 ch.9 000074H bit15........... 000094H 0000B4H 0001C4H 0001E4H 8 D8 7 D7 6 D6 5 D5 4 D4 3 D3 2 D2 1 D1 0 Initial value D0 111111111B W W W W W W W W W Transmission data register (TDR) is a 9-bit data buffer register for serial data transmission. • If data to be transmitted is written to the transmission data register (TDR) when the transmission operation is enabled (SCR:TXE=1), the data is transferred to the transmission shift register where the data is converted to serial data, and then transmitted from the serial data output pin (SOT pin). • As described below, data becomes invalid from the upper bits depending on the data length. Data length D8 D7 D6 D5 D4 D3 D2 D1 D0 9-bit X X X X X X X X X 8-bit Invalid X X X X X X X X 7-bit Invalid Invalid X X X X X X X 6-bit Invalid Invalid Invalid X X X X X X 5-bit Invalid Invalid Invalid Invalid X X X X X • A transmission data empty flag (SSR:TDRE) is cleared to "0" when the transmission data is written into the transmission data register (TDR). • If the transmission FIFO is disabled or empty, the transmission data empty flag (SSR:TDRE) is set to "1" when the transmission data is transferred to the transmission shift register and the transmission is started. • When the transmission data empty flag (SSR:TDRE) is "1", you can write the transmission data. If transmission interrupt is enabled, a transmission interrupt request occurs. Write a transmission data when a transmission interrupt occurs or when the transmission data empty flag (SSR:TDRE) is "1". • You cannot write the transmission data when the transmission data empty flag (SSR:TDRE) is "0" and also the transmission FIFO is disabled or full. • For the operating mode 1 (multiprocessor mode), the operation becomes 7-bit or 8-bit length and the AD bit is transmitted by writing to D8 bit. • For 9-bit length transfer and the operating mode 1, writing to TDR is performed by 16-bit access. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 291 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.3 Registers of UART (Asynchronous Multi Function Serial Interface) MB91313A Series Notes: • The transmission data register (TDR) is a write only register and the reception data register (RDR) is a read only register. These registers are located at the same address, so the read value is different from the write value. Therefore an instruction that operates read-modify-write (RMW) instruction, such as INC/DEC, cannot be used. • For more information about the set timing of the transmission data empty flag (SSR:TDRE) when using the transmission FIFO, see "15.4.2 Interrupt Generation and Flag Set Timing When Using Reception FIFO". 292 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.3 Registers of UART (Asynchronous Multi Function Serial Interface) MB91313A Series 15.3.6 Baud Rate Generator Registers 1, 0 (BGR1/BGR0) The baud rate generator registers 1, 0 (BGR1/BGR0) sets the division ratio for the serial clock. They can also select an external clock as the clock source of the reload counter. ■ Bit Configuration of Baud Rate Generator Registers 1, 0 (BGR1/BGR0) Figure 15.3-7 shows the bit configuration of the baud rate generator registers 1, 0 (BGR1/BGR0). Figure 15.3-7 Bit Configuration of Baud Rate Generator Registers 1, 0 (BGR1/BGR0) 14 BGR bit 15 ch.0 000066H EXT B14 ch.1 000076H ch.2 000086H R/W R/W ch.3 000096H ch.4 0000A6H ch.5 0000B6H ch.6 0001B6H ch.7 0001C6H ch.8 0001D6H ch.9 0001E6H ch.A 0001F6H R/W 13 12 11 10 9 8 7 6 5 4 3 2 1 0 Initial value B13 B12 B11 B10 B9 B8 B7 B6 B5 B4 B3 B2 B1 B0 00000000B R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W 00000000B : Readable/writable R/W R/W BGR0 Write Read Baud rate generator register 0 Writes to the reload counter bits 0 to 7 Reads the value set to BGR0 BGR1 Write Read Baud rate generator register 1 Writes to the reload counter bits 8 to 14 Reads the value set to BGR1 EXT 0 1 External clock selection bit Uses internal clock Uses external clock : Initial value • The baud rate generator registers (BGR) set the division ratio for the serial clock. • BGR1 (supports the upper bits) and BGR0 (supports the lower bits) can write the reload value to count and read the value set to BGR1/BGR0. • The reload counter starts counting when a reload value is written in the baud rate generator registers 1, 0 (BGR1/BGR0). • Specify whether to use the internal clock or external clock for a clock source of the reload counter using EXT bit in bit15. EXT = 0 specifies the internal clock. EXT = 1 specifies the external clock. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 293 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.3 Registers of UART (Asynchronous Multi Function Serial Interface) MB91313A Series Notes: • Write to the baud rate generator registers 1, 0 (BGR1/BGR0) by 16-bit access. • When you change the value set to the baud rate generator registers 1, 0 (BGR1/BGR0), new value is reloaded after the counter value reaches "000000000000000B". Therefore, if you want to reflect the change immediately, execute programmable clear (UPCL) after you change the value set to BGR1/BGR0. • If the reload value is an even number, "L" width of the reception serial clock is longer than "H" width by 1 cycle of the machine clock. If it is an odd number, "H" and "L" widths of the serial clock have the same length. • Set a value more than 4 to BGR1/BGR0. However, they may not be able to receive data properly depending on a baud rate error and the setting for the reload value. • If you want to change to the external clock setting (EXT = 1) while operating the baud rate generator, write "0" into the baud rate generator 1, 0 (BGR1/BGR0) and execute programmable clear (UPCL), and then specify the external clock (EXT = 1). 294 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.3 Registers of UART (Asynchronous Multi Function Serial Interface) MB91313A Series 15.3.7 FIFO Control Register 1 (FCR1) FIFO control register 1 (FCR1) sets the test for FIFO, specifies the transmission/ reception FIFO, enables the transmission FIFO interrupt, and controls the interrupt flag. ■ Bit Configuration of FIFO Control Register 1 (FCR1) Figure 15.3-8 shows the bit configuration of the FIFO control register 1 (FCR1), and Table 15.3-8 shows the function of each bit. Figure 15.3-8 Bit Configuration of FIFO Control Register 1 (FCR1) FCR1 bit 15 14 ch.0 00006AH FTST1 FTST0 ch.1 00007AH ch.2 00008AH R/W R/W 13 − 12 11 10 9 FLSTE FRIIE FDRQ FTIE (−) R/W R/W R/W R/W 8 Initial value FSEL 00-00100B R/W FSEL FIFO selection bit Transmission FIFO: FIFO1, Reception FIFO: FIFO2 0 1 Transmission FIFO: FIFO2, Reception FIFO: FIFO1 FTIE 0 1 Transmission FIFO interrupt enable bit Disables the transmission FIFO interrupt Enables the transmission FIFO interrupt FDRQ 0 1 FRIIE 0 1 Transmission FIFO data request bit Does not request the transmission FIFO data Requests the transmission FIFO data Reception FIFO idle detection enable bit Disables the reception FIFO idle detection Enables the reception FIFO idle detection FLSTE 0 1 Retransmission data lost detection enable bit Disables the data lost detection Enables the data lost detection Unused bit Read value is undefined. Writing has no effect on operation. FTST1.0 00B Other than 00B R/W : Readable/writable - : Unused FIFO test bits Disables FIFO test Setting disabled : Initial value CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 295 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.3 Registers of UART (Asynchronous Multi Function Serial Interface) MB91313A Series Table 15.3-8 Function Description of Each Bit in the FIFO Control Register 1 (FCR1) Bit name Function bit15, FTST1, FTST0: bit14 FIFO test bits These are the test bits for FIFO. Be sure to set these bits to "0". Note: If you set these bits to "1", the test for FIFO will be executed. bit13 Unused bit When reading : Value is undefined. When writing : No effect. bit12 FLSTE: Retransmission data lost detection enable bit Enables data lost detection. When "0" is set: Disables data lost detection. When "1" is set: Enables data lost detection. Note: When you set this bit to "1", set FSET bit to "1" before doing so. bit11 FRIIE: Reception FIFO idle detection enable bit Specifies whether to detect the reception idle state that continues over 8-bit time with the reception FIFO holding valid data. If the reception interrupt is enabled (SCR:RIE = 1), a reception interrupt occurs when the reception idle state is detected. When "0" is set: Disables the reception FIFO idle state detection. When "1" is set: Enables the reception FIFO idle state detection. bit10 FDRQ: Transmission FIFO data request bit This is a data request bit for the transmission FIFO. When this bit is set to "1", it indicates that the transmission data is being requested. A FIFO transmission interrupt request is output when this bit is "1" and the transmission FIFO interrupt is enabled (FTIE = 1). FDRQ set condition FBYTE (for transmission) = 0 (transmission FIFO is empty) FDRQ reset condition • When writing "0" to this bit • When the transmission FIFO gets full Notes: • When the transmission FIFO is enabled, writing "0" is valid. • When FBYTE (for transmission) = 0, writing "0" to this bit is disabled. • Setting "1" to this bit has no effect on the operations. • "1" is read by a read-modify-write (RMW) instruction. bit9 FTIE: Transmission FIFO interrupt enable bit This is an interrupt enable bit for the transmission FIFO. If this bit is set to "1", an interrupt occurs when FDRQ bit is "1". FSEL: FIFO selection bit Selects the transmission/reception FIFO. When "0" is set: Assigns the transmission FIFO:FIFO1 and the reception FIFO:FIFO2. When "1" is set: Assigns the transmission FIFO:FIFO2 and the reception FIFO:FIFO1. Notes: • This bit cannot be cleared by the FIFO reset (FCL2, FCL1 = 1). • When you change this bit, disable FIFO operation (FCR:FE2, FE1 = 0) first. bit8 Note: There are 2 transmission interrupts: transmission FIFO interrupt request and transmission buffer interrupt request. 296 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.3 Registers of UART (Asynchronous Multi Function Serial Interface) MB91313A Series 15.3.8 FIFO Control Register 0 (FCR0) FIFO control register 0 (FCR0) enables/disables FIFO operation, performs FIFO reset, saves the read pointer, and sets the retransmission. ■ Bit Configuration of FIFO Control Register 0 (FCR0) Figure 15.3-9 shows the bit configuration of the FIFO control register 0 (FCR0), and Table 15.3-9 shows the function of each bit. Figure 15.3-9 Bit Configuration of FIFO Control Register 0 (FCR0) FCR0 bit ch.0 00006BH ch.1 00007BH ch.2 00008BH 7 − 6 5 4 3 2 1 FLST FLD FSET FCL2 FCL1 FE2 ( −) R R/W R/W R/W R/W R/W 0 Initial value FE1 00000000B R/W FE1 0 1 FIFO1 operation enable bit Disables FIFO1 operation Enables FIFO1 operation FE2 0 1 FIFO2 operation enable bit Disables FIFO2 operation Enables FIFO2 operation FCL1 0 1 FCL2 0 1 : Readable/writable R : Read only - : Unused Read Always read "0" FIFO2 reset bit Write No effect FIFO2 reset Read Always read "0" 0 1 FIFO pointer save bit Write Read Does not save Always read "0" Executes save FLD 0 1 FIFO pointer reload bit Does not reload Executes reload FLST 0 1 FIFO retransmission data lost flag bit Disables the data lost Enables the data lost FSET R/W FIFO1 reset bit Write No effect FIFO1 reset Unused bit When reading, "0" is always read. When writing, "0" is always written. : Initial value CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 297 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.3 Registers of UART (Asynchronous Multi Function Serial Interface) MB91313A Series Table 15.3-9 Function Description of Each Bit in the FIFO Control Register 0 (FCR0) (1 / 2) Bit name bit7 bit6 bit5 bit4 bit3 bit2 298 Function Unused bit When reading : "0" is always read. When writing : Always write "0". FLST: FIFO retransmission data lost flag bit Indicates that retransmission data of the transmission FIFO has been lost. FLST set condition Writing (Overwriting) to FIFO when FLSTE bit in the FIFO control register 1 (FCR1) is "1" and also the write pointer of the transmission FIFO and the read pointer saved by FSET bit match each other. FLST reset condition • FIFO reset (writing "1" into FCL) • When writing "1" to FSET bit Setting this bit to "1" overwrites the data indicated by the read pointer saved with FSET bit, therefore FLD bit cannot set the retransmission when an error occurs. If you retransmit with this bit set to "1", perform FIFO reset and write the data again into FIFO. FLD: FIFO pointer reload bit Reloads the data saved to the transmission FIFO by FSET bit to the read pointer. This bit is used for the retransmission due to a communication error. When a retransmission setting is completed, this bit becomes "0". Notes: • As long as this bit is set to "1", this bit is reloading to the read pointer. Therefore, do not write anything other than FIFO reset. • Setting this bit to "1" is disabled while transmitting or being in FIFO enabled state. • Set TIE and TBIE bits to "0" and then write "1" into this bit. After you enabled the transmission FIFO, set TIE and TBIE bits to "1". FSET: FIFO pointer save bit Saves the read pointer of the transmission FIFO. Once you save the read pointer before communication, when FLST bit is "0" it is possible to retransmit in the case a communication error. When "1" is set: Retains the current value set to the read pointer. When "0" is set: No effect. Note: Set this bit to "1" when the number of bytes for transmission (FBYTE) indicates "0". FCL2: FIFO reset bit Resets FIFO2. If you set this bit to "1", the internal state of FIFO2 is initialized. Only the FLST bit in the FIFO control register 1 (FCR1) is initialized and the other bits in the FCR1/FCR0 registers remain unchanged. Notes: • Disables any transmission/reception before performing FIFO2 reset. • Set the transmission FIFO interrupt enable bit to "0" first. • The number of the valid data in the FBYTE2 register becomes "0". FCL1: FIFO1 reset bit Resets FIFO1. If you set this bit to "1", the internal state of FIFO1 is initialized. Only the FLST bit in the FIFO control register 1 (FCR1) is initialized and the other bits in the FCR1/FCR0 registers remain unchanged. Notes: • Disables any transmission/reception before performing FIFO1 reset. • Set the transmission FIFO interrupt enable bit to "0" first. • The number of the valid data in the FBYTE1 register becomes "0". FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E MB91313A Series CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.3 Registers of UART (Asynchronous Multi Function Serial Interface) Table 15.3-9 Function Description of Each Bit in the FIFO Control Register 0 (FCR0) (2 / 2) Bit name bit1 bit0 Function FE2: FIFO2 operation enable bit Enables/disables the operation of FIFO2. • When using FIFO2, set this bit to "1". • Set FIFO2 to the transmission FIFO (FCR1:FSEL = 1). When there is some data in FIFO2 and UART is enabled for transmission (TXE = 1), writing "1" into this bit starts transmitting immediately. Set TIE and TBIE bits to "0" and then write "1" into this bit to make TIE and TBIE bits to "1". • If specified as a reception FIFO by FSEL bit, a reception error clears this bit to "0". You cannot set this bit to "1" until the reception error is cleared. • When using as the transmission FIFO, set "1" or "0" to this bit when the transmission buffer is empty (TDRE = 1). If using as the reception FIFO, set "1" or "0" to this bit when the reception buffer is empty (RDRF = 0). • Even if FIFO2 is disabled, the state of FIFO2 is still retained. FE1: FIFO1 operation enable bit Enables/disables the operation of FIFO1. • When using FIFO1, set this bit to "1". • Set FIFO1 to the transmission FIFO (FCR1:FSEL = 0). When there is some data in FIFO1 and UART is enabled for transmission (TXE = 1), writing "1" into this bit starts transmitting immediately. Set TIE and TBIE bits to "0" and then write "1" into this bit to make TIE and TBIE bits to "1". • If specified as a reception FIFO by FSEL bit, a reception error clears this bit to "0". You cannot set this bit to "1" until the reception error is cleared. • If using as the transmission FIFO, set "1" or "0" to this bit when the transmission buffer is empty (TDRE = 1). If using as the reception FIFO, set "1" or "0" to this bit when the reception buffer is empty (RDRF = 0). • Even if FIFO1 is disabled, the state of FIFO1 is still retained. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 299 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.3 Registers of UART (Asynchronous Multi Function Serial Interface) 15.3.9 MB91313A Series FIFO Byte Register (FBYTE) FIFO byte register (FBYTE) indicates the number of valid data for FIFO. In addition, it can specify whether to generate a reception interrupt when the predefined number of data has been received at the reception FIFO. ■ Bit Configuration of FIFO Byte Register (FBYTE) Figure 15.3-10 shows the bit configuration of the FIFO byte register (FBYTE). Figure 15.3-10 Bit Configuration of FIFO Byte Register (FBYTE) FBYTE bit 15 14 13 12 11 10 9 ch.0 00006CH FD15 FD14 FD13 FD12 FD11 FD10 FD9 ch.1 00007CH ch.2 00008CH R/W R/W R/W R/W R/W R/W R/W 8 7 6 5 4 3 2 1 0 Initial value FD8 FD7 FD8 FD5 FD4 FD3 FD2 FD1 FD0 R/W R/W R/W R/W R/W R/W R/W R/W R/W FBYTE1 Write Read FIFO1 data number display bit Sets the transfer count Reads the number of valid data FBYTE2 Write Read FIFO2 data number display bit Sets the transfer count Reads the number of valid data 00000000B 00000000B R/W: Readable/writable Read (number of valid data) When transmitting : The number of data that are written into FIFO and have not transmitted yet. When receiving : The number of data that are received at FIFO. Write (transfer count) When transmitting : Sets "00H". When receiving : Sets the number of data that generates a reception interrupt. FIFO byte register (FBYTE) indicates the number of valid data written or received into FIFO. The number varies as follows, depending on the setting of FSEL bit in the FCR1 register. Table 15.3-10 The Number of Data Displayed FSEL FIFO selection The number of data displayed 0 FIFO2: Reception FIFO, FIFO1: Transmission FIFO FIFO2: FBYTE2, FIFO1: FBYTE1 1 FIFO2: Transmission FIFO, FIFO1: Reception FIFO FIFO2: FBYTE2, FIFO1: FBYTE1 • The initial value of the transfer count of the FBYTE register is "08H". • Set the number of data to generate a reception interrupt flag to the FBYTE in the reception FIFO. An interrupt flag (RDRF bit in the SSR) is set to "1" when the defined transfer count matches with the number of data displayed in the FIFO byte register (FBYTE). 300 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E MB91313A Series CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.3 Registers of UART (Asynchronous Multi Function Serial Interface) • If the reception FIFO idle detection enable bit (FRIIE) is "1" and the number of data that exists in the reception FIFO has not reached the transfer count, the interrupt flag (RDRF) is set to "1" when the reception idle state continues over 8 clocks of the baud rate clock. If you read the RDR while counting 8 clocks, the counter is reset to "0" and start counting 8 clocks all over again. The counter is reset to "0" when the reception FIFO is disabled. When the reception FIFO that has still some data is enabled, it starts counting all over again. Notes: • Set "00H" to the FIFO byte register (FBYTE) in the transmission FIFO. • Set a data more than "1" to the FBYTE in the reception FIFO. • Disable the reception before you change the setting. • You cannot use any read-modify-write (RMW) instruction to this register. • The setting that exceeds the FIFO size is disabled. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 301 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.4 Interrupts of UART 15.4 MB91313A Series Interrupts of UART UART uses both reception and transmission interrupts. An interrupt request can be generated by the following sources: • When the received data is set in the reception data register (RDR), or a reception error occur. • When the transmission data is transferred from the transmission data register (TDR) to the transmission shift register and the transmission has started. • Transmission bus idle (no transmission operation) • Transmission FIFO data request ■ Interrupts of UART Table 15.4-1 shows the UART interrupt control bit and the interrupt source. 302 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.4 Interrupts of UART MB91313A Series Table 15.4-1 UART Interrupt Control Bit and Interrupt Source Interrupt type Interrupt request flag bit Flag register Operating mode 0 Interrupt source 1 Interrupt source enable bit Receive 1 byte How to clear the interrupt request flag Read reception data (RDR) The value set to FBYTE is received RDRF SSR Detect the reception idle state that continues over 8-bit time with the reception FIFO holding SCR:RIE valid data when FRIIE bit is "1" ORE SSR Overrun error FRE SSR Framing error PE SSR Reception TDRE Transmission TBI FDRQ SSR SSR FCR1 × Read reception data (RDR) until the reception FIFO gets empty Write "1" to the reception error flag clear bit (SSR:REC) Parity error Transmission register is SCR:TIE empty Write to the transmission data (TDR), or write "1" to the transmission FIFO operation enable bit when it is "0" and the transmission FIFO has a valid data (retransmission)* No transmission operation SCR:TBIE Write to the transmission data (TDR), or write "1" to the transmission FIFO operation enable bit when it is "0" and the transmission FIFO has a valid data (retransmission)* Transmission FIFO is empty Write "0" to the FIFO transmission data request bit FCR1:FTIE (FCR1:FDRQ), or the transmission FIFO is full *: Set TIE bit to "1" after TDRE bit has become "0". CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 303 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.4 Interrupts of UART 15.4.1 MB91313A Series Reception Interrupt Generation and Flag Set Timing A reception completion (RDRF bit in SSR) and a reception error occurrence (PE, ORE, FRE bits in SSR) are the sources of the reception interrupt. ■ Reception Interrupt Generation and Flag Set Timing Detection of the first stop bit stores the reception data to the reception data register (RDR). When a reception is completed (SSR:RDRF = 1) or a reception error occurs (SSR:PE, ORE, FRE = 1), each flag is set. If reception interrupt is enabled (SSR:RIE = 1) at this point, a reception interrupt occurs. Note: If a reception error occurs, the data in the reception data register (RDR) becomes invalid. Figure 15.4-1 Set Timing of RDRF (Reception Data Full) Flag Bit Reception data ST D0 D1 D2 D5 D6 D7 SP ST RDRF Reception interrupt occurred Figure 15.4-2 Set Timing of FRE (Framing Error) Flag Bit Reception data ST D0 D1 D2 D5 D6 D7 SP ST RDRF FRE Reception interrupt occurred A framing error occurs when the first stop bit is "L" level. Even when a framing error occurs, RDRF is set to "1" to receive the data however, the reception data becomes invalid. Figure 15.4-3 Set Timing of ORE (Overrun Error) Flag Bit Reception data ST D0 D1 D2 D3 D4 D5 D6 D7 SP ST D0 D1 D2 D3 D4 D5 D6 D7 SP RDRF ORE An overrun error occurs when next data is transferred before the reception data is read (RDRF = 1). 304 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.4 Interrupts of UART MB91313A Series 15.4.2 Interrupt Generation and Flag Set Timing When Using Reception FIFO When using the reception FIFO, an interrupt is generated when the same value set to the FIFO byte register (FBYTE) has been received. ■ Reception Interrupt Generation and Flag Set Timing When Using Reception FIFO When using the reception FIFO, the generation of an interrupt depends on the value set to the FIFO byte register (FBYTE). • When the amount of data set to the FIFO byte register (FBYTE) as the transfer count has been received, the reception data full flag bit in the serial status register (RDRF bit in SSR) is set to "1". If reception interrupt is enabled (SCR:RIE) at this point, a reception interrupt occurs. • If the reception FIFO idle detection enable bit (FRIIE) is "1" and the number of data that exists in the reception FIFO has not reached the transfer count, the interrupt flag (RDRF) is set to "1" when the reception idle state continues over 8 clocks of the baud rate clock. If you read the RDR while counting 8 clocks, the counter is reset to "0" and start counting 8 clocks all over again. The counter is reset to "0" when the reception FIFO is disabled. When the reception FIFO that has still some data is enabled, it starts counting all over again. • When the reception data (RDR) is read until the reception FIFO gets empty, the reception data full flag bit (SSR:RDRF) is cleared. • If next data is received with the FIFO size displayed as the number of data that can be received, an overrun error occurs (SSR:ORE = 1). Figure 15.4-4 Reception Interrupt Generation Timing When Using Reception FIFO Reception data ST 1st byte SP ST 2nd byte SP F byte setting (transfer count) F byte reading (valid byte displayed) ST 3rd byte SP ST 4th byte SP ST 5th byte SP 3 0 1 2 3 2 1 0 1 2 RDRF RDR reading An interrupt occurs upon a match between F byte setting (transfer count) and the number of data received CM71-10143-5E Read all reception data FUJITSU SEMICONDUCTOR LIMITED 305 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.4 Interrupts of UART MB91313A Series Figure 15.4-5 Set Timing of ORE (Overrun Error) Flag Bit Reception data ST 62nd byte SP ST 63rd byte SP ST 64th byte SP F byte setting (transfer count) F byte reading (valid byte displayed) ST 65th byte SP ST 66th byte SP 62 62 63 64 RDRF ORE An overrun error occurs An overrun error occurs when next data is received with the FIFO size displayed as the F byte reading. The figure shows an example where a FIFO size of 64 bytes is used. 306 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.4 Interrupts of UART MB91313A Series 15.4.3 Transmission Interrupt Generation and Flag Set Timing A transmission interrupt occurs when the transmission data is transferred from the transmission data register (TDR) to the transmission shift register (SSR:TDRE = 1) and the transmission has started, or when the transmission operation is not in progress (SSR:TBI=1). ■ Transmission Interrupt Generation and Flag Set Timing ● Set timing of the transmission data empty flag (TDRE) Once the data written into the transmission data register (TDR) is transferred to the transmission shift register, next data can be written (SSR:TDRE = 1). If transmission interrupt is enabled (SCR:TIE = 1) at this point, a transmission interrupt occurs. As TDRE bit is read only, it is cleared to "0" by writing data into the transmission data register (TDR). Figure 15.4-6 Set Timing of Transmission Data Empty Flag (TDRE) A transmission interrupt occurred Transmission data (mode0 and mode1) ST D0 D1 D2 D3 A transmission interrupt occurred D4 D5 D6 D7 SP ST D0 D1 D2 TDRE Writing to TDR ST: Start bit D0 to D7: Data bits SP: Stop Bit ● Set timing of the transmission bus idle flag (TBI) TBI bit in the serial status register (SSR) is set to "1" when the transmission data register is empty (TDRE = 1) and the transmission operation is not in progress. If transmission bus idle interrupt is enabled (SCR:TBIE = 1) at this point, a transmission interrupt occurs. TBI bit and the transmission interrupt request are cleared when a transmission data is set to the transmission data register (TDR). Figure 15.4-7 Set Timing of Transmission Bus Idle Flag (TBI) Transmission data ST D0 D1 D2 D3 D4 D5 D6 D7 SP ST D0 D1 D2 D3 D4 D5 D6 D7 TBI TDRE Writing to TDR ST: Start bit CM71-10143-5E A transmission interrupt by TBI bit occurred D0 to D7: Data bits SP: Stop Bit FUJITSU SEMICONDUCTOR LIMITED 307 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.4 Interrupts of UART MB91313A Series Interrupt Generation and Flag Set Timing When Using Transmission FIFO 15.4.4 When using the transmission FIFO, an interrupt occurs when the transmission FIFO has no data. ■ Transmission Interrupt Generation and Flag Set Timing When Using Transmission FIFO • When the transmission FIFO has no data, FIFO transmission data request bit (FCR1:FDRQ) is set to "1". If FIFO transmission interrupt is enabled (FCR1:FTIE = 1) at this point, a transmission interrupt occurs. • Once the transmission interrupt has been generated and you have written the required data into the transmission FIFO, write "0" to the FIFO transmission data request bit (FCR1:FDRQ) to clear the interrupt request. • The FIFO transmission data request bit (FCR1:FDRQ) becomes "0" when the transmission FIFO gets full. • You can verify if the transmission FIFO has data or not by reading the FIFO byte register (FBYTE). FBYTE = 00H indicates that the transmission FIFO has no data. Figure 15.4-8 Transmission Interrupt Generation Timing When Using Transmission FIFO Transmission data F byte ST 1st byte SP 0 1 2 ST 2nd byte SP 1 0 1 ST 3rd byte ST 2 SP 4th byte SP SP 5th byte 0 1 FDRQ TDRE Clear by writing "0" A transmission interrupt occurred *1 Writing to transmission FIFO (TDR) Clear by writing "0" A transmission interrupt occurred *1 Transmission data register is empty *2 *1: FDRQ is set to "1" as the transmission FIFO is empty. *2: TDRE is set to "1" as the transmission shift register and the transmission buffer register have no data. 308 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.5 Operations of UART MB91313A Series 15.5 Operations of UART UART operates in the mode 0 for bidirectional serial asynchronous communication and the mode 1 for master/slave multiprocessor communication. ■ Operations of UART ● Transmission and reception data formats • The transmission and reception data always start with the start bit, continue as long as the data bit length specified, and end with at least 1 bit of the stop bit. • The data transfer direction (LSB first or MSB first) is determined by BDS bit in the serial mode register (SMR). If parity is enabled, a parity bit is always placed between the last data bit and the first stop bit. • In operating mode 0 (normal mode), you can select whether to enable or disable the parity. • In operating mode 1 (multiprocessor mode), AD bit is added instead of the parity. Figure 15.5-1 shows the transmission and reception data formats in operating modes 0 and 1. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 309 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.5 Operations of UART MB91313A Series Figure 15.5-1 Example of Transmission and Reception Data Format (Operating Modes 0 and 1) [Operating mode 0] ST D0 D1 D2 D3 D4 D5 D6 D7 SP1 SP2 ST D0 D1 D2 D3 D4 D5 D6 D7 SP1 ST D0 D1 D2 D3 D4 D5 D6 D7 P SP1 SP2 ST D0 D1 D2 D3 D4 D5 D6 D7 P SP1 ST D0 D1 D2 D3 D4 D5 D6 SP1 SP2 P disabled 8-bit data P enabled P disabled ST D0 D1 D2 D3 D4 D5 D6 SP1 ST D0 D1 D2 D3 D4 D5 D6 P SP1 SP2 ST D0 D1 D2 D3 D4 D5 D6 P SP1 ST D0 D1 D2 D3 D4 D5 D6 D7 AD SP1 SP2 ST D0 D1 D2 D3 D4 D5 D6 D7 AD SP1 ST D0 D1 D2 D3 D4 D5 D6 AD SP1 SP2 ST D0 D1 D2 D3 D4 D5 D6 AD SP1 7-bit data P enabled [Operating mode 1] 8-bit data 7-bit data ST SP P AD D0 to D7 : Start bit : Stop Bit : Parity bit : Address bit : Data bit Notes: • The figure above shows the case where the data length is set to 7 and 8 bits (the data length can be set between 5 and 9 bits in operating mode 0). • If BDS bit in the serial mode register (SMR) is set to "1" (MSB first), the bit is processed in order as D7, D6, D5, ..., D1, D0, (P). • If the data length is set to X-bit, the lower X-bit in the transmission and reception data registers (RDR/TDR) are enabled. 310 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E MB91313A Series CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.5 Operations of UART ● Transmission operation • If the transmission data empty flag bit (TDRE) in the serial status register (SSR) is "1", you can write a transmission data into the transmission data register (TDR) (if the transmission FIFO is enabled, you can also write the transmission data when TDRE = 0). • The transmission data empty flag bit (TDRE) is cleared to "0" when a transmission data is written into the transmission data register (TDR). • When the transmission operation enable (TXE) bit in the serial control register (SCR) is set to "1", the transmission data is loaded to the transmission shift register and the transmission starts with the start bit. • Once the transmission has started, the transmission data empty flag bit (TDRE) is set back to "1". If transmission interrupt is enabled (SCR:TIE = 1) at this point, a transmission interrupt occurs. In the interrupt process, next transmission data can be written to the transmission data register. Notes: • Since the initial value of the transmission data empty bit flag (TDRE) in the serial status register (SSR) is "1", a transmission interrupt will occur immediately once the transmission interrupt is enabled (SCR:TIE). • Since the initial value of the FIFO transmission data request bit (FDRQ) in the FIFO control register 1 (FCR1) is "1", a transmission interrupt will occur immediately once the FIFO transmission interrupt is enabled (FCR1:FTIE = 1). ● Reception operation • A reception operation is performed when the reception operation is enabled (SCR:RXE = 1). • When a start bit is detected, 1 frame data is received according to the data format set to the extended communication control register (ESCR:PEN, P, L2, L1, L0) and the serial mode register (SMR:BDS). • When the reception of 1 frame of data is completed, the reception data full flag bit (SSR:RDRF) is set to "1". If reception interrupt is enabled (SCR:RIE = 1) at this point, a reception interrupt occurs. • If you want to read the received data, wait until the reception of 1 frame of data is completed to verify the status of the error flag in the serial status register (SSR). If a reception error occurs, correct the error. • When the received data is read, the reception data full flag bit (SSR:RDRF) is cleared to "0". • When the reception FIFO is enabled, the reception data full flag bit (SSR:RDRF) is set to "1" after the certain frames set to the reception FBYTE have been received. • If the reception FIFO idle detection enable bit (FRIIE) is "1" and the number of data that exists in the reception FIFO has not reached the transfer count, the interrupt flag (RDRF) is set to "1" when the reception idle state continues over 8 clocks of the baud rate clock. If you read the RDR while counting 8 clocks, the counter is reset to "0" and start counting 8 clocks all over again. The counter is reset to "0" when the reception FIFO is disabled. When the reception FIFO that has still some data is enabled, it starts counting all over again. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 311 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.5 Operations of UART MB91313A Series • If the reception FIFO is enabled, when the error flag in the serial status register (SSR) is set to "1", the data that generated the error is not stored into the reception FIFO. In this case, the reception data full flag bit (SSR:RDRF) is not set to "1" (however, RDRF flag will be set to "1" when it is an overrun error). The reception FBYTE displays the number of data that has been successfully received before the error. The reception FIFO will not be enabled until the error flag in the serial status register (SSR) is cleared to "0". • If the reception FIFO is enabled, reception data full flag bit (SSR:RDRF) is cleared to "0" when the reception FIFO gets empty. Note: The data in the reception data register (RDR) becomes valid when the reception data full flag bit (SSR:RDRF) is set to "1" and no reception error is generated (SSR:PE, ORE, FRE = 0). ● Clock selection • You can use the internal clock or the external clock. • When using an external clock, set EXT bit in the serial mode register (SMR) to "1". If so, the external clock is divided by the baud rate generator. ● Start bit detection • In asynchronous mode, the start bit is detected by the falling edge of the SIN signal. Therefore, the reception operation does not start without inputting the falling edge of the SIN signal, even if the reception operation is enabled (SCR:RXE = 1). • When the falling edge of the start bit is detected, the reception reload counter of the baud rate generator is reset to reload and starts counting down. This makes it possible to take a sample always in the center of the data. Start bit Data bit SIN SIN (OverSampled) SEDGE (Internal signal) Reset the reload counter Data sampling Reception sampling clock 1-bit time ● Stop bit • You can choose 1-bit or 2-bit length. • The reception data full flag bit (SSR:RDRF) is set to "1" when the first stop bit is detected. 312 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.5 Operations of UART MB91313A Series ● Error detection • In operating mode 0, parity, overrun, and framing errors can be detected. • In operating mode 1, overrun and framing errors can be detected. Parity error cannot be detected. ● Parity bit • Parity bit can be added only in the operating mode 0. The parity enable bit (ESCR:PEN) can specify whether to enable or disable the parity, and the parity selection bit (ESCR:P) can specify whether to use even parity or odd parity. • Parity cannot be used in operating mode 1. Figure 15.5-2 shows the operation when parity is enabled. Figure 15.5-2 Operation When Parity Is Enabled ST D0 D1 D2 D3 D4 D5 D6 D7 P SP A parity error occurs upon the reception in even parity (ESCR:P=0) Reception data (mode 0) SMR:PE Transmission of even parity (ESCR:P=0) Transmission data (mode 0) Transmission of odd parity (ESCR:P=1) Transmission data (mode 0) ST: Start bit SP: Stop bit With parity (ESCR: PEN = 1), when data length is 8-bit (Note) Parity cannot be used in operating mode 1. ● Data signal method You can specify the NRZ (Non Return to Zero) (ESCR:INV = 0) or invert NRZ (ESCR:INV = 1) signal methods depending on the setting of the INV bit in the extended communication control register. Figure 15.5-3 shows the NRZ (Non Return to Zero) and invert NRZ signal methods. Figure 15.5-3 NRZ (Non Return to Zero) and Invert NRZ Signal Methods SIN (NRZ) INV = 0 ST D0 D1 D2 D3 D4 D5 D6 D7 SP SIN (invert NRZ) INV = 1 ST D0 D1 D2 D3 D4 D5 D6 D7 SP SOT (NRZ) INV = 0 ST D0 D1 D2 D3 D4 D5 D6 D7 SP SOT (invert NRZ) INV = 1 ST D0 D1 D2 D3 D4 D5 D6 D7 SP ● Data transfer method You can select the LSB first or MSB first as the data bit transfer method. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 313 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.6 UART Dedicated Baud Rate Generator 15.6 MB91313A Series UART Dedicated Baud Rate Generator One of the followings can be selected for the transmission and reception clock source of UART: • Dedicated baud rate generator (reload counter) • Input an external clock to the baud rate generator (reload counter) ■ UART Baud Rate Selection You can select 1 type of baud rate out of the following 2 types: ● Baud rate that can be obtained by dividing the internal clock with the dedicated baud rate generator (reload counter) There are 2 internal reload counters that correspond to transmission and reception serial clocks. Baud rate can be specified by setting the reload value for 15 bits with the baud rate generator registers 1, 0 (BGR1/ BGR0). The reload counter divides the internal clock by the set value. To set the clock source, select the internal clock (SMR:EXT = 0). ● Baud rate that can be obtained by dividing the external clock with the dedicated baud rate generator (reload counter) An external clock is used as the clock source of the reload counter. Baud rate can be specified by setting the reload value for 15 bits with the baud rate generator registers 1, 0 (BGR1/BGR0). The reload counter divides the external clock by the set value. To set the clock source, select the external clock and enable the baud rate generator clock (SMR:EXT = 1). This mode is provided for the case where the resonator that has special frequency is divided to use. Notes: • Be sure to specify the external clock (EXT = 1) after the reload counter has stopped (BGR1/BGR0 = 15"H00). • When you specified to the external clock (EXT = 1), the minimum widths required for "H" and "L" of the external clock is 2-machine clock or more. 314 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.6 UART Dedicated Baud Rate Generator MB91313A Series 15.6.1 Baud Rate Setting This section shows the setting for the baud rate. The calculation result of serial clock frequency is also described. ■ Calculating Baud Rate 2 of 15-bit reload counters are set using the baud rate generator registers 1, 0 (BGR1/BGR0). The equation to calculate the baud rate is shown below: (1) Reload value V = φ / b -1 V: Reload value b : Baud rate, φ: Machine clock, External clock frequency (2) Example of calculation Where the machine clock is 16 MHz, the internal clock is enabled, and the baud rate is set to 19200 bps, the reload value is calculated as follows: Reload value: V = (16 × 1000000)/19200 - 1 = 832 Therefore, the baud rate is: b = (16 × 1000000)/(832+1) = 19208 bps (3) Baud rate error Baud rate error can be calculated by the following equation: Error (%) = (calculated value - desired value) / desired value × 100 (Example) Where the machine clock is 20 MHz and the desired baud rate is set to 153600 bps: Reload value = (20 × 10000000) / 153600 - 1 = 129 Baud rate (calculated value) = (20 × 10000000) / (129 + 1) = 153846 (bps) Error (%) = (153846 -153600) / 153600 x100 = 0.16 (%) Notes: • If the reload value is set to "0", the reload counter will stop. • If the reload value is an even number, "L" width of the reception serial clock is longer than "H" width by 1 cycle of the machine clock. If it is an odd number, "H" and "L" widths of the serial clock have the same length. • Be sure to set the reload value to 4 or more. However, data may not be able to receive properly depending on a baud rate error and the setting for the reload value. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 315 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.6 UART Dedicated Baud Rate Generator MB91313A Series ■ Reload Value and Baud Rate for Each Machine Clock Frequency Table 15.6-1 Reload Value And Baud Rate Baud rate (bps) 8 MHz 10 MHz 16 MHz 20 MHz 24 MHz 32MHz Value ERR Value ERR Value ERR Value ERR Value ERR Value ERR 4M - - - - - 0 4 0 5 0 7 0 2.5 M - - - 0 - - - - - - - - 2M - 0 4 0 7 0 9 0 11 0 15 0 1M 7 0 9 0 15 0 19 0 23 0 31 0 500000 15 0 19 0 31 0 39 0 47 0 63 0 460800 - - - - - - - - 51 -0.16 - - 250000 31 0 39 0 63 0 79 0 95 0 127 0 230400 - - - - - - - - 103 -0.16 - - 153600 51 -0.16 64 -0.16 103 -0.16 129 -0.16 155 -0.16 207 -0.16 125000 63 0 79 0 127 0 159 0 191 0 255 0 115200 68 -0.64 86 0.22 138 0.08 173 0.22 207 -0.16 277 0.08 76800 103 -0.16 129 -0.16 207 -0.16 259 -0.16 311 -0.16 416 0.08 57600 138 0.08 173 0.22 277 0.08 346 -0.16 416 0.08 555 0.08 38400 207 -0.16 259 -0.16 416 0.08 520 0.03 624 0 832 -0.04 28800 277 0.08 346 <0.01 554 -0.01 693 -0.06 832 -0.03 1110 -0.01 19200 416 0.08 520 0.03 832 -0.03 1041 0.03 1249 0 1666 0.02 10417 767 <0.01 959 <0.01 1535 <0.01 1919 <0.01 2303 <0.01 3071 <0.01 9600 832 0.04 1041 0.03 1666 0.02 2083 0.03 2499 0 3332 -0.01 7200 1110 <0.01 1388 <0.01 2221 <0.01 2777 <0.01 3332 <0.01 4443 -0.01 4800 1666 0.02 2082 -0.02 3332 <0.01 4166 <0.01 4999 0 6666 <0.01 2400 3332 <0.01 4166 <0.01 6666 <0.01 8332 <0.01 9999 0 13332 <-0.01 1200 6666 <0.01 8334 0.02 13332 <0.01 16666 <0.01 19999 0 26666 <0.01 600 13332 <0.01 16666 <0.01 26666 <0.01 - - - - - - 300 26666 26666 <0.01 - - - - - - - - - • Value : Value set to BGR1/BGR0 registers (decimal) • ERR : Baud rate error (%) 316 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.6 UART Dedicated Baud Rate Generator MB91313A Series ■ Baud Rate Tolerance Level upon the Reception The baud rate tolerance level upon the reception is shown as follows. Make sure that the baud rate error upon the reception falls into the tolerance level using the equation shown below. Figure 15.6-1 Baud Rate Tolerance Level upon the Reception Sampling UART transfer rate Start Bit 0 Bit 1 Bit 7 Parity Stop FL 1 data frame (11 x FL) Minimum transfer rate allowed Start Bit 0 Bit 1 Bit 7 Parity Stop FLmin Maximum transfer rate allowed Start Bit 0 Bit 1 Bit 7 Parity Stop FLmax As described in the figure, once the start bit is detected, the counter set in the BGR1/BGR0 registers decide the sampling timing of the reception data. If the last data (stop bit) can be included in this sampling timing, the data is received successfully. If this is applied to 11-bit reception, the tolerance level can theoretically be calculated as follows: Where the margin of the sampling timing is 2 clocks of the machine clock (φ), the minimum transfer rate allowed (FLmin) can be as follows: FLmin = (11 bit × (V+1) - (V+1)/2 + 3)/φ = (21V+27)/2φ (s) V: Reload value, φ: Machine clock Therefore, the receivable maximum baud rate (BGmax) for the destination is as follows: BGmax = 11/FLmin = 22φ/(21V+27) (bps) V: Reload value, φ: Machine clock Similarly, the maximum transfer rate allowed (FLmax) can be calculated as follows: FLmax = (11 bits × (V+1) + (V+1)/2 - 3)/φ = (23V+17)/2φ (s) V: Reload value, φ: Machine clock Therefore, the receivable minimum baud rate (BGmin) for the destination is as follows: BGmin = 11/FLmax = 22φ/(23V+17) (bps) CM71-10143-5E V: Reload value, φ: Machine clock FUJITSU SEMICONDUCTOR LIMITED 317 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.6 UART Dedicated Baud Rate Generator MB91313A Series The following table shows the allowable error between UART and the destination baud rate calculated by the equations for the maximum/minimum baud rate value described above: Reload value (V) Maximum baud rate error allowed Minimum baud rate error allowed 3 0% 0 10 +2.98% -2.81% 50 +4.37% -4.02% 100 +4.56% -4.18% 200 +4.66% -4.26% 32767 +4.76% -4.35% Note: Accuracy of the reception depends on the number of bits for 1 frame, the machine clock, and the reload value. The higher the machine clock and the division ratio become, the higher the accuracy becomes. ■ External Clock The baud rate generator divides the external clock when "1" is written to EXT bit in the baud rate generator registers 1, 0 (BGR1/BGR0). Note: The external clock signal is synchronized with the internal clock at UART. Therefore, the operation becomes unstable when the external clock is unsynchronizable. ■ Functions of the Reload Counter The reload counter has the transmission and reception reload counters that function as the dedicated baud rate generator. The reload counter consists of 15-bit register and generates a transmission and reception clock by the external or internal clock. ■ Start of a Count The reload counter starts counting when a reload value is written in the baud rate generator registers 1, 0 (BGR1/BGR0). ■ Restart The reload counters can be restarted for the following conditions: ● For both transmission/reception reload counters Programmable reset (SCR: UPCL bit) ● For reception reload counter only Detection of the start bit falling edge in asynchronous mode 318 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.7 Setting Procedure and Program Flow for Operating Mode 0 (Asynchronous Normal Mode) MB91313A Series 15.7 Setting Procedure and Program Flow for Operating Mode 0 (Asynchronous Normal Mode) In operating mode 0, asynchronous serial bidirectional communication is available. ■ Inter-CPU Connection In operating mode 0 (normal mode), the bidirectional communication is selected. As shown in Figure 15.7-1, 2 CPUs are connected each other. Figure 15.7-1 Example of Bidirectional Communication Connection in UART Operating Mode 0 SOT SOT SIN SIN SCK SCK CPU–1 (Master) CPU–2 (Slave) ■ Flowchart ● Without FIFO Figure 15.7-2 Example of Bidirectional Communication Flowchart (Without FIFO) (Transmission side) (Reception side) Start Start Set operating mode (set to mode 0) Set operating mode (coordinate with the transmission side) Transmit the data Set 1 byte data to TDR to communicate NO RDRF=1 YES NO RDRF=1 YES Read the received data to process CM71-10143-5E Transmit the data Read the received data to process (ANS) Transmit 1 byte data FUJITSU SEMICONDUCTOR LIMITED 319 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.7 Setting Procedure and Program Flow for Operating Mode 0 (Asynchronous Normal Mode) ● With FIFO MB91313A Series Figure 15.7-3 Example of Bidirectional Communication Flowchart (With FIFO) (Transmission side) (Reception side) Start Start Set operating mode (set to mode 0) Set operating mode (set to mode 0) • Enable the transmission and reception FIFO • Specify the FBYTE • Enable the transmission and reception FIFO • Specify the FBYTE Set N byte to the transmission FIFO Transmit the data NO RDRF=1 YES Write "0" to FDRQ bit NO RDRF=1 Read the data according to the value set to the FBYTE and process it Return the data Set N byte to the transmission FIFO YES Read the data according to the value set to the FBYTE and process it 320 Write "0" to FDRQ bit FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.8 Setting Procedure and Program Flow for Operating Mode 1 (Asynchronous Multiprocessor Mode) MB91313A Series 15.8 Setting Procedure and Program Flow for Operating Mode 1 (Asynchronous Multiprocessor Mode) In operating mode 1 (multiprocessor mode), multiple CPUs communication using the master/slave connection is available. It is possible to use as master/slave. ■ Inter-CPU Connection As shown in the figure below, the master/slave communication system consists of 1 master CPU and multiple slave CPUs connected by 2 common communication lines. UART can be used for the master or slave. Figure 15.8-1 Example of UART Master/Slave Communication Connection SOT SIN Master CPU SOT SIN SOT Slave CPU#0 SIN Slave CPU#1 ■ Function Selection For master/slave communication, select the operating mode and data transfer method as shown in Table 15.8-1. Table 15.8-1 Master/Slave Communication Function Selection Operating mode Data Master CPU Address transmission and reception Data transmission and reception Mode 1 (AD bit transmission) Parity Stop bit Bit direction None 1-bit or 2-bit LSB first or MSB first Slave CPU Mode 1 (AD bit reception) AD = 1 + 7-bit or 8-bit address AD = 0 + 7-bit or 8-bit data Note: Use word access to perform the transmission and reception data (TDR/RDR) in the operating mode 1. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 321 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.8 Setting Procedure and Program Flow for Operating Mode 1 (Asynchronous Multiprocessor Mode) ● Communication procedure MB91313A Series The communication starts when the master CPU transmits address data. The address data, where D8 bit is set to "1", selects the slave CPU to be the destination of the communication. Each slave CPU identifies the address data with the program and communicates with the master CPU (normal data) when the address data matches with the address assigned to the slave CPU. Figure 15.8-2 and Figure 15.8-3 show the flowcharts for master/slave communication. 322 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.8 Setting Procedure and Program Flow for Operating Mode 1 (Asynchronous Multiprocessor Mode) MB91313A Series ■ Flowchart ● Without FIFO Figure 15.8-2 Example of Master/Slave Communication Flowchart (Without FIFO) (Master CPU) (Slave CPU) Start Start Set operating mode (set to mode 1) Set operating mode (set to mode 1) Set SIN pin as serial data input Set SOT pin as serial data output Set SIN pin as serial data input Set SOT pin as serial data output 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 D8 bit to "1" Enable transmission and reception operation Enable transmission and reception operation Receive byte NO Transmit the slave address D8 bit = 1 YES NO Set D8 bit to "0" Slave address matched YES Communicate with slave CPU Terminate communication? Communicate with master CPU NO Terminate communication? YES NO YES Communicate with other slave CPU NO YES Disable transmission and reception operation End CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 323 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.8 Setting Procedure and Program Flow for Operating Mode 1 (Asynchronous Multiprocessor Mode) ● With FIFO MB91313A Series Figure 15.8-3 Example of Master/Slave Communication Flowchart (With FIFO) (Master CPU) (Slave CPU) Start Start Set operating mode (set to mode 1) Set operating mode (set to mode 1) • Enable the transmission and reception FIFO • Specify the FBYTE Enable the transmission and reception FIFO Set AD bit to "1" Set a slave address to the transmission FIFO and write "0" to FDRQ bit Set FBYTE = 1 Transmit the slave address RDRF=1 NO YES AD=1 & slave address matched Set AD bit to "0" NO YES Set N byte to the transmission FIFO and write "0" to FDRQ bit Transmit the data Set FBYTE = N Reception FIFO is full Set D8 bit to "0" NO YES NO YES Read the data according to the value set to the FBYTE and process it 324 Read the data according to the value set to the FBYTE and process it RDRF=1 Transmit the data Set N byte to the transmission FIFO and write "0" to FDRQ bit FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.9 Notes on UART Mode MB91313A Series 15.9 Notes on UART Mode The notes for when you use the UART mode are shown below. • FIFO cannot be used for requesting DMA transfer with a channel with FIFO. Please set as FIFO operation disable. • To request a DMA transfer request, set the block size of DMA to one time. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 325 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.10 Overview of CSIO (Clock Synchronous Multi Function Serial Interface) 15.10 MB91313A Series Overview of CSIO (Clock Synchronous Multi Function Serial Interface) CSIO (clock synchronous multi function serial interface) is a general-purpose serial data communication interface for synchronous communication with external devices (SPI compliant). In addition, it has the transmission/reception FIFO (Maximum 16-byte each). ■ Functions of CSIO (Clock Synchronous Multi Function Serial Interface) Function 1 Data buffer 2 Transfer format 3 Baud rate 4 Data length 5 Reception error detection 6 Interrupt request 7 Synchronous mode 8 Pin access 9 FIFO options • Full-duplex, double buffering (when FIFO is not used) • Transmission/reception FIFO (maximum 16-byte each) * (when FIFO is used) • Clock synchronous (no start/stop bit) • Master/slave function • SPI compliant (both master/slave) • Dedicated baud rate generator (15-bit reload counter configuration, when master operation) • External clock input capability (when slave operation) • Variable 5 to 9 bits • Overrun error • • • • Reception interrupt (reception completion, overrun error) Transmission interrupt (transmission data empty, transmission bus idle) Transmission FIFO interrupt (when the transmission FIFO is empty) Both transmission/reception have the extended intelligent I/O service (EI2OS) and DMA transfer function • Master or slave function • "1" can be set to the serial data output pin • Transmission/reception FIFO are provided (maximum size: transmission FIFO 16-byte, reception FIFO 16-byte)* • Transmission FIFO and reception FIFO can be selected • Transmission data can be retransmitted • Reception FIFO interrupt timing can be changed from the software • Independent FIFO reset support *: FIFO is only provided to ch.0, ch.1 and ch.2 (16-byte each for transmission and reception). 326 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.11 Registers of CSIO (Clock Synchronous Multi Function Serial Interface) MB91313A Series 15.11 Registers of CSIO (Clock Synchronous Multi Function Serial Interface) This section shows the register list of CSIO (clock synchronous multi function serial interface). ■ Register List of CSIO (Clock Synchronous Multi Function Serial Interface) Table 15.11-1 Register List of CSIO (Clock Synchronous Multi Function Serial Interface) Address CSIO FIFO bit15 bit8 bit7 bit0 00X0H 00X1H SCR (serial control register) SMR (serial mode register) 00X2H 00X3H SSR (serial status register) ESCR (extended communication control register) 00X4H 00X5H RDR1/TDR1 (transmission and reception data register 1) RDR0/TDR0 (transmission and reception data register 0) 00X6H 00X7H BGR1 (baud rate generator register 1) BGR0 (baud rate generator register 0) 00X8H 00X9H 00YAH 00YBH FCR1 (FIFO control register 1) FCR0 (FIFO control register 0) 00YCH 00YDH FBYTE2 (FIFO2 byte register) FBYTE1 (FIFO1 byte register) - - (X = 06H, 07H, 08H, 09H, 0AH, 0BH, 1BH, 1CH, 1DH, 1EH, 1FH, Y=06H, 07H, 08H) Table 15.11-2 Bit Arrangement of CSIO (Clock Synchronous Multi Function Serial Interface) bit15 bit14 bit13 bit12 bit11 bit10 bit9 bit8 bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 MS SPI RIE TIE TBIE RXE TXE MD2 MD1 MD0 - SCINV BDS SCKE SOE - - - ORE RDRF TDRE TBI SOP - - - - L2 L1 L0 D8 D7 D6 D5 D4 D3 D2 D1 D0 B8 B7 B6 B5 B4 B3 B2 B1 B0 SCR/SMR UPCL SSR/ ESCR REC TDR/RDR BGR1/ BGR0 - - B14 B13 B12 FCR1/ FCR0 B11 B10 B9 - FTST1 FTST0 FBYTE2/ FD15 FBYTE1 FD14 CM71-10143-5E - FD13 - FLSTE FRIIE FD12 FD11 FDRQ FTIE FSEL - FLST FLD FSET FCL2 FCL1 FE2 FE1 FD10 FD9 FD8 FD7 FD6 FD5 FD4 FD3 FD2 FD1 FD0 FUJITSU SEMICONDUCTOR LIMITED 327 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.11 Registers of CSIO (Clock Synchronous Multi Function Serial Interface) 15.11.1 MB91313A Series Serial Control Register (SCR) Serial control register (SCR) can enable/disable the transmission and reception interrupts, the transmission and reception operations, and transmission idle interrupt. It is also able to set to connect to SPI and reset CSIO. ■ Serial Control Register (SCR) Figure 15.11-1 shows the bit configuration of the serial control register (SCR), and Table 15.11-3 shows the function of each bit. Figure 15.11-1 Bit Configuration of Serial Control Register (SCR) SCR bit 15 ch.0 000060H UPCL ch.1 000070H ch.2 000080H R/W ch.3 000090H ch.4 0000A0H ch.5 0000B0H ch.6 0001B0H ch.7 0001C0H ch.8 0001D0H ch.9 0001E0H ch.A 0001F0H 14 13 12 11 10 9 8 Initial value MS SPI RIE TIE TBIE RXE TXE 00000000B R/W R/W R/W R/W R/W R/W R/W TXE 0 1 Transmission enable bit Disables transmission Enables transmission RXE 0 1 Reception enable bit Disables reception Enables reception TBIE Transmission bus idle interrupt enable bit Disables transmission bus idle interrupt 0 1 TIE 0 1 Transmission interrupt enable bit Disables transmission interrupt Enables transmission interrupt RIE 0 1 Reception interrupt enable bit Disables reception interrupt Enables reception interrupt SPI 0 1 SPI compliant bit Normal synchronous transfer SPI compliant MS 0 1 Master/slave function selection bit Master mode Slave mode UPCL R/W : Readable/writable Enables transmission bus idle interrupt 0 1 Programmable clear bit Write Read No effect Always read "0" Programmable clear : Initial value 328 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E MB91313A Series CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.11 Registers of CSIO (Clock Synchronous Multi Function Serial Interface) Table 15.11-3 Function Description of Each Bit in the Serial Control Register (SCR) Bit name Function UPCL: Programmable clear bit Initializes the internal state of CSIO. When "1" is set: • CSIO is directly reset (software reset). However, the register setting is retained. The CSIO that is under transmission/reception status is immediately disconnected. • Baud rate generator reloads the value set in BGR1/BGR0 register and restarts. • All transmission and reception interrupt sources (TDRE, TBI, RDRF, and ORE) are initialized. • When "0" is set: No effect on the operation. When reading, "0" is always read. Notes: • Execute programmable clear after you disable an interrupt. • When using FIFO, disable FIFO (FE2, FE1 = 0) before you execute programmable clear. bit14 MS: Master/slave function selection bit Specifies whether to use master or slave mode. When "0" is set: Sets to the master mode. When "1" is set: Sets to the slave mode. Note: If the slave mode is specified, an external clock is directly input when SCKE = 0 in the serial mode register (SMR). bit13 SPI: SPI compliant bit This bit is provided for the SPI compliant communication. When "0" is set: Performs the normal synchronous communication. When "1" is set: Performs the SPI compliant communication. bit12 RIE: • Enables/disables the output of a reception interrupt request to the CPU. Reception interrupt enable • A reception interrupt request is output when RIE bit and the reception data flag bit bit (RDRF) are "0" or when the error flag bit (ORE) is set to "1". bit11 TIE: Transmission interrupt enable bit • Enables/disables the output of a transmission interrupt request to the CPU. • A transmission interrupt request is output when TIE bit and the TDRE bit are "1". bit10 TBIE: Transmission bus idle interrupt enable bit • Enables/disables the output of a transmission bus idle interrupt request to the CPU. • A transmission bus idle interrupt request is output when TBI bit and the TBIE bit are "1". RXE: Reception operation enable bit Enables/disables the reception operation of CSIO. • When "0" is set: Disables the data frame reception operation. • When "1" is set: Enables the data frame reception operation. Note: The reception operation is immediately stopped if you disable it (RXE = 0) while receiving. TXE: Transmission operation enable bit Enables/disables the transmission operation of CSIO. • When "0" is set: Disables the data frame transmission operation. • When "1" is set: Enables the data frame transmission operation. Note: The transmission operation is immediately stopped if you disable it (TXE = 0) while transmitting. bit15 bit9 bit8 CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 329 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.11 Registers of CSIO (Clock Synchronous Multi Function Serial Interface) 15.11.2 MB91313A Series Serial Mode Register (SMR) Serial mode register (SMR) can set the operating mode, select transfer direction, data length and serial clock inversion, and enable/disable the output to the pin of the serial data and clock. ■ Serial Mode Register (SMR) Figure 15.11-2 shows the bit configuration of the serial mode register (SMR), and Table 15.11-4 shows the function of each bit. Figure 15.11-2 Bit Configuration of Serial Mode Register (SMR) SMR bit ch.0 000061H ch.1 000071H ch.2 000081H ch.3 000091H ch.4 0000A1H ch.5 0000B1H ch.6 0001B1H ch.7 0001C1H ch.8 0001D1H ch.9 0001E1H ch.A 0001F1H 7 6 5 MD2 MD1 MD0 4 3 − SCINV 2 1 0 Initial value BDS SCKE SOE 000-0000B R/W R/W R/W R/W R/W R/W R/W R/W SOE 0 1 Serial data output enable bit Disables SOT output Enables SOT output SCKE Serial clock output enable bit Disables SCK output or Enables SCK input 0 1 Enables SCK output BDS 0 1 Transfer direction selection bit LSB first (transferred with the lowest bit) MSB first (transferred with the highest bit) SCINV 0 1 Serial clock inversion bit Mark level "H" format Mark level "L" format Unused bit Read value is undefined. Writing has no effect on operation. R/W - 330 : Readable/writable : Unused : Initial value Operating mode setting bits MD2 MD1 MD0 0 0 0 Operating mode 0 (asynchronous normal mode) 0 0 1 Operating mode 1 (asynchronous multiprocessor mode) 0 1 0 Operating mode 2 (clock synchronous mode) 1 0 0 Operating mode 4 (I2C mode) Note: This section explains the register and operation in the operating mode 2. FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E MB91313A Series CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.11 Registers of CSIO (Clock Synchronous Multi Function Serial Interface) Table 15.11-4 Function Description of Each Bit in the Serial Mode Register (SMR) Bit name Function bit7 to bit5 MD2 to MD0: Operating mode setting bits Sets the operating mode. "000B": Sets to the operating mode 0 (asynchronous normal mode) "001B": Sets to the operating mode 1 (asynchronous multiprocessor mode) "010B": Sets to the operating mode 2 (clock synchronous mode) "100B": Sets to the operating mode 4 (I2C mode) Notes: • Any setting other than those above is disabled. • When switching the operating mode, execute the programmable clear (SCR:UPCL = 1) before switching it. • Set the operating mode, and then set each register. bit4 Unused bit When reading : Value is undefined. When writing : No effect. bit3 SCINV: Serial clock inversion bit Inverts the serial clock format. When "0" is set: • The mark level of the serial clock output is set to "H". • The transmission data is synchronized with the falling edge of a serial clock in normal transfer or the rising edge of a serial clock in SPI transfer to output. • The reception data is sampled at the rising edge of a serial clock in normal transfer or the falling edge of a serial clock in SPI transfer. When "1" is set: • The mark level of the serial clock output is set to "L". • The transmission data is synchronized with the rising edge of a serial clock in normal transfer or the falling edge of a serial clock in SPI transfer to output. • The reception data is sampled at the falling edge of a serial clock in normal transfer or the rising edge of a serial clock in SPI transfer. Note: Specify this bit when the transmission/reception are disabled (TXE = RXE= 0). bit2 BDS: Transfer direction selection bit Specifies whether the transfer serial data is transferred with the lowest bit (LSB first, BDS = 0) or the highest bit (MSB first, BDS = 1). Note: Specify this bit when the transmission/reception are disabled (TXE = RXE= 0). bit1 Controls the I/O port of the serial clock. SCKE: When "0" is set: Enables SCK "H" output or SCK input. When using as SCK input, set Serial clock output enable the general-purpose I/O port as an input port. bit When "1" is set: Enables SCK output. bit0 SOE: Serial data output enable bit Enables/disables the output of the serial data. When "0" is set: Enables SOT "H" output. When "1" is set: Enables SOT output. Note: Set the operating mode first because the other registers will be initialized once the operating mode has been changed. However, when SCR and SMR are written at the same time by 16-bit writing, the written contents will be reflected on SCR. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 331 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.11 Registers of CSIO (Clock Synchronous Multi Function Serial Interface) 15.11.3 MB91313A Series Serial Status Register (SSR) Serial status register (SSR) verifies the transmission/reception status and the reception error flag, and also clears the reception error flag. ■ Serial Status Register (SSR) Figure 15.11-3 shows the bit configuration of the serial status register (SSR), and Table 15.11-5 shows the function of each bit. Figure 15.11-3 Bit Configuration of Serial Status Register (SSR) SSR bit 15 ch.0 000062H ch.1 000072H REC ch.2 000082H R/W ch.3 000092H ch.4 0000A2H ch.5 0000B2H ch.6 0001B2H ch.7 0001C2H ch.8 0001D2H ch.9 0001E2H ch.A 0001F2H 14 13 12 − − − − − − 11 10 9 8 ORE RDRF TDRE TBI R R R Initial value 0---0011B R TBI 0 1 TDRE 0 Transmission bus idle flag bit Transmitting No transmission operation 1 Transmission data empty flag bit Transmission data register (TDR) has data Transmission data register is empty RDRF 0 1 Reception data full flag bit Reception data register (RDR) is empty Reception data register (RDR) has data ORE 0 1 Overrun error flag bit No overrun error There is an overrun error Unused bits Read values are undefined. Writing has no effect on operation. REC R/W : Readable/writable R : Read only : Unused : Initial value 332 0 1 Reception error flag clear bit Write Read No effect Always read "0" Clears reception error flags (FRE, ORE) FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.11 Registers of CSIO (Clock Synchronous Multi Function Serial Interface) Table 15.11-5 Function Description of Each Bit in the Serial Status Register (SSR) MB91313A Series Bit name Function bit15 REC: Reception error flag clear bit Clears ORE flag in the serial status register (SSR). • Writing "1" to this bit clears the error flags. • Writing "0" has no effect. When reading, "0" is always read. bit14 to bit12 Unused bits When reading: Values are undefined. When writing: No effect. bit11 ORE: Overrun error flag bit • When an overrun error occurs while receiving, this bit is set to "1". When you write "1" to REC bit in the serial status register (SSR), this bit is cleared. • A reception interrupt request is output when ORE bit and RIE bit are "1". • Data in the reception data register (RDR) is invalid if this flag is set. • When this bit is set while using the reception FIFO, the enable bit in the reception FIFO will be cleared and the reception data will not be stored into the reception FIFO. bit10 • Indicates the status of the reception data register (RDR). • When the reception data is loaded to RDR, this bit is set to "1". If the reception data register (RDR) is read, this bit is cleared to "0". • A reception interrupt request is output when RDRF bit and RIE bit are "1". • When using the reception FIFO, RDRF is set to "1" if the reception FIFO has received a predefined number of data. RDRF: • When using the reception FIFO, if the reception idle state continues over 8 clocks of Reception data full flag bit the baud rate clock (because the reception FIFO has not received a predefined number of data and some data still remains in the reception FIFO), RDRF is set to "1". If you read the RDR while counting 8 clocks, the counter is reset to "0" and start counting 8 clocks all over again. • When using the reception FIFO, this bit is cleared to "0" if the reception FIFO gets empty. bit9 TDRE: Transmission data empty flag bit • Indicates the status of the transmission data register (TDR). • When you write a transmission data to TDR, this bit becomes "0" to indicate that there is some valid data. When the data is loaded to the transmission shift register to start transmission, this bit becomes "1" to indicate that there is no valid data in TDR. • A transmission interrupt request is output when TIE bit and the TDRE bit are "1". • If you set UPCL bit in the serial control register (SCR) to "1", TDRE bit becomes "1". • For more information about set/reset timing of TDRE bit when using the transmission FIFO, see "15.4.4 Interrupt Generation and Flag Set Timing When Using Transmission FIFO". bit8 • Indicates that CSIO is not processing the transmission operation. • This bit becomes "0" when data is written to the transmission data register (TDR). • This bit becomes "1" when the transmission data register (TDR) is empty (TDRE = TBI: 1) and the transmission operation is not in progress. Transmission bus idle flag • If you set UPCL bit in the serial control register (SCR) to "1", TDRE bit becomes bit "1". • A transmission interrupt request is output when this bit is "1" and the transmission bus idle interrupt is enabled (SCR:TBIE = 1). CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 333 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.11 Registers of CSIO (Clock Synchronous Multi Function Serial Interface) 15.11.4 MB91313A Series Extended Communication Control Register (ESCR) Extended communication control register (ESCR) can set the transmission/reception data length and fix the serial output to "H". ■ Bit Configuration of Extended Communication Control Register (ESCR) Figure 15.11-4 shows the bit configuration of the extended communication control register (ESCR), and Table 15.11-6 shows the function of each bit. Figure 15.11-4 Bit Configuration of Extended Communication Control Register (ESCR) ESCR bit 7 ch.0 000063H SOP ch.1 000073H ch.2 000083H R/W ch.3 000093H ch.4 0000A3H ch.5 0000B3H ch.6 0001B3H ch.7 0001C3H ch.8 0001D3H ch.9 0001E3H ch.A 0001F3H 6 5 4 3 2 1 0 Initial value − − − − L2 L1 L0 0----000B − − − − R/W R/W R/W L2 0 0 0 0 1 L1 0 0 1 1 0 L0 0 1 0 1 0 Data length selection bits 8-bit length 5-bit length 6-bit length 7-bit length 9-bit length Unused bits Read values are undefined. Writing has no effect on operation. SOP R/W - : Readable/writable : Unused 0 1 Serial output pin set bit Write Read No effect Always read "0" Sets SOT pin to "H" : Initial value 334 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E MB91313A Series CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.11 Registers of CSIO (Clock Synchronous Multi Function Serial Interface) Table 15.11-6 Function Description of Each Bit in the Extended Communication Control Register (ESCR) Bit name Function bit7 SOP: Serial output pin set bit • Sets the serial output pin to "H" level. • When reading, "0" is always read. Note: Do not set this bit while transmitting the serial data. Configuration value for this bit is enabled only when TXE bit for serial control register (SCR) is "0". bit6 to bit3 Unused bits When reading : Values are undefined. When writing : No effect. Specifies the data length of the transmission/reception data. bit2 to bit0 L2 to L0: Data length selection bits CM71-10143-5E • When "000B" is set: Sets the data length to 8-bit. • When "001B" is set: Sets the data length to 5-bit. • When "010B" is set: Sets the data length to 6-bit. • When "011B" is set: Sets the data length to 7-bit. • When "100B" is set: Sets the data length to 9-bit. Note: Any setting other than those above is disabled. FUJITSU SEMICONDUCTOR LIMITED 335 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.11 Registers of CSIO (Clock Synchronous Multi Function Serial Interface) 15.11.5 MB91313A Series Reception Data Register/Transmission Data Register (RDR/TDR) Reception/transmission data registers are arranged in the same address. When reading, it functions as the reception data register and when writing, it functions as the transmission data register. ■ Reception Data Register (RDR) Figure 15.11-5 shows the bit configuration of the reception data register (RDR). Figure 15.11-5 Bit Configuration of the Reception Data Register (RDR) RDR ch.0 000064H ch.2 000084H ch.4 0000A4H ch.6 0001B4H ch.8 0001D4H ch.A 0001F4H R: Read only ch.1 ch.3 ch.5 ch.7 ch.9 000074H bit15........... 000094H 0000B4H 0001C4H 0001E4H 8 D8 7 D7 6 D6 5 D5 4 D4 3 D3 2 D2 1 D1 0 D0 R R R R R R R R R Initial value 000000000B Reception data register (RDR) is a 9-bit data buffer register for serial data reception. • A serial data signal transmitted to the serial input pin (SIN pin) is converted at the shift register and then stored in this reception data register (RDR). • As described below, data becomes "0" from the upper bits depending on the data length. Data length D8 D7 D6 D5 D4 D3 D2 D1 D0 9-bit X X X X X X X X X 8-bit 0 X X X X X X X X 7-bit 0 0 X X X X X X X 6-bit 0 0 0 X X X X X X 5-bit 0 0 0 0 X X X X X • When the received data is stored in the reception data register (RDR), the reception data full flag bit (SSR:RDRF) is set to "1". If the reception interrupt is enabled (SSR:RIE = 1), a reception interrupt request occurs. • Read the reception data register (RDR) when the reception data full flag bit (SSR:RDRF) is "1". If the serial reception data register (RDR) is read, the reception data full flag bit (SSR:RDRF) is automatically cleared to "0". • If a reception error occurs (SSR:ORE), the data in the reception data register (RDR) becomes invalid. • For 9-bit length transfer, RDR reading is performed by 16-bit access. 336 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E MB91313A Series CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.11 Registers of CSIO (Clock Synchronous Multi Function Serial Interface) Notes: • When using the reception FIFO, RDRF is set to "1" if the reception FIFO has received a predefined number of data. • When using the reception FIFO, RDRF is cleared to "0" if the reception FIFO gets empty. • When a reception error occurs (SSR:ORE = 1) while using the reception FIFO, the enable bit in the reception FIFO will be cleared and the received data will not be stored into the reception FIFO. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 337 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.11 Registers of CSIO (Clock Synchronous Multi Function Serial Interface) MB91313A Series ■ Transmission Data Register (TDR) Figure 15.11-6 shows the bit configuration of the transmission data register (TDR). Figure 15.11-6 Bit Configuration of the Transmission Data Register (TDR) TDR ch.0 000064H ch.2 000084H ch.4 0000A4H ch.6 0001B4H ch.8 0001D4H ch.A 0001F4H W: Write only ch.1 ch.3 ch.5 ch.7 ch.9 000074H bit15........... 000094H 0000B4H 0001C4H 0001E4H 8 D8 7 D7 6 D6 4 D5 5 D4 3 D3 2 D2 1 D1 0 D0 W W W W W W W W W Initial value 111111111B Transmission data register (TDR) is a 9-bit data buffer register for serial data transmission. • If data to be transmitted is written to the transmission data register (TDR) when the transmission operation is enabled (SCR:TXE = 1), the data is transferred to the transmission shift register where the data is converted to serial data, and then transmitted from the serial data output pin (SOT pin). • As described below, data becomes invalid from the upper bits depending on the data length. Data length D8 D7 D6 D5 D4 D3 D2 D1 D0 9-bit X X X X X X X X X 8-bit Invalid X X X X X X X X 7-bit Invalid Invalid X X X X X X X 6-bit Invalid Invalid Invalid X X X X X X 5-bit Invalid Invalid Invalid Invalid X X X X X • A transmission data empty flag (SSR:TDRE) is cleared to "0" when the transmission data is written into the transmission data register (TDR). • If the transmission FIFO is disabled or empty, the transmission data empty flag (SSR:TDRE) is set to "1" when the transmission data is transferred to the transmission shift register and the transmission is started. • When the transmission data empty flag (SSR:TDRE) is "1", you can write next transmission data. If transmission interrupt is enabled, a transmission interrupt request occurs. Write next transmission data when a transmission interrupt occurs or when the transmission data empty flag (SSR:TDRE) is "1". • You cannot write a transmission data to the transmission data register (TDR) when the transmission data empty flag (SSR:TDRE) is "0" and also the transmission FIFO is disabled or full. • For 9-bit length transfer, writing to TDR is performed by 16-bit access. 338 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E MB91313A Series CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.11 Registers of CSIO (Clock Synchronous Multi Function Serial Interface) Notes: • The transmission data register (TDR) is a write only register and the reception data register (RDR) is a read only register. These registers are located at the same address, so the read value is different from the write value. Therefore an instruction that operates read-modify-write (RMW) instruction, such as INC/DEC, cannot be used. • For more information about the set timing of the transmission data empty flag (SSR:TDRE) when using the transmission FIFO, see "15.4.4 Interrupt Generation and Flag Set Timing When Using Transmission FIFO". CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 339 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.11 Registers of CSIO (Clock Synchronous Multi Function Serial Interface) MB91313A Series Baud Rate Generator Registers 1, 0 (BGR1/BGR0) 15.11.6 The baud rate generator registers 1, 0 (BGR1/BGR0) sets the division ratio for the serial clock. ■ Bit Configuration of Baud Rate Generator Registers 1, 0 (BGR1/BGR0) Figure 15.11-7 shows the bit configuration of the baud rate generator registers 1, 0 (BGR1/BGR0). Figure 15.11-7 Bit Configuration of Baud Rate Generator Registers 1, 0 (BGR1/BGR0) BGR bit ch.0 000066H ch.1 000076H ch.2 000086H ch.3 000096H ch.4 0000A6H ch.5 0000B6H ch.6 0001B6H ch.7 0001C6H ch.8 0001D6H ch.9 0001E6H ch.A 0001F6H 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 − B14 B13 B12 B11 B10 B9 B8 B7 B6 B5 B4 B3 B2 B1 B0 -0000000B − 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 R/W 00000000B BGR0 Write Read Baud rate generator register 0 Writes to the reload counter bits 0 to 7 Reads the value set to BGR0 BGR1 Write Read Baud rate generator register 1 Writes to the reload counter bits 8 to 14 Reads the value set to BGR1 Unused bit R/W: Readable/writable Read value is undefined. Writing has no effect on operation. • Set a value to the baud rate generator registers 1, 0 (BGR1, BGR0). • BGR1 (supports the upper bits) and BGR0 (supports the lower bits) can write the reload value to count and read the value set to BGR1/BGR0. • The reload counter starts counting when a reload value is written in the baud rate generator registers 1, 0 (BGR1/BGR0). 340 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E MB91313A Series CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.11 Registers of CSIO (Clock Synchronous Multi Function Serial Interface) Notes: • Write to the baud rate generator registers 1, 0 (BGR1/BGR0) by 16-bit access. • If the reload value is an even number, "L" and "H" widths of the serial clock become as follows depending on the setting for SCINV bit: If it is an odd number, "H" and "L" widths of the serial clock have the same length. When SCINV = 0, "H" width of the serial clock is longer than "L" width by 1 cycle of the machine clock. When SCINV = 1, "L" width of the serial clock is longer than "H" width by 1 cycle of the machine clock. • Be sure to set the reload value to 1 or more. However, if you use CSIO for the master and slave, set the reload value for the master CSIO to 3 or more. • When you change the value set to the baud rate generator registers 1, 0 (BGR0/BGR1), new value is reloaded after the counter value reaches "000000000000000B". Therefore, if you want to reflect the change immediately, execute CSIO reset (UPCL) after you change the value set to BGR1/BGR0. • When using the reception FIFO, you need to set a baud rate to BGR1/BGR0 if the reception FIFO idle detection enable bit is set to "1" (FCR1:FRIIE) to operate as the slave mode. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 341 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.11 Registers of CSIO (Clock Synchronous Multi Function Serial Interface) 15.11.7 MB91313A Series FIFO Control Register 1 (FCR1) FIFO control register 1 (FCR1) sets the test for FIFO, specifies the transmission/ reception FIFO, enables the transmission FIFO interrupt, and controls the interrupt flag. ■ Bit Configuration of FIFO Control Register 1 (FCR1) Figure 15.11-8 shows the bit configuration of the FIFO control register 1 (FCR1), and Table 15.11-7 shows the function of each bit. Figure 15.11-8 Bit Configuration of FIFO Control Register 1 (FCR1) FCR1 bit 15 14 13 ch.0 00006AH FTST1 FTST0 ch.1 00007AH ch.2 00008AH R/W R/W 12 11 FLSTE FRIIE R/W R/W 10 9 FDRQ FTIE R/W R/W 8 FSEL Initial value 00-00100B R/W FSEL FIFO selection bit 0 1 Transmission FIFO: FIFO1, Reception FIFO: FIFO2 FTIE 0 1 Transmission FIFO interrupt enable bit Disables the transmission FIFO interrupt Enables the transmission FIFO interrupt Transmission FIFO: FIFO2, Reception FIFO: FIFO1 FDRQ 0 1 Transmission FIFO data request bit Does not request the transmission FIFO data Requests the transmission FIFO data FRIIE 0 1 Reception FIFO idle detection enable bit Disables the reception FIFO idle detection Enables the reception FIFO idle detection FLSTE 0 1 Retransmission data lost detection enable bit Disables the data lost detection Enables the data lost detection Unused bit Read value is undefined. Writing has no effect on operation. FTST1.0 00B R/W : Readable/writable - : Unused Other than 00B FIFO test bits Disables FIFO test Prohibited setting : Initial value 342 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.11 Registers of CSIO (Clock Synchronous Multi Function Serial Interface) Table 15.11-7 Function Description of Each Bit in the FIFO Control Register 1 (FCR1) MB91313A Series Bit name Function bit15, FTST1, FTST0: bit14 FIFO test bits These are the test bits for FIFO. Be sure to set these bits to "0". Note: If you set these bits to "1", the test for FIFO will be executed. bit13 Unused bit When reading : Value is undefined. When writing : No effect. bit12 FLSTE: Retransmission data lost detection enable bit Enables data lost detection. When "0" is set: Disables data lost detection. When "1" is set: Enables data lost detection. Note: When you set this bit to "1", set FSET bit to "1" before doing so. bit11 FRIIE: Reception FIFO idle detection enable bit Specifies whether to detect the reception idle state that continues over 8-bit time with the reception FIFO holding valid data. If the reception interrupt is enabled (SCR:RIE = 1), a reception interrupt occurs when the reception idle state is detected. When "0" is set: Disables the reception idle state detection. When "1" is set: Enables the reception idle state detection. bit10 FDRQ: Transmission FIFO data request bit This is a data request bit for the transmission FIFO. When this bit is set to "1", it indicates that the transmission data is being requested. A transmission FIFO interrupt request is output when this bit is "1" and the transmission FIFO interrupt is enabled (FTIE = 1). FDRQ set condition • FBYTE (for transmission) = 0 (transmission FIFO is empty) • Reset the transmission FIFO FDRQ reset condition • When writing "0" to this bit • When the transmission FIFO gets full Notes: • When FBYTE (for transmission) = 0, writing "0" to this bit is disabled. • When this bit is set to "0", change of FSEL bit is disabled. • Setting "1" to this bit has no effect on the operations. • "1" is read by a read-modify-write (RMW) instruction. bit9 FTIE: Transmission FIFO interrupt enable bit This is an interrupt enable bit for the transmission FIFO. If this bit is set to "1", an interrupt occurs when FDRQ bit is "1". FSEL: FIFO selection bit Selects the transmission/reception FIFO. When "0" is set:Assigns the transmission FIFO:FIFO1 and the reception FIFO:FIFO2. When "1" is set:Assigns the transmission FIFO:FIFO2 and the reception FIFO:FIFO1. Notes: • This bit cannot be cleared by the FIFO reset (FCL2, FCL1 = 1). • When you want to change this bit, disable FIFO operation (FE2, FE1 = 0) and any transmission/reception (TXE = RXE = 0) first. bit8 CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 343 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.11 Registers of CSIO (Clock Synchronous Multi Function Serial Interface) 15.11.8 MB91313A Series FIFO Control Register 0 (FCR0) FIFO control register 0 (FCR0) enables/disables FIFO operation, performs FIFO reset, saves the read pointer, and sets the retransmission. ■ Bit Configuration of FIFO Control Register 0 (FCR0) Figure 15.11-9 shows the bit configuration of the FIFO control register 0 (FCR0), and Table 15.11-8 shows the function of each bit. Figure 15.11-9 Bit Configuration of FIFO Control Register 0 (FCR0) FCR0 bit ch.0 00006BH ch.1 00007BH ch.2 00008BH 7 − 6 5 4 3 2 1 FLST FLD FSET FCL2 FCL1 FE2 (−) R R/W R/W R/W R/W R/W 0 Initial value FE1 -0000000B R/W FE1 0 1 FIFO1 operation enable bit Disables FIFO1 operation Enables FIFO0 operation FE2 0 1 FIFO2 operation enable bit Disables FIFO2 operation Enables FIFO2 operation FCL1 0 1 FIFO1 reset bit Write No effect FIFO1 reset FCL2 0 1 FSET R/W : Readable/writable R : Read only - : Unused Read Always read "0" FIFO2 reset bit Write No effect FIFO2 reset Read Always read "0" 0 1 FIFO pointer save bit Write Read Does not save Always read "0" Executes save FLD 0 1 FIFO pointer reload bit Does not reload Executes reload FLST 0 1 FIFO retransmission data lost flag bit Disables the data lost Enables the data lost Unused bit When reading, "0" is always read. When writing, "0" is always written. : Initial value 344 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.11 Registers of CSIO (Clock Synchronous Multi Function Serial Interface) Table 15.11-8 Function Description of Each Bit in the FIFO Control Register 0 (FCR0) (1 / 2) MB91313A Series Bit name bit7 bit6 bit5 bit4 bit3 bit2 Function Unused bit When reading : "0" is always read. When writing : Always write "0". FLST: FIFO retransmission data lost flag bit Indicates that retransmission data of the transmission FIFO has been lost. FLST set condition • Writing to FIFO when FLSTE bit in the FIFO control register 1 (FCR1) is "1" and also the write pointer of the transmission FIFO and the read pointer saved by FSET bit match each other. FLST reset condition • FIFO reset (writing "1" into FCL) • When writing "1" to FSET bit Setting this bit to "1" overwrites the data indicated by the read pointer saved with FSET bit, therefore FLD bit cannot set the retransmission when an error occurs. If you retransmit with this bit set to "1", perform FIFO reset and write the data again into FIFO. FLD: FIFO pointer reload bit Reloads the data saved to the transmission FIFO by FSET bit to the read pointer. This bit is used for the retransmission due to a communication error. When a retransmission setting is completed, this bit becomes "0". Notes: • As long as this bit is set to "1", this bit is reloading to the read pointer. Therefore, do not write anything other than FIFO reset. • Setting this bit to "1" is disabled while transmitting or being in FIFO enabled state. • Set TIE and TBIE bits to "0" and then write "1" into this bit. After you enabled the transmission FIFO, set TIE and TBIE bits to "1". FSET: FIFO pointer save bit Saves the read pointer of the transmission FIFO. Once you save the read pointer before transmission, when FLST bit is "0" it is possible to retransmit in the case a communication error. When "1" is set: Retains the current value set to the read pointer. When "0" is set: No effect. Note: Set this bit to "1" when the number of bytes for transmission (FBYTE) indicates "0". FCL2: FIFO2 reset bit Resets FIFO2. If you set this bit to "1", the internal state of FIFO2 is initialized. Only the FLST2 bit in the FIFO control register 1 (FCR1) is initialized and the other bits in the FCR1/FCR0 registers remain unchanged. Notes: • Disables any transmission/reception before performing FIFO2 reset. • Set the transmission FIFO interrupt enable bit to "0" first. • The number of the valid data in the FBYTE2 register becomes "0". FCL1: FIFO1 reset bit Resets FIFO1. If you set this bit to "1", the internal state of FIFO1 is initialized. Only the FLST1 bit in the FIFO control register 1 (FCR1) is initialized and the other bits in the FCR1/FCR0 registers remain unchanged. Notes: • Disables any transmission/reception before performing FIFO1 reset. • Set the transmission FIFO interrupt enable bit to "0" first. • The number of the valid data in the FBYTE1 register becomes "0". CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 345 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.11 Registers of CSIO (Clock Synchronous Multi Function Serial Interface) Table 15.11-8 Function Description of Each Bit in the FIFO Control Register 0 (FCR0) (2 / 2) MB91313A Series Bit name bit1 bit0 346 Function FE2: FIFO2 operation enable bit Enables/disables the operation of FIFO2. • When using FIFO2, set this bit to "1". • Set FIFO2 to the transmission FIFO (FCR1:FSEL = 1). When there is some data in FIFO2 and UART is enabled for transmission (TXE = 1), writing "1" into this bit starts transmitting immediately. At this time, set TIE and TBIE bits to "0" and then write "1" into this bit to make TIE and TBIE bits to "1". • If specified as a reception FIFO by FSEL bit, a reception error clears this bit to "0". You cannot set this bit to "1" until the reception error is cleared. • When using as the transmission FIFO, set "1" or "0" to this bit when the transmission buffer is empty (TDRE = 1). If using as the reception FIFO, set "1" or "0" to this bit when the reception buffer is empty (RDRF = 0). • Even if FIFO2 is disabled, the state of FIFO2 is still retained. FE1: FIFO1 operation enable bit Enables/disables the operation of FIFO1. • When using FIFO1, set this bit to "1". • Set FIFO1 to the transmission FIFO (FCR1:FSEL = 0). When there is some data in FIFO1 and UART is enabled for transmission (TXE = 1), writing "1" into this bit starts transmitting immediately. At this time, set TIE and TBIE bits to "0" and then write "1" into this bit to make TIE and TBIE bits to "1". • If specified as a reception FIFO by FSEL bit, a reception error clears this bit to "0". You cannot set this bit to "1" until the reception error is cleared. • When using as the transmission FIFO, set "1" or "0" to this bit when the transmission buffer is empty (TDRE = 1). If using as the reception FIFO, set "1" or "0" to this bit when the reception buffer is empty (RDRF = 0). • Even if FIFO1 is disabled, the state of FIFO1 is still retained. FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E MB91313A Series 15.11.9 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.11 Registers of CSIO (Clock Synchronous Multi Function Serial Interface) FIFO Byte Register (FBYTE) FIFO byte register (FBYTE) indicates the number of valid data for FIFO. ■ Bit Configuration of FIFO Byte Register (FBYTE) Figure 15.11-10 shows the bit configuration of the FIFO byte register (FBYTE). Figure 15.11-10 Bit Configuration of FIFO Byte Register (FBYTE) FBYTE bit 15 14 13 12 11 10 9 ch.0 00006CH FD15 FD14 FD13 FD12 FD11 FD10 FD9 ch.1 00007CH ch.2 00008CH R/W R/W R/W R/W R/W R/W R/W 8 6 5 4 3 FD7 FD8 FD5 FD4 FD3 FD2 FD1 FD0 00000000B R/W R/W R/W R/W R/W R/W R/W R/W R/W 00000000B FBYTE1 Write Read 2 1 0 Initial value 7 FD8 FIFO1 data number display bit Sets the transfer count Reads the number of valid data FBYTE2 FIFO2 data number display bit Write Sets the transfer count R/W: Readable/writable Read Reads the number of valid data Read (number of valid data) When transmitting : The number of data that are written into FIFO and have not transmitted yet. When receiving : The number of data that are received at FIFO. Write (transfer count) When transmitting : Sets "00H". When receiving : Sets the number of data that generates a reception interrupt. FIFO byte register (FBYTE) indicates the number of valid data of FIFO. The number varies as follows, depending on the setting of FSEL bit in the FCR1 register. Table 15.11-9 The Number of Data Displayed FSEL FIFO selection The number of byte displayed 0 FIFO2: Reception FIFO, FIFO1: Transmission FIFO FIFO2: FBYTE2, FIFO1: FBYTE1 1 FIFO2: Transmission FIFO, FIFO1: Reception FIFO FIFO2: FBYTE2, FIFO1: FBYTE1 • The initial value of the transfer count of the FIFO byte register (FBYTE) is "08H". • Set the number of data to generate a reception interrupt flag to the FBYTE in the reception FIFO. An interrupt flag (RDRF) is set to "1" when the defined transfer count matches with the number of data displayed in the FIFO byte register (FBYTE). • If the reception FIFO idle detection enable bit (FRIIE) is "1" and the number of data that exists in the reception FIFO has not reached the transfer count, the interrupt flag (RDRF) is set to "1" when the reception idle state continues over 8 clocks of the baud rate clock. If you read the RDR while counting 8 clocks, the counter is reset to "0" and start counting 8 clocks all over again. The counter is reset to "0" when the reception FIFO is disabled. When the reception FIFO that has still some data is enabled, it starts counting all over again. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 347 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.11 Registers of CSIO (Clock Synchronous Multi Function Serial Interface) • To receive the data with the master operation (master reception), set TIE and TBIE bits to "0", specify the number of data to receive in the FIFO byte register (FBYTE) of the transmission FIFO, and write "0" to FDRQ bit. Then, the specified number of data for serial clock can be output when TXE bit is "1" to receive the specified number of data. If you want to set TIE and TBIE bits to "1", wait until FDRQ bit becomes "1". MB91313A Series Notes: • In the master operation, set "00H" to FBYTE of the transmission FIFO except that data is received. • When receiving data with the master operation, set the number of transmission data when the transmission FIFO is empty and also TIE and TBIE bits are set to "0". • If you want to disable the reception (RXE=0) while receiving the data with the master operation, disable the transmission FIFO before disabling the transmission and reception. • Set a data more than "1" to the FBYTE in the reception FIFO. • Disable the reception before changing the FBYTE in the reception FIFO. • You cannot use any read-modify-write (RMW) instruction to this register. • The setting that exceeds the FIFO size is disabled. 348 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E MB91313A Series 15.12 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.12 Interrupts of CSIO (Clock Synchronous Multi Function Serial Interface) Interrupts of CSIO (Clock Synchronous Multi Function Serial Interface) There are reception and transmission interrupts for CSIO (clock synchronous multi function serial interface) and an interrupt request can be generated by the following sources: • When the received data is set in the reception data register (RDR), or a reception error occurs • When the transmission data is transferred from the transmission data register (TDR) to the transmission shift register and the transmission has started • Transmission bus idle (no transmission operation) • Transmission FIFO data request ■ Interrupts of CSIO Table 15.12-1 shows the CSIO interrupt control bit and the interrupt source. Table 15.12-1 CSIO Interrupt Control Bit and Interrupt Source Interrupt type Interrupt request flag bit Flag register Interrupt source Interrupt source enable bit Receive 1 byte How to clear the interrupt request flag Read reception data (RDR) The value set to FBYTE is received RDRF SSR Reception ORE TDRE Transmission SSR SSR TBI SSR FDRQ FCR1 Detect the reception idle state that continues over 8-bit time with the reception FIFO holding valid data when FRIIE bit is "1" SCR:RIE Read reception data (RDR) until the reception FIFO gets empty Overrun error Write "1" to the reception error flag clear bit (SSR:REC) Transmission register is empty SCR:TIE Write to the transmission data (TDR), or write "1" to the transmission FIFO operation enable bit when it is "0" and the transmission FIFO has a valid data (retransmission)* No transmission operation SCR:TBIE Write to the transmission data (TDR), or write "1" to the transmission FIFO operation enable bit when it is "0" and the transmission FIFO has a valid data (retransmission)* Transmission FIFO is empty Write "0" to the FIFO transmission data FCR1:FTIE request bit (FCR1:FDRQ), or the transmission FIFO is full *: Set TIE bit to "1" after TDRE bit has become "0". CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 349 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.12 Interrupts of CSIO (Clock Synchronous Multi Function Serial Interface) MB91313A Series Reception Interrupt Generation and Flag Set Timing 15.12.1 A reception completion (RDRF bit in SSR) and a reception error occurrence (ORE bit in SSR) are the sources of the reception interrupt. ■ Reception Interrupt Generation and Flag Set Timing Detection of the last data bit stores the reception data to the reception data register (RDR). When a reception is completed (SSR:RDRF = 1) or a reception error occurs (SSR:ORE = 1), each flag is set. If reception interrupt is enabled (SSR:RIE = 1) at this point, a reception interrupt occurs. Note: If a reception error occurs, the data in the reception data register (RDR) becomes invalid. Figure 15.12-1 Reception Operation and Flag Set Timing SCK D0 SIN D1 D2 D3 D4 D5 D6 D7 Reception data sampling RDRF Note: This figure shows the timing under the following conditions: SCR: MS=1, SPI=0 ESCR: L2 to L0=000B SMR:SCINV=0, BDS=0, SCKE=0, SOE=0 Reception interrupt occurred Figure 15.12-2 ORE (Overrun Error) Flag Set Timing SCK SIN D0 D1 D2 D3 D4 D5 D6 D7 D0 D1 D2 D3 D4 D5 D6 D7 Reception data sampling RDRF ORE Note: This figure shows the timing under the following conditions: SCR: MS=1, SPI=0 ESCR: L2 to L0=000B SMR:SCINV=0, BDS=0, SCKE=0, SOE=0 An overrun error occurs An overrun error occurs when next data is transferred before the reception data is read (RDRF = 1). 350 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.12 Interrupts of CSIO (Clock Synchronous Multi Function Serial Interface) MB91313A Series 15.12.2 Interrupt Generation and Flag Set Timing When Using Reception FIFO When using the reception FIFO, an interrupt is generated when the same value set to the FIFO byte register (FBYTE) has been received. ■ Reception Interrupt Generation and Flag Set Timing When Using Reception FIFO When using the reception FIFO, the generation of an interrupt depends on the value set to the FIFO byte register (FBYTE). • When the amount of data set to the FIFO byte register (FBYTE) as the transfer count has been received, the reception data full flag bit in the serial status register (RDRF bit in SSR) is set to "1". If reception interrupt is enabled (SCR:RIE) at this point, a reception interrupt occurs. • If the reception FIFO idle detection enable bit (FRIIE) is "1" and the number of data that exists in the reception FIFO has not reached the transfer count, the interrupt flag (RDRF) is set to "1" when the reception idle state continues over 8 clocks of the baud rate clock. If you read the RDR while counting 8 clocks, the counter is reset to "0" and start counting 8 clocks all over again. The counter is reset to "0" when the reception FIFO is disabled. When the reception FIFO that has still some data is enabled, it starts counting all over again. • When the reception data (RDR) is read until the reception FIFO gets empty, the reception data full flag bit (SSR:RDRF) is cleared. • If next data is received with the FIFO size displayed as the number of data that can be received, an overrun error occurs (SSR:ORE = 1). Figure 15.12-3 Reception Interrupt Generation Timing When Using Reception FIFO SCK Reception data 1st byte 2nd byte 3rd byte FIFO byte (reception) Valid byte displayed 4th byte 5th byte 6th byte 1 2 7th byte 3 0 1 2 3 2 1 0 3 2 1 0 1 RDRF RDR reading An interrupt occurs upon a match between FIFO byte setting (transfer count) and the number of data received CM71-10143-5E Read all reception data FUJITSU SEMICONDUCTOR LIMITED 351 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.12 Interrupts of CSIO (Clock Synchronous Multi Function Serial Interface) Figure 15.12-4 Set Timing of ORE (Overrun Error) Flag Bit MB91313A Series SCK Reception data FIFO byte (reception) Valid byte displayed 1st byte 2nd byte 3rd byte 4th byte 5th byte 6th byte 7th byte 60 59 60 61 62 63 64 RDRF ORE An interrupt occurs upon a match between FIFO byte (reception) setting + 1 and the number of data received An overrun error occurs An overrun error occurs when next data is received with the FIFO size displayed in the FIFO. The figure shows an example where a FIFO size of 64 bytes is used. 352 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.12 Interrupts of CSIO (Clock Synchronous Multi Function Serial Interface) MB91313A Series 15.12.3 Transmission Interrupt Generation and Flag Set Timing A transmission interrupt occurs when the transmission data is transferred from the transmission data register (TDR) to the transmission shift register (SSR:TDRE = 1) and the transmission has started, or when the transmission operation is not in progress (SSR:TBI = 1). ■ Transmission Interrupt Generation and Flag Set Timing ● Set timing of the transmission data empty flag (TDRE) Once the data written into the transmission data register (TDR) is transferred to the transmission shift register, next data can be written into TDR (SSR:TDRE = 1). If transmission interrupt is enabled (SCR:TIE = 1) at this point, a transmission interrupt occurs. As TDRE bit is read only, it is cleared to "0" by writing data into the transmission data register (TDR). Figure 15.12-5 Set Timing of Transmission Data Empty Flag (TDRE) SCK Transmission data D0 D1 D2 D3 D4 D5 D6 D7 D0 D1 D2 D3 D4 D5 TDRE Writing to TDR A transmission interrupt occurred ● Set timing of the transmission bus idle flag (TBI) TBI bit in the serial status register (SSR) is set to "1" when the transmission data register is empty (TDRE = 1) and the transmission operation is not in progress. If transmission bus idle interrupt is enabled (SCR:TBIE = 1) at this point, a transmission interrupt occurs. TBI bit and the transmission interrupt request are cleared when a transmission data is set to the transmission data register (TDR). Figure 15.12-6 Set Timing of Transmission Bus Idle Flag (TBI) SCK Transmission data D0 D1 D2 D3 D4 D5 D6 D7 D0 D1 D2 D3 D4 D5 TBI TDRE Writing to TDR CM71-10143-5E A transmission interrupt by the bus idle occurred FUJITSU SEMICONDUCTOR LIMITED 353 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.12 Interrupts of CSIO (Clock Synchronous Multi Function Serial Interface) 15.12.4 MB91313A Series Interrupt Generation and Flag Set Timing When Using Transmission FIFO When using the transmission FIFO, an interrupt occurs when the transmission FIFO has no data. ■ Transmission Interrupt Generation and Flag Set Timing When Using Transmission FIFO • When the transmission FIFO has no data, FIFO transmission data request bit (FCR1:FDRQ) is set to "1". If FIFO transmission interrupt is enabled (FCR1:FTIE = 1) at this point, a transmission interrupt occurs. • Once the transmission interrupt has been generated and you have written the required data into the transmission FIFO, write "0" to the FIFO transmission data request bit (FCR1:FDRQ) to clear the interrupt request. • The FIFO transmission data request bit (FCR1:FDRQ) becomes "0" when the transmission FIFO gets full. • You can verify if the transmission FIFO has data or not by reading the FIFO byte register (FBYTE). FBYTE = 00H indicates that the transmission FIFO has no data. Figure 15.12-7 Transmission Interrupt Generation Timing When Using Transmission FIFO SCK Transmission data FIFO byte displayed 3rd byte 1st byte 0 1 2 1 0 1 4th byte 0 FDRQ TDRE Writing "0" to clear A transmission interrupt occurred *1 Writing to transmission FIFO Transmission buffer is empty *2 TXE *1: FDRQ is set to "1" as the transmission FIFO is empty. *2: TDRE is set to "1" as the transmission buffer register has no data. 354 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.13 Operations of CSIO (Clock Synchronous Multi Function Serial Interface) MB91313A Series 15.13 Operations of CSIO (Clock Synchronous Multi Function Serial Interface) The clock synchronous method is employed as the transfer method. ■ Operations of CSIO (Clock Synchronous Multi Function Serial Interface) (1) Normal transfer (I) ● Features Item Description 1 Mark level of the serial clock (SCK) "H" 2 Transmission data output timing Falling edge of SCK 3 Reception data sampling Rising edge of SCK 4 Data length 5 to 9 bits ● Register setting The following table shows the register setting required for the normal transfer (I): Table 15.13-1 Normal Transfer (I) Register Setting bit15 bit14 bit13 bit12 bit11 bit10 bit9 bit8 bit7 bit6 bit5 SCR/ SMR UPCL MS SPI RIE TIE TBIE RXE TXE MD2 MD1 MD0 0 1/0 0 * * * * * 0 1 0 0 SSR/ ESCR REC - - - ORE RDRF TDRE TBI SOP - - 0 - - - - - - - 0 - - D8 D7 - * TDR/ RDR BGR1/ BGR0 bit4 bit3 bit2 bit1 bit0 BDS SCKE SOE 0 * 1/0 1/0 - - L2 L1 L0 - - - * * * D6 D5 D4 D3 D2 D1 D0 * * * * * * * * WUCR SCINV - B14 B13 B12 B11 B10 B9 B8 B7 B6 B5 B4 B3 B2 B1 B0 - * * * * * * * * * * * * * * * 1: Set "1" 0: Set "0" *: Setting defined by the user Note: The values set for the bits above (1/0) varies depending on the master operation and slave operation. Set as follows: Master transmission : SCR: MS = 0, SMR: SCKE = 1, SOE = 1 Master reception : SCR: MS = 0, SMR: SCKE = 1, SOE = 0 Slave transmission : SCR: MS = 1, SMR: SCKE = 0, SOE = 1 Slave reception : SCR: MS = 1, SMR: SCKE = 0, SOE = 0 CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 355 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.13 Operations of CSIO (Clock Synchronous Multi Function Serial Interface) ● Normal Transfer (I) Timing Chart 1st byte Transmission operation SCK SOUT D0 D1 D2 MB91313A Series 2nd byte D3 D4 D5 D6 D7 D0 D1 D2 D3 D4 D5 D6 D7 TDRE TDR RW TXE Reception operation SIN D0 D1 D2 D3 D4 D5 D6 D7 D0 D1 D2 D3 D4 D5 D6 D7 Sampling RDRF RDR RD RXE ● Operating explanation [1] Master operation (SCR:MS = 0, SMR:SCKE = 1) • Transmission operation (1) Enable the serial data output (SMR:SOE = 1) and the transmission operation (SCR:TXE = 1), and disable the reception operation (SCR:RXE = 0). Then, when you write a transmission data to TDR, TDRE bit in the serial status register (SSR) becomes "0" to output the transmission data in synchronization with the falling edge of the serial clock (SCK) output. (2) When the 1st bit of the transmission data is output, TDRE bit in the serial status register (SSR) becomes "1". A transmission interrupt request is also output when the transmission interrupt is enabled (SCR:TIE = 1). At this point, 2nd byte of the transmission data can be written. • Reception operation (1) Disable the serial data output (SMR:SOE = 0), and enable the transmission operation (SCR:TXE = 1) and the reception operation (SCR:RXE = 1). Then, when you write a dummy data to TDR, the reception data is sampled in synchronization with the rising edge of the serial clock output (SCK). (2) Receiving the last bit sets RDRF bit in the serial status register (SSR) to "1". A reception interrupt request is also output when the reception interrupt is enabled (SCR:RIE = 1). At this point, the reception data (RDR) can be read. (3) If the reception data register (RDR) is read, the RDRF bit in the serial status register (SSR) is cleared to "0". 356 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.13 Operations of CSIO (Clock Synchronous Multi Function Serial Interface) MB91313A Series Notes: • If you want the reception operation only, write a dummy data to TDR in order to output the serial clock (SCK). • When the transmission and reception FIFO are enabled, setting the number of frames you want to transfer to the FIFO byte register (FBYTE) outputs the serial clock (SCK) of the desired number of frames. [2] Slave operation (SCR:MS = 1, SMR:SCKE = 0) • Transmission operation (1) Enable the serial data output (SMR:SOE = 1) and the transmission operation (SCR:TXE = 1). Then, when you write a transmission data to TDR, TDRE bit in the serial status register (SSR) becomes "0" to output the transmission data in synchronization with the falling edge of the serial clock (SCK) input. (2) When the 1st bit of the transmission data is output, TDRE bit in the serial status register (SSR) becomes "1". A transmission interrupt request is also output when the transmission interrupt is enabled (SCR:TIE = 1). At this point, 2nd byte of the transmission data can be written. • Reception operation (1) If you disable the serial data output (SMR:SOE = 0) and enable the reception operation (SCR:RXE = 1), the reception data is sampled in synchronization with the rising edge of the serial clock (SCK) input. (2) Receiving the last bit sets RDRF bit in the serial status register (SSR) to "1". A reception interrupt request is also output when the reception interrupt is enabled (SCR:RIE = 1). At this point, the reception data (RDR) can be read. (3) If the reception data register (RDR) is read, the RDRF bit in the serial status register (SSR) is cleared to "0". CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 357 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.13 Operations of CSIO (Clock Synchronous Multi Function Serial Interface) MB91313A Series (2) Normal transfer (II) ● Features Item Description 1 Mark level of the serial clock (SCK) "L" 2 Transmission data output timing Rising edge of SCK 3 Reception data sampling Falling edge of SCK 4 Data length 5 to 9 bits ● Register setting The following table shows the register setting required for the normal transfer (II): Table 15.13-2 Normal Transfer (II) Register Setting bit15 bit14 bit13 bit12 bit11 bit10 bit9 bit8 bit7 bit6 bit5 SCR/ SMR UPCL MS SPI RIE TIE TBIE RXE TXE MD2 MD1 MD0 0 1/0 0 * * * * * 0 1 0 0 SSR/ ESCR REC - - - ORE RDRF TDRE TBI SOP - - 0 - - - - - - - 0 - - D8 D7 - * TDR/ RDR BGR1/ BGR0 bit4 bit3 bit2 bit1 bit0 BDS SCKE SOE 1 * 1/0 1/0 - - L2 L1 L0 - - - * * * D6 D5 D4 D3 D2 D1 D0 * * * * * * * * WUCR SCINV - B14 B13 B12 B11 B10 B9 B8 B7 B6 B5 B4 B3 B2 B1 B0 - * * * * * * * * * * * * * * * 1: Set "1" 0: Set "0" *: Setting defined by the user Note: The values set for the bits above (1/0) varies depending on the master operation and slave operation. Set as follows: Master transmission : SCR: MS = 0, SMR: SCKE = 1, SOE = 1 Master reception : SCR: MS = 0, SMR: SCKE = 1, SOE = 0 Slave transmission : SCR: MS = 1, SMR: SCKE = 0, SOE = 1 Slave reception : SCR: MS = 1, SMR: SCKE = 0, SOE = 0 358 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.13 Operations of CSIO (Clock Synchronous Multi Function Serial Interface) MB91313A Series ● Normal Transfer (II) Timing Chart Transmission operation 1st byte 2nd byte Mark level SCK SOUT D0 D1 D2 D3 D4 D5 D6 D7 D0 D1 D2 D3 D4 D5 D6 D7 TDRE TDR RW TXE Reception operation SIN D0 D1 D2 D3 D4 D5 D6 D7 D0 D1 D2 D3 D4 D5 D6 D7 Sampling RDRF RDR RD RXE ● Operating explanation [1] Master operation (SCR:MS = 0, SMR:SCKE = 1) • Transmission operation (1) Enable the serial data output (SMR:SOE = 1) and the transmission operation (SCR:TXE = 1), and disable the reception operation (SCR:RXE = 0). Then, when you write a transmission data to TDR, TDRE bit in the serial status register (SSR) becomes "0" to output the transmission data in synchronization with the rising edge of the serial clock (SCK) output. (2) When the 1st bit of the transmission data is output, TDRE bit in the serial status register (SSR) becomes "1". A transmission interrupt request is also output when the transmission interrupt is enabled (SCR:TIE = 1). At this point, 2nd byte of the transmission data can be written. • Reception operation (1) Disable the serial data output (SMR:SOE = 0), and enable the transmission operation (SCR:TXE = 1) and the reception operation (SCR:RXE = 1). Then, when you write a dummy data to TDR, the reception data is sampled in synchronization with the falling edge of the serial clock output (SCK). (2) Receiving the last bit sets RDRF bit in the serial status register (SSR) to "1". A reception interrupt request is also output when the reception interrupt is enabled (SCR:RIE = 1). At this point, the reception data (RDR) can be read. (3) If the reception data register (RDR) is read, the RDRF bit in the serial status register (SSR) is cleared to "0". CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 359 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.13 Operations of CSIO (Clock Synchronous Multi Function Serial Interface) MB91313A Series Notes: • If you want the reception operation only, write a dummy data to TDR in order to output the serial clock (SCK). • When the transmission and reception FIFO are enabled, setting the number of frames you want to transfer to the FIFO byte register (FBYTE) outputs the serial clock (SCK) of the desired number of frames. [2] Slave operation (SCR:MS = 1, SMR:SCKE = 0) • Transmission operation (1) Enable the serial data output (SMR:SOE = 1) and the transmission operation (SCR:TXE = 1). Then, when you write a transmission data to TDR, TDRE bit in the serial status register (SSR) becomes "0" to output the transmission data in synchronization with the rising edge of the serial clock (SCK) input. (2) When the 1st bit of the transmission data is output, TDRE bit in the serial status register (SSR) becomes "1". A transmission interrupt request is also output when the transmission interrupt is enabled (SCR:TIE = 1). At this point, 2nd byte of the transmission data can be written. • Reception operation (1) If you disable the serial data output (SMR:SOE = 0) and enable the reception operation (SCR:RXE = 1), the reception data is sampled in synchronization with the falling edge of the serial clock (SCK) input. (2) Receiving the last bit sets RDRF bit in the serial status register (SSR) to "1". A reception interrupt request is also output when the reception interrupt is enabled (SCR:RIE = 1). At this point, the reception data (RDR) can be read. (3) If the reception data register (RDR) is read, the RDRF bit in the serial status register (SSR) is cleared to "0". 360 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.13 Operations of CSIO (Clock Synchronous Multi Function Serial Interface) MB91313A Series (3) SPI transfer (I) ● Features Item Description 1 Mark level of the serial clock (SCK) "H" 2 Transmission data output timing Rising edge of SCK 3 Reception data sampling Falling edge of SCK 4 Data length 5 to 9 bits ● Register setting The following table shows the register setting required for the SPI transfer (I): Table 15.13-3 SPI Transfer (I) Register Setting bit15 bit14 bit13 bit12 bit11 bit10 bit9 bit8 bit7 bit6 bit5 SCR/ SMR UPCL MS SPI RIE TIE TBIE RXE TXE MD2 MD1 MD0 0 1/0 1 * * * * * 0 1 0 0 SSR/ ESCR REC - - - ORE RDRF TDRE TBI SOP - - 0 - - - - - - - 0 - - D8 D7 - * TDR/ RDR BGR1/ BGR0 bit4 bit3 bit2 bit1 bit0 BDS SCKE SOE 0 * 1/0 1/0 - - L2 L1 L0 - - - * * * D6 D5 D4 D3 D2 D1 D0 * * * * * * * * WUCR SCINV - B14 B13 B12 B11 B10 B9 B8 B7 B6 B5 B4 B3 B2 B1 B0 - * * * * * * * * * * * * * * * 1: Set "1" 0: Set "0" *: Setting defined by the user Note: The values set for the bits above (1/0) varies depending on the master operation and slave operation. Set as follows: Master transmission : SCR: MS = 0, SMR: SCKE = 1, SOE = 1 Master reception : SCR: MS = 0, SMR: SCKE = 1, SOE = 0 Slave transmission : SCR: MS = 1, SMR: SCKE = 0, SOE = 1 Slave reception : SCR: MS = 1, SMR: SCKE = 0, SOE = 0 CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 361 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.13 Operations of CSIO (Clock Synchronous Multi Function Serial Interface) ● SPI Transfer (I) Timing Chart 1st byte Transmission operation SCK SOUT MB91313A Series 2nd byte *A D0 D1 D2 D3 D4 D5 D6 D7 D0 D1 D2 D3 D4 D5 D6 D7 TDRE TDR RW TXE Reception operation SIN D0 D1 D2 D3 D4 D5 D6 D7 D0 D1 D2 D3 D4 D5 D6 D7 Sampling RDRF RDR RD RXE *A: In the slave transmission (MS = 1, SCKE = 0, SOE = 1), you need to wait the time more than 4 machine cycles is elapsed after writing to TDR. ● Operating explanation [1] Master operation (SCR:MS = 0, SMR:SCKE = 1) • Transmission operation (1) Enable the serial data output (SMR:SOE = 1) and the transmission operation (SCR:TXE = 1), and disable the reception operation (SCR:RXE = 0). Then, when you write a transmission data to TDR, TDRE bit in the serial status register (SSR) becomes "0" to output the 1st bit. Then, the transmission data is output in synchronization with the rising edge of the serial clock (SCK) output. (2) TDRE bit in the serial status register (SSR) becomes "1" before the half cycle of the falling edge of the first serial clock. A transmission interrupt request is also output when the transmission interrupt is enabled (SCR:TIE = 1). At this point, 2nd byte of the transmission data can be written. • Reception operation (1) Disable the serial data output (SMR:SOE = 0), and enable the transmission operation (SCR:TXE = 1) and the reception operation (SCR:RXE = 1). Then, when you write a dummy data to TDR, the reception data is sampled in synchronization with the falling edge of the serial clock output (SCK). (2) Receiving the last bit sets RDRF bit in the serial status register (SSR) to "1". A reception interrupt request is also output when the reception interrupt is enabled (SCR:RIE = 1). At this point, the reception data (RDR) can be read. (3) If the reception data register (RDR) is read, the RDRF bit in the serial status register (SSR) is cleared to "0". 362 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.13 Operations of CSIO (Clock Synchronous Multi Function Serial Interface) MB91313A Series Notes: • If you want the reception operation only, write a dummy data to TDR in order to output the serial clock (SCK). • When the transmission and reception FIFO are enabled, setting the number of frames you want to transfer to the FIFO byte register (FBYTE) outputs the serial clock (SCK) of the desired number of frames. [2] Slave operation (SCR:MS = 1, SMR:SCKE = 0) • Transmission operation (1) Enable the serial data output (SMR:SOE = 1) and the transmission operation (SCR:TXE = 1). Then, when you write a transmission data to TDR, TDRE bit in the serial status register (SSR) becomes "0" to output the 1st bit. Then, the transmission data is output in synchronization with the rising edge of the serial clock (SCK) output. (2) TDRE bit in the serial status register (SSR) becomes "1" before the half cycle of the falling edge of the first serial clock. A transmission interrupt request is also output when the transmission interrupt is enabled (SCR:TIE = 1). At this point, 2nd byte of the transmission data can be written. • Reception operation (1) If you disable the serial data output (SMR:SOE = 0) and enable the reception operation (SCR:RXE = 1), the reception data is sampled in synchronization with the falling edge of the serial clock (SCK) input. (2) Receiving the last bit sets RDRF bit in the serial status register (SSR) to "1". A reception interrupt request is also output when the reception interrupt is enabled (SCR:RIE = 1). At this point, the reception data (RDR) can be read. (3) If the reception data register (RDR) is read, the RDRF bit in the serial status register (SSR) is cleared to "0". CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 363 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.13 Operations of CSIO (Clock Synchronous Multi Function Serial Interface) MB91313A Series (4) SPI transfer (II) ● Features Item Description 1 Mark level of the serial clock (SCK) "L" 2 Transmission data output timing Falling edge of SCK 3 Reception data sampling Rising edge of SCK 4 Data length 5 to 9 bits ● Register setting The following table shows the register setting required for the SPI transfer (II): Table 15.13-4 SPI Transfer (II) Register Setting bit15 bit14 bit13 bit12 bit11 bit10 bit9 bit8 bit7 bit6 bit5 SCR/ SMR UPCL MS SPI RIE TIE TBIE RXE TXE MD2 MD1 MD0 0 1/0 1 * * * * * 0 1 0 0 SSR/ ESCR REC - - - ORE RDRF TDRE TBI SOP - - 0 - - - - - - - 0 - - D8 D7 - * TDR/ RDR BGR1/ BGR0 bit4 bit3 bit2 bit1 bit0 BDS SCKE SOE 1 * 1/0 1/0 - - L2 L1 L0 - - - * * * D6 D5 D4 D3 D2 D1 D0 * * * * * * * * WUCR SCINV - B14 B13 B12 B11 B10 B9 B8 B7 B6 B5 B4 B3 B2 B1 B0 - * * * * * * * * * * * * * * * 1: Set "1" 0: Set "0" *: Setting defined by the user Note: The values set for the bits above (1/0) varies depending on the master operation and slave operation. Set as follows: Master transmission : SCR: MS = 0, SMR: SCKE = 1, SOE = 1 Master reception : SCR: MS = 0, SMR: SCKE = 1, SOE = 0 Slave transmission : SCR: MS = 1, SMR: SCKE = 0, SOE = 1 Slave reception : SCR: MS = 1, SMR: SCKE = 0, SOE = 0 364 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.13 Operations of CSIO (Clock Synchronous Multi Function Serial Interface) MB91313A Series ● SPI Transfer (II) Timing Chart Transmission operation SCK SOUT 1st byte 2nd byte *A D0 D1 D2 D3 D4 D5 D6 D7 D0 D1 D2 D3 D4 D5 D6 D7 TDRE TDR RW TXE Reception operation SIN D0 D1 D2 D3 D4 D5 D6 D7 D0 D1 D2 D3 D4 D5 D6 D7 Sampling RDRF RDR RD RXE *A: In the slave transmission (MS = 1, SCKE = 0, SOE = 1), you need to wait the time more than 4 machine cycles is elapsed after writing to TDR. ● Operating explanation [1] Master operation (SCR: MS = 0, SMR: SCKE = 1) • Transmission operation (1) Enable the serial data output (SMR: SOE = 1) and the transmission operation (SCR:TXE = 1), and disable the reception operation (SCR:RXE = 0). Then, when you write a transmission data to TDR, TDRE bit in the serial status register (SSR) becomes "0" to output the transmission data in synchronization with the falling edge of the serial clock (SCK) output. (2) When the 1st bit of the transmission data is output, TDRE bit in the serial status register (SSR) becomes "1". A transmission interrupt request is also output when the transmission interrupt is enabled (SCR:TIE = 1). At this point, 2nd byte of the transmission data can be written. • Reception operation (1) Disable the serial data output (SMR:SOE = 0), and enable the transmission operation (SCR:TXE = 1) and the reception operation (SCR:RXE = 1). Then, when you write a dummy data to TDR, the reception data is sampled in synchronization with the rising edge of the serial clock output (SCK). (2) Receiving the last bit sets RDRF bit in the serial status register (SSR) to "1". A reception interrupt request is also output when the reception interrupt is enabled (SCR:RIE = 1). At this point, the reception data (RDR) can be read. (3) If the reception data register (RDR) is read, the RDRF bit in the serial status register (SSR) is cleared to "0". CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 365 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.13 Operations of CSIO (Clock Synchronous Multi Function Serial Interface) MB91313A Series Notes: • If you want the reception operation only, write a dummy data to TDR in order to output the serial clock (SCK). • When the transmission and reception FIFO are enabled, setting the number of frames you want to transfer to the FIFO byte register (FBYTE) outputs the serial clock (SCK) of the desired number of frames. [2] Slave operation (SCR:MS = 1, SMR:SCKE = 0) • Transmission operation (1) Enable the serial data output (SMR:SOE = 1) and the transmission operation (SCR:TXE = 1). Then, when you write a transmission data to TDR, TDRE bit in the serial status register (SSR) becomes "0" to output the transmission data in synchronization with the falling edge of the serial clock (SCK) output. (2) When the 1st bit of the transmission data is output, TDRE bit in the serial status register (SSR) becomes "1". A transmission interrupt request is also output when the transmission interrupt is enabled (SCR:TIE = 1). At this point, 2nd byte of the transmission data can be written. • Reception operation (1) If you disable the serial data output (SMR:SOE = 0) and enable the reception operation (SCR:RXE = 1), the reception data is sampled in synchronization with the rising edge of the serial clock (SCK) input. (2) Receiving the last bit sets RDRF bit in the serial status register (SSR) to "1". A reception interrupt request is also output when the reception interrupt is enabled (SCR:RIE = 1). At this point, the reception data (RDR) can be read. (3) If the reception data register (RDR) is read, the RDRF bit in the serial status register (SSR) is cleared to "0". 366 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E MB91313A Series 15.14 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.14 CSIO Dedicated Baud Rate Generator CSIO Dedicated Baud Rate Generator The CSIO dedicated baud rate generator only functions in the master operation. However, if you use the reception FIFO, set the dedicated baud rate generator even in the slave operation. ■ CSIO (Clock Synchronous Multi Function Serial Interface) Baud Rate Selection The setting for the dedicated baud rate generator varies depending on the master operation and slave operation. ● Master operation Select the baud rate by dividing the internal clock by the dedicated baud rate generator. - There are 2 internal reload counters that correspond to transmission and reception serial clocks. Baud rate can be specified by setting the reload value for 15 bits with the baud rate generator registers 1, 0 (BGR1/BGR0). - The reload counter divides the internal clock by the set value. ● Slave operation The dedicated baud rate generator does not function in the slave operation (SCR:MS = 1). (The external clock input from the clock input pin SCK is directly used) Note: If you use the reception FIFO, set the dedicated baud rate generator even in the slave operation. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 367 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.14 CSIO Dedicated Baud Rate Generator 15.14.1 MB91313A Series Baud Rate Setting This section shows the setting for the baud rate. The calculation result of serial clock frequency is also described. ■ Calculating Baud Rate 2 of 15-bit reload counters are set using the baud rate generator registers 1, 0 (BGR1/BGR0). The equation to calculate the baud rate is shown below: (1) Reload value V = φ / b -1 V: Reload value, b: Baud rate, φ: Machine clock frequency (2) Example of calculation Where the machine clock is 16 MHz, the internal clock is enabled, and the baud rate is set to 19200 bps, the reload value is calculated as follows: Reload value: V = (16 × 1000000) / 19200 - 1 = 832 Therefore, the baud rate is: b = (16 × 1000000) / (832 + 1) = 19208 (bps) (3) Baud rate error Baud rate error can be calculated by the following equation: Error (%) = (calculated value - desired value) / desired value × 100 Ex.) Where the machine clock is 20 MHz and the desired baud rate is set to 153600 bps: Reload value = (20 × 1000000)/153600 - 1 = 129 Baud rate (calculated value) = (20 × 1000000)/(129+1) = 153846 (bps) Error (%) = (153846 - 153600)/153600 × 100 = 0.16 (%) Notes: • If the reload value is set to "0", the reload counter will stop. • If the reload value is an even number, "L" and "H" widths of the serial clock become as follows depending on the setting for SCINV bit:If it is an odd number, "H" and "L" widths of the serial clock have the same length. When SCINV = 0, "H" width of the serial clock is longer than "L" width by 1 cycle of the machine clock. When SCINV = 1, "L" width of the serial clock is longer than "H" width by 1 cycle of the machine clock. • Be sure to set the reload value to 3 or more. 368 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.14 CSIO Dedicated Baud Rate Generator MB91313A Series ■ Reload Value and Baud Rate for Each Machine Clock Frequency Table 15.14-1 Reload Value And Baud Rate Baud rate (bps) 8 MHz 10 MHz 16 MHz 20 MHz 24 MHz Value ERR Value ERR Value ERR Value ERR 8M - - - - - - - - 6M - - - - - - - - Value 32MHz ERR Value ERR - - 3 0 3 0 - - 5M - - - - - - 3 0 - - - - 4M - - - - 3 0 4 0 5 0 7 0 2.5 M - - 3 0 - - - - - - - - 2M 3 0 4 0 7 0 9 0 11 0 15 0 1M 7 0 9 0 15 0 19 0 23 0 31 0 500000 15 0 19 0 31 0 39 0 47 0 63 0 460800 - - - - - - - - 51 -0.16 - - 250000 31 0 39 0 63 0 79 0 95 0 127 0 230400 - - - - - - - - 103 -0.16 - - 153600 51 -0.16 64 -0.16 103 -0.16 129 -0.16 155 -0.16 207 -0.16 125000 63 0 79 0 127 0 159 0 191 0 255 0 115200 68 -0.64 86 0.22 138 0.08 173 0.22 207 -0.16 277 0.08 76800 103 -0.16 129 -0.16 207 -0.16 259 -0.16 311 -0.16 416 0.08 57600 138 0.08 173 0.22 277 0.08 346 -0.16 416 0.08 555 0.08 38400 207 -0.16 259 -0.16 416 0.08 520 0.03 624 0 832 -0.04 28800 277 0.08 346 <0.01 554 -0.01 693 -0.06 832 -0.03 1110 -0.01 19200 416 0.08 520 0.03 832 -0.03 1041 0.03 1249 0 1666 0.02 10417 767 <0.01 959 <0.01 1535 <0.01 1919 <0.01 2303 <0.01 3071 <0.01 9600 832 0.04 1041 0.03 1666 0.02 2083 0.03 2499 0 3332 -0.01 7200 1110 <0.01 1388 <0.01 2221 <0.01 2777 <0.01 3332 <0.01 4443 -0.01 4800 1666 0.02 2082 -0.02 3332 <0.01 4166 <0.01 4999 0 6666 <0.01 2400 3332 <0.01 4166 <0.01 6666 <0.01 8332 <0.01 9999 0 13332 <-0.01 1200 6666 <0.01 8334 0.02 13332 <0.01 16666 <0.01 19999 0 26666 <0.01 600 13332 <0.01 16666 <0.01 26666 <0.01 - - - - - - 300 26666 26666 <0.01 - - - - - - - - - • Value : Value set to BGR1/BGR0 registers • ERR : Baud rate error (%) CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 369 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.14 CSIO Dedicated Baud Rate Generator MB91313A Series ■ Functions of the Reload Counter The reload counter has the transmission and reception reload counters that function as the dedicated baud rate generator. The reload counter consists of 15-bit register and generates a transmission and reception clock from the internal clock. ■ Start of a Count The reload counter starts counting when a reload value is written in the baud rate generator registers 1, 0 (BGR1/BGR0). ■ Restart The reload counters can be restarted for the following conditions: ● For both transmission/reception reload counters Programmable reset (SCR: UPCL bit) 370 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.15 Setting Procedure and Program Flow for CSIO (Clock Synchronous Multi Function Serial Interface) MB91313A Series 15.15 Setting Procedure and Program Flow for CSIO (Clock Synchronous Multi Function Serial Interface) In CSIO (clock synchronous multi function serial interface), a synchronous serial bidirectional communication is available. ■ Inter-CPU Connection The bidirectional communication is selected in CSIO (clock synchronous multi function serial interface). As shown in Figure 15.15-1 CPUs are connected each other. Figure 15.15-1 Example of Bidirectional Communication Connection in CSIO (Clock Synchronous Multi Function Serial Interface) SOT SOT SIN SIN SCK SCK CPU–1 (Master) CPU–2 (Slave) ■ Flowchart ● Without FIFO Figure 15.15-2 Example of Bidirectional Communication Flowchart (Without FIFO) (Master side) (Slave side) Start Start Set the operating format Set operating format (coordinate with the master side) Transmit the data Set 1 byte data to TDR to communicate NO RDRF=1 YES NO RDRF=1 YES Read and process the reception data CM71-10143-5E Transmit the data (ANS) Read and process the reception data Transmit 1 byte data FUJITSU SEMICONDUCTOR LIMITED 371 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.15 Setting Procedure and Program Flow for CSIO (Clock Synchronous Multi Function Serial Interface) ● With FIFO MB91313A Series Figure 15.15-3 Example of Bidirectional Communication Flowchart (With FIFO) (Master side) (Slave side) Start Start Set the operating format Set operating format (coordinate with the master side) Enable the transmission and reception FIFO Enable the transmission and reception FIFO Specify the reception FBYTE Specify the reception FBYTE Set N byte to the transmission FIFO and write "0" to FDRQ bit Transmit the data RDRF=1 YES RDRF=1 YES Transmit the data (ANS) NO NO Read the data according to the value set to the FIFOBYTE and process it Set N byte to the transmission FIFO and write "0" to FDRQ bit Read the data according to the value set to the FBYTE and process it 372 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.16 Notes on CSIO Mode MB91313A Series 15.16 Notes on CSIO Mode The notes for when you use the CSIO mode are shown below. • FIFO cannot be used for requesting DMA transfer with a channel with FIFO. Please set as FIFO operation disable. • To request a DMA transfer request, set the block size of DMA to one time. • When master reception and slave reception are selected, it is required to use two channels for DMA; one is used for DMA transfer to receive data and the other one is used for DMA transfer to send dummy data. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 373 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.17 Overview of the I2C Interface 15.17 MB91313A Series Overview of the I2C Interface I2C interface that supports the Inter IC bus operates as the master/slave device on the I2C bus. In addition, it has the transmission/reception FIFO (Maximum 16-byte each). ■ Functions of the I2C Interface I2C interface has the following functions: • Master/slave transmission and reception function • Arbitration function • Clock synchronization function • Transfer direction detection function • Function that generates and detects a repetitive start condition • Bus error detection function • General call addressing function • 7-bit addressing as master and slave • Capable of generating an interrupt upon the transfer and bus error • 10-bit addressing function can be supported by program • Noise filter provided ■ Functions of FIFO FIFO has the following functions: • Transmission/reception FIFO provided (maximum size: transmission FIFO 16-byte, reception FIFO 16-byte) • Transmission FIFO and reception FIFO can be selected • Capable of retransmitting the transmission data • Reception FIFO interrupt timing can be changed from the software • Independent FIFO reset supported 374 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.18 Registers of the I2C Interface MB91313A Series Registers of the I2C Interface 15.18 This section shows the register list of I2C interface. ■ Register List of the I2C Interface Table 15.18-1 Register List of the I2C Interface Address 00X2H 00X1H IBCR bus control register) 00X3H SSR (serial status register) 00X4H 00X5H 00X6H 00X7H BGR1 (baud rate generator register 1) 00X9H ISMK (7-bit slave address mask register) 00X8H FIFO bit8 bit7 (I2C 00X0H I2C bit15 SMR (serial mode register) IBSR (I2C bus status register) RDR/TDR (transmission and reception data register) BGR0 (baud rate generator register 0) - IBSA (7-bit slave address register) 00YBH FCR1 (FIFO control register 1) 00YDH FBYTE2 (FIFO2 byte register) 00YAH 00YCH bit0 FCR0 (FIFO control register 0) FBYTE1 (FIFO1 byte register) (X = 06H, 07H, 08H, 09H, 0AH, 0BH, 1BH, 1CH, 1DH, 1EH, 1FH, Y = 06H, 07H, 08H) Table 15.18-2 Bit Arrangement of the I2C Interface bit15 bit14 bit13 bit11 bit10 bit9 bit8 bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 IBCR/ SMR MSS ACT/ SCC ACKE WSEL CNDE INTE BER INT MD2 MD1 MD0 - RIE TIE ITST1 ITST0 SSR/ IBSR REC TSET - - ORE RDRF TDRE - FBT RACK RSA TRX AL RSC SPC BB TDR1/ TDR0 - - - - - - - - D7 D6 D5 D4 D3 D2 D1 D0 BGR1/ BGR0 - B14 B13 B12 B11 B10 B9 B8 B7 B6 B5 B4 B3 B2 B1 B0 ISMK/ ISBA EN SM6 SM5 SM4 SM3 SM2 SM1 SM0 SAEN SA6 SA5 SA4 SA3 SA2 SA1 SA0 FDRQ FTIE FSEL - FLST FLD FSET FCL2 FCL1 FE2 FE1 FD10 FD9 FD8 FD7 FD6 FD5 FD4 FD3 FD2 FD1 FD0 FCR1/ FTST1 FTST0 FCR0 FBYTE2/ FD15 FBYTE1 FD14 CM71-10143-5E FD13 bit12 FLSTE FRIIE FD12 FD11 FUJITSU SEMICONDUCTOR LIMITED 375 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.18 Registers of the I2C Interface MB91313A Series I2C Bus Control Register (IBCR) 15.18.1 I2C bus control register (IBCR) can select master/slave mode, generate the repetitive start condition, enable the acknowledgment and interrupt, and display the interrupt flag. ■ I2C Bus Control Register (IBCR) Figure 15.18-1 shows the bit configuration of the I2C bus control register (IBCR), and Table 15.18-3 shows the function of each bit. Figure 15.18-1 Bit Configuration of I2C Bus Control Register (IBCR) IBCR bit ch.0 000060H ch.1 000070H ch.2 000080H 15 14 13 12 MSS ACT/SCC ACKE WSEL R/W R/W R/W R/W 11 10 9 8 Initial value CNDE INTE BER INT 00000000B R/W R/W R R/W INT 0 1 Interrupt flag bit Write Read Clears INT bit No interrupt request No effect Interrupt request BER 0 1 Bus error detection bit No error Detects error INTE 0 1 Interrupt enable bit Disables the interrupt Enables the interrupt CNDE 0 1 Condition detection interrupt enable bit Disables the interrupt of the repetitive start or stop condition Enables the interrupt of the repetitive start or stop condition WSEL Wait selection bit 0 Wait after acknowledgment (9-bit) 1 Wait after the data transmission and reception are completed (8-bit) ACKE 0 1 ACT/SCC 0 1 R/W : Readable/writable R : Read only Acknowledgment enable bit Disables acknowledgment Enables acknowledgment Operating flag/repetitive start condition generation bit Write No effect Read No operation Generates the repetitive start condition While I2C operating MSS 0 1 Master/slave selection bit Selects the slave mode Selects the master mode : Initial value 376 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.18 Registers of the I2C Interface MB91313A Series Table 15.18-3 Function Description of Each Bit in the I2C Bus Control Register (IBCR) (1 / 4) Bit name Function • If this bit is set to "1", the master mode is selected when I2C bus is in idle state (EN = 1, BB = 0). • If BB bit in the IBSR register is "1", generation of the start condition is waited until BB bit becomes "0" when "1" is set to this bit. While waiting, if it operates as a slave by matching the slave address, this bit becomes "0" and AL bit in the IBSR register becomes "1". • If the interrupt flag (INT) is "1" during the master operation (MSS = 1, ACT = 1), a stop condition is generated when "0" is written to this bit. MSS bit is cleared when: (1) I2C interface is disabled (EN bit = 0) (2) Arbitration lost is generated (3) Bus error is detected (BER bit = 1) (4) Write "0" to MSS bit when INT = 1. bit15 MSS: Master/slave selection bit The relationship between the MSS and ACT bits is shown below: MSS bit ACT bit State 0 0 Idle 0 1 ACK response* to the reserved address or the match with slave address, and slave operation is in progress (slave mode) 1 0 Waiting for master operation 1 1 Master operation is in progress (master mode) *: ACK response: Indicates that SDA in the I2C bus is "L" while the acknowledgment period. Notes: • If MSS bit is set to "1", change MSS bit to "0" when MSS bit is "1" and INT bit is "1". If "0" is written to MSS bit when ACT bit is "1", INT bit is also cleared to "0". • During master operation, "1" is read as long as ACT bit is "1", even if "0" is written to MSS bit. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 377 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.18 Registers of the I2C Interface MB91313A Series Table 15.18-3 Function Description of Each Bit in the I2C Bus Control Register (IBCR) (2 / 4) Bit name Function This bit has a different role when reading and writing. bit14 378 ACT/SCC: Operating flag/repetitive start condition generation bit Read Write ACT bit SCC bit ACT bit indicates that the IBCR register is operating as master or slave mode. Set conditions for ACT bit: (1) When the start condition is output to I2C bus (master mode) (2) When the slave address matches with the address transmitted from the master (slave mode) (3) When a reserved address is detected and an ACK response is performed to the address (slave mode is selected when MSS = 0) Reset conditions for ACT bit: <Master mode> (1) Stop condition detected (2) Arbitration lost detected (3) Bus error detection (4) I2C interface disabled (EN bit = 0) <Slave mode> (1) (Repetitive) start condition detected (2) Stop condition detected (3) When a reserved address is detected (RSA = 1) but an ACK response is not performed (4) I2C interface disabled (EN bit = 0) (5) Bus error generated (BER bit = 1) During master mode, a repetitive start is executed when "1" is written to this bit. Writing "0" to this bit is ignored. Notes: • Write "1" to SCC bit while master mode is interrupted (MSS = 1, ACT = 1, INT = 1). If ACT bit is "1", INT bit is cleared to "0" when "1" is written to SCC bit. • Writing "1" to this bit is disabled during slave mode (MSS = 0, ACT = 1). • If you write "1" to SCC bit and "0" to MSS bit, MSS bit is prioritized. • SCC bit is read by a read-modify-write (RMW) instruction. FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E MB91313A Series CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.18 Registers of the I2C Interface Table 15.18-3 Function Description of Each Bit in the I2C Bus Control Register (IBCR) (3 / 4) Bit name Function ACKE: Data byte acknowledgment enable bit • Setting this bit to "1" will output "L" at an acknowledgment timing. • If ACT = 1, change this bit when INT bit is "1". This bit becomes invalid when: (1) An acknowledgment is performed to an address field other than the reserved address (auto-generation) (2) Data is transmitted (RSA = 0, TRX = 1, FBT = 0) (3) ACK response is always performed when the reception FIFO and slave reception are enabled (FE = 1, MSS = 0, ACT = 1) (4) If WSEL bit is "0", and the reception FIFO and master reception are enabled (FE = 1, MSS = 1, ACT = 1, WSEL = 0), ACK response is performed when TDRE bit is "0" and NACK response is performed when TDRE bit is "1" (5) When the reception FIFO is enabled, WSEL = 0, a reserved address is detected, and slave transmission is enabled (RSA = 1, TRX = 1, FBT = 1), ACK response is always performed. If you want to perform NACK response, disables the reception FIFO and set ACKE bit to "0" when interrupting after a reserved address is detected. (5) The reception FIFO is enabled, WSEL bit is "1", master reception is enabled, and the transmission data register has data (FE = 1, MSS = 1, ACT = 1, WSEL = 1, TDRE = 0) bit12 WSEL: Wait selection bit • This bit generates an interrupt (INT = 1) either before or after the acknowledgment, and selects whether to have I2C bus waited. • WSEL bit becomes invalid when: (1) An interrupt for the 1st byte*1 is generated (INT = 1) (2) A reserved address is detected (FBT = 1, RSA = 1) (3) NACK respond*2 is detected while transmitting the data when FIFO is used (FE = 1, RACK = 1, ACT = 1) (4) Reception FIFO gets full when using the reception FIFO *1: 1st byte: Indicates the data after the (repetitive) start condition. *2: NACK response: Indicates that SDA in the I2C bus is "H" while the acknowledgment period. bit11 CNDE: Condition detection interrupt enable bit Enables the generation of an interrupt when the stop conditions or the repetitive start conditions are detected in master or slave mode (ACT = 1). An interrupt is generated when RSC or SPC bit in the I2C bus status register (IBSR) is "1" and also this bit is "1". bit10 INTE: Interrupt enable bit Enables an interrupt for the data transmission/reception and the bus error (INT = 0) when in master or slave mode. BER: Bus error detection bit Indicates that an error is detected on the I2C bus. Set conditions for BER bit: (1) A start or stop condition is detected while transmitting the 1st byte * (2) A (repetitive) start or stop condition is detected at 2nd to 9th bit (acknowledgment) of the data in the 2nd or subsequent byte Reset conditions for BER bit: (1) Write "0" to INT bit when BER = 1 (2) I2C interface disabled (EN = 0) *: 1st byte: Indicates the data after the (repetitive) start condition. Note: Check this bit when the interrupt flag (INT bit) becomes "1" so that you can implement appropriate measures including retransmission (if it is "1", data is not transmitted or received successfully). bit13 bit9 CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 379 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.18 Registers of the I2C Interface MB91313A Series Table 15.18-3 Function Description of Each Bit in the I2C Bus Control Register (IBCR) (4 / 4) bit8 380 Bit name Function INT: Interrupt flag bit Sets this flag to "1" when in master or slave mode, after 8 or 9 bit (ACK) of the data transmission/reception, or upon a bus error. When other than the bus error, SCL is set to "L" when INT = 1, and SCL released from "L" when INT = 0. Set conditions for INT bit: <8th bit> (1) The reserved address is detected with 1st byte (2) WSEL bit is "1" and an arbitration lost is detected in the 2nd or subsequent byte (3) WSEL bit is "1", and TDRE bit is "1" in the 2nd or subsequent byte during master operation (4) WSEL bit is "1", reception FIFO is disabled, and TDRE bit is "1" in the 2nd or subsequent byte during slave operation (5) WSEL bit is "1", and TDRE bit is "1" in the 2nd or subsequent byte during slave operation <9th bit> (1) An arbitration lost is detected with 1st byte (2) NACK is received when other than the stop condition output setting (writing "0" to MSS bit during master operation) (3) The reserved address is not detected with 1st byte, and TDRE bit is "1" in the transmission direction of master or slave mode (TRX = 1) (4) The reserved address is not detected with 1st byte, and reception FIFO has data in the reception direction of master or slave mode (TRX = 0) when the reception FIFO is enabled (5) The reserved address is not detected with 1st byte, and TDRE bit is "1" in the reception direction of master or slave mode (TRX = 0) when the reception FIFO is disabled (6) WSEL bit is set to "0" and an arbitration lost is detected in the 2nd or subsequent byte (7) WSEL bit is set to "0", and TDRE bit is "1" in the 2nd or subsequent byte during master operation (8) WSEL bit is set to "0", and TDRE bit is "1" in the 2nd or subsequent byte while slave transmission (9) WSEL bit is set to "0" and slave reception is enabled while reception FIFO is disabled. However, an interrupt is not generated at 9th bit in the slave reception with 1st byte that detects the reserved address (10)Reception FIFO gets full in the slave reception when the reception FIFO is enabled <Others> (1) Bus error detection Reset conditions for INT bit: (1) Writing "0" to INT bit (2) Writing "0" to MSS bit when INT = 1 and ACT = 1 (3) Writing "1" to SCC bit when INT = 1 and ACT = 1 Writing "1" to INT bit is ignored. Notes: • If you set EN bit to "0", RDRF and INT bits may become "1" depending on the reception timing. In this case, read the reception data to clear INT bit. • "1" is read by a read-modify-write (RMW) instruction. • If the reception FIFO is enabled, INT bit is not set to "1" even when the reception FIFO gets full by the master reception operation. FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.18 Registers of the I2C Interface MB91313A Series 15.18.2 Serial Mode Register (SMR) The serial mode register (SMR) is used to set the operating mode, enable/disable the transmission and reception interrupts. ■ Serial Mode Register (SMR) Figure 15.18-2 shows the bit configuration of the serial mode register (SMR), and Table 15.18-4 shows the function of each bit. Figure 15.18-2 Bit Configuration of Serial Mode Register (SMR) SMR bit 7 6 5 4 3 ch.0 000061H − MD2 MD1 MD0 RIE ch.1 000071H ch.2 000081H R/W R/W R/W R/W R/W ch.3 000091H ch.4 0000A1H ch.5 0000B1H ch.6 0001B1H ch.7 0001C1H ch.8 0001D1H ch.9 0001E1H ch.A 0001F1H 2 1 0 Initial value TIE ITST1 ITST0 000-0000B R/W R/W R/W ITST 0 1 I2C test bit Disables I2C test Enables I2C test TIE 0 1 Transmission interrupt enable bit Disables transmission interrupt Enables transmission interrupt RIE 0 1 Reception interrupt enable bit Disables reception interrupt Enables reception interrupt Unused bit Read value is undefined. Writing has no effect on operation. R/W : Readable/writable - : Unused : Initial value CM71-10143-5E MD2 MD1 MD0 Operating mode setting bits 0 0 0 Operating mode 0 (asynchronous normal mode) 0 0 1 Operating mode 1 (asynchronous multiprocessor mode) 0 1 0 Operating mode 2 (clock synchronous mode) 1 0 0 Operating mode 4 (I2C mode) (Note) This section explains the register and operation in the operating mode 4. FUJITSU SEMICONDUCTOR LIMITED 381 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.18 Registers of the I2C Interface MB91313A Series Table 15.18-4 Function Description of Each Bit in the Serial Mode Register (SMR) Bit name Function bit7 to bit5 MD2 to MD0: Operating mode setting bits Sets the operating mode. "000B": Sets to the operating mode 0 (asynchronous normal mode) "001B": Sets to the operating mode 1 (asynchronous multiprocessor mode) "010B": Sets to the operating mode 2 (clock synchronous mode) "100B": Sets to the operating mode 4 (I2C mode) Notes: • Any setting other than those above is disabled. • When switching the operating mode, disables I2C (ISMK:EN = 0) before switching it. • Set the operating mode, and then set each register. bit4 Unused bit When reading : Values are undefined. When writing : No effect. bit3 • Enables/disables the output of a reception interrupt request to the CPU. • A reception interrupt request is output when RIE bit and the reception data flag bit RIE: (RDRF) are "1" or when the error flag bit (ORE) is set to "1". Reception interrupt enable Note: bit If INT bit in the I2C bus control register (IBCR) is used to receive the data, set this bit to "0". bit2 TIE: Transmission interrupt enable bit • Enables/disables the output of a transmission interrupt request to the CPU. • A transmission interrupt request is output when TIE bit and the TDRE bit are "1". Note: If INT bit in the I2C bus control register (IBCR) is used to transmit the data, set this bit to "0". ITST1, ITST0: I2C test bits These are I2C test bits. Be sure to set these bits to "0". Note: If you set these bits to "1", the test for I2C will be executed. bit1, bit0 Note: Set the operating mode first because the other registers will be initialized once the operating mode has been changed. However, when IBCR and SMR are written at the same time by 16-bit writing, the written contents will be reflected on IBCR. 382 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.18 Registers of the I2C Interface MB91313A Series 15.18.3 Serial Status Register (SSR) The serial status register (SSR) is used to check transmission/reception status. ■ Serial Status Register (SSR) Figure 15.18-3 shows the bit configuration of the serial status register (SSR), and Table 15.18-5 shows the function of each bit. Figure 15.18-3 Bit Configuration of Serial Status Register (SSR) SSR bit 15 14 13 ch.0 000062H REC TSET ch.1 000072H ch.2 000082H R/W R/W ch.3 000092H ch.4 0000A2H ch.5 0000B2H ch.6 0001B2H ch.7 0001C2H ch.8 0001D2H ch.9 0001E2H ch.A 0001F2H 12 − − − − 11 10 9 ORE RDRF TDRE R R R 8 Initial value − 00--001-B − Unused bit Read value is undefined. Writing has no effect on operation. TDRE 0 1 Transmission data empty flag bit Transmission data register (TDR) has data Transmission data register is empty RDRF 0 1 Reception data full flag bit Reception data register (RDR) is empty Reception data register (RDR) has data ORE 0 1 Overrun error flag bit No overrun error There is an overrun error Unused bit Read values are undefined. Writing has no effect on operation. TSET 0 1 REC R/W : Readable/writable R : Read only : Unused 0 1 Transmission data empty flag set bit Write Read No effect Always read "0" TDRE bit set Reception error flag clear bit Write Read No effect Always read "0" Clears reception error flag (ORE) : Initial value CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 383 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.18 Registers of the I2C Interface MB91313A Series Table 15.18-5 Function Description of Each Bit in the Serial Status Register (SSR) (1 / 2) Bit name Function Clears ORE bit in the serial status register (SSR). • Writing "1" to this bit clears ORE bit. • Writing "0" has no effect. When reading, "0" is always read. bit15 REC: Reception error flag clear bit bit14 Sets TDRE bit in the serial status register (SSR). TSET: • Writing "1" to this bit sets TDRE bit. Transmission buffer empty • Writing "0" has no effect. flag set bit When reading, "0" is always read. bit13, Unused bits bit12 When reading : Values are undefined. When writing : No effect. • When an overrun error occurs while receiving, this bit is set to "1". When you write "1" to REC bit in the serial status register (SSR), this bit is cleared. • A reception interrupt request is output when ORE bit and RIE bit are "1". • Data in the reception data register (RDR) is invalid if this flag is set. • When this bit is set while using the reception FIFO, the reception data will not be stored into the reception FIFO. bit11 ORE: Overrun error flag bit bit10 • Indicates the status of the reception data register (RDR). • A reception interrupt request is output when the reception data flag (RDRF) bit and RIE bit are "1". • When the reception data is loaded to RDR, this bit is set to "1". If the reception data register (RDR) is read, this bit is cleared to "0". • This bit is set at SCL falling timing of 8th bit of the data. • This bit is also set by NACK response*. • When using the reception FIFO, RDRF is set to "1" if the reception FIFO has received a predefined number of data. RDRF: Reception data full flag bit • When using the reception FIFO, this bit is cleared to "0" if the reception FIFO gets empty. • When using the reception FIFO, if the reception idle state continues over 8 clocks of the reception baud rate clock (because the reception FIFO has not received a predefined number of data and some data still remains in the reception FIFO), RDRF is set to "1" when BER bit is "0". If you read the RDR while counting 8 clocks, the counter is reset to "0" and start counting 8 clocks all over again. *: NACK response: Indicates that SDA in the I2C bus is "H" while the acknowledgment period. 384 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E MB91313A Series CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.18 Registers of the I2C Interface Table 15.18-5 Function Description of Each Bit in the Serial Status Register (SSR) (2 / 2) Bit name Function bit9 TDRE: Transmission data empty flag bit • Indicates the status of the transmission data register (TDR). • A transmission interrupt request is output when TIE bit and the TDRE bit are "1". • When you write a transmission data to TDR, this bit becomes "0" to indicate that there is some valid data. When the data is loaded to the transmission shift register to start transmission, this bit becomes "1" to indicate that there is no valid data in TDR. • This bit is set when "1" is written to TSET bit in the serial status register (SSR). When an arbitration lost or bus error is detected, use this bit to set TDRE bit to "1". bit8 Unused bit When reading : Values is undefined. When writing : No effect. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 385 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.18 Registers of the I2C Interface 15.18.4 MB91313A Series I2C Bus Status Register (IBSR) I2C bus status register (IBSR) indicates that a repetitive start, acknowledgment, data direction, arbitration lost, stop condition, I2C bus state, and bus error are detected. ■ I2C Bus Status Register (IBSR) Figure 15.18-4 shows the bit configuration of the I2C bus status register (IBSR), and Table 15.18-6 shows the function of each bit. Figure 15.18-4 Bit Configuration of I2C Bus Status Register (IBSR) IBSR bit 7 6 5 ch.0 000063H RSA FBT RACK ch.1 000073H ch.2 000083H R R R ch.3 000093H ch.4 0000A3H ch.5 0000B3H ch.6 0001B3H ch.7 0001C3H ch.8 0001D3H ch.9 0001E3H ch.A 0001F3H 4 3 0 Initial value TRX AL RSC SPC BB 00000000B R R R/W R/W R 2 1 BB 0 1 SPC 0 1 R/W : Readable/writable R Bus state bit Bus idle state Bus transmission/reception state Stop condition verification bit Stop condition has not been detected Arbitration lost is generated when the stop Master condition is detected or output Slave Stop condition is detected RSC 0 1 Repetitive start condition verification bit Repititive start condition has not been detected Repititive start condition has been detected AL 0 1 Arbitration lost bit Arbitration lost is not generated Arbitration lost is generated TRX 0 1 Data direction bit Reception direction Transmission direction RSA 0 1 Reserved address detection bit Reserved address has not been detected Reserved address has been detected RACK 0 1 Acknowledgment flag bit "L" reception "H" reception FBT 0 1 First byte bit Other than first byte In transmitting or receiving first byte : Read only : Initial value 386 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E MB91313A Series CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.18 Registers of the I2C Interface Table 15.18-6 Function Description of Each Bit in the I2C Bus Status Register (IBSR) (1 / 3) Bit name bit7 bit6 bit5 Function FBT: First byte bit Indicates First byte. Set conditions for FBT bit: (1) (Repetitive) start condition is detected Clear conditions for FBT bit: (1) Transmission and reception of 2nd byte (2) Stop condition is detected (3) I2C interface is disabled (EN bit = 0) (4) Bus error is detected (BER bit = 1) RACK: Acknowledgment flag bit The acknowledgment received with First byte or when in master or slave mode is indicated in this bit. Update conditions for RACK bit (1) An acknowledgment when 1st byte (2) An acknowledgment when in master or slave mode Clear conditions for RACK bit (RACK = 0) (1) (Repetitive) start condition is detected (2) I2C interface is disabled (EN bit = 0) (3) Bus error is detected (BER bit = 1) RSA: Reserved address detection bit Indicates that a reserved address is detected. Set conditions for RSA bit (RSA = 1) (1) 1st byte is (0000xxxxB) or (1111xxxxB). "x" represents "0" or "1". Reset conditions for RSA bit (RSA = 0) (1) (Repetitive) start condition is detected (2) Stop condition is detected (3) I2C interface is disabled (EN bit = 0) (4) Bus error is detected (BER bit = 1) When RSA bit becomes "1" with 1st byte, the interrupt flag (INT) is set to "1" to specify SCL to "L" at the falling of SCL of the 8th bit in the 1st byte, regardless of whether FIFO is enabled or disabled. If you want to read the reception data to operate as a slave at this point, set ACKE to "1" to clear the interrupt flag (INT) to "0". Then, if TRX bit is "0", the data is received as a slave. If you do not want to have the data received, set ACKE bit to "0". Subsequent data will not be received. Notes: • If ACKE bit is set to "0" while transmitting the data, setting ACKE bit to "1" is disabled until a stop or a repetitive start condition is detected. • Upon the interrupt by detecting the reserved address, the verification of the slave transmission causes an ACK response when the reception FIFO is enabled, so disable the reception FIFO and set ACKE bit to "0". CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 387 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.18 Registers of the I2C Interface MB91313A Series Table 15.18-6 Function Description of Each Bit in the I2C Bus Status Register (IBSR) (2 / 3) bit4 bit3 bit2 388 Bit name Function TRX: Data direction bit Indicates the direction of the data. Set conditions for TRX bit: (1) Transmits a (repetitive) start condition in master mode (2) When 8th bit in 1st byte is "1" in slave mode (transmission direction as a slave) Reset conditions for TRX bit: (1) Arbitration lost is generated (AL = 1) (2) When 8th bit in 1st byte is "0" in slave mode (reception direction as a slave) (3) When 8th bit in 1st byte is "1" in master mode (reception direction as a master) (4) Stop condition is detected (5) (Repetitive) start condition is detected in other than master mode (6) I2C interface is disabled (EN bit = 0) (7) Bus error is detected (BER bit = 1) AL: Arbitration lost bit Indicates the arbitration lost. Set conditions for AL bit: (1) The output data and received data are different when in master mode (2) MSS bit is set to "1" but, the register is operating as a slave (3) A repetitive start condition is detected at 1st bit of the data in the 2nd or subsequent byte when in master mode (4) A stop condition is detected at 1st bit of the data in the 2nd or subsequent byte when in master mode (5) Trying to generate a (repetitive) start condition but cannot do so when in master mode (6) Trying to generate a stop condition but cannot do so when in master mode Reset conditions for AL bit: (1) Writing "1" to MSS bit (2) Writing "0" to INT bit (3) Writing "0" to SPC bit when AL bit = 1 and SPC bit = 1 (4) I2C interface is disabled (EN bit = 0) (5) Bus error is detected (BER bit = 1) RSC: Repetitive start condition verification bit Indicates that a repetitive start condition is detected when in master or slave mode. Set conditions for RSC bit: (1) A repetitive start condition is detected after the acknowledgment during the slave or master mode operation Reset conditions for RSC bit: (1) Writing "0" to RSC bit (2) Writing "1" to MSS bit (3) I2C interface is disabled (EN bit = 0) Writing "1" to this bit is ignored. Notes: • While the reception operation is in progress as slave mode by detecting the reserved address, if the ACK response is not performed, the slave mode is terminated so that this bit will not be set to "1" even when next repetitive start condition is detected. • "1" is read by a read-modify-write (RMW) instruction. FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E MB91313A Series CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.18 Registers of the I2C Interface Table 15.18-6 Function Description of Each Bit in the I2C Bus Status Register (IBSR) (3 / 3) Bit name bit1 bit0 Function Indicates that a stop condition is detected when in master or slave mode. Set conditions for SPC bit: (1) A stop condition is detected during the slave or master mode operation (2) An arbitration lost is generated by the operation to generate a stop condition when in master mode Reset conditions for SPC bit: SPC: (1) Writing "0" to this bit Stop condition verification (2) Writing "1" to MSS bit bit (3) I2C interface is disabled (EN bit = 0) Writing "1" to this bit is ignored. Notes: • While the reception operation is in progress as slave mode by detecting the reserved address, if the ACK response is not performed, the slave mode is terminated so that this bit will not be set to "1" even when next stop condition is detected. • "1" is read by a read-modify-write (RMW) instruction. BB: Bus state bit CM71-10143-5E Indicates the state of the bus. Set conditions for BB bit: (1) "L" is detected in SDA or SCL in the I2C bus Reset conditions for BB bit: (1) Stop condition is detected (2) I2C interface is disabled (EN bit = 0) (3) Bus error is detected (BER bit = 1) FUJITSU SEMICONDUCTOR LIMITED 389 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.18 Registers of the I2C Interface 15.18.5 MB91313A Series Reception/Transmission Data Registers (RDR/TDR) Reception/transmission data registers are arranged in the same address. When reading, it functions as the reception data register and when writing, it functions as the transmission data register. ■ Reception Data Register (RDR) Figure 15.18-5 shows the bit configuration of the reception data register (RDR). Figure 15.18-5 Bit Configuration of the Reception Data Register (RDR) RDR ch.0 000064H ch.2 000084H ch.4 0000A4H ch.6 0001B4H ch.8 0001D4H ch.A 0001F4H R: Read only ch.1 ch.3 ch.5 ch.7 ch.9 000074H bit15........... 000094H 0000B4H 0001C4H 0001E4H 7 D7 6 D6 5 D5 4 D4 3 D3 2 D2 1 D1 0 Initial value D0 00000000B R R R R R R R R Reception data register (RDR) is a data buffer register for serial data reception. • A serial data signal transmitted to the serial data line (SDA pin) is converted at the shift register and then stored in this reception data register (RDR). • When 1st byte* is received, the lowest bit (RDR:D0) becomes the data direction bit. • When the received data is stored in the reception data register (RDR), the reception data full flag bit (SSR:RDRF) is set to "1". • If the reception data register (RDR) is read, the reception data full flag bit (SSR:RDRF) is automatically cleared to "0". *: 1st byte: Indicates the data after the (repetitive) start condition. Notes: • When using the reception FIFO, RDRF is set to "1" if the reception FIFO has received a predefined number of data. • When using the reception FIFO, RDRF is cleared to "0" if the reception FIFO gets empty. 390 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.18 Registers of the I2C Interface MB91313A Series ■ Transmission Data Register (TDR) Figure 15.18-6 shows the bit configuration of the transmission data register (TDR). Figure 15.18-6 Bit Configuration of the Transmission Data Register (TDR) TDR ch.0 000064H ch.2 000084H ch.4 0000A4H ch.6 0001B4H ch.8 0001D4H ch.A 0001F4H W: Write only ch.1 ch.3 ch.5 ch.7 ch.9 000074H bit15........... 000094H 0000B4H 0001C4H 0001E4H 7 D7 6 D6 5 D5 4 D4 3 D3 2 D2 1 D1 0 Initial value D0 11111111B W W W W W W W W Transmission data register (TDR) is a data buffer register for serial data transmission. • Data is output to the serial data line (SDA pin) by MSB first of the value in the transmission data register (TDR). • When 1st byte is transmitted, the lowest bit (TDR:D0) becomes the data direction bit. • A transmission data empty flag (SSR:TDRE) is cleared to "0" when the transmission data is written into the transmission data register (TDR). • Once the data is transferred to the transmission shift register, the transmission data empty flag (SSR:TDRE) bit is set to "1". • Write next transmission data when: • Interrupt flag (INT bit) is "1" • Bus error is not generated (BER bit = 0) • Acknowledgment performs ACK response (receive "0" as an acknowledgment) • If the transmission FIFO is disabled, you cannot write the transmission data to the transmission data register (TDR) when the data empty flag (SSR:TDRE) is "0". • If the transmission FIFO is used, you can write the transmission data up to the size of the transmission FIFO even when the data empty flag (SSR:TDRE) is "0". Note: The transmission data register (TDR) is a write only register and the reception data register (RDR) is a read only register. These registers are located at the same address, so the read value is different from the write value. Therefore an instruction that operates read-modify-write (RMW) instruction, such as INC/DEC, cannot be used. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 391 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.18 Registers of the I2C Interface MB91313A Series Baud Rate Generator Registers 1, 0 (BGR1/BGR0) 15.18.6 The baud rate generator registers 1, 0 (BGR1/BGR0) sets the division ratio for the serial clock. ■ Bit Configuration of Baud Rate Generator Registers 1, 0 (BGR1/BGR0) Figure 15.18-7 shows the bit configuration of the baud rate generator registers 1, 0 (BGR1/BGR0). Figure 15.18-7 Bit Configuration of Baud Rate Generator Registers 1, 0 (BGR1/BGR0) BGR bit ch.0 000066H ch.1 000076H ch.2 000086H ch.3 000096H ch.4 0000A6H ch.5 0000B6H ch.6 0001B6H ch.7 0001C6H ch.8 0001D6H ch.9 0001E6H ch.A 0001F6H 15 − (−) 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 Initial value B14 B13 B12 B11 B10 B9 B8 B7 B6 B5 B4 B3 B2 B1 B0 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 -0000000B 00000000B BGR0 Write Read Baud rate generator register 0 Writes to the reload counter bits 0 to 7 Reads the value set to BGR0 BGR1 Write Read Baud rate generator register 1 Writes to the reload counter bits 8 to 14 Reads the value set to BGR1 Unused bit Read value is undefined. Writing has no effect on operation. R/W: Readable/writable -: Unused The baud rate generator registers (BGR) set the division ratio for the serial clock. BGR1 (supports the upper bits) and BGR0 (supports the lower bits) can write the reload value to count and read the value set to BGR1/BGR0. The reload counter starts counting when a reload value is written in the baud rate generator registers 1, 0 (BGR1/BGR0). Notes: • Write to the baud rate generator registers 1, 0 (BGR1/BGR0) by 16-bit access. • Set the baud rate generator registers when EN bit in the ISMK register is "0". • Baud rate should be set regardless of master or slave mode. • In operating mode 4 (I2C mode), the machine clock should be used for 8 MHz or more and setting over 400 kbps to the baud rate generator is disabled. 392 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.18 Registers of the I2C Interface MB91313A Series 15.18.7 7-bit Slave Address Mask Register (ISMK) 7-bit slave address mask register (ISMK) is used to compare or set each bit in the slave address. ■ 7-bit Slave Address Mask Register (ISMK) Figure 15.18-8 shows the bit configuration of the 7-bit slave address register (ISMK), and Table 15.18-7 shows the function of each bit. Figure 15.18-8 Bit Configuration of 7-bit Slave Mask Register (ISMK) ISMK bit ch.0 000068H ch.1 000078H ch.2 000088H ch.3 000098H ch.4 0000A8H ch.5 0000B8H ch.6 0001B8H ch.7 0001C8H ch.8 0001D8H ch.9 0001E8H ch.A 0001F8H R/W 15 EN R/W 14 13 12 11 10 9 8 Initial value SM6 SM5 SM4 SM3 SM2 SM1 SM0 01111111B R/W R/W R/W R/W : Readable/writable R/W R/W R/W SM6 to SM0 0 1 7-bit slave address mask bits Doesn't compare each bit Compares each bit EN 0 1 I2C interface enable bit Disable Enable : Initial value Table 15.18-7 Function Description of Each Bit in the 7-bit Slave Mask Register (ISMK) Bit name bit15 bit14 to bit8 Function EN: I2C interface enable bit Enables/disables the operation of the I2C interface. When "0" is set: Disables the operation of the I2C interface. When "1" is set: Enables the operation of the I2C interface. Notes: • This bit is not cleared to "0" even if BER bit in the I2C bus status register (IBSR) is set to "1". • Set the baud rate generator when this bit is set to "0". • Set the 7-bit slave address and 7-bit slave mask registers when this bit is set to "0". • If EN bit is set to "0" while transmitting, a pulse can be generated in SDA/SCL in the I2C bus. • If FIFO is enabled, disable the FIFO then write "0" to EN bit. SM6 to SM0: Slave address mask bits Specifies whether 7-bit slave address and the received address should be the subject of comparison or not. The bit set to "1": Compares The bit set to "0": Processed as if they match Note: Set this register when EN bit is "0". CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 393 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.18 Registers of the I2C Interface 15.18.8 MB91313A Series 7-bit Slave Address Register (ISBA) 7-bit slave address register (ISBA) is used to set the slave address. ■ 7-bit Slave Address Register (ISBA) Figure 15.18-9 shows the bit configuration of the 7-bit slave address register (ISBA), and Table 15.18-8 shows the function of each bit. Figure 15.18-9 Bit Configuration of 7-bit Slave Address Register (ISBA) ISBA bit 7 6 5 4 3 2 1 0 Initial value ch.0 000069H ch.1 000079H SAEN SA6 SA5 SA4 SA3 SA2 SA1 SA0 00000000B ch.2 000089H R/W R/W R/W R/W R/W R/W R/W R/W ch.3 000099H ch.4 0000A9H ch.5 0000B9H ch.6 0001B9H ch.7 0001C9H SA ch.8 0001D9H ch.9 0001E9H 6 to 0 ch.A 0001F9H R/W : Readable/writable : Initial value Slave address setting bits 7-bit slave addresses SAEN 0 1 Slave address enable bit Disable Enable Table 15.18-8 Function Description of Each Bit in the 7-bit Slave Address Register (ISBA) Bit name bit7 bit6 to bit0 394 Function SAEN: Slave address enable bit Enables the detection of the slave address. When "0" is set: Does not detect the slave address. When "1" is set: Compares between the setting of ISBA and ISMK and 1st byte of the received data. SA6 to SA0: 7-bit slave addresses • If the detection of the slave address is enabled (SAEN = 1), 7-bit slave address register (ISBA) compares with the 7-bit of data received after the (repetitive) start condition is detected. If they match each other, this register operates as slave mode and outputs an ACK. At this point, the received slave address is set to this register (ACK is not output when SAEN = 0). • The address bit of which ISMK register is set to "0" is not the subject of comparison. Notes: • Setting the reserved address is disabled. • Set this register when EN bit in the ISMK register is "0". FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.18 Registers of the I2C Interface MB91313A Series 15.18.9 FIFO Control Register 1 (FCR1) FIFO control register 1 (FCR1) sets the test for FIFO, specifies the transmission/ reception FIFO, enables the transmission FIFO interrupt, and controls the interrupt flag. ■ Bit Configuration of FIFO Control Register 1 (FCR1) Figure 15.18-10 shows the bit configuration of the FIFO control register 1 (FCR1), and Table 15.18-9 shows the function of each bit. Figure 15.18-10 Bit Configuration of FIFO Control Register 1 (FCR1) FCR1 bit 15 14 ch.0 00006AH FTST1 FTST0 ch.1 00007AH ch.2 00008AH R/W R/W 13 − (−) 12 11 10 9 FLSTE FRIIE FDRQ FTIE R/W R/W R/W R/W 8 FSEL Initial value 00-00100B R/W FSEL FIFO selection bit 0 1 Transmission FIFO: FIFO1, Reception FIFO: FIFO2 Transmission FIFO: FIFO2, Reception FIFO: FIFO1 FTIE 0 1 Transmission FIFO interrupt enable bit Disables the transmission FIFO interrupt Enables the transmission FIFO interrupt FDRQ 0 1 Transmission FIFO data request bit Does not request the transmission FIFO data Requests the transmission FIFO data FRIIE 0 1 Reception FIFO idle detection enable bit Disables the reception FIFO idle detection Enables the reception FIFO idle detection FLSTE 0 1 Retransmission data lost detection enable bit Disables the data lost detection Enables the data lost detection Unused bit Read value is undefined. Writing has no effect on operation. R/W - : Readable/writable : Unused FTST1, 0 00B Other than 00B FIFO test bits Disables FIFO test Prohibited setting : Initial value CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 395 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.18 Registers of the I2C Interface MB91313A Series Table 15.18-9 Function Description of Each Bit in the FIFO Control Register 1 (FCR1) Bit name Function bit15, FTST1, FTST0: bit14 FIFO test bits These are the test bits for FIFO. Be sure to set these bits to "0". Note: If you set these bits to "1", the test for FIFO will be executed. bit13 Unused bit When reading : Values is undefined. When writing : No effect. bit12 FLSTE: Retransmission data lost detection enable bit Enables data lost detection. When "0" is set: Disables data lost detection. When "1" is set: Enables data lost detection. Note: When you set this bit to "1", set FSET bit to "1" before doing so. bit11 FRIIE: Reception FIFO idle detection enable bit Unused bit Specifies whether to detect the reception idle state that continues over 8-bit time with the reception FIFO holding valid data. If the reception interrupt is enabled (SMR:RIE = 1), a reception interrupt occurs when the reception idle state is detected. When "0" is set: Disables the reception idle state detection. When "1" is set: Enables the reception idle state detection. bit10 FDRQ: Transmission FIFO data request bit This is a data request bit for the transmission FIFO. When this bit is set to "1", it indicates that the transmission data is being requested. A transmission FIFO interrupt request is output when this bit is "1" and the transmission interrupt is enabled (FTIE = 1). FDRQ set condition • FBYTE (for transmission) = 0 (transmission FIFO is empty) • Reset the transmission FIFO FDRQ reset condition • Writing "0" to this bit • The transmission FIFO gets full Notes: • When FBYTE (for transmission) = 0, writing "0" to this bit is disabled. • When this bit is set to "0", change of FSEL bit is disabled. • Setting "1" to this bit has no effect on the operations. • "1" is read by a read-modify-write (RMW) instruction. bit9 FTIE: Transmission FIFO interrupt enable bit This is an interrupt enable bit for the transmission FIFO. If this bit is set to "1", an interrupt occurs when FDRQ bit is "1". FSEL: FIFO selection bit Selects the transmission/reception FIFO. When "0" is set: Assigns the transmission FIFO:FIFO1 and the reception FIFO:FIFO2. When "1" is set: Assigns the transmission FIFO:FIFO2 and the reception FIFO:FIFO1. Notes: • This bit cannot be cleared by the FIFO reset (FCL2, FCL1 = 1). • When you want to change this bit, disable FIFO operation (FE2, FE1 = 0) and any transmission/reception (TXE = RXE = 0) first. bit8 396 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.18 Registers of the I2C Interface MB91313A Series 15.18.10 FIFO Control Register 0 (FCR0) FIFO control register 0 (FCR0) enables/disables FIFO operation, performs FIFO reset, saves the read pointer, and sets the retransmission. ■ Bit Configuration of FIFO Control Register 0 (FCR0) Figure 15.18-11 shows the bit configuration of the FIFO control register 0 (FCR0), and Table 15.18-10 shows the function of each bit. Figure 15.18-11 Bit Configuration of FIFO Control Register 0 (FCR0) FCR0 bit ch.0 00006BH ch.1 00007BH ch.2 00008BH 7 − (−) 6 5 4 3 2 1 0 FLST FLD FSET FCL2 FCL1 FE2 R R/W R/W R/W R/W R/W R/W FE1 0 1 FIFO1 operation enable bit Disables FIFO1 operation Enables FIFO0 operation FE2 0 1 FIFO2 operation enable bit Disables FIFO2 operation Enables FIFO2 operation FCL1 0 1 FCL2 0 1 R/W : Readable/writable : Read only R : Unused : Initial value CM71-10143-5E Initial value FE1 00000000B FIFO1 reset bit Write No effect FIFO1 reset Read Always read "0" FIFO2 reset bit Write No effect FIFO2 reset Read Always read "0" FSET 0 1 FIFO pointer save bit Does not save Executes save FLD 0 1 FIFO pointer reload bit Does not reload Executes reload FLST 0 1 FIFO retransmission data lost flag bit Disables the data lost Enables the data lost Unused bit When reading, "0" is always read. When writing, "0" is always written. FUJITSU SEMICONDUCTOR LIMITED 397 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.18 Registers of the I2C Interface MB91313A Series Table 15.18-10 Function Description of Each Bit in the FIFO Control Register 0 (FCR0) (1 / 2) Bit name Function Unused bit When reading : "0" is always read. When writing : Always write "0". FLST: FIFO retransmission data lost flag bit Indicates that retransmission data of the transmission FIFO has been lost. FLST set condition • Writing to FIFO when FLSTE bit in the FIFO control register 1 (FCR1) is "1" and also the write pointer of the transmission FIFO and the read pointer saved by FSET bit match each other. FLST reset condition • FIFO reset (writing "1" into FCL) • When writing "1" to FSET bit Setting this bit to "1" overwrites the data indicated by the read pointer saved with FSET bit, therefore FLD bit cannot set the retransmission when an error occurs. If you retransmit with this bit set to "1", perform FIFO reset and write the data again into FIFO. bit5 FLD: FIFO pointer reload bit Reloads the data saved to the transmission FIFO by FSET bit to the read pointer. This bit is used for the retransmission due to a communication error. When a retransmission setting is completed, this bit becomes "0". Notes: • As long as this bit is set to "1", this bit is reloading to the read pointer. Therefore, do not write anything other than FIFO reset. • Setting this bit to "1" is disabled while transmitting or being in FIFO enabled state. • Set TIE bit to "0", and then write "1" into this bit. After you enabled the transmission FIFO, set TIE bit to "1". bit4 Saves the read pointer of the transmission FIFO. Once you save the read pointer before communication, when FLST bit is "0" it is possible to retransmit in the case a communication error. FSET: When "1" is set: Retains the current value set to the read pointer. FIFO pointer save bit When "0" is set: No effect. Note: Set this bit to "1" when the number of bytes for transmission (FBYTE) indicates "0". bit3 FCL2: FIFO2 reset bit Resets FIFO2. If you set this bit to "1", the internal state of FIFO2 is initialized. Only the FLST bit in the FIFO control register 0 (FCR0) is initialized and the other bits in the FCR1/FCR0 registers remain unchanged. Notes: • Disables FIFO2 before performing FIFO2 reset. • Set the transmission FIFO interrupt enable bit to "0" first. • The number of the valid data in the FBYTE2 register becomes "0". FCL1: FIFO1 reset bit Resets FIFO1. If you set this bit to "1", the internal state of FIFO1 is initialized. Only the FLST bit in the FIFO control register 0 (FCR0) is initialized and the other bits in the FCR1/FCR0 registers remain unchanged. Notes: • Disables FIFO1 before performing FIFO1 reset. • Set the transmission FIFO interrupt enable bit to "0" first. • The number of the valid data in the FBYTE1 register becomes "0". bit7 bit6 bit2 398 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E MB91313A Series CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.18 Registers of the I2C Interface Table 15.18-10 Function Description of Each Bit in the FIFO Control Register 0 (FCR0) (2 / 2) Bit name bit1 bit0 Function FE2: FIFO2 operation enable bit Enables/disables the operation of FIFO2. • When using FIFO2, set this bit to "1". • When specified as a reception FIFO by FSEL bit, a reception error clears this bit to "0". You cannot set this bit to "1" until the reception error is cleared. • If using as the transmission FIFO, set "1" or "0" to this bit when the transmission data is empty (TDRE = 1). If using as the reception FIFO, set "1" or "0" to this bit when the reception data is empty (RDRF = 0). • Even if FIFO2 is disabled, the state of FIFO2 is still retained. Notes: • Enable/disable the operation when BB bit is "0" or INT bit is "1". • When specified as a reception FIFO, the reserved address is detected, and it operates as a slave transmission, set this bit to "0" with the interrupt generated by detecting the reserved address and ACKE to "0". • If the RDRF bit in SSR is set to "1" when the device is used as the reception FIFO and this bit is switched from "1" to "0", the reception FIFO will not be disabled until the RDRF bit is set to "0". • To switch this bit from "0" to "1", set the TIE bit to "0" first, write "1" to this bit and then set the TIE bit to "1", when the device is used as the transmission FIFO and FIFO2 contains data. FE1: FIFO1 operation enable bit Enables/disables the operation of FIFO1. • When using FIFO1, set this bit to "1". • When specified as a reception FIFO by FSEL bit, a reception error clears this bit to "0". You cannot set this bit to "1" until the reception error is cleared. • If using as the transmission FIFO, set "1" or "0" to this bit when the transmission data is empty (TDRE = 1). If using as the reception FIFO, set "1" or "0" to this bit when the reception data is empty (RDRF = 0). • Even if FIFO1 is disabled, the state of FIFO1 is still retained. Notes: • Enable/disable the operation when BB bit is "0" or INT bit is "1". • When specified as a reception FIFO, the reserved address is detected, and it operates as a slave transmission, set this bit to "0" with the interrupt generated by detecting the reserved address and ACKE to "0". • If the RDRF bit in SSR is set to "1" when the device is used as the reception FIFO and this bit is switched from "1" to "0", the reception FIFO will not be disabled until the RDRF bit is set to "0". • To switch this bit from "0" to "1", set the TIE bit to "0" first, write "1" to this bit and then set the TIE bit to "1", when the device is used as the transmission FIFO and FIFO1 contains data. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 399 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.18 Registers of the I2C Interface MB91313A Series 15.18.11 FIFO Byte Register (FBYTE) FIFO byte register (FBYTE) indicates the number of valid data for FIFO. In addition, it can specify whether to generate a reception interrupt when the predefined number of data has been received at the reception FIFO. ■ Bit Configuration of FIFO Byte Register (FBYTE) Figure 15.18-12 shows the bit configuration of the FIFO byte register (FBYTE). Figure 15.18-12 Bit Configuration of FIFO Byte Register (FBYTE) FBYTE bit 15 14 13 12 11 10 9 ch.0 00006CH ch.1 00007CH FD15 FD14 FD13 FD12 FD11 FD10 FD9 ch.2 00008CH R/W R/W R/W R/W R/W R/W R/W 8 7 6 5 4 3 2 1 FD8 FD7 FD8 FD5 FD4 FD3 FD2 FD1 R/W R/W R/W R/W R/W R/W R/W R/W Initial value 0 FD0 00000000B 00000000B R/W FBYTE1 Write Read FIFO1 data number display bit Sets the transfer count Reads the number of valid data FBYTE2 Write Read FIFO2 data number display bit Sets the transfer count Reads the number of valid data R/W: Readable/writable Read (number of valid data) When transmitting: The number of data that are written into FIFO and have not transmitted yet. When receiving: The number of data that are received at FIFO. Write (transfer count) When transmitting: Sets "00H". When receiving: Sets the number of data that generates a reception interrupt. FIFO byte register (FBYTE) indicates the number of valid data of FIFO. The number varies as follows, depending on the setting of FSEL bit in the FCR1 register. Table 15.18-11 The Number of Data Displayed FSEL FIFO selection The number of data displayed 0 FIFO2: Reception FIFO, FIFO1: Transmission FIFO FIFO2: FBYTE2, FIFO1: FBYTE1 1 FIFO2: Transmission FIFO, FIFO1: Reception FIFO FIFO2: FBYTE2, FIFO1: FBYTE1 • The initial value of the transfer count of the FIFO byte register (FBYTE) is "08H". • Set the number of data to generate a reception interrupt flag to the FBYTE in the reception FIFO. An interrupt flag (RDRF) is set to "1" when the defined transfer count matches with the number of data displayed in the FIFO byte register (FBYTE). 400 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E MB91313A Series CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.18 Registers of the I2C Interface • If the reception FIFO idle detection enable bit (FRIIE) is "1" and the number of data that exists in the reception FIFO has not reached the transfer count, the interrupt flag (RDRF) is set to "1" when the reception idle state continues over 8 clocks of the baud rate clock. If you read the RDR while counting 8 clocks, the counter is reset to "0" and start counting 8 clocks all over again. The counter is reset to "0" when the reception FIFO is disabled. When the reception FIFO that has still some data is enabled, it starts counting all over again. • To receive the data with the master operation (master reception), set TIE bit to "0", specify the number of data to receive in the FIFO byte register (FBYTE) of the transmission FIFO, and write "0" to FDRQ bit. The specified number of data for SCL clocks are output, and then INT bit becomes "1". If you want to set TIE bit to "1", wait until FDRQ bit becomes "1". Notes: • In the master operation, set "00H" to FBYTE of the transmission FIFO except that data is received. • When receiving data with the master operation, set the number of transmission data when the transmission FIFO is empty and also TIE bit is set to "0". • If you want to disable the I2C interface (EN = 0) while receiving the data with the master operation, disable the transmission and reception FIFO before disabling the interface. • Set a data more than "1" to the FBYTE in the reception FIFO. • Disable the transmission and reception before you change the setting. • You cannot use any read-modify-write (RMW) instruction to this register. • The setting that exceeds the FIFO size is disabled. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 401 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.19 Interrupts of the I2C Interface 15.19 MB91313A Series Interrupts of the I2C Interface An interrupt request of the I2C interface can be generated by the following sources: • After 1st byte/data is transmitted and received • Stop conditions • Repetitive start conditions • FIFO transmission data request • FIFO reception data is completed ■ Interrupts of the I2C Interface Table 15.19-1 shows the I2C interface interrupt control bit and the interrupt source. 402 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.19 Interrupts of the I2C Interface MB91313A Series Table 15.19-1 I2C Interface Interrupt Control Bit and Interrupt Source Interrupt type Interrupt Flag request flag register bit Interrupt source Interrupt source enable bit How to clear the interrupt request flag After 1st byte is transmitted and received*1 After the data is transmitted and received*1 Write "0" to the interrupt flag bit (IBCR:INT) Bus error has been detected INT IBCR Arbitration lost has been detected IBCR:INTE The value set to FBYTE is received Read the reception data (RDR) until the reception FIFO gets empty, and then write "0" to the interrupt flag bit (IBCR:INT) The reception idle state that continues over 8-bit time has been detected with the reception FIFO holding valid data when FRIIE bit is "1" Reception Reserved address has been detected RDRF SSR Read reception data (RDR) After the data is received The value set to FBYTE is received SMR:RIE Read reception data (RDR) until the reception FIFO gets empty ORE SSR Overrun error Write "1" to the reception error flag bit (SSR:REC) SPC IBSR Stop conditions Write "0" to the stop condition detection bit IBCR:CNDE RSC IBSR Write "0" to the repetitive start detection flag bit (IBSR:RSC) Repetitive start conditions Transmission register is empty TDRE SSR FDRQ FCR1 Transmission "1" is written to the transmission buffer empty flag set bit (SSR:TSET) SMR:TIE Write to the transmission data (TDR), or write "1" to the transmission FIFO operation enable bit when it is "0" and the transmission FIFO has a valid data (retransmission)*2 Transmission FIFO is empty FCR1:FTIE Write "0" to the FIFO transmission data request bit, or the transmission FIFO is full *1: If normal data can be transmitted and received and TDRE bit is "0", no interrupt is generated. This is because the DMA transfer is supported. If you want INT flag to be generated on the data transmission/reception, TDRE bit must be "1" before the timing when the INT flag is set. *2: Set TIE bit to "1" after TDRE bit has become "0". CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 403 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.20 Operations of I2C Interface Communication 15.20 MB91313A Series Operations of I2C Interface Communication I2C interface uses 2 bidirectional bus lines, the serial data line (SDA) and the serial clock line (SCL), for communication. ■ I2C Bus Start Condition The figure below shows the start condition for I2C bus. Figure 15.20-1 Start Condition SDA SCL Start condition ■ I2C Bus Stop Condition The figure below shows the stop condition for I2C bus. Figure 15.20-2 Stop Condition SDA SCL Stop condition ■ I2C Bus Repetitive Start Condition The figure below shows the repetitive start condition for I2C bus. Figure 15.20-3 Repetitive Start Condition SDA SCL ACK Repetitive start condition 404 FUJITSU SEMICONDUCTOR LIMITED ACK: Acknowledgment CM71-10143-5E CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.20 Operations of I2C Interface Communication MB91313A Series 15.20.1 Master Mode Master mode gets I2C bus to generate a start condition and outputs the clock to I2C bus. If I2C bus is in the idle state (SCL = "H", SDA =" H"), the master mode is selected when "1" is set to MSS bit in the IBCR register, and ACT bit in the IBCR register becomes "1". ■ Generation of the Start Condition A start condition is output under the following condition: When SDA = "H", SCL = "H", EN = 1, and BB = 0, ACT bit is set to "1" if "1" is written to MSS bit and a start condition is output to I2C bus. Then, once the start condition is received, BB bit is set to "1", indicating that I2C bus is on the communication (See, Figure 15.20-4). Figure 15.20-4 Relationship Between Start Condition and Each Bit Start condition SDA A6 A5 SCL 1 2 BB bit MSS bit Writing "1" ACT bit TRX bit FBT bit TDRE bit Note: In operating mode 4 (I2C mode), the machine clock should be used for 8 MHz or more and setting over 400 kbps to the baud rate generator is disabled. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 405 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.20 Operations of I2C Interface Communication MB91313A Series ■ Slave Address Output When the start condition is output, the data set in the TDR register is output from bit7 as the address. If FIFO is enabled, the first data written to TDR is output. bit0 is used as the data direction bit (R/W). When the data direction bit (R/W) is "0", the data indicates the write direction (master → slave). Set the address for the TDR register before "1" is written to MSS or SCC. Figure 15.20-5 and Figure 15.20-6 show the output timing of the address and data direction. Figure 15.20-5 Address and Data Direction (When FIFO is Disabled) 1 2 3 4 5 6 7 8 SCL SDA A6(D7) A5(D6) A4(D5) A3(D4) A2(D3) A1(D2) A0(D1) R/W(D0) ACK BB bit MSS bit* TDRE bit INT bit <Reserved address is detected> RSA bit RDRF bit INT bit SCL is "L" as long as INT is "1" A6 to A0: Address D7 to D0: TDR register bit R/W: Data direction ("L": write direction) ACK: Acknowledgment ("L": acknowledgment, output from slave) *: Set the address for the TDR register before "1" is written to MSS bit. 406 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.20 Operations of I2C Interface Communication MB91313A Series Figure 15.20-6 Address and Data Direction (When Transmission/Reception FIFO are Enabled) 1 2 3 4 5 6 7 8 SCL SDA A6(D7) A5(D6) A4(D5) A3(D4) A2(D3) A1(D2) A0(D1) R/W(D0) ACK BB bit MSS bit*1 INT bit*2 <Reserved address is detected> RSA bit RDRF bit INT bit A6 to A0: Address SCL is "L" as long as INT is "1" D7 to D0: TDR register bit R/W: Data direction ("L": write direction) ACK: Acknowledgment ("L": acknowledgment, output from slave) *1: Set the address for the TDR register before "1" is written to MSS bit. *2: When acknowledgment is "L", R/W = "L", and transmission FIFO has data, or when acknowledgment is "L", R/W = "H", and reception FIFO has no data, INT bit doesn't become "1". CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 407 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.20 Operations of I2C Interface Communication MB91313A Series ■ Acknowledgment Reception by Transmitting First Byte When the data direction bit (R/W) is output, I2C interface receives the acknowledgment from the slave. The table below shows the operation when FIFO is enabled and when FIFO is disabled. Table 15.20-1 Operation after Acknowledgment is Received (RSA bit = 0) Transmission FIFO Reception FIFO State of the transmission FIFO State of the reception FIFO Data direction bit (R/W) 0 Disable Disable - 1 No data 0 Disable Enable - Disable - 408 INT bit is set to "1" and wait. INT bit is set to "1" and wait when TDRE bit is "1". INT bit remains "0" and no wait when TDRE bit is "0". - 1 - 0 - INT bit is set to "1" and wait when TDRE bit is "1". INT bit remains "0" and no wait when TDRE bit is "0". INT bit is set to "1" and wait when TDRE bit is "1". INT bit remains "0" and no wait when TDRE bit is "0". No data Enable Acknowledgment is NACK INT bit is set to "1" and wait. 1 Enable Acknowledgment is ACK There is data 0 Enable Operation right after the acknowledgment is received INT bit is set to "1" and wait when TDRE bit is "1". INT bit remains "0" and no wait when TDRE bit is "0". INT bit is set to "1" and wait. INT bit is set to "1" and wait when TDRE bit is "1". INT bit remains "0" and no wait when TDRE bit is "0". There is data INT bit is set to "1" and wait. - INT bit is set to "1" and wait when TDRE bit is "1". INT bit remains "0" and no wait when TDRE bit is "0". 1 INT bit is set to "1" and wait. FUJITSU SEMICONDUCTOR LIMITED INT bit is set to "1" and wait. CM71-10143-5E MB91313A Series CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.20 Operations of I2C Interface Communication ● FIFO disabled (both transmission and reception FIFOs are disabled) • When RSA bit is "0", the interrupt flag bit (INT) is set to "1" and SCL is retained as "L" to wait if TDRE bit is "1" after the acknowledgment is received. To release the wait, write "0" to the interrupt flag. If TDRE bit is "0", the clock is generated to SCL instead of setting "1" to the interrupt flag when ACK is received. • When RSA bit is "1", the interrupt flag bit (INT) is set to "1" and SCL is retained as "L" to wait after the reserved address is received (before the acknowledgment). After RDR register is read, the interrupt flag becomes "0" to release the wait when you set ACKE bit and the transmission data, and write "0" to the interrupt flag. • The received acknowledgment is set to RACK bit. If you check the RACK bit during the wait and it is NACK, write "0" to MSS bit or "1" to SCC bit in order to generate a stop or repetitive start condition. At this point, INT bit is automatically cleared to "0". ● FIFO enabled • FIFO should be set as follows before "1" is set to MSS bit. - When transmitting to slave (data direction bit = 0), data including slave address should be set to the transmission FIFO - When receiving data from slave (data direction bit = 1), specify the number of data to be received to the FIFO byte count register, and write to the transmission data register using slave address, data direction bit, and the number of dummy data that you want to receive. • When RSA bit is "0", the data is transmitted and received according to the data direction bit, instead of setting the interrupt flag bit (INT) to "1" after the acknowledgment is received and it is ACK (no wait). If it is NACK, the interrupt flag bit (INT) is set to "1" and SCL is retained as "L" to wait. • The received acknowledgment is stored to RACK bit. If you check the RACK bit during the wait and it is NACK, write "0" to MSS bit or "1" to SCC bit in order to generate a stop or repetitive start condition. At this point, INT bit is automatically cleared to "0". CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 409 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.20 Operations of I2C Interface Communication MB91313A Series Figure 15.20-7 Acknowledgment (When FIFO is Disabled, RSA = 0, and ACK Response) "L" because of INT bit Data SCL SDA R/W ACK Writing "0" INT bit RACK bit FBT bit Write to TDR register TDRE bit The wait for the address is generated: • After the reception of the acknowledgment when RSA bit is "0" • Before the reception of the acknowledgment when RSA bit is "1" These are independent of the WSEL setting. Figure 15.20-8 Acknowledgment (When FIFO is Disabled, RSA = 0, and NACK Response) "L" because of INT bit SCL SDA R/W NACK Writing "0" Stop condition INT bit MSS bit RACK bit FBT bit 410 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.20 Operations of I2C Interface Communication MB91313A Series Figure 15.20-9 Acknowledgment (When FIFO is Disabled, RSA = 1, and ACK Response) "L" because of INT bit Data SCL SDA R/W ACK Writing "0" INT bit RACK bit FBT bit RSA bit Reading the RDR register RDRF bit Figure 15.20-10 Acknowledgment (When FIFO is Disabled, RSA = 1, and NACK Response) "L" because of INT bit SCL SDA R/W NACK Writing "0" Stop condition INT bit MSS bit RACK bit FBT bit RSA bit Reading the RDR register RDRF bit CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 411 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.20 Operations of I2C Interface Communication MB91313A Series Figure 15.20-11 Acknowledgment (When FIFO is Enabled, Transmission FIFO Has Data, Reception FIFO Has No Data, RSA = 0, and ACK Response) Data SCL SDA R/W ACK INT bit RACK bit FBT bit TDRE bit ■ Data Transmission by Master When the data direction bit (R/W) is "0", data is transmitted from the master. Slave responds ACK or NACK on every 1 byte transmission. The wait is generated at the following point depending on the setting for WSEL bit: Table 15.20-2 WSEL Bit When Transmitting Master Data WSEL bit Operation 0 In the 2nd or subsequent byte, the interrupt flag bit (INT) is set to "0" and SCL is set to "L" to go into the wait state when TDRE bit is "1" or after the acknowledgment on the arbitration lost detection. The interrupt flag bit (INT) is set to "1" to go into the wait state after the acknowledgment if FIFO is enabled, or after the acknowledgment when the arbitration lost is detected or the transmission data register has no longer valid data (TDRE = 1). 1 In the 2nd or subsequent byte, the interrupt flag bit (INT) is set to "1" and SCL is set to "L" to go into the wait state when TDRE bit is "1" or after the master transmitted 1 byte data on the arbitration lost detection. The interrupt flag bit (INT) is set to "1" to go into the wait state after the data is transmitted when the arbitration lost is detected or the transmission data register has no longer valid data (TDRE = 1), if FIFO is enabled. However, the interrupt flag (INT) is set after the acknowledgment regardless of the WSEL setting in the following case: 412 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.20 Operations of I2C Interface Communication MB91313A Series NACK is received other than when the stop conditions are set (MSS = 0, ACT= 1) An example of procedure to transmit the data to the slave is described below: ● When transmitting to other than the reserved address • When the transmission FIFO is disabled (1) Set the slave address (including the data direction bit) to the TDR register, and write "1" to MSS bit. (2) After the slave address is transmitted, ACK is received and the interrupt flag (INT) becomes "1". (3) Write the data to transmit to the TDR register. (4) Write "0" to the interrupt flag (INT) together with the update of WSEL bit to release the wait of I2C bus. (5) Put the I2C bus in a wait by setting the interrupt flag to "1", after receiving an acknowledge upon the transmission of one byte when WSEL is set to "0", or immediately after one byte has been transmitted when WSEL is set to "1". Repeat (2) to (4) until the predefined number of data is transmitted. However, another interrupt occurs upon the reception of an acknowledge, causing the bus to wait, when a NACK is received after the wait is cancelled with WSEL set to "1". (6) Set MSS bit to "0" or SCC bit to "1" to generate a stop or repetitive start condition. • When the transmission FIFO is enabled (1) Write the slave address (including the data direction bit) and the transmission data to the TDR register. (2) Write "1" to MSS bit along with setting up WSEL bit. (3) Set the interrupt flag bit (INT) to "1" to wait the I2C bus right after the NACK is received during transmission. Set the interrupt flag to "1" to wait the I2C bus according to the setting for WSEL after the last byte is transmitted when all ACK responses are received. (4) Generate a stop condition by writing "0" to MSS bit. ● When transmitting to the reserved address • When the transmission FIFO is disabled (1) Set the reserved address as a slave address to the TDR register, and write "1" to MSS bit. (2) Once the slave address is transmitted, the interrupt flag (INT) becomes "1". (3) Read the RDR register and verify the reserved address.* (4) Write the data to transmit to the TDR register. (5) Write "0" to the interrupt flag (INT) together with the update of WSEL bit to release the wait of I2C bus. (6) Put the I2C bus in a wait by setting the interrupt flag to "1", after receiving an acknowledge upon the transmission of one byte when WSEL is set to "0", or immediately after one byte has been transmitted when WSEL is set to "1". Repeat (4) to (6) until the predefined number of data is transmitted. However, another interrupt occurs upon the reception of an acknowledge, causing the bus to wait, when a NACK is received after the wait is cancelled with WSEL set to "1". (7) Set MSS bit to "0" or SCC bit to "1" to generate a stop or repetitive start condition. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 413 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.20 Operations of I2C Interface Communication MB91313A Series • When the transmission FIFO is enabled (1) Set the reserved address as a slave address to the TDR register, and write "1" to MSS bit. (2) Once the slave address is transmitted, the interrupt flag (INT) becomes "1". (3) Read the RDR register and verify the reserved address.* (4) Write all transmission data to the TDR register (until the transmission FIFO gets full, if possible). (5) Set the interrupt flag bit (INT) to "1" to wait the I2C bus right after the NACK is received during transmission. Set the interrupt flag to "1" to wait the I2C bus according to the setting for WSEL after the last byte is transmitted when all ACK responses are received. (6) Set MSS bit to "0" or SCC bit to "1" to generate a stop or repetitive start condition. *: Set ACKE and WSEL bits to "1" to verify whether to operate as a master or a slave on next data if an arbitration lost is generated and there is a possibility to operate as a slave when the reserved address is a general call in the multi-master. Notes: • Change IBCR register during transmission and reception, when the interrupt flag (INT) is "1". • WSEL bit is changed, which is used as a generation condition of an interrupt flag (INT) for next data. • If the transmission data is written to the TDR register when transmitting the data (TDRE = 1) and the ACK response is detected, the interrupt flag (INT) will not become "1" and the written data is transmitted instead. • If the transmission data is written to the TDR register when transmitting the data (TDRE = 1) and the ACK response is detected, the interrupt flag (INT) will not become "1" and only RDRF becomes "1" instead (if the number of data set to the FBYTE register are received when the reception FIFO is enabled). 414 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.20 Operations of I2C Interface Communication MB91313A Series Figure 15.20-12 Interrupt of Master by Disabling FIFO (1) (WSEL = 0, RSA = 0) S Slave Address W ACK Data ACK (1) Data ACK (2) Data ACK P or Sr (2) (3) S : Start condition W : Data direction bit (Write direction) P : Stop condition Sr : Repetitive start condition : Interrupt because of INTE = 1 : Interrupt because of CNDE = 1 (1) An interrupt generated by slave address transmission + direction bit transmission + acknowledgment reception - Write INT = 0 after the transmission data is written to TDR register (2) An interrupt generated by 1 byte transmission + acknowledgment reception - Write INT = 0 after the transmission data is written to TDR register (3) An interrupt generated by 1 byte transmission + acknowledgment reception - Set MSS = 0 or MSS = 1 and SCC = 1 (Note) TDRE bit is "1" upon the generation of the interrupt flag (INT) Figure 15.20-13 Interrupt of Master Transmission by Disabling FIFO (2) (WSEL = 1, RSA = 0, ACK Response) S Slave Address W ACK (1) Data ACK (2) Data ACK (2) Data ACK P or Sr (3) S : Start condition W : Data direction bit (Write direction) P : Stop condition Sr : Repetitive start condition : Interrupt because of INTE = 1 : Interrupt because of CNDE = 1 (1) An interrupt generated by slave address transmission + direction bit transmission + acknowledgment reception - Write INT = 0 after the transmission data is written to TDR register (2) An interrupt generated by 1 byte transmission - Write INT = 0 after the transmission data is written to TDR register (3) An interrupt generated by 1 byte transmission - Set MSS = 0 or MSS = 1 and SCC = 1 (Note) TDRE bit is "1" upon the generation of the interrupt flag (INT) CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 415 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.20 Operations of I2C Interface Communication MB91313A Series Figure 15.20-14 Interrupt of Master Transmission by Disabling FIFO (3) (WSEL = 1, RSA = 0, NACK Response) S Slave Address W ACK Data (1) ACK Data (2) ACK Data (2) NACK P or Sr (3) S : Start condition W : Data direction bit (Write direction) P : Stop condition Sr : Repetitive start condition : Interrupt because of INTE = 1 : Interrupt because of CNDE = 1 (1) An interrupt generated by slave address transmission + direction bit transmission + acknowledgment reception - Write INT = 0 after the transmission data is written to TDR register (2) An interrupt generated by 1 byte transmission - Write INT = 0 after the transmission data is written to TDR register (3) An interrupt generated by 1 byte transmission - Set MSS = 0 or MSS = 1 and SCC = 1 (Note) TDRE bit is "1" upon the generation of the interrupt flag (INT) Figure 15.20-15 Interrupt of Master Transmission by Disabling FIFO (4) (WSEL = 1, RSA = 0, Halfway NACK Response) S Slave Address W ACK (1) Data ACK (2) Data ACK (2) Data NACK P or Sr (2) (3) S : Start condition W : Data direction bit (Write direction) P : Stop condition Sr : Repetitive start condition : Interrupt because of INTE = 1 : Interrupt because of CNDE = 1 (1) An interrupt generated by slave address transmission + direction bit transmission + acknowledgment reception - Write INT = 0 after the transmission data is written to TDR register (2) An interrupt generated by 1 byte transmission - Write INT = 0 after the transmission data is written to TDR register (3) An interrupt generated by NACK response - Set MSS = 0 or MSS = 1 and SCC = 1 (Note) TDRE bit is "1" upon the generation of the interrupt flag (INT) 416 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.20 Operations of I2C Interface Communication MB91313A Series Figure 15.20-16 Interrupt of Master Transmission by Disabling FIFO (5) (WSEL = 1 → 0, RSA = 0, ACK Response) S Slave Address W ACK Data (1) Data ACK (2) ACK Data (2) ACK P or Sr (3) S : Start condition W : Data direction bit (Write direction) P : Stop condition Sr : Repetitive start condition : Interrupt because of INTE = 1 : Interrupt because of CNDE = 1 (1) An interrupt generated by slave address transmission + direction bit transmission + acknowledgment reception - Write INT = 0 after the transmission data is written to the transmission buffer (2) An interrupt generated by 1 byte transmission - Write INT = 0 and WSEL = 0 after the transmission data is written to the transmission buffer (3) An interrupt generated by 1 byte transmission - Set MSS = 0 or MSS = 1 and SCC = 1 (Note) TDRE bit is "1" upon the generation of the interrupt flag (INT) Figure 15.20-17 Interrupt of Master by Disabling FIFO (6) (WSEL = 0, RSA = 1) S Slave Address W ACK (1) Data ACK (2) Data ACK Data ACK P or Sr (2) (3) S : Start condition W : Data direction bit (Write direction) P : Stop condition Sr : Repetitive start condition : Interrupt because of INTE = 1 : Interrupt because of CNDE = 1 (1) An interrupt generated by slave address (reserved address) transmission + direction bit transmission + acknowledgment reception - Write INT = 0 after the transmission data is written to TDR register (2) An interrupt generated by 1 byte transmission + acknowledgment reception - Write INT = 0 after the transmission data is written to TDR register (3) An interrupt generated by 1 byte transmission + acknowledgment reception - Set MSS = 0 or MSS = 1 and SCC = 1 (Note) TDRE bit is "1" upon the generation of the interrupt flag (INT) CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 417 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.20 Operations of I2C Interface Communication MB91313A Series Figure 15.20-18 Interrupt of Master Transmission by Enabling FIFO (7) (WSEL = 0, RSA = 0, ACK Response) S Slave Address W ACK Data ACK Data ACK Data ACK P or Sr (1) (2) S : Start condition W : Data direction bit (Write direction) P : Stop condition Sr : Repetitive start condition : Interrupt because of INTE = 1 : Interrupt because of CNDE = 1 (1) An interrupt generated because the transmission FIFO is empty - Write INT = 0 after the transmission data is written to the transmission FIFO (2) An interrupt generated by the last byte transmission (transmission FIFO is empty) + acknowledgment reception - Set MSS = 0 or MSS = 1 and SCC = 1 Figure 15.20-19 Interrupt of Master Transmission by Enabling FIFO (8) (WSEL = 1, RSA = 0) S Slave Address W ACK Data ACK Data ACK (1) Data ACK P or Sr (2) S : Start condition W : Data direction bit (Write direction) P : Stop condition Sr : Repetitive start condition : Interrupt because of INTE = 1 : Interrupt because of CNDE = 1 (1) An interrupt generated because the transmission FIFO is empty - Write INT = 0 after the transmission data is written to the transmission FIFO (2) An interrupt generated by the last byte transmission (transmission FIFO is empty) - Set MSS = 0 or MSS = 1 and SCC = 1 418 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.20 Operations of I2C Interface Communication MB91313A Series Figure 15.20-20 Interrupt of Master Transmission by Enabling FIFO (9) (WSEL = 1, RSA = 0, NACK Response) S Slave Address W ACK Data ACK Data ACK Data NACK (1) P or Sr (2) S : Start condition W : Data direction bit (Write direction) P : Stop condition Sr : Repetitive start condition : Interrupt because of INTE = 1 : Interrupt because of CNDE = 1 (1) An interrupt generated because the transmission FIFO is empty - Write INT = 0 after the transmission data is written to the transmission FIFO (2) An interrupt generated by NACK response - Set MSS = 0 or MSS = 1 and SCC = 1 CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 419 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.20 Operations of I2C Interface Communication MB91313A Series ■ Data Reception by Master When the data direction bit (R/W) is "1", the data transmitted from the slave is received. When FIFO is disabled, master generates a wait every 1 byte received (INT = 1, RDRF = 1) if TDRE bit is "1", and performs ACK or NACK response with the setting for ACKE bit in the IBCR register according to WSEL bit. If TDRE bit is "0", next data is received instead of generating a wait (INT = 0) when ACK response is performed with the setting for ACKE bit in the IBCR register, or a wait is generated when NACK response is performed (INT = 1). When FIFO is enabled, RDRF bit is set once the same number of bytes as the defined number of reception byte is received. Set the interrupt flag when TDRE bit is "1" to wait the I2C bus. NACK response is performed to set the interrupt flag to "1" when TDRE bit becomes "1" if WSEL = 0. When WSEL = 1, a wait is generated after the last byte is received. Set ACKE bit during the wait, and then ACK or NACK response is performed according to the setting for ACKE bit once the interrupt flag is cleared to "0". The data is stored to the reception FIFO as the reception data even if NACK is output. See the table below about the wait generated by the interrupt: Table 15.20-3 WSEL Bit When Receiving Master Data WSEL bit Operation 0 In the 2nd or subsequent byte, the interrupt flag bit (INT) is set to "1" and SCL is set to "L" to go into the wait state after the acknowledgment when TDRE bit is "1". 1 In the 2nd or subsequent byte, the interrupt flag bit (INT) is set to "1" and SCL is set to "L" to go into the wait state after the master received 1 byte data when TDRE bit is "1 An example of procedure to receive the data from the slave is described below: • When the reception FIFO is disabled (1) Set the slave address (including the data direction bit) to the TDR register, and write "1" to MSS bit. (2) After the slave address is transmitted, ACK is received and the interrupt flag (INT) becomes "1". (3) Write "0" to the interrupt flag bit (INT) together with the update of WSEL bit to release the wait of I2C bus. (4) Put the I2C bus in a wait by setting the interrupt flag to "1", after transmitting an acknowledge upon the reception of one byte when WSEL is set to "0", or immediately after one byte has been received when WSEL is set to "1". Repeat (2) to (4) until the predefined number of data is received. (5) Output NACK and set MSS bit to "0" or SCC bit to "1" to generate a stop or repetitive start condition after the last data is received. 420 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.20 Operations of I2C Interface Communication MB91313A Series • When the transmission and reception FIFO is enabled (1) Write the slave address (including the data direction bit) to the TDR register. (2) Set the number of data to be received to the FBYTE register. (3) Write "1" to MSS bit. (4) ACK response is performed and receiving is continued as long as TDRE bit is "0". RDRF becomes "1" once the amount of data predefined to the FBYTE is received during this receiving period. RDR register is read when RDRF bit becomes "1". (5) Set the interrupt flag to "1" to wait the I2C bus after NACK is output when WSEL = 0, or right after 1st byte is received when WSEL = 0 once TDRE bit becomes "1". (6) Set MSS bit to "0" or SCC bit to "1" to generate a stop or repetitive start condition after ACKE bit is set to "0" when WSEL = 1, or regardless of the setting for ACKE bit when WSEL = 0. Notes: • When TDRE bit is "0", even if an overrun error is generated, the acknowledgment is output according to the setting for ACKE bit and the following processes are executed: • Change IBCR register during transmission and reception, when the interrupt flag (INT) is "1". • The interrupt flag (INT) remains "0" and next data is received when a dummy data is written to the TDR register and TDRE bit is "0" at the timing when the interrupt flag (INT) becomes "1" in master reception. • If data is received when the reception FIFO is enabled and WSEL = 0, RDRF bit becomes "1" after the last bit is received and the interrupt flag (INT) becomes "1" after ACK is transmitted. Figure 15.20-21 Interrupt of Master Reception by Disabling FIFO (1) (WSEL = 0, RSA = 0) S Slave Address R ACK Data ACK (1) Data ACK Data (2) NACK P or Sr (3) : Interrupt because of INTE = 1 : Interrupt because of CNDE = 1 (1) An interrupt generated by slave address transmission + direction bit transmission + acknowledgment reception - Interrupt is cleared to "0" by writing INT = 0 (2) An interrupt generated by 1 byte reception + acknowledgment transmission - Set ACKE = 0 and then write INT = 0 after the reception data is read (3) An interrupt generated by 1 byte reception + acknowledgment transmission - Set MSS = 0 or MSS = 1 and SCC = 1 (Note) TDRE bit is "1" upon the generation of the interrupt flag (INT) CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 421 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.20 Operations of I2C Interface Communication MB91313A Series Figure 15.20-22 Interrupt of Master Reception by Disabling FIFO (2) (WSEL = 1, RSA = 0) S Slave Address R ACK Data (1) ACK Data (2) ACK Data (2) P or Sr NACK (3) : Interrupt because of INTE = 1 : Interrupt because of CNDE = 1 (1) An interrupt generated by slave address transmission + direction bit transmission + acknowledgment reception - Interrupt is cleared to "0" by writing INT = 0 (2) An interrupt generated by 1 byte reception - Write INT = 0 after the reception data is read (3) An interrupt generated by 1 byte reception - Set ACKE = 0 and MSS = 0, or MSS = 1, SCC = 1 after reception data is read (Note) TDRE bit is "1" upon the generation of the interrupt flag (INT) Figure 15.20-23 Interrupt of Master Reception by Enabling FIFO (3) (WSEL = 0, ACKE=0, RSA = 0) S Slave Address R ACK Data ACK Data ACK Data NACK P or Sr (1) : Interrupt because of INTE = 1 : Interrupt because of CNDE = 1 (1) An interrupt generated by TDRE = 1 - Set MSS = 0, or MSS = 1 and SCC = 1 after all data is read from the reception FIFO Figure 15.20-24 Interrupt of Master Reception by Enabling FIFO (4) (WSEL = 1, RSA = 0) S Slave Address R ACK Data ACK Data ACK Data NACK P or Sr (1) : Interrupt because of INTE = 1 : Interrupt because of CNDE = 1 (1) An interrupt generated by TDRE = 1 - Set ACKE = 0 and MSS = 0, or MSS = 1 and SCC = 1 after all data is read from the reception FIFO 422 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.20 Operations of I2C Interface Communication MB91313A Series ■ Arbitration Lost When a master receives the different data than the transmitted data due to a collision of data from another master, which is recognized as arbitration lost, and the master becomes available to operate as slave mode, setting MSS bit to "0" and AL bit to "1". AL bit is cleared to "0" when: • "1" is written to MSS bit • "0" is written to INT bit • "0" is written to SPC bit when AL bit = 1 and SPC bit = 1 • I2C interface is disabled (EN bit = 0) When the arbitration lost is generated, the interrupt flag (INT) is set to "1" and the SCL of I2C bus to "L" according to the setting for WSEL. ■ Wait of the Master Mode When BB bit is "1" and MSS bit is set to "1", if the slave mode is not operated, wait the master mode as long as the BB bit is "1". The start condition is transmitted when BB bit becomes "0". You can judge whether the master mode is in wait state or not using MSS and ACT bits (in wait state if MSS = 1 and ACT = 0). To operate as the slave mode after MSS bit is set to "1", set AL and ACT bits to "1" and MSS bit to "0". CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 423 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.20 Operations of I2C Interface Communication 15.20.2 MB91313A Series Slave Mode Slave mode is used to detect the (repetitive) start condition. When the combination of ISBA and ISMK registers matches with received address, ACK response is performed and the slave mode is enabled. ■ Slave Address Match Detection When the (repetitive) start condition is detected, 7-bit of next data is received as the address. ISBA register and each bit of the received address are compared about the bit where "1" is set in the ISMK register, and if they are matched, ACK is output. Table 15.20-4 Operation Right After Acknowledgment is Output for Slave Address Transmission FIFO Reception FIFO State of the transmission FIFO State of the reception FIFO Operation right after the acknowledgment Data direction bit (R/W) 0 Disable Disable - 1 No data 0 Disable Enable Disable 424 Enable INT bit is set to "1" and wait when TDRE bit is "1". INT bit remains "0" and no wait when TDRE bit is "0". INT bit remains "0" and no wait. INT bit remains "0" and no wait. There is data INT bit is set to "1" and wait. - TINT bit is set to "1" and wait when TDRE bit is "1". INT bit remains "0" and no wait when TDRE bit is "0". 1 1 INT bit is set to "1" and wait when TDRE bit is "1". INT bit remains "0" and no wait when TDRE bit is "0". - 0 INT bit remains "0" and no wait. - No data Enable Acknowledgment is NACK - 0 Enable Acknowledgment is ACK There is data INT bit is set to "1" and wait. - INT bit is set to "1" and wait when TDRE bit is "1". INT bit remains "0" and no wait when TDRE bit is "0". 1 FUJITSU SEMICONDUCTOR LIMITED INT bit remains "0" and no wait. INT bit remains "0" and no wait. INT bit remains "0" and no wait. CM71-10143-5E CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.20 Operations of I2C Interface Communication MB91313A Series • Reserved address detection If 1st byte matches with the reserved address ("0000XXXXB" or "1111XXXXB"), INT bit is set to "1" to wait I2C bus after the data in 8th bit is received whichever the transmission and reception FIFO is enabled or not. If you want to read the reception data to operate as a slave at this point, set ACKE to "1" to clear INT bit to "0". Then, it operates as a slave. If ACKE is "0", it does not operate as slave after the acknowledgment is output. ■ Data Direction Bit After the address is received, the data direction bit is received that decides the transmission and reception of the data. When this bit is set to "0", it indicates the transmission from the master, and the data is received as a slave. ■ Reception by Slave When the slave address matches and the data direction bit is "0", which indicates the reception by the slave mode. An example of procedure to receive data by the slave mode is described below: • When the reception FIFO is disabled (1) After ACK is transmitted, set the interrupt flag bit (INT) to "1" to wait the I2C bus. When recognized as an interrupt generated by the match of the salve address using MSS, ACT, and FBT bits, 1 is written to the ACKE bit and "0" is written to the interrupt flag (INT) to release the wait of I2C bus (See, Table 15.20-4). (2) After 1 byte data is received, the interrupt flag (INT) is set to "1" to wait the I2C bus according to the setting for WSEL. (3) After the received data is read from the RDR register and ACKE bit is set, "0" is written to the interrupt flag (INT) to release the wait of I2C bus. (4) (2) to (3) are repeated until a stop or repetitive start condition is detected. • When the reception FIFO is enabled (1) The interrupt flag bit (INT) becomes "1" to wait the I2C bus when the NACK is detected or the reception FIFO gets full. When a stop or repetitive start condition is detected, SPC and RSC bits are set to "1" instead of the interrupt flag bit (INT) (no wait of I2C bus). The reception FIFO sets RDRF bit to "1" when the number of received data reaches the value set to FIFO byte register (FBYTE). If RIE bit is "1" at this point, a reception interrupt occurs. (2) When the interrupt flag (INT) becomes "1", the received data is read from the RDR register. Once all the data is read, "0" is written to the interrupt flag to release the wait of I2C bus. When a stop or repetitive start condition is detected, all the received data is read from the RDR register to clear SPC or RSC bit to "0". CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 425 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.20 Operations of I2C Interface Communication MB91313A Series Figure 15.20-25 Interrupt of Slave Reception by Disabling FIFO (1) (WSEL = 0, RSA = 0) S Slave Address W ACK Data ACK (1) Data ACK (2) Data NACK P or Sr (3) (2) : Interrupt because of INTE = 1 : Interrupt because of CNDE = 1 (1) An interrupt generated by ACK output due to the match with the slave address - Write ACKE = 1 and INT = 0 (2) An interrupt generated by 1 byte reception + ACK response - Write INT = 0 after the reception data is read from the reception buffer (3) An interrupt generated by 1 byte reception + NACK response - Write INT = 0 after the reception data is read from the reception buffer Figure 15.20-26 Interrupt of Slave Reception by Disabling FIFO (2) (WSEL = 1, RSA = 0) S Slave Address W ACK Data (1) ACK Data (2) ACK Data ACK P or Sr (3) (2) : Interrupt because of INTE = 1 : Interrupt because of CNDE = 1 (1) An interrupt generated by ACK output due to the match with the slave address - Write ACKE = 1 and INT = 0 (2) An interrupt generated by 1 byte reception - Write INT = 0 after the reception data is read from the reception buffer (3) An interrupt generated by 1 byte reception - Write INT = 0 after the reception data is read from the reception buffer Figure 15.20-27 Interrupt of Slave Reception by Disabling FIFO (3) (WSEL = 1, RSA = 0) S Slave Address W ACK (1) Data ACK (2) Data ACK (2) Data (2) NACK (2) P or Sr (3) : Interrupt because of INTE = 1 : Interrupt because of CNDE = 1 (1) An interrupt generated by ACK output due to the match with the slave address - Write ACKE = 1 and INT = 0 (2) An interrupt generated by 1 byte reception - Write INT = 0 after the reception data is read from the reception buffer (3) An interrupt generated by NACK response - Write INT = 0 426 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.20 Operations of I2C Interface Communication MB91313A Series Figure 15.20-28 Interrupt of Slave Reception by Enabling Reception FIFO (4) (RSA = 0) S Slave Address W ACK Data ACK Data ACK Data ACK P or Sr (1) : Interrupt because of CNDE = 1 (1) An interrupt generated by a stop or repetitive start condition - Read all data from the reception FIFO Figure 15.20-29 Interrupt of Slave Reception by Enabling Reception FIFO (5) (RSA = 0) S Slave Address W ACK Data ACK Data ACK Data ACK P or Sr (1) : Interrupt because of INTE = 1 : Interrupt because of CNDE = 1 (1) An interrupt generated because the reception FIFO gets full - Read all data from the reception FIFO, and write INT = 0 Figure 15.20-30 Interrupt of Slave Reception by Disabling FIFO (6) (WSEL = 0, RSA = 1) S Slave Address W ACK (1) Data ACK (2) Data ACK Data ACK (2) P or Sr (3) : Interrupt because of INTE = 1 : Interrupt because of CNDE = 1 (1) An interrupt generated by matching the reserved address ("0000XXXX" of "1111XXXX") - Read the reception data, and write ACKE = 1 and INT = 0 (2) An interrupt generated by 1 byte reception + acknowledgment output - Write INT = 0 (3) An interrupt generated by 1 byte reception + acknowledgment output - Interrupt by writing INT = 0 ■ Transmission by Slave When the slave address matches and the data direction bit is "1", which indicates the transmission by the slave mode. Set the interrupt flag (INT) to "1" to generate a wait after 1 byte is transmitted or ACK response depending on the setting for WSEL bit when FIFO is disabled (See, Table 15.20-4). You can verify the acknowledgment output from the master using RACK bit. If NACK response is output, which indicates that the master cannot receive properly or data reception is completed. NACK is detected when WSEL = 1, an interrupt occurs and a wait is generated. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 427 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.20 Operations of I2C Interface Communication 15.20.3 MB91313A Series Bus Error It is recognized as a bus error when a stop or (repetitive) start condition is detected while transmitting/receiving data on I2C bus. ■ Bus Error Generation Condition A bus error sets BER bit to "1" when: • A (repetitive) start or stop condition is detected while transferring 1st byte • A (repetitive) start or stop condition is detected at 2nd to 9th bit (acknowledgment) of the data ■ Bus Error Operation Implement appropriate error process if you verify BER bit when the interrupt flag (INT) generated by a transmission/reception becomes "1", and you found that BER bit is "1". You can clear BER bit by writing "0" to INT bit. A bus error sets INT bit to "1" however, it does not start a wait state by setting SCL of the I2C bus to "L". 428 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E MB91313A Series 15.21 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.21 Dedicated Baud Rate Generator Dedicated Baud Rate Generator Dedicated baud rate generator is used to set the frequency of the serial clock. ■ Baud Rate Selection ● Baud rate that can be obtained by dividing the internal clock with the dedicated baud rate generator (reload counter) There are 2 internal reload counters that correspond to transmission and reception serial clocks. Baud rate can be specified by setting the reload value for 15 bits with the baud rate generator registers 1, 0 (BGR1/ BGR0). The reload counter divides the internal clock by the set value. ■ Calculating Baud Rate 2 of 15-bit reload counters are set using the baud rate generator registers 1, 0 (BGR1/BGR0). The equation to calculate the baud rate is shown below: (1) Reload value: V = φ / b -1 V: Reload value, b: Baud rate, φ: Machine clock frequency However, you may need to adjust the reload value because the defined baud rate may not be generated depending on the rising time of the SCL in the I2C bus. (2) Example of calculation Where the machine clock is 16 MHz and the baud rate is set to 400 kbps, the reload value is calculated as follows: Reload value: V = (16 × 1000000) / 400000 - 1 = 39 Therefore, the baud rate is: b = (16 × 1000000) / (38 +2) = 400 kbps Notes: • Write to the baud rate generator registers 1, 0 (BGR1/BGR0) by 16-bit access. • Set the baud rate generator registers when EN bit in the ISMK register is "0". • In operating mode 4 (I2C mode), the machine clock should be used for 8 MHz or more and setting over 400 kbps to the baud rate generator is disabled. • If the reload value set is to "0", the reload counter will stop. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 429 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.21 Dedicated Baud Rate Generator MB91313A Series ■ Reload Value and Baud Rate for Each Machine Clock Frequency Table 15.21-1 Reload Value And Baud Rate Baud rate [bps] 8 MHz 10 MHz 16 MHz 20 MHz 24 MHz 32 MHz 400000 19 24 39 49 59 79 200000 39 49 79 99 119 159 100000 79 99 159 199 239 319 Note: The table indicates the Value (set value of the BGR1/BGR0 register). These values are for when the SCL rising in the I2C bus is "0". If the SCL rising in the I2C bus is delayed, the baud rate gets slower than the value above. ■ Functions of the Reload Counter The reload counter consists of 15-bit register and generates a transmission and reception clock from the internal clock. You can read the count value of the transmission reload counter from the baud rate generator registers 1, 0 (BGR1/BGR0). ■ Start of a Count The reload counter starts counting when a reload value is written in the baud rate generator registers 1, 0 (BGR1/BGR0). 430 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E MB91313A Series 15.22 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.22 Examples of I2C Flowchart Examples of I2C Flowchart This section shows examples of I2C communication flowchart. ■ I2C Master Reception/ Slave Transmission FIFO Communication Flow Figure 15.22-1 Master Reception Main Settings Start Master Reception Initial Settings Communication error? Error flag=1 NO YES Stop I2C (ISMK:EN=0) End ISMK: 7-bit slave address mask register (ISMK) CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 431 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.22 Examples of I2C Flowchart MB91313A Series Figure 15.22-2 Master Reception Initial Settings Start Set initial settings: I2C mode settings (SMR) Baud rate settings (BGR) Set FIFO settings FIFO control register 1 settings (FCR1) FIFO control register 0 settings (FCR0) Enable INT interrupt (IBCR:INTE=1) Set I2C enable settings (ISMK:EN=1) Reception FIFO depends on FSEL value of FIFO control register 1. Set FIFO reception byte count (FBYTE1=xx FBYTE2=00, or FBYTE1=00 FBYTE2=xx) Write FIFO buffer: Slave address + communication direction (Read) Store Dummy data FIFO (TDR) Bus busy? IBSR:BB=1 YES NO Error Set operation mode: Master (IBCR:MSS=1) End SMR: Serial mode register (SMR) BGR: Baud rate generator register (BGR) ISBA: 7-bit slave address register (ISBA) ISMK: 7-bit slave address mask register (ISMK) FCR1: FIFO control register 1 (FCR1) FCR0: FIFO control register 0 (FCR0) IBCR: I2C bus control register (IBCR) IBSR: I2C bus status register (IBSR) FBYTE1: FIFO1 byte register (FBYTE1) FBYTE2: FIFO2 byte register (FBYTE2) TDR: Transmitted data register (TDR) 432 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.22 Examples of I2C Flowchart MB91313A Series Figure 15.22-3 Master Reception Interrupt Process Reception interrupt process Bus error? YES IBCR:BER=1 Arbitration error? NO YES IBSR:AL=1 NO NO SSR:RDRF=1 FIFO END? (Reception is completed) YES Read FIFO received data (RDR) Error 1 2 3 IBCR: I2C I2C bus control register (IBCR) bus status register (IBSR) SSR: serial status register (SSR) RDR: received data register (RDR) * For actual error handling, please judge each status error flag and handle each error by considering your systems. * For final ACK process when receiving FIFO continuously, a wait will be generated after receiving the final data, if setting WSEL=1. Please respond with NACK by setting IBSR.RACK=1 during this wait. IBSR: 1 2 NO IBCR:MSS=1, and IBCR:ACT=1 Confirm I C / master operation YES Are all data transferred? NO Software checks whether all the expected data (for dummy data write) have been received. YE S Iterative start? 2 NO YES Write FIFO buffer: 3 Slave address + communication direction When WSEL=1, a user should set NACK transmission settings. INT flag becomes "1" after the NACK transmission. (Read) Store dummy data FIFO (TDR) Iterative start condition settings (IBCR:SCC=1) Clear interrupt (IBCR:INT=0) When WSEL=1, a user should set NACK transmission settings. StopCondition (IBCR:MSS=0) IBCR : I2C bus control register (IBCR) TDR End : Transmitted data register (TDR) CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 433 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.22 Examples of I2C Flowchart MB91313A Series Figure 15.22-4 Slave Transmission Main Settings Start Slave transmission initial settings Communication error? Error flag=1 NO YES Stop I2C (ISMK:EN=0) End ISMK: 7-bit slave address mask register (ISMK) 434 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E MB91313A Series CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.22 Examples of I2C Flowchart Figure 15.22-5 Slave Transmission Initial Settings Start Set initial settings: I2C mode settings (SMR) Baud rate settings (BGR) Slave address settings (ISBA) Slave mask settings (ISMK) Enable iterative start interrupt (IBCR:CNDE=1) Enable INT interrupt (IBCR:INTE=1) Set I2C enable settings (ISMK:EN=1) Set Slave settings (IBCR:MSS=0) Set FIFO settings FIFO control register 1settings (FCR1) FIFO control register 0 settings (FCR0) Write FIFO buffer: Store Transmitted data FIFO (TDR) End SMR: Serial mode register (SMR) BGR: Baud rate generator register (BGR) ISBA: 7-bit slave address register (ISBA) ISMK: 7-bit slave address mask register (ISMK) IBCR: I2C bus control register (IBCR) FCR1: FIFO control register 1 (FCR1) FCR0: FIFO control register 0 (FCR0) TDR: Transmitted data register (TDR) CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 435 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.22 Examples of I2C Flowchart MB91313A Series Figure 15.22-6 Slave Transmission Interrupt Process Transmission interrupt process NACK is output from master even if transmission/ reception are interrupted. Bus error? YES IBCR:BER=1 NO YES Detected iterative start? (IBSR:RSC=1) Write FIFO buffer: Store Transmitted data FIFO (TDR) Clear the interrupt flag (IBSR:RSC=0) NO NACK response at final data? (IBSR:RACK=1) Error NO YES YES Is there data in FIFO? (SSR:TDRE=0) Whether transmission/ reception are interrupted is judged by the existence of FIFO data. Prohibit FIFO operation (FCR0=0x00) NO Reset FIFO (FCR0:FCL=1) Set transmitted data empty flag (SSR:TSET=1) Enable FIFO operation (FCR0=0x03) Clear interrupt (IBCR:INT=0) End IBSR: I2C bus status register (IBSR) TDR: Transmitted data register (TDR) SSR: Serial status register (SSR) FCR0: FIFO control register 0 (FCR0) IBCR: I2C bus control register (IBCR) * For actual error handling, please judge each status error flag and handle each error by considering your systems. 436 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E MB91313A Series CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.22 Examples of I2C Flowchart ■ I2C Master Transmission/ Slave Reception FIFO Communication Flow Figure 15.22-7 Master Transmission Main Settings Start Master Transmission Initial Setting Communication error? Error flag=1 NO YES Stop I2C (ISMK:EN=0) End ISMK: 7-bit slave address mask register (ISMK) CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 437 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.22 Examples of I2C Flowchart MB91313A Series Figure 15.22-8 Master Transmission Initial Settings Start Set initial settings: I2C mode settings (SMR) Baud rate settings (BGR) Set FIFO settings FIFO control register 1 settings (FCR1) FIFO control register 0 settings (FCR0) Enable INT interrupt (IBCR:INTE=1) Set I2C enable settings (ISMK:EN=1) Write FIFO buffer: Slave address + communication direction (Write) Store transmission data FIFO (TDR) Bus busy? IBSR:BB=1 YES NO Error Set operation mode: Master (IBCR:MSS=1) End SMR: Serial mode register (SMR) BGR: Baud rate generator register (BGR) ISBA: 7-bit slave address register (ISBA) ISMK: 7-bit slave address mask register (ISMK) FCR1: FIFO control register 1 (FCR1) FCR0: FIFO control register 0 (FCR0) IBCR: I2C bus control register (IBCR) IBSR: I2C bus status register (IBSR) TDR: Transmitted data register (TDR) 438 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.22 Examples of I2C Flowchart MB91313A Series Figure 15.22-9 Master Transmission Interrupt Process Transmission interrupt process Bus error? YES IBCR:BER=1 Arbitration error? NO YES IBSR:AL=1 NO NACK error? YES IBSR:RACK=1 Error NO 1 2 IBCR: I2C bus control register (IBCR) IBSR: I2C bus status register (IBSR) * For actual error handling, please judge each status error flag and handle each error by considering your systems. 1 2 Confirm I C/ master operation NO IBCR:MSS=1, and IBCR:ACT=1 Software checks whether all the transmission data have been written to the transmission buffer. YES NO SSR:TDRE=1, and Are all data transferred? Judge iterative packet operation requests for the whole system. YES NO Iteration start request? YES 2 Write FIFO buffer: Slave address + communication direction (Write) Score Transmitted data FIFO (TDRx) Clear interrupt (IBCR:INT=0) Iteration start condition settings (IBCR:SCC=1) Iteration operation initial settings Stop Condition (IBCR:MSS=0) End IBCR : I C bus control register (IBCR) TDR : Transmitted data register (TDR) SSR : Serial status register (SSR) * For actual error handling, please judge each status error flag and handle each error by considering your systems. 2 CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 439 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.22 Examples of I2C Flowchart MB91313A Series Figure 15.22-10 Slave Reception Main Settings Start Slave reception initial settings Communication error? Error flag=1 NO YES Stop I2C (ISMK:EN=0) End ISMK: 7-bit slave address mask register (ISMK) 440 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.22 Examples of I2C Flowchart MB91313A Series Figure 15.22-11 Slave Reception Initial Settings Start Set initial settings: I2C mode settings (SMR) Baud rate settings (BGR) Slave address settings (ISBA) Slave mask settings (ISMK) Enable INT interrupt (IBCR:INTE=1) Set I2C enable settings (ISMK:EN=1) Set slave settings (IBCR:MSS=0) Set FIFO settings FIFO control register 1 settings (FCR1) FIFO control register 0 settings (FCR0) Reception FIFO depends on FSEL value of FIFO control register 1. Set FIFO reception byte count (FBYTE1=xx FBYTE2=00, or FBYTE1=00 FBYTE2=xx) End SMR: Serial mode register (SMR) BGR: Baud rate generator register (BGR) ISBA: 7-bit slave address register (ISBA) ISMK: 7-bit slave address mask register (ISMK) IBCR: I2C bus control register (IBCR) FCR1: FIFO control register 1 (FCR1) FCR0: FIFO control register 0 (FCR0) FBYTE1: FIFO1 byte register (FBYTE1) FBYTE2: FIFO2 byte register (FBYTE2) CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 441 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.22 Examples of I2C Flowchart MB91313A Series Figure 15.22-12 Slave Reception Interrupt Process Reception interrupt process Bus error? IBCR:BER=1 FIFO END? (Reception is completed) NO YES NO SSR:RDRF=1 YES Error Read FIFO received data (RDR) Clear interrupt (IBCR:INT=0) End IBSR: I2C bus status register (IBSR) SSR: Serial status register (SSR) RDR: Received data register (RDR) IBCR: I2C bus control register (IBCR) * For actual error handling, please judge each status error flag and handle each error by considering your systems. 442 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.23 Notes on I2C Mode MB91313A Series 15.23 Notes on I2C Mode The notes for when you use the I2C mode are shown below. • FIFO cannot be used for requesting DMA transfer with a channel with FIFO. Please set as FIFO operation disable. • To request a DMA transfer request, set the block size of DMA to one time. • When master reception and slave reception are selected, it is required to use two channels for DMA; one is used for DMA transfer to receive data and the other one is used for DMA transfer to send dummy data. • In I2C mode, if there is no valid data in transmission register (TDR), and transmission data empty flag bit (TDRE) is "1", the interrupt flag (INT) becomes "1" as shown in Figure 15.23-1 when the data on I2C bus for 9 bits (WSEL=0) or for 8 bits (WSEL=1) is transmitted. When the interrupt flag (INT) becomes "1" during DMA transfer, DMA transfer cannot be continued unless clearing the bit to "0" by software. (Common to master transmission, slave transmission, master reception, and slave reception.) Figure 15.23-1 INT Bit Change Timing of I2C (WSEL= 0) SCL SDA DATA ACK DATA ACK TDRE bit DMA transfer to TDR INT bit To perform DMA transfer in I2C mode, since the specification is as shown above, such operations listed below are required for performing DMA transfer to TDR before the interrupt flag (INT) becomes "1". Below operations are possible to perform to prioritize DMA transfer of I2C. - Use DMA which has a higher priority (channel number is small). It is enabled to use by fixing the priority setting bit (AT=0). - Set the value of DMA-halt by interrupt level bit as small as possible (LVL4-LVL0 bit in DILVR register). CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 443 CHAPTER 15 MULTI FUNCTION SERIAL INTERFACE 15.23 Notes on I2C Mode MB91313A Series • In case of writing the transmission data to transmission data register (TDR) by DMA transfer after transmission data empty flag (SSR: TDRE) becomes "1", or writing the data by software confirming the transmission data empty flag (SSR:TDRE), transmission data empty flag (SSR:TDRE) may not become "0". Therefore, the transmission data should be written before SCL in ACK field falls. There are no restrictions on writing the transmission data by software after the interrupt flag (IBCR:INT) becomes "1". When performing DMA transfer or sending the data by software confirming the transmission data empty flag (SSR:TDRE), please follow below procedures if the data cannot be written before SCL in ACK field falls. - Setting Set the timing of interrupt flag (IBCR:INT) becoming "1" to the 8th bit (WSEL=1). - Procedures To transmit or receive data by master, the following procedures are required. To transmit or receive data by slave, it is not required to perform the following. 1. Write the first byte (slave address) to the transmission data register by software. 2. Set to 8-bit for wait selection (IBCR:WSEL="1" write) at the same time that master is started (IBCR:MSS="1" write). 3. After sending the first byte, the interrupt flag (IBCR:INT) becomes "1". Write the second byte to transmission data register (TDR) by software after confirming ACK response (IBSR:RACK="0"). Set the DMAC, and activate DMA transfer, then write "0" to interrupt flag (IBCR:INT). 4. After transmission and reception are completed, terminate the master (IBCR:MSS="0" write) or reboot (IBCR:SCC="1" write). 444 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 16 DMAC (DMA CONTROLLER) This chapter gives an overview of the DMA controller (DMAC) and describes its register configuration and its operations. 16.1 Overview of DMA Controller 16.2 Operations of DMA Controller 16.3 Setting of Transfer Request 16.4 Transfer Sequence 16.5 Operation Flowcharts 16.6 Data Bus CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 445 CHAPTER 16 DMAC (DMA CONTROLLER) 16.1 Overview of DMA Controller 16.1 MB91313A Series Overview of DMA Controller This module is used to carry out the DMA (Direct Memory Access) transfer in the FR family devices. The DMA transfer controlled by this module enables various data to be transferred quickly without using CPU, resulting into an improvement of the system performance. ■ Hardware Configuration This module is composed of the following items: • Five independent DMA channels • Five independent channels access control circuit • 20-bit address register (reload selectable: ch.0 to ch.3) • 24-bit address register (reload selectable: ch.4) • 16-bit transfer count register (reload selectable: one for each channel) • 4-bit block count register (one for each channel) • Two-cycle transfer ■ Main Functions The data transfer in this module has the following functions: • Data can be transferred dependently from multiple channels (5 channels) • Priority (ch.0 > ch.1 > ch.2 > ch.3 > ch.4) • Priority can be rotated between ch.0 and ch.1 • DMAC activation source - Internal peripheral request - Software request (register programming) • Transfer mode - Burst transfer/step transfer/block transfer - Addressing mode: 20-bit (24-bit) address specification (increased/reduced/fixed) (range of change in address is ±1, 2, 4 fixed) - Data type: byte/half word/word length - Single shot/reload selectable 446 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 16 DMAC (DMA CONTROLLER) 16.1 Overview of DMA Controller MB91313A Series ■ Registers of DMA Controller Figure 16.1-1 Registers of DMA Controller ch.0 Control/Status register A DMACA0 (bit) 31 000200H ch.0 Control/Status register B DMACB0 000204H ch.1 Control/Status register A DMACA1 000208H ch.1 Control/Status register B DMACB1 00020CH ch.2 Control/Status register A DMACA2 000210H ch.2 Control/Status register B DMACB2 000214H ch.3 Control/Status register A DMACA3 000218H ch.3 Control/Status register B DMACB3 00021CH ch.4 Control/Status register A DMACA4 000220H ch.4 Control/Status register B DMACB4 000224H Overall control register DMACR 000240H ch.0 Transfer source address register (bit) 31 00001000 DMASA0 H ch.0 Transfer destination address register DMADA0 00001004H ch.1 Transfer source address register DMASA1 00001008H ch.1 Transfer destination address register DMADA1 0000100CH ch.2 Transfer source address register DMASA2 00001010H ch.2 Transfer destination address register DMADA2 00001014H ch.3 Transfer source address register DMASA3 00001018H ch.3 Transfer destination address register DMADA3 0000101CH ch.4 Transfer source address register (bit) 31 DMASA4 00001020H ch.4 Transfer destination address register DMADA4 00001024H CM71-10143-5E 0 20 24 23 FUJITSU SEMICONDUCTOR LIMITED 19 0 0 447 CHAPTER 16 DMAC (DMA CONTROLLER) 16.1 Overview of DMA Controller MB91313A Series ■ Block Diagram Counter DMA transfer request to bus controller Buffer Selector Write back Figure 16.1-2 Block Diagram DMA activation source selection circuit & request reception control Peripheral activation request/stop input DTC 2 step register DTCR Counter Read/write control BLK register Bus control State transition circuit 448 Counter buffer Selector Selector Address Counter buffer Access IRQ[4:0] Peripheral interrupt clear MCLREQ TYPE,MOD,WS DMA control Address counter To bus controller To interrupt controller ERIE,EDIE Selector Bus control Read Write DSS[2:0] Priority circuit DMASA 2 step register SADM,SASZ[7:0] SADR DMADA 2 step register DADM,DASZ[7:0] X-bus Buffer Write back DADR Write back FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 16 DMAC (DMA CONTROLLER) 16.1 Overview of DMA Controller MB91313A Series ■ Notes on Setting Register If setting this DMAC, there is a bit that needs to be executed when DMA is stopped. If bit is set during the operation (transfer), this DMAC may not normally operate. The * mark indicates that the bit effects the operation if set during the DMAC transfer. This bit should be rewritten when the DMCA transfer is stopped (is not permitted to activate or halted). If it is set when the DMA transfer is not permitted to activate (DMACR:DMAE=0 or DMACA:DENB=0), the setting is enabled after the activation is permitted. If it is set when the DMA transfer is halted (DMACR:DMAH[3:0] ≠ 0000B or DMACA:PAUS=1), the setting is enabled after the halt is cancelled. ■ DMAC-ch.0, ch.1, ch.2, ch.3, ch.4 Control/Status Register A [DMACA0 to DMACA4] DMACA0 to DMACA4 are the registers that control the operations of each of the DMAC channels, and they exist independently for each of the channels. The bit functions are as follows: Figure 16.1-3 DMAC-ch.0, ch.1, ch.2, ch.3, ch.4 Control/Status Register A [DMACA0 to DMACA4] bit 31 30 29 28 27 DENB PAUS STRG bit 15 14 13 26 25 24 23 22 IS4 to IS0 11 11 10 21 20 19 Reserved 9 8 7 6 5 18 17 16 BLK3 to BLK0 4 3 2 1 0 DTC15 to DTC0 (Initial value: 00000000B) [bit31] DENB (Dma ENaBle): DMA operation enable bit Corresponds to each of the transfer channels and enables/disables the DMA transfer activation. The activated channel starts the DMA transfer when the transfer request occurs and is accepted. Any transfer requests, if occurred on the channel that is disabled to activate, are invalid. If the activated channel's transfer is finished after repeated by specified counts, this bit turns to "0" and the transfer stops. Writing "0" to this bit forcibly stops the transfer. However, be sure to halt DMA in the PAUS bit [DMACA bit30] before forcibly stopping the operation (write "0"). If it is stopped forcibly without halting it, DMA is stopped but the transfer data is not guaranteed. To check if it is stopped, see the DSS[2:0] bit (DMACB:bit18 to bit16). DENB CM71-10143-5E Function 0 Corresponding channel DMA operation disabled (Initial value) 1 Corresponding channel DMA operation enabled FUJITSU SEMICONDUCTOR LIMITED 449 CHAPTER 16 DMAC (DMA CONTROLLER) 16.1 Overview of DMA Controller MB91313A Series • If the stop request is accepted when reset: Initialized to "0". • This bit is readable and writable. • If operations of all of the channels are disabled with the bit15:DMAE, a bit in the DMAC overall control register DMACR, writing "1" to this bit is invalid and the stop status remains. If the operation is disabled with the bit mentioned above when the operation is enabled by this bit, this bit turns to "0" and the transfer is stopped (forcibly stopped). [bit30] PAUS (PAUSe): Instruction for pause Pauses the DMA transfer for the corresponding channel. If this bit is set, the DMA transfer is not executed before this bit is cleared again (When DMA is paused, the DSS bit is "1XXB"). If this bit is set before activation, it keeps paused. A transfer request that occurs when this bit is set can be accepted, but the transfer is not started unless this bit is cleared (see "■ Acceptance and Transfer of Transfer Request"). PAUS Function 0 Corresponding channel DMA operation enabled (Initial value) 1 Corresponding channel DMA paused • When reset: Initialized to "0". • This bit is readable and writable. [bit29] STRG (Software TRiGger): Transfer request Generates the DMA transfer request for the corresponding channel. If "1" is written to this bit, a transfer request occurs when writing to the register is completed, starting the transfer to the corresponding channel. However, if the corresponding channel is not activated, any operation to this bit is disabled. Note: If the channel is activated by writing to the DMAE bit at the same time when a transfer request occurs from this bit, the transfer request is enabled and the transfer is started. The transfer request is enabled just when "1" is written to the PAUS bit, but the DMA transfer is not started until the PAUS bit is returned to "0". STRG Function 0 Ignored 1 DMA activation request • When reset: Initialized to "0". • Read value is always "0". • The write value only works on "1". "0" does not effect the operations. 450 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 16 DMAC (DMA CONTROLLER) 16.1 Overview of DMA Controller MB91313A Series [bit28 to bit24] IS4 to IS0 (Input Select) *: Transfer source selection Select the transfer request source as follows. However, the software transfer request by the STRG bit function is enabled regardless of this setting. IS Function 00000B Software transfer request only 00001B to 01111B Setting disabled 10000B UART0 (Reception complete) 10001B UART1 (Reception complete) 10010B UART2 (Reception complete) 10011B UART0 (Transmission complete) 10100B UART1 (Transmission complete) 10101B UART2 (Transmission complete) 10110B Setting disabled 10111B Setting disabled 11000B Setting disabled 11001B Setting disabled 11010B Setting disabled 11011B Setting disabled 11100B PPG0 11101B PPG1 11110B PPG2 11111B PPG3 Transfer stop request No Yes No • When reset: initialized to "00000B". • These bits are readable and writable. Notes: • If setting DMA activation with the interrupt of peripheral functions (IS=1XXXXB), the selected function should disable the interrupt in the ICR register. • When the software transfer request causes the DMA transfer to be activated if the DMA activation with the interrupt of peripheral functions is set, the source is cleared for the appropriate peripherals after the transfer is completed. Therefore, the original transfer request can be cleared, so do not activate the transfer from the software transfer request if the DMA activation with the interrupt of peripheral functions is set. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 451 CHAPTER 16 DMAC (DMA CONTROLLER) 16.1 Overview of DMA Controller MB91313A Series [bit23 to bit20] Reserved: Reserved bits • The read value is fixed as "0000B". The write is disabled. [bit19 to bit16] BLK3 to BLK0 (BLocK size): Block size specification Specifies the block size for the corresponding channel at the time of the block transfer. The value specified in these bits is the number of words in a transfer unit at a time (the number of the repeats of the data width setting). Set 0001B (size 1) if the block transfer is not to be performed. BLK XXXXB Function The block size specification for the corresponding channel • When reset: Initialized to "0000B". • These bits are readable and writable. • If all the bits are set to "0", the block size is 16 words. • When reading, the block size (reload value) is always read. [bit15 to bit0] DTC15 to DTC0 (Dma Terminal Count register) *: Transfer count register This is a register that stores the transfer counts. Each register has 16-bit length. Every register has its reload register. If reloading of the transfer count register is used for the enabled channel, the initial value is automatically returned to the register when the transfer is completed. DTC XXXXH Function The transfer counts specification for the corresponding channel When the DMA transfer is activated, this register's data is stored in the counter buffer for the transfer counter for DMA and is counted by -1 (subtracted by 1) per transfer unit. DMA is finished by writing back the content of the counter buffer to this register when the DMA transfer is finished. Therefore, you cannot read the specified value of the transfer counts during the DMA operation. • When reset: Initialized to "0000H". • These bits are readable and writable. Be sure to use the half word length or word length to access to DTC. • The read value is the count value. The reload value cannot be read. 452 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 16 DMAC (DMA CONTROLLER) 16.1 Overview of DMA Controller MB91313A Series ■ DMAC-ch.0, ch.1, ch.2, ch.3, ch.4 Control/Status Register B [DMACB0 to DMACB4] DMACB0 to DMACB4 are the registers that control the operation of each of the DMAC channels, and they exist independently for each of the channels. The bit functions are as follows Figure 16.1-4 DMAC-ch.0, ch.1, ch.2, ch.3, ch.4 Control/Status Register B [DMACB0 to DMACB4] Address ch.0 ch.1 ch.2 ch.3 ch.4 bit 31 30 29 28 27 26 TYPE1,TYPE0 MOD1,MOD:0 WS1,WS0 000204H 00020CH 000214H 00021CH bit 15 14 13 11 11 10 000224H SASZ7 to SASZ0 25 24 23 22 21 20 19 SADM DADM DTCR SADR DADR ERIE EDIE 9 8 7 6 5 4 3 18 17 16 DSS2 to DSS0 2 1 0 DASZ7 to DASZ0 (Initial value: 00000000B) [bit31, bit30] TYPE1, TYPE0 (TYPE) *: Transfer type setting Select the operation type for the corresponding channel as follows: Two-cycle transfer mode: This is a mode in which the read and write operations are transferred repeatedly by the transfer counts after setting the transfer source address (DMASA) and the transfer destination address (DMADA). TYPE1, TYPE0 Function 00B Two-cycle transfer (Initial value) 01B Setting disabled 10B Setting disabled 11B Setting disabled • When reset: Initialized to "00B". • These bits are readable and writable. • Be sure set the value to "00B". [bit29, bit28] MOD1, MOD0 (MODe) *: Transfer mode setting Select the operation mode for the corresponding channel as follows: MOD1, MOD0 Function 00B Block/step transfer mode (Initial value) 01B Burst transfer mode 10B Setting disabled 11B Setting disabled • When reset: Initialized to "00B". • These bits are readable and writable. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 453 CHAPTER 16 DMAC (DMA CONTROLLER) 16.1 Overview of DMA Controller MB91313A Series [bit27, bit26] WS1, WS0 (Word Size): Transfer data width selection Select the transfer data range for the corresponding channel. Transfer the data by the specified number of times on a data-range basis specified in this register. WS1, WS0 Function 00B Transfer on a byte basis (Initial value) 01B Transfer on a half word basis 10B Transfer on a word range basis 11B Setting disabled • When reset: Initialized to "00B". • These bits are readable and writable. [bit25] SADM (Source-ADdr. count-Mode select) *: Transfer source address count mode specification Specifies the processing of the source address per transfer for the corresponding channel. Address is incremented/decremented after each transfer is completed based on the specified source address count range (SASZ) and the next accessing address is written to the corresponding address register (DMASA) when the transfer is completed. Therefore, the transfer source address register is not updated until the DMA transfer is finished. To fix the address, specify this bit to "0" or "1" and set the address count range (SASZ, DASZ) to "0". SADM Function 0 The transfer source address is incremented. (Initial value) 1 The transfer source address is decremented. • When reset: Initialized to "0". • These bits are readable and writable. 454 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 16 DMAC (DMA CONTROLLER) 16.1 Overview of DMA Controller MB91313A Series [bit24] DADM (Destination-ADdr. Count-Mode select) *: Transfer destination address count mode specification Specifies the processing of the destination address per transfer for the corresponding channel. Address is incremented/decremented after each transfer is completed based on the specified destination address count width (DASZ) and the next accessing address is written to the corresponding address register (DMADA) when the transfer is completed. Therefore, the transfer destination address register is not updated until the DMA transfer is finished. To fix the address, specify this bit to "0" or "1" and set the address count width (SASZ, DASZ) to "0". DADM Function 0 The transfer destination address is incremented. (Initial value) 1 The transfer destination address is decremented. • When reset: Initialized to "0". • This bit is readable and writable. [bit23] DTCR (DTC-reg. Reload) *: Transfer count register reload specification Controls the reload function of the transfer count register for the corresponding channel. If the reload operation is enabled by this bit, the count register value is returned to the initial value and stopped when the transfer is finished, resulting into a status of waiting for a transfer request (activation request by the STRG or IS setting). (If this bit is 1, the DENB bit is not cleared.) Setting DENB=0 or DMAE=0 forcibly stops the operation. If the reload operation of the counter is disabled, specifying the reload in the address register makes the operation single shot which would be stopped when the transfer is finished. In this case, the DENB bit is cleared. DTCR Function 0 Disable the reload of the transfer count register (Initial value) 1 Enable the reload of the transfer count register • When reset: Initialized to "0". • This bit is readable and writable. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 455 CHAPTER 16 DMAC (DMA CONTROLLER) 16.1 Overview of DMA Controller MB91313A Series [bit22] SADR (Source-ADdr.-reg. Reload) *: Reload specification of the transfer source address register Controls the reload function of the transfer source address register for the corresponding channel. If the reload operation is enabled by this bit, the transfer source address register value is returned to the initial value when the transfer is finished. If the reload operation of the counter is disabled, specifying the reload in the address register makes the operation single shot which would be stopped when the transfer is finished. In this case, the address register value is stopped with the initial setting value having been reloaded. If the reload operation is disabled by this bit when the transfer is finished, the address register value is the next access address to the last address (or incremented address if the address increment is specified). SADR Function 0 Disable the reload of the transfer source address register (Initial value) 1 Enable the reload of the transfer source address register • When reset: Initialized to "0". • This bit is readable and writable. [bit21] DADR (Dest.-ADdr.-reg. Reload) *: Reload specification of the transfer destination address register Controls the reload function of the transfer destination address register for the corresponding channel. If the reload operation is enabled by this bit, the transfer destination address register value is returned to the initial value when the transfer is finished. Other details of the function is equivalent to the content of bit22:SADR. DADR Function 0 Disable the reload of the transfer destination address register (Initial value) 1 Enable the reload of the transfer destination address register • When reset: Initialized to "0". • This bit is readable and writable. [bit20] ERIE (ERror Interrupt Enable)*: Error interrupt output enabled Controls the interrupt occurrence when finished due to an occurrence of error. The content of occurred error is indicated in DSS2 to DSS0. Note that this interrupt occurs only for particular finish sources, not for every finish source (see the explanation of the DSS2 to DSS0 bits). ERIE Function 0 Error interrupt request output disabled (Initial value) 1 Error interrupt request output enabled • When reset: Initialized to "0". • This bit is readable and writable. 456 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 16 DMAC (DMA CONTROLLER) 16.1 Overview of DMA Controller MB91313A Series [bit19] EDIE (EnD Interrupt Enable) *: End interrupt output enable Controls the interrupt occurrence when normally finished. EDIE Function 0 End interrupt request output disabled (Initial value) 1 End interrupt request output enabled • When reset: Initialized to "0". • This bit is readable and writable. [bit18 to bit16] DSS2 to DSS0 (Dma Stop Status)*: Transfer stop source display Displays a 3-bit code (end code) that indicates the source of the DMA transfer stop/finish for the corresponding channel. The contents of the end code are as follows: DSS2 Function Interrupt generation 0 Initial value No 1 Pausing DMA (DMAH, PAUS bit, interrupt, and so on) No DSS1, DSS0 00B Function Initial value 01B Interrupt generation No - No 10B Transfer stop request Error 11B Normal termination End The transfer stop request is set only if the request from peripheral circuit is used. Note: The "interrupt generation" column indicates the type of possible interrupt requests. • When reset: Initialized to "000B". • Cleared by writing "000B". • These bits are readable/writable, but only "000B" can be written to this bit. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 457 CHAPTER 16 DMAC (DMA CONTROLLER) 16.1 Overview of DMA Controller MB91313A Series [bit15 to bit8] SASZ7 to SASZ0 (Source Addr count SiZe) *: Transfer source address count size specification Specifies the increment/decrement width of the transfer source address (DMASA) per transfer for the corresponding channel. The value set to this bit is the address increment/decrement width per transfer. The address increment/decrement depends on the instruction of the transfer source address count mode (SADM). SASZ7 to SASZ0 Function 00H Address fixed 01H Transfer on a byte basis 02H Transfer on a half word basis 04H Transfer on a word basis Others Setting disabled • When reset: Initialized to "00H". • These bits are readable and writable. • If set to other than address fixed, only the same transfer unit as the transfer data width (WS) can be set. [bit7 to bit0] DASZ7 to DASZ0 (Des Addr count SiZe) *: Transfer destination address count size specification Specifies the increment/decrement range of the transfer destination address (DMADA) per transfer for the corresponding channel. The value set to this bit is the address increment/decrement width per transfer. The address increment/decrement depends on the instruction of the transfer destination address count mode (DADM). DASZ7 to DASZ0 Function 00H Address fixed 01H Transfer on a byte basis 02H Transfer on a half word basis 04H Transfer on a word basis Others Setting disabled • When reset: Initialized to "00H". • These bits are readable and writable. • If set to other than address fixed, only the same transfer unit as the transfer data width (WS) can be set. 458 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 16 DMAC (DMA CONTROLLER) 16.1 Overview of DMA Controller MB91313A Series ■ DMAC-ch.0, ch.1, ch.2, ch.3, ch.4 Transfer Source/Destination Address Setting Registers [DMASA0 to DMASA4/DMADA0 to DMADA4] DMASA0 to DMASA4/DMADA0 to DMADA4 are the registers that control the operations of each of the DMAC channels, and they exist independently for each of the channels. The bit functions are as follows: Figure 16.1-5 DMAC Transfer Source/Destination Address Setting Registers Address: bit ch.0 001000H ch.1 001008H ch.2 001010H ch.3 001018H 31 30 29 28 27 26 25 24 23 22 21 20 15 14 13 12 11 10 18 17 16 DMASA0 to DMASA3 [19:16] - bit 19 9 8 7 6 5 4 3 2 1 0 21 20 19 18 17 16 DMASA0 to DMASA3 [15:0] (Initial value: 00000000H) Address: bit ch.0 001004H ch.1 00100CH ch.2 001014H ch.3 00101CH 31 30 29 28 27 26 25 24 23 22 DMADA0 to DMADA3 [19:16] - bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 17 16 DMADA0 to DMADA3[15:0] (Initial value: 00000000H) Figure 16.1-6 DMAC Transfer Source/Destination Address Setting Registers Address: bit 31 30 29 28 ch.4 001020H 27 26 25 24 23 22 21 bit 15 14 13 12 20 19 18 DMASA4 [23:16] 11 10 9 8 7 6 5 4 3 2 1 0 22 21 20 19 18 17 16 1 0 DMASA4[15:0] (Initial value: 00000000H) Address: bit 31 30 29 28 ch.4 001024H 27 26 25 24 23 bit 15 14 13 12 DMADA4 [23:16] 11 10 9 8 7 6 5 4 3 2 DMADA4[15:0] (Initial value: 00000000H) CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 459 CHAPTER 16 DMAC (DMA CONTROLLER) 16.1 Overview of DMA Controller MB91313A Series These are a set of registers that store the transfer source/destination addresses. ch.0 to ch.3 have 20-bit length, ch.4 has 24-bit length. [bit31 to bit0] DMASA (DMA Source Addr) *: Transfer source address setting Sets the transfer source address. [bit31 to bit0] DMADA (DMA Destination Addr) *: Transfer destination address setting Sets the transfer destination address. When the DMA transfer is activated, this register's data is stored in the counter buffer for the address counter for DMA and the address is counted per transfer based on the setting. DMA is finished by writing back the content of the counter buffer to this register when the DMA transfer is finished. Therefore, you cannot read the address counter value during the DMA operation. Every register has its reload register. If reloading of the transfer source/destination address register is used for the enabled channel, the initial value is automatically returned to the register when the transfer is completed. In this case, other address registers are not effected. • When reset: Initialized to "00000000H". • These bits are readable and writable. With this register, be sure to use 32 bit data for access. • The read value is an address value before transfer when the transfer is being executed, and the next access address value when the transfer is finished. The reload value cannot be read. Therefore, the transfer address cannot be read at real time. • Set "0" to a nonexistent upper bit. Note: Do not use this register to set the register of DMAC itself. The DMA transfer cannot be executed to the register of DMAC itself. 460 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 16 DMAC (DMA CONTROLLER) 16.1 Overview of DMA Controller MB91313A Series ■ DMAC-ch.0, ch.1, ch.2, ch.3, ch.4 DMAC Overall Control Register [DMACR] DMACR is a register that controls the operation for the DMAC 5 channels. With this register, be sure to use byte length for access. The bit functions are as follows: Figure 16.1-7 DMAC-ch.0, ch.1, ch.2, ch.3, ch.4 DMAC Overall Control Register [DMACR] Address: bit 000240H 31 30 DMAE bit 15 29 Reserved 14 13 28 PM01 12 27 26 25 24 23 22 21 DMAH3 to DMAH0 11 10 9 8 20 19 18 17 16 2 1 0 Reserved 7 6 5 4 3 Reserved (Initial value: 0XX00000 XXXXXXXX XXXXXXXX XXXXXXXXB) [bit31] DMAE (DMA Enable): DMA operation enable Controls the operations of all the DMA channels. If the DMA operation is disabled by this bit, the transfer operations of all the channels are disabled regardless of the settings of activation/stop and operation statuses of the channels. The channel in which a transfer is in progress turns down the request and stops the transfer at the block boundary. Any activation operations for each channel, if disabled, are invalid. If the DMA operation is enabled by this bit, the activation/stop operation is available for each channel. The channels will not be activated by enabling the DMA operation with this bit. Writing "0" to this bit forcibly stops the transfer. However, be sure to halt DMA in the DMAH[3:0] bits (DMACR bit27 to bit24) before forcibly stopping the operation (write "0"). If it is stopped forcibly without halting it, DMA is stopped but the transfer data is not guaranteed. To check if it is stopped, see the DSS[2:0] bit (DMACB:bit18 to bit16). DMAE Function 0 All the channels' DMA operation disabled (Initial value) 1 All the channels' DMA operation enabled • When reset: Initialized to "0". • This bit is readable and writable. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 461 CHAPTER 16 DMAC (DMA CONTROLLER) 16.1 Overview of DMA Controller MB91313A Series [bit28] PM01 (Priority Mode ch.0, ch.1 robin): Channel priority rotation Set this bit if the priority of ch.0. ch.1 should be rotated for each transfer. PM01 Function 0 Priority fixed (ch.0 > ch.1) (Initial value) 1 Priority rotated (ch.1 > ch.0) • When reset: Initialized to "0". • This bit is readable and writable. [bit27 to bit24] DMAH3 to DMAH0 (DMA Halt): DMA pause Controls pausing of all the DMA channels. If these bits are set, all the channels' DMA transfers are not executed before these bits are cleared again. If these bits are set before activation, the channels keep paused. When these bits are set, all the transfer requests that occur on the channel with the DMA transfer enabled (DENB=1) are valid and the transfer is started by clearing these bits. DMAH3 to DMAH0 Function All the channels, DMA operation enabled (Initial value) 0000B Other than 0000B All the channels' DMA halted • When reset: Initialized to "0". • These bits are readable and writable. [bit30, bit29, bit23 to bit0] Reserved: Reserved bits • The read values are undefined. 462 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 16 DMAC (DMA CONTROLLER) 16.2 Operations of DMA Controller MB91313A Series 16.2 Operations of DMA Controller This section explains operation of a multifunction DMA controller that controls the high performance of data transfer without receiving any instructions from CPU. ■ Main Operations • Each of the transfer channels independently sets each of the functions. • If the activation is enabled, the channels do not execute the transfer operation until the specified transfer request is detected. • By detecting a transfer request, the DMA transfer request is output to the bus controller, and the bus controller controls the operation to obtain the bus right and start the transfer. • The transfer is performed according to the sequence based on the mode setting specified independently for each channel. ■ Transfer Mode Each of the DMA channels executes the transfer operation according to the transfer mode specified in the MOD[1:0] bit in each of the DMACB registers. ● Block/step transfer Transfers one block transfer unit for each transfer request. DMA stops the transfer request to the bus controller until the next transfer request is accepted. 1 block transfer unit: Specified block size (DMACA:BLK[3:0]) ● Burst transfer Repeats the transfer for a transfer request until the specified number of transfers is completed. Specified transfer count: Block size × Transfer count (DMACA:BLK[3:0] × DMACA:DTC[15:0]) CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 463 CHAPTER 16 DMAC (DMA CONTROLLER) 16.2 Operations of DMA Controller MB91313A Series ■ Transfer Type ● Two-cycle transfer (normal transfer) The DMA controller operates as a unit of the read and write operations. The data is read from the address of the transfer source register, and written to the address of the transfer destination register. ■ Transfer Address The following addressing is available. The address is set independently for each channel's transfer source/ destination. ● Specifying address in two-cycle transfer Access to the value as the address that is read from the register (DMASA, DMADA) in which the address is set in advance. After the transfer request is accepted, DMA starts the transfer after storing the address from the register to the temporary storage buffer. The address to be accessed next is generated (addition, subtraction, or fix can be selected) at the address counter for each transfer (access) and returned to the temporary storage buffer. The content of this temporary storage buffer is written back to the register (DMASA, DMADA) for each completion of a block transfer unit. Therefore, the address register (DMASA, DMADA) value is updated only on a block-transfer-unit basis, and the address cannot be known at real time. ■ Transfer Count and Transfer Termination ● Transfer count The transfer count register is decremented (by 1) for each completion of a block transfer unit. If the transfer count register is "0", then the specified number of transfers is finished, resulting into a stop or re-activation after the end code is displayed. The transfer count register value is updated only on a block-transfer unit basis, similarly to the address register. If the reload of the transfer count register is disabled, the transfer is terminated. If it is enabled, the register value is initialized, resulting into a status where the transfer is waited (DMACB:DTCR). ● Transfer termination The sources of the transfer termination are as follows. When terminated, one of the source is displayed as a end code (DMACB:DSS[2:0]). • End of specified number of transfers (DMACA:BLK[3:0] × DMACA:DTC[15:0]) → Normal Termination • Occurrence of transfer stop request from peripheral circuit → Error • Occurrence of reset → Reset The transfer stop source is displayed (DSS) for each of the termination sources, and the transfer termination interrupt/error interrupt can be generated, 464 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 16 DMAC (DMA CONTROLLER) 16.3 Setting of Transfer Request MB91313A Series 16.3 Setting of Transfer Request There are two types of the transfer request that activates the DMA transfer. The software request can always be used regardless of other request settings. ■ Built-in Peripheral Request Generates a transfer request due to an occurrence of the interrupt from the built-in peripheral circuit. Set which of the peripheral interrupts generates a transfer request for each channel (DMACA: IS[4:0]=1XXXXB). Note: The interrupt request used for a transfer request can be seen as an interrupt request to CPU, so disable the interrupt for the interrupt controller setting (ICR register). ■ Software Request Generates a transfer request by writing to the trigger bit in the register (DMACA:STRG). It is independent of the transfer request shown above, and it can always be used. If a software request is issued simultaneously with activation (enabling of transfer), the DMA transfer request is immediately output to the bus controller to start the transfer. Note: CM71-10143-5E If a software request is issued to the channel in which built-in peripheral request is set, the source is cleared for the corresponding peripheral after the transfer is completed. Therefore, the original transfer request can be cleared, so do not issue the software request. FUJITSU SEMICONDUCTOR LIMITED 465 CHAPTER 16 DMAC (DMA CONTROLLER) 16.4 Transfer Sequence 16.4 MB91313A Series Transfer Sequence You can independently set the transfer type and transfer mode to determine the operation sequence after the DMA transfer is activated for each channel (setting of DMACB:TYPE[1:0], MOD[1:0]). ■ Selecting the Transfer Sequence The following sequence can be selected depending on the register setting: Burst two-cycle transfer Block/step two-cycle transfer ■ Burst Two-cycle Transfer Repeats the specified number of transfers at one transfer source. For the two-cycle transfer, the transfer source/destination address can be specified with 20 bits (for ch.0 to ch.3) or 24 bits (for ch.4). The transfer source can select the peripheral transfer request/software transfer request. [Features of burst transfer] • If one transfer request is accepted, the transfer is repeated until the transfer count register turns to "0". Number of transfers is block size × number of transfers (DMACA:BLK[3:0] × DMACA:DTC[15:0]). • If another request occurs during the transfer, it is ignored. • If the reload function of the transfer count register is enabled, the next transfer request is accepted after the transfer is finished. • If another channel's transfer request with a higher priority is accepted during the transfer, the channel is switched at the boundary of the current block transfer unit, and it is not returned until the transfer request for the channel is cleared. Figure 16.4-1 Transfer Sequence of Burst Transfer Peripheral transfer request Bus operation Transfer count CPU SA DA 4 SA DA 3 SA DA 2 SA CPU DA 1 0 Transfer termination (Internal) (Example of burst transfer when peripheral transfer request, block count = 1, transfer count = 4) 466 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 16 DMAC (DMA CONTROLLER) 16.4 Transfer Sequence MB91313A Series ■ Step/Block Transfer Two-cycle Transfer For the step/block transfer (in which the transfer is executed for each transfer request at the specified number of blocks), the transfer source/destination address can be specified with 20 bits (for ch.0 to ch.3) or 24 bits (for ch.4). ● Step transfer If "1" is set to the block size, the sequence turns to the step transfer sequence. [Features of step transfer] • If a transfer request is accepted once, the transfer is executed once and stopped after the transfer request is cleared (the DMA transfer request is turned down to the bus controller). • If another request occurs during the transfer, it is ignored. • If another channel's transfer request with a higher priority is accepted during the transfer, the channel is switched after the transfer is stopped and the new transfer is started. Priority in the step transfer works only if multiple transfer requests occur simultaneously. ● Block transfer If other value than "1" is set to the block size, the sequence turns to the block transfer sequence. [Features of block transfer] The operation is the same except one transfer unit is composed of multiple numbers (blocks) of the transfer cycle. Figure 16.4-2 Transfer Sequence of Block Transfer Peripheral transfer request Bus operation CPU Block count Transfer count Transfer termination (Internal) SA DA SA 2 DA 1 CPU 0 2 SA DA SA 2 DA 1 1 (Example of block transfer when peripheral transfer request, block count = 2, transfer count=2) CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 467 CHAPTER 16 DMAC (DMA CONTROLLER) 16.4 Transfer Sequence MB91313A Series ■ General DMA Transfer ● Block size • One transfer unit of the transfer data is a collection of the data, number of which is specified in the block size specification register (× the data width). • Since the data transferred in one transfer cycle is fixed to the value specified with the data width, a transfer unit is composed of the number of the transfer cycles with the block size specified value. • If a transfer request with a higher priority is accepted during the transfer or if the transfer pause request is issued, even the block transfer is stopped only at the end of one transfer unit. This enables the data to be protected for the data block that does not want to be divided or paused, but the response can be downgraded if the block size is large. • Though it is stopped immediately only when the reset occurs, the content of the data being transferred is not secured. ● Reload operation This module enables you to set the three types of the reload function for each channel: (1) Transfer count register reload function After the specified number of transfers are finished, the initial value is reset in the transfer count register to wait for acceptance of an activation. Set it if the whole transfer sequence is repeated. If the reload is not specified, the count register value remains "0" after the specified number of transfers is completed, and the subsequent transfer is not performed. (2) Reload function of the transfer source address register After the specified number of transfers are finished, the initial value is reset in the transfer source address register. Set if the transfer is repeated from the fixed area in the transfer source address area. If the reload is not specified, the transfer source address register value is the next address after the specified number of transfers are completed. It is used if the address area is not fixed. (3) Reload function of the transfer destination address register After the specified number of transfers are finished, the initial value is reset in the transfer destination address register. Set if the transfer is repeated to the fixed area in the transfer destination address area. (Description shown below is the same as (2)) • Only If the reload function of the transfer source/destination register is enabled, the re-activation is not performed after the specified number of the transfers are completed. Each of the address register values is only reset. Note: Special case of operation mode and reload operation • If it is preferable that processing stops when data transfer ends and starts after input is detected again, do not specify reload. • If the burst/block/step transfer mode is used for the transfer, the data is not transferred when the transfer is completed, until the transfer is halted after reloaded and then a new transfer request input is detected. 468 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 16 DMAC (DMA CONTROLLER) 16.4 Transfer Sequence MB91313A Series ■ Addressing Mode The transfer destination/source address is specified independently for each of the transfer channel. The following methods are provided to specify the address. The transfer sequence should be used to set it. ● Address register specification For the two-cycle transfer mode, set the transfer source address in the transfer source address setting register (DMASA) and the transfer destination address in the transfer destination address setting register (DMADA). [Features of address register] ch.0 to ch.3 are registers with 20-bit length, and ch.4 is a register with 24-bit length. [Functions of address register] • Read for each access and sent to the address bus. • At the same time, the address for the next access is calculated with the address counter, and the address register is updated with the address of the calculation result. • The address calculation is selected from addition/subtraction independently for each channel/transfer destination/transfer source. Increment/decrement width of the address depends on the value of the address count size specification register (DMACB:SASZ, DASZ). • If the reload function is disabled, the calculated address is left in the last address in the address register after the transfer is completed. • If the reload function is enabled, the initial value of the address is reloaded. Notes: • If an overflow or underflow occurs as a result of 20-bit or 24-bit length full address calculation, transfer on the channel continues. Set each channel to prevent an overflow or underflow from being generated. • Do not set the address of the register of DMAC itself in the address register. ■ Data Type The data length (data width) transferred in one transfer should be selected from one of the following: • Byte • Half word • Word Since the word boundary specification is kept for the DMA transfer, the different lower bit is ignored if the specified address does not match the data length in the transfer source/destination address specification. • Word . . . . . . Actual access address is 4 bytes in which the lower 2 bits start with "00B". • Half word . . . Actual access address is 2 bytes in which the lower 1 bit starts with "0B". • Byte. . . . . . . . Actual access address matches the address specification. If the lower bit of the transfer source address does not match that of the transfer destination address, the address as is set is output on the internal address bus, but the address is fixed on each of the transfer targets on the bus, based on the rule described above. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 469 CHAPTER 16 DMAC (DMA CONTROLLER) 16.4 Transfer Sequence MB91313A Series ■ Transfer Count Control The transfer count is specified within a range of 16-bit length (1 to 65536) at maximum. The transfer count specification value is set in the transfer count register (DMACA:DTC). The register value is stored in the temporary storage buffer when the transfer is started, and decremented by the transfer counter. When this counter value turns to "0", it is detected as completion of specified number of the transfers, and the transfer for the channel is stopped or re-activation is waited (when the reload is specified). [Features of transfer count registers] • Each of the registers has 16-bit length. • Every register has its reload register. • If activated when the register value is "0B", the transfer is repeated 65536 times. [Reload operation] • Available only if the register has the reload function and the function is enabled. • The initial value of the count register is saved to the reload register when the transfer is activated. • If the count turns to "0" using the transfer counter, the transfer is notified as completed, and the initial value is read from the reload register and written to the count register. 470 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 16 DMAC (DMA CONTROLLER) 16.4 Transfer Sequence MB91313A Series ■ CPU Control If the DMA transfer request is accepted, DMA issues the transfer request to the bus controller. The bus controller passes the right to use the internal bus to DMA at the break of the bus operation to start the DMA transfer. ● DMA transfer and interrupt • During DMA transfer, interrupts are generally not accepted until the transfer ends. And if the DMA transfer request occurs when the interrupt is being processed, the transfer request is accepted and the process of the interrupt is paused until the transfer is completed. • If, as an exception, an interrupt request with a higher priority than the hold suppression level specified in the interrupt controller occurs, DMAC temporarily turns down the transfer request to the bus controller at the boundary of the transfer unit (1 block), and pauses the transfer until the interrupt request is cleared. The transfer request is internally kept during this time. If the interrupt request is cleared, then DMAC issues the transfer request to the bus controller to obtain the right to use the bus and resume the DMA transfer. ● DMA suppression • If the interrupt source with a higher priority occurs during the DMA transfer, the FR family halts the DMA transfer and branches to the appropriate interrupt routine. This mechanism is valid as long as the interrupt request exists. However, the suppression mechanism does not work if the interrupt source is cleared, resulting that the DMA transfer resumes in the interrupt process routine. Therefore, use the DMA suppression function, if you do not want the DMA transfer to be resumed in the process routine of the interrupt source with a level which halts the DMA transfer. The DMA suppression function is activated when other value than "0000B" is written to the DMAH[3:0] bit in the DMA overall control register, and stopped when "0000B" is written. • This function is mainly used in the interrupt process routine. Before the interrupt source is cleared in the interrupt process routine, the content of the DMA suppression register is incremented by 1. This prevents the subsequent DMA transfer from being performed. After the interrupt process is addressed, the content of the DMAH[3:0] bit is decremented by 1 before the return. If there are multiple interrupts, the content of the DMAH[3:0] bit is not "0000B" yet, meaning that the DMA transfer continues to be suppressed. If there are not multiple interrupts, the content of the DMAH[3:0] bit is "0", meaning that the DMA transfer request is immediately enabled. ● Notes • As number of the register's bits are 4 bits, this function cannot be used for multiple interrupts with more than 15 levels. • The priority order of the DMA tasks should be placed at least 15-level higher than other interrupt levels. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 471 CHAPTER 16 DMAC (DMA CONTROLLER) 16.4 Transfer Sequence MB91313A Series ■ Start of Operation Starting of the DMA transfer is controlled independently for each channel, but you must enable all the channels' operations before that. ● All the channels' operation enabled Before activating each of the DMAC channels, you must enable all the channels' operation using the DMA operation enable bit (DMACR:DMAE) in advance. If not enabled, any activation settings or occurred transfer requests are invalid. ● Transfer activation Use the operation enable bit in the control register of each channel to activate the transfer operation. When the transfer request is accepted for the activated channel, the DMA transfer operation is started in the specified mode. ● Activation from pausing state If each or all the channels control is paused before the activation, the state remains after activating the transfer operation. If a transfer request is issued at this time, the request is accepted and maintained. The transfer is started at the point where the pausing is deactivated. ■ Acceptance and Transfer of Transfer Request • When activated, the transfer request specified for each channel starts to be sampled. • If the peripheral interrupt activation is selected, the DMAC transfers are continued until the transfer request is cleared, and if cleared, the transfer is stopped at a transfer unit (peripheral interrupt activation). Since the peripheral interrupt level is treated as detected, the interrupt should be performed with the interrupt cleared by DMA. • The transfer request is always accepted, even when other channel's request is accepted to perform the transfer. The channel to transfer for each transfer unit is determined based on a judgment of the priority. ■ Peripheral Interrupt Clear by DMA • This DMA has a function to clear the peripheral interrupt. This function works when the peripheral interrupt is selected for the DMA activation source (when IS[4:0]=1XXXXB). • The peripheral interrupt is cleared only for the specified activation source. That is, only the peripheral function specified in IS[4:0] is cleared. ● Timing of occurrence for interrupt clear • The timing of occurrence depends on the transfer mode (see the section "16.5 Operation Flowcharts"). [Block/step transfer] If the block transfer is selected, a clear signal occurs for each block (step) transfer. [Burst transfer] If the burst transfer is selected, the clear signal occurs when the specified number of transfers are completed. 472 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 16 DMAC (DMA CONTROLLER) 16.4 Transfer Sequence MB91313A Series ■ Pause The DMA transfer pauses if: ● Setting of pausing by writing to the control register (Each channel independently or all the channels simultaneously) If pause is set by the pause bit, the corresponding channel's transfer is stopped until the pause deactivation is enabled again. Pause should be checked in the DSS bit. If the pause is deactivated, the transfer is resumed. ● Hold suppression level interrupt process If an interrupt request with a higher level than the hold suppression level occurs, all the channels being transferred are paused at the boundary of the transfer unit, and the NMI/interrupt is processed first after releasing the bus right. The transfer request accepted during the processing of the interrupt is maintained. The channel in which the request is retained resumes the transfer after the interrupt process is completed. ■ Termination/Stop of Operation Termination of the DMA transfer is controlled independently for each channel, but you can disable all the channels' operations. ● Transfer termination If the reload operation is invalid, the transfer is stopped when the transfer count register turns to "0". The subsequent transfer requests become invalid after "normal termination" is displayed in the end code (the DMACA:DENB bit is cleared). If the reload operation is valid, the initial value is reloaded when the transfer count register turns to "0". A transfer request is being waited again after "normal termination" is displayed in the end code (the DMACA:DENB bit is not cleared). ● All the channels' operation disabled If the DMA operation enable bit DMAE is used to disable all the channels' operations, all the DMAC operations are stopped, including those of running channels. If all the channels' DMA operations are enabled again after that, a transfer is not performed unless it is re-activated for each channel. In this case, interrupt does not occur at all. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 473 CHAPTER 16 DMAC (DMA CONTROLLER) 16.4 Transfer Sequence MB91313A Series ■ Stop By Error As some cases where the transfer is stopped due to other source than the normal termination by completion of the specified number of transfers, there are stop and halt by various errors. ● Occurrence of Transfer Stop Request from Peripheral Circuit Some peripheral circuits that output the transfer request can generate the transfer stop request when an abnormality (such as receive/send error around the communication system) is found. If this transfer stop request is received, DMAC stops the corresponding channel's transfer, displaying "transfer stop request" in the end code. See the explanation of the transfer source selection bits bit28 to bit24 (IS4 to IS0) of the DMACA register for information on whether there is a transfer stop request in the peripheral circuit. See the specification of each peripheral circuit for details on the condition for generation of each transfer stop request. ■ DMAC Interrupt Control The following interrupts can be output for each DMAC channel, independently of the peripheral interrupt, which becomes a transfer request. • Transfer end interrupt . . . . Occurs only for normal termination. • Error interrupt . . . . . . . . . . Transfer stop request from the peripheral circuit (Error due to peripheral) These interrupts are all output according to the content of the end code. The interrupt request can be cleared by writing "000B" to DSS2 to DSS0 (end code) of DMACS. The end code must be cleared by writing "000B" for reactivation. If the reload operation is valid, it is automatically reactivated, but the end code is not cleared in this case, meaning that the data remains until a new end code is written when the next transfer is finished. There is only one type of the end source that can be displayed in the end code, so if the multiple sources occur simultaneously, the result of the priority judgment is displayed. Interrupt that occurs in this case follows the displayed end code. The priority of the end code is shown in the following (from the top with the highest priority): • Reset • Clear by writing "000B" • Peripheral stop request • Normal termination • Channel selection and control ■ DMA Transfer during the Sleep • DMAC can operate during the sleep mode. • If the operation during the sleep mode is expected, you should consider the following: (1) As CPU is being stopped, the DMAC register cannot be changed. The setting should be finished before entering the sleep mode. (2) The sleep mode is deactivated by interrupt, and if interrupt around the DMA activation source is selected, the interrupt controller must be used to disable the interrupt. Similarly, if you do not want to deactivate the sleep mode in the DMA end interrupt, the interrupt should be disabled. 474 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 16 DMAC (DMA CONTROLLER) 16.4 Transfer Sequence MB91313A Series ■ Channel Selection and Control You can set up to five channels simultaneously for the transfer channel. Each of the channel can be set independently for each function. ● Priority among channels Only one channel is simultaneously available for the DMA transfer, and the priority is set among the channels. The priority setting has two modes, fix/rotation, and is selected for each channel group (described later). • Fix mode Fixed from the smallest channel number. (ch.0 > ch.1 > ch.2 > ch.3 > ch.4) If a transfer request with a higher priority is accepted during the transfer, the transfer channel is switched to the channel with the higher priority at the end of one transfer unit (number specified in the block size specification register × data width). After the higher priority transfers are finished, the original channel's transfer is resumed. Figure 16.4-3 DMA Transfer in Fix Mode ch.0 transfer request ch.1 transfer request Bus operation CPU SA Transfer channel DA SA ch.1 DA SA ch.0 DA SA ch.0 DA CPU ch.1 ch.0 transfer finished ch.1 transfer finished • Rotation Mode (Only between ch.0 and ch.1) The initial state is set the same as (1) after the operation is enabled, but the priority of the channel changes for each transfer completion. Therefore, if the transfer request is output simultaneously, the channels switches for each transfer unit. This is a mode that is useful if the continuous/burst transfer is set. Figure 16.4-4 DMA Transfer in Rotation Mode ch.0 transfer request ch.1 transfer request Bus operation Transfer channel CPU SA DA ch.1 SA DA ch.0 SA DA ch.1 SA DA CPU ch.0 ch.0 transfer finished ch.1 transfer finished CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 475 CHAPTER 16 DMAC (DMA CONTROLLER) 16.4 Transfer Sequence MB91313A Series ● Channel group The priority is selected in the following unit. Mode Priority level Remarks Fix ch.0 > ch.1 - ch.0 > ch.1 Rotation ↑↓ The initial state is the top row. It is reversed when the transfer occurs for the top row. ch.0 < ch.1 476 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 16 DMAC (DMA CONTROLLER) 16.5 Operation Flowcharts MB91313A Series 16.5 Operation Flowcharts This section contains operation flowcharts for the following operation modes: • Block transfer • Burst transfer ■ Block Transfer Figure 16.5-1 Operation Flowchart of Block Transfer DENB DMA stopped 0 DENB=1 Reload enabled Activation request waiting Activation request Load initial address, number of the transfers, number of the blocks Transfer source address access address operation Transfer destination address access address operation Block count -1 BLK=0 Transfer count - 1 Only when the peripheral interrupt activation source is selected Write back address, transfer count, number of the blocks Clear interrupt DTC=0 DMA transfer finished Clearing of interrupt occurred Occurrence of the DMA interrupt Block transfer • Can be activated for every activation source (selected) • Accessible to all the areas • Configurable for the number of the blocks • Interrupt clear is issue at the end of the block count • The DMA interrupt is issued when the specified number of transfers is completed CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 477 CHAPTER 16 DMAC (DMA CONTROLLER) 16.5 Operation Flowcharts MB91313A Series ■ Burst Transfer Figure 16.5-2 Operation Flowchart of Burst Transfer DMA stopped DENB 0 DENB=1 Reload enabled Activation request waiting Load initial address, number of the transfers, number of the blocks Transfer source address access address operation Transfer destination address access address operation Block count -1 BLK=0 Transfer count - 1 DTC=0 Write back address, transfer count, number of the blocks Only when the peripheral interrupt activation source is selected Clear interrupt Clearing of interrupt occurred DMA transfer finished Occurrence of the DMA interrupt Burst transfer • Can be activated for every activation source (selected) • Accessible to all the areas • Configurable for the number of the blocks • Interrupt clear and the DMA interrupt are issued when the specified number of transfer is completed. 478 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 16 DMAC (DMA CONTROLLER) 16.6 Data Bus MB91313A Series 16.6 Data Bus This section shows transfer examples of data bus. ■ Operation of Data in Two-cycle Transfer Figure 16.6-1 Operation of Data in Two-cycle Transfer X-bus Bus controller D-bus Data buffer I-bus X-bus Bus controller D-bus Data buffer F-bus External bus I/F CPU I-bus DMAC Write cycle CPU DMAC Read cycle External bus I/F External Area → External Area Transfer F-bus RAM I/O RAM I/O CPU I-bus X-bus Bus controller D-bus Data buffer Write cycle I-bus X-bus Bus controller D-bus Data buffer F-bus RAM External bus I/F Read cycle DMAC CPU DMAC External bus I/F External Area → Internal RAM Area Transfer F-bus I/O RAM I/O X-bus Bus controller D-bus Data buffer I-bus X-bus Bus controller D-bus Data buffer F-bus RAM I/O External bus I/F CPU I-bus DMAC Write cycle CPU DMAC Read cycle External bus I/F External Area → Built-in I/O Area Transfer F-bus RAM I/O (Continued) CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 479 CHAPTER 16 DMAC (DMA CONTROLLER) 16.6 Data Bus MB91313A Series (Continued) X-bus Bus controller D-bus Data buffer I-bus X-bus Bus controller D-bus F-bus F-bus RAM External bus I/F CPU I-bus DMAC Write cycle CPU DMAC Read cycle External bus I/F Built-in I/O Area → Internal RAM Area Transfer I/O RAM I/O X-bus Bus controller D-bus Data buffer I-bus X-bus Bus controller D-bus Data buffer F-bus F-bus RAM External bus I/F CPU I-bus DMAC Write cycle CPU DMAC Read cycle External bus I/F Internal RAM Area → External Area Transfer I/O RAM I/O CPU I-bus X-bus Bus controller D-bus Data buffer Write cycle X-bus I-bus Bus controller D-bus Data buffer F-bus RAM 480 I/O FUJITSU SEMICONDUCTOR LIMITED External bus I/F Read cycle DMAC CPU DMAC External bus I/F Internal RAM Area → Built-in I/O Area Transfer F-bus RAM I/O CM71-10143-5E CHAPTER 17 REMOTE CONTROL RECEPTION This chapter describes the functions and operations of HDMI-CEC reception, ACK automatic a response, and the remote control reception. 17.1 Overview of Remote Control Reception 17.2 Register of Remote Control Reception 17.3 Explanation of Operations and Setting Procedure Examples CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 481 CHAPTER 17 REMOTE CONTROL RECEPTION 17.1 Overview of Remote Control Reception 17.1 MB91313A Series Overview of Remote Control Reception This Product is equipped with HDMI-CEC reception, ACK automatic response, and remote-control reception function. ■ Block Diagram of Remote Control Reception Figure 17.1-1 Block Diagram of Remote Control Reception Count clock Overflow Counter High width setting register StartBit Detect RCIN Noise Filter Edge Detect Latch Comp "1" Detect Rise/Fall "0" Detect *1 ACK RCACK*2 Data store register Endian convert Shifter *1 : Pseudo open drain *2 : MB91F313A only 482 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 17 REMOTE CONTROL RECEPTION 17.2 Register of Remote Control Reception MB91313A Series 17.2 Register of Remote Control Reception This section describes the configurations and functions of the registers used for remote control reception. ■ Register Configuration of Remote Control Reception Table 17.2-1 shows a list of remote control reception registers. Table 17.2-1 Registers of the Remote Control Reception Address Register Abbreviation 000X0H RCCR 000X1H RCST 000X2H RCSHW 000X3H RCDAHW High width setting register A *1 000X4H RCDBHW High width setting register B *1 000X5H Reserved 000X6H RCADR1 Device address setting register 1 *1 000X7H RCADR2 000X8H RCDTHH Device address setting register 2 *1 Data store register HH 000X9H RCDTHL Data store register HL 000XAH RCDTLH Data store register LH 000XBH RCDTLL Data store register LL RCCKD Clock divided register *2 000XCH 000XDH Register Name Remote control reception control register *1 Remote control reception interrupt control register *1 Start bit high width setting register *1 X = 18H : (ch.0), 19H : (ch.1) *1 : 8-bit access only *2 : 16-bit access only CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 483 CHAPTER 17 REMOTE CONTROL RECEPTION 17.2 Register of Remote Control Reception MB91313A Series Remote Control Reception Control Register (RCCR) 17.2.1 Shows the bit configuration of the remote control reception control register (RCCR). ■ Remote Control Reception Control Register (RCCR) Figure 17.2-1 Bit Configuration of Remote Control Reception Control Register (RCCR) bit 7 6 5 4 3 2 1 0 THSEL Reserved Reserved Reserved ADRCE MOD1 MOD0 EN 0 0 0 0 Attribute Initial value R/W 0 - - - R/W: Readable/writable Note: This register allows only 8-bit access. [bit 7]: THSEL This is the threshold select bit. Initial value is "0". Set the criteria to check for "0" and "1" in the high width setting register A/B. Status THSEL 0 1 W > width A W < width B "0" data "1" data W > width A W > width B "1" data "0" data [bit 6 to bit 4]: Reserved 484 Write Ignored. Read The read value is "0". FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 17 REMOTE CONTROL RECEPTION 17.2 Register of Remote Control Reception MB91313A Series [bit 3]: ADRCE Enable address comparison bit. The initial value is "0" (disable comparison). Comparison of receive address and device address is enabled when set to "1". When comparison is enabled, an ACK/OVF interrupt occurs only when the addresses match. In CEC mode, an ACK is returned when the address match is detected. In the case of broadcast address, match is assumed, but no ACK is returned. Set "0" if the mode is other than SIRCS mode or HDMI-CEC mode. [bit 2,bit 1]: MOD1,MOD0 These bits are used to set the remote control reception operation mode. MOD1 MOD0 Function 0 0 SIRCS mode [Initial Value] 0 1 Forbidden to set 1 0 NEC/AEHA mode (repeat signal not supported) 1 1 HDMI-CEC mode Except for SIRCS mode (MOD1=1), the input signal is internally reversed. High width comparison is applied to Low width. [bit 0]: EN This is the operation enable bit. Remote control reception operation starts when this bit is set to "1". Initial value is "0" (stopped). Do not change the following registers and bits when this bit is "1" (operating). RCCR register's THSEL bit, ADRCE bit, and MOD bit RCST register's OVFSEL RCSHW, RCDAHW, RCDBHW, RCADR1, RCADR2, and RCCKD register CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 485 CHAPTER 17 REMOTE CONTROL RECEPTION 17.2 Register of Remote Control Reception MB91313A Series Remote Control Reception Interrupt Control Register (RCST) 17.2.2 Figure 17.2-2 shows the bit configuration of the remote control reception interrupt control register (RCST). ■ Remote Control Reception Interrupt Control Register (RCST) Figure 17.2-2 Bit Configuration of Remote Control Reception Interrupt Control Register (RCST) bit 7 6 5 4 3 2 1 0 STIE ACKIE OVFIE OVFSEL ST ACK EOM OVF Attribute R/W Initial value 0 R/W: Readable/writable Note: This register allows only 8-bit access. [bit 7]: STIE This bit enables start bit interrupt. Value Description 0 Interrupt disabled 1 Interrupt enabled [bit 6]: ACKIE This bit enables ACK interrupt. Value Description 0 Interrupt disabled 1 Interrupt enabled It is valid only in CEC mode. 486 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 17 REMOTE CONTROL RECEPTION 17.2 Register of Remote Control Reception MB91313A Series [bit 5]: OVFIE This bit enables counter overflow interrupt. Value Description 0 Interrupt disabled 1 Interrupt enabled This interrupt occurs only when there is an overflow after a start bit is detected. No interrupt occurs if start bit is undetected. [bit 4]: OVFSEL This bit is used to set the overflow detection condition. Value Description 0 Overflow occurs when the counter reaches 128 clock counts. 1 Overflow occurs when the counter reaches 256 clock counts. [bit 3]: ST This bit indicates the detection of start bit. Value Description 0 Start bit undetected 1 Start bit detected Cleared when "0" is written. An interrupt occurs when a start bit is detected while the STIE bit is "1". [bit 2]: ACK This bit indicates the detection of ACK. Value Description 0 ACK undetected 1 ACK detected Cleared when "0" is written. An interrupt occurs when an ACK is detected while the ACKIE bit is "1". When address comparison is enabled, an interrupt occurs only when the addresses match. It is valid only in CEC mode. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 487 CHAPTER 17 REMOTE CONTROL RECEPTION 17.2 Register of Remote Control Reception MB91313A Series [bit 1]: EOM This bit indicates the detection of EOM. Value Description 0 EOM undetected 1 EOM detected Cleared when "0" is written. It is valid only in CEC mode. [bit 0]: OVF This bit indicates the detection of counter overflow. Value Description 0 Counter overflow undetected 1 Counter overflow detected When address comparison is enabled, an interrupt occurs only when the addresses match. Cleared when "0" is written. In SIRCS mode, the OVF flag is not set until the second byte is received. 488 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 17 REMOTE CONTROL RECEPTION 17.2 Register of Remote Control Reception MB91313A Series 17.2.3 Device Address Configuration Registers 1, 2 (RCADR1, RCADR2) Figure 17.2-3 shows the bit configuration of the device address configuration registers 1, 2 (RCADR1, RCADR2). ■ Device Address Configuration Registers 1, 2 (RCADR1, RCADR2) Figure 17.2-3 Bit Configuration of Device Address Configuration Registers 1, 2 (RCADR1, RCADR2) bit 7 6 5 4 3 Reserved 2 1 0 0 0 RCADR1,2 Attribute R/W Initial value - - - 0 0 0 R/W: Readable/writable Note: This register allows only 8-bit access. [bit 7 to bit 5]: Reserved Write Ignored. Read The read value is "0". [bit 4 to bit 0]: RCADR1, 2 This is the register to set the device side (receive side) address. The address set in this register is compared with the Remote Control Reception device address and HDMICEC destination. Do not set 0FH (broadcast address) in this register in HDMI-CEC mode. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 489 CHAPTER 17 REMOTE CONTROL RECEPTION 17.2 Register of Remote Control Reception MB91313A Series Start Bit High Width Configuration Register (RCSHW) 17.2.4 Figure 17.2-4 shows the bit configuration of the start bit high width configuration register (RCSHW). ■ Start Bit High Width Configuration Register (RCSHW) Figure 17.2-4 Bit Configuration of Start Bit High Width Configuration Register (RCSHW) bit 7 0 RCSHW Attribute R/W Initial value 0 R/W: Readable/writable Note: This register allows only 8-bit access. This register is used to set the High duration of the start bit. A start bit is detected when the width of the received High exceeds the set value. If the High width of the received signal is less than the set value, no start bit is detected and start bit High detection wait state is reentered. Set RCSHW < 127 (value not exceeding overflow detection) if OVFSEL=0. 490 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 17 REMOTE CONTROL RECEPTION 17.2 Register of Remote Control Reception MB91313A Series 17.2.5 "H" Width Configuration Register A (RCDAHW) Figure 17.2-5 shows the bit configuration of the "H" Width Configuration register A (RCDAHW). ■ "H" Width Configuration Register A (RCDAHW) Figure 17.2-5 Bit Configuration of "H" Width Configuration A (RCDAHW) bit 7 0 RCDAHW Attribute R/W Initial value 0 R/W: Readable/writable Note: This register allows only 8-bit access. This is register A used to set the "H" duration. The value set in this register must be such that 2 < RCDAHW < RCDBHW. Also, in CEC mode, set so that RCDAHW < 46 (less than ACK response pulse width). CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 491 CHAPTER 17 REMOTE CONTROL RECEPTION 17.2 Register of Remote Control Reception MB91313A Series "H" Width Configuration Register B (RCDAHW) 17.2.6 Figure 17.2-6 shows the bit configuration of the "H" Width Configuration register B (RCDBHW). ■ "H" Width Configuration Register B (RCDAHW) Figure 17.2-6 Bit Configuration of "H" Width Configuration Register B (RCDBHW) bit 7 0 RCDBHW Attribute R/W Initial value 0 R/W: Readable/writable Note: This register allows only 8-bit access. This is register B used to set the "H" duration. Do not set value less than RCCDAHW. Make sure RCCDAHW < RCCDBHW < RCSHW is satisfied. 492 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 17 REMOTE CONTROL RECEPTION 17.2 Register of Remote Control Reception MB91313A Series 17.2.7 Data Storage Registers (RCDTHH, RCDTHL, RCDTLH, RCDTLL) Figure 17.2-7 shows the bit configuration of the data storage registers (RCDTHH, RCDTHL, RCDTLH, RCDTLL). ■ Data Storage Registers (RCDTHH, RCDTHL, RCDTLH, RCDTLL) Figure 17.2-7 Bit Configuration of Data Storage Registers (RCDTHH, RCDTHL, RCDTLH, RCDTLL) bit 31 24 23 RCDTHH 16 15 RCDTHL 8 7 RCDTLH Attribute R Initial value 0 0 RCDTLL R/W: Readable/writable These are the registers to store the received data. In CEC mode, the received data is stored in RCDTHH. In remote control mode, data is stored starting from RCDTHH as each 8 bits are received. When a counter overflow interrupt occurs, the bits received up to that point are stored MSB justified. When the EN bit of RCCR register is "0", the value read from these registers is undefined. If a signal exceeding 4 bytes is received, the excess data is ignored and not reflected in the registers. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 493 CHAPTER 17 REMOTE CONTROL RECEPTION 17.2 Register of Remote Control Reception MB91313A Series Clock Division Configuration Register (RCCKD) 17.2.8 Figure 17.2-8 shows the bit configuration of the clock division configuration register (RCCKD). ■ Clock Division Configuration Register (RCCKD) Figure 17.2-8 Bit Configuration of Clock Division Configuration Register (RCCKD) bit 15 Attribute Initial value 13 12 11 0 Reserved CKSEL CKDIV R/W R/W R/W - 0 0 R/W: Readable/writable Note: This register allows only 16-bit access. [bit 15 to bit 13]: Reserved Write Ignored. Read The read value is "0". [bit 12]: CKSEL This bit selects the operating clock. Value Description 0 Clock dividing the resource clock is selected. 1 Source oscillation clock (32kHz) is selected. To select a sub-clock by CKSEL bit of Clock Division Configuration Register (RCCKD), write "1" in PLL2EN bit of Clock Source Control register (CLKP) to oscillate the sub-clock. [bit 11 to bit 0]: CKDIV These bits are used to set the resource clock division rate. Division rate is CKDIV+1. From 1 division (no division) to 4096 divisions can be set (only if CKSEL=0). 494 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 17 REMOTE CONTROL RECEPTION 17.3 Explanation of Operations and Setting Procedure Examples MB91313A Series 17.3 Explanation of Operations and Setting Procedure Examples This section describes the remote control reception operation. A setting examples for each operation status are also shown. ■ Operation Flowchart of Remote Control Reception ● HDMI-CEC Reception Figure 17.3-1 Operation Flowchart of HDMI-CEC Reception HDMI-CEC STRAT bit detect ? NO YES Data reception (8bit) EOM detect ? NO YES ACK processing ACK processing END b7 Start bit Initiator MSB CM71-10143-5E b0 Destination EOM ACK Data EOM ACK LSB FUJITSU SEMICONDUCTOR LIMITED 495 CHAPTER 17 REMOTE CONTROL RECEPTION 17.3 Explanation of Operations and Setting Procedure Examples MB91313A Series ● Remote Control Reception Figure 17.3-2 Operation Flowchart of Remote Control Reception Remote control STRAT bit detect ? NO YES Data reception Overflow ? NO YES END b0 Start bit b6 b0 command MSB LSB b15 b0 Data code LSB 496 device MSB LSB b0 Reader code b4 b2 b0 Ext.+3 MSB LSB Ext.+5 Start bit MSB LSB b7 b0 Data code MSB LSB b0 b7 Data code MSB LSB FUJITSU SEMICONDUCTOR LIMITED Stop bit Reader code MSB CM71-10143-5E CHAPTER 17 REMOTE CONTROL RECEPTION 17.3 Explanation of Operations and Setting Procedure Examples MB91313A Series ■ Setting Example of Remote Control Reception Table 17.3-1 Setting Example of HDMI-CEC Registers Settings Remarks Remote Control Reception control register MOD=11, THSEL=1, ADRCE=1 Remote Control Reception interrupt control register ACKIE=1, OVFSEL=1, OVFIE=1 (7.8 ms) Start bit high width configuration register 114 3.5 ms "H" width configuration register A 13 0.4 ms "H" width configuration register B 42 1.3 ms Table 17.3-2 Setting Example of Remote Control (SIRCS) Registers Settings Remarks Remote Control Reception control register MOD=00, THSEL=0, ADRCE=1 Remote Control Reception interrupt control register ACKIE=0, OVFSEL=0, OVFIE=1 3.9 ms Start bit high width configuration register 76 2.3 ms "H" width configuration register A 17 0.52 ms "H" width configuration register B 37 1.1 ms Table 17.3-3 Setting Example of Remote Control (NEC) Registers Settings Remarks Remote Control Reception control register MOD=10, THSEL=0 Remote Control Reception interrupt control register ACKIE=0, OVFSEL=1, OVFIE=1 7.8 ms Start bit high width configuration register 144 4.4 ms "H" width configuration register A 15 0.46 ms "H" width configuration register B 52 1.6 ms CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 497 CHAPTER 17 REMOTE CONTROL RECEPTION 17.3 Explanation of Operations and Setting Procedure Examples 498 FUJITSU SEMICONDUCTOR LIMITED MB91313A Series CM71-10143-5E CHAPTER 18 FLASH MEMORY This chapter provides an outline of flash memory and explains its register configuration, register functions, and operations. 18.1 Outline of Flash Memory 18.2 Flash Memory Registers 18.3 Flash Memory Access Modes 18.4 Automatic Algorithm of Flash Memory 18.5 Execution Status of the Automatic Algorithm 18.6 Data Writing to and Erasing from Flash Memory 18.7 Restrictions on Data Polling Flag (DQ7) and How to Avoid Erroneous Judgment 18.8 Restriction and Notes Code: CM71-00512-2E Page: 500, 500, 501, 501, 502, 505, 507, 511, 522, 525, 531 CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 499 CHAPTER 18 FLASH MEMORY 18.1 Outline of Flash Memory 18.1 MB91313A Series Outline of Flash Memory MB91313A series has a built-in 544 KB flash memory. The internal flash memory can be erased either by sector or in all of the sectors collectively, and can be written (programmed) in halfwords (16-bit units), via the FRCPU. ■ Outline of Flash Memory This flash memory is a built-in 544 KB memory operating at 3.3 V. Similar to the discrete flash memory, this flash memory supports writing outside the device using the ROM programmer. In addition to the functions equivalent to the discrete flash memory, when used as built-in ROM for the FR-CPU, the flash memory allows instructions and data to be read from in words (32 bits), enabling a high-speed operation of the device. This product supports the following features by combining flash memory macros and FR-CPU interface circuits: • Features for use as CPU memory, for storing programs and data Accessibility through 32-bit bus when used as ROM Allowing read, write, and erase (automatic algorithm*) by the CPU • Features equivalent to single flash memory product Allowing read or write (automatic algorithm*) by a ROM writer *: Automatic algorithm: embedded algorithm Embedded Algorithm is a trademark of Advanced Micro Devices, Inc. This section explains use of the flash memory accessed from the FR-CPU. For information on using the flash memory accessed from a ROM writer, see the instruction manual provided with the ROM writer. 500 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 18 FLASH MEMORY 18.1 Outline of Flash Memory MB91313A Series ■ Block Diagram Figure 18.1-1 shows a block diagram of flash memory. Figure 18.1-1 Block Diagram of Flash Memory RDY/BUSYX Detection of rising edge Generation of control signal RESETX BYEX OEX FLASHmemory 544KB WEX RDY WE Bus control signal CEX FA 19-0 DI 15-0 Address buffer FA 19-0 DO 15-0 Data buffer FD 31-0 FR F-bus (instruction/data) ■ Memory Map Figure 18.1-2 shows a memory map of flash memory. Figure 18.1-2 Memory map of Flash memory 0000_0000 0007_8000 544KB FLASH 0010_0000 FFFF_FFFF CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 501 CHAPTER 18 FLASH MEMORY 18.1 Outline of Flash Memory MB91313A Series ■ Sector Address Table Sector configuration is different between Flash mode and CPU mode. ❍ Sector map in CPU mode 078000H SA4 (64kB) 088000H SA5 (64kB) 098000H SA6 (64kB) 0A8000H SA7 (64kB) 0B8000H SA8 (64kB) 0C8000H SA9 (64kB) 0D8000H SA10 (64kB) 0E8000H SA11 (64kB) 0F8000H 0FA000H 0FC000H 0FE000H 100000H SA0 (8kB) SA1 (8kB) SA2 (8kB) SA3 (8kB) 32bits 502 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 18 FLASH MEMORY 18.1 Outline of Flash Memory MB91313A Series ❍ Sector map in FLASH mode 078000H 07A000H 07C000H 07E000H 080000H SA0 (8kB) SA1 (8kB) SA2 (8kB) SA3 (8kB) SA4 (64kB) 090000H SA5 (64kB) 0A0000H SA6 (64kB) 0B0000H SA7 (64kB) 0C0000H SA8 (64kB) 0D0000H SA9 (64kB) 0E0000H SA10 (64kB) 0F0000H SA11 (64kB) 100000H 16bits CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 503 CHAPTER 18 FLASH MEMORY 18.2 Flash Memory Registers 18.2 MB91313A Series Flash Memory Registers The flash memory has two registers: flash control status register (FLCR) and wait register (FLWC). ■ List of Flash Memory Registers Figure 18.2-1 shows a list of flash memory registers. Figure 18.2-1 Flash Memory Registers bit 7 0 Flash control status register(FLCR) Wait register (FLWC) 504 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 18 FLASH MEMORY 18.2 Flash Memory Registers MB91313A Series 18.2.1 Flash Control Status Register (FLCR) The flash control status register (FLCR) indicates the operation status of flash memory. ■ Configuration of Flash Control Status Register (FLCR) (CPU Mode) This register controls writing to flash memory. This register can only be accessed in CPU mode. Do not access this register using the Read Modify Write instruction. Figure 18.2-2 shows the bit configuration of FLCR. Figure 18.2-2 Bit Configuration of FLCR FLCR Address bit 00007000H 7 6 5 4 Reserved Reserved Reserved Reserved R R R R 3 2 1 0 Initial value RDY Reserved WE Reserved 0000X000B R R R/W R R/W: Readable/writable R: Read only [bit7 to bit4] Reserved: Reserved bits These are reserved bits. The read value is always "0000B". [bit3] RDY: Ready bit This bit indicates the operation status of the automatic algorithm (data write/erase). The read data indicates the flash memory status as listed in the table below. 0 Data writing or erasing is in process, flash memory is not ready to accept a new Data write/Erase command, and no data can be read from a flash memory address. 1 Flash memory is ready to accept a new Data write/Erase command and data can be read from a flash memory address. • This bit is not initialized during a reset. • Only read operation is possible, but write operation does not affect this bit. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 505 CHAPTER 18 FLASH MEMORY 18.2 Flash Memory Registers MB91313A Series [bit2] Reserved bit This is a reserved bit. Always set this bit to "0". [bit1] WE : Write Enable bit This bit controls the writing of data and commands to flash memory in CPU mode. In flash memory mode, writing is enabled regardless of this bit. 0 Writing to flash memory is disabled and data is read from flash memory in 32-bit access mode. 1 Writing to flash memory is enabled and data is read from flash memory in 16-bit access mode. This bit is initialized to "0" during reset. Notes: • If this is overwritten, confirm that the RDY bit has stopped the automatic algorithm. When the RDY bit is set to "0", the value of this bit cannot be charged. • When WE=1, do not respond to the instruction access request and only respond to the data access request. [bit0] Reserved bit This is a reserved bit. Always set this bit to "0". 506 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 18 FLASH MEMORY 18.2 Flash Memory Registers MB91313A Series 18.2.2 Wait Register (FLWC) The wait register (FLWC) controls the wait state for flash memory access in CPU mode. ■ Bit Configuration of Wait Register (FLWC) The wait register (FLWC) consists of the following bits: Figure 18.2-3 Bit Configuration of Wait Register (FLWC) FLWC Address bit 007004H 7 6 5 4 3 2 1 0 Initial value FAC1 FAC0 WTW2 WTW1 WTW0 WTC2 WTC1 WTC0 01011011B R/W R/W R/W R/W R/W R/W R/W R/W R/W: Readable/writable [bit7, bit6] FAC1, FAC0: Access control bits These bits are set to control internal pulse generation for flash memory control. The ATDIN/ EQIN pulse width can be set by setting these bits. Please set the value matched to setting (WTC2 to WTC0) of the wait cycle of the read access. CM71-10143-5E FAC1 FAC0 ATDIN width EQIN width Remarks 0 0 0.5 clock 1.0 clock Read 1 wait 0 1 1.0 clock 1.5 clock Read 2, 3 wait [Initial value] 1 0 1.5 clock 2.0 clock Setting disabled 1 1 2.0 clock 2.5 clock Setting disabled FUJITSU SEMICONDUCTOR LIMITED 507 CHAPTER 18 FLASH MEMORY 18.2 Flash Memory Registers MB91313A Series [bit5 to bit3] WTW2 to WTW0: Write wait cycle bits WTW2 WTW1 WTW0 Wait cycle Remarks 0 0 0 - Setting disabled 0 0 1 1 Setting disabled 0 1 0 2 Setting disabled 0 1 1 3 [Initial value] 1 0 0 4 Setting disabled 1 0 1 5 Setting disabled 1 1 0 6 Setting disabled 1 1 1 7 Setting disabled • This bit is initialized to "011B" at a reset. • Be sure to set always"011B". [bit2 to bit0] WTC2, WTC1, WTC0: Wait cycle bits WTC2 WTC1 WTC0 Wait cycle Remarks 0 0 0 - Setting disabled 0 0 1 1 - 0 1 0 2 - 0 1 1 3 Initial value 1 0 0 4 Setting disabled 1 0 1 5 Setting disabled 1 1 0 6 Setting disabled 1 1 1 7 Setting disabled • These bits are initialized to "011B" at a reset. 508 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 18 FLASH MEMORY 18.3 Flash Memory Access Modes MB91313A Series 18.3 Flash Memory Access Modes The following two types of access mode are available for the FR-CPU: • FR-CPU ROM mode: One word (32 bits) data can be read but not written in a single cycle. • FR-CPU Programming mode: Word (32 bits) access is prohibited but reading/writing data with half-word (16 bits) is enabled. ■ FR-CPU ROM Mode (32 Bits, Read Only) In this mode, the flash memory serves as FR-CPU internal ROM. This mode enables to read one word (32 bits) in one cycle but does not enable to write to flash memory or to start the automatic algorithm. ❍ Mode specification When specifying this mode, set the WE bit of the flash control status register (FLCR) to "0". This mode is always set after releasing a reset at CPU run time. This mode can be set only when the CPU is running. ❍ Detailed operation In this mode, one word (32 bits) can be read from the flash memory area in one cycle. ❍ Restrictions • Address assignment and endians in this mode differ from those for writing with the ROM writer. • In this mode, commands and data cannot be written to flash memory together. ■ FR-CPU Programming Mode (16 Bits, Read/Write) This mode enables data to be written and erased. As one word (32 bits) cannot be accessed in one cycle, program execution in flash memory is disabled in this mode. ❍ Mode specification When specifying this mode, set the WE bit of the flash control status register (FLCR) to "1". When a reset is released at CPU run time, the WE bit indicates "0". To set to this mode, set the WE bit to "1". If the WE bit is set again to "0" through a writing operation or because of a reset, the device enters FR-CPU ROM mode. When the RDY bit of the flash control status register (FLCR) is "0", the WE bit cannot be overwritten. When overwriting the WE bit, ensure that the RDY bit is set to "1". CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 509 CHAPTER 18 FLASH MEMORY 18.3 Flash Memory Access Modes MB91313A Series ❍ Detailed operation Half word (16 bits) data can be read from the flash memory area in one cycle. The automatic algorithm can be started by writing a command to flash memory. When the automatic algorithm starts, data can be written to or erased from flash memory. For details on the automatic algorithm, see "18.4 Automatic Algorithm of Flash Memory". ❍ Restrictions • Address assignment and endians in this mode differ from those for writing with the ROM writer. • This mode inhibits reading data in words (32 bits). ■ Automatic Algorithm Execution Status When the automatic algorithm is started in FR-CPU programming mode, the operation status of the automatic algorithm can be checked by reading the RDY bit in the flash control status register (FLCR). When the RDY bit is set to "0", data is being written or erased with the automatic algorithm, and no write or erase command can be accepted. Moreover, data cannot be read from any address in flash memory. Data read with the RDY bit set to "0" is a hardware sequence flag to indicate flash memory status. 510 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 18 FLASH MEMORY 18.4 Automatic Algorithm of Flash Memory MB91313A Series 18.4 Automatic Algorithm of Flash Memory The flash memory automatic algorithm can be started using a Reset, Write, Chip Erase, or Sector Erase command. The Sector Erase command can suspend and resume the automatic algorithm. ■ Command Sequence To start the automatic algorithm, write one to six half-words (16 bits) data in sequence. This is called the command. If the address and data to be written are invalid or are written in an incorrect sequence, the flash memory is reset to read mode. Table 18.4-1 lists commands that can be used to write data to or erase data from flash memory. Table 18.4-1 Command Sequence Table Command Sequence Bus Write Cycle 1st Bus Write cycle Address Data 2nd Bus Write cycle Address Data 3rd Bus Write cycle Address Data 4th Bus Read/write cycle Address Data 5th Bus Write cycle Address Data 6th Bus Write cycle Address Data ------------------Reset 1 XXXXH F0F0H 5555H DAAA8H F0F0H ----------Reset 3 DAAA8H AAAAH D5554H 5555H DAAA8H A0A0H PA PD ------Data writing 4 DAAA8H AAAAH D5554H Chip erase 6 DAAA8H AAAAH D5554H 5555H DAAA8H 8080H DAAA8H AAAAH D5554H AAAAH DAAA8H Sector erase 6 DAAA8H AAAAH D5554H 5555H DAAA8H 8080H DAAA8H AAAAH D5554H AAAAH SA Sector erase suspend Suspend erase during sector erase with input of Address= XXXXH, data = B0B0H Sector erase resume Resume erase after Sector erase suspend, with input of Address= XXXXH, data = 3030H Continuous 3 DAAA8H AAAAH D5554H 5555H DAAA8H 2020H ----------mode Continuous PA PD --------------2 XXXXXH A0A0H writing Continuous F0F0H or --------------mode 2 XXXXXH 9090H XXXXXH 0000H Reset RA: Read address PA: Write address SA: Sector address (Specify any address in the sector) RD: Read data PD: Write data ------1010H 3030H ------- ❍ Reset command Set flash memory into Read/Reset mode. The flash memory remains in reading state until another command is entered. When the power is turned on, flash memory is automatically set to the read or reset state. In this case, data can be read without a reset command of the automatic algorithm. To return to read/reset mode after the time limit is exceeded, issue a Reset command. Data is read from flash memory in the next read cycle. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 511 CHAPTER 18 FLASH MEMORY 18.4 Automatic Algorithm of Flash Memory MB91313A Series ❍ Program (Data write) In FR-CPU programming mode, data is basically written in half-word units. The data write operation is performed in four cycles of bus operation. Writing to memory starts when the last write cycle is performed. After executing automatic algorithm of data writing, it becomes unnecessary to control the flash memory externally. The flash memory itself internally generates write pulses to check the margin of the cells to which data is written. The data polling function compares bit7 of the original data with data polling flag (DQ7) of the written data, and if these bits are the same, the automatic write operation ends (see "■Hardware Sequence Flag" in "18.5 Execution Status of the Automatic Algorithm"). The automatic write operation then returns to the read/reset mode and accepts no more write addresses. After that, the flash memory requests the next valid address. In this manner, the data polling function indicates a write operation in memory. During a write operation, all commands written to the flash memory are ignored. If a hardware reset starts during write operation, the data at the address for writing may become invalid. Writing operations can be performed in any address sequence and outside of sector boundaries. However, write operations cannot change a data item "0" to "1". If a "0" is overwritten with a "1", the data polling algorithm either determines that the elements are defective, or that "1" has been written. In the latter case, however, the respective data item is read as "0" in reset or read/reset mode. A data item "0" can be changed to "1" only after an erase operation. ❍ Chip Erase The Chip Erase command sequence ("erase all sectors simultaneously") is executed in six access cycles. During the Chip Erase command sequence, the user does not have to write to flash memory before the erase operation. When the automatic algorithm of chip erasure is executed, flash memory checks cell states by writing a pattern of zeros before automatically erasing the contents of all cells (preprogram). In this operation, flash memory does not have to be controlled externally. The automatic erase operation starts with the write operation of the command sequence and ends when data polling flag (DQ7) is set to "1", where flash memory returns to the read/reset mode. The chip erase time can be expressed as follows: time for sector erase × number of all sectors + time for writing to the chip (preprogram). 512 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 18 FLASH MEMORY 18.4 Automatic Algorithm of Flash Memory MB91313A Series ❍ Sector Erase The Sector Erase command sequence is executed in six access cycles. The Sector Erase command is entered in the sixth cycle for starting the sector erase operation. The next Sector Erase command can be accepted within a time-out period of 40 μs to 160 μs after the last Sector Erase command is written. Multiple Sector Erase commands can be accepted during the six bus cycles of the writing operation. During the command sequence, Sector Erase commands (3030H) for sectors whose contents are to be erased simultaneously are written consecutively to the addresses for these sectors. The sector erase operation itself starts from the end of the time-out period of 40 μs to 160 μs after the last Sector Erase command is written. When the contents of multiple sectors are erased simultaneously, the subsequent Sector Erase commands must be input within the 40 μs time-out period to ensure that they are accepted. For checking whether the succeeding Sector Erase command is valid, read sector erase timer flag (DQ3) (see "■Hardware Sequence Flag" in "18.5 Execution Status of the Automatic Algorithm"). During the time-out period, any command other than Sector Erase and Temporarily Stop Erase is reset at read time, and the preceding command sequence is ignored. In the case of the Temporary Stop Erase command, the contends of the sector are erased again and the erase operation is completed. Any combination and number (from 0 to 6) of sector addresses can be entered in the sector erase buffers. The user does not have to write to flash memory before the sector erase operation. Flash memory automatically writes to all cells in a sector whose data is automatically erased (preprogram). When the contents of a sector are erased, the other cells remain intact. In these operations, flash memory does not have to be controlled externally. The automatic sector erase operation starts from the end of the 40 μs to 160 μs time-out period after the last Sector Erase command is written. When data polling flag (DQ7) is set to "1", the automatic sector erase operation ends and flash memory returns to the read/reset mode. At this time, other commands are ignored. The data polling function is enabled for any sector address in which data has been erased. The time required for erasing the data of multiple sectors can be expressed as follows: time for sector erase + time for sector write (preprogram) × number of erased sectors. ❍ Temporarily Stop Erase The Temporarily Stop Erase command temporarily stops the automatic algorithm in flash memory when the user is erasing the data of a sector, thereby making it possible to write data to and read data from the other sectors. This command is valid only during the sector erase operation and ignored during chip erase and write operations. The Temporarily Stop Erase command (B0B0H) is effective only during sector erasure operation that includes the sector erase time-out period after a Sector Erase command (3030H) is issued. When this command is entered within the time-out period, waiting for time-out ends and the erase operation is suspended. The erase operation is restarted when a Restart Erase command was written. Temporarily Stop Erase and Restart Erase commands can be entered with any address. When a Temporarily Stop Erase command is entered during sector erase operation, the flash memory needs a maximum of 20 μs to stop the erase operation. When flash memory enters temporary erase stop mode, a RDY bit in FLCR register and data polling flag (DQ7) output "1", and toggle bit flag (DQ6) stops to toggle. For checking whether the erase operation has stopped, enter the address of the sector whose data is being erased and read the values of toggle bit flag (DQ6) and data polling flag (DQ7). At this time, another Temporarily Stop Erase command entry is ignored. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 513 CHAPTER 18 FLASH MEMORY 18.4 Automatic Algorithm of Flash Memory MB91313A Series When the erase operation stops, flash memory enters the temporary erase stop and read mode. Data reading is enabled in this mode for sectors that are not subject to temporary erase. Other than that, there is no difference from the standard read operation. After the temporary erase stop and read mode is entered, the user can write to flash memory by writing a Write command sequence. The write mode in this case is the temporary erase stop and write mode. In this mode, data write operations become valid for sectors that are not subject to temporary erase stop. Other than that, there is no difference from the standard byte writing operation. The temporary toggle bit flag (DQ6) can be used to detect this operation. Note that toggle bit flag (DQ6) can be read from any address, but data polling flag (DQ7) must be read from write addresses. To restart the sector erase operation, a Restart Erase command (3030H) must be entered. Another Restart Erase command entry is ignored in this case. On the other hand, a Temporarily Stop Erase command can be entered after flash memory restarts the erase operation. 514 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 18 FLASH MEMORY 18.5 Execution Status of the Automatic Algorithm MB91313A Series 18.5 Execution Status of the Automatic Algorithm Data write/erasure operation of flash memory is performed by automatic algorithm. The operation status of automatic algorithm can be checked by hardware sequence flag and RDY bit. ■ RDY bit The flash memory uses RDY bit in flash memory status register (FLCR) in addition to the hardware sequence flag to indicate whether the automatic algorithm is running or ends. When the value of the RDY bit is "0", the flash memory is executing a data write or erase operation, where new Data Write and Erase commands are not accepted. When the value of the RDY bit is "1", the flash memory is in read/data write or erase operation wait state. ■ Hardware Sequence Flag For obtaining the hardware sequence flag as data, read an arbitrary address (an odd address in byte access) from flash memory when the automatic algorithm is executed. The data contains five validity bits which indicate the status of the automatic algorithm. When the automatic algorithm is executed for ROM1, specify an address in ROM1. When executed for ROM2, specify an address in ROM2. Figure 18.5-1 shows the structure of the hardware sequence flag. Figure 18.5-1 Structure of the Hardware Sequence Flag bit During half-word read During byte read (from odd address only) 15 8 7 0 Hardware sequence flag (Undefined) 0 bit 7 Hardware sequence flag * Reading in units of words is disabled. (Only use this function in FR-CPU programming mode.) bit 7 6 5 4 3 2 1 0 (In half-word and DPOLL TOGGLE TLOVER (Undefined) SETIMER (Undefined) (Undefined) (Undefined) byte access) The hardware sequence flag becomes invalid in FR-CPU ROM mode. Always use FR-CPU programming mode and read only in half-words or bytes. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 515 CHAPTER 18 FLASH MEMORY 18.5 Execution Status of the Automatic Algorithm MB91313A Series Table 18.5-1 lists the possible statuses of the hardware sequence flag. Table 18.5-1 Statuses of the Hardware Sequence Flag Status DPOLL Data write Chip erase Sector erase Executing Temporary erase stop mode TOGGLE TLOVER SETIMR Reverse data Toggle 0 0 0 Toggle 0 1 Time-out duration 1 Toggle 0 0 Erase duration 0 Toggle 0 1 Read (from sectors in temporary erase stop) 1 1 0 0 Data Data Data Data Reverse data Toggle* 0 0 Reverse data Toggle 1 0 0 Toggle 1 1 0 Toggle 1 1 Read (from sectors not in temporary erase stop) Data write (to sectors not in temporary erase stop) Data write Time limit Chip/sector erase exceeded Write operation during temporary erase stop *: TOGGLE toggles continuous read operations from any address. The hardware sequence flags are explained below. [bit7] DPOLL: Data polling flag (DQ7) This flag is used with the data polling function to report that the automatic algorithm is being executed or terminated. • Automatic data write operation status When read access is performed while the automatic algorithm of data write is being executed, flash memory outputs the inversion of bit7 of the last data written regardless of the address indicated by the address signal. When read access is performed at the end of the automatic write algorithm, flash memory outputs bit7 of the read data to the address indicated by the address signal. • Chip erase operation status When read access is performed while the automatic algorithm of chip erase is being executed, flash memory outputs "0", regardless of the address indicated by the address signal. Similarly, flash memory outputs "1" at the end of the chip erase. • During a sector erase operation: When read access is performed from the sector being erased during execution of the sector erase automatic algorithm, it outputs "0". Due to restrictions on the function in this series, the flash memory outputs "1" for 40 μs to 160 μs after the sector erase command is issued, and then outputs "0". After the sector erase is terminated, the flash memory outputs "1". For restrictions on the data polling flag (DQ7) and how to avoid erroneous judgment of sector erase completion, see section "18.7 Restrictions on Data Polling Flag (DQ7) and How to Avoid Erroneous Judgment". • Temporary sector erase stop status When read access is performed during temporary sector erase stop status, flash memory outputs "1" when the address indicated by the address signal is included in the sector in erase status. If the address is not included in the sector in erase status, flash memory outputs bit7 of the read value to the address. For checking whether a sector is in temporary sector erase stop status and which sector is in erase status, read this bit and the toggle bit flag. 516 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 18 FLASH MEMORY 18.5 Execution Status of the Automatic Algorithm MB91313A Series Note: Read access to a specified address is ignored while the automatic algorithm is active. Values can be output to other bits after data polling flag operation terminates in data read operation. Therefore, when data is to be read after terminating the automatic algorithm, confirm that data polling is terminated in the current read access. [bit6] TOGGLE: Toggle bit flag (DQ6) This flag is used with the toggle bit function to mainly report that the automatic algorithm is being executed or terminated as well as data polling flag. • Write or chip/sector erase operation status When continuous read operations are performed while the automatic algorithm of data write or chip/sector erase is being executed, flash memory outputs "1" and "0" toggle results to bit6 regardless of the address indicated by the address signal. When continuous read operations are performed at the end of the automatic algorithm of write or chip/sector erase algorithm, flash memory stops toggle operation of bit6 and outputs bit6 (DATA: 6) of the data read from the address indicated by the address signal. If a write target sector is protected from overwriting during a write operation, the toggle bit tries to toggle for about 2 μs and stops toggling without changing data. If all selected sectors are protected from overwriting, the toggle bit tries to toggle for about 100 μs and the system returns to read/reset status without changing data. • Temporary sector erase stop status When a read operation is performed during a temporary sector erase stop operation, flash memory outputs "1" if the address indicated by the address signal is included in the sector in erase state. If the address is not included in the sector in erase state, flash memory outputs the data of bit6 of the read value at the address indicated by the address signal. [bit5] TLOVER: Timing limit over flag (DQ5) This flag is used to report that a time (number of internal pulses) specified internally with flash memory is exceeded while the automatic algorithm is being executed. • Write or chip/sector erase operation status When read access is performed within a specified time (necessary for write or erase) after activating the automatic algorithm of write or chip/sector erase, flash memory outputs "0". If read access is performed beyond the specified time, flash memory outputs "1". Because these output operations are not affected by whether the automatic algorithm is being executed or terminated, these operations can be used to check whether data write or erase operation is successful. If flash memory outputs "1" while the automatic algorithm is being executed with the data polling function or toggle bit function, consider the write operation to be unsuccessful. For example, when "1" is written to a flash memory address where "0" is written, failure occurs. Flash memory is locked and the automatic algorithm is not terminated. Thus, valid data is not output from the data polling flag. The toggle bit flag does not stop toggling, the time limit is exceeded, and "1" is output to the TLOVER flag. This status indicates that flash memory was not used correctly, not that it was defective. Execute a Reset command. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 517 CHAPTER 18 FLASH MEMORY 18.5 Execution Status of the Automatic Algorithm MB91313A Series [bit3] SETIMR: Sector erase timer flag (DQ3) This flag is used to report that sector erasure is being awaited after starting a Sector Erase command. • Sector erase operation status When read access is performed within a sector erase time-out period after starting a Sector Erase command, flash memory outputs "0" regardless of the address indicated by the address signal of the target sector. If read access is performed beyond the time-out period, flash memory outputs "1" regardless of the address. When "1" is set in this flag while the data polling or toggle bit function indicates that the automatic algorithm is being executed, an internally controlled erase operation has started. The writing of subsequent sector erase code and commands other than Erase Temporary Stop is ignored until erase operation terminates. When this flag is "0", flash memory accepts another sector erase code entry. In this case, it is recommended to check the status of this flag by software before writing the succeeding sector erase code. If this flag is "1" at the second time of status check, the additional sector erase code may not be accepted. • Sector erase operation status When a read operation is performed during a temporary sector erase stop operation, flash memory outputs "1" if the address indicated by the address signal is included in the sector that is subject to the erase operation. If the address is not included in the sector that is subject to the erase operation, flash memory outputs the data of bit3 of the read value at the address indicated by the address signal. 518 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E MB91313A Series 18.6 CHAPTER 18 FLASH MEMORY 18.6 Data Writing to and Erasing from Flash Memory Data Writing to and Erasing from Flash Memory This section explains how to issue a command to start the automatic algorithm for following operations in flash memory. • Reset • Data write • Chip erase • Sector erase • Temporary sector erase stop • Sector erase restart ■ Data Writing/Erase Automatic algorithm (data write, chip erase, sector erase, temporary sector erase stop, sector erase restart) of flash memory is activated by writing the command sequence into bus. The write cycles for each bus must always be executed continuously. Termination of the automatic algorithm can be checked with the data polling function and toggle bit function. Flash memory is set again into read/reset status after the automatic algorithm terminates normally. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 519 CHAPTER 18 FLASH MEMORY 18.6 Data Writing to and Erasing from Flash Memory 18.6.1 MB91313A Series Read/Reset Status This section explains the procedure to set flash memory into read/reset status by issuing reset command. ■ Read/Reset Status To set the flash memory read/reset status, issue the reset command sequence table continuously to target sector in the flash memory. A bus operation is performed one or three times with a Reset command sequence. There is no essential difference between these two sequences. Read/reset status is the initial status of flash memory, and flash memory is set in this status at power-on or when a command terminates normally. In this status, the system waits for a command other than Read/Reset to be entered. Data can be read using normal read access in this status. Programs can be accessed from the CPU the same way the programs in mask ROM are accessed. The Read/Reset command is not necessary for reading data in normal read access. This command is required, however, to initialize the automatic algorithm if a command does not terminate normally. 520 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 18 FLASH MEMORY 18.6 Data Writing to and Erasing from Flash Memory MB91313A Series 18.6.2 Data Writing This section explains the procedure to write data to flash memory by issuing data write command. ■ Data Writing To activate the automatic algorithm of data write, issue the data write command in command sequence table continuously to target sector in flash memory. The automatic algorithm and automatic writing start when writing data to the target address terminates in the fourth cycle. ❍ How to specify address Only even-numbered addresses can be specified in write data cycles. If an odd-numbered address is specified, data cannot be written correctly. In other words, data must be written to evennumbered addresses in units of half-words. Data can be written by freely specifying the order of addresses where data is to be written. Moreover, data can be written beyond sector boundaries. Note that items of data can only be written with each write command in units of half-words. ❍ Notes on writing data Data "0" cannot be changed to "1" in a write operation. If data "1" is overwritten, the data polling algorithm or toggle operation does not terminate, and the flash memory device is considered defective. An error is assumed with the time limit over flag if the specified write time is exceeded, or if only data "1" is apparently written, although data "0" is read in read/reset status. Data "0" can be changed to "1" only with an erase operation. All commands are ignored during automatic writing. If a hardware reset is activated during writing, the data being written is not guaranteed. ❍ Write procedure Figure 18.6-1 shows an example of the write procedure. The status of the automatic algorithm in flash memory can be checked using the hardware sequence flag. In the example in Figure 18.6-1, the data polling flag (DQ7) is used to check for termination of the write operation. Data for the flag check is read from the address where the last data was written. The data polling flag (DQ7) changes together with the timing limit over flag (DQ5). Therefore, data polling flag (DQ7) must be rechecked even though timing limit over flag (DQ5) is set to "1". The toggle bit flag (DQ6) also stops toggling simultaneously when the value of timing limit over flag (DQ5) is changed to "1". Therefore, this flag must also be rechecked. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 521 CHAPTER 18 FLASH MEMORY 18.6 Data Writing to and Erasing from Flash Memory MB91313A Series Figure 18.6-1 Example of Flash Memory Programming Procedure Program start FLCR: WE (bit1) Programming of flash memory enabled Programming command sequence AAAAH D5556H 5555H CAAAAH A0A0H D5556H Program address Program data Read internal address Data polling (DQ7) Next address Data Data 0 Time limit (DQ5) 1 Read internal address Data Data polling (DQ7) Data Write error Last address NO YES FLCR : WE(bit1) Programming of flash memory disabled Check with hardware sequence flag Program finished 522 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E MB91313A Series 18.6.3 CHAPTER 18 FLASH MEMORY 18.6 Data Writing to and Erasing from Flash Memory Erasing Data (Chip Erase) This section explains the procedures to erase all items of data in flash memory by issuing chip erase commands. ■ Erasing Data (Chip Erase) To erase all data in flash memory, issue the chip erase command in command sequence table to the target section in flash memory. Six bus operations are necessary to execute a chip erase operation. The operation starts when the sixth write cycle is completed. The user need not write any value to flash memory before chip erase operation. Flash memory automatically writes "0" to erase all cells. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 523 CHAPTER 18 FLASH MEMORY 18.6 Data Writing to and Erasing from Flash Memory 18.6.4 MB91313A Series Erasing Data (Sector Erase) This section explains the procedures to erase specified sectors in flash memory by issuing sector erase commands. Erasure in sector units is possible and two or more sectors can be specified with this command. ■ Sector Erase To erase the sectors, issue the sector erase command continuously to the target sector in the flash memory. ❍ How to specify sectors A sector erase operation can be performed with six bus operations. A 40μs to 160μs sector erase timeout period starts when a sector erase code (3030H) is written to an even-numbered address accessible in the target sector in the sixth cycle. To erase another sector, a sector code (3030H) must be written in the same cycle the same way. ❍ Note on specifying two or more sectors A sector erase operation starts when the 40 μs to 160 μs sector erase time-out period terminates after the final sector erase code is written. Therefore, when two or more sectors are to be specified, the address and erase code of each target sector must be entered within 40 μs (in the sixth cycle of the command sequence) after specifying the preceding sector. Note that an address and erase code not entered within 40 μs may not be accepted. The sector erase timer flag (DQ3) of hardware sequence flag can be used to check the validity of a written sector erase code. The address at which the read sector erase time is written should indicate the target sector. ❍ Sector erase procedure The hardware sequence flag can be used to check the status of the automatic algorithm in flash memory. Figure 18.6-2 shows an example of the sector erase procedure. In this example, the toggle bit flag (DQ6) is used to check for termination of the erase operation. Note that data for the flag check is read from the sector to be erased. The toggle bit flag (DQ6) stops toggling simultaneously when the value of the timing limit over flag (DQ5) changes to "1". Therefore, the toggle bit flag (DQ6) must be rechecked even though the timing limit over flag (DQ5) is set to "1". Because the data polling flag (DQ7) also changes with the timing limit over flag (DQ5), it must also be rechecked. ■ Restrictions on Data Polling Flag (DQ7) Due to restrictions on the function in this series, the data polling flag(DQ7) outputs "1" for 40 μs to 160 μs after the sector erase command is issued, and then outputs "0". After the sector erase is terminated, the flash memory outputs "1". For restrictions on the data polling flag (DQ7) and how to avoid erroneous judgment of sector erase completion, see section "18.7 Restrictions on Data Polling Flag (DQ7) and How to Avoid Erroneous Judgment". 524 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 18 FLASH MEMORY 18.6 Data Writing to and Erasing from Flash Memory MB91313A Series Figure 18.6-2 Example of Sector Erasing Procedure Erase start FLCR : WE(bit1) Flash memory erase enabled Erase commandsequence DAAA8H D5554H DAAA8H DAAA8H D5554H Input to erasesector (3030H) YES AAAAH 5555H 8080H AAAAH 5555H Is there any other sector? NO Internal address read Internal address read 1 Sector erase timer (DQ3) Internal address read 2 Toggle bit (TOGGLE) YES Data 1 = Data 2 ? No erasing specification occurs within 40 µs additionally. Set the flag for starting again from the remainder andsuspend the erasing. NO Timing limit (TLOVER) Internal address read 1 Internal address read 2 : Check by hardware sequtnce flag NO Toggle bit (TOGGLE) Data 1 = Data 2 ? YES Erase error Set the flag for starting again from the remainder ? YES NO FLCR : WE(bit1) Flash memory erase disabled TOGGLE: Toggle bit flag (DQ6) TLOVER: Timing limit over flag (DQ5) CM71-10143-5E Erase complete FUJITSU SEMICONDUCTOR LIMITED 525 CHAPTER 18 FLASH MEMORY 18.6 Data Writing to and Erasing from Flash Memory 18.6.5 MB91313A Series Temporary Sector Erase Stop This section explains the procedures to stop the sector erase operation temporarily by issuing temporary sector erase stop command. When sector erase operation is temporarily stopped by this command, the data can be read from a sector not being erased by using this command. ■ Temporary Sector Erase Stop To stop the sector erase temporarily, issue the temporary sector erase command in command sequence table to target sector in flash memory. This command stops erase operation temporarily, so, data read from a sector not being erased becomes available. Data can only be read from the sector; data cannot be written there. This command is only effective during sector erasure that includes an erase time-out period. It is ignored during chip erase operation and write operation. A sector erase operation is stopped temporarily by writing a temporary erase stop code (B0B0 H). The address where the temporary erase stop code is written should indicate an address in flash memory. A Temporary Sector Erase Stop command issued during temporary erase stop status is ignored. If a Temporary Sector Erase Stop command is entered during a sector erase time-out period, the sector erase time-out is immediately canceled and erase operation in progress is stopped. If a Temporary Sector Erase Stop command is entered during a sector erase operation after the sector erase time-out period elapses, sector erase operation is stopped temporarily after up to 20 μs elapse. 526 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 18 FLASH MEMORY 18.6 Data Writing to and Erasing from Flash Memory MB91313A Series 18.6.6 Sector Erase Restart This section explains how to restart the temporarily stopped sector erase operation by issuing the sector erase restart command. ■ Sector Erase Restart To restart the sector erase which is temporarily stopped, issue the sector erase restart command in command sequence table to target sector in flash memory. Restart operation starts when an erase restart code (3030H) is written. The address where the erase restart code is written should indicate an address in flash memory. Sector Erase Restart commands issued during a sector erase operation are ignored. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 527 CHAPTER 18 FLASH MEMORY 18.7 Restrictions on Data Polling Flag (DQ7) and How to Avoid Erroneous Judgment 18.7 MB91313A Series Restrictions on Data Polling Flag (DQ7) and How to Avoid Erroneous Judgment This series has some restrictions on how to use the data polling flag (DQ7) during execution of the automatic sector erase algorithm. This section describes such restrictions and how to avoid erroneous judgment of sector erase completion. ■ Description of Problems due to Restrictions The data polling flag (DQ7) is used to indicate that the execution of the automatic algorithm is currently in progress or completed, by using the data polling function. In its original operation, as shown in Figure 18.7-1, DQ7 outputs "0" after the sector erase command is issued when the automatic algorithm is being started, and returns to "1" upon the completion of the erase operation. Therefore, the DQ7 polling algorithm indicates the completion of the erase operation by outputting "1". In this series, DQ7 continues to output "1" for 40 μs to 160 μs, after the Sector Erase command is issued, and then it outputs "0". When the erase operation is completed, it then returns to "1". For this reason, if the sector erase polling is started while "1" is still being output immediately after the sector erase command is issued, the erroneous judgment that the erase operation has been completed may occur, although the erase operation has not actually started. The timing for DQ7 to change from "1" to "0" after the sector erase command is accepted is the same as the timing for the sector erase timer flag (DQ3), which indicates the sector erase timeout period, to change from "0" to "1". Figure 18.7-1 Actual Operation of Data Polling Flag (DQ7) Writing the last 3030H by sector erase command Erase completed Signal of internal interruption DQ7 (Normal) DQ7(Problems) First reading 40 μs to 160 μ s DQ3 The following or other problems may occur, as a result of the erroneous judgment that the erase operation has been completed, (1) Runaway or abnormal operation may occur, because the value of the sequence flag is read from the flash memory even when the CPU attempts to fetch instruction/data; therefore, the value of the program cannot be read properly. (2) If the next command is issued after the erroneous judgment that the sector erase operation has been completed occurs, the first command may be cancelled, resulting in a return to the read state, or the next command may not be accepted. 528 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E MB91313A Series ■ CHAPTER 18 FLASH MEMORY 18.7 Restrictions on Data Polling Flag (DQ7) and How to Avoid Erroneous Judgment How to Avoid Problems Use one of the following methods to avoid the problems. ● Polling using the toggle bit flag (DQ6) Determine the state of the automatic algorithm using DQ6, as shown in Figure 18.6-2 in "18.6.4 Data (Sector Erase)" Erasing In the same manner as the data polling flag (DQ7), the toggle bit flag (DQ6) indicates that the automatic algorithm is being executed or has terminated by the toggle bit function. ● Starting polling of DQ7 after the sector erase timeout period elapses Before starting the polling of DQ7, wait for 160μs or more by software after the sector erase command is issued, or wait until DQ3 is set to "1" (end of the sector erase timeout period). Figure 18.7-2 shows the judgment method using DQ3 after the sector erase command is issued. Figure 18.7-2 How to Avoid Problems by Sector Erase Timer Flag (DQ3) P Internal address read 0 Sector erase timer flag (DQ3) 1 Internal address read Data polling flag (DQ7) 1 0 0 Timing limit over flag (DQ5) 1 Internal address read 0 Data polling flag (DQ7) 1 Erase error CM71-10143-5E Sector erase completed FUJITSU SEMICONDUCTOR LIMITED 529 CHAPTER 18 FLASH MEMORY 18.7 Restrictions on Data Polling Flag (DQ7) and How to Avoid Erroneous Judgment ● Data polling using the 8 bits of hardware sequence flags MB91313A Series Make a judgment by data polling using the 8 bits of hardware sequence flags, rather than using only the polling of DQ7. Figure 18.7-3 shows the judgment method using the data polling of the 8 bits after the sector erase command is issued. Figure 18.7-3 How to Avoid Problems by Data Polling of 8 Bits P Internal address read Data (DQ0 to DQ7)? FFH other 0 Timing limit over flag (DQ5) 1 Internal address read other Data (DQ0 to DQ7)? FFH Erase error 530 Sector erase completed FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 18 FLASH MEMORY 18.8 Restriction and Notes MB91313A Series 18.8 Restriction and Notes This section explains the notes on programming flash memory. ■ Restrictions and Notes (1) Do not execute the write access for the following area (I-bus) 0000_0300H to 0000_037FH 0000_03E4H to 0000_03E7H 0000_8000H to 0000_BFFFH 0001_0000H to 0001_FFFFH (2) Do not execute the write access to the FLASH memory at WE=0 of FLCR register. (3) Do not execute the continuous write access for the FLASH memory at WE=1 of FLCR register. Be sure to open more than "NOP"1 instruction. Example: Command write to FLASH (command sequence) => FLASH read Idi #0xAAAA, r0 Idi #0x5555, r1 Idi #0xAAAAA, r6 Idi #0xA5555, r7 Idi #0xA0A0, r8 Idi #PA, r2 Idi #PD, r3 sth nop sth nop sth nop sth nop r0, @r6 : Be sure to open more than "NOP"1 instruction r1, @r7 : Be sure to open more than "NOP"1 instruction r8, @r6 : Be sure to open more than "NOP"1 instruction r3, @r2 : Be sure to open more than "NOP"1 instruction (4) The write access is enabled only the halfword to FLASH memory at the CPU mode. Do not execute the byte write access. (5) Do not execute the branch instruction to the FLASH memory area after rewriting the WE of the FLCR register. When branching to the FLASH area, obey the following program example once the FLCR register value is read. STB LDUB BRA R1, @R2 @R2, R1 _flash_address / / WE=OFF / / FLCR value dummy read / / Branch to the FLASH memory (6) The sector protect cannot be used. (7) Do not guarantee the read value immediately after rewriting to FLASH. Before reading is executed after writing, be sure to insert the dummy read. STH LDUH LDUH CM71-10143-5E r0, @r2, @r3 @r1 r4 r4 / / FLASH write / / Dummy read / / Polling data read FUJITSU SEMICONDUCTOR LIMITED 531 CHAPTER 18 FLASH MEMORY 18.8 Restriction and Notes 532 MB91313A Series FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 19 MB91313A SERIAL PROGRAMMING CONNECTION This chapter explains the serial programming connection for MB91313A. 19.1 Basic Configuration of Serial Programming 19.2 Example of Serial Programming Connection 19.3 System Configuration of Flash Microcontroller Programmer 19.4 Additional Notes CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 533 CHAPTER 19 MB91313A SERIAL PROGRAMMING CONNECTION 19.1 Basic Configuration of Serial Programming 19.1 MB91313A Series Basic Configuration of Serial Programming MB91313A supports serial on-board programming (Fujitsu standard) into flash ROM. This section summarizes its specifications. ■ Basic Configuration of Serial Programming Connection Fujitsu standard serial on-board programming uses the AF420/AF320/AF220/AF210/AF120/AF110 flash microcontroller programmers by Yokogawa Digital Computer Corporation. The following figure shows the basic configuration for the MB91313A serial programming connection. It is possible to choose between the program operated in single-chip mode and the program operated in internal ROM external bus mode and to write. Host interface cable RS232C General-purpose common cable (AZ210) AF420/AF320/ AF220/AF210/ AF120/AF110 Flash microcontroller programmer + memory card CLK synchronous serial MB91313A user system Operable in stand-alone mode Note: Contact Yokogawa Digital Computer Corporation for the functions and use of the flash microcontroller programmer and for information on the general-purpose common cable (AZ210) for connection and relevant connectors. 534 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E CHAPTER 19 MB91313A SERIAL PROGRAMMING CONNECTION 19.1 Basic Configuration of Serial Programming MB91313A Series ■ Pins Used for Fujitsu-standard Serial On-board Programming Pin Function Supplement MD2, MD1, MD0 Mode pins Controls the programming mode. Flash serial programming mode: MD2, MD1, MD0=H, L, L P54/ASX P55/RDX Write program start pins Sets P54="L", P55="H" (clock synchronous mode) during the flash serial reprogramming. INITX, TRSTX Reset pins ICD3 (SIN0) Serial data input pin ICS0 (SOT0) Serial data output pin ICD2 (SCK0) Serial clock input pin VCC Supply-voltage feeder pin Supply the programming voltage from the user system. VSS GND pin Use this pin also to GND of the flash microcontroller programmer. Use the ch.0 resource of UART as an interface for the serial on-board programming communication via the DSU pin. AF420/AF320/ AF220/AF210/ AF120/AF110 Write control pin AF420/AF320/ AF220/AF210/ AF120/AF110 /TICS pin MB91313A Write control pin 10 kΩ User Notes: 1. The control circuit shown above is required for the user system to use the Pxx, ICD3, ICS0, and ICD2 pins. (During serial programming, the user circuit can be isolated by the /TICS signal of the flash microcontroller programmer.) 2. Connect the user system to the flash microcontroller programmer with the user power supply off. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 535 CHAPTER 19 MB91313A SERIAL PROGRAMMING CONNECTION 19.2 Example of Serial Programming Connection 19.2 MB91313A Series Example of Serial Programming Connection This section indicates an example the serial programming connection. ■ Example of Serial Programming Connection Figure 19.2-1 shows an example of the serial programming connection. Figure 19.2-1 Example for Serial Programming Connection MB91313A Flash microcontroller programmer User system MB91313A Connector DX10-28S TAUX3 (19) MD2 For serial reprogramming 1 ≥4.7 kΩ MD1 MD0 User circuit P54 For serial reprogramming 0 For serial reprogramming 1 ≥4.7 kΩ ≥4.7 kΩ P55 User circuit TRSTX ≥4.7 kΩ /TRES (5) TTXD (13) (27) ICD3 (SIN0)* ICS0 (SOT0)* (6) ICD2 (SCK0)* (2) VCC TRXD TCK TVcc GND (7,8, 14,15, 21,22 1,28) 3, 4, 9, 10, 11, 12, 16, 17, 18, 20, 23, 24, 25, and 26 pins are OPEN INITX User power supply (3.3 V) 14 pin VSS 1 pin DX10-28S 28 pin 15 pin Pin assignment of connector DX10-28S: Right-angle type (manufactured by HIROSE ELECTRIC) *:It becomes the ch.0 resource of UART only at the serial programming mode. 536 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E MB91313A Series 19.3 CHAPTER 19 MB91313A SERIAL PROGRAMMING CONNECTION 19.3 System Configuration of Flash Microcontroller Programmer System Configuration of Flash Microcontroller Programmer This section indicates the system configuration of the flash microcontroller programmer (manufactured by Yokogawa Digital Computer Corporation). ■ System Configuration of Flash Microcontroller Programmer Model Function AF220 /AC4P Ethernet interface model /100V to 220V power adapter AF210 /AC4P Standard model /100V to 220V power adapter AF120 /AC4P Single-key Ethernet interface model /100V to 220V power adapter AF110 /AC4P Single-key model Main unit Contact: CM71-10143-5E /100V to 220V power adapter Yokogawa Digital Computer Corporation Phone: (81)-42-333-6224 FUJITSU SEMICONDUCTOR LIMITED 537 CHAPTER 19 MB91313A SERIAL PROGRAMMING CONNECTION 19.4 Additional Notes 19.4 MB91313A Series Additional Notes This section explains the note for the serial programming connection for MB91313A. ■ Note The port state during flash memory programming by the serial programmer is the same as the reset state, except for the pin being used for programming. 538 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E APPENDIX This appendix explains the details not covered in the main topics and other referential information for programming about the I/O map, interrupt vector, pin status of the CPU state, notes and instructions list when using the little endian area. APPENDIX A I/O Map APPENDIX B Vector Table APPENDIX C Pin Status In Each CPU State APPENDIX D Instruction Lists CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 539 APPENDIX APPENDIX A I/O Map MB91313A Series APPENDIX A I/O Map This section shows the correspondence between memory space area and each register of peripheral resources. ■ How to Read I/O Map Address 000000H Register +0 +1 +2 +3 PDR0 [R/W]B PDR1 [R/W]B PDR2 [R/W]B PDR3 [R/W]B XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX Block T-unit port data register Read/write attribute Initial register value after reset Register name (Registers in column 1 are located at 4n addresses, registers in column 2 are located at 4n + 2 addresses, and so on) The leftmost register address (When word access is used, the register in the first column becomes the MSB side of data.) The bit value of a register shows an initial value as follows: "1": Initial value "1" "0": Initial value "0" "X": Initial value "Undefine" "-": No physical register exists at that location. 540 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E APPENDIX APPENDIX A I/O Map MB91313A Series Appendix A-1 I/O Map (1 / 10) Address 000000H 000004H Register 0 PDR0 [R/W] XXXXXXXX PDR4 [R/W] XXXXXXXX 000008H 00000CH PDRC [R/W] XXXXXXXX 1 2 PDR1 [R/W] PDR2 [R/W] XXXXXXXX XXXXXXXX PDR5 [R/W] PDR6 [R/W] XXXXXXXX ----XXXX Reserved PDRD [R/W] PDRE [R/W] XXXXXXXX XXXXXXXX 000010H to 00001CH 000020H 000024H 000028H 00002CH 000030H 000034H ADCTH [R/W] ADCTL [R/W] 00000000 00000000 ADAT0 [R] XXXXXX00_00000000 ADAT2 [R] XXXXXX00_00000000 ADAT4 [R] XXXXXX00_00000000 ADAT6 [R] XXXXXX00_00000000 ADAT8 [R] XXXXXX00_00000000 000048H 00004CH Reserved 000050H TMRLR1 [W] XXXXXXXX XXXXXXXX 000054H Reserved 000058H TMRLR2 [W] XXXXXXXX XXXXXXXX 00005CH Reserved CM71-10143-5E Block Port data register PDRF [R/W] XXXXXXXX Reserved ADCH [R/W] 00000000_00000000 ADAT1 [R] ------XX XXXXXXXX ADAT3 [R] XXXXXX00_00000000 ADAT5 [R] XXXXXX00_00000000 ADAT7 [R] XXXXXX00_00000000 ADAT9 [R] XXXXXX00_00000000 Reserved EIRR0 [R/W] ENIR0 [R/W] 00000000 00000000 DICR [R/W] HRCL [R,R/W] -------0 ---11111 TMRLR0 [W] XXXXXXXX XXXXXXXX 000044H Reserved Reserved 000038H to 00003CH 000040H 3 PDR3 [R/W] XXXXXXXX 10-bit A/D converter Reserved ELVR0 [R/W] 00000000 00000000 External interrupt 0 to 7 Reserved Delay / I-unit TMR0 [R] XXXXXXXX XXXXXXXX TMCSR0 [R,RW] 00000000 00000000 TMR1 [R] XXXXXXXX XXXXXXXX TMCSR1 [R,RW] 00000000 00000000 TMR2 [R] XXXXXXXX XXXXXXXX TMCSR2 [R,RW] 00000000 00000000 FUJITSU SEMICONDUCTOR LIMITED Reload timer 0 Reload timer 1 Reload timer 2 541 APPENDIX APPENDIX A I/O Map MB91313A Series Appendix A-1 I/O Map (2 / 10) Address 000060H 000064H 000068H 00006CH 000070H 000074H 000078H 00007CH 000080H 000084H 000088H 00008CH 000090H 000094H 000098H 00009CH 0000A0H 0000A4H 0000A8H 0000ACH 542 Register 0 1 2 3 SCR0 [R,R/W] SMR0 [W,R/W] SSR0 [R,R/W] ESCR0 [R/W] 0--00000 000-0000 0-000011 --000000 RDR0/TRD0 [R/W] BGR01 [R/W] BGR00 [R/W] -------- 00000000 : RDR0 00000000 00000000 -------- 11111111 : TDR0 ISMK0 [R/W] IBSA [R/W] FCR01 [R/W] FCR00 [R/W] 01111110 00000000 00-00100 00000000 FBYTE01 [R/W] FBYTE00 [R/W] Reserved 00000000 00000000 SCR1 [R,R/W] SMR1 [W,R/W] SSR1 [R,R/W] ESCR1 [R/W] 0--00000 000-0000 0-000011 --000000 RDR1/TDR1 [R/W] BGR11 [R/W] BGR10 [R/W] -------- 00000000 : RDR1 00000000 00000000 -------- 11111111 : TDR1 ISMK1 [R/W] IBSA1 [R/W] FCR11 [R/W] FCR10 [R/W] 01111110 00000000 00-00100 00000000 FBYTE10 [R/W] FBYTE00 [R/W] Reserved Reserved 00000000 00000000 SCR2 [R,R/W] SMR2 [W,R/W] SSR2 [R,R/W] ESCR2 [R/W] 0--00000 000-0000 0-000011 --000000 RDR2/TDR2 [R/W] BGR21 [R/W] BGR20 [R/W] -------- 00000000 : RDR2 00000000 00000000 -------- 11111111 : TDR2 ISMK2 [R/W] IBSA2 [R/W] FCR21 [R/W] FCR20 [R/W] 01111110 00000000 00000000 00000000 FBYTE21 [R/W] FBYTE20 [R/W] Reserved 00000000 00000000 SCR3 [R,R/W] SMR3 [W,R/W] SSR3 [R,R/W] ESCR3 [R/W] 0--00000 000-0000 0-000011 --000000 RDR3/TDR3 [R/W] BGR31 [R/W] BGR30 [R/W] -------- 00000000 : RDR3 00000000 00000000 -------- 11111111 : TDR3 ISMK3 [R/W] IBSA3 [R/W] Reserved 01111110 00000000 Reserved SCR4 [R,R/W] SMR4 [W,R/W] SSR4 [R,R/W] ESCR4 [R/W] 0--00000 00000000 0-000011 --000000 RDR4/TDR4 [R/W] BGR41 [R/W] BGR40 [R/W] -------- 00000000 : RDR4 00000000 00000000 -------- 11111111 : TDR4 ISMK4 [R/W] IBSA4 [R/W] Reserved 01111110 00000000 Reserved FUJITSU SEMICONDUCTOR LIMITED Block Serial interface 0 FIFO 0 Serial interface 1 FIFO 1 Serial interface 2 Serial interface 3 Serial interface 4 CM71-10143-5E APPENDIX APPENDIX A I/O Map MB91313A Series Appendix A-1 I/O Map (3 / 10) Address 0000B0H 0000B4H 0000B8H 0000BCH 0000C0H 0000C4H Register 0 1 2 3 SCR5 [R,R/W] SMR5 [W,R/W] SSR5 [R,R/W] ESCR5 [R/W] 0--00000 00000000 0-000011 --000000 RDR5/TDR5 [R/W] BGR51 [R/W] BGR50 [R/W] -------- 00000000 : RDR5 00000000 00000000 -------- 11111111 : TDR5 ISMK5 [R/W] IBSA5 [R/W] Reserved 01111110 00000000 Reserved EIRR1 [R/W] ENIR1 [R/W] ELVR1 [R/W] 00000000 00000000 00000000 00000000 EIRR2 [R/W] ENIR2 [R/W] ELVR2 [R/W] 00000000 00000000 00000000 00000000 0000C8H to 0000CCH 0000D0H 0000D4H 0000D8H 0000DCH Reserved PWCCL [R/W] PWCCH [R/W] 0000--00 0--00000 PWCD [R] XXXXXXXX XXXXXXXX PWCC2 [R/W] 000----PWCUD [R/W] XXXXXXXX XXXXXXXX 0000E0H to 0000ECH 0000F0H 0000F4H 0000F8H 0000FCH 000100H 000104H 000108H 00010CH 000110H 000114H to 00011CH CM71-10143-5E Serial interface 5 Ext. INT 8 to INT 15 Ext. INT 16 to INT 23 Reserved Reserved Reserved PWC Reserved Reserved Reserved T0LPCR [R/W] T0CCR [R/W] -----000 0-000000 T0DRR [R/W] XXXXXXXX XXXXXXXX T1LPCR [R/W] T1CCR [R/W] -----000 0-000000 T1DRR [R/W] XXXXXXXX XXXXXXXX T2LPCR [R/W] T2CCR [R/W] -----000 0-000000 T2DRR [R/W] XXXXXXXX XXXXXXXX T3LPCR [R/W] T3CCR [R/W] -----000 0-000000 T3DRR [R/W] XXXXXXXX XXXXXXXX TMODE [R/W] 00000000 00000000 Block Reserved T0TCR [R/W] T0R [R/W] 00000000 ---00000 T0CRR [R/W] XXXXXXXX XXXXXXXX T1TCR [R/W] T1R [R/W] 00000000 ---00000 T1CRR [R/W] XXXXXXXX XXXXXXXX T2TCR [R/W] T2R [R/W] 00000000 ---00000 T2CRR [R/W] XXXXXXXX XXXXXXXX T3TCR [R/W] T3R [R/W] 00000000 ---00000 T3CRR [R/W] XXXXXXXX XXXXXXXX Multifunction timer Reserved Reserved FUJITSU SEMICONDUCTOR LIMITED Reserved 543 APPENDIX APPENDIX A I/O Map MB91313A Series Appendix A-1 I/O Map (4 / 10) Address 000120H 000124H 000128H 00012CH 000130H 000134H 000138H 00013CH Register 0 1 PDUT0 [W] XXXXXXXX XXXXXXXX PTMR0 [W] 11111111 11111111 PDUT1 [W] XXXXXXXX XXXXXXXX PTMR1 [W] 11111111 11111111 PDUT2 [W] XXXXXXXX XXXXXXXX PTMR2 [W] 11111111 11111111 PDUT3 [W] XXXXXXXX XXXXXXXX PTMR3 [W] 11111111 11111111 000140H to 000144H TMRLR3 [W] XXXXXXXX XXXXXXXX 00014CH Reserved 000150H TMRLR4 [W] XXXXXXXX XXXXXXXX 000154H Reserved 000158H TMRLR5 [W] XXXXXXXX XXXXXXXX 00015CH Reserved 000180H 000184H 000188H 00018CH 000190H 000194H 000198H 00019CH 544 3 PCSR0 [W] XXXXXXXX XXXXXXXX PCNH0 [R/W] PCNL0 [R/W] 00000000000000PCSR1 [W] XXXXXXXX XXXXXXXX PCNH1 [R/W] PCNL1 [R/W] 00000000000000PCSR2 [W] XXXXXXXX XXXXXXXX PCNH2 [R/W] PCNL2 [R/W] 00000000000000PCSR3 [W] XXXXXXXX XXXXXXXX PCNH3 [R/W] PCNL3 [R/W] 00000000000000Reserved 000148H 000160H to 00017CH 2 PPG0 PPG1 PPG2 PPG3 Reserved TMR3 [R] XXXXXXXX XXXXXXXX TMCSR3 [R,RW] 00000000 00000000 TMR4 [R] XXXXXXXX XXXXXXXX TMCSR4 [R,RW] 00000000 00000000 TMR5 [R] XXXXXXXX XXXXXXXX TMCSR5 [R,RW] 00000000 00000000 Reserved RCCR0 [R/W] RCST0 [R/W] 0---0000 00000000 RCDBHW0 [R/W] Reserved 00000000 RCDT0HH [R] RCDT0HL [R] 00000000 00000000 RCCKD0 [R/W] 00000000 00000000 RCCR1 [R/W] RCST1 [R/W] 0---0000 00000000 RCDBHW1 [R/W] Reserved 00000000 RCDT1HH [R] RCDT1HL [R] 00000000 00000000 RCCKD1 [R/W] 00000000 00000000 Block Reload timer 3 Reload timer 4 Reload timer 5 Reserved RCSHW0 [R/W] 00000000 RCADR01 [R/W] 00000000 RCDT0LH [R] 00000000 RCDAHW0 [R/W] 00000000 RCADR02 [R/W] 00000000 RCDT0LL [R] 00000000 Remote control 0 Reserved RCSHW1 [R/W] 00000000 RCADR11 [R/W] 00000000 RCDT1LH [R] 00000000 RCDAHW1 [R/W] 00000000 RCADR12 [R/W] 00000000 RCDT1LL [R] 00000000 Remote control 1 Reserved FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E APPENDIX APPENDIX A I/O Map MB91313A Series Appendix A-1 I/O Map (5 / 10) Register Address 0 0001A0H to 0001ACH 0001B0H 0001B4H 0001B8H 0001BCH 0001C0H 0001C4H 0001C8H 0001CCH 0001D0H 0001D4H 0001D8H 0001DCH 0001E0H 0001E4H 0001E8H 0001ECH 0001F0H 0001F4H 0001F8H 0001FCH 1 2 3 Reserved SCR6 [R,R/W] SMR6 [W,R/W] SSR6 [R,R/W] ESCR6 [R/W] 0--00000 000-0000 0-000011 --000000 RDR6/TDR6 [R/W] BGR61 [R/W] BGR60 [R/W] -------- 00000000 : RDR6 00000000 00000000 -------- 11111111 : TDR6 ISMK6 [R/W] IBSA6 [R/W] Reserved 01111110 00000000 Reserved SCR7 [R,R/W] SMR7 [W,R/W] SSR7 [R,R/W] ESCR7 [R/W] 0--00000 000-0000 0-000011 --000000 RDR7/TDR7 [R/W] BGR71 [R/W] BGR70 [R/W] -------- 00000000 : RDR7 00000000 00000000 -------- 11111111 : TDR7 ISMK7 [R/W] IBSA7 [R/W] Reserved 01111110 00000000 Reserved SCR8 [R,R/W] SMR8 [W,R/W] SSR8 [R,R/W] ESCR8 [R/W] 0--00000 000-0000 0-000011 --000000 RDR8/TDR8 [R/W] BGR81 [R/W] BGR80 [R/W] -------- 00000000 : RDR8 00000000 00000000 -------- 11111111 : TDR8 ISMK8 [R/W] IBSA8 [R/W] Reserved 01111110 00000000 Reserved SCR9 [R,R/W] SMR9 [W,R/W] SSR9 [R,R/W] ESCR9 [R/W] 0--00000 000-0000 0-000011 --000000 RDR9/TDR9 [R/W] BGR91 [R/W] BGR90 [R/W] -------- 00000000 : RDR9 00000000 00000000 -------- 11111111 : TDR9 ISMK9 [R/W] IBSA9 [R/W] Reserved 01111110 00000000 Reserved SCRA [R,R/W] SMRA [W,R/W] SSRA [R,R/W] ESCRA [R/W] 0--00000 000-0000 0-000011 --000000 RDRA/TDRA [R/W] BGRA1 [R/W] BGRA0 [R/W] -------- 00000000 : RDRA 00000000 00000000 -------- 11111111 : TDRA ISMKA [R/W] IBSAA [R/W] Reserved 01111110 00000000 Reserved CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED Block Reserved Serial interface 6 Serial interface 7 Serial interface 8 Serial interface 9 Serial interface 10 545 APPENDIX APPENDIX A I/O Map MB91313A Series Appendix A-1 I/O Map (6 / 10) Address 000200H 000204H 000208H 00020CH 000210H 000214H 000218H 00021CH 000220H 000224H Register 0 1 2 DMACA0 [R/W] 00000000 00000000 00000000 00000000 DMACB0 [R/W] 00000000 00000000 00000000 00000000 DMACA1 [R/W] 00000000 00000000 00000000 00000000 DMACB1 [R/W] 00000000 00000000 00000000 00000000 DMACA2 [R/W] 00000000 00000000 00000000 00000000 DMACB2 [R/W] 00000000 00000000 00000000 00000000 DMACA3 [R/W] 00000000 00000000 00000000 00000000 DMACB3 [R/W] 00000000 00000000 00000000 00000000 DMACA4 [R/W] 00000000 00000000 00000000 00000000 DMACB4 [R/W] 00000000 00000000 00000000 00000000 000228H to 00023CH Reserved 000240H DMACR [R/W] 0XX00000 XXXXXXXX XXXXXXXX XXXXXXXX 000244H to 0003ECH Reserved 0003F0H 0003F4H 0003F8H 0003FCH 000400H 000404H 000408H 00040CH 000410H 000414H to 00041CH 546 3 BSD0 [W] XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX BSD1 [R/W] XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX BSDC [W] XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX BSRR [R] XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX DDR0 [R/W] B,H DDR1 [R/W] B,H DDR2 [R/W] B,H DDR3 [R/W] B,H 00000000 00000000 00000000 00000000 DDR4 [R/W] B,H DDR5 [R/W] B,H DDR6 [R/W] B,H Reserved 00000000 00000000 ----0000 Reserved DDRC [R/W] B,H DDRD [R/W] B,H DDRE [R/W] B,H Reserved -----000 00000000 00000000 Reserved Reserved FUJITSU SEMICONDUCTOR LIMITED Block DMAC Reserved Bit search module Data direction register Reserved CM71-10143-5E APPENDIX APPENDIX A I/O Map MB91313A Series Appendix A-1 I/O Map (7 / 10) Address 000420H 000424H Register 0 PFR0 [R/W] B,H 00000000 PFR4 [R/W] B,H 00000000 000428H 00042CH PFRC [R/W] B,H -----000 000430H 000434H to 00043CH 000440H 000444H 000448H 00044CH 000450H 000454H 000458H 00045CH 000460H 000464H 000468H 00046CH 1 2 PFR1 [R/W] B,H PFR2 [R/W] B,H 00000000 00000000 PFR5 [R/W] B,H PFR6 [R/W] B,H 00000000 ----0000 Reserved PFRD [R/W] B,H PFRE [R/W] B,H 00000000 00000000 Reserved ICR00 [R,R/W] -11111 ICR04 [R,R/W] -11111 ICR08 [R,R/W] -11111 ICR12 [R,R/W] -11111 ICR16 [R,R/W] -11111 ICR20 [R,R/W] -11111 ICR24 [R,R/W] -11111 ICR28 [R,R/W] -11111 ICR32 [R,R/W] -11111 ICR36 [R,R/W] -11111 ICR40 [R,R/W] -11111 ICR44 [R,R/W] -11111 ICR01 [R,R/W] -11111 ICR05 [R,R/W] -11111 ICR09 [R,R/W] -11111 ICR13 [R,R/W] -11111 ICR17 [R,R/W] -11111 ICR21 [R,R/W] -11111 ICR25 [R,R/W] -11111 ICR29 [R,R/W] -11111 ICR33 [R,R/W] -11111 ICR37 [R,R/W] -11111 ICR41 [R,R/W] -11111 ICR45 [R,R/W] -11111 000484H 000490H STCR [R/W] 00110011 WPR [W] XXXXXXXX Reserved 000488H 00048CH Port function register − Reserved ICR02 [R,R/W] -11111 ICR06 [R,R/W] -11111 ICR10 [R,R/W] -11111 ICR14 [R,R/W] -11111 ICR18 [R,R/W] -11111 ICR22 [R,R/W] -11111 ICR26 [R,R/W] -11111 ICR30 [R,R/W] -11111 ICR34 [R,R/W] -11111 ICR38 [R,R/W] -11111 ICR42 [R,R/W] -11111 ICR46 [R,R/W] -11111 ICR03 [R,R/W] -11111 ICR07 [R,R/W] -11111 ICR11 [R,R/W] -11111 ICR15 [R,R/W] -11111 ICR19 [R,R/W] -11111 ICR23 [R,R/W] -11111 ICR27 [R,R/W] -11111 ICR31 [R,R/W] -11111 ICR35 [R,R/W] -11111 ICR39 [R,R/W] -11111 ICR43 [R,R/W] -11111 ICR47 [R,R/W] -11111 Reserved RSRR [R,R/W] 10000000 CLKR [R/W] 00000000 WPCR [R/W] 00000000 OSCR [R/W] 00000000 CM71-10143-5E Interrupt control unit Reserved TBCR [R/W] 00XXXX00 DIVR0 [R/W] 00000011 OSCCR [R/W] XXXXXXX0 CTBR [W] XXXXXXXX DIVR1 [R/W] 00000000 Clock control unit Reserved Reserved OSCT [R/W] XXXXXXXX Block Reserved Reserved 000470H to 00047CH 000480H 3 PFR3 [R/W] B,H 00000000 Clock timer Reserved FUJITSU SEMICONDUCTOR LIMITED Stabilization wait timer 547 APPENDIX APPENDIX A I/O Map MB91313A Series Appendix A-1 I/O Map (8 / 10) Address Register 0 1 000494H to 0004FCH PCR0 [R/W] 00000000 000504H Reserved PCR1 [R/W] 00000000 PCR5 [R/W] 00000000 000508H to 000510H 000514H to 00051CH 000524H 000530H 000534H to 00056CH 000570H 00057CH to 00063CH 548 Reserved Reserved PCR6 [R/W] ----0000 Reserved Reserved EPFR0 [R/W] 00000000 EPFR4 [R/W] 11111111 Port pull-up control register EPFRC [R/W] -----000 Reserved EPFR1 [R/W] EPFR2 [R/W] 00000000 11111111 EPFR5 [R/W] EPFR6 [R/W] 11111111 ----1000 Reserved EPFRD [R/W] EPFRE [R/W] B,H 00000000 00000000 Reserved EPFR3 [R/W] 11111111 Reserved ADER [R/W] H 00000011 11111111 Reserved Reserved Reserved NSF [R/W] ------00 00000000 Extra port function register EPFRF [R/W] 00000000 Reserved 000574H 000578H Block Reserved 000528H 00052CH 3 Reserved 000500H 000520H 2 EXT/I2C/AD Reserved Reserved Reserved FUJITSU SEMICONDUCTOR LIMITED I2C noise filter Reserved CM71-10143-5E APPENDIX APPENDIX A I/O Map MB91313A Series Appendix A-1 I/O Map (9 / 10) Address 000640H 000644H 000648H 00064CH Register 0 1 ASR0 [R/W] 00000000 00000000 ASR1 [R/W] 00000000 XXXXXXXX ASR2 [R/W] 00000000 XXXXXXXX ASR3 [R/W] 00000000 XXXXXXXX 000650H to 00065C H 000660 H 000664 H 000800 H to 000AFC H 000B00H to 000FFCH CM71-10143-5E Block ACR0 [R/W] 1111XX00 00000000 ACR1 [R/W] 00XX0X00 00X0XXXX ACR2 [R/W] 00XX0X00 00X0XXXX ACR3 [R/W] 00XX0X00 00X0XXXX Ext. bus Interface AWR0 [R/W] 01110000 01011011 AWR2 [R/W] 0XXX0000 0X0X1XXX AWR1 [R/W] 0XXX0000 0X0X1XXX AWR3 [R/W] 0XXX0000 0X0X1XXX Reserved CSER[R/W] 00000001 000684 H 000688 H to 0007F8 H 0007FC H 3 Reserved 000668 H to 00067C H 000680 H 2 Reserved Reserved - Reserved MODR [W] XXXXXXXX Unused Reserved Mode register - Unused Reserved Reserved FUJITSU SEMICONDUCTOR LIMITED 549 APPENDIX APPENDIX A I/O Map MB91313A Series Appendix A-1 I/O Map (10 / 10) Address Register 0 001000H 001004H 001008H 00100CH 001010H 001014H 001018H 00101CH 001020H 001024H 001028H to 006FFCH 007000H 007004H 550 FLCR[R/W] 0000X000 FLWC[R/W] 00011011 1 2 3 Block DMASA0 [R/W] 00000000 00000000 00000000 00000000 DMADA0 [R/W] 00000000 00000000 00000000 00000000 DMASA1 [R/W] 00000000 00000000 00000000 00000000 DMADA1 [R/W] 00000000 00000000 00000000 00000000 DMASA2 [R/W] 00000000 00000000 00000000 00000000 DMADA2 [R/W] 00000000 00000000 00000000 00000000 DMASA3 [R/W] 00000000 00000000 00000000 00000000 DMADA3 [R/W] 00000000 00000000 00000000 00000000 DMASA4 [R/W] 00000000 00000000 00000000 00000000 DMADA4 [R/W] 00000000 00000000 00000000 00000000 DMAC Reserved Reserved Reserved Flash I/F Reserved FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E APPENDIX APPENDIX B Vector Table MB91313A Series APPENDIX B Vector Table This section indicates the interrupt vector table. Appendix B-1 Interrupt Vector (1 / 3) Interrupt Number Interrupt Source Interrupt Level Offset TBR Default Address RN DMAC STOP Source Decimal Hexadecimal Reset 0 0 - 3FCH 000FFFFCH - - Mode vector 1 1 - 3F8H 000FFFF8H - - System-reserved 2 2 - 3F4H 000FFFF4H - - System-reserved 3 3 - 3F0H 000FFFF0H - - System-reserved 4 4 - 3ECH 000FFFECH - - System-reserved 5 5 - 3E8H 000FFFE8H - - System-reserved 6 6 - 3E4H 000FFFE4H - - Coprocessor absence trap 7 7 - 3E0H 000FFFE0H - - Coprocessor error trap 8 8 - 3DCH 000FFFDCH - - INTE instruction 9 9 - 3D8H 000FFFD8H - - System-reserved 10 0A - 3D4H 000FFFD4H - - System-reserved 11 0B - 3D0H 000FFFD0H - - Step trace trap 12 0C - 3CCH 000FFFCCH - - NMI request (tool) 13 0D - 3C8H 000FFFC8H - - Undefined instruction exception 14 0E - 3C4H 000FFFC4H - - System-reserved 15 0F 15(FH) fixation 3C0H 000FFFC0H - - External interrupt 0 16 10 ICR00 3BCH 000FFFBCH - - External interrupt 1 17 11 ICR01 3B8H 000FFFB8H - - External interrupt 2 18 12 ICR02 3B4H 000FFFB4H - - External interrupt 3 19 13 ICR03 3B0H 000FFFB0H - - External interrupt 4 20 14 ICR04 3ACH 000FFFACH - - External interrupt 5 21 15 ICR05 3A8H 000FFFA8H - - External interrupt 6 22 16 ICR06 3A4H 000FFFA4H - - External interrupt 7 23 17 ICR07 3A0H 000FFFA0H - - Reload timer 0 24 18 ICR08 39CH 000FFF9CH - - Reload timer 1 25 19 ICR09 398H 000FFF98H - - Reload timer 2 26 1A ICR10 394H 000FFF94H - - UART0 RX/I2C status 27 1B ICR11 390H 000FFF90H 0 STOP CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 551 APPENDIX APPENDIX B Vector Table MB91313A Series Appendix B-1 Interrupt Vector (2 / 3) Interrupt Number Interrupt Source Interrupt Level Offset TBR Default Address RN DMAC STOP Source Decimal Hexadecimal UART0 TX 28 1C ICR12 38CH 000FFF8CH 3 - UART1 RX/I2C status 29 1D ICR13 388H 000FFF88H 1 STOP UART1 TX 30 1E ICR14 384H 000FFF84H 4 - UART2 RX/I2C status 31 1F ICR15 380H 000FFF80H 2 STOP UART2 TX 32 20 ICR16 37CH 000FFF7CH 5 - UART3 RX/UART3 TX/I C status 33 21 ICR17 378H 000FFF78H - - UART4 RX/UART4 TX /I2C status 34 22 ICR18 374H 000FFF74H - - UART5 RX/UART5 TX/I2C status 35 23 ICR19 370H 000FFF70H - - UART6 RX/UART6 TX /I2C status 36 24 ICR20 36CH 000FFF6CH - - UART7 RX/UART7 TX /I2C status 37 25 ICR21 368H 000FFF68H - - status 38 26 ICR22 364H 000FFF64H - - UART9 RX/UART9 TX/I2C status 39 27 ICR23 360H 000FFF60H - - UART10 RX/UART10 TX/ I2C status 40 28 ICR24 35CH 000FFF5CH - - A/D Converter 41 29 ICR25 358H 000FFF58H - - PPG0 42 2A ICR26 354H 000FFF54H 12 - PWC 43 2B ICR27 350H 000FFF50H - - HDMI-CEC/Remote Controler0,1 44 2C ICR28 34CH 000FFF4CH - - Watch timer 45 2D ICR29 348H 000FFF48H - - Main clock oscillation wait 46 2E ICR30 344H 000FFF44H - - Time-base timer 47 2F ICR31 340H 000FFF40H - - Reload timer 3 48 30 ICR32 33CH 000FFF3CH - - Reload timer 4 49 31 ICR33 338H 000FFF38H - - Reload timer 5 50 32 ICR34 334H 000FFF34H - - PPG1 51 33 ICR35 330H 000FFF30H - - PPG2 52 34 ICR36 32CH 000FFF2CH - - PPG3 53 35 ICR37 328H 000FFF28H - - DMA0 54 36 ICR38 324H 000FFF24H - - DMA1 55 37 ICR39 320H 000FFF20H - - DMA2 56 38 ICR40 31CH 000FFF1CH - - DMA3 57 39 ICR41 318H 000FFF18H - - DMA4 58 3A ICR42 314H 000FFF14H - - External interrupt 8 to 15 59 3B ICR43 310H 000FFF10H - - External interrupt 16 to 23 60 3C ICR44 30CH 000FFF0CH - - Multifunction timer 0, 1 61 3D ICR45 308H 000FFF08H - - 2 UART8 RX/UART8 552 TX/I2C FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E APPENDIX APPENDIX B Vector Table MB91313A Series Appendix B-1 Interrupt Vector (3 / 3) Interrupt Number Interrupt Source Interrupt Level Offset TBR Default Address RN DMAC STOP Source Decimal Hexadecimal Multifunction timer 2, 3 62 3E ICR46 304H 000FFF04H - - Delayed interrupt 63 3F ICR47 300H 000FFF00H - - System-reserved (used in REALOS) 64 40 - 2FCH 000FFEFCH - - System-reserved (used in REALOS) 65 41 - 2F8H 000FFEF8H - - System-reserved 66 42 - 2F4H 000FFEF4H - - System-reserved 67 43 - 2F0H 000FFEF0H - - System-reserved 68 44 - 2ECH 000FFEECH - - System-reserved 69 45 - 2E8H 000FFEE8H - - System-reserved 70 46 - 2E4H 000FFEE4H - - System-reserved 71 47 - 2E0H 000FFEE0H - - System-reserved 72 48 - 2DCH 000FFEDCH - - System-reserved 73 49 - 2D8H 000FFED8H - - System-reserved 74 4A - 2D4H 000FFED4H - - System-reserved 75 4B - 2D0H 000FFED0H - - System-reserved 76 4C - 2CCH 000FFECCH - - System-reserved 77 4D - 2C8H 000FFEC8H - - System-reserved 78 4E - 2C4H 000FFEC4H - - System-reserved 79 4F - 2C0H 000FFEC0H - - Used for INT instruction 80 to 255 50 to FF - 2BCH to 000H 000FFEBCH to 000FFC00H - - CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 553 APPENDIX APPENDIX C Pin Status In Each CPU State MB91313A Series APPENDIX C Pin Status In Each CPU State This appendix describes the pin status in each CPU state. Words and phrases used for the pin status have the following meanings. 1. Input enabled It means that the input function is allowed to be used. 2. Input 0 fix It means that the pin is sending "0" to the internal by blocking the external input at the input gate near the pin. 3. Output Hi-Z It means that the transistor for pin drive is disabled and the pin is set to high impedance. 4. Output Retention It means that the output status used immediately before becoming this mode is output as it is. That is, when internal peripherals are operating, the pin will output by following the peripherals in which the output occurs. When the pin outputs as a port, it will retains the output. 5. Retention of the Status Immediately Before It means that the output status immediately before becoming this mode is output as it is, or for input, it means that the input is enabled. 554 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E APPENDIX APPENDIX C Pin Status In Each CPU State MB91313A Series Appendix C-1 Pin Status in Single-Chip Mode (Internal Vector Mode) (1 / 4) At initialize (INITX=0) Pin No. Pin name Function 3 P23 SIN1 P23 4 P24 SOT1/SDA1 P24 5 P25 SCK1/SCL1 P25 6 P26 SIN2 P26 7 P27 SOT2 P27 8 P30 SCK2 P30 9 P31 TOT0 P31 10 P32 TOT1 P32 11 P33 TOT2 P33 12 P34 TIN0 P34 13 P35 TIN1 P35 14 P36 TIN2 P36 15 P37 RIN P37 16 P40 TMO0/INT16 P40 17 P41 TMO1/INT17 P41 18 P42 TMO2/INT18 P42 19 P43 TMO3/INT19 P43 20 P44 TMI0/INT20 P44 21 P45 TMI1/INT21/SIN10 P45 22 P46 TMI2/INT22/ SOT10/SDA10 P46 23 P47 TMI3/INT23/ SCK10/SCL10 P47 24 P60 TOT3/TRG2 P60 25 P61 TOT4/TRG3 P61 26 P62 TOT5 P62 27 P63 TIN3 P63 28 P64 TIN4 P64 29 P65 TIN5 P65 32 PF0 PF0/RCIN0 PF0 33 PF1 PF1/RCIN1 PF1 34 PF2 PF2/RCACK0 PF2 35 PF3 PF3/RCACK1 PF3 36 PF4 ⎯ PF4 Function CM71-10143-5E At stop* At sleep* Initial value HIZ=0 HIZ=1 Output Hi-Z/ Input 0 fix Output Hi-Z/ Input enabled Retention of the status immediately before FUJITSU SEMICONDUCTOR LIMITED Retention of the status immediately before Output Hi-Z/ Input 0 fix (Can only be set as an input when external interrupts are enabled.) Output Hi-Z/ Input 0 fix 555 APPENDIX APPENDIX C Pin Status In Each CPU State MB91313A Series Appendix C-1 Pin Status in Single-Chip Mode (Internal Vector Mode) (2 / 4) At initialize (INITX=0) Pin No. Pin name Function 37 PF5 ⎯ PF5 38 PF6 ⎯ PF6 39 PF7 ⎯ PF7 45 PD0 AN0 AN0 46 PD1 AN1 AN1 47 PD2 AN2 AN2 48 PD3 AN3 AN3 49 PD4 AN4 AN4 50 PD5 AN5 AN5 51 PD6 AN6 AN6 52 PD7 AN7 AN7 53 PE0 AN8/INT0 AN8 54 PE1 AN9/PPG0/INT1 AN9 55 PE2 PPG1/INT2/ATRG PE2 Function 56 PE3 PPG2/INT3 PE3 58 ⎯ INITX INITX 65 ⎯ MD0 MD0 66 ⎯ MD1 MD1 67 ⎯ MD2 MD2 68 PE4 PPG3/INT4 PE4 69 PE5 SIN8/INT5 PE5 70 PE6 SOT8/SDA8/INT6 PE6 71 PE7 SCK8/SCL8/INT7 PE7 72 PC0 SIN9 PC0 73 PC1 SOT9/SDA9 PC1 74 PC2 SCK9/SCL9 PC2 75 PC3 ⎯ PC3 76 PC4 PPGA PC4 77 PC5 PPGB PC5 78 PC6 TRG0 PC6 79 PC7 TRG1 PC7 80 ⎯ TRSTX TRSTX 556 At stop* At sleep* Initial value HIZ=0 HIZ=1 Output Hi-Z/ Input enabled Output Hi-Z/ Input 0 fix Output Hi-Z/ Input 0 fix Retention of the status immediately before Retention of the status immediately before Output Hi-Z/ Input 0 fix (Can only be set as an input when external interrupts are enabled.) Output Hi-Z/ Input enabled Input enabled Input enabled Input enabled Input enabled Output Hi-Z/ Input 0 fix (Can only be set as an input when external interrupts are enabled.) Output Hi-Z/ Input enabled Retention of the status immediately before Retention of the status immediately before Output Hi-Z/ Input 0 fix Input enabled Input enabled FUJITSU SEMICONDUCTOR LIMITED Input enabled Input enabled CM71-10143-5E APPENDIX APPENDIX C Pin Status In Each CPU State MB91313A Series Appendix C-1 Pin Status in Single-Chip Mode (Internal Vector Mode) (3 / 4) At initialize (INITX=0) Pin No. Pin name Function 81 ⎯ ICD0 ICD0 82 ⎯ ICD1 ICD1 83 ⎯ ICD2 ICD2 84 ⎯ ICD3 ICD3 85 ⎯ ICS0 86 ⎯ 87 At stop* At sleep* Function Initial value HIZ=0 HIZ=1 Output Hi-Z/ Input enabled Retention of the status immediately before Retention of the status immediately before Retention of the status immediately before ICS0 "H" output "L" output "L" output "L" output ICS1 ICS1 "L" output "L" output "L" output "L" output ⎯ ICS2 ICS2 "L" output "L" output "L" output "L" output 88 ⎯ ICLK ICLK Undefined "H" output "H" output "H" output 89 ⎯ IBREAK IBREAK Input enabled Input enabled Input enabled Input enabled CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 557 APPENDIX APPENDIX C Pin Status In Each CPU State MB91313A Series Appendix C-1 Pin Status in Single-Chip Mode (Internal Vector Mode) (4 / 4) At initialize (INITX=0) Pin No. Pin name Function 93 P00 SIN3/INT8 P00 94 P01 SOT3/SDA3/INT9 P01 95 P02 SCK3/SCL3/INT10 P02 96 P03 SIN4/INT11 P03 97 P04 SOT4/SDA4/INT12 P04 98 P05 SCK4/SCL4/INT13 P05 99 P06 SIN5/INT14 P06 100 P07 SOT5/SDA5/INT15 P07 101 P10 SCK5/SCL5 P10 102 P11 SIN6 P11 103 P12 SOT6/SDA6 P12 104 P13 SCK6/SCL6 P13 105 P14 SIN7 P14 Function 106 P15 SOT7/SDA7 P15 107 P16 SCK7/SCL7 P16 108 P17 ⎯ P17 109 P50 PPG0 P50 110 P51 PPG1 P51 111 P52 PPG2 P52 112 P53 PPG3 P53 113 P54 ⎯ P54 114 P55 ⎯ P55 115 P56 ⎯ P56 116 P57 ⎯ P57 117 P20 SIN0 P20 118 P21 SOT0/SDA0 P21 119 P22 SCK0/SCL0 P22 * : P : When set as a general-purpose port 558 At stop* At sleep* Initial value HIZ=0 HIZ=1 Output Hi-Z/ Input 0 fix (Can only be set as an input when external interrupts are enabled.) Output Hi-Z/ Input enabled Retention of the status immediately before Retention of the status immediately before Output Hi-Z/ Input 0 fix F : When specified function is selected FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E APPENDIX APPENDIX C Pin Status In Each CPU State MB91313A Series Appendix C-2 Pin Status in Internal ROM External Bus Mode (Internal Vector Mode) (1 / 4) At initialize (INITX=0) Pin No. Pin name Function 3 P23 SIN1 P23 4 P24 SOT1/SDA1 P24 5 P25 SCK1/SCL1 P25 6 P26 SIN2 P26 7 P27 SOT2 P27 8 P30 SCK2 P30 9 P31 TOT0 P31 10 P32 TOT1 P32 11 P33 TOT2 P33 12 P34 TIN0 P34 13 P35 TIN1 P35 14 P36 TIN2 P36 15 P37 RIN P37 16 P40 TMO0/INT16 P40 17 P41 TMO1/INT17 P41 18 P42 TMO2/INT18 P42 19 P43 TMO3/INT19 P43 20 P44 TMI0/INT20 P44 21 P45 TMI1/INT21/SIN10 P45 22 P46 TMI2/INT22/ SOT10/SDA10 P46 23 P47 TMI3/INT23/ SCK10/SCL10 P47 24 P60 TOT3/TRG2 P60 25 P61 TOT4/TRG3 P61 26 Function P62 CM71-10143-5E TOT5/RDY At stop* At sleep* P62 Initial Value HIZ=0 HIZ=1 Output Hi-Z/ Input 0 fix Retention of the Retention of the status immediately status immediately before before Output Hi-Z/ Input enabled Output Hi-Z/ Input 0 fix (Can only be set as an input when external interrupts are enabled.) P: Retention of the P: Retention of the status status immediately immediately before before F: Retention of the F: Retention of the status status immediately immediately before (TOT5) before (TOT5) CLK output "H" or "L" (CLK) output (CLK) FUJITSU SEMICONDUCTOR LIMITED Output Hi-Z/ Input 0 fix 559 APPENDIX APPENDIX C Pin Status In Each CPU State MB91313A Series Appendix C-2 Pin Status in Internal ROM External Bus Mode (Internal Vector Mode) (2 / 4) Pin No. Pin name At initialize (INITX=0) Function Function 27 P63 TIN3/CLK P63 28 P64 TIN4 P64 29 P65 TIN5 P65 32 PF0 PF0/RCIN0 PF0 33 PF1 PF1/RCIN1 PF1 34 PF2 PF2/RCACK0 PF2 35 PF3 PF3/RCACK1 PF3 36 PF4 ⎯ PF4 37 PF5 ⎯ PF5 38 PF6 ⎯ PF6 39 PF7 ⎯ PF7 45 PD0 AN0 AN0 46 PD1 AN1 AN1 47 PD2 AN2 AN2 48 PD3 AN3 AN3 49 PD4 AN4 AN4 50 PD5 AN5 AN5 51 PD6 AN6 AN6 52 PD7 AN7 AN7 53 PE0 AN8/INT0 AN8 54 PE1 AN9/PPG0/INT1 AN9 55 PE2 PPG1/INT2/ATRG PE2 56 PE3 PPG2/INT3 PE3 58 ⎯ INITX INITX 65 ⎯ MD0 MD0 66 ⎯ MD1 MD1 67 ⎯ MD2 MD2 560 At stop* At sleep* Initial Value HIZ=0 HIZ=1 P: Retention of the P: Retention of the status status immediately immediately before before F: Retention of the F: Retention of the status status immediately immediately before (TIN3) before (TIN3) Retention of the RDY input status (RDY) immediately before (RDY) Output Hi-Z/ Input enabled Output Hi-Z/ Input 0 fix Retention of the Retention of the status immediately status immediately before before Output Hi-Z/ Input 0 fix Output Hi-Z/ Input 0 fix (Can only be set as an input when external interrupts are enabled.) Output Hi-Z/ Input enabled Input enabled Input enabled FUJITSU SEMICONDUCTOR LIMITED Input enabled Input enabled CM71-10143-5E APPENDIX APPENDIX C Pin Status In Each CPU State MB91313A Series Appendix C-2 Pin Status in Internal ROM External Bus Mode (Internal Vector Mode) (3 / 4) At initialize (INITX=0) At stop* Pin No. Pin name Function 68 PE4 PPG3/INT4 PE4 69 PE5 SIN8/INT5 PE5 70 PE6 SOT8/SDA8/INT6 PE6 71 PE7 SCK8/SCL8/INT7 PE7 72 PC0 SIN9 PC0 73 PC1 SOT9/SDA9 PC1 74 PC2 SCK9/SCL9 PC2 75 PC3 ⎯ PC3 76 PC4 PPGA PC4 77 PC5 PPGB PC5 78 PC6 TRG0 PC6 79 PC7 TRG1 PC7 80 ⎯ TRSTX TRSTX 81 ⎯ ICD0 ICD0 82 ⎯ ICD1 ICD1 83 ⎯ ICD2 ICD2 84 ⎯ ICD3 ICD3 85 ⎯ ICS0 ICS0 "H" output "L" output "L" output "L" output 86 ⎯ ICS1 ICS1 "L" output "L" output "L" output "L" output 87 ⎯ ICS2 ICS2 "L" output "L" output "L" output "L" output 88 ⎯ ICLK ICLK Undefined "H" output "H" output "H" output 89 ⎯ IBREAK Input enabled Input enabled Input enabled At sleep* Function CM71-10143-5E Initial Value HIZ=0 HIZ=1 Output Hi-Z/ Input 0 fix (Can only be set as an input when external interrupts are enabled.) Retention of the Retention of the Output Hi-Z/ status immediately status immediately Input enabled before before Output Hi-Z/ Input 0 fix Input enabled Input enabled Input enabled Input enabled Retention of the Retention of the Retention of the Output Hi-Z/ status immediately status immediately status immediately Input enabled before before before IBREAK Input enabled FUJITSU SEMICONDUCTOR LIMITED 561 APPENDIX APPENDIX C Pin Status In Each CPU State MB91313A Series Appendix C-2 Pin Status in Internal ROM External Bus Mode (Internal Vector Mode) (4 / 4) At initialize (INITX=0) Pin No. Pin name Function 93 P00 AD00 P00 94 P01 AD01 P01 95 P02 AD02 P02 96 P03 AD03 P03 97 P04 AD04 P04 98 P05 AD05 P05 99 P06 AD06 P06 100 P07 AD07 P07 101 P10 AD08 P10 102 P11 AD09 P11 103 P12 AD10 P12 104 P13 AD11 P13 105 P14 AD12 P14 106 P15 AD13 P15 107 P16 AD14 P16 108 P17 AD15 P17 109 P50 CS0X/PPG0 P50 110 P51 CS1X/PPG1 P51 111 P52 CS2X/PPG2 P52 112 P53 CS3X/PPG3 P53 113 P54 ASX P54 114 P55 RDX P55 115 P56 WR0X P56 116 P57 WR1X P57 117 P20 SIN0 P20 118 P21 SOT0/SDA0 P21 119 P22 SCK0/SCL0 P22 Function * : P : When set as a general-purpose port 562 At stop* At sleep* Initial Value HIZ=0 HIZ=1 P: Retention of the P: Retention of the status status immediately immediately before before F: Output Reten- F: Output Retention or Hi-Z tion or Hi-Z Output Hi-Z/ Input enabled Output Hi-Z/ Input 0 fix P: Retention of the P: Retention of the status status immediately immediately before before F: "H" output F: "H" output Retention of the Retention of the status immediately status immediately before before F : When specified function is selected FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E APPENDIX APPENDIX C Pin Status In Each CPU State MB91313A Series Appendix C-3 Pin status in serial programming mode (1 / 3) At initialize (INITX=0) Pin No. Pin name Function 3 P23 SIN1 P23 4 P24 SOT1/SDA1 P24 5 P25 SCK1/SCL1 P25 6 P26 SIN2 P26 7 P27 SOT2 P27 8 P30 SCK2 P30 9 P31 TOT0 P31 10 P32 TOT1 P32 11 P33 TOT2 P33 12 P34 TIN0 P34 13 P35 TIN1 P35 14 P36 TIN2 P36 15 P37 RIN P37 16 P40 TMO0/INT16 P40 17 P41 TMO1/INT17 P41 18 P42 TMO2/INT18 P42 19 P43 TMO3/INT19 P43 20 P44 TMI0/INT20 P44 21 P45 TMI1/INT21/SIN10 P45 22 P46 TMI2/INT22/SOT10/SDA10 P46 23 P47 TMI3/INT23/SCK10/SCL10 P47 24 P60 TOT3/TRG2 P60 25 P61 TOT4/TRG3 P61 26 P62 TOT5 P62 27 P63 TIN3 P63 28 P64 TIN4 P64 29 P65 TIN5 P65 32 PF0 PF0/RCIN0 PF0 33 PF1 PF1/RCIN1 PF1 34 PF2 PF2/RCACK0 PF2 35 PF3 PF3/RCACK1 PF3 36 PF4 ⎯ PF4 37 PF5 ⎯ PF5 38 PF6 ⎯ PF6 39 PF7 ⎯ PF7 CM71-10143-5E Function P54="L" * Initial Value P55="H" P55="L" Output Hi-Z/ Input enabled Output Hi-Z/ Input enabled Output Hi-Z/ Input enabled Output Hi-Z/ Input enabled Output Hi-Z/ Input enabled Output Hi-Z/ Input enabled FUJITSU SEMICONDUCTOR LIMITED 563 APPENDIX APPENDIX C Pin Status In Each CPU State MB91313A Series Appendix C-3 Pin status in serial programming mode (2 / 3) At initialize (INITX=0) Pin No. Pin name Function 45 PD0 AN0 AN0 46 PD1 AN1 AN1 47 PD2 AN2 AN2 48 PD3 AN3 AN3 49 PD4 AN4 AN4 50 PD5 AN5 AN5 51 PD6 AN6 AN6 52 PD7 AN7 AN7 53 PE0 AN8/INT0 AN8 54 PE1 AN9/PPG0/INT1 AN9 55 PE2 PPG1/INT2/ATRG PE2 56 PE3 PPG2/INT3 PE3 58 ⎯ INITX INITX 65 ⎯ MD0 MD0 66 ⎯ MD1 MD1 67 ⎯ MD2 MD2 68 PE4 PPG3/INT4 PE4 69 PE5 SIN8/INT5 PE5 70 PE6 SOT8/SDA8/INT6 PE6 71 PE7 SCK8/SCL8/INT7 PE7 72 PC0 SIN9 PC0 73 PC1 SOT9/SDA9 PC1 74 PC2 SCK9/SCL9 PC2 75 PC3 ⎯ PC3 76 PC4 PPGA PC4 77 PC5 PPGB PC5 78 PC6 TRG0 PC6 79 PC7 TRG1 PC7 80 ⎯ TRSTX TRSTX 81 ⎯ ICD0 ICD0 82 ⎯ ICD1 ICD1 83 ⎯ SCK0 SCK0 84 ⎯ SIN0 SIN0 85 ⎯ SOT0 SOT0 564 Function P54="L" * Initial Value P55="H" P55="L" Output Hi-Z/ Input 0 fix Output Hi-Z/ Input 0 fix Output Hi-Z/ Input 0 fix Output Hi-Z/ Input enabled Output Hi-Z/ Input enabled Output Hi-Z/ Input enabled Input enabled Input enabled Input enabled Output Hi-Z/ Input enabled Output Hi-Z/ Input enabled Output Hi-Z/ Input enabled Input enabled Input enabled Input enabled Retention of the status immediately before Retention of the status immediately before Output Hi-Z/ Input enabled Output Hi-Z/ Input enabled Output state Output state Output Hi-Z/ Input enabled "H" output FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E APPENDIX APPENDIX C Pin Status In Each CPU State MB91313A Series Appendix C-3 Pin status in serial programming mode (3 / 3) At initialize (INITX=0) Pin No. Pin name Function 86 ⎯ 87 P54="L" * Function Initial Value P55="H" P55="L" ICS1 ICS1 "L" output "L" output "L" output ⎯ ICS2 ICS2 "L" output "L" output "L" output 88 ⎯ ICLK ICLK Undefined "H" output "H" output 89 ⎯ IBREAK Input enabled Input enabled 93 P00 SIN3/INT8 P00 94 P01 SOT3/SDA3/INT9 P01 95 P02 SCK3/SCL3/INT10 P02 96 P03 SIN4/INT11 P03 97 P04 SOT4/SDA4/INT12 P04 98 P05 SCK4/SCL4/INT13 P05 99 P06 SIN5/INT14 P06 100 P07 SOT5/SDA5/INT15 P07 101 P10 SCK5/SCL5 P10 102 P11 SIN6 P11 103 P12 SOT6/SDA6 P12 104 P13 SCK6/SCL6 P13 105 P14 SIN7 P14 Output Hi-Z/ Input enabled Output Hi-Z/ Input enabled Output Hi-Z/ Input enabled 106 P15 SOT7/SDA7 P15 107 P16 SCK7/SCL7 P16 108 P17 ⎯ P17 109 P50 PPG0 P50 110 P51 PPG1 P51 111 P52 PPG2 P52 112 P53 PPG3 P53 113 P54 ⎯ P54 114 P55 ⎯ P55 115 P56 ⎯ P56 116 P57 ⎯ P57 117 P20 ⎯ P20 118 P21 ⎯ P21 119 P22 ⎯ P22 Output Hi-Z/ Input enabled Output Hi-Z/ Input enabled Output Hi-Z/ Input enabled * : P : When set as a general-purpose port CM71-10143-5E IBREAK Input enabled F : When specified function is selected FUJITSU SEMICONDUCTOR LIMITED 565 APPENDIX APPENDIX D Instruction Lists MB91313A Series APPENDIX D Instruction Lists FR family instruction lists are shown below. [How to read instruction lists] Mnemonic ADD Rj, Rj *ADD #s5, Rj (1) Type A C OP AG A4 CYC 1 1 NZVC CCCC CCCC , , , , , , , , , , (2) (3) (4) (5) (6) Operation Ri + Rj -> Rj Ri + s5 -> Ri Remarks , , (7) (1) Instruction name An asterisk (*) indicates an extended instruction that is not contained in the CPU specifications and is obtained by extension or addition by the assembler. (2) Symbols indicating addressing modes that can be specified for the operand. For the meaning of symbols, see "Addressing Mode Symbols (on the next page)". (3) Instruction format (4) Instruction code in hexadecimal notation (5) Number of machine cycles a: Memory access cycle. It may be extended by the Ready function. b: Memory access cycle. It may be extended by the Ready function. However, the cycle is interlocked if the instruction immediately after refers to a targeted register for LD operation, and the number of execution cycles is increased by 1. c: Interlocked if the instruction immediately after is an instruction that reads or writes to R15, SSP, or USP, or an instruction in instruction format A. The number of execution cycles is increased by 1 and so it becomes 2. d: Interlocked if the instruction immediately after refers to MDH/MDL. The number of execution cycles is increased to 2. The minimum cycle number is 1 for each case a, b, c, and d. (6) Indicating flag changes Flag change C: Change -: No change 0: Clear 1: Set Flag meaning N: Negative flag Z: Zero flag V: Over flag C: Carry flag (7) Instruction operation 566 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E APPENDIX APPENDIX D Instruction Lists MB91313A Series ● Addressing mode symbols Ri : Register direct (R0 to R15, AC, FP, SP) Rj : Register direct (R0 to R15, AC, FP, SP) R13 : Register direct (R13, AC) Ps : Register direct (Program status register) Rs : Register direct (TBR, RP, SSP, USP, MDH, MDL) Cri : Register direct (CR0 to CR15) CRj : Register direct (CR0 to CR15) #i8 : Unsigned 8-bit immediate (-128 to 255) Note: -128 to -1 is handled as 128 to 255. #i20 : Unsigned 20-bit immediate (-0X80000 to 0XFFFFF) Note: -0X7FFFF to -1 is handled as 0X7FFFF to 0XFFFFF. #i32 : Unsigned 32-bit immediate (-0X80000000 to 0XFFFFFFFF) Note: -0X80000000 to -1 is handled as 0X80000000 to 0XFFFFFFFF. CM71-10143-5E #s5 : Signed 5-bit immediate (-16 to 15) #s10 : Signed 10-bit immediate (-512 to 508, multiples of 4 only) #u4 : Unsigned 4-bit immediate (0 to 15) #u5 : Unsigned 5-bit immediate (0 to 31) #u8 : Unsigned 8-bit immediate (0 to 255) #u10 : Unsigned 10-bit immediate (0 to 1020, multiples of 4 only) @dir8 : Unsigned 8-bit direct address (0 to 0XFF) @dir9 : Unsigned 9-bit direct address (0 to 0X1FE, multiples of 2 only) @dir10 : Unsigned 10-bit direct address (0 to 0X3FC, multiples of 4 only) label9 : Signed 9-bit branch address (-0X100 to 0XFC, multiples of 2 only) label12 : Signed 12-bit branch address (-0X800 to 0X7FC, multiples of 2 only) label20 : Signed 20-bit branch address (-0X80000 to 0X7FFFF) label32 : Signed 32-bit branch address (-0X80000000 to 0X7FFFFFFF) @Ri : Register indirect (R0 to R15, AC, FP, SP) @Rj : Register indirect (R0 to R15, AC, FP, SP) @(R13,Rj) : Register relative indirect (Rj: R0 to R15, AC, FP, SP) @(R14,disp10) : Register relative indirect (disp10: -0X200 to 0X1FC, multiples of 4 only) @(R14,disp9) : Register relative indirect (disp9: -0X100 to 0XFE, multiples of 2 only) @(R14,disp8) : Register relative indirect (disp8: -0X80 to 0X7F) @(R15,udisp6) : Register relative indirect (udisp6: 0 to 60, multiples of 4 only) @Ri+ : Register indirect with post-increment (R0 to R15, AC, FP, SP) @R13+ : Register indirect with post-increment (R13, AC) @SP+ : Stack pop @-SP : Stack push (reglist) : Register list FUJITSU SEMICONDUCTOR LIMITED 567 APPENDIX APPENDIX D Instruction Lists MB91313A Series ● Instruction format MSB LSB 16bit A B OP Rj Ri 8 4 4 OP i8/O8 Ri 4 8 4 C OP u4/m4 Ri 8 4 4 ADD, ADDN, CMP, LSL, LSR, and ASR instructions only *C' OP s5/u5 Ri 7 5 4 D OP 8 E F 568 u8/rel8/dir/ reglist 8 OP SUB-OP Ri 8 4 4 OP rel11 5 11 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E APPENDIX APPENDIX D Instruction Lists MB91313A Series Appendix Table D-1 Addition and Subtraction Mnemonic Type OP CYCLE NZVC Operation ADD Rj, Ri *ADD #s5, Ri A C’ A6 A4 1 1 CCCC CCCC Ri+Rj->Ri Ri+s5->Ri ADD #u4, Ri ADD2 #u4, Ri ADDN Rj, Ri ADDN Rj, Ri *ADDN #s5, Ri C C A A C’ A4 A5 A7 A2 A0 1 1 1 1 1 CCCC CCCC CCCC ------- Ri+extu(i4)->Ri Ri+extu(i4)->Ri Ri+Rj+c->Ri Ri+Rj->Ri Ri+s5->Ri ADDN #u4, Ri ADDN2 #u4, Ri SUB Rj, Ri SUBC Rj, Ri SUBN Rj, Ri C C A A A A0 A1 AC AD AE 1 1 1 1 1 ------CCCC CCCC ---- Ri+extu(i4)->Ri Ri+extu(i4)->Ri Ri-Rj->Ri Ri-Rj-c->Ri Ri-Rj->Ri Remarks The assembler treats the highest-order 1 bit as the sign. Zero extension Minus extension Addition with carry The assembler treats the highest-order 1 bit as the sign. Zero extension Minus extension Subtraction with carry Appendix Table D-2 Comparison Operation Mnemonic Type OP CYCLE NZVC CMP Rj, Ri *CMP #s5, Ri A C’ AA A8 1 1 CCCC CCCC Ri-Rj Ri-s5 The assembler treats the highest-order 1 bit as the sign. CMP #u4, Ri CMP2 #u4, Ri C C A8 A9 1 1 CCCC CCCC Ri-extu(i4) Ri-extu(i4) Zero extension Minus extension CM71-10143-5E Operation FUJITSU SEMICONDUCTOR LIMITED Remarks 569 APPENDIX APPENDIX D Instruction Lists MB91313A Series Appendix Table D-3 Logic Operation Mnemonic Type OP CYCLE NZVC A A A A A A A A A A A A 82 84 85 86 92 94 95 96 9A 9C 9D 9E 1 1+2a 1+2a 1+2a 1 1+2a 1+2a 1+2a 1 1+2a 1+2a 1+2a CC-CC-CC-CC-CC-CC-CC-CC-CC-CC-CC-CC-- AND Rj, Ri AND Rj, @Ri ANDH Rj, @Ri ANDB Rj, @Ri OR Rj, Ri OR Rj, @Ri ORH Rj, @Ri ORB Rj, @Ri EOR Rj, Ri EOR Rj, @Ri EORH Rj, @Ri EORB Rj, @Ri Operation RMW Ri & = Rj (Ri) & = Rj (Ri) & = Rj (Ri) & = Rj Ri | = Rj (Ri) | = Rj (Ri) | = Rj (Ri) | = Rj Ri ^ = Rj (Ri) ^ = Rj (Ri) ^ = Rj (Ri) ^ = Rj ❍ ❍ ❍ ❍ ❍ ❍ ❍ ❍ ❍ Remarks Word Word Halfword Byte Word Word Halfword Byte Word Word Halfword Byte Appendix Table D-4 Bit Manipulation Instruction Mnemonic Type OP BANDL #u4, @Ri BANDH #u4, @Ri *BAND #u8, @Ri CYCLE NZVC Operation RMW Remarks C C 80 81 1+2a 1+2a ---------- (Ri)&=(0xF0+u4) (Ri)&=((u4<<4)+0x0F) (Ri)&=u8 ❍ ❍ - Low-order 4 bits are manipulated. High-order 4 bits are manipulated. C C 90 91 1+2a 1+2a ---------- (Ri) | = u4 (Ri) | = (u4<<4) (Ri) | = u8 ❍ ❍ - Low-order 4 bits are manipulated. High-order 4 bits are manipulated. C C 98 99 1+2a 1+2a ---------- (Ri) ^ = u4 (Ri) ^ = (u4<<4) (Ri) ^ = u8 ❍ ❍ - Low-order 4 bits are manipulated. High-order 4 bits are manipulated. C C 88 89 2+a 2+a 0C-CC-- (Ri) & u4 (Ri) & (u4<<4) - Low-order 4 bits are tested. High-order 4 bits are tested. *1 BORL #u4, @Ri BORH #u4, @Ri *BOR #u8, @Ri *2 BEORL #u4, @Ri BEORH #u4, @Ri *BEOR #u8, @Ri *3 BTSTL #u4, @Ri BTSTH #u4, @Ri *1: The assembler generates BANDL if the bit is set at u8&0x0F, and BANDH if the bit is set at u8&0xF0. In some cases, both BANDL and BANDH may be generated. *2: The assembler generates BORL if the bit is set at u8&0x0F, and BORH if the bit is set at u8&0xF0. In some cases, both BORL and BORH are generated. *3: The assembler generates BEORL if the bit is set at u8&0x0F, and BEORH if the bit is set at u8&0xF0. In some cases, both BEORL and BEORH are generated. 570 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E APPENDIX APPENDIX D Instruction Lists MB91313A Series Appendix Table D-5 Multiplication and Division Mnemonic Type OP CYCLE NZVC A A A A E E E E E E AF AB BF BB 97-4 97-5 97-6 97-7 9F-6 9F-7 5 5 3 3 1 1 d 1 1 1 36 CCCCCCCC-CC--------C-C -C-C -------C-C MDL / Ri -> MDL , MDL % Ri -> MDH -C-C MDL / Ri -> MDL , MDL % Ri -> MDH MUL Rj,Ri MULU Rj,Ri MULH Rj,Ri MULUH Rj,Ri DIV0S Ri DIV0U Ri DIV1 Ri DIV2 Ri DIV3 DIV4S *DIV Ri Ri * Rj -> MDH, MDL Ri * Rj -> MDH, MDL Ri * Rj -> MDL Ri * Rj -> MDL *1 *DIVU Ri *2 Operation Remarks 32bit*32bit=64bit No sign 16bit*16bit=32bit No sign Step operation 32bit/32bit=32bit Appendix Table D-6 Shift Mnemonic Type OP CYCLE NZVC Operation A C’ C C A C’ C C A C’ C C B6 B4 B4 B5 B2 B0 B0 B1 BA B8 B8 B9 1 1 1 1 1 1 1 1 1 1 1 1 CC-C CC-C CC-C CC-C CC-C CC-C CC-C CC-C CC-C CC-C CC-C CC-C Ri << Rj -> Ri Ri << u5 -> Ri Ri << u4 -> Ri Ri <<(u4+16) -> Ri Ri >> Rj -> Ri Ri >> u5 -> Ri Ri >> u4 -> Ri Ri >>(u4+16) -> Ri Ri >> Rj -> Ri Ri >> u5 -> Ri Ri >> u4 -> Ri Ri >>(u4+16) -> Ri LSL Rj, Ri *LSL #u5, Ri(u5:0 to 31) LSL #u4, Ri LSL2 #u4, Ri LSR Rj, Ri *LSR #u5, Ri(u5:0 to 31) LSR #u4, Ri LSR2 #u4, Ri ASR Rj, Ri *ASR #u5, Ri (u5:0 to 31) ASR #u4, Ri ASR2 #u4, Ri Remarks Logical shift Logical shift Arithmetic shift Appendix Table D-7 Immediate Value Set/16-Bit/32-Bit Immediate Value Transfer Instruction Mnemonic LDI:32 #i32, Ri LDI:20 #i20, Ri LDI:8 #i8, Ri *LDI # {i8|i20|i32} ,Ri Type OP CYCLE NZVC E C B 9F-8 9B C0 3 2 1 ---------- Operation Remarks i32 -> Ri High-order 12 bits are zero-extended. i20 -> Ri High-order 24 bits are zero-extended. i8 -> Ri {i8 | i20 | i32} -> Ri *3 *1: DIV0S, DIV1 x 32, DIV2, DIV3, and DIV4S are generated. The instruction code length becomes 72 bytes. *2: DIV0U and DIV1 x 32 are generated. The instruction code length becomes 66 bytes. *3: If the immediate value is an absolute value, i8, i20, or i32 is selected automatically by the assembler. If immediate value contains a relative value or an external reference symbol, i32 is selected. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 571 APPENDIX APPENDIX D Instruction Lists MB91313A Series Appendix Table D-8 Memory Load Mnemonic LD @Rj, Ri LD @(R13,Rj), Ri LD @(R14,disp10),Ri LD @(R15,udisp6),Ri LD @R15+, Ri LD @R15+, Rs LD @R15+, PS LDUH @Rj, Ri LDUH @(R13,Rj), Ri LDUH @(R14,disp9), Ri LDUB @Rj, Ri LDUB @(R13,Rj), Ri LDUB @(R14,disp8), Ri Type OP CYCLE NZVC Operation A A B C E E E A A B A A B 04 00 2 03 07-0 07-8 07-9 05 01 4 06 02 6 b b b b b b 1+a+b b b b b b b ------------------CCCC ------------------- (Rj)->Ri (R13+Rj)->Ri (R14+disp10)->Ri (R15+udisp6)->Ri (R15)->Ri,R15+=4 (R15)->Rs,R15+=4 (R15)->PS, R15+=4 (Rj)->Ri (R13+Rj)->Ri (R14+disp9)->Ri (Rj)->Ri (R13+Rj)->Ri (R14+disp8)->Ri Remarks Rs: Special register *1 Zero extension Zero extension Zero extension Zero extension Zero extension Zero extension *1: In the o8 and o4 fields of the hardware specifications, the assembler calculates values and sets them as shown below: disp10/4->o8, disp9/2->o8, disp8->o8, disp10, disp9, and disp8 have a sign, udisp6/4->o4 udisp6 has no sign. Appendix Table D-9 Memory Store Mnemonic ST Ri,@Rj ST Ri,@(R13,Rj) ST Ri,@(R14,disp10) ST Ri,@(R15,udisp6) ST Ri,@-R15 ST Rs,@-R15 ST PS,@-R15 STH Ri,@Rj STH Ri,@(R13,Rj) STH Ri,@(R14,disp9) STB Ri,@Rj STB Ri,@(R13,Rj) STB Ri,@(R14,disp8) Type OP CYCLE NZVC Operation A A B C E E E A A B A A B 14 10 3 13 17-0 17-8 17-9 15 11 5 16 12 7 a a a a a a a a a a a a a ---------------------------------------- Ri->(Rj) Ri->(R13+Rj) Ri->(R14+disp10) Ri->(R15+udisp6) R15-=4,Ri->(R15) R15-=4, Rs->(R15) R15-=4, PS->(R15) Ri->(Rj) Ri->(R13+Rj) Ri->(R14+disp9) Ri->(Rj) Ri->(R13+Rj) Ri->(R14+disp8) Remarks Word Word Word Rs Special register *1 Halfword Halfword Halfword Byte Byte Byte *1: In the o8 and o4 fields of the hardware specifications, the assembler calculates values and sets them as shown below: disp10/4->o8, disp9/2->o8, disp8->o8, disp10, disp9, and disp8 have a sign, udisp6/4->o4 udisp6 has no sign. Appendix Table D-10 Register-to-Register Transfer Mnemonic MOV MOV MOV MOV MOV *1: 572 Rj, Ri Rs, Ri Ri, Rs PS, Ri Ri, PS Type OP CYCLE NZVC A A E E E 8B B7 B3 17-1 07-1 1 1 1 1 c ------------CCCC Operation Rj -> Ri Rs -> Ri Ri -> Rs PS -> Ri Ri -> PS Remarks Transfer between generalpurpose registers Rs: Special register Rs: Special register *1 Special register Rs: TBR, RP, USP, SSP, MDH, and MDL FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E APPENDIX APPENDIX D Instruction Lists MB91313A Series Appendix Table D-11 Normal Branch (No Delay) Mnemonic Type OP CYCLE NZVC JMP @Ri CALL label12 CALL @Ri RET INT #u8 E E F E D 97-0 D0 97-1 97-2 1F 2 2 2 2 3+3a ---------------- INTE E 9F-3 3+3a ---- RETI BRA label9 BNO label9 BEQ label9 E D D D 97-3 E0 E1 E2 2+2A 2 1 2/1 CCCC ---------- BNE label9 BC label9 BNC label9 BN label9 BP label9 BV label9 BNV label9 BLT label9 BGE label9 BLE label9 BGT label9 BLS label9 BHI label9 D D D D D D D D D D D D D E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF 2/1 2/1 2/1 2/1 2/1 2/1 2/1 2/1 2/1 2/1 2/1 2/1 2/1 ---------------------------------------- Operation Remarks Ri -> PC PC+2->RP , PC+2+(label12-PC-2)->PC PC+2->RP ,Ri->PC RP -> PC Return SSP-=4, PS->(SSP), SSP-=4, PC+2->(SSP), 0->I Flag, 0->S Flag, (TBR+0x3FC-u8 × 4)->PC SSP-=4, PS->(SSP), SSP-=4, PC+2->(SSP), 0->S Flag,(TBR+0x3D8)->PC For emulator (R15)->PC,R15-=4,(R15)->PS,R15-=4 PC+2+(label9-PC-2)->PC No branch if(Z==1) then PC+2+(label9-PC-2)->PC ↑ s/Z==0 ↑ s/C==1 ↑ s/C==0 ↑ s/N==1 ↑ s/N==0 ↑ s/V==1 ↑ s/V==0 ↑ s/V xor N==1 ↑ s/V xor N==0 ↑ s/(V xor N) or Z==1 ↑ s/(V xor N) or Z==0 ↑ s/C or Z==1 ↑ s/C or Z==0 Notes: • "2/1" under CYCLE indicates "2" cycles when branching occurs and "1" cycle when branching does not occur. • In the rel11 and rel8 fields of the hardware specifications, the assembler calculates values and sets them as shown below: (label12-PC-2)/2->rel11, (label9-PC-2)/2->rel8, label12 and label9 have a sign. • To execute the RETI instruction, the S flag must be set to "0". CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 573 APPENDIX APPENDIX D Instruction Lists MB91313A Series Appendix Table D-12 Delayed Branch Mnemonic Type OP CYCLE NZVC JMP:D @Ri CALL:D label12 CALL:D @Ri RET:D BRA:D label9 BNO:D label9 BEQ:D label9 E F E E D D D 9F-0 D8 9F-1 9F-2 F0 F1 F2 1 1 1 1 1 1 1 ---------------------- BNE:D label9 BC:D label9 BNC:D label9 BN:D label9 BP:D label9 BV:D label9 BNV:D label9 BLT:D label9 BGE:D label9 BLE:D label9 BGT:D label9 BLS:D label9 BHI:D label9 D D D D D D D D D D D D D F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF 1 1 1 1 1 1 1 1 1 1 1 1 1 ---------------------------------------- Operation Remarks Ri -> PC PC+4->RP , PC+2+(label12-PC-2)->PC PC+4->RP ,Ri->PC RP -> PC Return PC+2+(label9-PC-2)->PC No branch if(Z==1) then PC+2+(label9-PC-2)->PC ↑ s/Z==0 ↑ s/C==1 ↑ s/C==0 ↑ s/N==1 ↑ s/N==0 ↑ s/V==1 ↑ s/V==0 ↑ s/V xor N==1 ↑ s/V xor N==0 ↑ s/(V xor N) or Z==1 ↑ s/(V xor N) or Z==0 ↑ s/C or Z==1 ↑ s/C or Z==0 Notes: • In the rel11 and rel8 fields of the hardware specifications, the assembler calculates values and sets them as shown below: (label12-PC-2)/2->rel11, (label9-PC-2)/2->rel8, label12 and label9 have a sign. • A delayed branch always occurs after the next instruction (delay slot) is executed. • Instructions that can be placed in the delay slot are all 1-cycle, a-, b-, c-, and d-cycle instructions. Multi-cycle instructions cannot be placed in the delay slot. 574 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E APPENDIX APPENDIX D Instruction Lists MB91313A Series Appendix Table D-13 Other Instructions Mnemonic Type OP CYCLE NZVC NOP ANDCCR #u8 ORCCR #u8 STILM #u8 ADDSP #s10 *1 EXTSB Ri EXTUB Ri EXTSH Ri EXTUH Ri LDM0 (reglist) E D D D D E E E E D 9F-A 83 93 87 A3 97-8 97-9 97-A 97-B 8C 1 c c 1 1 1 1 1 1 ---cccc cccc ---------------------- LDM1 (reglist) D 8D ------- *LDM (reglist) *2 STM0 (reglist) D 8E ---- STM1 (reglist) D 8F ------- *STM (reglist) *3 D 0F 1+a ---- LEAVE E 9F-9 b ---- XCHB @Rj, Ri A 8A 2a ---- ENTER #u10 *4 Operation No change CCR and u8 -> CCR CCR or u8 -> CCR i8 -> ILM R15 += s10 Sign extension 8->32bit Zero extension 8->32bit Sign extension 16->32bit Zero extension 16->32bit (R15)->reglist, R15 increment (R15)->reglist, R15 increment (R15)->reglist, R15 increment R15 decrement reglist->(R15) R15 decrement reglist->(R15) R15 decrement reglist->(R15) R14 -> (R15 - 4), R15 - 4 -> R14, R15 - u10 -> R15 R14 + 4 -> R15, (R15 - 4) -> R14 Ri -> TEMP (Rj) -> Ri TEMP -> (Rj) RMW - Remarks ILM Immediate set ADD SP instruction Load multi R0-R7 - Load multi R8-R15 - Load multi R0-R15 - Store multi R0-R7 - Store multi R8-R15 - Store multi R0-R15 - Entry processing of a function - Exit processing of a function For semaphore management Byte data ❍ *1: For s10, the assembler calculates s10/4 and then changes to s8 to set a value. s10 has a sign. *2: If any of R0 to R7 is specified in reglist, LDM0 is generated, and if any of R8 to R15 is specified, LDM1 is generated. In some cases, both LDM0 and LDM1 are generated. *3: If any of R0 to R7 is specified in reglist, STM0 is generated, and if any of R8 to R15 is specified, STM1 is generated. In some cases, both STM0 and STM1 are generated. *4: For u10, the assembler calculates u10/4 and then changes to u8 to set a value. u10 has no sign. Notes: • The number of execution cycles of LDM0(reglist) and LDM1(reglist) can be calculated as a × (n-1)+b+1 cycles if the number of specified registers is n. • The number of execution cycles of STM0(reglist) and STM1(reglist) can be calculated as a × n+1 cycles if the number of specified registers is n. CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 575 APPENDIX APPENDIX D Instruction Lists MB91313A Series Appendix Table D-14 20-Bit Normal Branch Macro Instruction Mnemonic Operation *CALL20 label20,Ri Address of the next instruction ->RP, label20->PC label20->PC if(Z==1) then label20->PC ↑ s/Z==0 ↑ s/C==1 ↑ s/C==0 ↑ s/N==1 ↑ s/N==0 ↑ s/V==1 ↑ s/V==0 ↑ s/V xor N==1 ↑ s/V xor N==0 ↑ s/(V xor N) or Z==1 ↑ s/(V xor N) or Z==0 ↑ s/C or Z==1 ↑ s/C or Z==0 *BRA20 label20,Ri *BEQ20 label20,Ri *BNE20 label20,Ri *BC20 label20,Ri *BNC20 label20,Ri *BN20 label20,Ri *BP20 label20,Ri *BV20 label20,Ri *BNV20 label20,Ri *BLT20 label20,Ri *BGE20 label20,Ri *BLE20 label20,Ri *BGT20 label20,Ri *BLS20 label20,Ri *BHI20 label20,Ri Remarks Ri: Temporary register (See Reference 1) Ri: Temporary register (See Reference 2) Ri: Temporary register (See Reference 3) ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ [Reference 1] CALL20 (1) If label20-PC-2 is between -0x800 and +0x7fe, the following instruction will be generated: CALL label12 (2) If label20-PC-2 is outside the range of (1) or contains an external reference symbol, the following instruction will be generated: LDI:20 #label20,Ri CALL @Ri [Reference 2] BRA20 (1) If label20-PC-2 is between -0x100 and +0xfe, the following instruction will be generated: BRA label9 (2) If label20-PC-2 is outside the range of (1) or contains an external reference symbol, the following instruction will be generated: LDI:20 #label20,Ri JMP @Ri [Reference 3] Bcc20 (1) If label20-PC-2 is between -0x100 and +0xfe, the following instruction will be generated: Bcc label9 (2) If label20-PC-2 is outside the range of (1) or contains an external reference symbol, the following instruction will be generated: Bxcc false xcc is the opposite condition of cc. LDI:20 #label20,Ri JMP @Ri false: 576 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E APPENDIX APPENDIX D Instruction Lists MB91313A Series Appendix Table D-15 20-Bit Delayed Branch Macro Instruction Mnemonic Operation *CALL20:D label20,Ri *BRA20:D label20,Ri *BEQ20:D label20,Ri *BNE20:D label20,Ri *BC20:D label20,Ri *BNC20:D label20,Ri *BN20:D label20,Ri *BP20:D label20,Ri *BV20:D label20,Ri *BNV20:D label20,Ri *BLT20:D label20,Ri *BGE20:D label20,Ri *BLE20:D label20,Ri *BGT20:D label20,Ri *BLS20:D label20,Ri *BHI20:D label20,Ri Address of the next instruction +2->RP, label20->PC label20->PC if(Z==1) then label20->PC ↑ s/Z==0 ↑ s/C==1 ↑ s/C==0 ↑ s/N==1 ↑ s/N==0 ↑ s/V==1 ↑ s/V==0 ↑ s/V xor N==1 ↑ s/V xor N==0 ↑ s/(V xor N) or Z==1 ↑ s/(V xor N) or Z==0 ↑ s/C or Z==1 ↑ s/C or Z==0 Remarks RRi: Temporary register (See Reference 1) Ri: Temporary register (See Reference 2) Ri: Temporary register (See Reference 3) ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ [Reference 1] CALL20:D (1) If label20-PC-2 is between -0x800 and +0x7fe, the following instruction will be generated: CALL:D label12 (2) If label20-PC-2 is outside the range of (1) or contains an external reference symbol, the following instruction will be generated: LDI:20 #label20,Ri CALL:D @Ri [Reference 2] BRA20:D (1) If label20-PC-2 is between -0x100 and +0xfe, the following instruction will be generated: BRA:D label9 (2) If label20-PC-2 is outside the range of (1) or contains an external reference symbol, the following instruction will be generated: LDI:20 #label20,Ri JMP:D @Ri [Reference 3] Bcc20:D (1) If label20-PC-2 is between -0x100 and +0xfe, the following instruction will be generated: Bcc:D label9 (2) If label20-PC-2 is outside the range of (1) or contains an external reference symbol, the following instruction will be generated: Bxcc false xcc is the opposite condition of cc. LDI:20 #label20,Ri JMP:D @Ri false: CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 577 APPENDIX APPENDIX D Instruction Lists MB91313A Series Appendix Table D-16 32-Bit Normal Branch Macro Instruction Mnemonic Operation *CALL32 label32,Ri Address of the next instruction ->RP, label32->PC label32->PC if(Z==1) then label32->PC ↑ s/Z==0 ↑ s/C==1 ↑ s/C==0 ↑ s/N==1 ↑ s/N==0 ↑ s/V==1 ↑ s/V==0 ↑ s/V xor N==1 ↑ s/V xor N==0 ↑ s/(V xor N) or Z==1 ↑ s/(V xor N) or Z==0 ↑ s/C or Z==1 ↑ s/C or Z==0 *BRA32 label32,Ri *BEQ32 label32,Ri *BNE32 label32,Ri *BC32 label32,Ri *BNC32 label32,Ri *BN32 label32,Ri *BP32 label32,Ri *BV32 label32,Ri *BNV32 label32,Ri *BLT32 label32,Ri *BGE32 label32,Ri *BLE32 label32,Ri *BGT32 label32,Ri *BLS32 label32,Ri *BHI32 label32,Ri Remarks Ri: Temporary register (See Reference 1) Ri: Temporary register (See Reference 2) Ri: Temporary register (See Reference 3) ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ [Reference 1] CALL32 (1) If label32-PC-2 is between -0x800 and +0x7fe, the following instruction will be generated: CALL label12 (2) If label32-PC-2 is outside the range of (1) or contains an external reference symbol, the following instruction will be generated: LDI:32 #label32,Ri CALL @Ri [Reference 2] BRA32 (1) If label32-PC-2 is between -0x100 and +0xfe, the following instruction will be generated: BRA label9 (2) If label32-PC-2 is outside the range of (1) or contains an external reference symbol, the following instruction will be generated: LDI:32 #label32,Ri JMP @Ri [Reference 3] Bcc32 (1) If label32-PC-2 is between -0x100 and +0xfe, the following instruction will be generated: Bcc label9 (2) If label32-PC-2 is outside the range of (1) or contains an external reference symbol, the following instruction will be generated: Bxcc false xcc is the opposite condition of cc. LDI:32 #label32,Ri JMP @Ri false: 578 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E APPENDIX APPENDIX D Instruction Lists MB91313A Series Appendix Table D-17 32-Bit Delayed Branch Macro Instruction Mnemonic Operation *CALL32D label32,Ri Address of the next instruction +2->RP, label32->PC label32->PC if(Z==1) then label32->PC ↑ s/Z==0 ↑ s/C==1 ↑ s/C==0 ↑ s/N==1 ↑ s/N==0 ↑ s/V==1 ↑ s/V==0 ↑ s/V xor N==1 ↑ s/V xor N==0 ↑ s/(V xor N) or Z==1 ↑ s/(V xor N) or Z==0 ↑ s/C or Z==1 ↑ s/C or Z==0 *BRA32:D label32,Ri *BEQ32:D label32,Ri *BNE32:D label32,Ri *BC32:D label32,Ri *BNC32:D label32,Ri *BN32:D label32,Ri *BP32:D label32,Ri *BV32:D label32,Ri *BNV32:D label32,Ri *BLT32:D label32,Ri *BGE32:D label32,Ri *BLE32:D label32,Ri *BGT32:D label32,Ri *BLS32:D label32,Ri *BHI32:D label32,Ri Remarks Ri: Temporary register (See Reference 1) Ri: Temporary register (See Reference 2) Ri: Temporary register (See Reference 3) ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ [Reference 1] CALL32:D (1) If label32-PC-2 is between -0x800 and +0x7fe, the following instruction will be generated: CALL:D label12 (2) If label32-PC-2 is outside the range of (1) or contains an external reference symbol, the following instruction will be generated: LDI:32 #label32,Ri CALL:D @Ri [Reference 2] BRA32:D (1) If label32-PC-2 is between -0x100 and +0xfe, the following instruction will be generated: BRA:D label9 (2) If label32-PC-2 is outside the range of (1) or contains an external reference symbol, the following instruction will be generated: LDI:32 #label32,Ri JMP:D @Ri [Reference 3] Bcc32:D (1) If label32-PC-2 is between -0x100 and +0xfe, the following instruction will be generated: Bcc:D label9 (2) If label32-PC-2 is outside the range of (1) or contains an external reference symbol, the following instruction will be generated: Bxcc false xcc is the opposite condition of cc. LDI:32 #label32,Ri JMP:D @Ri false: CM71-10143-5E FUJITSU SEMICONDUCTOR LIMITED 579 APPENDIX APPENDIX D Instruction Lists MB91313A Series Appendix Table D-18 Direct Addressing Mnemonic DMOV @dir10, R13 DMOV R13, @dir10 DMOV @dir10, @R13+ DMOV @R13+, @dir10 DMOV @dir10, @-R15 DMOV @R15+, @dir10 DMOVH @dir9, R13 DMOVH R13, @dir9 DMOVH @dir9, @R13+ DMOVH @R13+, @dir9 DMOVB @dir8, R13 DMOVB R13, @dir8 DMOVB @dir8, @R13+ DMOVB @R13+, @dir8 Type OP CYCLE NZVC D D D D D D D D D D D D D D 08 18 0C 1C 0B 1B 09 19 0D 1D 0A 1A 0E 1E b a 2a 2a 2a 2a b a 2a 2a b a 2a 2a ------------------------------------------- Operation Remarks (dir10)-> R13 R13 ->(dir10) (dir10)->(R13),R13+=4 (R13)->(dir10),R13+=4 R15-=4,(R15)->(dir10) (R15)->(dir10),R15+=4 (dir9)-> R13 R13 ->(dir9) (dir9)->(R13),R13+=2 (R13)->(dir9),R13+=2 (dir8)-> R13 R13 ->(dir8) (dir8)->(R13),R13++ (R13)->(dir8),R13++ Word Word Word Word Word Word Halfword Halfword Halfword Halfword Byte Byte Byte Byte Note: In the dir8, dir9, and dir10 fields, the assembler calculates values and sets them as shown below: dir8->dir, dir9/2->dir, dir10/4->dir dir8, dir9, and dir10 have no sign. Appendix Table D-19 Resource Instruction Mnemonic Type OP CYCLE NZVC LDRES @Ri+, #u4 C BC a ---- STRES #u4, @Ri+ C BD a ---- Operation Resource of u4 Ri+=4 Resource of u4->(Ri) Ri+=4 Remarks u4: Channel No. u4: Channel No. Note: These instructions cannot be used in this MB91313A series since resource having channel number is not installed. Appendix Table D-20 Coprocessor Control Instruction {CRi|CRj} := CR0 | CR1 | CR2 | CR3 | CR4 | CR5 | CR6 | CR7 | CR8 | CR9 | CR10 | CR11 | CR12 | CR13 | CR14 | | CR15 u4: := Specify channel u8: := Specify command COPOP COPLD COPST COPSV Mnemonic Type OP CYCLE NZVC #u4, #u8, CRj, Cri #u4, #u8, Rj, Cri #u4, #u8, CRj, Ri #u4, #u8, CRj, Ri E E E E 9F-C 9F-D 9F-E 9F-F 2+a 1+2a 1+2a 1+2a ------------- Operation Remarks Operation instruction Rj -> CRi No error stop CRj -> Ri CRj -> Ri Note: These instructions cannot be used in this MB91313A series since coprocessor is not installed. 580 FUJITSU SEMICONDUCTOR LIMITED CM71-10143-5E INDEX INDEX The index follows on the next page. This is listed in alphabetic order. 581 INDEX Index Numerics A 0 Detection 0 Detection ...................................................... 261 0 Detection Data Register 0 Detection Data Register (BSD0) ..................... 259 1 Detection 1 Detection ...................................................... 261 1 Detection Data Register 1 Detection Data Register (BSD1) ..................... 259 10-bit A/D Converter 10-bit A/D Converter............................................ 3 Features of the 10-Bit A/D Converter ................. 266 16-Bit Pulse Width Counter Registers of the 16-Bit Pulse Width Counter ....... 192 16-Bit Reload Register Bit Configuration of 16-Bit Reload Register (TMRLR) ........................................... 170 16-bit Reload Timer 16-bit Reload Timer (Including One Channel for REALOS) ...... 3 Notes on Using 16-Bit Reload Timer.................. 176 Overview of 16-Bit Reload Timer...................... 164 Register List of 16-Bit Reload Timer.................. 165 16-Bit Timer Register Bit Configuration of 16-Bit Timer Register (TMR)................................................ 169 2-Cycle Transfer 2-Cycle Transfer (External→I/O) (TYP[3:0]=0000B,AWR=0008H) .......... 137 2-Cycle Transfer (I/O→External) (TYP[3:0]=0000B,AWR=0008H) .......... 138 2-Cycle Transfer (The Timing is the Same as for Internal RAM→External I/O,RAM,External I/O, RAM→Internal RAM.) (TYP[3:0]=0000B, AWR=0008H) ......... 136 7-bit Slave Address Mask Register 7-bit Slave Address Mask Register (ISMK) ........ 393 7-bit Slave Address Register 7-bit Slave Address Register (ISBA) .................. 394 A/D Conversion A/D Conversion Started by External Trigger ...... 271 A/D Conversion Started by Software ................. 270 A/D Conversion Result Register A/D Conversion Result Register (Channels 0 to 9) ......................................................... 270 A/D Converter 10-bit A/D Converter ........................................... 3 Features of the 10-Bit A/D Converter................. 266 A/D Converter Control Register A/D Converter Control Register (ADCTH, ADCTL) ............................. 268 Absence Trap Coprocessor Absence Trap ................................. 63 Acceptance Acceptance and Transfer of Transfer Request ..... 472 Acknowledgment Reception Acknowledgment Reception by Transmitting First Byte................................................... 408 ADCT A/D Converter Control Register (ADCTH, ADCTL) ............................. 268 Address Match Detection Slave Address Match Detection......................... 424 Address/Data Multiplex Access Normal Access or a Address/Data Multiplex Access Operation ........................................... 127 Addressing Addressing Mode............................................. 469 Direct Addressing .............................................. 33 Direct Addressing Area ...................................... 26 ADER ADER: External Bus,I2C Bridge,ADER Control Register ............................................. 161 ADER Control Register ADER: External Bus,I2C Bridge,ADER Control Register ............................................. 161 Alignment Word Alignment ................................................ 44 All-H Examples of Methods of All-L and All-H PPG Output ......................................................... 188 All-L Examples of Methods of All-L and All-H PPG Output ......................................................... 188 Arbitration Lost Arbitration Lost ............................................... 423 582 INDEX Area Configuration Register ACR0 to ACR3 (Area Configuration Register) .......................................................... 122 Area Select Register ASR0 to ASR3 (Area Select Register) ............... 121 Area Wait Register AWR0 to AWR3 (Area Wait Register) .............. 126 Arithmetic Operation Arithmetic Operation.......................................... 32 Arithmetic Operation and Bit Manipulation .......... 33 ASR ASR0 to ASR3 (Area Select Register) ............... 121 Asynchronous Functions of UART (Asynchronous Multi Function Serial Interface) .................................. 277 Register List of UART (Asynchronous Multi Function Serial Interface) .................................. 278 Asynchronous Multi Function Serial Interface Functions of UART (Asynchronous Multi Function Serial Interface) .................................. 277 Register List of UART (Asynchronous Multi Function Serial Interface) .................................. 278 Automatic Algorithm Automatic Algorithm Execution Status .............. 510 AVCC AVCC Pin......................................................... 21 AWR 2-Cycle Transfer (External→I/O) (TYP[3:0]=0000B,AWR=0008H).......... 137 2-Cycle Transfer (I/O→External) (TYP[3:0]=0000B,AWR=0008H).......... 138 AWR0 to AWR3 (Area Wait Register) .............. 126 Setting of CSX →RDX/WRX Setup (TYP[3:0]=0101B,AWR=100BH) ......... 135 With External Wait (TYP[3:0]=0101B, AWR=1008H)..................................... 134 Without External Wait (TYP[3:0]=0100B,AWR=0008H).......... 133 B Basic Block Diagram Basic Block Diagram of Ports ........................... 142 Basic Clock Division Setting Register DIVR0: Basic Clock Division Setting Register 0 ............................................. 96 DIVR1: Basic Clock Division Setting Register 1 ............................................. 99 Basic Configuration Basic Configuration of Serial Programming Connection ......................................... 534 Basic Programming Model Basic Programming Model.................................. 34 Baud Rate Baud Rate Selection ......................................... 429 Baud Rate Tolerance Level upon the Reception ..........................................................317 Calculating Baud Rate.......................315, 368, 429 CSIO (Clock Synchronous Multi Function Serial Interface) Baud Rate Selection ..............367 Reload Value and Baud Rate for Each Machine Clock Frequency ...........................316, 369, 430 UART Baud Rate Selection ...............................314 Baud Rate Generator Registers Bit Configuration of Baud Rate Generator Registers 1,0 (BGR1/BGR0) ...............293, 340, 392 BGR Bit Configuration of Baud Rate Generator Registers 1,0 (BGR1/BGR0) ...............293, 340, 392 Bit Configuration Bit Configuration of 16-Bit Reload Register (TMRLR) ...........................................170 Bit Configuration of 16-Bit Timer Register (TMR) ................................................169 Bit Configuration of Baud Rate Generator Registers 1,0 (BGR1/BGR0) ...............293, 340, 392 Bit Configuration of Control Status Register (TMCSR)............................................166 Bit Configuration of Extended Communication Control Register (ESCR) ..............287, 334 Bit Configuration of FIFO Byte Register (FBYTE) ............................300, 347, 400 Bit Configuration of FIFO Control Register 0 (FCR0) ...............................297, 344, 397 Bit Configuration of FIFO Control Register 1 (FCR1) ...............................295, 342, 395 Bit Configuration of ICR .....................................52 Bit Configuration of Wait Register (FLWC)........507 Bit Manipulation Arithmetic Operation and Bit Manipulation...........33 Bit Ordering Bit Ordering .......................................................43 Bit Search Module Bit Search Module (Used by REALOS) ..................3 Block Diagram of Bit Search Module .................258 Register List of Bit Search Module.....................258 Block Diagram Basic Block Diagram of Ports ............................142 Block Diagram .................................119, 164, 180, 192, 203, 267, 448, 501 Block Diagram of Bit Search Module .................258 Block Diagram of Clock Generation Control Block....................................................81 Block Diagram of Delay Interrupt Module ..........254 Block Diagram of External Interrupt Control Unit....................................................244 Block Diagram of MB91313A Series .....................5 Block Diagram of Remote Control Reception......482 Block Diagram of the Main Oscillation Stabilization Wait Timer..........................................219 583 INDEX Block Diagram of Watch Timer......................... 226 Interrupt Controller Block Diagram.................... 234 Block Transfer Block Transfer ................................................. 477 Branch Instructions Overview of Branch Instructions.......................... 45 Branching Branching.......................................................... 32 BSD 0 Detection Data Register (BSD0) ..................... 259 1 Detection Data Register (BSD1) ..................... 259 BSD0 0 Detection Data Register (BSD0) ..................... 259 BSD1 1 Detection Data Register (BSD1) ..................... 259 BSDC Change Point Detection Data Register (BSDC) .......................................................... 260 BSRR Detection Result Register (BSRR) ..................... 260 Built-in Memory Built-in Memory .................................................. 2 Built-in Peripheral Request Built-in Peripheral Request ............................... 465 Burst Burst Transfer .................................................. 478 Burst Two-cycle Transfer.................................. 466 Burst Transfer Burst Transfer .................................................. 478 Burst Two-cycle Transfer Burst Two-cycle Transfer.................................. 466 Bus Converter 32-bit ←→ 16-bit Bus Converter ......................... 30 Harvard ←→ Princeton Bus Converter................. 31 Bus Error Bus Error Generation Condition......................... 428 Bus Error Operation ......................................... 428 Bus Error Generation Condition Bus Error Generation Condition......................... 428 Bus Interface Simplified External Bus Interface .......................... 2 Bus Mode Bus Mode 0 (Single-chip Mode) ........................ 115 Bus Mode 1 (Internal ROM/External Bus Mode) .......................................................... 115 Bus Repetitive Start Condition I2C Bus Repetitive Start Condition..................... 404 Bus Start Condition I2C Bus Start Condition .................................... 404 Bus Stop Condition I2C Bus Stop Condition .................................... 404 BUSYX Ready/Busy Signal (RDY/BUSYX) ................... 515 584 Byte Ordering Byte Ordering.................................................... 43 C Capture Control Register TxCCR (Capture Control Register).................... 205 Capture Data Register TxCRR (Capture Data Register) ........................ 210 Capture Mode Capture Mode.................................................. 214 CCR CCR (Condition Code Register) .......................... 37 Change Point Detection Change Point Detection .................................... 262 Change Point Detection Data Register Change Point Detection Data Register (BSDC) ......................................................... 260 Channel Selection Channel Selection and Control .......................... 475 Chip Example of Chip Select Area Setting ................. 132 Chip Erase Erasing Data (Chip Erase)................................. 523 Chip Select Area Example of Chip Select Area Setting ................. 132 Chip Select Enable Register CSER (Chip Select Enable Register).................. 131 Circuit Crystal Oscillator Circuit .................................... 19 CLKB CPU Clock (CLKB) ........................................... 78 CLKP Peripheral Clock (CLKP).................................... 78 CLKR CLKR: Clock Source Control Register................. 92 CLKT External Bus Clock (CLKT)................................ 79 Clock Count Clock Selection...................................... 199 CPU Clock (CLKB) ........................................... 78 External Bus Clock (CLKT)................................ 79 External Clock................................................. 318 Generating Internal Operating Clock.................... 73 Internal Clock Operation .................................. 171 Notes on Using an External Clock ....................... 20 Operation of Clock Supply Function .................. 223 Operation of Input Pin Function (in Internal Clock Mode) ..................... 173 Peripheral Clock (CLKP).................................... 78 Reload Value and Baud Rate for Each Machine Clock Frequency .......................... 316, 369, 430 Selecting the Source Clock ................................. 73 INDEX Wait Time after Switching from the Sub Clock to the Main Clock .......................................... 77 Clock Division Configuration Register Clock Division Configuration Register (RCCKD)........................................... 494 Clock Generation Control Block Block Diagram of Clock Generation Control Block ................................................... 81 Clock Source Control Register CLKR: Clock Source Control Register................. 92 Clock Supply Function Operation of Clock Supply Function .......... 223, 229 Clock Synchronous Multi Function Serial Interface CSIO (Clock Synchronous Multi Function Serial Interface) Baud Rate Selection ............. 367 Functions of CSIO (Clock Synchronous Multi Function Serial Interface)..................... 326 Operations of CSIO (Clock Synchronous Multi Function Serial Interface)..................... 355 Register List of CSIO (Clock Synchronous Multi Function Serial Interface)..................... 327 Command Command Sequence ......................................... 511 Command Sequence Command Sequence ......................................... 511 Condition Code Register CCR (Condition Code Register) .......................... 37 Connection Inter-CPU Connection ...................... 319, 321, 371 Control Status Register Bit Configuration of Control Status Register (TMCSR) ........................................... 166 Control Status Register ..................................... 181 Control/Status Register DMAC-ch.0, ch.1, ch.2, ch.3, ch.4 Control/Status Register A [DMACA0 to DMACA4] .......................................................... 449 DMAC-ch.0, ch.1, ch.2, ch.3, ch.4 Control/Status Register B [DMACB0 to DMACB4] .......................................................... 453 Coprocessor Coprocessor Absence Trap.................................. 63 Coprocessor Error Trap ...................................... 63 Coprocessor Absence Trap Coprocessor Absence Trap.................................. 63 Coprocessor Error Trap Coprocessor Error Trap ...................................... 63 Count Count Clock Selection ...................................... 199 Start of a Count................................................ 318 Count Clock Count Clock Selection ...................................... 199 Counter Operating Status of Counter .............................. 175 PC (Program Counter).........................................40 CPU CPU ..................................................................29 CPU Clock (CLKB)............................................78 CPU Control ....................................................471 FR CPU ...............................................................2 Inter-CPU Connection.......................319, 321, 371 CPU Clock CPU Clock (CLKB)............................................78 CPU Mode Configuration of Flash Control Status Register (FLCR) (CPU Mode) ...........................505 Crystal Oscillator Circuit Crystal Oscillator Circuit.....................................19 CSER CSER (Chip Select Enable Register) ..................131 CSIO CSIO (Clock Synchronous Multi Function Serial Interface) Baud Rate Selection ..............367 Functions of CSIO (Clock Synchronous Multi Function Serial Interface) .....................326 Interrupts of CSIO ............................................349 Operations of CSIO (Clock Synchronous Multi Function Serial Interface) .....................355 Register List of CSIO (Clock Synchronous Multi Function Serial Interface) .....................327 CSX Setting of CSX →RDX/WRX Setup (TYP[3:0]=0101B,AWR=100BH)..........135 CTBR CTBR: Time-Base Counter Clear Register ............91 D Data Direction Bit Data Direction Bit.............................................425 Data Direction Register Configuration of Data Direction Register ............145 Data Reception Data Reception by Master .................................420 Data Storage Register Data Storage Registers (RCDTHH, RCDTHL, RCDTLH, RCDTLL)...........................493 Data Transmission Data Transmission by Master.............................412 Data Type Data Type ........................................................469 Delay Interrupt Module Block Diagram of Delay Interrupt Module ..........254 Register List of Delay Interrupt Module..............254 Delay Interrupt Module Register DICR (Delay Interrupt Module Register) ............255 Delay Slot Explanation of Operation without a Delay Slot ......48 585 INDEX Instruction for Operation with a Delay Slot........... 46 Instructions that Operate without a Delay Slot....... 48 Operating Explanation of Operation with a Delay Slot ............................................................ 46 Restrictions on the Operation with a Delay Slot ............................................................ 47 Detection 0 Detection ...................................................... 261 1 Detection ...................................................... 261 Change Point Detection .................................... 262 Slave Address Match Detection ......................... 424 Detection Result Register Detection Result Register (BSRR) ..................... 260 Device Device States ................................................... 106 Operational States of Device ............................. 107 Overview of Reset (Device Initialization) ............. 64 Device Address Configuration Register Device Address Configuration Registers 1, 2 (RCADR1, RCADR2) ......................... 489 Device Initialization Overview of Reset (Device Initialization) ............. 64 DICR DICR (Delay Interrupt Module Register) ............ 255 DLYI Bit of DICR............................................ 256 Direct Addressing Direct Addressing............................................... 33 Direct Addressing Area....................................... 26 Division Ratio Initializing the Division Ratio Setting................... 80 Setting Division Ratio......................................... 80 DIVR DIVR0: Basic Clock Division Setting Register 0 ............................................................ 96 DIVR1: Basic Clock Division Setting Register 1 ............................................................ 99 DLYI DLYI Bit of DICR............................................ 256 DMA DMA Transfer during the Sleep......................... 474 DMAC (DMA Controller)..................................... 3 General DMA Transfer ..................................... 468 Peripheral Interrupt Clear by DMA .................... 472 Registers of DMA Controller............................. 447 DMA Controller DMAC (DMA Controller)..................................... 3 Registers of DMA Controller............................. 447 DMA Transfer DMA Transfer during the Sleep......................... 474 General DMA Transfer ..................................... 468 DMAC DMAC (DMA Controller)..................................... 3 DMAC Interrupt Control................................... 474 586 DMAC-ch.0, ch.1, ch.2, ch.3, ch.4 Control/Status Register A [DMACA0 to DMACA4] ......................................................... 449 DMAC-ch.0, ch.1, ch.2, ch.3, ch.4 Control/Status Register B [DMACB0 to DMACB4] ......................................................... 453 DMAC-ch.0, ch.1, ch.2, ch.3, ch.4 Transfer Source/ Destination Address Setting Registers [DMASA0 to DMASA4/DMADA0 to DMADA4] ......................................... 459 DMAC Interrupt Control DMAC Interrupt Control .................................. 474 DMAC Overall Control Register DMAC-ch.0, ch.1, ch.2, ch.3, ch.4 DMAC Overall Control Register [DMACR] ................. 461 DMACR DMAC-ch.0, ch.1, ch.2, ch.3, ch.4 DMAC Overall Control Register [DMACR] ................. 461 DMASA0 to DMASA4/DMADA0 to DMADA4 DMAC-ch.0, ch.1, ch.2, ch.3, ch.4 Transfer Source/ Destination Address Setting Registers [DMASA0 to DMASA4/DMADA0 to DMADA4] ......................................... 459 E EIRR External Interrupt Source Register (EIRR) ......... 247 EIT EIT Interrupt Levels........................................... 50 EIT Sources....................................................... 49 EIT Vector Table ............................................... 54 Features of EIT .................................................. 49 Priority Levels for Accepting EIT Sources ........... 58 Returning from EIT............................................ 49 ELVR External Interrupt Request Level Setting Register (ELVR).............................................. 248 Emulator Notes when not Using the Emulator..................... 21 ENIR Interrupt Enable Register (ENIR) ...................... 246 Entire Timer Control Register TxR (Entire Timer Control Register) ................. 209 Erase Data Writing/Erase........................................... 519 Sector Erase .................................................... 524 Sector Erase Restart ......................................... 527 Temporary Sector Erase Stop ............................ 526 Erasing Erasing Data (Chip Erase)................................. 523 Error Coprocessor Error Trap ...................................... 63 Stop By Error .................................................. 474 INDEX ESCR Bit Configuration of Extended Communication Control Register (ESCR) ............. 287, 334 Event Count Mode Event Count Mode ........................................... 213 Exception Operation of Undefined Instruction Exception ...... 62 Extended Communication Control Register Bit Configuration of Extended Communication Control Register (ESCR) ............. 287, 334 External Bus ADER: External Bus,I2C Bridge,ADER Control Register.............................................. 161 Bus Mode 1 (Internal ROM/External Bus Mode) .......................................................... 115 External Bus Clock (CLKT)................................ 79 Notes on Using External Bus Interface ............... 140 Simplified External Bus Interface .......................... 2 External Bus Clock External Bus Clock (CLKT)................................ 79 External Bus Interface Notes on Using External Bus Interface ............... 140 External Clock External Clock................................................. 318 Notes on Using an External Clock ....................... 20 External Event Count External Event Count Operation ........................ 173 External Interrupt External Interrupt Request Level ....................... 251 Operating Procedure for an External Interrupt..... 250 Operations of an External Interrupt .................... 250 External Interrupt Control Unit Block Diagram of External Interrupt Control Unit ................................................... 244 Details of Registers of External Interrupt Control Unit ................................................... 245 List of Registers of External Interrupt Control Unit ................................................... 244 External Interrupt Request Level Setting Register External Interrupt Request Level Setting Register (ELVR).............................................. 248 External Interrupt Source Register External Interrupt Source Register (EIRR).......... 247 External Trigger A/D Conversion Started by External Trigger ...... 271 External Wait With External Wait (TYP[3:0]=0101B, AWR=1008H) .......................................................... 134 F FBYTE Bit Configuration of FIFO Byte Register (FBYTE)............................ 300, 347, 400 FCR Bit Configuration of FIFO Control Register 0 (FCR0) ...............................297, 344, 397 Bit Configuration of FIFO Control Register 1 (FCR1) ...............................295, 342, 395 Feature Features ...........................................................118 FIFO Functions of FIFO ............................................374 Reception Interrupt Generation and Flag Set Timing When Using Reception FIFO ........305, 351 Transmission and Reception FIFO (Ch.0, Ch.1 and Ch.2) ..........................276 Transmission Interrupt Generation and Flag Set Timing When Using Transmission FIFO ..........................................308, 354 FIFO Byte Register Bit Configuration of FIFO Byte Register (FBYTE) ............................300, 347, 400 FIFO Control Register Bit Configuration of FIFO Control Register 0 (FCR0) ...............................297, 344, 397 Bit Configuration of FIFO Control Register 1 (FCR1) ...............................295, 342, 395 Filter Low-Pass Filter ................................................215 Flag Hardware Sequence Flag ...................................515 Flag Set Timing Reception Interrupt Generation and Flag Set Timing When Using Reception FIFO ........305, 351 Transmission Interrupt Generation and Flag Set Timing........................................307, 353 Flash Control Status Register Configuration of Flash Control Status Register (FLCR) (CPU Mode) ...........................505 Flash Memory List of Flash Memory Registers .........................504 Outline of Flash Memory ..................................500 Flash Microcontroller Programmer System Configuration of Flash Microcontroller Programmer ........................................537 FLCR Configuration of Flash Control Status Register (FLCR) (CPU Mode) ...........................505 Flowchart Flowchart.........................................319, 323, 371 Operation Flowchart of Remote Control Reception............................................495 FLWC Bit Configuration of Wait Register (FLWC)........507 FR FR CPU ...............................................................2 FR Family Memory Map .....................................26 587 INDEX FR Family FR Family Memory Map..................................... 26 FR-CPU Programming Mode FR-CPU Programming Mode (16 Bits,Read/Write) .......................................................... 509 FR-CPU ROM Mode FR-CPU ROM Mode (32 Bits,Read Only).......... 509 Frequency Reload Value and Baud Rate for Each Machine Clock Frequency........................... 316, 369, 430 Fujitsu-standard Pins Used for Fujitsu-standard Serial On-board Programming ...................................... 535 G General DMA Transfer General DMA Transfer ..................................... 468 General Specifications General Specifications of Ports .......................... 143 General-purpose Register General-purpose Register .................................... 35 Generation Transmission Interrupt Generation and Flag Set Timing ............................................... 353 Generation Condition Bus Error Generation Condition......................... 428 H "H" Width Configuration Register "H" Width Configuration Register A (RCDAHW) .......................................................... 491 "H" Width Configuration Register B (RCDAHW) .......................................................... 492 Hardware Configuration Hardware Configuration.................................... 446 Hardware Configuration of the Interrupt Controller .......................................................... 232 Hardware Sequence Flag Hardware Sequence Flag................................... 515 Harvard Harvard ←→ Princeton Bus Converter................. 31 HDMI-CEC HDMI-CEC/Remote Control Reception ................. 4 Hold Request Example of Using the Function to Generate a Request to Cancel a Hold Request (HRCR) ........ 241 Hold Request Cancel Request............................ 239 Hold Request Cancel Request Hold Request Cancel Request............................ 239 Hold Request Cancel Request Register Hold Request Cancel Request Register (HRCL) .......................................................... 238 588 How to Avoid How to Avoid Problems ................................... 529 HRCL Hold Request Cancel Request Register (HRCL) ......................................................... 238 HRCR Example of Using the Function to Generate a Request to Cancel a Hold Request (HRCR)........ 241 I I Flag I Flag ................................................................ 51 I/O Circuit I/O Circuit Types ............................................... 16 I/O Map How to Read I/O Map ...................................... 540 I/O Pins I/O Pins........................................................... 119 I/O Ports I/O Ports ............................................................. 4 2 I C Functions of the I2C Interface ........................... 374 I2C Bus Repetitive Start Condition .................... 404 I2C Bus Start Condition .................................... 404 I2C Bus Stop Condition .................................... 404 NSF: Noise Filter Control Register for I2C ......... 162 Register List of the I2C Interface ....................... 375 2 I C Bridge ADER: External Bus,I2C Bridge,ADER Control Register ............................................. 161 2 I C Bus Control Register I2C Bus Control Register (IBCR) ...................... 376 2 I C Bus Status Register I2C Bus Status Register (IBSR) ......................... 386 I2C Interface Interrupts of the I2C Interface............................ 402 IBCR I2C Bus Control Register (IBCR) ...................... 376 IBSR I2C Bus Status Register (IBSR) ......................... 386 ICR Bit Configuration of ICR .................................... 52 ICR Mapping..................................................... 52 Interrupt Control Register (ICR)........................ 236 ILM ILM.................................................................. 51 ILM (Interrupt Level Mask Register) ................... 40 INIT Setting Initialization Reset (INIT)........................ 65 Setting Initialization Reset (INIT) Clear Sequence ........................................................... 68 INDEX Initialization INITX Pin Input (Settings Initialization Reset Pin) ............................................................ 66 Operation Initialization Reset (RST) .................... 65 Operation Initialization Reset (RST) Clear Sequence ............................................................ 68 Overview of Reset (Device Initialization)............. 64 Setting Initialization Reset (INIT)........................ 65 Setting Initialization Reset (INIT) Clear Sequence ............................................................ 68 Wait Time after Setting Initialization ................... 76 Initialization Reset Operation Initialization Reset (RST) .................... 65 Setting Initialization Reset (INIT)........................ 65 INITX INITX Pin Input (Settings Initialization Reset Pin) ............................................................ 66 Input Pin Function Operation of Input Pin Function (in Internal Clock Mode) ..................... 173 Instruction Instruction for Operation with a Delay Slot........... 46 Instructions that Operate without a Delay Slot ............................................ 48 Operation of INT Instruction ............................... 61 Operation of INTE Instruction............................. 61 Operation of RETI Instruction ............................. 63 Operation of Undefined Instruction Exception ...... 62 Overview of Branch Instructions ......................... 45 Overview of Other Instructions ........................... 33 INT Operation of INT Instruction ............................... 61 INTE Operation of INTE Instruction............................. 61 Inter-CPU Inter-CPU Connection ...................... 319, 321, 371 Interface Functions of the I2C Interface............................ 374 Multi Function Serial Interface .............................. 3 Notes on Using External Bus Interface ............... 140 Register List of the I2C Interface ....................... 375 Simplified External Bus Interface .......................... 2 Interface Mode Interface Mode ................................................ 275 Switching the Interface Modes .......................... 275 Internal Architecture Features of Internal Architecture ......................... 28 Structure of Internal Architecture ........................ 29 Internal Clock Internal Clock Operation................................... 171 Operation of Input Pin Function (in Internal Clock Mode) ..................... 173 Internal Operating Clock Generating Internal Operating Clock.................... 73 Internal ROM Bus Mode 1 (Internal ROM/External Bus Mode) ..........................................................115 Interrupt DMAC Interrupt Control ...................................474 EIT Interrupt Levels............................................50 External Interrupt Request Level ........................251 Interrupt Controller ...............................................3 Interrupt Number ..............................................256 Interrupt Request Generation .............................200 Interrupt Sources and Timing Chart (with PPG Output Set for Ordinary Polarity) .....................188 Interrupt Stack....................................................53 Interrupts of CSIO ............................................349 Interrupts of UART...........................................302 Level Masking for Interrupt/NMI .........................51 Main Oscillation Stabilization Wait Interrupt ......222 Operating Procedure for an External Interrupt .....250 Operation of User Interrupt and NMI....................60 Operations of an External Interrupt.....................250 Peripheral Interrupt Clear by DMA ....................472 Reception Interrupt Generation and Flag Set Timing........................................304, 350 Reception Interrupt Generation and Flag Set Timing When Using Reception FIFO ........305, 351 Transmission Interrupt Generation and Flag Set Timing........................................307, 353 Transmission Interrupt Generation and Flag Set Timing When Using Transmission FIFO ..........................................308, 354 Watch Interrupt ................................................228 Interrupt Control Register Interrupt Control Register (ICR) ........................236 Interrupt Controller Details of Interrupt Controller Registers..............235 Hardware Configuration of the Interrupt Controller ...........................................232 Interrupt Controller ...............................................3 Interrupt Controller Block Diagram ....................234 Major Functions of the Interrupt Controller .........232 Register List of Interrupt Controller....................233 Interrupt Enable Register Interrupt Enable Register (ENIR) .......................246 Interrupt Level Mask Register ILM (Interrupt Level Mask Register)....................40 Interrupt Request Interrupt Request Generation .............................200 Interrupts Interrupts of CSIO ............................................349 Interrupts of the I2C Interface ............................402 Interrupts of UART...........................................302 Interval Time Interval Time of Watch Timer............................225 Interval Timer Interval Timer Mode .........................................212 589 INDEX Operation of Interval Timer Function ......... 222, 229 Other Interval Timers ........................................... 4 Interval Timer Function Operation of Interval Timer Function ......... 222, 229 Interval Timer Mode Interval Timer Mode......................................... 212 Interval Timers Other Interval Timers ........................................... 4 Interval Times Interval Times of the Main Oscillation Stabilization Wait Timer ......................................... 218 ISBA 7-bit Slave Address Register (ISBA) .................. 394 ISMK 7-bit Slave Address Mask Register (ISMK) ........ 393 L Latch-up Preventing a Latch-up......................................... 19 Level Masking Level Masking for Interrupt/NMI......................... 51 Load Load and Store................................................... 32 Low-Pass Filter Low-Pass Filter ................................................ 215 Low-Pass Filter Control Register TxLPCR (Low-Pass Filter Control Register) ....... 204 LPF LPF Sampling Intervals .................................... 199 M Machine Clock Reload Value and Baud Rate for Each Machine Clock Frequency........................... 316, 369, 430 Main Clock Wait Time after Switching from the Sub Clock to the Main Clock........................................... 77 Main Oscillation Stabilization Wait Main Oscillation Stabilization Wait Interrupt ...... 222 Main Oscillation Stabilization Wait Timer Block Diagram of the Main Oscillation Stabilization Wait Timer ......................................... 219 Explanation of the Main Oscillation Stabilization Wait Timer Register .................................... 220 Interval Times of the Main Oscillation Stabilization Wait Timer ......................................... 218 Notes on Using the Main Oscillation Stabilization Wait Timer ......................................... 224 Operation of the Main Oscillation Stabilization Wait Timer ................................................. 223 Main Oscillation Stabilization Wait Timer Register Explanation of the Main Oscillation Stabilization Wait Timer Register .................................... 220 590 Master Data Reception by Master................................. 420 Data Transmission by Master ............................ 412 Wait of the Master Mode .................................. 423 Master Mode Wait of the Master Mode .................................. 423 MB91313A Series Block Diagram of MB91313A Series..................... 5 Memory Map of MB91313A Series ..................... 27 Pin Assignment of MB91313A Series .................... 6 Pin Functions of MB91313A Series ....................... 8 MD Mode Pins (MD0 to MD2) .................................. 19 Memory Built-in Memory .................................................. 2 Memory Map FR Family Memory Map .................................... 26 Memory Map................................................... 501 Memory Map of MB91313A Series ..................... 27 Mode Addressing Mode............................................. 469 Bus Mode 0 (Single-chip Mode)........................ 115 Bus Mode 1 (Internal ROM/ External Bus Mode) ............................ 115 Capture Mode.................................................. 214 Configuration of Flash Control Status Register (FLCR) (CPU Mode) .......................... 505 Event Count Mode ........................................... 213 FR-CPU Programming Mode (16 Bits,Read/Write) ......................................................... 509 FR-CPU ROM Mode (32 Bits,Read Only) ......... 509 Interface Mode ................................................ 275 Interval Timer Mode ........................................ 212 Mode Pins (MD0 to MD2) .................................. 19 Mode Setting ................................................... 115 Operating Mode............................................... 115 Operating Modes ............................................. 279 Operation of Input Pin Function (in Internal Clock Mode) ..................... 173 Returning from Standby (Stop or Sleep) Mode ......................................................... 240 Sleep Mode ..................................................... 110 Switching the Interface Modes .......................... 275 Transfer Mode ................................................. 463 Wait of the Master Mode .................................. 423 Mode Pins Mode Pins (MD0 to MD2) .................................. 19 Multi Function CSIO (Clock Synchronous Multi Function Serial Interface) Baud Rate Selection ............. 367 Functions of UART (Asynchronous Multi Function Serial Interface) .................................. 277 Register List of UART (Asynchronous Multi Function Serial Interface) .................................. 278 INDEX Multi Function Serial Interface CSIO (Clock Synchronous Multi Function Serial Interface) Baud Rate Selection ............. 367 Functions of CSIO (Clock Synchronous Multi Function Serial Interface)............................................ 326 Functions of UART (Asynchronous Multi Function Serial Interface) .................................. 277 Multi Function Serial Interface .............................. 3 Operations of CSIO (Clock Synchronous Multi Function Serial Interface)..................... 355 Register List of CSIO (Clock Synchronous Multi Function Serial Interface)..................... 327 Register List of UART (Asynchronous Multi Function Serial Interface) .................................. 278 Multifunction Timer Multifunction Timer............................................. 4 Multiplex Access Normal Access or a Address/Data Multiplex Access Operation ........................................... 127 Multiplication Rate PLL Multiplication Rate ..................................... 75 Wait Time after Changing PLL Multiplication Rate ............................................................ 76 Multiply & Divide Register MDH, MDL (Multiply & Divide Register) ........... 42 N NMI Level Masking for Interrupt/NMI ........................ 51 Operation of User Interrupt and NMI ................... 60 Noise Filter Control Register NSF: Noise Filter Control Register for I2C ......... 162 Normal Access Normal Access or a Address/Data Multiplex Access Operation ........................................... 127 Normal Reset Normal Reset Operation ..................................... 71 Note Note on Oscillator Input at Power-On .................. 20 Notes on Selecting PLL Clocks ........................... 21 Notes on the Turning On/Off VDDI Pin (1.8 V Internal Power Supply) and VDDE Pin (3.3 V External Pin Power Supply) ............................................................ 20 Notes on Using an External Clock ....................... 20 Notes when not Using the Emulator ..................... 21 NSF NSF: Noise Filter Control Register for I2C ......... 162 O One-Shot Operation Timing Charts for One-Shot Operation............... 187 Operating Mode Operating Mode ...............................................115 Operating Modes Operating Modes ..............................................279 Operation Operation at Power-On........................................20 Operation Initialization Reset (RST).....................65 Operation Initialization Reset (RST) Clear Sequence ............................................................68 Operational States Operational States of Device..............................107 Ordering Bit Ordering .......................................................43 Byte Ordering ....................................................43 OSCCR OSCCR: Oscillation Control Register .................101 Oscillation Circuit Crystal Oscillator Circuit.....................................19 Oscillation Control Register OSCCR: Oscillation Control Register .................101 Oscillation Stabilization Wait Main Oscillation Stabilization Wait Interrupt ......222 Notes on Using the Main Oscillation Stabilization Wait Timer..........................................224 Operation of the Main Oscillation Stabilization Wait Timer .................................................223 Selecting an Oscillation Stabilization Wait Time ............................................................70 Sources of an Oscillation Stabilization Wait ..........69 Oscillation Stabilization Wait Time Selecting an Oscillation Stabilization Wait Time ............................................................70 Oscillation Stabilization Wait Timer Block Diagram of the Main Oscillation Stabilization Wait Timer..........................................219 Explanation of the Main Oscillation Stabilization Wait Timer Register.....................................220 Interval Times of the Main Oscillation Stabilization Wait Timer..........................................218 Oscillator Note on Oscillator Input at Power-On ...................20 Other Features Other Features ......................................................4 Other Operations Other Operations ..............................................174 Output Pin Function Output Pin Function Operation ..........................174 P Pause Pause...............................................................473 PC PC (Program Counter).........................................40 591 INDEX PCSR PCSR (PPG Cycle Setting Register)................... 184 PDR Configuration of Port Data Register (PDR) ......... 144 PDUT PDUT (PPG Duty Setting Register) ................... 184 Peripheral Built-in Peripheral Request ............................... 465 Peripheral Interrupt Clear by DMA .................... 472 Peripheral Clock Peripheral Clock (CLKP) .................................... 78 Peripheral Interrupt Peripheral Interrupt Clear by DMA .................... 472 Pin Assignment Pin Assignment of MB91313A Series .................... 6 Pin Functions Pin Functions of MB91313A Series ....................... 8 PLL Enabling PLL Operation ..................................... 74 PLL Multiplication Rate ..................................... 75 Wait Time after Changing PLL Multiplication Rate ..................................................... 76 Wait Time after Enabling PLL Operation ............. 76 PLL Clocks Notes on Selecting PLL Clocks ........................... 21 Pointer RP (Return Pointer) ............................................ 41 SSP (System Stack Pointer)................................. 41 USP (User Stack Pointer) .................................... 41 Polarity Interrupt Sources and Timing Chart (with PPG Output Set for Ordinary Polarity)..................... 188 Port Basic Block Diagram of Ports............................ 142 General Specifications of Ports .......................... 143 I/O Ports.............................................................. 4 Port 0 .............................................................. 146 Port 1 .............................................................. 148 Port 2 .............................................................. 149 Port 3 .............................................................. 150 Port 4 .............................................................. 151 Port 5 .............................................................. 152 Port 6 .............................................................. 153 Port C.............................................................. 154 Port D ............................................................. 155 Port E.............................................................. 157 Port F .............................................................. 158 Port 0 Port 0 .............................................................. 146 Port 1 Port 1 .............................................................. 148 Port 2 Port 2 .............................................................. 149 592 Port 3 Port 3.............................................................. 150 Port 4 Port 4.............................................................. 151 Port 5 Port 5.............................................................. 152 Port 6 Port 6.............................................................. 153 Port C Port C ............................................................. 154 Port D Port D ............................................................. 155 Port Data Register Configuration of Port Data Register (PDR)......... 144 Port E Port E ............................................................. 157 Port F Port F.............................................................. 158 Port Pull-Up Control Register Port Pull-Up Control Register ........................... 160 Ports Basic Block Diagram of Ports ........................... 142 General Specifications of Ports.......................... 143 Power Supply Power Supply Pins ............................................. 19 Power Supply Pins Power Supply Pins ............................................. 19 Power-On Note on Oscillator Input at Power-On .................. 20 Operation at Power-On ....................................... 20 Power-up Wait Time after Power-up................................... 76 PPG Examples of Methods of All-L and All-H PPG Output ......................................................... 188 Interrupt Sources and Timing Chart (with PPG Output Set for Ordinary Polarity) .................... 188 PPG.................................................................... 4 PPG Cycle Setting Register PCSR (PPG Cycle Setting Register) .................. 184 PPG Duty Setting Register PDUT (PPG Duty Setting Register) ................... 184 PPG Timer Characteristics of PPG Timer ............................ 178 Precautions on Using the PPG Timer ................. 189 PPG Timer Register PTMR (PPG Timer Register) ............................ 185 Princeton Harvard ←→ Princeton Bus Converter ................ 31 Priority Determining the Priority ................................... 239 Priority Levels for Accepting EIT Sources ........... 58 INDEX Problem Description of Problems due to Restrictions ....... 528 How to Avoid Problems ................................... 529 Program PC (Program Counter) ........................................ 40 PS (Program Status) ........................................... 36 Program Counter PC (Program Counter) ........................................ 40 Program Status PS (Program Status) ........................................... 36 Programming Basic Programming Model.................................. 34 Example of Serial Programming Connection ...... 536 Pins Used for Fujitsu-standard Serial On-board Programming...................................... 535 Programming Mode FR-CPU Programming Mode (16 Bits,Read/Write) .......................................................... 509 Programming Model Basic Programming Model.................................. 34 PS PS (Program Status) ........................................... 36 PTMR PTMR (PPG Timer Register) ............................ 185 Pull-up Control Pull-up Control ................................................ 160 Pulse Width Counter Registers of the 16-Bit Pulse Width Counter....... 192 PWC PWC................................................................... 4 PWC Control Register PWC Control Register (PWCCH)...................... 194 PWC Control Register (PWCCL) ...................... 193 PWC Control Register 2 (PWCC2) .................... 196 PWC Data Register PWC Data Register (PWCD) ............................ 195 PWC Upper Value Setting Register PWC Upper Value Setting Register (PWCUD) .......................................................... 197 PWCC PWC Control Register 2 (PWCC2) .................... 196 PWCCH PWC Control Register (PWCCH)...................... 194 PWCCL PWC Control Register (PWCCL) ...................... 193 PWCD PWC Data Register (PWCD) ............................ 195 PWCUD PWC Upper Value Setting Register (PWCUD) .......................................... 197 PWM Operation Timing Charts for PWM Operation.................... 186 R RCADR Device Address Configuration Registers 1, 2 (RCADR1, RCADR2)..........................489 RCCKD Clock Division Configuration Register (RCCKD) ..........................................................494 RCCR Remote Control Reception Control Register (RCCR) ..........................................................484 RCDAHW "H" Width Configuration Register A (RCDAHW) ..........................................................491 "H" Width Configuration Register B (RCDAHW) ..........................................................492 RCDT Data Storage Registers (RCDTHH, RCDTHL, RCDTLH, RCDTLL)...........................493 RCSHW Start Bit High Width Configuration Register (RCSHW) ...........................................490 RCST Remote Control Reception Interrupt Control Register (RCST)...............................................486 RDR Reception Data Register (RDR) .........289, 336, 390 RDX Setting of CSX →RDX/WRX Setup (TYP[3:0]=0101B,AWR=100BH)..........135 RDY Ready/Busy Signal (RDY/BUSYX) ...................515 RDY bit RDY bit ...........................................................515 Read/Reset Status Read/Reset Status .............................................520 REALOS 16-bit Reload Timer (Including One Channel for REALOS) ......3 Bit Search Module (Used by REALOS) ..................3 Reception Acknowledgment Reception by Transmitting First Byte ...................................................408 Baud Rate Tolerance Level upon the Reception ..........................................................317 Data Reception by Master .................................420 HDMI-CEC/Remote Control Reception..................4 Reception by Slave ...........................................425 Reception Interrupt Generation and Flag Set Timing........................................304, 350 Reception Interrupt Generation and Flag Set Timing When Using Reception FIFO ........305, 351 Register Configuration of Remote Control Reception ..........................................................483 593 INDEX Transmission and Reception FIFO (Ch.0, Ch.1 and Ch.2) .......................... 276 Reception Data Register Reception Data Register (RDR) ......... 289, 336, 390 Reception Interrupt Reception Interrupt Generation and Flag Set Timing When Using Reception FIFO........ 305, 351 Register 0 Detection Data Register (BSD0) ..................... 259 1 Detection Data Register (BSD1) ..................... 259 7-bit Slave Address Mask Register (ISMK) ........ 393 7-bit Slave Address Register (ISBA) .................. 394 A/D Conversion Result Register (Channels 0 to 9) .......................................................... 270 A/D Converter Control Register (ADCTH, ADCTL) .......................................................... 268 ACR0 to ACR3 (Area Configuration Register) .......................................................... 122 ADER: External Bus,I2C Bridge,ADER Control Register .............................................. 161 ASR0 to ASR3 (Area Select Register)................ 121 AWR0 to AWR3 (Area Wait Register)............... 126 Bit Configuration of 16-Bit Reload Register (TMRLR) ........................................... 170 Bit Configuration of Baud Rate Generator Registers 1,0 (BGR1/BGR0)....................... 340, 392 Bit Configuration of Control Status Register (TMCSR) ........................................... 166 Bit Configuration of Extended Communication Control Register (ESCR).............. 287, 334 Bit Configuration of FIFO Byte Register (FBYTE) ............................ 300, 347, 400 Bit Configuration of FIFO Control Register 0 (FCR0)............................... 297, 344, 397 Bit Configuration of FIFO Control Register 1 (FCR1)....................................... 342, 395 Bit Configuration of Wait Register (FLWC) ....... 507 CCR (Condition Code Register)........................... 37 Change Point Detection Data Register (BSDC) .............................................. 260 CLKR: Clock Source Control Register ................. 92 Clock Division Configuration Register (RCCKD) .......................................................... 494 Configuration of Data Direction Register............ 145 Configuration of Port Data Register (PDR) ......... 144 Control Status Register ..................................... 181 CSER (Chip Select Enable Register) .................. 131 CTBR: Time-Base Counter Clear Register............ 91 Data Storage Registers (RCDTHH, RCDTHL, RCDTLH, RCDTLL) .......................... 493 Detection Result Register (BSRR) ..................... 260 Device Address Configuration Registers 1, 2 (RCADR1, RCADR2) ......................... 489 DICR (Delay Interrupt Module Register) ............ 255 DIVR0: Basic Clock Division Setting Register 0 ............................................................ 96 594 DIVR1: Basic Clock Division Setting Register 1 ........................................................... 99 DMAC-ch.0, ch.1, ch.2, ch.3, ch.4 DMAC Overall Control Register [DMACR] ................. 461 DMAC-ch.0, ch.1, ch.2, ch.3, ch.4 Transfer Source/ Destination Address Setting Registers [DMASA0 to DMASA4/DMADA0 to DMADA4] ......................................... 459 Explanation of the Main Oscillation Stabilization Wait Timer Register.................................... 220 External Interrupt Request Level Setting Register (ELVR).............................................. 248 External Interrupt Source Register (EIRR) ......... 247 General-purpose Register.................................... 35 "H" Width Configuration Register A (RCDAHW) ......................................................... 491 "H" Width Configuration Register B (RCDAHW) ......................................................... 492 Hold Request Cancel Request Register (HRCL) ......................................................... 238 I2C Bus Control Register (IBCR) ...................... 376 I2C Bus Status Register (IBSR) ......................... 386 ILM (Interrupt Level Mask Register) ................... 40 Interrupt Control Register (ICR)........................ 236 Interrupt Enable Register (ENIR) ...................... 246 MDH, MDL (Multiply & Divide Register) ........... 42 NSF: Noise Filter Control Register for I2C ......... 162 OSCCR: Oscillation Control Register ................ 101 PCSR (PPG Cycle Setting Register) .................. 184 PDUT (PPG Duty Setting Register) ................... 184 Port Pull-Up Control Register ........................... 160 PTMR (PPG Timer Register) ............................ 185 PWC Control Register (PWCCH)...................... 194 PWC Control Register (PWCCL) ...................... 193 PWC Control Register 2 (PWCC2) .................... 196 PWC Data Register (PWCD) ............................ 195 PWC Upper Value Setting Register (PWCUD) ......................................................... 197 Reception Data Register (RDR)......... 289, 336, 390 Register List .................................................... 120 Register Setting Procedure ................................ 139 Registers ......................................... 179, 202, 266 Remote Control Reception Control Register (RCCR) ............................................. 484 Remote Control Reception Interrupt Control Register (RCST) .............................................. 486 RSRR: Reset Source Register/Watchdog Timer Control Register.................................... 82 SCR (System Condition code Register) ................ 39 Serial Control Register (SCR) ................... 280, 328 Serial Mode Register (SMR) ............. 282, 330, 381 Serial Status Register (SSR).............. 284, 332, 383 Software Conversion Analog Input Select Register ............................................. 269 Start Bit High Width Configuration Register (RCSHW) .......................................... 490 STCR: Standby Control Register ......................... 85 INDEX TBCR: Time-Base Counter Control Register ........ 88 TBR (Table Base Register) ........................... 40, 54 Transmission Data Register (TDR) .......................................... 291, 338, 391 TxCCR (Capture Control Register) .................... 205 TxCRR (Capture Data Register) ........................ 210 TxDRR (Timer Compare Data Register) ............ 210 TxLPCR (Low-Pass Filter Control Register)....... 204 TxR (Entire Timer Control Register).................. 209 TxTCR (Timer Setting Register) ....................... 207 WPR: Watchdog Reset Generation Delay Register ............................................................ 95 Register Setting Procedure Register Setting Procedure ................................ 139 Reload Counter Functions of the Reload Counter........ 318, 370, 430 Reload Register Bit Configuration of 16-Bit Reload Register (TMRLR)........................................... 170 Reload Timer 16-bit Reload Timer (Including One Channel for REALOS)...... 3 Notes on Using 16-Bit Reload Timer ................. 176 Overview of 16-Bit Reload Timer...................... 164 Register List of 16-Bit Reload Timer ................. 165 Reload Value Reload Value and Baud Rate for Each Machine Clock Frequency .......................... 316, 369, 430 Remote Control Reception HDMI-CEC/Remote Control Reception ................. 4 Operation Flowchart of Remote Control Reception .......................................................... 495 Register Configuration of Remote Control Reception .......................................................... 483 Setting Example of Remote Control Reception .......................................................... 497 Remote Control Reception Control Register Remote Control Reception Control Register (RCCR).............................................. 484 Remote Control Reception Interrupt Control Register Remote Control Reception Interrupt Control Register (RCST) .............................................. 486 Request Built-in Peripheral Request ............................... 465 External Interrupt Request Level ....................... 251 Hold Request Cancel Request ........................... 239 Software Request ............................................. 465 Reset INITX Pin Input (Settings Initialization Reset Pin) ............................................................ 66 Normal Reset Operation ..................................... 71 Operation Initialization Reset (RST) .................... 65 Operation Initialization Reset (RST) Clear Sequence ............................................................ 68 Overview of Reset (Device Initialization)............. 64 Read/Reset Status .............................................520 Setting Initialization Reset (INIT) ........................65 Setting Initialization Reset (INIT) Clear Sequence ............................................................68 STCR:SRST Bit Writing (Software Reset) ............66 Synchronous Reset Operation ..............................71 Watchdog Reset .................................................67 Reset Source Register/Watchdog Timer Control Register RSRR: Reset Source Register/Watchdog Timer Control Register ....................................82 Restart Restart .....................................................318, 370 Sector Erase Restart ..........................................527 Restore Process of Save/Restore ....................................263 Restriction Description of Problems due to Restrictions ........528 Restrictions ........................................................22 RETI Operation of RETI Instruction .............................63 RETI Instruction Operation of RETI Instruction .............................63 Return Pointer RP (Return Pointer) ............................................41 ROM Bus Mode 1 (Internal ROM/ External Bus Mode) .............................115 ROM Mode FR-CPU ROM Mode (32 Bits,Read Only) ..........509 RP RP (Return Pointer) ............................................41 RSRR RSRR: Reset Source Register/Watchdog Timer Control Register ....................................82 RST Operation Initialization Reset (RST).....................65 Operation Initialization Reset (RST) Clear Sequence ............................................................68 S Sampling Intervals LPF Sampling Intervals.....................................199 Save Process of Save/Restore ....................................263 SCR SCR (System Condition code Register).................39 Serial Control Register (SCR) ....................280, 328 Sector Sector Address Table ........................................502 Sector Erase .....................................................524 Sector Erase Restart ..........................................527 Temporary Sector Erase Stop.............................526 595 INDEX Sector Address Table Sector Address Table ........................................ 502 Sector Erase Sector Erase..................................................... 524 Sector Erase Restart Sector Erase Restart.......................................... 527 Serial Control Register Serial Control Register (SCR).................... 280, 328 Serial Interface CSIO (Clock Synchronous Multi Function Serial Interface) Baud Rate Selection.............. 367 Functions of UART (Asynchronous Multi Function Serial Interface)................................... 277 Register List of UART (Asynchronous Multi Function Serial Interface)................................... 278 Serial Mode Register Serial Mode Register (SMR) ............. 282, 330, 381 Serial On-board Programming Pins Used for Fujitsu-standard Serial On-board Programming ...................................... 535 Serial Programming Connection Basic Configuration of Serial Programming Connection ......................................... 534 Example of Serial Programming Connection....... 536 Serial Status Register Serial Status Register (SSR) .............. 284, 332, 383 Setting INITX Pin Input (Settings Initialization Reset Pin) ............................................................ 66 Setting Initialization Reset (INIT) Clear Sequence ............................................................ 68 Wait Time after Setting Initialization ................... 76 Setup Setting of CSX →RDX/WRX Setup (TYP[3:0]=0101B,AWR=100BH) ......... 135 Single-chip Mode Bus Mode 0 (Single-chip Mode) ........................ 115 Slave Reception by Slave........................................... 425 Slave Address Match Detection ......................... 424 Slave Address Output ....................................... 406 Transmission by Slave ...................................... 427 Slave Address Slave Address Output ....................................... 406 Slave Address Match Detection Slave Address Match Detection ......................... 424 Sleep DMA Transfer during the Sleep......................... 474 Returning from Standby (Stop or Sleep) Mode .......................................................... 240 Sleep Mode...................................................... 110 SMR Serial Mode Register (SMR) ............. 282, 330, 381 596 Software Conversion Analog Input Select Register Software Conversion Analog Input Select Register ............................................. 269 Software Request Software Request ............................................. 465 Software Reset STCR:SRST Bit Writing (Software Reset) ........... 66 Source Clock Selecting the Source Clock ................................. 73 SRST STCR:SRST Bit Writing (Software Reset) ........... 66 SSP SSP (System Stack Pointer) .......................... 41, 53 SSR Serial Status Register (SSR).............. 284, 332, 383 Stack Interrupt Stack ................................................... 53 Standby Returning from Standby (Stop or Sleep) Mode ......................................................... 240 Standby Control Register STCR: Standby Control Register ......................... 85 Start Start of Operation ............................................ 472 Start Bit High Width Configuration Register Start Bit High Width Configuration Register (RCSHW) .......................................... 490 Start Condition Generation of the Start Condition ...................... 405 STCR STCR: Standby Control Register ......................... 85 STCR:SRST Bit Writing (Software Reset) ........... 66 Step Trace Trap Operation of Step Trace Trap .............................. 62 Step/Block Transfer Step/Block Transfer Two-cycle Transfer ............ 467 Stop Returning from Standby (Stop or Sleep) Mode ......................................................... 240 Stop By Error .................................................. 474 Stop Mode....................................................... 112 Temporary Sector Erase Stop ............................ 526 Termination/Stop of Operation .......................... 473 Wait Time after Returning from Stop Mode ......... 77 Store Load and Store .................................................. 32 Sub Clock Wait Time after Switching from the Sub Clock to the Main Clock .......................................... 77 Synchronous CSIO (Clock Synchronous Multi Function Serial Interface) Baud Rate Selection ............. 367 INDEX Synchronous Reset Synchronous Reset Operation.............................. 71 System Condition code Register SCR (System Condition code Register) ................ 39 System Configuration System Configuration of Flash Microcontroller Programmer........................................ 537 System Stack Pointer SSP (System Stack Pointer) .......................... 41, 53 T Table Base Register TBR (Table Base Register) ........................... 40, 54 TBCR TBCR: Time-Base Counter Control Register ........ 88 TBR TBR (Table Base Register) ........................... 40, 54 TDR Transmission Data Register (TDR) .......................................... 291, 338, 391 Temporary Sector Erase Stop Temporary Sector Erase Stop ............................ 526 Termination Termination/Stop of Operation .......................... 473 Time-Base Counter Time-Base Counter .......................................... 102 Time-Base Counter Clear Register CTBR: Time-Base Counter Clear Register ........... 91 Time-Base Counter Control Register TBCR: Time-Base Counter Control Register ........ 88 Timer Compare Data Register TxDRR (Timer Compare Data Register) ............ 210 Timer Register Bit Configuration of 16-Bit Timer Register (TMR) ............................................... 169 Timer Setting Register TxTCR (Timer Setting Register) ....................... 207 Timing Chart Interrupt Sources and Timing Chart (with PPG Output Set for Ordinary Polarity) .................... 188 Timing Charts for One-Shot Operation............... 187 Timing Charts for PWM Operation.................... 186 TMCSR Bit Configuration of Control Status Register (TMCSR) ........................................... 166 TMODE TMODE.......................................................... 211 TMR Bit Configuration of 16-Bit Timer Register (TMR) ............................................... 169 TMRLR Bit Configuration of 16-Bit Reload Register (TMRLR)........................................... 170 Trace Trap Operation of Step Trace Trap...............................62 Transfer 2-Cycle Transfer (External→I/O) (TYP[3:0]=0000B,AWR=0008H) ..........137 2-Cycle Transfer (I/O→External) (TYP[3:0]=0000B,AWR=0008H) ..........138 Acceptance and Transfer of Transfer Request...............................................472 Block Transfer .................................................477 Burst Transfer ..................................................478 Burst Two-cycle Transfer ..................................466 DMA Transfer during the Sleep .........................474 DMAC-ch.0, ch.1, ch.2, ch.3, ch.4 Transfer Source/ Destination Address Setting Registers [DMASA0 to DMASA4/DMADA0 to DMADA4]..........................................459 General DMA Transfer .....................................468 Operation of Data in Two-cycle Transfer ............479 Selecting the Transfer Sequence.........................466 Step/Block Transfer Two-cycle Transfer.............467 Transfer Address ..............................................464 Transfer Count and Transfer Termination ...........464 Transfer Count Control .....................................470 Transfer Mode..................................................463 Transfer Type...................................................464 Transfer Count Control Transfer Count Control .....................................470 Transfer Mode Transfer Mode..................................................463 Transmission Data Transmission by Master.............................412 Transmission and Reception FIFO (Ch.0, Ch.1 and Ch.2) ..........................276 Transmission by Slave ......................................427 Transmission Interrupt Generation and Flag Set Timing........................................307, 353 Transmission Interrupt Generation and Flag Set Timing When Using Transmission FIFO ..................................................308, 354 Transmission Data Register Transmission Data Register (TDR) ..........................................291, 338, 391 Transmission Interrupt Transmission Interrupt Generation and Flag Set Timing................................................307 Transmission Interrupt Generation Transmission Interrupt Generation and Flag Set Timing................................................353 Trap Coprocessor Absence Trap ..................................63 Coprocessor Error Trap .......................................63 Operation of Step Trace Trap...............................62 Trigger A/D Conversion Started by External Trigger .......271 597 INDEX Two-cycle Transfer Burst Two-cycle Transfer.................................. 466 Operation of Data in Two-cycle Transfer............ 479 Step/Block Transfer Two-cycle Transfer ............ 467 TxCCR TxCCR (Capture Control Register) .................... 205 TxCRR TxCRR (Capture Data Register) ........................ 210 TxDRR TxDRR (Timer Compare Data Register)............. 210 TxLPCR TxLPCR (Low-Pass Filter Control Register) ....... 204 TxR TxR (Entire Timer Control Register).................. 209 TxTCR TxTCR (Timer Setting Register)........................ 207 TYP 2-Cycle Transfer (External→I/O) (TYP[3:0]=0000B,AWR=0008H) .......... 137 2-Cycle Transfer (I/O→External) (TYP[3:0]=0000B,AWR=0008H) .......... 138 Setting of CSX →RDX/WRX Setup (TYP[3:0]=0101B,AWR=100BH) ......... 135 With External Wait (TYP[3:0]=0101B, AWR=1008H) ..................................... 134 Without External Wait (TYP[3:0]=0100B, AWR=0008H) ......... 133 U UART Functions of UART (Asynchronous Multi Function Serial Interface)................................... 277 Interrupts of UART .......................................... 302 Operations of UART ........................................ 309 Register List of UART (Asynchronous Multi Function Serial Interface)................................... 278 UART Baud Rate Selection............................... 314 Undefined Instruction Operation of Undefined Instruction Exception ...... 62 Underflow Underflow Operation ........................................ 172 Unused Unused Input Pins .............................................. 19 Unused Input Pins Unused Input Pins .............................................. 19 User Interrupt Operation of User Interrupt and NMI ................... 60 User Stack Pointer USP (User Stack Pointer) .................................... 41 598 USP USP (User Stack Pointer).................................... 41 V VDDI Pin Notes on the Turning On/Off VDDI Pin (1.8 V Internal Power Supply) and VDDE Pin (3.3 V External Pin Power Supply)................ 20 Vector Table EIT Vector Table ............................................... 54 W Wait Register Bit Configuration of Wait Register (FLWC) ....... 507 Wait Time Wait Time after Changing PLL Multiplication Rate ..................................................... 76 Wait Time after Enabling PLL Operation ............. 76 Wait Time after Power-up................................... 76 Wait Time after Returning from Stop Mode ......... 77 Wait Time after Setting Initialization ................... 76 Wait Time after Switching from the Sub Clock to the Main Clock .......................................... 77 Watch Watch Interrupt................................................ 228 Watch Timer Block Diagram of Watch Timer ........................ 226 Interval Time of Watch Timer ........................... 225 Notes on Using Watch Timer ............................ 230 Operations of Watch Timer............................... 230 Registers of Watch Timer ................................. 227 Watchdog Reset Watchdog Reset................................................. 67 Watchdog Reset Generation Delay Register WPR: Watchdog Reset Generation Delay Register ........................................................... 95 Word Alignment Word Alignment ................................................ 44 WPR WPR: Watchdog Reset Generation Delay Register ............................................... 95 Writing Data Writing.................................................... 521 Data Writing/Erase........................................... 519 WRX Setting of CSX →RDX/WRX Setup (TYP[3:0]=0101B,AWR=100BH) ......... 135 CM71-10143-5E FUJITSU SEMICONDUCTOR • CONTROLLER MANUAL FR60 32-BIT MICROCONTROLLER MB91313A Series HARDWARE MANUAL August 2010 the fifth edition Published FUJITSU SEMICONDUCTOR LIMITED Edited Sales Promotion Dept.