Notice When using this document, keep the following in mind: 1. This document may, wholly or partially, be subject to change without notice. 2. All rights are reserved: No one is permitted to reproduce or duplicate, in any form, the whole or part of this document without Hitachi's permission. 3. Hitachi will not be held responsible for any damage to the user that may result from accidents or any other reasons during operation of the user's unit according to this document. 4. Circuitry and other examples described herein are meant merely to indicate the characteristics and performance of Hitachi's semiconductor products. Hitachi assumes no responsibility for any intellectual property claims or other problems that may result from applications based on the examples described herein. 5. No license is granted by implication or otherwise under any patents or other rights of any third party or Hitachi, Ltd. 6. MEDICAL APPLICATIONS: Hitachi's products are not authorized for use in MEDICAL APPLICATIONS without the written consent of the appropriate officer of Hitachi's sales company. Such use includes, but is not limited to, use in life support systems. Buyers of Hitachi's products are requested to notify the relevant Hitachi sales offices when planning to use the products in MEDICAL APPLICATIONS. SH7032/7034 SERIES SuperH RIse Engine . Hardware Manual HITACHr Introduction The SH7032 and SH7034 are part of a new generation of reduced instruction-set computer-type (RISC) microcomputers that integrate RISC-type CPUs and the peripheral functions required for system configuration onto a single chip to achieve high-performance operations processing. They can operate in a power-down state, which is an essential feature for portable equipment. The SH7032 and SH7034 CPUs have RISC-type instruction sets. Basic instructions can be executed in a single clock cycle, which strikingly improves instruction execution speed. The SH7032 and SH7034 include peripheral functions such as large-capacity ROM (PROM or masked ROM), RAM, a direct memory access controller (DMAC), timers, a serial communication interface (SCI), an A/D converter, an interrupt controller (INTC), and I/O ports. These on-chip elements enable users to construct systems with the fewest possible components. External memory access support functions enable direct connection to SRAM and DRAM. without the use of glue logics. This Hardware Manual describes in detail the hardware functions of the SH7032 and SH7034. For information on the instructions, please refer to the Programming Manual. Related Manuals SH7000 Series Instructions "SH7000n600 Series Programming Manual" (Document No. ADE-602-063A). For software development support tools, contact your Hitachi sales office. Organization of This Manual Table 1 describes how this manual is organized. Figure 1 shows the relationships between the Sections within this manual. Table 1 Manual Organization Abbrev- Category Section Title ation Contents Introduction 1. Introduction Features, internal block diagram, pin layout, pin functions CPU 2. CPU CPU Register configuration, data structure. instruction features, instruction types, instruction lists Operating 3. Operating MCU mode, PROM mode Modes Modes Internal 4. Exception Resets, address errors, interrupts, trap instructions, Modules Processing illegal instructions 5. Interrupt INTC NMI interrupts, user break interrupts, IRQ interrupts, Controller on-Chip module interrupts 6. User Break UBC Break address and break bus cycles selection Controller Clock 7. Clock Pulse CPG Crystal pulse generator, duty correction circuit Generator Buses 8. Bus Controller BSC Division of memory space, DRAM interface, refresh, wait state control, parity control 9. Direct Memory DMAC Auto request, external request, on-chip peripheral Access module request, cycle steal mode, burst mode Controller Timers 10. 16-Bit ITU Waveform output mode, input capture function, counter Integrated- clear function, buffer operation, PWM mode, Timer Pulse complementary PWM mode, reset synchronized mode, Unit synchronized operation, phase counting mode, compare match output mode 11. Program-able TPC Compare match output triggers, non-overlap operation Timing Pattern Controller 12. Watchdog WDT Watchdog timer mode, interval timer mode Timer Data 13. Serial SCI Asynchronous mode, clock synchronous mode, Processing Communica- multiprocessor communication function tion Interface 14. AID Converter AID Single mode, scan mode, activation by external trigger Table 1 Manual Organization (cont) Abbrev- Category Section Title ation Contents Pins 15. Pin Function PFC Pin function selection Controller 16. Parallel I/O I/O I/O port Ports Memory 17. ROM ROM PROM mode, high-speed programming system 18. RAM RAM On-chip RAM Power-Down 19. Power-Down Sleep mode, standby mode States States Electrical 20. Electrical Absolute maximum ratings, AC characteristics, DC Characteristics Characteristics characteristics, operation timing 11. Introduction I 3. Operating modes 14. Exception processing Is. Interrupt controller (INTC) 16. User break controller (UBC) I _- ------- ........ 10. 16-bit integrated-timer pulse unit (lTU) 9. Direct memory access 11. Programmable timing controller (DMAC) pattern controller (TPC) 112. Watchdog timer (WDT) I 1-- - - - - - - -:- -, 1~~~P~O~!~~~g..J 13. Serial communication interface (SCI) 114. AID converter I 1S. Pin function controller (PFC) 116. Parallel I/O ports 1 119. Power-down states 120. Electrical characteristics 1 Manual Organization Scheme Addresses of On-Chip Peripheral Module Registers The on-chip peripheral module registers are located in the on-chip peripheral module space (area 5: H'5000000-H'5FFFFFF), but since the actual register space is only 512 bytes, address bits A23- A9 are ignored. 32k shadow areas in 512 byte units that contain exactly the same contents as the actual registers are thus provided in the on-chip peripheral module space. In this manual, register addresses are specified as though the on-chip peripheral module registers were in the 512 bytes H'5FFFEOO-H'5FFFFFF. Only the values of the A27-A24 and A8-AO bits are valid; the A23-A9 bits are ignored. When H'5000000-H'50001FF is accessed, for example, the result will be the same as when H'5FFFEOO-H'5FFFFFF is accessed. For more details, see Section 8.3.5, Area Description: Area 5. Table of Contents Section 1 Overview .......................................................................................... . 1.1 SH Microcomputer Features ............................................................................................. . 1.2 Block Diagram................................................................................................................... 6 1.3 Pin Descriptions ............ ..... ...... .................. ......... ...... ...... .... ......... ........ ............. ... ...... ..... ... 7 1.3.1 Pin Arrangement ................................................................................................ 7 1.3.2 Pin Functions...................................................................................................... 8 1.3.3 Pin Layout by Mode........................................................................................... 12 Section 2 CPU................................................................................................... 15 2.1 Register Configuration....................................................................................................... 15 2.1.1 General Registers (Rn) ....................................................................................... 15 2.1.2 Control Registers ....................... ......................................................................... 15 2.1.3 System Registers ................................................................................................ 16 2.1.4 Initial Values of Registers .................................................................................. 17 2.2 Data Formats ........................... ........................................................................................... 17 2.2.1 Data Format in Registers. ...... ........... .... ....... ....... ............. ...... .......... ..... .... ..... ..... 17 2.2.2 Data Format in Memory..................................................................................... 18 2.2.3 Immediate Data Format...................................................................................... 18 2.3 Instruction Features............................................................................................................ 19 2.3.1 RISC-Type Instruction Set................................................................................. 19 2.3.2 Addressing Modes .............................................................................................. 22 2.3.3 Instruction Formats ............................................................................................ 25 2.4 Instruction Set ...... ..... ................ ...... ..... ... ...... .... ... ..... ...... .............. ......... ........ .......... ..... ..... 28 2.4.1 Instruction Set by Classification. ... ............ .......... ... ... .......... ..... ..... ......... ....... .... 28 2.4.2 Operation Code Map .......................................................................................... 39 2.5 CPU State. ...... .... .... ... ...... ......... ............ ...... .................. ...... ... ...... ... ....... ... ........... ... ...... ...... 42 2.5.1 State Transitions................................................................................................. 42 2.5.2 Power-Down State.............................................................................................. 44 Section 3 Operating Modes ............................................................................... 47 3.1 Types of Operating Modes and Their Selection ................................................................ 47 3.2 Operating Mode Descriptions ............................................................................................ 47 3.2.1 Mode 0 (MCU Mode 0) ..................................................................................... 47 3.2.2 Mode 1 (MCU Mode 1) ..................................................................................... 47 3.2.3 Mode 2 (MCV Mode 2) ..................................................................................... 47 3.2.4 Mode 7 (PROM mode) ...................................................................................... 47 Section 4 Exception Processing....... ......... ......... ...... ............... ............... ........... 49 4.1 Overview. ... .... ....... ..... .... ................ ...... .... ......... ....... ... ................. .... ...... ....... ....... .............. 49 4.1.1 Exception Processing Types and Priorities ........................................................ 49 4.1.2 Exception Processing Operation ........................................................................ 51 4.1.3 Exception Process Vector Table. ..... ........... ........... ........ .... ..... .... ............ ...... ..... 51 4.2 Reset ........... ........... .... ...... ........ ................ ...... ............... ..... ... ............. ..... .......... ................. 53 4.2.1 Reset Types ........................................................................................................ 53 4.2.2 Power-On Reset.................................................................................................. 53 4.2.3 Manual Reset...................................................................................................... 54 4.3 Address Errors ......... .............. ..... ................. ... ........... .............. ........ ..... ................. ............ 54 4.31 Address Error Sources ........................................................ ".............................. 54 4.3.2 Address Error Exception Processing.................................................................. 55 4.4 Interrupts ..... ....... .... ...... .... ........ ..... .............................. ......... ........................... ................... 56 4.4.1 Interrupt Sources ............. ......... ..... ....................... ........... ....... ......... ................... 56 4.4.2 Interrupt Priority Rankings .. .... ................. ....... .... ....... ......... ...... ........................ 56 4.4.3 Interrupt Exception Processing .. ..... .......... ........... ........... ........ ........ ................... 57 4.5 Instruction Exceptions .. ........ .................... ................. ......... ... .................................... ........ 57 - 4.5.1 Types of Instruction Exceptions ...................................................................... ;. 57 4.5.2 Trap Instruction .................................................................................................. 57 4.5.3 Illegal Slot Instruction........................................................................................ 58 4.5.4 General Illegal Instructions ................................................................................ 58 4.6 Cases in which Exceptions Are Not Accepted .................................................................. 59 4.6.1 Immediately after Delayed Branch Instructions ................................................ 59 4.6.2 Immediately after Interrupt-Disabling Instructions............................................ 59 4.7 Stack Status after Exception Processing............................................................................ 60 4.8 Notes .................................................................................................................................. 61 4.8.1 Value of the Stack Pointer (SP) .................................. ;....................................... 61 4.8.2 Value of the Vector Base Register (VBR) ......................................................... 61 4.8.3 Address Errors that Are Caused by Stacking During Address Error Exception Processing ......................................................................................... 61 Section 5 Interrupt Controller.. ......... .......... ................................ ......... .............. 63 5.1 Overview............................................................................................................................ 63 5.1.1 Features .............................................................................................................. 63 5.1.2 Block Diagram................................................................................................... 63 5.1.3 Pin Configuration............................................................................................... 65 5.1.4 Registers............................................................................................................. 65 5.2 Interrupt Sources................................................................................................................ 65 5.2.1 NMI Interrupts.................................................................................................... 65 5.2.2 User Break Interrupt........................................................................................... 66 5.2.3 IRQ Interrupts ...................................................................'................................. 66 5.2.4 On-Chip Interrupts ............................................................................................. 66 5.2.5 Interrupt Exception Vectors and Priority Rankings ........................................... 66 5.3 Register Descriptions......................................................................................................... 70 5.3.1 Interrupt Priority Registers A-E (IPRA-IPRE) ................................................. 70 5.3.2 Interrupt Control Register (lCR) ........................................................................ 71 5.4 Interrupt Operation ............................................................................................................ 72 5.4.1 Interrupt Sequence.............................................................................................. 72 5.4.2 Stack after Interrupt Exception Processing ........................................................ 74 5.5 Interrupt Response Time.................................................................................................... 75 Section 6 User Break Controller ....................................................................... 77 6.1 Overview...... ..... ............ ....... ............ ....... ..... ........ ............. ..... ............ ........ ... ...... ........ ....... 77 6.1.1 Features .............................................................................................................. 77 6.1.2 Block Diagram ......... ..... ..... ......... .......................... .... ........ ............ ... ......... ......... 77 6.1.3 Register Configuration .......................................... ,........ .............. ..... ....... ...... .... 78 6.2 Register Descriptions......................................................................................................... 79 6.2.1 Break Address Registers (BAR) ........................................................................ 79 6.2.2 Break Address Mask Register (BAMR) .... ..... ............. ...... .... .... ..... ........ ........ ... 80 6.2.3 Break Bus Cycle Register (BBR)....................................................................... 81 6.3 Operation. .... ............ ....... ...... .......... ...... ..... ........... .... ..... ......... .............. ........... ........ .... ... .... 83 6.3.1 Flow of the User Break Operation ..................................................................... 83 6.3.2 Break on Instruction Fetch Cycles to On-Chip Memory....................... ............ 86 6.3.3 Program Counter (PC) Value Saved in User Break Interrupt Exception Processing.......................................................................................................... 86 6.4 Setting User Break Conditions .......................................................................... ................ 86 6.5 Notes. ..... ..... ...... ........... ..... ... .......... ..... ........... ...... ............ ......... ...... ...... ......... .... ... ..... ........ 88 6.5.1 On-Chip Memory Instruction Fetch................................................................... 88 6.5.2 Instruction Fetch at Branches............................................................................. 88 Section 7 Clock Pulse Generator......... ........ ...... .... ..... ... ..................... ....... ........ 89 7.1 Overview..................................................................... ........ ............................................... 89 7.2 Clock Source...................................................................................................................... 89 7.2.1 Connecting a Crystal Resonator......................................................................... 89 7.2.2 External Clock Input .......................................................................................... 90 7.3 Usage Notes....................................................................................................................... 91 Section 8 Bus State Controller .......................................................................... 93 8.1 Overview.......................................... .............. ...... ...... ...... ....... ........................... ................ 93 8.1.1 Features .............................................................................................................. 93 8.1.2 Block Diagram ........ ............. ........... ......... ................... ..................... .................. 93 8.1.3 Pin Configuration ......... .............. ....... ..................... ............... ............................. 95 8.1.4 Register Configuration....... ................. ................ .................. ................... .......... 95 8.1.5 Overview of Areas .......................................................... .......................... ......... 96 8.2 Register Descriptions......................................................................................................... 97 8.2.1 Bus Control Register (BCR) .............................................................................. 97 8.2.2 Wait State Control Register I (WCR I) .............................................................. 99 8.2.3 Wait State Control Register 2 (WCR2) .............................................................. 102 8.2.4 Wait State Control Register 3 (WCR3) .............................................................. 104 8.2.5 DRAM Area Control Register (DCR) ................................................................ 105 8.2.6 Refresh Control Register (RCR) ........................................................................ 108 8.2.7 Refresh Timer Control/Status Register (RTCSR) .............................................. 110 8.2.8 Refresh Timer Counter (RTCNT) ................. :........................................... ;........ III 8.2.9 Refresh Time Constant Register (RTCOR) ....................................................... 112 8.2.10 Parity Control Register (PCR)............................................................................ 113 8.2.11 Notes on Register Access ................................................................................... 114 8.3 Address Space Subdivision ................................................................................................ 116 8.3.1 Address Spaces and Areas .................................................................................. 116 8.3.2 Bus Width .......................................................................................................... 118 8.3.3 Chip Select Signals (CSO-CS7) ......................................................................... 118 8.3.4 Shadows ............................................................................................................. 119 8.3.5 Area Description ................................................................................................ 121 8.4 Accessing External Memory Space ................................................................................... 128 8.4.1 ·Basic Timing ...................................................................................................... 128 8.4.2 Wait State Control .............................................................................................. 129 8.4.3 Byte Access Control ........................................................................................... 132 8.5 DRAM Interface Operation ............................................................................................... 133 8.5.1 DRAM Address Multiplexing ........................................................................... 133 8.5.2 Basic Timing ...................................................................................................... 135 8.5.3 Wait State Control .............................................................................................. 137 8.5.4 Byte Access Control ........................................................................................... 139 8.5.5 DRAM Burst Mode ............................................................................................ 141 8.5.6 Refresh Control .................................................................................................. 147 8.6 AddresslData Multiplexed 1/0 Space Access ......................................... ,.......................... 150 8.6.1 Basic Timing ...................................................................................................... 150 8.6.2 Wait State Control .............................................................................................. 152 8.6.3 Byte Access Control........................................................................................... 152 8.7 Parity Check and Generation ............................................................................................. 153 8.8 Warp Mode ........................................................................................................................ 153 8.9 Wait State Control. ............................................................................................................. 154 8.10 Bus Arbitration .................................................................................................................. 156 8.10.1 The Operation of Bus Arbitration ...................................................................... 157 8.11 Usage Notes ....................................................................................................................... 158 8.11.1 Usage Notes on Manual Reset ........................................................................... 158 8.11.2 Usage Notes on Parity Data Pins DPH and DPL ............................................... 161 Section 9 Direct Memory Access Controller (DMAC) .................................... 163 9.1 Overview............................................................................................................................ 163 9.1.1 Features .............................................................................................................. 163 9.1.2 Block Diagram ............................... ,................................................................... 164 9.1.3 Pin Configuration ............................................................................................... 166 9.1.4 Register Configuration ....................................................................................... 167 9.2 Register Descriptions ......................................................................................................... 168 9.2.1 DMA Source Address Registers 0-3 (SARO-SAR3) ........................................ 168 9.2.2 DMA Destination Address Registers 0-3 (DARO-DAR3) ................................ 168 9.2.3 DMA Transfer Count Registers 0-3 (TCRO-TCR3) ................... ....... .... ........... 169 9.2.4 DMA Channel Control Registers 0-3 (CHCRO-CHCR3) ................................ 169 9.2.5 DMA Operation Register (DMAOR) ................................................................ 175 9.3 Operation ............................................................................................................................ 176 9.3.1 DMA Transfer Flow ........................................................................................... 176 9.3.2 DMA Transfer Requests. ............... ............. ........... ................ .... ............ ......... ... 178 9.3.3 Channel Priority ................................................................................................. 180 9.3.4 DMA Transfer Types ......................................................................................... 185 9.3.5 Number of Bus Cycle States and DREQ Pin Sample Timing ............................ 192 9.3.6 DMA Transfer Ending Conditions.. ........... ........... ........ .... ........... .... .... ..... ..... .... 199 9.4 Examples of Use ................................................................................................................ 200 9.4.1 DMA Transfer between On-Chip RAM and a Memory-Mapped External Device......................... ......................................................................... 200 9.4.2 Example of DMA Transfer between On-Chip SCI and External Memory ........ 201 9.4.3 Example of DMA Transfer Between On-Chip AID Converter and External Memory....................... ......................................................................... 202 9.5 Cautions .......................... ......... .......................................................................................... 203 Section 10 16-Bit Integrated-Timer Pulse Unit.. ............................................... 205 10.1 Overview ............................................................................................................................ 205 10.1.1 Features .............................................................................................................. 205 10.1.2 Block Diagram ................................................................................................... 208 10.1.3 Input/Output Pins ............................................................................................... 213 10.1.4 Register Configuration ....................................................................................... 214 10.2 ITU Register Descriptions ................................................................................................. 216 10.2.1 Timer Start Register (TSTR) .............................................................................. 216 10.2.2 Timer Synchro Register (TSNC) ........................................................................ 218 10.2.3 Timer Mode Register (TMDR) .......................................................................... 219 10.2.4 Timer Function Control Register (TFCR) .......................................................... 222 10.2.5 Timer Output Control Register (TOCR) ............... ,............................................ 223 10.2.6 Timer Counters (TCNT) .................................................................................... 224 10.2.7 General Registers A and B (GRA and GRB) ..................................................... 225 10.2.8 Buffer Registers A and B (BRA, BRB) ............................................................. 226 10.2.9 Timer Control Register nCR) ........................................................................... 227 10.2.10 Timer 110 Control Register (TIOR) ................................................................... 229 10.2.11 Timer Status Register (TSR) .............................................................................. 230 10.2.12 Timer Interrupt Enable Register (TIER) ............................................................ 232 10.3 CPU Interface .................................................................................................................... 233 10.3.1 16-Bit Accessible Registers ............................................................................... 233 10.3.2 8-Bit Accessible Registers ................................................................................. 235 10.4 Description of Operation .................................................................................................... 236 10.4.1 Overview ............................................................................................................ 236 1004.2 Basic Functions .................................................................................................. 237 1004.3 Synchronizing Mode .......................................................................................... 248 10.4.4 PWM Mode .......................................... ;............................................................. 250 10.4.5 Reset-Synchronized PWM Mode ....................................................................... 253 1004.6 Complementary PWM Mode ............................................................................. 256 1004.7 Phase Counting Mode ........................................................................................ 264 1004.8 Buffer Mode ....................................................................................................... 266 10.4.9 ITU Output Timing ............................................................................................ 272 10.5 Interrupts ............................................................................................................................ 273 10.5.1 Timing of Setting Status Flags...... ................ ........................... .......... .......... ...... 273 10.5.2 Clear Timing of Status Flags .............................................................................. 275 10.5.3 Interrupt Sources and Activating the DMAC ..................................................... 276 10.6 Notes and Precautions ........................................................................................................ 277 10.6.1 Contention between TCNT Write and Clear ...................................................... 277 10.6.2 Contention between TCNT Word Write and Increment .................................... 278 10.6.3 Contention between TCNT Byte Write and Increment.. .................................... 279 10.6.4 Contention between GR Write and Compare Match ......................................... 280 10.6.5 Contention between TCNT Write and OverflowlUnderflow ............................. 281 10.6.6 Contention between General Register Read and Input Capture........ ................. 282 10.6.7 Contention Between Counter Clearing by Input Capture and Counter Increment .............................................................................................. 283 10.6.8 Contention between General Register Write and Input Capture ........................ 284 10.6.9 Note on Waveform Cycle Setting ...................................................................... 284 10.6.10 Contention Between BR Write and Input Capture.............. ...... ............ ............. 285 10.6.11 Note on Writing in the Synchronizing Mode ..................................................... 286 10.6.12 Note on Setting Reset-synchronized PWM Mode/Complementary PWM Mode............................................................................. .................. ......... 286 10.6.13 Clearing the Complementary PWM Mode ........................................................ 287 10.6.14 ITU Operating Modes ........................................................................................ 287 Section 11 Programmable Timing Pattern Controller ....................................... 295 11.1 Overview................................... ........................ ................................ ....... ....... ................... 295 11.1.1 Features ....... .................... ................. .......... ........... ........ .......... ......... .................. 295 11.1.2 Block Diagram.. ......... ............... .................................... ........ ..................... ........ 296 11.1.3 Input/Output Pins ......... ;..................................................................................... 297 11.1.4 Registers............. ........ ................. ....... ....... ............. ..................................... ....... 298 11.2 Register Descriptions........................ ..... ...... ......... ......... .... ....................... ............... .......... 299 11.2.1 Port B Control Registers 1 and 2 (PBCR 1, PCBR2) .......................................... 299 11.2.2 Port B Data Register (PBDR) ............................................................................ 300 11.2.3 Next Data Register A (NDRA) .. ................ .............. ......................... ......... ........ 300 11.204 Next Data Register B (NDRB) ........................................................................... 302 11.2.5 Next Data Enable Register A (NDERA) ............................................................ 304 11.2.6 Next Data Enable Register B (NDERB) ............................................................ 305 11.2.7 TPC Output Control Register (TPCR) ............................................................... 306 11.2.8 TPC Output Mode Register (TPMR) ................................................................. 307 11.3 Operation.. ........ .............. ........................... ........ ........ .......... .......... ....... .... ... ............. ... ....... 308 11.3.1 Overview......................... ................................................................................... 308 11.3.2 Output Timing .................................................................................................... 309 11.3.3 Examples of Use of Ordinary TPC Output ........................................................ 3 I 0 11.3.4 TPC Output Non-Overlap Operation ................................................................. 3 I 3 11.3.5 TPC Output by Input Capture... ...................................................... ......... .......... 317 11.4 Usage Notes ....................................................................................................................... 318 11.4.1 Non-Overlap Operation ...................................................................................... 318 Section 12 Watchdog Timer .............................................................................. 321 12.1 Overview................................................................... ................................. ........................ 321 12.1.1 Features .............................................................................................................. 321 12.1.2 Block Diagram ................................................................................................... 322 12.1.3 Pin Configuration ....................................................................................... :....... 322 12.1.4 Register Configuration ....................................................................................... 323 12.2 Register Descriptions.......................................... .................. .................. ........................... 323 12.2.1 Timer Counter (TCNT) ............. ........................................... ........ ............ .......... 323 12.2.2 Timer Control/Status Register (TCSR) .............................................................. 324 12.2.3 . Reset Control/Status Register (RSTCSR) .......................................................... 325· 12.2.4 Register Access .................................................................................................. 327 12.3 Operation ............................................................................................................................ 328 12.3.1 Operation in the Watchdog Timer Mode ........................................................... 328 12.3.2 Operation in the Interval Timer Mode ............................................................... 330 12.3.3 Operation in the Standby Mode ......................................................................... 330 12.3.4 Timing of Setting the Overflow Flag (OVF) ..................................................... 331 12.3.5 Timing of Setting the Watchdog Timer Overflow Flag (WOVF) ..................... 331 12.4 Usage Notes ....................................................................................................................... 332 12.4.1 TCNT Write and Count Up Contention ............................................................. 332 12.4.2 Changing CKS2-CKSO Bit Values .................................................................... 332 12.4.3 Changing Watchdog TimerlInterval Timer Modes ............................................ 332 12.4.4 System Reset With WDTOVF ........................................................................... 333 12.4.5 Internal Reset With the Watchdog Timer .......................................................... 333 Section 13 Serial Communication Interface ...................................................... 335 13.1 Overview ............................................................................................................................ 335 13.1.1 Features .............................................................................................................. 335 13.1.2 Block Diagram ................................................................................................... 336 13.1.3 Input/Output Pins ............................................................................................... 337 13.1.4 Register Configuration ....................................................................................... 337 13.2 Register Descriptions ......................................................................................................... 338 13.2.1 Receive Shift Register ........................................................................................ 338 13.2.2 Receive Data Register ........................................................................................ 338 13.2.3 Transmit Shift Register ...................................................................................... 338 13.2.4 Transmit Data Register ...................................................................................... 339 13.2.5 Serial Mode Register. ................ ............................ ................ ..... ........................ 339 13.2.6 Serial Control Register ....................................................................................... 341 13.2.7 Serial Status Register ......................................................................................... 345 13.2.8 Bit Rate Register (BRR) .................................................................................... 349 13.3 Operation ............................................................................................................................ 357 13.3.1 Overview ............................................................................................................ 357 13.3.2 Operation in Asynchronous Mode ..................................................................... 359 13.3.3 Multiprocessor Communication ......................................................................... 370 13.3.4 Clocked Synchronous Operation ........................................................................ 378 13.4 SCI Interrupt Sources and the DMAC .... ,.......................................................................... 388 13.5 Usage Notes ....................................................................................................................... 388 Section 14 AID Converter ................................................................................. 393 14.1 Overview ............................................................................................................................ 393 14.1.1 Features .............................................................................................................. 393 14.1.2 Block Diagram ................................................................................................... 394 14.1.3 Configuration of Input Pins ................................................................................ 395 14.1.4 Configuration of AID Registers ...... ...................... ...... ...... ................................. 396 14.2 Register Descriptions ......................................................................................................... 396 14.2.1 AID Data Registers A-D (ADDRA-ADDRD) .................................................. 396 14.2.2 AID Control/Status Register (ADCSR) .............................................................. 397 14.2.3 AID Control Register (ADCR) .......................................................................... 399 14.3 CPU Interface .................................................................................................................... 400 14.4 Operation ............................................................................................................................ 402 14.4.1 Single Mode (SCAN =0) ................................................................................... 402 14.4.2 Scan Mode (SCAN = 1) ..................................................................................... 404 14.4.3 Input Sampling Time and AID Conversion Time .............................................. 406 14.4.4 AID Conversion Start by External Trigger Input.. ............................................. 407 14.5 Interrupts and DMA Transfer Requests ............................................................................. 407 14.6 Definitions of AID Conversion Accuracy .......................................................................... 408 14.7 AID Converter Usage Notes ..........................................................................................,.... 409 14.7.1 Setting Analog Input Voltage ..................... ,...................................................... 409 14.7.2 Handling of Analog Input Pins .......................................................................... 409 Section 15 Pin Function Controller.. ................................................................. 411 15.1 Overview ............................................................................................................................ 411 15.2 Register Configuration ....................................................................................................... 413 15.3 Register Descriptions ......................................................................................................... 413 15.3.1 PortA 110 Register (PAIOR) ............................................................................. 413 15.3.2 Port A Control Registers (PACRI and PACR2) ................................................ 414 15.3.3 Port B 1/0 Register (PBIOR) ............................................................................. 419 15.3.4 Port B Control Registers (PBCRI and PBCR2) ................................................ 420 15.3.5 Column Address Strobe Pin Control Register (CASCR) ................................... 425 Section 16 Parallel 110 Ports ............................................................................. 427 16.1 Overview ............................................................................................................................ 427 16.2 Port A................................................................................................................................. 427 16.2.1 Register Configuration ....................................................................................... 427 16.2.2 Port A Data Register (PADR) ............................................................................ 428 16.3 Port B ................................................................................................................................. 429 16.3.1 Register Configuration ....................................................................................... 429 16.3.2 Port B Data Register (PBDR) ............................................................................ 430 16.4 PortC ................................................................................................................................. 431 16.4: 1 Register Configuration ....................................................................................... 431 16.4.2 Port C Data Register (PCDR) ............................................................................ 432 Section 17 ROM ................................................................................................ 433 17.1 Overview ............................................................................................................................ 433 17.2 PROM Mode ...................................................................................................................... 434 17.2.1 Setting the PROM Mode .................................................................................... 434 17.2.2 Socket Adapter Pin Correspondence and Memory Map .................................... 434 17.3 PROM Programming......................................................................................................... 436 17.3.1 Selecting the Programming ~ode ...................................................................... 436 17.3.2 WritelVerify and Electrical Characteristics ....................................................... 437 17.3.3 Points to Note About Writing ............................................................................ 441 17.3.4 Reliability After Writing .................................................................................... 442 Section 18 RAM ................................................................................................ 443 18.1 Overview ............................................................................................................................ 443 18.2 Operation ............................................................................................................................ 444 Section 19 Power-Down States ......................................................................... 445 19.1 Overview ............................................................................................................................ 445 19.1.1 Power-Down Modes .......................................................................................... 445 19.1.2 Register .............................................................................................................. 446 19.2 Standby Control Register (SBYCR) .................................................................................. 446 19.3 Sleep Mode ........................................................................................................................ 447 19.3.1 Transition to the Sleep Mode ............................................................................. 447 19.3.2 Canceling the Sleep Mode .................................................................................. 447 19.4 Standby Mode .................................................................................................................... 447 19.4.1 Transition to the Standby Mode ......................................................................... 447 19.4.2 Canceling the Standby Mode ............................................................................. 449 19.4.3 Standby Mode Application ................................................................................ 450 Section 20 Electrical Characteristics ................................................................ .451 20.1 Absolute Maximum Ratings .............................................................................................. 451 20.2 DC Characteristics ............................................................................................................. 452 20.3 AC Characteristics ............................................................................................................. 459 20.3.1 Clock Timing ...................................................................................................... 459 20.3.2 Control Signal Timing ........................................................................................ 461 20.3.3 Bus Tirning ......................................................................................................... 464 20.3.4 DMAC Timing ................................................................................................... 496 20.3.5 16-bit Integrated Timer Pulse Unit Timing ........................................................ 498 20.3.6 Programmable Timing Pattern Controller and I/O Port Timing ........................ 499 20.3.7 Watchdog Timer Timing .................................................................................... 500 20.3.8 Serial Communications Interface Timing .......................................................... 501 20.3.9 AID Converter Timing ....................................................................................... 502 20.3.10 AC Characteristics Measurement Conditions .................................................... 504 20.4 ND Converter Characteristics ........................................................................................... 505 Appendix A On-Chip Peripheral Module Registers .......................................... 507 A.l List of Registers....................... ................................................................ .......................... 507 A.2 Register Tables .................................................................................................................. 517 A.2.1 Serial Mode Register (SMR) .............................................................................. 517 A.2.2 Bit Rate Register (BRR) .................................................................................... 518 A.2.3 Serial Control Register (SCR) ............................................................................ 518 A.2.4 Transmit Data Register (TDR) ........................................................................... 520 A.2.5 Serial Status Register (SSR) .............................................................................. 520 A.2.6 Receive Data Register (RDR) ............................................................................ 522 A.2.7 AID Data Register AH-DL (ADDRAH-ADDRL) ........................................... 523 A.2.8 AID Control/Status Register (ADCSR) .............................................................. 523 A.2.9 AID Control Register (ADCR) .......................................................................... 525 A.2.1O Timer Start Register (TSTR) .............................................................................. 525 A.2.11 Timer Synchronization Register (TSNC) .......................................................... 526 A.2.12 Timer Mode Register (TMDR) .......................................................................... 528 A.2.13 Timer Function Control Register (TFCR).... ........ .......................... .............. ...... 529 A.2.14 Timer Control Registers ~ (TCRO-TCR4) ..................................................... 530 A.2.l5 Timer I/O Control Registers 0-4 (TIORO-TIOR4) ........................................... 531 A.2.16 Timer Interrupt Enable Registers ~ (TIERO-TIER4) ..................................... 532 A.2.17 Timer Status Registers ~ (TSRO-TSR4) ........................................................ 533 A.2.18 Timer Counter 0-4 (TCNTO-TCNT4) .............................................................. 534 A.2.19 General Registers A~ (GRAO-GRA4) ........................................................... 535 A.2.20 General Registers BO-4 (GRBO-GRB4) ............................................................ 536 A.2.21 Buffer Registers A3,4 (BRA3, BRA4) .............................................................. 537 A.2.22 Buffer Registers B3, 4 (BRB3, BRB4) .............................................................. 538 A.2.23 Timer Output Control Register (TOCR) ............................................................ 539 A.2.24 DMA Source Address Registers 0-3 (SARO-SAR3) ........................................ 540 A.2.25 DMA Destination Address Registers 0-3 (DARO-DAR3) ................................ 541 A.2.26 DMA Transfer Count Registers 0-3 (TCRO-TCR3) ......................................... 542 A.2.27 DMA Channel Control Registers 0-3 (CHCRO-CHCR3) ................................ 543 A.2.28 DMA Operation Registers (DMAOR) ............................................................... 546 A.2.29 Interrupt Priority Setting Register A (lPRA) ..................................................... 547 A.2.30 Interrupt Priority Setting Register B (IPRB) ...................................................... 548 A.2.31 Interrupt Priority Setting Register C (lPRC) ...................................................... 549 A.2.32 Interrupt Priority Setting Register D (IPRD) ..................................................... 550 A.2.33 Interrupt Priority Setting Register E (IPRE) ...................................................... 551 A.2.34 Interrupt Control Register (lCR) ........................................................................ 552 A.2.35 Break Address Register H (BARH) ................................................................... 553 A.2.36 Break Address Register L (BARL) .................................................................... 554 A.2.37 Break Address Mask Register H (BAMRH) ...................................................... 555 A.2.38 Break Address Mask Register L (BAMRL) ....................................................... 556 A.2.39 Break Bus Cycle Register (BBR) ....................................................................... 557 A. 2.40 Bus Control Register (BCR) .............................................................................. 559 A.2.41 Wait State Control Register 1 (WCRI) .............................................................. 560 A. 2.42 Wait State Control Register 2 (WCR2) .............................................................. 561 A.2.43 Wait State Control Register 3 (WCR3) ..................................... ,........................ 563 A. 2.44 DRAM Area Control Register (DCR) ................................................................ 564 A. 2.45 Parity Control Register (PCR) ............................................................................ 566 A.2.46 Refresh Control Register (RCR) ........................................................................ 567 A.2.47 Refresh Timer Control/Status Register (RSTCR) .............................................. 568 A.2.48 Refresh Timer Counter Register (RTCNT) ........................................................ 569 A.2.49 Refresh Timer Constant Register (RTCOR) ...................................................... 570 A.2.50 Timer Control/Status Register (TCSR) .............................................................. 570 A.2.51 Timer Counter (TCNT) .................................................................. .................... 572 A.2.52 Reset Control/Status Register (RSTCSR) .......................................................... 572 A.2.53 Standby Control Register (SBYCR) .................................................................. 573 A.2.54 Port A Data Register (PADR) ............................................................................ 574 A.2.55 Port B Data Register (PBDR) ............................................................................ 575 A.2.56 Port C Data Register (PCDR) ............................................................................ 576 A.2.57 Port A I/O Register (PAIOR) ............................................................................. 577 A.2.58 Port B Data Register (PBIOR) ........................... ,............................................... 578 A.2.59 Port A Control Register I (PACRl) .................................................................. 579 A.2.60 Port A Control Register 2 (PACR2) .................................................................. 581 A.2.61 Port B Control Register I (PBCR1) ................................................................... 583 A.2.62 Port B Control Register 2 (PBCR2) ................................................................... 585 A.2.63 Column Address Strobe Pin Control Register (CASCR) ................................... 587 A.2.64 TPC Output Mode Register (TPMR) ................................................................. 588 A.2.65 TPC Output Control Register (TPCR) ............................................................... 589 A.2.66 Next Data Enable Register A (NDERA) ............................................................ 591 A.2.67 Next Data Enable Register B (NDERB) ............................................................ 591 A.2.68 Next Data Register A (NDRA) (when the output triggers ofTPC output groups 0 and I are same) .................. 592 A.2.69 Next Data Register A (NDRA) (when the output triggers ofTPC output groups 0 and 1 are same) .................. 592 A.2.70 Next Data Register A (NDRA) (when the output triggers ofTPC output groups 0 and 1 are different) ............. 593 A.2.71 Next Data Register A (NDRA) (when the output triggers ofTPC output groups 0 and 1 are different) ............. 593 A.2.72 Next Data Register B (NDRB) (when the output triggers ofTPC output groups 2 and 3 are same) .................. 594 A.2.73 Next Data Register B (NDRB) (when the output triggers ofTPC output groups 2 and 3 are same) .................. 594 A.2.74 Next Data Register B (NDRB) (when the output triggers ofTPCoutput groups 2 and 3 are different} ............. 595 A.2.75 Next Data Register B (NDRB) (when the output triggers ofTPC output groups 2 and 3 are different) ............. 595 A.3 Register Status in Reset and Power-Down States .............................................................. 596 Appendix B Pin States ...................................................................................... 599 Appendix C External Dimensions ..................................................................... 605 1.1 Section 1 Overview SH Microcomputer Features The SH microcomputer (SH7000 series) is a new generation reduced instruction set computer (RISC) in which a Hitachi-original CPU and the peripheral functions required for system • configuration are integrated onto a single chip. The CPU has a RISC-type instruction set. Most instructions can be executed in one clock cycle, which strikingly improves instruction execution speed. In addition, the CPU has a 32-bit internal architecture for enhanced data-processing ability. As a result, the CPU enables high-performance systems to be constructed with advanced functionality at low cost, even in applications such as realtime control that require very high speeds, an impossibility with conventional microcomputers. The SH microcomputer includes peripheral functions such as large-capacity ROM, RAM, a direct memory access controller (DMAC), timers, a serial communication interface (SCI), an AID converter. an interrupt controller (lNTc), and 110 ports. External memory access support functions enable direct connection to SRAM and DRAM. These features can drastically reduce system cost. For on-chip ROM, masked ROM or electrically programmable ROM (PROM) can be selected. The PROM version can be programmed by users with a general-purpose EPROM programmer. Table l.llists the features ofthe SH microcomputers (SH7032 and SH7034). HITACHI 1 Table 1.1 Features of the S87032 and S87034 Microcomputers Feature Description CPU Original Hitachi architecture ---------------------------------------------- 32-bit internal data paths General-register machine: • Sixteen 32-bit general registers • Three 32-bit control registers • Four 32-bit system registers RiSe-type instruction set: • Instruction length: 16-bit fixed length for improved code efficiency • Load-store architecture (basic arithmetic and logic operations are executed between registers) • Delayed unconditional branch instructions reduce pipeline disruption • Instruction set optimized for C language Instruction execution time: one instruction/cycle (50 ns/instruction at 2D-MHz operation) Address space: 4 Gbytes available on the architecture On-chip multiplier: multiplication operations (16 bits x 16 bits ~ 32 bits) executed in 1-3 cycles, and multiplication/accumulation operations (16 bits x 16 bits + 42 bits ~ 42 bits) executed in 2-3 cycles Five-stage pipeline Operating modes Operating modes: • On-chip ROM less mode • On-chip ROM mode (SH7034 only) Processing states: • Power-on reset state • Manual reset state • Exception processing state • Program execution state • Power-down state • Bus-released state Power-down states: • Sleep mode • Software standby mode 2 HITACHI Table 1.1 Features of the SH7032 and SH7034 Microcomputers (cont) Feature Description Interrupt controller (INTC) Nine external interrupt pins (NMI, IROQ-IR07) Thirty-one internal interrupt sources Sixteen programmable priority levels User break controller (UBC) Generates an interrupt when the CPU or DMAC generates a bus cycle with specified conditions Simplifies configuration of a self-debugger Clock pulse generator (CPG) On-chip clock pulse generator (maximum operating frequency: 20 MHz): • 20-MHz pulses can be generated from a 20·MHz crystal with a duty cycle correcting circuit Bus state controller (BSG) Supports external memory access: • Sixteen-bit external data bus Address space divided into eight areas with the following preset features: • Bus size (8 or 16 bits) • Number of wait cycles can be defined by user. • Type of area (external memory area, DRAM area, etc.) - Simplifies connection to ROM, SRAM, DRAM, and peripheral I/O • When the DRAM area is accessed: RAS and CAS signals for DRAM are output Tp cycles can be generated to assure RAS precharge time Address multiplexing is supported internally, so DRAM can be connected directly • Chip select signals (CSO toCS7) are output for each area DRAM refresh function: • Programmable refresh interval • Supports CAS-before-RAS refresh and self-refresh modes DRAM burst access function: • Supports high-speed access modes for DRAM Wait cycles can be inserted by an external WAIT signal One-stage write buffer improves the system performance Data bus parity can be generated and checked HITACHI 3 Table 1.1 Features of the SH7032 and SH7034 Microcomputers (cont) Feature Description Direct memory access Permits DMA transfer between the following modules: controller (DMAC) • External memory (4 channels) • ExternallJO • On-chip memory • Peripheral on~chip modules (except DMAC) DMA transfer can be requested from external pins, on-chip SCI, on- chip timers, and on-chip AID converter Cycle-steal mode or burst mode Channel priority level is selectable Channels 0 and 1: dual or single address transfer mode is selectable; external request sources are supported; Channels 2 and 3: dual address transfer mode, internal request sources only 16-bit integrated-timer Ten types of waveforms can be output pulse unit (ITU) Input pulse width and cycle can be measured PWM mode: pulse output with 0-100% duty cycle (maximum resolution: 50 ns) Complementary PWM mode: can output a maximum of three pairs of non-overlapping PWM waveforms Phase counting mode: can count up or down according to the phase of an external two-phase clock Timing pattern controller Maximum 16-bit output (4 bits x 4 channels) can be output (TPC) Non-overlap intervals can be established between pairs of waveforms Timing-source timer is selectable Watchdog timer (WDT) Can be used as watchdog timer or interval.timer (1 channel) Timer overflow can generate an internal reset, extemal signal, or interrupt Power-on reset or manual reset can be selected as the internal reset Serial communication Asynchronous or clocked synchronous mode is selectable interface (SCI) (2 channels) Can transmit and receive simultaneously (full duplex) On-chip baud rate generator in each channel Multiprocessor communication function AID converter Ten bits x 8 channels Can be externally triggered Variable reference voltage 4 HITACHI Table 1.1 Features of the SH7032 and SH7034 Microcomputers (cont) Feature Description 1/0 ports Total of 40 I/O lines (32 input/output lines, 8 input-only lines): • Port A: 16 input/output lines (input or output can be selected for each bit) • Port B: 16 input/output lines (input or output can be selected for each bit) • Port C: 8 input lines Large on-chip memory SH7034 (on-chip ROM version): 64-kbyte electrically programmable ROM or masked ROM, and 4-kbyte RAM SH7032 (ROMless version): 8-kbyte RAM 32-bit data can be accessed in one clock cycle Table 1.2 Product Line Product On-Chip Operating Operating Model Package Number ROM Voltage Frequency SH7034 PROM 5.0 V . 2-20 MHz HD6477034F20 112-pin plastic QFP (FP-112) 2-16.6 MHz HD6477034F16 3.3V 2-12.5 MHz HD6477034VF12* Masked 5.0 V 2-20 MHz HD6437034F20 ROM 2-16.6 MHz HD6437034F16 3.3V 2-12.5 MHz HD6437034VF12* SH7032 None 5.0V 2-20 MHz HD6417032F20 2-16.6 MHz HD6417032F16 3.3 V 2-12.5 MHz HD6417032VF12* Note: Under development HITACHI 5 1.2 Block Diagram RE"S- Wi5TOVF -- ~- ~~~_A15 _A14 _A13 -~ MOl -- _All MDO- NMI- CK --.h EXTAL._ XTAL -. nae 130> CPU VedVpp)'2 - - Vee - VCC - . Vce -- Vec - Vcc· ... VCC - VCC - AD15 VSS - AD14 Vss - AD13 VSS - AD12 VSS - ADll VSS - Vss'''' AD10 VSS- AD9 VSS- ADS VSS- AD7 VSS-· AD6 ADS AV,et -- AD4 AVee--~"~~-''-~ ~~~-ror'-~.,~-r-.,-.-. . r AD3 AVss --. ...... co ~ .:.. ~ N _ 0 zzzzzzzz AD2 ~~~~~~~~ ADl 1(1(1(1(1(1(1(0. ADO . . : Peripheral address bus (24 bits) . .: Peripheral data bus (16 bits) ~ : Intemal address bus (24 bits) ~ : Intemal upper data bus (16 bits) ~ : Intemallower data bus (16 bits) Notes: 1. The SH7032 has 8 kB of RAM and no PROM or Masked ROM. The SH7034 has 4 kB of RAM and 64 kB of PROM or Masked ROM. 2. Vee: SH7032. SH7034 (Masked ROM version )Vpp: SH7034 (PROM version) Figure 1.1 Block Diagram 6 HITACHI 1.3 Pin Descriptions 1.3.1 Pin Arrangement PB14fTP1411R06 Vcc PB15fTP1511R07 Vcc Vss MD2 ADO MD1 AD1 MDO AD2 RES AD3 WOTOVF AD4 Vcc(V pp)" ADS NMI AD6 Vcc AD7 XTAL Vss EXTAL AD8 Top view Vss AD9 CK Vcc (FP-112) Vcc _____ AD10 PA1S/IRQ3/DREQ1 AD11 PA14/IRQ2/DACK1 AD12 PA 1311ROl iDREOOfTCLKB AD13 PA 12ilROOiDACKOfTCLKA AD14 PA11/DPHITIOCB1 AD1S PA1O/OPLITIOCA 1 Vss PA9iAHilROOUTiADTRG AO(HBS) PA8/BREQ A1 Vss A2 PA7/BACK A3 PAS/RD A4 PASiWRH (!JLS) AS PA4iWRL (WR) Note: Vcc: SH7032, SH7034 ( Masked ROM version )Vpp: SH7034 ( PROM version) Figure 1.2 Pin Arrangement HITACHI 7 1.3.2 Pin Functions Table 1.3 describes the pin functions. Table 1.3 Pin Functions Type Symbol Pin No. 110 Name and Function Power Vee 15,43,70, Power: Connected to the power supply. Connect all Vee 75,77*,83, pins to the system power supply. The chip will not 84,99 operate if any Vee pin is left unconnected. Vss 3,12,22, Ground: Connected to ground. Connect all Vss pins to 31,40,52, the system ·ground. The chip will not operate if any V ss 61,72,96, pin is left unconnected. 106 Vpp 77* PROM programming power supply: Connected to the power supply (Vee) during normal operation. Apply +12.5 V when programming the PROM in the SH7034 (PROM verSion). Clock EXTAL 73 Crystal/external clock: Connected to a crystal resonator or external clock input having the same frequency as the system clock (CK). XTAL 74 Crystal: Connected to a crystal resonator with the same frequency as the system clock (CK). If an external clock is input at the EXTAL pin, leave XTAL open. CK 71 0 System clock: Supplies the system clock (CK) to peripheral devices. System RES 79 Reset: Low input causes a power-on reset if NMI is high, control or a manual reset if NMI is low. WDTOVF 78 0 Watchdog timer overflow: Overflow output signal from the watchdog timer. BREQ 62 Bus request: Driven low by an external device to request the bus ownership. BACK 60 0 Bus request acknowledge: Indicates that bus ownership has been granted to an external device. By receiving the BACK signal, a device that has sent a BREQ signal can confirm that it has been granted the bus. Note: Pin 77 is Vee in the SH7032, SH7034 (Masked ROM version) and Vpp in the SH7034 (PROM version). 8 HITACHI Table 1.3 Pin Functions (cont) Type Symbol Pin No. 110 Name and Function Operating MD2, 82,81,80 Mode select: Selects the operating mode. Do not change mode MD1, these inputs while the chip is operating. The following control MDO table lists the possible operating modes and their corresponding MD2-MDO values. Operating On-chip Bus Size in M02 M01 MOO Mode ROM Area 0 0 0 0 MCU mode Disabled 8 bits 0 0 16 bits 0 0 Enabled 0 (Reserved) 0 0 0 0 PROM mode Interrupts NMI 76 Nonmaskable interrupt: Nonmaskable interrupt request signal. The rising or falling edge can be selected for signal detection. IROo- 66,67,68, Interrupt request 0-7: Maskable interrupt request signals. IR07 69, 111, Level input or edge-triggered input can be selected. 112,1,2 IROOUT 63 0 Slave interrupt request output: Indicates occurrence of an interrupt while the bus is released. Address A21-AO 47-44,42, 0 Address bus: Outputs addresses. bus 41, 3~32, 30-23 Data bus AD15-ADO 21-16,14, I/O Data bus: 16-bit bidirectional data bus that is multiplexed 13,11-4 with the lower 16 bits of the address bus. DPH 65 I/O Upper data bus parity: Parity data for D15-D8. DPL 64 I/O Lower data bus parity: Parity data for D7-DO. Bus WAIT 56 Wait: Requests the insertion of wait states (T w) into the control bus cycle when the external address space is accessed. RAS 54 0 Row address strobe: DRAM row-address strobe-timing signal. CASH 49 0 Column address strobe high: DRAM column-address strobe-timing signal outputs low level to access the upper eight data bits. HITACHI 9 Table 1.3 Pin Functions (cont) Type Symbol Pin No. I/O Name and Function Bus controlCASL 51 a Column address strobe low: DRAM column-address (cont) strobe-timing signal outputs low level to access the lower eight data bits. RD 59 a Read: Indicates reading of data from an external device. WRH 58 a Upper write: Indicates write access to the upper eight bits of an external device. WRL 57 a Lower write: Indicates write access to the lower eight bits of an external device. CSO-CS7 48,49,50, a Chip select 0-7: Chip select signals for accessing 51,53,54, external memory and devices. 55, 56 AH 63 a Address hold: Address hold timing signal for a device using a multiplexed address/data bus. HBS, LBS 23, 58 a Upper/lower byte strobe: Upper and lower byte strobe signals. (Also used as WRH and AO.) WR 57 a Write: Brought low during write access. (Also used as WRL.) DMAC DREQO, 67,69 DMA transfer request (channels 0 and 1): Input pins for DREQ1 external DMA transfer requests. DACKO, 66,68 a DMA transfer acknowledge (channels 0 and 1): Indicates DACK1 that DMA transfer is acknowledged. 16-bit TIOCAO, 53,55 I/O ITU input capture/output compare (channel 0): Input integrated- TIOCBO capture or output compare pins. timer pulse TIOCA1 64,65 I/O ITU input capture/output compare (channel 1): Input unit (ITU) TIOCB1' capture or output compare pins. TIOCA2, 97,98 I/O ITU input capture/output compare (channel 2): Input TIOCB2 capture or output compare pins. TIOCA3, 100,101 I/O ITU input capture/output compare (channel 3): Input TIQCB3 capture or output compare pins. TIOCA4, 102,103 I/O ITU input capture/output compare (channel 4): Input TIOCB4 capture or output compare pins. TOCXA4, 104,105 a ITU output compare (channel 4): Output compare pins. TOCXB4 TCLKA- 66,67, ITU timer clock input: External clock input pins for ITU TCLKD 104,105 counters. 10 HITACHI Table 1.3 Pin Functions (cont) Type Symbol Pin No. VO Name and Function Timing TP15-TPO 2,1,112- o Tim ing pattern output 15-0: Timing pattern output pins. pattern 107,105- controller 100,98,97 (TPC) Serial com- TxDO, 108, 110 0 Transmit data (channels 0 and 1): Transmit data output munication TxD1 pins for SCIO and SCI1. interface RxDO, 107, 109 Receive data (channels 0 and 1): Receive data input pins (SCI) RxD1 for SCIO and SCI1. SCKO, 111,112 I/O Serial clock (channels 0 and 1): Clock input/output pins SCK1 for SCIO and SCI1. AID AN7-ANO 95-92, Analog input: Analog signal input pins. converter 90-87 ADTRG 63 AID trigger input: External trigger input for starting AID conversion. AV ref 86 Analog reference power supply: Input pin for the analog reference voltage. AVee 85 Analog power supply: Power supply pin for analog circuits. Connect to the Vee potential. AVss 91 Analog ground: Power supply pin for analog circuits. Connect to the Vss potential. 1/0 ports PA15-PAO 69-62, I/O Port A: 16-bit input/output pins. Input or output can be 60-53 selected individually for each bit. PB15-PBO 2, 1, 112- I/O Port B: 16·bit input/output pins. Input or output can be 107, 105- selected individually for each bit. 100,98,97 PC7-PCO 95-92, I Port C: 8-bit input pins. 90-87 HITACHI 11 1.3.3 Pin Layout by Mode Table 1.4 shows pin layout by mode Table 1.4 Pin Layout by Mode PROM Mode PROM Mode Pin (SH7034PR- Pin (SH7034PR- No. MCUMode OM version) No. MCUMode OM version) PB14fTP14/1RQ6 NC 29 A6 A6 2 PB15fTP15/1RQ7 NC 30 A7 A7 3 Vss Vss 31 Vss Vss 4 ADO DO 32 A8 A8 5 AD1 D1 33 A9 OE 6 AD2 D2 34 A10 A10 7 AD3 D3 35 A11 A11 8 AD4 D4 36 A12 A12 9 AD5 D5 37 A13 A13 10 AD6 D6 38 A14 A14 11 AD7 D7 39 A15 A15 12 Vss Vss 40 Vss Vss 13 AD8 NC 41 A16 A16 14 AD9 NC 42 A17 Vee 15 Vee Vee 43 Vee Vee 16 AD10 NC 44 A18 Vee 17 AD11 NC 45 A19 Vee 18 AD12 NC 46 A20 NC 19 AD13 NC 47 A21 NC 20 AD14 NC 48 CSO NC 21 AD15 NC 49 CS1/CASH NC 22 Vss Vss 50 CS2 NC 23 AO (HBS) AO 51 CS3/CASL NC 24 A1 A1 52 Vss Vss 25 A2 A2 53 PAO/CS4fT10CAO NC 26 A3 A3 54 PA 1/CS5/RAS NC 27 A4 A4 55 PA2ICS6fT10CBO PGM 28 A5 A5 56 PA3ICS7NVAIT CE 12 HITACHI Table 1.4 Pin Layout by Mode (cont) PROM Mode . PROM Mode Pin (SH7034PR- Pin (SH7034PR- No. MCUMode OM version) No. MCUMode OM version) 57 PA4IWRL (WR) NC 85 AVee Vee 58 PA5IWRH (LBS) NC 86 AVref Vee 59 PA6/RD NC 87 PCO/ANO Vss 60 PA7/BACK NC 88 PC1/AN1 Vss 61 Vss Vss 89 PC2/AN2 Vss 62 PA8/BREQ NC 90 PC3/AN3 Vss 63 PA9/AH/IRQOUT/ADTRG NC 91 AVss Vss 64 PA 1O/DPLITIOCA 1 NC 92 PC4/AN4 Vss 65 PA11/DPHITIOCB1 NC 93 PC5/AN5 Vss 66 PA12/IRQO/DACKOITCLKA NC 94 PC6/AN6 Vss 67 PA 13/IRQ1 /DREQOITCLKB NC 95 PC7/AN7 Vss 68 PA 14/IRQ2/DACK1 NC 96 Vss Vss 69 PA 15/IRQ3/DREQ1 NC 97 PBOITPOITIOCA2 NC 70 Vee Vee 98 PB1ITP11T10CB2 NC 71 CK NC 99 Vee Vee 72 Vss Vss 100 PB2ITP2ITIOCA3 NC ~3 EXTAL NC 101 PB3ITP31T10CB3 NC 74 XTAL NC 102 PB4ITP41T10CA4 NC 75 Vee Vee 103 PB5ITP51T10CB4 NC 76 NMI A9 104 PB6ITP6ITOCXA4ITCLKC NC 77 Vee V pp 105 PB7ITP7ITOCXB4ITCLKD NC 78 WDTOVF NC 106 Vss Vss 79 RES Vss 107 PB8ITP8/RxDO NC 80 MOO Vee 108 PB9ITP9ITxDO NC 81 MD1 Vee 109 PB10ITP10/RxD1 NC 82 MD2 Vee 110 PB11ITP11ITxD1 NC 83 Vee Vee 111 PB 12ITP121IRQ4/SCKO NC 84 Vee Vee 112 PB 13ITP 131IRQ5/SCK 1 NC HITACHI 13 Section 2 CPU 2.1 Register Configuration The register set consists of sixteen 32-bit general registers. three 32-bit control registers, and four 32-bit system registers. I 2.1.1 General Registers (Rn) General registers Rn consist of sixteen 32-bit registers (RO-R 15). General registers are used for data processing and address calculation. Register RO also functions as an index register. For some instructions, the RO register must be used. Register R15 functions as a stack pointer to save or recover status registers (SR) and program counter (PC) during exception processing. 31 o AO AO functions as an index register A1 in the indexed register addressing mode and indirect indexed GSA A2 addressing mode. In some instruc- A3 tions, AO functions as a source A4 register or a destination register. A5 A6 A7 AS A9 A10 A11 A12 A13 A14 A15, SP A15 functions as a stack pointer (SP) during exception processing. Figure 2.1 General Registers (Rn) 2.1.2 Control Registers Control registers consist of the 32-bit status register (SR), global base register (GBR), and vector base register (VBR). The status register indicates processing states. The global base register functions as a bas~ address for the indirect GBR addressing mode to transfer data to the registers HITACHI 15 of peripheral on-chip modules. The vector base register functions as the base address of the exception processing vector area including interrupts. 31 9 8 7 6 5 4 32 1 0 SR I --------- M Q 13 12 11 10 -- S T I SR: Status register --.,--- -- -, L. T bit: The MOVT, CMP, TAS, TST, ST, SF, SETT, and CLRT instructions use the T bit to indicate a true (1) or false (0). The ADDV, ADDC, SUSV, SUSC, DIVOU, DIVOS, DIV1, NEGC, SHAR, SHAL, SHLR, SHLL, ROTR, ROTL, ROTCR and ROTCL instructions also use the T bit to indicate carrylborrow or overflow/underflow ---.S bit: Used by the MAC instruction. '--------if----+-..............------i.Reserved bits. These bits always read O. The write value should always be O. '------+Sits 10-13: Interrupt mask bits. ' - - - - - - - - - + M and Q bits: Used by the DIVOU, DIVOS, and DIV1 instructions. Global base register (GSR): 3,,.:..1_ _ _ _ _ _ _ _ _ _ _ _--;0 Indicates the base address of the indirect I GSR I GSR addressing mode. The indirect GSR ' - - - - - - - - - - - - - - - - ' addressing mode is used to transfer data to the register areas peripheral on-chip modules. 3,.:..1_ _ _ _ _ _ _ _ _ _ _ _--;0 Vector base register (VSR): I VSR I Stores t~e base address of the exception ' - - - - - - - - - - - - - - - - ' processing vector area. Figure 2.2 Control Registers 2.1.3 System Registers System registers consist of four 32-bit registers: multiply and accumulate registers high and low (MACH and MACL), procedure register (PR), and program counter (PC). The multiply and accumulate registers store the results of multiply and accumulate operations. The procedure register stores the return address from the subroutine procedure. The program counter stores, program addresses to control the flow of the processing. 16 HITACHI 3".1_ _ _ _ _ _ _ _ _----"'--_ _ _--';0 Multiply and accumulate (MAC) registers (sign extended) MACH high and low (MACH, MACL): Store the results of multiply and accumulate opera- MACL tions. MACH is sign-extended when read because only the lowest 10 bits are valid. 31 o Procedure register (PR): Stores a return PR address from a subroutine procedure. 3r-1_ _ _ _ _ _ _ _ _ _ _ _ _ _--;0 Program counter (PC): Indicates the I PC I fourth byte (second instruction) after '------------------' the current instruction. Figure 2.3 System Registers 2.1.4 Initial Values of Registers Table 2.1 lists the values of the registers after reset. Table 2.1 Initial Values of Registers Classification Register Initial Value General register RD-R14 Undefined ------------------------------------------------------- R15 (SP) Value of the stack pointer in the vector address table Control register SR Bits 10·13 are 1111 (H'F), reserved bits are 0, and other bits are undefined GBR Undefined VBR H'OOOOOOOO System register MACH, MACL, PR Undefined PC Value of the program counter in the vector address table 2.2 Data Formats 2.2.1 Data Format in Registers Register operands are always long words (32 bits). When the memory operand is only a byte (8 bits) or a word (16 bits), it is sign-extended into a long word when stored into a register (figure 2.4). HITACHI 17 31 o Long word Figure 2.4 Data Format in Registers 2.2.2 Data Format in Memory Memory data formats are classified into bytes, words, and long words. Byte data can be accessed from any address, but an address error will occur if you try to access word data starting from an address other than 2n or long word data starting from an address other than 4n. In such cases, the data accessed cannot be guaranteed. The hardware stack area, which is referred to by the hardware stack pointer (SP, R15), uses only long word data starting from address 4n because this area stores the program counter and status register (figure 2.5). Address m + 1 Address m + 3 - Address m 1 Add,.,s m + 2 1 - Address 2n -+ 15 31 • 23 15 • 7 7 Byte OJ7 Byte 0 7 Byte OJ7 Byte 0 Word o 15 Word 0 0 Address 4n -+ 31 Long word 0 - - Figure 2.5 Data Format in Memory 2.2.3 Immediate Data Format Byte (8-bit) immediate data is located in the instruction code. Immediate data accessed by the MOY, ADD, and CMPIEQ instructions is sign-extended and is handled in registers as long word data. Immediate data accessed by the TST, AND, OR, and XOR instructions is zero-extended and is handled as long word data. Consequently, AND instructions with immediate data always clear the upper 24 bits of the destination register. Word or long word immediate data is not located in the instruction code but rather is stored in a memory table. The memory table is accessed by a immediate data transfer instruction (MOY) using the PC relative addressing mode with displacement. 18 HITACHI 2.3 Instruction Features 2.3.1 RISC-Type Instruction Set All instructions are RISC type. Their features are as follows: 16-Bit Fixed Length: Every instruction is 16 bits long, making program coding much more efficient. One Instruction/Cycle: Basic instructions can be executed in one cycle using the pipeline system. One-cycle instructions are executed in 50 ns at 20 MHz .. Data Length: Long word is the standard data length for all operations. Memory can be accessed in bytes, words. or long words. Byte or word data accessed from memory is sign-extended and handled as long word data. Immediate data is sign-extended for arithmetic operations or zero- extended for logic operations (handled as long word data). Table 2.2 Sign Extension of Word Data CPU of SH7000 Series Description Conventional CPUs MOV.W Data is sign-extended to 32 bits, and ADD. W @(disp, PC) , R1 R1 becomes H'OO001234. It is next #H' 1234, RO operated upon by an ADD instruction. ADD Rl,RO .DATA.W H'1234 Note: The address of the immediate data is accessed by @(disp, PC). Load-Store Architecture: Basic operations are executed between registers. For operations that involve memory, data is loaded to the registers and executed (load-store architecture). Instructions such as AND that manipulate bits, however, are executed directly in memory. Delayed Branch Instructions: Unconditional branch instructions are delayed. Pipeline disruption during branching is reduced by first executing the instruction that follows the branch instruction, and then branching. See the SH7000/SH7600 Series Programming Manual for details. Table 2.3 Delayed Branch Instructions CPU of SH7000 Series Description Conventional CPU BRA TRGET Executes an ADD before ADD.W R1,RO ADD R1,RO branching to TRGET. BRA TRGET HITACHI 19 Multiplication/Accumulation Operation: The five-stage pipeline system and the on-chip multiplier enable 16-bit x 16-bit ~ 32 bit multiplication operations to be executed in 1-3 cycles. 16 bit x 16 bit + 42 bit ~ 42 bit multiplication/accumulation operations can be executed in 2-3 cycles. T bit: T bit (in the status register) is set according to the result of a comparison, and in turn is the condition (TruelFalse) that determines if the program will branch. The T bit in the status register is only changed by selected instructions, thus improving the processing speed. Table 2.4 T bit CPU of SH7000 Series Description Conventional CPU CMP/GE Rl,RO T bit is set when RO ~ R1. The program CMP.W Rl,RO BT TRGETO branches to TRGETO when RO ~ R 1 and BGE TRGETO to TRGET1 when RO Rm with Comparison unsigned data, 1 ~ T result CMP/GT Rm,Rn 00 11nnnnmmmmO 111 If Rn > Rm with Comparison signed data, 1 ~ T result CMP/PZ Rn 0100nnnnOO010001 If Rn ~ 0, 1 ~ T Comparison result CMP/PL Rn 0100nnnnOO010101 If Rn > 0, 1 ~ T Comparison result CMP/STR Rm,Rn 0010nnnnmmmm1100 If Rn and Rm have an Comparison equivalent byte, 1 ~ result T DIV1 Rm,Rn 00 11nnnnmmmm0100 Single-step division Calculation (Rn/Rm) result DIVOS Rm,Rn 00 1 OnnnnmmmmO 111 MSB of Rn ~ Q, Calculation MSB of Rm ~ M, M " result Q~T DIVOU 0000000000011001 ° ~ M/Q/T ° EXTS.B Rm,Rn 0110nnnnmmmm1110 A byte in Rm is sign- extended ~ Rn HITACHI 33 Table 2.13 Arithmetic Instructions (cont) Execution Instruction Instruction Code Operation Cycles T bit EXTS.W Rm,Rn 0110nnnnmmmm1111 A word in Am is sign- 1 extended ~ An EXTU.B Rm,~n o1 10nnnnmmmm110 0 A byte in Am is zero- extended ~ An EXTU.W Rm,Rn 0110nnnnmmmm1101 A word in Am is zero- extended ~ An MAC.W @Rm+,@Rn+ 0100nnnnmmmm1111 Signed operation of 3/(2)· (An) x (Am) + MAC ~MAC MULS Rm,Rn 0010nnnnmmmm1111 Signed operation of 1-3· AnxAm ~ MAC MULU Rm,Rn 0010nnnnmmmm1110 Unsigned operation of 1-3· AnxAm~MAC NEG Rm,Rn 0110nnnnmmmm1011 Q-Am ~ An NEGC Rm,Rn o110nnnnmmmm10 10 Q-Am-T ~ An, Borrow Borrow~ T SUB Rm,Rn 0011nnnnmmmm1000 An-Am ~An SUBC Rm,Rn 00 1 1nnnnmmmm10 10 Rn-Rm-T ~ Rn, Borrow Borrow ~ T SUBV Rm,Rn 0011nnnnmmmm1011 Rn-Rm ~Rn, Underflow Underflow ~ T Note: The normal minimum number of cycles (numbers in parenthesis represent the number of cycles when there is contension with preceding following instructions). 34 HITACHI Table 2.14 Logic Operation Instructions Execution Instruction Instruction Code Operation Cycles Tbit AND Rm,Rn 00 10nnnnmmmmlOO 1 Rn & Rm ~ Rn 1 AND #imm,RO 11001001iiiiiiii RD& imm ~ RD AND.B #imm,@(RO,GBR) 11001101iiiiiiii (RD + GBR) & imm ~ (RD 3 +GBR) NOT Rm,Rn OllOnnnnmmmmOlll -Rm ~ Rn OR Rm,Rn OOlOnnnnmmmmlOll Rn I Rm ~ Rn OR #imm,RO 11001011iiiiiiii RD I imm ~ RD OR.B #imm,@(RO,GBR) 11001111iiiiiiii (RD + GBR) I imm ~ (RD 3 +GBR) TAS.B @Rn OlOOnnnnOOOllOll If (Rn) is D, 1 ~ T; 1 ~ 4 Test MSB of (Rn) result TST Rm,Rn OOlOnnnnmmmmlOOO Rn & Rm; if the result is D, Test 1~T result TST #imm, RO 11001000iiiiiiii RD & imm; if the result is Test 0,1 ~T result TST.B #imm, @(RO,GBR) 11001100iiiiiiii (RO + GBR) & imm; if the 3 Test result is D, 1 ~ T result XOR Rm,Rn 001Onnnnmmmml01O Rn" Rm ~ Rn XOR #imm,RO 11001010iiiiiiii RD" imm ~ RD XOR.B #imm,@(RO,GBR) 11001110iiiiiiii (RO + GBR) " imm ~ (RO 3 +GBR) HITACHI 35 Table 2.15 Shift Instructions Instruction Instruction Code Operation Execution Cycles T bit ROTL Rn 0100nnnnOOOO0100 T +- Rn +- MSB 1 MSB ROTR Rn 0100nnnnOOOO0101 LSB ~ Rn ~ T LSB ROTCL Rn 0100nnnn00100100 T +- Rn +- T MSB ROTCR Rn 0100nnnn00100101 T~Rn~T LSB SHAL Rn 0100nnnn00100000 T +- Rn +-0 MSB SHAR Rn 0100nnnn0010000l MSB~Rn~T . LSB SHLL Rn OlOOnnnnOOOOOOOO T +- Rn +-0 MSB SHLR Rn 0100nnnnOOOOOO01 O~Rn~T LSB SHLL2 Rn 0100nnnnOOO01000 Rn«2~ Rn SHLR2 Rn 0100nnnnOOO01001 Rn»2 ~ Rn SHLL8 Rn 0100nnnnOO011000 Rn«8~ Rn SHLR8 Rn 0100nnnnOOOl1001 Rn»8~ Rn SHLL16 Rn 0100nnnn00101000 Rn«16 ~ Rn SHLR16 Rn 0100nnnn00101001 Rn»16 ~ Rn Table 2.16 Branch Instructions Execution Instruction Instruction Code Operation Cycles Tblt BF label 10001011dddddddd If T = 0, dispx2 + PC ~ PC; ifT= 1, 3/1· nap BT label 1000 10 01dddddddd If T = 1, dispx2 + PC ~ PC; ifT=O, 3/1* nop BRA label 1010dddddddddddd Delayed branch, dispx2 + PC ~ PC 2 BSR label 1011dddddddddddd Delayed branch, PC ~ PR, dispx2 + 2 PC~PC JMP @Rn 0100nnnn00101011 Delayed branch, Rn ~ PC 2 JSR @Rn 0100nnnn00001011 Delayed branch, PC ~ PR, Rn ~ PC 2 RTS 0000000000001011 Delayed branch, PR ~ PC 2 Note: The execution state is three cycles when program branches, and one cycle when program does not branch. 36 HITACHI Table 2.17 System Control Instructions Execution T Instruction Instruction Code Operation Cycles bit CLRT 0000000000001000 O~T 1 0 CLRMAC 0000000000101000 o ~ MACH, MACL LDC Rm,SR 0100mmmmOOO01110 Rm~SR LSB LDC Rm,GBR 0100mmmmOO011110 Rm~GBR LDC Rm,VBR 0100mmmm00101110 Rm~VBR LDC.L @Rm+,SR 0100mmmmOOOO0111 (Rm) ~ SR, Rm+4~Rm 3 LSB LDC.L @Rm+,GBR 0100mmmmOO010111 (Rm) ~ GBR, Rm + 4 ~ Rm 3 LDC.L @Rm+,VBR 0100mmmm00100111 (Rm) ~ VBR, Rm +4~ Rm 3 LDS Rm,MACH 0100mmmmOOO01010 Rm~MACH LDS Rm,MACL 0100mmmmOO011010 Rm ~MACL LDS Rm,PR 0100mmmm00101010 Rm~PR LDS.L @Rm+,MACH 0100mmmmOOOO0110 (Rm) ~ MACH, Rm+4~ Rm LDS.L @Rm+,MACL 0100mmmmOO010110 (Rm) ~ MACL, Rm + 4 ~ Rm LDS.L @Rm+,PR 0100mmmm00100110 (Rm) ~ PR, Rm + 4 ~ Rm NOP 0000000000001001 No operation RTE 0000000000101011 Delayed branch, stack area 4 ~PC/SR SETT 0000000000011000 1~T SLEEP 0000000000011011 Sleep 3" STC SR,Rn 00OOnnnnOOOOOO10 SR~Rn STC GBR, Rn OOOOnnnnOOO10010 GBR ~ Rn STC VBR,Rn OOOOnnnnOO100010 VBR~ Rn STC.L SR,@-Rn 0100nnnnOOOOO011 Rn-4 ~ Rn, SR~(Rn) 2 STC.L GBR,@-Rn 0100nnnnOOO10011 Rn-4 ~ Rn, GBR ~ (Rn) 2 STC.L VBR,@-Rn 0100nnnnOO100011 Rn-4 ~ Rn, VBR ~ (Rn) 2 STS MACH,Rn OOOOnnnnOOOO1010 MACH~Rn Note: The number of execution states before the chip enters the ~Ieep state. HITACHI 37 Table 2.16 System Control Instructions (cont) Execution T Instruction Instruction Code Operation Cycles bit STS MACL,Rn OOOOnnnnOOOl101O MACL~ Rn STS PR,Rn OOOOnnnnOO10101O PR~Rn STS.L MACH,@-Rn OlOOnnnnOOOOOO1O Rn-4 ~ Rn, MACH ~ (Rn) STS.L MACL,@-Rn OlOOnnnnOOO1OO1O Rn-4 ~ Rn, MACL~ (Rn) STS.L PR,@-Rn OlOOnnnnOO1OOO1O Rn-4 ~ Rn, PR ~ (Rn) TRAPA Hmrn 110000lliiiiiiii PC/SR ~ stack area, 8 (immx4+VBR) ~ PC Note: Instruction execution cycles: The execution cycles shown in the table are minimums. The actual number of cycles may be increased: 1. When contention occurs between instruction fetches and data access, or 2. When the destination register of the load instruction (memory ~ register) and the register used by the next instruction are the same. 38 HITACHI 2.4.2 Operation Code Map Table 2.18 is an operation code map. Table 2.18 Operation Code Map Instruction Code Fx:OOOO Fx:0001 Fx: 0010· Fx:0011-1111 MSB LSB MD: 00 MD: 01 MD: 10 MD: 11 0000 Rn Fx 0000 0000 Rn Fx 0001 0000 Rn Fx 0010 STC SR,Rn STC GBR,Rn STC VBR,Rn 0000 Rn Fx 0011 0000 Rn Rm 01MO MOV.B RM, MOV.W RM, MOV.L RM, @(RO,Rn) @(RO,Rn) @(RO,Rn) 0000 0000 Fx 1000 CLRT SETT CLRMAC 0000 0000 Fx 1001 NOP DIVOU 0000 0000 Fx 1010 0000 0000 Fx 1011 RTS SLEEP RTE 0000 Rn Fx 1000 0000 Rn Fx 1001 0000 Rn Fx 1010 STS MACH,Rn STS MACL,Rn STS PR,Rn 0000 Rn Rm 1011 I 0000 Rn 11MO MOV.B MOV.W MOV.L I IRm @(RO,Rm),Rn @(RO,Rm),Rn @(RO,Rm) ,Rn I 0001 Rn Rm disp MOV.L Rm,@(disp:4,Rn) 0010 Rn Rm OOMO MOV. B Rm, @Rn MOV. W Rm, @Rn MOV. L Rm, @Rn 0010 Rn Rm 01MO MOV.B Rm, @-Rn MOV.W Rm,@-Rn MOV. L Rm, @-Rn DIVOS Rm, Rn 0010 Rn Rm 10MO TST Rm,Rn AND Rm,Rn XOR Rm,Rn OR Rm,Rn 0010 Rn Rm 11MO CMP/STR XTRCT Rm,Rn MULU Rm,Rn MULS Rm,Rn Rm,Rn 0011 Rn Rm OOMO CMP / EQ Rm, Rn CMP/HS Rm, Rn CMP/GE Rm, Rn 0011 Rn Rm 01MO DIVl Rm,Rn CMP/HI Rm, Rn CMP IGT Rm, Rn 0011 Rn Rm 10MO SUB Rm,Rn SUBC Rm,Rn SUBV Rm,Rn 0011 Rn Rm 11MO ADD Rm,Rn ADDC Rm,Rn ADDV Rm,Rn 0100 Rn Fx 0000 SHLL Rn SHAL Rn 0100 Rn Fx 0001 SHLR Rn CMP/PZ Rn SHAR Rn 0100 Rn Fx 0010 STS.L MACH, I STS . L MACL, STS.L PR, @-Rn !@-Rn @-Rn HITACHI 39 Table 2.18 Operation Code Map (cont) Instruction Code Fx:OOOO Fx:0001 Fx:0010 Fx:0011-1111 MSB LSB MD:OO MD: 01 MD: 10 MD: 11 0100 Rn Fx 0011 STC.L STC.L I STC.L SR,@-Rn GBR,@-Rn VBR,@-Rn 0100 Rn Fx 0100 ROTL Rn ROTCL Rn 0100 Rn Fx 0101 ROTR Rn CMP/PL Rn ROTCR Rn 0100 Rm Fx 0110 LDS.L LDS.L LDS.L @Rm+,MACH @Rm+,MACL @Rm+,PR 0100 Rm Fx 0111 LDC.L LDC.L LDC.L @Rm+,SR @Rm+,GBR @Rm+,VBR 0100 Rn Fx 1000 SHLL2 Rn SHLL8 Rn SHLL16 Rn 0100 Rn Fx 1001 SHLR2 Rn SHLR8 Rn SHLL16 Rn 0100 Rm Fx 1010 LDS Rm,MACH LDS Rm,MACL LDS Rm,PR 0100 Rn Fx 1011 JSR @Rn TAS.B @Rn JMP @Rn 0100 Rm Fx 1100 0100 Rm Fx 1101 0100 Rn Fx 1110 LDC Rm,Sr LDC Rm,GBR LDC Rm,VBR 0100 Rn Rm 1111 MAC. W @Rm+, @Rn+ 0101 Rn Rm disp MOV.L @(disp:4,Rm),Rn 0110 Rn Rm OOMD MOV.B @Rm,Rn MOV . W @Rm, Rn ,MOV.L @Rm,Rn MOV Rm,Rn 0110 Rn Rm 01MD MOV.B @Rm+,Rn MOV.W @Rm+,Rn MOV.L @Rm+,Rn NOT Rm,Rn 01.10 Rn Rm 10MD SWAP.B SWAP.W NEGC Rm,Rn NEG Rm,Rn @Rm+,Rn @Rm+,Rn 0110 Rn Rm 11MD EXTU.B Rm, Rn EXTU . W Rm, Rn EXTS.B Rm,Rn EXTS. W Rm, Rn 0111 Rn imm ADD #illUll:8,Rn 1000 OOMD Rn disp MOV.B RD, MOV.W RD, @(disp:4,Rn) @(disp:4,Rn) 1000 01MD Rm disp MOV.B MOV.W RD, @(disp:4, @(disp:4, Rm) ,RD Rn) ,RD 1000 10MD imm/disp CMP/EQ BT disp: 8 BF disp:8 #illUll:8,RD 1000 11MD imm/disp 1001 Rn disp MOV.W @(di sp : 8 , PC) , Rn 1010 disp BRA disp:12 1011 disp BSR disp: 12 40 HITACHI Table 2.18 Operation Code Map (cont) Instruction Code Fx:OOOO Fx:0001 Fx:0010 Fx:0011-1111 MSB LSB MD: 00 MD: 01 MD: 10 MD: 11 1100 OOMO imm/disp MOV.B RO,@ MOV.W RO,@ MOV.L RO,@ TRAPA #imm:8 (disp:8,GBR) ( di sp : 8 , GBR) (disp: 8, GBR) 1100 01MO disp MOV.B MOV.W MOV.L MOVA @(disp:8, 1@(disp:8, @(disp:8, @(disp:8, GBR) , RO GBR) , RO GBR) , RO PC) ,RO 1100 10MO imm TST AND XOR OR #imm: 8, RO #imm: 8, RO #imm:8,RO '#imm:8,RO 1100 11MO imm TST.B AND.B XOR.B OR.B #imm: 8, l#imm:8, #imm: 8, #imm: 8, @(RO,GBR) I@(RO,GBR) @(RO,GBR) @(RO,GBR) 1101 Rn disp MOV.L @(disp:8,PC),Rn 1110 Rn I imm MOV #imm:8,Rn 1111 ... HITACHI 41 2.5 CPU State 2.5.1 State Transitions The CPU has five processing states: reset, exception processing, bus release, program execution and power-down. The transitions between the states are shown in figure 2.6. For more information on the reset and exception processing states, see section 4, Exception Processing. For details on the power-down states, see section 19, Power Down States. 42 HITACHI From any state when From any state when RES =0 and NMI = 11 RES =0 and NMI =0 - - - , f----------------t--------------~------------------------------------------- , RES =0, NMI =0 Power-on reset state .. Manual reset state RES = 0, NMI = 1 RES = 1, RES = 1, Reset states When an interrupt source NMI = 1 NMI =0 or DMA address error occurs ~----~ Exception processing state NMI interrupt source occurs Exception Exception Bus release state processing processing source occurs ends SBY bit cleared for SLEEP instruction Sleep mode Standby mode , ------------------------------------------------------------------------------- Power-down state Figure 2.6 Transitions Between Processing States Reset State: In the reset state the CPU is reset. This occurs when the RES pin level goes low. When the NMI pin is high, the result is a power-on reset; when it is low, a manual reset will occur.When turning on the power, make sure to carry out a power-on reset. HITACHI 43 On a power-on reset, all CPU internal states and on-chip peripheral module registers are initialized. In a manual reset, all CPU internal states and on-chip peripheral module registers, with the exception of the bus state controller (BSC) and pin function controller (PFC), are initialized. On a manual reset, the BSC is not initialized, so the refresh operation will continue. Exception Processing State: Exception processing is a transient state that occurs when the CPU's processing state flow is altered by exception processing sources such as resets or interrupts. For a reset, the initial values of the program counter PC (execution start address) and stack pointer SP are fetched from the exception processing vector table and stored; the CPU then branches to the execution start address and execution of the program begins. For an interrupt, the stack pointer (SP) is accessed and the program counter (PC) and status register (SR) are saved to the stack area. The exception service routine start address is fetched from the exception processing vector table; the CPU then branches to that address and the program starts executing, thereby entering the program execution state. Program Execution State: In the program execution state, the CPU sequentially executes the program. Power-Down State: In the power-down state, the CPU operation halts and power consumption declines. The SLEEP instruction places the CPU in the power-down state. This state has two modes: sleep mode and standby mode. This is described in more detail in section 2.5.1, Power- Down State. Bus Release State: In the bus release state, the CPU releases rights to the bus to the device that has requested them. 2.5.2 Power-Down State In addition to the ordinary program execution states, the CPU also has a power-down state in which CPU operation halts and power consumption is lowered. There are two power-down state modes: sleep mode and standby mode. Sleep Mode: When the standby bit SBY (in the standby control register SBYCR) is cleared to 0 and a SLEEP instruction executed, the CPU moves from program execution state to sleep mode. In the sleep mode, the CPU halts and the contents of its internal registers and the data in on-chip RAM are stored. The on-chip peripheral modules other than the CPU do not halt in the sleep mode. To return from sleep mode, use a reset, any interrupt, or a DMA address error; the CPU returns to ordinary program execution state through the exception processing state. Software Standby Mode: To enter the standby mode, set the standby bit SBY (in the standby control register SBYCR) to 1 and execute a SLEEP instruction. In standby mode, all CPU, on-chip 44 HITACHI peripheral module and oscillator functions are halted. CPU internal register contents and on-chip RAM data are held. To return from standby mode, use a reset or an external NMI interrupt. For resets. the CPU returns to ordinary program execution state through the exception processing state when placed in a reset state during oscillator stabilization time. For NMI interrupts, the CPU returns to ordinary program execution state through the exception processing state after the oscillator stabilization time has elapsed. In this mode, power consumption drops markedly, since the oscillator stops. Table 2.19 Power-Down State State On-chip CPU Peripheral Regi- Mode Conditions Clock CPU Modules sters RAM VO Ports Canceling Sleep Execute SLEEP Run Halt Run Held Held Held 1. Interrupt mode instruction with 2. DMAaddress SBY bit cleared error to 0 in SBYCR 3. Power-on reset 4. Manual reset Standby Execute SLEEP Halt Halt Halt and Held Held Held or 1. NMI mode instruction with initialize' high-Z· 2. Power-on SBY bit set to 1 (selectable) reset in SBYCR 3. Manual reset Note: Differs depending on the peripheral module and pin. HITACHI 45 Section 3 Operating Modes 3.1 Types of Operating Modes and Their Selection The SH7032 microcomputer operates in one of two operating modes (modes 0, 1) and the SH7034· • operates in one of four operating modes (modes 0, I, 2, and 7). Modes 0 and 1 differ in the bus width of memory area O. The mode is selected by the mode pins (MD2-MDO)as indicated in table 3.1. Do not change the mode selection while the chip is operating. Table 3.1 Operating Mode Selection Pin Settings Operating Mode M02 M01 MOO Mode Name Bus Width of Area 0 Mode a a a a MCU mode a 8 bits Mode 1 a a MCU mode 1 16 bits Mode 2* a a MCU mode 2 On-chip ROM Mode 7* PROM mode Note: SH7a34 (PROM version) only 3.2 Operating Mode Descriptions 3.2.1 Mode 0 (MCU Mode 0) In mode 0, memory area 0 has an eight-bit bus width. For the memory map, see section 8, Bus State Controller. 3.2.2 Mode 1 (MCU Mode 1) In mode I, memory area 0 has a 16-bit bus width. 3.2.3 Mode 2 (MCU Mode 2) In mode 2, memory area 0 is assigned to the on-chip ROM. Do not set to mode 2 unless the product is the SH7034 (PROM version). 3.2.4 Mode 7 (PROM mode) Mode 7 is a PROM mode. In this mode, the EPROM can be programmed. For details, see section 17, ROM. Do not set to mode 7 unless the product is the SH7034 (PROM version). HITACHI 47 Section 4 Exception Processing 4.1 Overview 4.1.1 Exception Processing Types and Priorities As figure 4.1 indicates. exception processing may be caused by a reset. address error. interrupt. or instruction. Exception sources are prioritized as indicated in figure 4.1. If two or more exceptions occur simultaneously. they are accepted and processed in the priority order shown. I HITACHI 49 Priority Reset --c · Power-on reset High • Manual reset Address error --c · CPU address error • DMA address error ·NMI • User break ·IRQ - - ·IRQo-IRQ7 Interrupt • Direct memory access controller Exception • 16-bit integrated-timer source pulse unit • On-chip module • Serial communications interface • Parity control unit (part of the bus con- troller) • AID converter • Watchdog timer • DRAM refresh control unit (part of the bus controller) • Trap instruction • TRAPA instruction { Instruction • General illegal • Undefined code instruction • Illegal slot • Undefined instruction instruction or instruction that rewrites the PC*1 placed directly after Low a delayed branch instruction*2 Notes: 1. The instructions that rewrite the PC are JMP, JSR, BRA, BSR, RTS, RTE, BT, BF, andTRAPA. 2. The delayed branch instructions are JMP, JSR. BRA. BSR, RTS, and RTE. Figure 4.1 Exception Source Types and Priority 50 HITACHI 4.1.2 Exception Processing Operation Exception sources are detected at the times indicated in table 4.1, whereupon processing starts. Table 4.1 Exception Source Detection and Time of the Start of Processing Exception Type Source Detection and Time of the Start of Processing Reset Power·on Low-to-high transition at pin RES when NMI is high Manual Low-to-high transition at pin RES when NMI is low Address error Detected when instruction is decoded and starts after the instruction that was executing prior to this point is completed. Interrupt Detected when instruction is decoded and starts after the instruction that was executing prior to this point is completed. Instruction Trap instruction Starts when a trap instruction (TRAPA) is executed. General illegal Starts when undefined code is decoded at a position other than instruction directly after a delayed branch instruction (a delay slot). Illegal slot Starts when undefined code or an instruction that rewrites the PC is instruction decoded directly after a delayed branch instruction (in a delay slot). When exception processing begins, the CPU operates as follows: Resets: The initial values of the program counter (PC) and stack pointer (SP) are read from the exception vector table (the respective PC and SP values are H'OOOOOOOO and H'00000004 for a power-on reset and H'00000008 and H'OOOOOOOC for a manual reset). For more information on the exception vector table, see section 4.1.3, Exception Vector Table. Next, the vector base register (VBR) is cleared to zero and interrupt mask bits (13-10) in the status register (SR) are set to 1111. Program execution starts from the PC address read from the exception vector table. Address Errors, Interrupts and Instructions: SR and PC are pushed onto the stack indicated in R15. For interrupts, the interrupt priority level is written in the interrupt mask bits (13-10). For address errors and instructions, bits I3-IO are not affected. Next, the start address is fetched from the exception vector table, and program execution starts from this address. 4.1.3 Exception Process Vector Table Before exception processing can execute, the exception vector table must be set in memory. The exception processing vector table holds the start addresses of exception service routines (the table for reset exception processing stores initial PC and SP values). Different vector numbers and vector table address offsets are assigned to different exception sources. The vector table addresses are calculated from the corresponding vector numbers and vector address offsets. In exception processing, the exception service routine start address is fetched from the exception vector table indicated by this vector table address. HITACHI 51 Table 4.2 lists vector numbers and vector table address offsets. Table 4.3 shows how to calculate vector table addresses. Table 4.2 Exception Process Vector Table Vector Exception Source Number Vector table Address Offset Power-on reset PC 0 H'OOOOOOOO-H '00000003 SP H'00000004-H '00000007 Manual reset PC 2 H'00000008-H'0000000B SP 3 H'OOOOOOOC-H'OOOOOOOF General illegal instruction 4 H'00000010-H'00000013 (Reserved for system use) 5 H'00000014-H'000OOO17 Illegal slot instruction 6 H'00000018-H'000000l B (Reserved for system use) 7 H'OOOOOOl C-H '000000 1F 8 H'00000020-H'00000023 CPU address error 9 H'00000024-H'00000027 DMA address error 10 H'00000028-H'0000002B Interrupts NMI 11 H'0000002C-H'0000002F User break 12 H'00000030-H'00000033 (Re!)erved for system use) 13-31 H'00000034-H'00000037 to H'0000007C- H'0000007F Trap instruction (user 32-63 H'000000SD-H'00000083 to H'OOOOOOFC- vectors) H'OOOOOOFF Interrupts IROO 64 H'OOOOOl OD-H'OOOOOl 03 IR01 65 H'OOOOOl 04-H'000001 07 IR02 66 H'000001 OS-H'OOOOOl OB IR03 67 H'000001 OC-H'OOOOOl OF IR04 68 H'00000110-H'0000Ol13 IR05 69 H'OOOOOl14-H'00000117 IR06 70 H'OOOOOl18-H'OOOOOllB IR07 71 H'0000011C-H'OOOOOll F On-chip 72-255 H'00000120-H'00000123 to H'OOOO03FC- modules· H'OOOOO3FF Note: See table 5.3, Interrupt Exception Processing Vectors and Rankings, in section 5, Interrupt Controller, for details on vector numbers and vector table address offsets of individual on- chip peripheral module interrupts. 52 HITACHI Table 4.3 Calculation of Exception Vector table Addresses Exception Source Calculation of Vector table Addresses Reset (Vector table address) = (vector table address offset) = (vector number) x 4 Address error, interrupt, instructions (Vector table address) = VBR + (vector table address offset) = VBR + (vector number) x 4 Note: VBR: Vector base register. For vector table address offsets and vector numbers, see table 4.2. 4.2 Reset 4.2.1 Reset Types A reset is the highest-priority exception. There are two types of reset: power-on reset and manual reset. As table 4.4 shows, a power-on reset initializes the internal state of the CPU and all registers of the on-chip peripheral modules. A manual reset initializes the internal state of the CPU and all registers of the on-chip peripheral mdules except the bus state controller (BSC), pin function controller (PFC) and 110 ports (110). Table 4.4 Reset Types Transition Conditions Internal State Reset NMI RES CPU On-Chip Peripheral Module Power-on Reset High Low Initialize Initialize Manual Reset Low Low Initialize Initialize all except BSC, PFC and I/O 4.2.2 Power-On Reset When the NMI pin is high, a low input at the RES pin drives the chip into the power-on reset state. The RES pin should be driven low while the clock pulse generator (CPG) is stopped (or while the CPG is operating during the oscillation settling time) for at least 20 !eye to assure that the LSI is reset. A power-on reset initializes the internal state of the CPU and all registers of the on-chip peripheral modules. For pin states in the power-on reset state, see appendix B, Pin States. While the NMI pin remains high. if the RES pin is held low for a certain time then driven high in the power-on state, power-on reset exception processing begins. The CPU then: 1. Reads the start address (initial PC value) from the exception vector table. 2. Reads the initial stack pointer value (SP) from the exception vector table. 3. Clears the vector base register (VBR) to H'OOOOOOOO, and sets interrupt mask bits I3-IO in the status register (SR) to H'F (1111). HITACHI 53 4. Loads the values read from the exception vector table into PC and SP and starts program execution. Further, make sure to carry out a power-on reset when turning on the power of the system. 4.2.3 Manual Reset When the NMI pin is high, a low input at the RES pin drives the chip into the manual reset state. To be assured of resetting the LSI, drive the RES pin low for at least 20 tcyc. A manual reset initializes the internal state of the CPU and all registers of the on-chip peripheral modules except the bus state controller, pin function controller and 110 ports. Since a manual reset does not affect the bus state controller, the DRAM refresh control function operates even if the manual reset state continues for a long time.'When a manual reset is performed during the bus cycle, the manual reset exception processing waits for the end of the bus cycle before beginning. The manual reset thus cannot be used to abort the bus cycle. For the pin states during the manual reset state, see appendix B, Pin States. While the NMI pin remains low, if the RES pin is held low for a certain time then driven high in the manual reset state, manual reset exception processing begins. The CPU carries out the same operations as for a power-on reset. 4.3 Address Errors 4.31 Address Error Sources Address errors occur during instruction fetches and data reading/writing as shown in table 4.5. 54 HITACHI Table 4.5 Address Error Sources Bus Cycle Type Bus Master Operation Address Error Instruction fetch CPU Instruction fetch from even address None (normal) Instruction fetch from odd address Address error Instruction fetch from outside on-chip None (normal) peripheral module space Instruction fetch from on-chip peripheral Address error module space Data read/write CPU or DMAC Access to word data from even address None (normal) Access to word data from odd address Address error Access to long word data aligned on long None (normal) word boundary Access to long word data not aligned on Address error long word boundary Access to word or byte data in on-chip None (normal) peripheral module space' Access to long word data in 16-bit on-chip None (normal) peripheral module space' Access to long word data in 8-bit on-chip Address error peripheral module space' Note: See section 8, Bus State Controller, for details on the on-chip peripheral module space. 4.3.2 Address Error Exception Processing When an address error occurs, address error exception processing starts after both the bus cycle that caused the address error and the instructions that were being executed at that time have been completed. The CPU then: 1. Pushes the SR onto the stack. 2. Pushes the program counter onto the stack. The PC value saved is the top address of the instruction following the last instruction to be executed. 3. Fetches the exception service routine start address from the exception vector table for the address error that occurred and starts program execution from that address. The branch that occurs here is not a delayed branch. HITACHI 55 4.4 Interrupts 4.4.1 Interrupt Sources Table 4.6 lists the types of interrupt exception processing sources (NMI, user break, IRQ, on-chip peri pheral module). Table 4.6 Interrupt Sources Interrupt Requesting Pin or Module Number of Sources NMI NMI pin (external input) User break User break controller IRQ IRQQ-IRQ7 pin (external input) 8 On-chip DMAC 4 16-bit integrated-timer pulse unit 15 Serial communications interface 8 AID converter Watchdog timer Bus state controller 2 Each interrupt source has a different vector number and vector address offset value. See table 5.3, Interrupt Exception Vectors and Rankings, in section 5, Interrupt Controller, for details on vector numbers and vector table address offsets. 4.4.2 Interrupt Priority Rankings Interrupt sources are assigned priorities. When multiple interrupts occur at the same time, the interrupt controller (INTC) ascertains their priorities and starts exception processing based on its findings. Priorities from 16-0 can be assigned, with 0 the lowest level and 16 the highest. The NMI has priority level 16 and cannot be masked. NMI is always accepted. The user break priority level is 15. The IRQ and on-chip peripheral module interrupt priority levels can be set in interrupt priority level registers A-E (IPRA-IPRE) as shown in table 4.7. Priority levels 0-15 can be set. . See section 5.3.1, Interrupt Priority Level Registers A-E (IPRA-IPRE), for details. Table 4.7 Interrupt Priority Rankings Type Priority Comments NMI 16 Fixed and unmaskable User break 15 Fixed IRQ and on-chip peripheral modules Q-15 Set in interrupt priority level registers A-E (lPRA- IPRE) 56 HITACHI 4.4.3 Interrupt Exception Processing When an interrupt is generated, the INTC ascertains the interrupt rankings. NMI is always accepted, but other interrupts are only accepted if their ranking is higher than the ranking set in the interrupt mask bits (13-10) of the SR. When an interrupt is accepted, interrupt exception processing begins. In the interrupt exception processing sequence, the SR and PC are pushed onto the stack, and the priority level of the accepted interrupt is copied to the interrupt mask level bits (13-10) in the SR. In NMI exception processing, the priority ranking is 16 but the value 15 (H'F) is stored in 13-10. The exception service routine start address for the accepted interrupt is fetched from the exception vector table and the program branches to that address and starts executing. For further information on interrupts, see section 5.4, Interrupt Operation. 4.5 Instruction Exceptions 4.5.1 Types of Instruction Exceptions Table 4.8 shows the three types of instruction that start exception processing (trap instructions, illegal slot instructions, and general illegal instructions). Table 4.8 Types of Instruction Exceptions Type Source Instruction Comments Trap instruction TAAPA Illegal slot Undefined code or instruction that Delayed branch instructions are: JMP, JSA, instruction rewrites the PC located BAA, BSA, ATS, ATE. Instructions that immediately after a delayed rewrite the PC are: JMP, JSA, BAA, BSA, branch instruction (delay slot) ATS, ATE, BT, BF and TAAPA General illegal Undefined code in other than instructions delayed slot 4.5.2 Trap Instruction Trap instruction exception processing is carried out when a trap instruction (TRAPA) is executed. The CPU then: 1. Saves the status register by pushing register contents onto the stack. 2. Pushes the program counter value onto the stack. The PC value saved is the top address of the next instruction after the TRAPA instruction. 3. Reads an exception processing service routine start address from the vector table corresponding to a vector number specified in the TRAPA instruction, branches to that address, and starts program execution. The bra'nch is not a delayed branch. HITACHI 57 4.5.3 Illegal Slot Instruction An instruction located immediately after a delayed branch instruction is called an "instruction placed in a delay slot." If an undefined instruction is located in a delay slot, illegal slot instruction exception processing begins executing when the undefined code is decoded. Illegal slot instruction exception processing also begins when the instruction located in the delay slot is an instruction that rewrites the program counter. In this case, exception processing begins when the instruction that rewrites the PC is decoded. The CPU performs illegal slot exception processing as follows: 1. Saves the status register onto the stack. 2. Pushes the program counter value onto the stack. The PC value saved is the branch destination address of the delayed branch instruction immediately before the instruction that contains the undefined code or rewrites the PC. 3. Fetches an exception processing service routine start address from the vector table corresponding to the exception that occurred, branches to that address and the program starts executing. The branch is not a delayed branch. 4.5.4 Generallllegallnstr~ctions If an undefined instruction located other than a delay slot (immediately after a delayed branch instruction) is decoded, general illegal instruction exception processing is executed. The CPU follows the same procedure as for illegal slot exception processing, except that the program counter (PC) value pushed on the stack in general illegal instruction exception processing is the top address of the illegal instruction with the undefined code. 58 HITACHI 4.6 Cases in which Exceptions Are Not Accepted In some cases, address errors and interrupts that directly follow a delayed branch instruction or interrupt-disabled instruction are not accepted immediately. Table 4.9 lists these cases. When this occurs, the exception is accepted when an instruction that can accept the exception is decoded. it' Table 4.9 Cases in which Exceptions Are Not Accepted Exception Source Case Address Error Interrupt Immediately after delayed branch instruction*1 X X Immediately after interrupt-disabled instruction*2 0 X X: Not accepted 0: Accepted Notes: 1. Delayed branch instructions: JMP, JSR, BRA, BSR, RTS, RTE 2. Interrupt-disabled instructions: LDC, LDC.L, STC, STC.L, LDS, LDS.L, STS, STS.L 4.6.1 Immediately after Delayed Branch Instructions Address errors and interrupts are not accepted when an instruction in a delay slot immediately following a delayed branch instruction is decoded. The delayed branch instruction and the instruction in the delay slot are therefore always executed one after the other. Exception processing is never inserted between them. 4.6.2 Immediately after Interrupt-Disabling Instructions Interrupts are not accepted when the instruction immediately following an interrupt-disabled instruction is decoded. Address errors are accepted, however. HITACHI 59 4.7 Stack Status after Exception Processing Table 4.10 shows the stack after exception processing. Table 4.10 Stack after Exception Processing Type Stack Status Type Stack Status Address -r- Interrupt -r- -r- error Address of Address of SP. instruction Upper 16 bits SP. instruction Upper 16 bits after instruc- after instruc- tion that has tion that finished has finished executing executing ------------------- Lower 16 bits Lower 16 bits SR Upper 16 bits SR Upper 16 bits ------------------- Lower 16 bits Lower 16 bits Trap -r- Illegal -r- instruc- Address of slot Branch SP. instruction Upper 16 bits SP. destination Upper 16 bits tion after TRAP A instruc- address of instruction tion delayed branch Lower 16 bits instuction SR Upper 16 bits ------------------- Lower 16 bits Lower 16 bits SR Upper 16 bits Lower 16 bits General illegal SP Start add- instruc- • ress of Upper 16 bits tion illegal instruction Lower 16 bits SR Upper 16 bits Lower 16 bits Note: Stack status is based on a bus width of 16 bits. 60 HITACHI 4.8 Notes 4.8.1 Value ofthe Stack Pointer (SP) An address error occurs if the stack is accessed for exception processing when the value of the stack pointer (SP) is not a multiple of four. Therefore, a multiple of four should always be stored in SP. 4.8.2 Value ofthe Vector Base Register (VBR) An address error occurs if the vector table is accessed for exception processing when the value of the vector base register (VBR) is not a multiple of four. Therefore, VBR should always be set to a multiple of four. 4.8.3 Address Errors that Are Caused by Stacking During Address Error Exception Processing When the stack pointer is not a multiple of four, address errors will occur in the exception processing (interrupt, etc.) stacking. After the exception processing ends, the CPU will then shift to address error exception processing. An address error will also occur during the address error exception processing stacking, but the CPU is set up to ignore the address error so that it can avoid an infinite series of address errors. This allows it to shift program control to the address error exception service routine and process the error. When an address error does occur in exception processing stacking, the stacking bus cycle (write) is executed. In SR and PC stacking, four is subtracted from each of the SPs so the SP values are not multiples of four after stacking either. Since the address value output during stacking is the SP value, the address that produced the error is exactly what is output. In such cases, the stacked write data will be undefined. HITACHI 61 Section 5 Interrupt Controller 5.1 Overview The interrupt controller (lNTC) determines the priority of interrupt sources and controls interrupt requests to the CPU. INTC has registers for assigning priority levels to interrupt sources. These registers handle interrupt requests according to user-established priorities. 5.1.1 Features The interrupt controller has the following features: • 16 settable priority levels: Five interrupt priority registers can set 16 levels of interrupt priorities for IRQ and on-chip peripheral interrupt sources. I • The INTC has an NMI input level T bit that indicates NMI pin status. By reading this bit with the interrupt exception service routine, the pin status can be checked for use in a noise canceller function. • The interrupt controller can notify external devices (via the IRQOUT pin) that an onchip interrupt has occured. In this wayan external device can, for example, be informed if an on-chip interrupt occurs while the chip is operating in a bus-released mode and the bus has been requested. 5.1.2 Block Diagram Figure 5.1 is a block diagram of the interrupt controller. HITACHI 63 IROOUT ~-------------------------------------- -I 1 1 1 NMI 1 1 1 1 1 IROQ 1 IR01 1 IR02 1 Input ----. IR03 1 control ----. Priority ~~ IR04 1 ----. decision IR05 1 ----. logic Com- -+ parator ~ Interrupt request IR06 1 ----. IR07 1 1 ----. 1 1 SR :(Interrupt request) UBC DMAC 1(Interrupt request) 1 I 13[12 J11 110 I 1(Interrupt request) ITU 1(I nterrupt request) SCI CPU :(Interrupt request) , PRT :(Interrupt request) AID 1(Interrupt request) WDT 1(Interrupt request) REF 1 1 1 1 1 1 1 1 1 1 1 ~ 1 1 1 1 1 1 1 1 1 1 1 I ICR I 1 1 1 1 IPRA-IPRE 1 1 1 0 0> 1 1 1 1 '" ::l .c 1 1 -a; Bus E Module bus interface /1 "-.1 ) .EoS 1 1 1 1 -----------------------.-----------INTC --I UBC: User break controller WOT: Watchdog timer DMAC: Direct memory access controller REF: DRAM refresh control unit of BSC ITU: 16-bit integrated-timer pulse unit ICR: Interrupt control register SCI: Serial communications interface IPRA-IPRE: Interrupt priority registers A-E PRT: Parity control unit of BSC SR: Status register AID: AID converter Figure 5_1 Block Diagram of the Interrupt ControUer 64 HITACHI 5.1.3 Pin Configuration INTC pins are summarized in table 5.1. Table 5.1 INTC Pin Configuration Name Abbr. I/O Function Nonmaskable interrupt input pin NMI I Inputs a non-maskable interrupt request signal Interrupt request input pins IROQ-IR07 I Inputs maskable interrupt request signals Interrupt request output pin IROOUT 0 Outputs a signal indicating an interrupt source has occurred. 5.1.4 Registers The interrupt controller has six registers as listed in table 5.2. These registers are used for setting interrupt priority levels and controlling the detection of external interrupt input signals. Table 5.2 Interrupt Controller Register Configuration Name Abbr. RIW Address*2 Initial Value Bus width Interrupt priority register A IPRA R/W H'5FFFF84 H'OOOO 8,16,32 Interrupt priority register B IPRB R/W H'5FFFF86 H'OOOO 8,16,32 Interrupt priority register C IPRC R/W H'5FFFF88 H'OOOO 8,16,32 Interrupt priority register D IPRD R/W H'5FFFF8A H'OOOO 8,16,32 Interrupt priority register E IPRE R/W H'5FFFF8C H'OOOO 8,16,32 Interrupt control register ICR R/W H'5FFFF8E *1 8,16,32 Note: 1. H'8000 when pin NMI is high, H'OOOO when pin NMI is low. 2. Only the values of bits A27-A24 and A8-AO are valid; bits A23-A9 are ignored. For details on the register addresses, see section 8.3.5, Description of Areas. 5.2 Interrupt Sources There are four types of interrupt sources: NMI, user break, IRQ, and on-chip peripheral module interrupts. Interrupt rankings are expressed as priority levels (0-16), with 0 the lowest and 16 the highest. An interrupt set to level 0 is masked. 5.2.1 NMI Interrupts NMI is the highest-priority interrupt (level 16) and is always accepted. Input at the NMI pin is edge-sensed. Either the rising or falling edge can be selected by setting the NMI edge select bit HITACHI 65 (NMIE) in the interrupt control register (lCR). NMI interrupt exception processing sets the interrupt mask level bits (13-10) in the status register (SR) to level 15. 5.2.2 User Break Interrupt A user break interrupt occurs when a break condition is satisfied in the user break controller· (UBC). A user break interrupt has priority level 15. User break interrupt exception processing sets the interrupt mask level bits (13-10) in the status register (SR) to level 15. For further details about the user break interrupt, see section 6, User Break Controller. 5.2.3 IRQ Interrupts IRQ interrupts are requested by input from pins IRQO-IRQ7. IRQ sense select bits 0-7 (IRQOS- IRQ7S) in the interrupt control register (ICR) can select low-level sensing or falling-edge sensing for each pin independently. Interrupt priority registers A and B (IPRA and IPRB) can select priority levels from 0-15 for each pin. IRQ interrupt exception processing sets the interrupt mask level bits (13-10) in the status register (SR) to the priority level value of the IRQ interrupt that was accepted. 5.2.4 On-Chip Interrupts On-chip interrupts are interrupts generated by the following 6 on-chip peripheral modules: • Direct memory access controller (DMAC) • 16-bit integrated-timer pulse unit (lTU) • Serial communications interface (SCI) • Bus state controller (BSC) • AID converter (AID) • Watchdog timer (WDT) A different interrupt vector is assigned to each interrupt source, so the exception service routine does not have to decide which interrupt has occurred. Priority levels 0-15 can be assigned to individual on-chip peripheral module in interrupt priority registers C-E (IPRC-IPRE). On-chip interrupt exception processing sets the interrupt mask level bits (13-10) in the status register (SR) to the priority level value of the on-chip interrupt that was accepted. 5.2.5 Interrupt Exception Vectors and Priority Rankings Table 5.3 lists the vector numbers, vector table address offsets, and interrupt priority order of the interrupt sources. Each interrupt source is allocated a different vector number and vector table address offset. The vector table address is calculated from this vector number and address offset. In interrupt exception processing, the exception service routine start address is fetched from the vector table 66 HITACHI indicated by this vector table address. See table 4.3, Calculation of Exception Vector table Addresses, in section 4, Exception Processing, for details on this calculation. Arbitrary interrupt priority levels between 0 and 15 can be assigned to IRQ and on-chip peripheral module interrupt sources by setting interrupt priority registers A-E (IPRA-IPRE) for each pin or module. The interrupt sources for IPRC-IPRE, however, must be ranked in the order listed under Priority Within Module in table 5.3 and cannot be changed. A reset assigns priority level 0 to IRQ and on-chip peripheral module interrupts. If the same priority level is assigned to two or more interrupt sources, and interrupts from those sources occur simultaneously, their priority order is the default priority order indicated at the right in table 5.3. HITACHI 67 Table 5.3 Interrupt Exception Vectors and Rankings Interrupt Pri- Priority Vec- Default ority Order IPR (bit Within tor Address Offset in Priority Interrupt Source (initial value) numbers) Module No. Vector table Order NMI 16 11 H'0000002C-H'OO00002F High User break 15 12 H'OOOOO030-H'OOOOO033 IROO 0-15 (0) IPRA (15-12) - 64 H'000001 00-H'OOOOO1 03 IR01 0-15 (0) IPRA (11-8) 65 H'000001 04-H'000OO 107 IR02 0-15 (0) IPRA (7-4) 66 H'000001 08-H '00000 1OB IR03 0-15 (0) IPRA (3-0) 67 H'000001 OC-H'000001 OF IR04 0-15 (0) IPRB (15-12) - 68 H'OOOO0110-H'OOOO0113 IR05 0-15 (0) IPRB (11-8) 69 H'OOOO0114-H'00000117 IR06 0-15 (0) IPRB (7-4) 70 H'00000118-H'OOOOO 11 B IR07 0-15 (0) IPRB (3-0) 71 H'0000011 C-H'OO00011 F DMACO DEIO 0-15 (0) IPRC (15-12) 3 72 H'OOOO0120-H'OOOO0123 Reserved 2 73 H'00000124-H'00000127 DMAC1 DEI1 74 H'OOOO0128-H'OOOO012B Reserved 0 75 H'OOOO012C-H'OOOO012F DMAC2DEI2 0-15 (0) IPRC (11-8) 3 76 H'00000130-H'OOOOO 133 Reserved 2 77 H'00000134-H'OOOO0137 DMAC3DEI3 78 H'00000138-H'00000 13B Reserved 0 79 H'OOOO013C-H'OOOO013F ITUO IMIAO 0-15(0) IPRC (7-4) 3 80 H'OOOO0140-H'OOOO0143 IMIBO 2 81 H'OOOO0144-H'00000147 OVIO 82 H'OOOO0148-H'OOOO014B Reserved 0 83 H'0000014C-H'OOOOO 14F ITU1 IMIA1 0-15 (0) IPRC (3-0) 3' 84 H'00000150-H'OOOOO 153 IMIB1 2 85 H'OOOO0154-H'OOOO0157 OVI1 86 H'OOOO0158-H'OOOO015B Reserved 0 87 H'0000015C-H'0000015F ITU2 IMIA2 0-15 (0) IPRD (15-12) 3 88 H'00000160-H'OOOO0163 IMIB2 2 89 H'OOOO0164-H'OOOO0167 OVI2 90 H'OOOO0168-H'OOOOO16B Reserved 0 91 H'0000016C-H'OOOO016F 68 HITACHI Table 5.3 Interrupt Exception Vectors and Rankings (cont) Interrupt Prl- Priority Vec- Default orlty Order IPR (bit Within tor Address Offset In Priority Interrupt Source (Initial value) numbers) Module No. Vector table Order ITU3 IMIA3 0-15 (0) IPRO (11-8) 3 92 H'OOOOO17Q-H'OOOO0173 IMIB3 2 93 H'OOOO0174-H'OOOO0177 OVI3 94 H'OOOO017B-H'OOOO017B Reserved 0 95 H'OOOO017C-H'OOOO017F ITU4 IMIA4 0-15 (0) IPRO (7-4) 3 96 H'OOO00180-H'OOOO0183 IMIB4 2 97 H'OOO00184-H'OOOO0187 OVI4 1 98 H'OOO0018B-H'OOOO018B Reserved 0 99 H'OOOO018C-H'OOOO018F SCIO ERIO 0-15 (0) IPRO (3-0) 3 100 H'OOOO0190-H'OOOO0193 RxlO 2 101 H'OOOO0194-H'OOOO0197 TxlO 1 102 H'OOOO0198-H'OOoo019B TEIO 0 103 H'OOO0019C-H'0000019F SCI1 ERI1 0-15 (0) IPRE (15-12) 3 104 H'00000 1Ao-H'000001 A3 Rxl1 2 105 H'OOOoo1A4-H'000001A7 Txl1 1 106 H'OOOoo1 A8-H'000001 AB TEI1 0 107 H'000oo1 AC-H '00000 1AF PRT*l PEl 0-15 (0) IPRE (11-8) 3 108 H'OOOoo1 Bo-H'oo0001 B3 AID ITI 2 109 H'OOOoo1 B4-H'OO0001 B7 Reserved 1 110 H'000001 BB-H'oo0001 BB Reserved 0 111 H'000001 BC-H'000001 BF WDT ITI 0-15 (0) IPRE (7-4) 3 112 H'000001 Co-H'000001 C3 REp2 CMI 2 113 H'OOOoo1 C4-H'000001 C7 Reserved 114 H'000001 C8-H'000001 CB Reserved 0 115 H'000001 CC-H'OO0001 CF Reserved 116 H'000001 Do-H'000001 03 to to 255 H'000003FC-H'OOOoo3FF Low Notes: 1. PRT: Parity control unit of bus state controller. 2. REF: DRAM refresh control unit of bus state controller. HITACHI 69 5.3 Register Descriptions 5.3.1 Interrupt Priority Registers A-E (IPRA-IPRE) The five registers from IPRA-IPRE are 16-bit read/write registers that assign priority levels from 0-15 to the IRQ and on-chip peripheral module interrupt sources. Interrupt request sources are mapped onto IPRA-IPRE as shown in table 5.4. Bit: 15 14 13 12 11 10 9 8 Bit name: I Initial value: 0 0 0 0 0 0 0 0 RIW: RIW RIW RIW RIW RIW RIW RIW RIW Bit: ? 6 5 4 3 2 0 Bit name: I Initial value: 0 0 0 0 0 0 0 0 RIW: RIW RIW RIW RIW RIW RIW RIW RIW Table 5.4 Interrupt Request Sources and IPRA-IPRE Register Bits 15-12 Bits 11-8 Bits 7-4 Bits 3-0 IPRA IRQO IRQ1 IRQ2 IRQ3 IPRB IRQ4 IRQ5 IRQ6 IRQ? IPRC DMACO,DMAC1 DMAC2, DMAC3 ITUO ITU1 IPRD ITU2 ITU3 ITU4 SCIO IPRE SCI1 PRT*1, AID WDT, REp2 (Reserved)*3 Notes: 1. PRT: Parity control unit of bus state controller. See section 8, Bus State Controller, for details. 2. REF: DRAM refresh control unit of bus controller. See section 8, Bus State Controller, for details. 3. When read, always O. Always write 0 in reserved bits. As indicated in table 5.4, four IRQ pins or four groups of on-chip peripheral modules are assigned to each interrupt priority register. The priority levels for the four pins or groups can be set by setting the corresponding 4-bit groups of bits 15-12, bits 11-8, bits 7-4, and bits 3-0 (of IPRA- IPRE) with values in the range of H'O (0000) to H'F (1111). Setting H'O gives interrupt priority level 0 (the lowest). Setting H'F gives level 15 (the highest). When two on-chip peripheral modules are assigned to the same bits (DMACO and DMACI, or DMAC2 and DMAC3, or the parity control unit and the AID converter, or the watchdog timer and DRAM refresh control unit), 70 HITACHI those two modules have the same priority. A reset initializes IPRA-IPRE to H'OOOO. They are not initialized by the standby mode. 5.3.2 Interrupt Control Register (ICR) ICR is a 16-bit register that sets the input detection mode of the external interrupt input pins NMI and IRQO-IRQ7 and indicates the input signal level to the NMI pin. A reset initializes ICR but the standby mode does not. Bit: 15 14 13 12 11 10 9 8 Bit name: I NMIL NMIE Initial value: 0 0 0 0 0 0 0 RIW: R RIW Bit: 7 6 5 4 3 2 0 Bit name: I IROOS IR01S IR02S IR03S IR04S IIR05S I IR06S IR07S Initial value: 0 0 0 0 0 0 0 0 RIW: RIW RIW RIW RIW RIW RIW RIW RIW Note: When NMI input is high: 1; when NMI input is low: 0 • Bit 15 (NMI input level (NMIL»: NMIL sets the level of the signal input at the NMI pin. NMIL cannot be modified. The NMI input level can be read to determine the NMI pin level. Bit 15: NMIL Description o NMI input level is low NMI input level is high • Bits 14-9 (reserved): These bits always read as O. The write value should ahvays be O. • Bit 8 (NMI edge select (NMIE»: NMIE selects whether the falling or rising edge of the interrupt request signal to the NMI pin is sensed. Bit 8: NMIE Description o Interrupt is requested on falling edge of NMI input (initial value) Interrupt is requested on rising edge of NMI input • Bits 7-fJ (IRQO-IRQ7 sense select (IRQOS-IRQ7S»: IRQO-IRQ7 select whether the falling edge or low level of the IRQ inputs is sensed at the pins IRQO-IRQ7. HITACHI 71 Bits 7-0: IROOS-IR07S Description o Interrupt is requested when IRQ input is low (initial value) Interrupt is requested on falling edge of IRQ input 5.4 Interrupt Operation 5.4.1 Interrupt Sequence The sequence of interrupt operations will be explained below. Figure 5.2 is a flowchart of the operations up to acceptance of the interrupt. 1. The interrupt request sources send interrupt request signals to the interrupt controller. 2. The interrupt controller selects the highest-priority interrupt in the interrupt requests sent, following the priority order indicated in table 5.3 and the levels set in interrupt priority registers A-E (IPRA-IPRE). Lower priority interrupts are ignored*. If two interrupts with the same priority level are requested simultaneously or if there are multiple interrupts occurring within a single module, the interrupt with the highest default priority or priority within module as indicated in table 5.3 is selected. 3. The interrupt controller compares the priority level of the selected interrupt request with the interrupt mask level bits (13-IO) in the CPU's status register (SR). If the request priority level is equal to or less than the interrupt mask level, the request is ignored. If the request priority level is higher than the interrupt mask level, the interrupt controller accepts the request and sends an interrupt request signal to the CPU. 4. When the interrupt controller accepts an interrupt request, it drives the pin IRQOUT low. 5. The CPU detects the interrupt request sent from the interrupt controller when it decodes the next instruction to be executed. Instead of executing that instruction, the CPU starts interrupt exception processing. 6. In interrupt exception processing, first SR and PC are pushed onto the stack. 7. The priority level of the accepted interrupt is copied to the interrupt mask level bits (13-IO) in the status register (SR). 8. When the accepted interrupt is level-sensed or from an on-chip peripheral module, The pin IRQOUT returns to the high level. If the accepted interrupt is edge-sensed, the pin IRQOUT returns to the high level when the instruction to be executed by the CPU in (5) is replaced by the interrupt exception processing. If the interrupt controller has accepted another interrupt (of a level higher than the current interrupt), however, the pin IRQOUT remains low. 9. The CPU accesSeS the exception vector table at the entry for the vector number of the accepted interrupt, reads the start address of the exception service routine, branches to that address, and starts executing the program there. This branch is not delayed. Note: The interrupts selected edge sensing are held pending. 72 HITACHI Interrupt? No ~ __________________- L____________-L ___________ ~ ______ ~ 13 to 10 : Interrupt mask bits of status register Notes: 1. IROOUT is the same signal as the interrupt request signal to the CPU (figure 5.1). The pin IROOUT return to the high level when the interrupt controller has accepted the interrupt of a level higher than the 13 to 10 bits of the status register in the CPU. 2. If the accepted interrupt is edge-sensed, the pin IRQOUT returns to the high level when the instruction to be executed by the CPU is replaced by the interrupt exception processing (before the status register is saved to the stack ). If the interrupt controller has accepted another interrupt of a level higher than the current interrupt. and has requested the interrupt to the CPU, however, the pin IROOUT remains low. Figure 5.2 Flowchart of Interrupt Operation HITACHI 73 5.4.2 Stack after Interrupt Exception Processing Figure 5.3 shows the stack after interrupt exception processing. Address 4n-8 PC*2 Upper 16 bits of the clock are satisfied, and the LSI will operate normally. Figure 7.7 shows the standard characteristics of a duty cycle correction. This duty cycle correction circuit is not for correcting the input clock's transient fluctuations and jutters. No crossing signal lines I II I I I I I I I I r-1: ds I I CU I I XTAL I I I I I I r-1: T I I I I C I EXTAL " I I I I ! Figure 7.6 Precaution on Oscillator Circuit Board Design Input duty 70 "- ,, , 70'" ~ 60 ----- ---~ ---;:-~~~~~~ :J "0 :; 50 Co S 0 -- ---40--./~~ 40 ~ ~ ~ /~30 30 5 10 20 (MHz) Input frequency Figure 7.7 Duty Cycle Correction Circuit Standard Characteristics 92 HITACHI Section 8 Bus State Controller 8.1 Overview The bus state controller (BSC) divides address space and outputs control signals for all kinds of memory and peripheral LSIs. BSC functions enable the LSI to link directly with DRAM, SRAM, ROM, and peripheral LSIs without the use of external circuits, simplifying system design and allowing high-speed data transfers in a compact system:. 8.1.1 Features The BSC has the following features: • Address space is divided into eight areas A maximum 4-Mbyte of linear address space for each of eight areas, 0-7 (area I can be up to 16-Mbyte linear space when set for DRAM) (The space that can actually be used varies with the type of memory connected) Bus width (8 bits or 16 bits) can be selected by access address On-chip ROM and RAM is accessed in one cycle (32 bits wide) Wait states can be inserted using the WAIT pin Wait state insertion can be controlled through software. Register settings can be used to specify the insertion of 1-4 cycles for areas 0, 2, and 6 (long wait function) I The type of memory connected can be specified for each area. Outputs control signals for accessing the memory and peripheral LSIs connected to the area • Direct interface to DRAM Multiplexes row/column addresses according to DRAM capacity Two types of byte access signals (dual-CAS system and dual-WE system) Supports burst operation (high-speed page mode) Supports CAS-before-RAS refresh and self-refresh • Access control for all memory and peripheral LSls - Address/data multiplex function • Parallel execution of external writes and the like with internal access (warp mode) • Supports parity check and generation for data bus - Odd parity/even parity selectable - Interrupt request generated for parity error (PEl interrupt request signal) • Refresh counter can be used as an 8-bit interval timer Interrupt request generated at compare match (CMI interrupt request signal) 8.1.2 Block Diagram Figure 8.1 shows the block diagram of the bus state controller. HITACHI 93 Wait control I . . - - r - - - - f unit RD.-~~---I WRH, WRL "'---+---1 HBS, LBS.-f Area control AH ...--+--1---1 unit CS7 to csa ...--'--1---1 CAS H, CAS L .---<---+---I DRAM RAS ...--'--:----i control unit CMI interrupt request DPH, DPL...--i--,-.. PEl interrupt request Parity control CJ) unit :J .0 Interrupt 1 1 1- ______ . __. ______ _ controller L _____ . ___ _ WCR: Wait state control register RTCSR: Refresh timer control/status register BCA: Bus control register RTCNT: Refresh timer counter DCR: DRAM area control register RTCOR: Refresh time constant register RCA: Refresh control register PCA: Parity control register Figure 8.1 BSC Block Diagram 94 HITACHI 8.1.3 Pin Configuration Table 8.1 shows the BSC pin configuration. Table 8.1 Pin Configuration Name Abbreviation 110 Function Chip select 7-0 CS7-CSO 0 Chip select signal that indicates the area being accessed Read RD 0 Strobe signal that indicates the read cycle High write WRH 0 Strobe signal that i'1dicates write cycle to upper 8 bits Low write WRL 0 Strobe signal that indicates write cycle to lower 8 bits Write WR*1 0 Strobe signal that indicates write cycle High byte strobe HBS*2 0 Strobe signal that indicates access to upper 8 bits Low byte strobe LBS*3 0 Strobe signal that indicates access to lower 8 bits Row address strobe RAS 0 DRAM row address strobe signal High column address CASH 0 Column address strobe signal for accessing the upper strobe 8 bits of the DRAM Low column address CASL 0 Column address strobe signal for accessing the lower strobe 8 bits of the DRAM Address hold AH 0 Signal for holding the address for address/data multiplexing Wait WAIT Wait state request signal Address bus A21-AO 0 Address output Data bus AD15-ADD I/O Data I/O. During address/data multiplexing, address output and data inpuVoutput. Data bus parity high DPH I/O Parity data I/O for upper byte Data bus parity low DPL I/O Parity data I/O for lower byte Notes: 1. Doubles with the WRL pin. (Selected by the BAS bit of the BCA. See section 8.2.1, Bus Control Register, for details. 2. Doubles with the AD pin. (Selected by the BAS bit of the BCA. See section 8.2.1, Bus Control Register, for details. 3. Doubles with the WRH pin. (Selected by the BAS bit of the BCA. See section 8.2.1, Bus Control Register, for details. 8.1.4 Register Configuration The BSC has ten registers (listed in table 8.2) which control space division, wait states, DRAM interface, and parity check. HITACHI 95 TableS.2 Register Configuration Name Abbr. RIW Initial Value Address*1 BU8wldth Bus control register BCR RIW H'OOOO H'SFFFFAO 8.16.32 Wait state control register 1 WCR1 RIW H'FFFF H'SFFFFA2 8.16\32 Wait state control register 2 WCR2 RIW H'FFFF H'SFFFFA4 8.16,32 Wait state control register 3 WCR3 RIW H'F800 H'SFFFFA6 8.16.32 DRAM area control register DCR RIW H'OOOO H'SFFFFA8 8.16.32 Parity control register PCR RIW H'OOOO H'5FFFFAA 8,16.32 Refresh control register RCR RIW H'OOOO H'SFFFFAC 8.16.32*2 Refresh timer control/status register RTCSR RIW H'OOOO H'SFFFFAE 8.16,32*2 Refresh timer counter RTCNT RIW H'OOOO H'SFFFFBO 8.16.32*2 Refresh time constant register RTCOR RIW H'OOFF H'SFFFFB2 8.16.32*2 Notes: 1. Only the values of bits A27-A24 and AS-AO are valid; bits A23-A9 are ignored. For details on the register addresses, see section 8.3.5. Description of Areas. 2. Write only with word transfer instructions. See section 8.2.11. Register Access. for details on writing. S.1.5 Overview of Areas The SH microprocessors have 32-bit address spaces on the architecture, but the top 4 bits are ignored. Table 8.3 outlines the division of space. As shown, the space is divided into areas 0-7 by the value of the top addresses. Each area is allocated a specific type of space. When the area is accessed, a strobe signal that matches the type of area space is generated. This allocates peripheral LSls and memory devices according to the type of the area spaces and allows them to be directly linked to this LSI. Some areas are of a fixed type based on their address while others can be selected in registers. Area 0 can be used as an on-chip ROM space or external memory space on the SH7034. On the SH7032, it can only be used as external memory space. Area I can be used as DRAM space or external memory space. DRAM space enables direct connection to DRAM and outputs RAS. CAS and multiplexed addresses. Areas 2-4 can only be used as external memory space. Area 5 can be used as on-chip peripheral module space or external memory space. Area 6 can be used as address/data multiplexed I/O space or external memory space. For address/data multiplexed I/O space, an address and data are multiplexed and input/output from ADI5-ADO pins. Area 7 can be used as on-chip RAM space or external memory space. The bus width of the data bus is basically switched between 8 bit and 16 bit by the value of address bit A27. For the following areas, however, the bus width is determined by conditions other than the A27 bit value. 96 HITACHI • On-chip ROM space in area 0: Always 32 bits • External memory space in area 0: 8 bits when MDO pin is 0, 16 bits when the pin is 1 • On-chip peripheral module space in area 5: 8 bits when the A8 address bit is 0, 16 bits when it is 1 • Area 6: If A27 =0, area 6 is 8 bits when the A14 address bit is 0, 16 bits when A14 is 1 • On-chip RAM space in area 7: Always 32 bits See table 8.6 in section 8.3, Address Space Subdivision, for more information on how the space is divided. 8.2 Register Descriptions 8.1.1 Bus Control Register (BCR) The bus control register (BCR) is a 16-bit read/write register that selects the functions of areas and status of bus cycles. It is initialized to H'OOOO by a power-on reset, but is not initialized by a manual reset or by the standby mode. Bit: 15 14 13 12 11 10 9 8 Bit name: IDRAME I IOE I WARP I RDDTY I BAS Initial value: 0 0 0 0 0 0 0 0 RIW: RIW RIW RIW RIW RIW Bit: 7 6 5 4 3 2 0 Bit name: I Initial value: 0 0 0 0 0 0 0 0 RIW: • Bit 15 (DRAM enable bit (DRAME»: DRAME selects whether area 1 is used as an external memory space or DRAM space. 0 sets it for external memory space and 1 sets it for DRAM space. The setting of the DRAM area control register is valid only when this bit is set to I. Bit 15: DRAME Description o Area 1 is external memory space (initial value) Area 1 is a DRAM space HITACHI 97 • Bit 14 (multiplexed 1/0 enable bit (IOE»: IOE selects whether area 6 is used as external memory space or an addressldata multiplexed 1/0 area. 0 sets it for external memory space and I sets it for addressldata multiplexed 110 space. With addressldata multiplexed 1/0 space, address and data are multiplexed and input/output is from ADI5-ADO. Bit 14: IOE Description o Area 6 is external memory space (initial value) Area 6 is an addressldata multiplexed 1/0 area • Bit 13 (warp mode bit (WARP»: WARP selects warp or normal mode. 0 sets it for normal mode and I sets it for warp mode. In warp mode, some external accesses are carried out in parallel with internal access. Bit 13: WARP Description o Normal mode: External and internal acce~ses are not simultaneously performed (initial value) Warp mode: External and internal accesses are simultaneously performed • Bit 12 (RD duty (RDDTY»: RDDTY selects 35% or 50% of the Tl state as the high-level duty cycle ratio of signal RD. 0 sets it for 50%, I sets it for 35%. Only set to I when the operating frequency is a minimum of 10 MHz. Bit 12: RDDTY Description o RD signal high-level duty cycle is 50% of T1 state (initial value) RD signal high-level duty cycle is 35% of T1 state • Bit 11 (byte access select (BAS»: BAS selects whether byte access control signals are WRH, WRL, and AO, or LBS, WR and HBS during word space accesses. When this bit is cleared to 0, WRH, WRL, and AO signals are valid; when set to 1, LBS, WR, and HBS, signals are valid. Bit 11: BAS Description o WRH, WRL, and AO enabled (initial value) LBS, WR, and HBS enabled • Bits 10-0 (reserved): These bits always read as O. The write value should always be O. 98 HITACHI 8.2.2 Wait State Control Register 1 (WCRl) Wait state control register I is a 16-bit read/write register that controls the number of states for accessing each area and the whether wait states are used. WCR 1 is initialized to H'FFFF by a power-on reset. It is not initialized by a manual reset or by the standby mode. Bit: 15 14 13 12 11 10 9 8 Bit name: I RW7 RW6 RW5 RW4 RW3 RW2 RW1 RWO Initial value: 1 1 1 1 1 1 1 RIW: RIW RIW RIW RIW RIW RIW RIW RIW Bit: 7 6 5 4 3 2 0 Bit name: I WW1 Initial value: 1 RIW: RIW • Bits 15-8 (wait state control during read (RW7-RWO)): RW7-RWO determine the number of states in read cycles for each area and whether or not to sample the signal input from the WAIT pin. Bits RW7-RWO correspond to areas 7-0, respectively. If a bit is cleared to 0, the WAIT signal is not sampled during the read cycle for the corresponding area. If it is set to 1, sampling takes place. For the external memory spaces of areas 1, 3-5, and 7, read cycles are completed in one state when the corresponding bits are cleared to 0. When they are set to 1, the number of wait states is 2 plus the WAIT signal value. For the external memory space of areas 0, 2, and 6, read cycles are completed in one state plus the number of long wait states (set in wait state controller 3 (WCR3» when the corresponding bits are cleared to 0. When they are set to 1, the number of wait states is 1 plus the long wait state; when the WAIT signal is at low level as well, a wait state is inserted. The DRAM space (area 1) finishes the column address output cycle in one state (short pitch) when the RWI bit is 0, and in 2 states plus the WAIT signal value (long pitch) when RW 1 is I. When RWI is set to I, the number of wait states selected in wait state insertion bits 1 and ° (RLWO and RLWl) for CAS-before-RAS (CBR) refresh of the refresh control register (RCR) are inserted during the CBR refresh cycle, regardless of the status of the WAIT signal.' HITACHI 99 The read cycle of the address/data multiplexed 110 space (area 6) is 4 states plus the wait states from the WAIT signal, regardless of the setting of the RW6 bit. The read cycle of the on-chip peripheral module space (area 5) finishes in 3 states, regardless of the setting of the RW5 bit, and the WAIT signal is not sampled. The read cycles of on-chip ROM (area 0) and on-chip RAM (area 7) finish in 1 state, regardless of the settings of bits RWO and RW7. The WAIT signal is not sampled for either. Table 8.3 summarizes read cycle state information. Table 8.3 Read Cycle State Description Read Cycle States External Memory Space Internal space WAIT Pin Multi- On-chip On-chip Bits 15-8: Input External Memory Plexed Peripheral ROM and RW7-RWO Signal Space DRAM Space VO Module RAM 0 Not • Areas 1, 3-5,7: 1 Column add- 4 states 3 states, 1 state, sampled state, fixed ress cycle: 1 + wait fixed fixed during Areas 0, 2, 6: 1 state state, fixed states read (short pitch) from + long wait state cycle*1 WAIT Sampled Areas 1, 3-5, 7: 2 Column address during states + wait states cycle: 2 states + read cycle from WAIT wait state from (initial Areas 0, 2, 6: 1 state WAIT (long value) + long wait state + pitch)*2 wait state from WAIT Notes: 1. Sampled in the address/data multiplexed I/O space 2. During a CBR refresh, the WAIT signal is ignored and the wait state from the RLW1 and RLWO bits of RCR is inserted. • Bits 7-2 (reserved): These bits always read as 1. The write value should always be 1. 100 HITACHI • Bit 1 (wait state control during write (WWI»: WWI detennines the number of states in write cycles for the DRAM space (area 1) and whether or not to sample the WAIT signal. When the DRAM enable bit (DRAME) of the BCR is set to I and area 1 is being used as DRAM space, clearing WWl to 0 makes the column address. output cycle finish in 1 states (short pitch). When WWl is set to 1, it finishes in 2 states plus the wait states from the WAIT signal (long pitch). Note: Write 0 to WWl only when area I is used as DRAM space (DRAME bit of BCR is 1). Never write 0 to WWl when area I is used as external memory space (DRAME is 0). Area 1'8 External Memory Space Bh 1: WW1 DRAM Space (DRAME = 1) (DRAME=O) o Column address cycle: 1 state (short pitch) Setting inhibited Column address cycle: 2 states + wait state 2 states + wait state from WAIT from WAIT (long pitch) (initial value) • Bit 0 (reserved): This bit always reads I. The write value should always be I. HITACHI 101 8.2.3 Wait State Control Register 2 (WCR2) Wait state control register 2 is a 16-bit read/write register that controls the number of states for accessing each area with a DMA single address mode transfer and whether wait states are used. WCR2 is initialized to H'FFFF by a power-on reset. It is not initialized by a manual reset or by the standby mode. Bit: 1S 14 13 12 11 10 9 8 Bit name: I DRW7! DRW6 ! DRWS! DRW4 DRW3 ! DRW2! DRW1 ! DRWO! Initial value: 1 1 1 1 1 1 1 R/W: R/W RIW R/W R/W R/W R/W RIW R/W Bit: 7 6 S 4 3 2 1 0 Bit name: ! DWW7! DWW6 ! DWWS! DWW4 ! DWW3 ! DWW2! DwW1 ! DWWO ! Initial value: 1 1 1 1 1 1 1 1 R/W: R/W RIW R/W RIW R/W R/W RIW R/W .• Bits 15-8 (wait state control during single-mode DMA transfer (DRW7-DRWO»: DRW7- DRWO determine the number of states in single-mode DMA memory read cycles for each area and whether or not to sample the WAIT signal. Bits DRW7-DRWO correspond to areas 7-0, respectively. If a bit is cleared to 0, the WAIT signal is not sampled during the single-mode DMA memory read cycle for the corresponding area. If it is set to I, sampling takes place. For the external memory spaces of areas 1,3-5, and 7, single-mode DMA memory read cycles are completed in one state when the corresponding bits are cleared to O. When they are set to 1, the number of wait states is 2 plus the wait states from the WAIT signal. For the external memory space of areas 0, 2, and 6, single-mode DMA memory read cycles are completed in one state plus the long wait state number (set in wait state controller 3 (WCR3» when the corresponding bits are cleared to 0. When they are set to I, the number of wait states is 1 plus the long wait state; when the WAIT signal is at low level as well, a wait state is inserted. The DRAM space (area 1) finishes the colunm address output cycle in one state (short pitch) when the DRWI bit is 0, and in 2 states plus the wait states from the WAIT signal (long pitch) when DRWI is 1. The single-modeDMA memory read cycle of the address/data multiplexed I/O space (area 6) is 4 states plus the wait states from the WAIT signal, regardless of the setting of the DRW6 bit. Table 8.4 summarizes single-mode DMA memory read cycle state information. 102 HITACHI Table 8.4 Single-Mode DMA Memory Read Cycle States (External Memory Space) Description Single-Mode DMA Memory Read Cycle States (External Memory Space) Bits 15-8: WAIT Pin Input Multiplexed DRW7-DRWO Signal External Memory Space DRAM Space va o Not sampled during Areas 1, 3-5,7: 1 state, Column address 4 states + single-mode DMA fixed cycle: 1 state, wait states memory read cycle" Areas 0, 2, 6: 1 state + fixed (short from WAIT long wait state pitch) Sampled during Areas 1, 3-5, 7: 2 states Column address single-mode DMA + wait states from WAIT cycle: 2 states + memory read cycle Areas 0, 2, 6: 1 state + wait state from (initial value) long wait state + Wait WAIT (long state from WAIT pitch) Note: Sampled in the address/data multiplexed I/O space. • Bits 7-0 (single-mode DMA memory write wait state control (DWW7-DWWO)): DWW7- DWWO determine the number of states in single-mode DMA memory write cycles for each area and whether or not to sample the WAIT signal. Bits DWW7-DWWO correspond to areas 7-0, respectively. If a bit is cleared to 0, the WAIT signal is not sampled during the single-mode DMA memory write cycle for the corresponding area. If it is set to 1, sampling takes place. The number of states for areas accesses based on bit settings are the same as indicated for single-mode DMA memory read cycles. See bits 15-8, wait state control during single-mode DMA memory transfer (DRW7-DRWO), for details. HITACHI 103 Table 8.5 summarizes single-mode DMA memory write cycle state information. Table 8.5 Single-Mode DMA Memory Write Cycle States (ExternarMemory Space) Description Single-mode DMA Memory Write Cycle States (External Memory Space) Bits 15-8: WAIT Pin Input External Memory Multiplexed DWW7-DWWO Signal Space DRAM Space I/O o Not sampled during Areas 1, 3-5,7: 1 state, Column address 4 states + single-mode DMA fixed cycle: 1 state, wait state memory write cycle" fixed (short from WAIT Areas 0, 2, 6: 1 state + long wait state pitch) Sampled during Areas 1, 3-5, 7: 2 states Column address single-mode DMA + wait state from WAIT cycle: 2 states + memory write cycle Areas 0, 2, 6: 1 state + wait state from (initial value) WAIT (long pitch) long wait state + wait state from WAIT Note: Sampled in the address/data multiplexed I/O space. 8.2.4 Wait State Control Register 3 (WCR3) Wait state control register 3 is a 16-bit read/write register that Controls WAIT pin pull-up and the insertion of long wait states. WCR3 is initialized to H'F800 by a power-on reset. It is not initialized by a manual reset or by the standby mode. Bit: 15 14 13 12 11 10 9 8 Bit name: I WPU !A02LW1!A02LWO! A~LW1 ! A6LWO ! Initial value: 1 1 1 1 1 0 0 0 R/W: R/W RIW R/W R/W R/W Bit: 7 6 5 4 3 2 0 Bit name: ! Initial value: 0 0 0 0 0 0 0 0 R/W: 104 HITACHI • Bit 15 (wait pin pull-up control (WPU»: WPU controls whether the WAIT pin is pulled up or not. When cleared to 0, the pin is not pulled up; when set to 1, it is pulled up. BIt 15: WPU Description o WAIT pin is not pulled up . WAIT pin is pulled up (initial value) • Bits 14 and 13 (long wait insertion in areas 0 and 2, bits 1,0 (A02LWI and A02LWO»: A02LWI and A02LWO select the long wait states to be inserted (1-4 states) when accessing external memory space of areas 0 and 2. Bit 14: A02LW1 Bit 13: A02LWO Description o 0 Inserts 1 state Inserts 2 states o Inserts 3 states Inserts 4 states (initial value) • Bits 12 and 11 (long wait insertion in area 6, bits 1,0 (A6LWI and A6LWO)): A6LWI and A6LWO select the long wait states to be inserted (1-4 states) when accessing external memory space of area 6. Bit 12: A6LW1 Bit 11: A6LWO Description o o Inserts 1 state Inserts 2 states o Inserts 3 states Inserts 4 states (initial value) • Bits 10-0 (reserved): These bits always read as O. The write value should always be O. 8.2.5 DRAM Area Control Register (DCR) The DRAM area control register (OCR) is a 16-bit read/write register that selects the type of DRAM control signal, the number of precharge cycles, the burst operation mode and the use of address multiplexing. DCR settings are valid only when the DRAME bit of BCR is set to I. It is initialized to H'OOOO by a power-on reset, but is not initialized by a manual reset or by the standby mode. HITACHI 105 · Bit: 15 14 13 12 11 10 9 8 Bit name: I CW2 RASD TPC BE CDTY MXE I MXC1 MXCO Initial value: 0 0 0 0 0 0 0 0 R1W: RIW R/w RIW RIW RIW RIW R/w RIW Bit: 7 6 5 4 3 2 0 Bit name: I I Initial value: 0 0 0 0 0 0 0 0 R1W: • Bit 15 (dual-CAS or dual-WE select bit (CW2»: When accessing a l6-bit bus width space, CW2 selects the dual-CAS or the dual-WE method. When cleared to 0, the CASH, CASL, and WRL signals are valid; when set to 1, the CASL, WRH, and WRL signals are valid. When accessing an 8-bit space, only CASL and WRL signals are valid, regardless of CW2 settings. Bit 15L: CW2 Description o Dual~CAS: CASH, CASL, and WRL Signals are valid (initial value) Dual-WE: CASL, WRH, and WRL signals are valid • Bit 14 (RAS down (RASD»: When DRAM access pauses, RASD determines whether to keep RAS low while waiting for the next DRAM access (RAS down mode) or return it to high (RAS up mode). When cleared to 0, the RAS signal returns to high; when set to 1, it stays at low. Bit 14: RASD Description o RAS up mode: Return RAS signal to high and wait for the next DRAM access (initial value) RAS down mode: Keep RAS Signal low and wait for the next DRAM access • Bit 13 (RAS precharge cycle count ("fPC»: TPC selects whether theRAS signal precharge cycle (Tp) will be 1 state or 2. When TPC is cleared to 0, a I-state precharge cycle is inserted; when 1 is set, a 2-state precharge cycle is inserted. Bit 13: TPC Description o Inserts 1-state precharge cycle (initial value) Inserts 2-state precharge cycle 106 HITACHI • Bit 12 (burst operation enable (BE»: BE selects whether or not to perform burst operation, a high speed page mode. When burst operation is not selected (0), the row address is not compared but instead is transferred to the DRAM every time and full access is performed. When burst operation is selected (1), row addresses are compared and burst operation with the same row address as the previous is performed (in this access, no row address is output and the column address and CAS signal alone are output). Bit 12: BE Description o Normal mode: full access (initial value) Burst operation: high-speed page mode • Bit II (CAS duty (CDTY)): CDTY selects 35% or 50% of the TC state as the high-level duty ratio of the signal CAS in the short-pitch access. When cleared to 0, the CAS signal high level duty is 50%; when set to 1, it is 35%. Only set to 1 when the operating frequency is a minimum of 10 MHz. Bit 11: CDTV Description o CAS signal high level duty cycle is 50% of the Testate (initial value) CAS signal high level duty cycle is 35% of the Testate • Bit 10 (multiplex enable bit (MXE»: MXE determines whether or not DRAM row and column addresses are multiplexed. When cleared to 0, addresses are not multiplexed; when set to 1, they are multiplexed. Bit 10: MXE Description o Multiplex of row and column addresses disabled (initial value) Multiplex of row and column addresses enabled HITACHI 107 • Bits 9 and 8 (multiplex shift count 1 and 0 (MXCI and MXCO»: Shift row addresses downward by a certain number of bits (8-10) when row and column addresses are multiplexed (MXE = 1). Regardless of the MXE bit setting, these bits also select the range of row addresses compared in burst operation. Bit 9: BitS: Row Address Shift Row Address Bits Compared (in burst operation) MXC1 MXCO (MXE 1) = = (MXE 0 or 1) 0 0 S bits (initial value) AS-A27 (initial value) 9 bits A9-A27 0 10 bits A10-A27 Reserved Reserved Bits 7-0 (reserved): These bits always read as O. The write value should always be O. 8.2.6 Refresh Control Register (RCR) The refresh control register (RCR) is a 16-bit read/write register that controls the start of refreshing and selects the refresh mode and the number of wait states during refresh. It is initialized to H'OOOO by a power-on reset, but is not initialized by a manual reset or by the standby mode. To prevent RCR from being written incorrectly, it must be written by a different method from most other registers. A word transfer operation is used, H'SA is written in the top byte, and the actual data is written in the lower byte. For details, see section 8.2.11, Notes on Register Access. Bit: 15 14 13 12 11 10 9 8 Bit name: I Initial value: 0 0 0 0 0 0 0 0 R/W: Bit: 7 6 5 4 3 2 0 Bit name: I RFSHE IRMODE I RLW1 RLWO Initial value: 0 0 0 0 0 0 0 0 R/W: R/W RIW R/W RIW • Bit IS-8 (reserved): These bits always read as O. 108 HITACHI • Bit 7 (refresh control (RFSHE»: RFSHE determines whether or not to perform DRAM refresh operations. When this bit is cleared to 0, no DRAM refresh control is performed and the refresh timer counter (RTCNT) can be used as an 8-bit interval timer. When set to 1, DRAM refresh control is performed. Bit 7: RFSHE Description o Refresh control disabled. RTCNT can be used as an 8-bit interval timer. (initial value) Refresh control enabled • Bit 6 (refresh mode (RMODE»: When DRAM refresh control is selected (RFSHE = 1), RMODE selects whether to perform CAS-before-RAS (CBR) refresh or self-refresh. When this bit is cleared to 0, a CBR refresh is performed at the cycle set in the refresh timer control/status register (RTCSR) and refresh time constant register (RTCOR). When set to I, it the DRAM does a self-refresh. When refresh control is not selected (RFSHE =0), the RMODE bit setting is ° not valid. When canceling self-refresh, set RMODE to with RFSHE set to 1. Bit 6: RMODE Description o CAS-before-RAS refresh (initial value) Self-refresh Bits 5 and 4--Insert wait states during CBR refresh bits 1 and 0 (RLWI, RLWO): These bits select the number of wait states to be inserted (1-4) during CAS-before-RAS refresh. When CBR refresh is performed and the RWI bit ofWCRI is set to 1, the number of wait states selected in the RLWI and RLWO is inserted regardless of the WAIT signal. When the RWI bit is cleared to 0, the RLWI and RLWO bit settings are ignored and no wait states are inserted. Bit 5: RLW1 Bit 4: RLWO Description o o Inserts 1 state (initial value) Inserts 2 states o Inserts 3 states Inserts 4 states Bits 3--0 (reserved): These bits always read as 0. The write value should always be 0. HITACHI 109 8.2.7 Refresh Timer Control/Status Register (RTCSR) The refresh timer control/status register (RTCSR) is a 16-bit read/write register that selects the clock input to refresh timer counter (RTCNT) and controls compare match interrupts (CMI). It is initialized to H'OOOO by a power-on reset, but is not initialized by a manual reset or by the standby mode. To prevent RTCSR from being written incorrectly, it must be written by a different method from most other registers. A word transfer operation is used, H'A5 is written in the top byte and the actual data is written in the lower byte. For details, see section 8.2.11, Notes on Register Access. Bit: 15 14 13 12 11 10 9 8 Bit name: I Initial value: 0 0 0 0 0 0 0 0 R/W: Bit: 7 6 5 4 3 2 0 Bit name: I CMF CMIE CKS2 CKS1 CKSO Initial value: 0 0 0 0 0 0 0 0 RIW: RIW RIW R/W RIW R/W • Bits 15-8 (reserved): These bits always read as O. • Bit 7 (compare match flag (CMF»: Indicates whether the values of RTCNT and the refresh time constant register (RTCOR) match. When 0, the value of RTCNT and RTCOR do not match; when 1, the value of RTCNT and RTCOR match. Bit 7: CMF Description o RTCNT does not equal the value of RTCOR (initial value) Cleared by reading CMF after it has been set to 1, then writing 0 in CMF Value RTCNT is equal to the value of RTCOR • Bit 6 (compare match interrupt enable (CMIE»: Enables or disables the compare match interrupt (CMI) generated when CMF is set to 1 in RTCSR (RTCNT value =RTCOR value). When cleared to 0, CMI interrupt is disabled; when set to 1, it is enabled. Bit 6: CMIE Description o Compare match interrupt request (CMI) is disabled (initial value) Compare match interrupt request (CMI) is enabled 110 HITACHI • Bits 5-3 (clock select bits 2-0 (CKS2-CKSO»: These bits select the clock input to RTCNT from among the seven types of clocks created by dividing the system clock (<<1». When the input clock is selected with the CKS2-CKSO bits, RTCNT starts to increment. Bit 5: CKS2 Bit 4: CKS1 Bit 3: CKSO Description 0 0 0 Clock input disabled (initial value) ,/2 0 ,/8 ",32 0 0 ,/128 ",512 0 cjl/2048 cjl/4096 • Bits 2-0 (reserved): These bits always read as O. The write value should always be O. 8.2.8 Refresh Timer Counter (RTCNT) The refresh timer counter (RTCNT) is a 16-bit read/write register that is used as an 8-bit upcounter that generates the refresh or interrupt request. When the input clock is selected by clock select bits 2-0 (CKS2-CKSO) in RTCSR, that clock makes the RTCNT start incrementing. When the values of RTCNT and the refresh time constant register (RTCOR) match, RTCNT is cleared to H'OOOO and the CMF flag of the RTCSR is set to 1. When the RFSHE bit of the RCR is also set to I, a CAS-before-RAS refresh is performed. When the CMIE bit of the RTCSR is also set to 1, a compare match interrupt (CMI) is generated. Bits 15-8 are reserved bits and do not count. These bits always read as o. RTCNT is initialized to H'OOOO by a power-on reset, but is not initialized by a manual reset or by the standby mode. To prevent RTCSR from being written incorrectly, it must be written by a different method from most other registers. A word transfer operation is used, H'69 is written in the top byte and the actual data is written in the lower byte. For details, see section 8.2.11, Notes on Register Access. HITACHI 111 Bit: 15 14 13 12 11 10 9 8 Bit name: I Initial value: 0 0 0 0 0 0 0 0 RIW: Bit: 7 6 5 4 3 2 0 Bit name: I Initial value: 0 0 0 0 0 0 0 0 RIW: RIW RIW RIW RIW RIW RIW RIW RIW 8.2.9 Refresh Time Constant Register (RTCOR) The refresh time constant register (RTCOR) is a 16-bit read/write register that sets the compare match cycle used with RTCNT. The values in RTCOR and RTCNT are constantly compared. When they match, the compare-match flag (CMF) is set in RTCNT and RTCSR is cleared to H'OOOO. If the bit RFSHE in RCR is set to 1 when this happens, a CAS before RAS (CBR) refresh is performed. When the CMIE bit of the RTCSR is also set to 1, a compare match interrupt (CM!) is generated. Bits 15-8 are reserved bits and cannot be used to set the cycle. These bits always read as O. RTCOR is initialized to H'OOFF by a power-on reset, but is not initialized by a manual reset or by the standby mode. To prevent RTCOR from being written incorrectly, it must be written by a different method from most other registers. A word transfer operation is used. H'96 is written in the top byte and the actual data is written in the lower byte. For details, see section 8.2.11, Notes on Register Access. Bit: 15 14 13 12 11 10 9 8 Bit name: I Initial value: 0 0 0 0 0 0 0 0 RIW: Bit: 7 6 5 4 3 2 0 Bit name: I Initial value: 1 1 1 1 1 1 1 RIW: RIW RIW RIW RIW RIW RIW RIW RIW 112 HITACHI 8.2.10 Parity Control Register (PCR) The parity control register (PCR) is a 16-bit read/write register that selects the parity polarity and space to be parity checked. PCR is initialized to H'OOOO by a power-on reset, but is not initialized by a manual reset or by the standby mode. Bit: 15 14 13 12 11 10 9 8 Bit name: I PEF PFRC PEO I PCHK1 I PCHKO I Initial value: 0 0 0 0 0 0 0 0 RIW: RIW RIW RIW RIW RIW Bit: 7 6 5 4 3 2 0 Bit name: I Initial value: 0 0 0 0 0 0 0 0 RIW: • Bit 15 (parity error flag (PEF»: When a parity check is done, PEF indicates whether a parity error has occurred. 0 indicates that no parity error has occurred; I indicates that a parity error has occurred. Bit 15: PEF Description o No parity error (initial value). Cleared by reading. PEF after it has been set to 1, then writing 0 in PEF. Parity error has occurred. • Bit 14 (parity output force (PFRC»: PFRC selects whether to produce a forced parity output for testing the parity error check function. When cleared to 0, there is no forced output; when set to 1, it produces a forced output of high level from the DPH and DPL pins when data is output, regardless of the parity. Bit 14: PFRC Description o Parity output not forced (initial value) High output forced HITACHI 113 • Bit I3 (parity polarity (PEa»: PEa selects even or odd parity. When cleared to 0, parity is even; when set to 1, parity is odd. Bit 13: PEO Description o Even parity (initial value) -------------------------- Odd parity ----------------------------------------- • Bits 12 and 11 (parity check enable bits 1,0 (PCHKI and PCHKO»: These bits determine whether or not a parity is checked and generated, and select the check and generation spaces. Bit 12: PCHK1 Bit 11: PCHKO Description o 0 Parity not checked and not generated (initial value) Parity checked and generated only in DRAM area ------------- o Parity checked and generated in DRAM area and area 2 Reserved • Bits 10-0 (reserved): These bits always read as O. The write value should always be O. 8.2.11 Notes on Register Access RCR, RTCSR, RTCNT, and RTCOR differ from other registers in being more difficult to write. Data requires a password when it is written. This prevents data from being mistakenly overwritten by program overruns and the like. 114 HITACHI Writing to RCR, RTCSR, RTCNT, and RTCOR: Use only word transfer instructions. You cannot write with byte transfer instructions. As figure 8.2 shows, when writing to RCR, place H'5A in the upper byte and the write data in the lower byte. When writing to RTCSR, place H'A5 in the upper byte and the write data in the lower byte. When writing to RTCNT, place H'69 in the upper byte and the write data in the lower byte. When writing to RTCOR, place H'96 in the upper byte and the write data in the lower byte. These transfers write data in the lower byte to the respective registers. If the upper byte differs from the above passwords, no writing occurs. 15 8 7 0 RCRIL_________H_'_5_A________~I________w_r_it_e_d_at_a______~1 15 8 7 0 RTCSRIL_________H_'_A_5________~I ________ w_r_it_e_d_at_a______~1 15 8 7 0 RTCNT LI_________H'6_9________~I __ ________ w_r_it_e_d_at_a______ ~1 15 8 7 0 RTCORIL_________H_'9_6________ ~I________ da_t_a______~1 w_r_ite__ Figure 8.2 Writing to RCR, RTCSR, RTCNT, and RTCOR Reading from RCR, RTCSR, RTCNT, and RTCORP: These registers are read like other registers. They can be read by byte and word transfer instructions. If read by word transfer, the value of the upper eight bits is H'OO. HITACHI 115 8.3 Address Space Subdivision 8.3.1 Address Spaces and Areas Figure 8.3 shows the address format used in this LSI. I  . . . .f - - - - - - - - - - - - - 4 Gbyte space -------------+l~1 I I I : :. . . .f - - - - - - - - - - - 128 Mbyte space ---------+l~ : : 16 Mbyte space ---------111""": : : 4 Mbyte space -----II"!~I I I I A26-A24 A21 AO Output address: Output from address pins A21-AO Ignore: Only valid when the address multiplex function is being used in the DRAM space (area 1); not output in other cases. When not output, becomes shadow. Area selection: Decoded to become chip select signals CSO-CS7 for areas rr-7 Basic bus width selection: Not output externally, but used for basic bus width selection When 0, (H'OOOOOOrr-H'7FFFFFF), the basic bus width is 8 bits. When 1, (H'800000rr-H'FFFFFFF) the basic bus width is 16 bits. Ignore: Always ignore, not output externally Figure 8.3 Address Format Since this LSI uses a 32-bit address, 4 Gbytes of space can be accessed on the architecture; however, the upper 4 bits (A31-A28) are always ignored and not output. Bit A27 is basically only used for switching the bus width. When the A27 bit is 0 (H'OOOOOOO-H'7FFFFFF), the bus width is 8 bits; when the A27 bit is 1 (H'8oo0000-H'FFFFFFF), the bus width is 16 bits. Of the remaining 27 bits (A26-AO), a total 128 Mbyte can thus be accessed. The 128 Mbyte space is subdivided into 8 areas (areas 0-7) of 16 Mbytes each according to the values of bits A26-A24. The space with bits A26-A24 as 000 is area 0 and the space 111 is area 7. The A26-A24 bits are decoded and become the chip select signals (CSO-CS7) of the corresponding areas 0-7 and output. Table 8.6 shows how the space is divided. 116 HITACHI Table 8.6 How Space is Divided Capacity Bus Area Address Assign-able Memory (linear space) Width CS Output 0 H'OOOOOOO - H'OFFFFFF On-chip ROM*1 64 kB 32 External memory*2 4MB 8/16*3 CSO H'1 000000 - H'1 FFFFFF External memory 4MB 8 CS1 DRAM*4 16 MB 8 RASCAS 2 H'2000000 - H'2FFFFFF External memory 4MB 8 CS2 3 H'3000000 - H'3FFFFFF External memory 4MB 8 CS3 4 H'4000000 - H'4FFFFFF External memory 4MB 8 CS4 5 H'5000000 - H'5FFFFFF On-chip peripheral module 512 B 8/16*5 6 H'6000000 - H'6FFFFFF External memory*7 4MB 8/16*6 CS6 Multiplexed I/O 4MB 7 H'7000000 - H'7FFFFFF External memory 4MB 8 CS7 0 H'8000000 - H'8FFFFFF On-chip ROM*1 64 kB 32 External memory*2 4MB 8/16*3 CSO H'9000000 - H'9FFFFFF External memory 4MB 16 CS1 DRAM*4 16 MB 16 RASCAS 2 H'AOOOOOO - H'AFFFFFF External memory 4MB 16 CS2 3 H'BOOOOOO - H'BFFFFFF External memory 4MB 16 CS3 4 H'COOOOOO - H'CFFFFFF External memory 4MB 16 CS4 5 H'DOOOOOO - H'DFFFFFF External memory 4MB 16 CS5 6 H'EOOOOOO - H'EFFFFFF External memory 4MB 16 CS6 7 H'FOOOOOO - H'FFFFFFF On-chip RAM 8kB*8, 4 kB*9 32 Notes: 1. When MD2-MDO pins are 010 (SH7034) 2. When MD2-MDO pins are 000 or 001 3. Select with MOO pin 4. Select with DRAME bit in BCR 5. Divided into 8-bit and 16-bit space according to value of address bit A8 (Long word accesses are inhibited, however, in on-chip peripheral modules with bus widths of 8 bits. Some on-chip peripheral modules with bus widths of 16 bits also have registers that are only byte-accessible and registers for which byte access is inhibited. For details, see the sections on the individual modules.) 6. Divided into 8-bit space and 16-bit space by value of address bit A 14 7. Select with 10E bit of BCR 8. For SH7032 9. For SH7034 HITACHI 117 As figure 8.4 shows, specific spaces such as DRAM space and address/data multiplexed I/O space are allocated to the 8 areas. Each of the spaces is equipped with the necessary interfaces. The control signals needed by DRAM and peripheral LSIs will be output by the chip to devices connected to an area allocated to the appropriate type of space. 8.3.2 Bus Width The primary bus width selection on for this chip is made by switching between 8-bit and 16 bit using the A27 bit. When A27 is 0, the bus width is 8 bits and data is input/output through the AD7-ADO pins; when A27 is 1, the size is 16 bits and data is input/output through the AD1S- ADO pins for word accesses. For byte access, the top byte is input/output through AD1S-AD8 and the lower byte through AD7-ADO. When the bus width is 8 bits or byte access is being performed with a 16-bit bus width, the status of the eight AD pins that are not inputting/outputting data is as shown in appendix B, Pin States. Bus widths are also determined by conditions other than the A27 bit for specific areas: • Area 0 is an 8-bit external memory space when the MD2-MDO pins are 000, a 16-bit external memory space when the same bits are 001, and a 32-bit on-chip ROM space when they are 010 (the on-chip ROM is available only on the SH7034). • Area S is an 8-bit on-chip peripheral module space when the A27 bit and A8 bit are both 0 and a 16-bit on-chip peripheral module space when the A27 bit is 0 and the A8 bit is 1. When the A27 bit is 1, it is a 16-bit external memory space. • Area 6 is an 8-bit bus width when the A27 bit and A 14 bit are both 0 and a 16-bit bus width when the A27 bit is 0 and the A 14 bit is 1. When the A27 bit is 1, it is a 16-bit space. • Area 7 is a 32-bit on-chip RAM space when the A27 bit is 1 and an 8-bit external memory space when the A27 bit is O. Word (16-bit) data accessed from 8-bit bus areas and longword (32-bit) data accessed from 16-bit bus areas require two consecutive accesses. Longword (32-bit) data accessed from 8-bit bus areas requires four consecutive accesses. 8.3.3 Chip Select Signals (CSO-CS7) When the A26-A24 bits of the address are decoded, they become chip select signals (CSO-CS7) for areas 0-7. When an area is accessed, the corresponding chip select pins are driven low. Table 8.7 shows the relationship between the A26-A24 bits and the chip select signals. 118 HITACHI TableS.7 A26-A24 Bits and Chip Select Signals Address A26 A25 A24 Area Selected Chip Select Pin Driven Low a a a Area a csa 1 Area 1 CS1 a Area 2 CS2 Area 3 CS3 a a Area 4 CS4 Area 5 CS5 a Area 6 CS6 Area 7 CS7 The chip select signal is output only for external accesses. When accessing the on-chip ROM (area 0), on-chip peripheral modules (area 5) and on-chip RAM (area 7), the CSO, CS5, and CS7 pins are not driven low. When accessing DRAM space (area 1), select the RAS and CAS signals with the pin function controller. S.3.4 Shadows The size of each area is 16 Mbytes, which can be specified with 24 address bits A23-AO for 8-bit spaces and 16-bit spaces alike. Bits A23 and A22, however, output externally only when the address multiplex function is used in DRAM space (area 1); in all other cases, there is no output, so the actually accessible area for all areas is the 4 Mbyte that can be specified with 22 bits A21- AO. No matter what the values of A23 and A22, the same 4 Mbytes of actual space is accessed. As illustrated in figure 8.4 (a), the A23 and A22 bit regions 00, 01, 10 and 11 are called shadows of actual areas. Shadows are allocated in 4-Mbyte units for both 8-bit and 16-bit bus widths. When the same addresses H'3200000, H'3600000, H'3AOOOOO and H'3EOOOOO are specified for values A21-AO, as shown in figure 8.4 (b), the same actual space is accessed regardless of the A23 and A22 bits. In areas whose bus widths are switchable using the A27 address bit, the shadow of the same actual space is allocated to both A27 =0 spaces and A27 = 1 spaces (figure 8.4(a». When the value of A27 is changed, the valid AD pins switch from AD15-ADO to AD7-ADO, but the actual space accessed remains the same. The spaces of on-chip ROM (area 0), DRAM (area I), on-chip peripheral modules (area 5) and on- chip RAM (area 7) have shadows of different sizes from those discussed above. See section 8.3.5, Description of Areas, for details. HITACHI 119 Logical address space H'BOOOOOO r··············· .... , H'3000000 ,, H'B3FFFFF Shadow ,, '" . H'B400000 H'33FFFFf (A23, A22 00)= ,, ! '. H'3400000 , ' H'B7FFFFF Shadow ',................... , ......... " ' Actual space H'B800000 H'37FFFFF (A23, A22 01)= \< _- :;-:1>i,-r----A-r-ea---, -- /,,,, " \ accessl'ble 4 Mbytes H'3800000 '~,' with A21-AO H'BBFFFFF Shadow /'" ......... ~'~----~ H'BCOOOOO H'3BFFFFF (A23, A22 10)= '" "':.------,-",'" -"'/ ". ,- H'3COOOOO ,- ,- H'BFFFFFF Shadow ,- H'3FFFFFf (A23, A22 11)= ,- ,- ,- 16-bit space 8-bit space a. Shadow allocation Logical address space H'3000000 H'3200000 • Location indicated H'33FFFFF by address H'3400000 Actual space H'3600000 • Location indicated H'37FFFFF by address H'3800000 H'3AOOOOO • /J Location actually accessed Location indicated H'3BFFFFF by address H'3COOOOO H'3EOOOOO H'3FFFFFF • Location indicated by address 8-bit space b. Actual space accessed when addresses are specified Figure 8.4 Shadows 120 HITACHI 8.3.S Area Description Area 0: Area 0 is the area where addresses A26-A24 are 000 and its address range is H'OOOOOOO- H'OFFFFFF and H'8000000-H'8FFFFFF. Figure 8.5 is a memory map of area O. Area 0 can be set for use as on-chip ROM space or external memory space with the mode pins (M02-MOO). The M02-MOO pins also determine the bus width, regardless of the A27 address bit. When M02-MOO are 000, area 0 is an 8-bit external memory space; when they are 00 I, area 0 is a 16-bit external memory space; and when they are 010, it is a 32-bit on-chip ROM space. The SH7032 can only be used as external memory space since there is no on-chip ROM and this last setting is meaningless. The capacity of the on-chip ROM is 64 kbytes, so bits A23-A16 are ignored in on-chip ROM space and the shadow is in 64-kbyte units. The CSO signal is disabled. In external memory space, the A23 and A22 bits are not output and the shadow is in 4-Mbyte units. When external memory space is accessed, the CSO signal is valid. The external memory space has a long wait function, so between I and 4 states can be selected for the number of long waits inserted into the bus cycle using the areas 0 and 2 long wait insertion bits (A02LWI, A02LWO) of wait state controller 3 (WCR3). HITACHI 121 logical address space logical address space H'8000000 .... H'8000000 H'800FFFF j H'8010000 H1000qoob H'OOOOOOO ·.1 Shadow H'OOOFFFF Shadow ff0019000 Shadow Shadow , H'83FFFFF H'8400000 H'03FFFFF H'0400000 ., ,, .. \ \ ", \', Actual space H'87FFFFF Shadow H'8800000 ~:,' ,",/ External H'07FFFFF " memory H'0800000 , • space , " ", i,' Valid 0 '\. (4 Mbytes) addresses H'8BFFFFF Shadow " '!------' Ii A15-AO H'8COOOOO ,," ....,' 0 MD2-MDO = t, (A23-A16 H'OBFFFFF '. '! 000: 8-bit " ignored) H'OeOOOoo " access, H'8FFOOOO ,I" Ii oeso not ! 001: 16-bit , valid ,, Shadow access :c~ Shadow ,, H'8FFFFFF Shadow I -On-chip H'OFFFFFF o Valid H'OFf'OOOO ". Shadow ROM ,, addresses H'OFFFFFF space H'OFFFFFF A21-AO valid on 8 or 16 8 or 16 (A23 and 32-bit space 32-bit space SH7034 bit space bit space A22 not only output) o eSOvalid o long wait function ,~----------------------~/ ,~--------------------------~/ MD2-MDO =010 MD2-MDO = 000 or 001 Note: The bus width of area 0 is determined by the MD2-MDO pins regardless of the A27 bit setting, Figure 8 5 Memory Map of Area 0 Area 1: Area 1 is-t6e area where addresses A26-A24 are 001 and its address range is H'1000000- H'IFFFFFF and H'9000000-H'9FFFFFF. Figure 8,6 is a memory map of area 1. Area 1 can be set for use as DRAM space or external memory space with the DRAM enable bit (DRAME) of the bus control register (BCR). When the DRAME bit is 0, it is external memory space; when DRAME is 1, it is DRAM space. In ex.ternal memory space, the bus width is 8 bits when the A27 bit is 0 and 16 bits when it is 1. Bits A23 and A22 are not output and the shadow is in 4-Mbyte units. When external memory is accessed, the CS 1 signal is valid. DRAM space is a type of external memory space, but it is configured especially to be connected to DRAM so it outputs strobe signals required for this purpose. Its bus width is 8 bits when it is 0 and 122 HITACHI 16 bits when it is 1. When the multiplex enable bit (MXE) of the DRAM control register (DCR) is set to 1 to use the address multiplex function, bits A23-AO are multiplexed and output from pins AI5-AO, so a maximum 16-Mbyte space can be used. When DRAM space is accessed, the CSI signal is not valid and the pin function controller should be set for access with CAS (CASH and CASL) and RAS signals. Logical address space Logical address space H'9000000 ................ r············ .... H'9000000 ................. r·······........ Actual space H'1000000 H'1000000 H'93FFFFF Shadow H'9400000 ' .. H'13FFFFF H'1400000 , ",\ Actual space : :, H'97FFFFF Shadow '.:' External .i" H'9800000 :''.': memory DRAM space , ,. H'17FFFFF I. space Shadow H'1800000 < X CSn \ ~~ ! RD \ n I A..d{ AD15-ADO ==> ~~ ( ) {WAH.WAL \ ~~ I Write AD15-ADO ( ) e WAIT \ e II \ Figure 8.13 Wait State Timing for External Memory Space Access (2 states plus wait states from WAIT signal) Areas 0, 2 and 6 have long wait functions. When the corresponding bits in WCR I and WCR2 are cleared to 0, the access cycle is I state plus the number oflong wait states (set in WCR3, selectable between 1 and 4) and the WAIT pin input signal is not sampled. When the bits are set to I, the WAIT signal is sampled and the number of states is I plus the number of long wait states plus the number of wait states in the WAIT signal. The WAIT signal is sampled at the rise of the system clock (CK) directly preceding the last long wait state and the wait states are inserted as long as the level is low. When a high level is detected, it shifts to the final long wait state. Figure 8.14 shows the wait state timing when accessing the external memory spaces of areas 0, 2, and 6. HITACHI 131 Wait state Wait Wait states from WAIT states set set in WCR3 signal input in WCR3 •• •• • CK A21-AO ==><~_-'-- _______-'--___~_"-_:"'->C r RD \'----'---~____'____';- { Read ADl5-ADO ~r---'---------'----'-----'---'---1 l-- WRH' WRL / Write { AD15-ADO -----~(~_~_______________,._-~-~ >- Figure 8.14 Wait State Timing for External Memory Space Access (1 state plus long wait state (when set to insert 3 states) plus wait states from WAIT signal) . For CPU write cycles and DMAC dual mode write cycles to external memory space, the number of states and wait state insertion cannot be controlled by WCR1. In areas 1,3,4,5, and 7, the WAIT signal is sampled and the number of states is 2 plus the number of wait states in the WAIT signal (figure 8.13). In areas 0, 2 and 6, the number of states is 1 state plus the number of long wait ° states plus the number of wait states in the WAIT signal (figure 8.14). Never write in bits 7-2 and 0 ofWCRl; only write l. When area 1 is being used as external memory space, never write 0 to bit 1 (WWl); always write 1. 8.4.3 Byte Access Control The upper byte and lower byte control signals when 16-bit bus width space is being accessed can be selected from (WRH, WRL, AO) or (WR, HBS, LBS). When the byte access select bit (BAS) of 132 HITACHI the BCR is set to 1, the WRH, WRL, and AO pins output WR, LBS and HBS signals. Figure 8.15 illustrates the control signal output timing in the byte write cycle. Upper byte access Lower byte access .. T1 .. : T2 T1 .. ... T2 .. CK AO BAS=O WRH WRL HBS ~ \~- BAS = 1 LBS J WR \ \,---------,1 Figure 8.15 Byte Access Control Timing For External Memory Space Access (Write Cycle) 8.S DRAM Interface Operation When the DRAM enable bit (DRAME) of the BCR is set to 1, area 1 becomes DRAM space and the DRAM interface function is available, which permits direct connection of this LSI to DRAMs. 8.5.1 DRAM Address Multiplexing When the multiplex enable bit (MXE) of the DRAM area control register (DCR) is set to 1, row addresses and column addresses are multiplexed. This allows DRAMs that require multiplexing of row and column addresses to be connected directly to the SH microprocessors without additional multiplexing circuits. When addresses are multiplexed (MXE = I), setting of the DCR' s multiplex shift bits (MXC1, MXCO) allows selection of eight, nine and ten-bit row address shifting. Table 8.9 illustrates the relationship between MXCIIMXCO bits and address multiplexing. HITACHI 133 Table 8.9 Relationship between Multiplex Shift Count Bits (MXCl t MXCO) and Address Multiplexing Shift Amount 8 bits Shift Amount 9 bits Shift Amount 10 bits Output Output Output Output Row Column Output Row Column Output Row Column Output Pin Address Address Address Address Address Address A21 A21 A21 A21 A20 A20 A20 A20 A19 Undefined A19 A19 A19 A18 Value A18 Undefined A18 A18 A17 A17 Value A17 Undefined A17 A16 A16 A16 Value A16 A15 A23 A15 A15 A15 A14 A22 A14 A23 A14 A14 A13 A21 A13 A22 A13 A23 A13 A12 A20 A12 A21 A12 A22 A12 A11 A19 A11 A20 A11 A21 A11 A10 A18 A10 A19 A10 A20 A10 A9 A17 A9 A18 A9 A19 A9 A8 A16 A8 A17 AS A1S AS A7 A15 A7 A16 A7 A17 A7 A6 A14 A6 A15 A6 A16 A6 . A5 A13 A5 A14 A5 A15 A5 A4 A12 A4 A13 A4 A14 A4 A3 A11 A3 A12 A3 A13 A3 A2 A10 A2 A11 A2 A12 A2 A1 A9 A1 A10 A1 A11 A1 AO AS AO A9 AO A10 AO Notes: The MXC1=1, MXO=1 setting is reserved. Do not use it. 134 HITACHI For example, when MXCI and MXCO are set to 00 and an 8-bit shift is selected, the A23-A8 address bit values are output to pins AI5-AO as row addresses. The values for A21-A16 are undefined. The values of bits address A21-AO are output to pins A21-AO as column addresses. Figure 8.16 depicts address multiplexing with an 8-bit shift. RAS =Low level Internal address Address pin Undefined output CAS =Low level Internal address L -_ _ ~= Address pin Figure 8.16 Address Multiplexing States (8-bit shift) 8.S.2 Basic Timing There are two types of DRAM accesses: short pitch and long pitch. Short pitch or long pitch can be selected for the respective bus cycles using the RWI and WWI bits ofWCRI and the DRWI and DWWI bits ofWCR2. When the corresponding bits are cleared to 0, DRAM access is short pitch and column address output occurs in I state. When these bits are I, DRAM access is long pitch and column address output occurs in 2 states. Figure 8.17 shows short pitch timing; figure 8.18 shows long pitch timing. The high-level duty of the CAS signal can also be selected between 50% and 35% oftheTc state when access is short pitch. By setting the CDTY bit to I, high level duty becomes 35% and DRAM access time can be lengthened. Only set to I when the operating frequency is a minimum of 10 MHz. HITACHI 135 ---------_.---------------------- Tp CK A21-AO =><______-'X Row address XColumn address X'-___ RAS =:J \ / . CDTY· =0 CAS =:J ... ....~\i ~~~----------~;- / . CDTY = 1 WRH.WRL Read { AD15-ADO =====)>--.;.......-~------'--...,....--...,....-~('-_ _ _-J)>--- WRH. WRL Write { AD15-ADO ====)>-;-._~_~_---o._--«I....._ _--')>---- Figure 8.17 Short Pitch Access Timing 136 HITACHI CK • Te .'. Tr •• Tc 1 •• Tc2 A21-AO =x '-,--~--'--><= Column address RAS ~ ~----~----~~;- CAS ~ \ {WAH.WAL ~ Read AD15-ADO I ( {WAH. WAL \ / Write AD15-ADO I ~------~>-- ( Figure 8.18 Long Pitch Access Timing 8.5.3 Wait State Control Precharge State Control: When the microprocessor clock frequency is raised and the cycle period shortened, 1 cycle may not always be sufficient for the precharge time for the RAS signal when the DRAM is accessed. The BSC allows the precharge cycle to be set to 1 state or 2 states using the RAS signal precharge cycles bit (TPC) of the OCR. When the TPC bit is 0, the precharge cycle is 1 state; when TPC is 1, the precharge cycle is 2 states. Figure 8.19 shows the timing when the precharge cycle is 2 states. HITACHI 137 .. CK A21-AO =::x__ ___ ~ ~XROw addreso/( Column address x= \ r \ r Figure 8.19 Precharge Timing (Long Pitch) Control of Insertion of Wait States Using the WAIT Pin Input Signal: The number of wait states inserted into the DRAM access cycle can be controlled by setting WCRI and WCR2. When the corresponding bits in WCR 1 and WCR2 are cleared to 0, the column address output cycle ends in 1 state and no wait states are inserted. When the bit is 1, the WAIT pin input signal is sampled on the rise of the system clock (CK) directly preceding the second state of the column address output cycle and the wait state is inserted as long as the level is low. When a high level is detected, it shifts to the second state. Figure 8.20 shows the wait state timing in a long pitch bus cycle. •• ... Tew (wait state) .. CK A21-AO =X~_--;"-J Column address ~~~~~~ ~ __~~A- Figure 8.20 Wait State Timing during DRAM Access (Long Pitch) 138 HITACHI When the RWI bit is set to 1, the number of wait states selected by CBR refresh wait state insertion bits 1 and 0 (RLW 1, RLWO) of the refresh control register (RCR) are inserted into the CAS-before-RAS refresh cycle. 8.5.4 Byte Access Control 16-bit width and 8-bit width DRAMs require different types of byte control signals for access. By setting the dual CAS signals/dual WE signals select bit (CW2) in the DCR, the BSC allows selection of either the dual CAS signals or the dual WE signals system of control signals. When 16-bit space is being accessed and the CW2 bit is cleared to 0 for dual CAS signals, CASH, CASL, and WRL signals are output; when CW2 is set to I for dual WE signals, the CASL, WRH, and WRL signals are output. When accessing 8-bit space, WRL and CASL are output regardless of the CW2 setting. Figure 8.21 shows the control timing of the upper byte write cycle (short pitch) in 16-bit space. HITACHI 139 Tp ... Tr . . Tc CK A21-AO =x x Row address x== XColumn address RAS ~ \ r- Byte {CASH control \ r- CASL High level WRH High level fixed WRL ~ \ r- (a) Dual CAS signals (CW2 =0) .. Tp ... Tr ... Tc CK A21-AO =x X Row address XColumn address x== RAS ~ \ r- CASH High level fixed CASL :J \ r- Byte { control' W~H Oil __ \ r- WRL :J High level (a) Dual WE signals (CW2 = 1) Figure 8.21 Byte Access Control Timing for DRAM Access (Upper Byte Write Cycle, Short Pitch) 140 HITACHI 8.S.S DRAM Burst Mode In addition to the normal mode of DRAM access, in which row addresses are output at every access and data then accessed (full access), the DRAM also has a high-speed page mode for use when continuously accessing the same row. The high speed page mode enables fast access of data simply by changing the column address after the row address is output (burst mode). Select between full access and burst operation by setting the burst enable bit (BE» in the DCR. When the BE bit is set to I, burst operation is performed when the row address matches the previous DRAM access row address. Figure 8.22 shows the comparison of full access and burst operation. A21-AO AD15- ADO (a) Full access (read cycle) A21-AO AD1S- ADO (b) Burst operation (read cycle) Figure 8.22 Full Access and Burst Operation Short pitch high-speed page mode or long pitch high-speed page mode burst transfers can be selected independently for DRAM read/write cycles even when the burst operation is selected by using the bits corresponding to area 1 in WCRI and WCR2 (RWI, WWI, DRWI, DWWl). The RAS down mode or RAS up mode can be selected by setting the RAS down bit (RASD) of the DCR when there is an access outside the DRAM space during burst operation. HITACHI 141 Short Pitch High-Speed Page Mode and Long Pitch High-Speed Page Mode: When burst operation is selected by setting the DCR's BE bit to I, the short pitch high-speed page mode or long pitch high-speed page mode can be selected by setting the RWI, WWI, DRWI, and DWWI bits of the WCR I and WCR2 . • Short-pitch, high-speed page mode: When the RWI, WWI, DRWI and DWWl bits are cleared to 0 in WCR 1 and WCR2, and the corresponding DRAM access cycle is continuing, the CAS signal and column address output cycles continue as long as the row addresses continue to match. The column address output cycle is perfonned in I state and the WAIT signal is not sampled. Figure 8.23 shows the read cycle timing for the short pitch high-speed page mode. Tp Tr Te Te . ... Te CK Column Column Column Column addres~ 1 addres~ 2 addres~ 3 addres~ 4 A21- AO ~~~_.~X~--~~X~ __~X~__~X~__~X x=== Row address 1 \~--------------------~~ CAS WRJ AD1~ ------)>-:_~__--'-_~( Data 1 >-< Data 2 >-< Data 3 >-< Data 4 >-- Figure 8.23 Short Pitch High-Speed Page Mode (Read Cycle) When the write cycle continues for the same row address in the short pitch high-speed page mode, an open cycle (silent cycle) is produced for I cycle only. This timing is shown in figure 8.24. Likewise, when a write cycle continues after the read cycle for the same row address, a silent cycle is produced for I cycle. This timing is shown in figure 8.25. The details of timing are discussed in section 20.3.3, Bus Timing. 142 HITACHI Access A Access B •• t: CK •Column Column •Column Column address A-1·address A-2 address B-1 'address B-2 ~~o_~~~X~:--~XX - . • _. - • . ! ~. X~--~X X ~. x== Row address ; CAS WR J \'""'._..--_---' AD15- - : - - , Vi . AO ~>'-:----------......(Data A-1)¢>ata A-2)>-·-..;--;....;(Data B-1/\Data B-?;i----- Note: Access A and B are examples of 32-bit data accesses in their respective 16-bit bus width spaces. Figure 8.24 Short Pitch High-Speed Page Mode (Write Cycle) HITACHI 143 Access A (read) ... Access 8 (write) Silent cycle •• Tc CK Column Column Column Column address A-1 address A-2 address 8-1 address 8-2 lr lr lr lr ~~~____~X~~~~X~__~X~__~X~__~X X~___X== Row address \~-----------------------;-- CAS WRJ \'-----~/ AD15- --~)~;- - - - - - ' - - - - ' - - « ADO )--<,_-'t-----'<, __ '-c:~_---' ~ - ~ - -:---'X, __ ~)>--- ~ Read data A-1 Read data A-2 Write data 8-1 Write data 8-2 Note: Access A and 8 are examples of 32-bit data accesses in their respective 16-bit bus width spaces. Figure 8.25 Short Pitch High-Speed Page Mode (When read or write cycle continues with the same row address) The high-level duty of the CAS signal can be selected in the short pitch high-speed page mode using the CAS duty bit (CDTY) in the DCR. When the CDTY bit is cleared to 0, high-level duty is 50% of the TC state; when CDTY is set to 1, it is 35% of the TC state. • Long-pitch, high-speed page mode: When the RWI, WWI, DRWI, and DWWI bits are set to 1 in WCR 1 and WCR2, and the corresponding DRAM access cycle is continuing, the CAS signal and column address output cycles (2 states) continue as long as the row addresses continue to match. When the WAIT signal is detected at the low level, the second cycle of the column address output cycle is repeated as the wait state. Figure 8.26 shows the timing for the long pitch high-speed page mode. See section 20.3.3, Bus Timing, for more information about the timing. 144 HITACHI .. Tr ,.... To 1 .. ... T02 I .. To 1 .. ... T02 .. .. CK A21-ADO •X , Row address 1 . XColumn address 1 XColumn address ~ RASJ \ r- CASJ \ WRJ Read { AD15-ADO .~ / Write { WR J · AD15-ADO ~>-.~-...-~--« Data 1 >--< Data2 r-- Figure 8.26 Long Pitch High-Speed Page Mode (Read/Write Cycle) RAS Down Mode and RAS Up Mode: Sometimes access to another area can occur between accesses to the DRAM even though burst operation has been selected. Keeping the RAS signal at low while this other access is occurring allows burst operation to continue the next time the same row of the DRAM is accessed. The RASD bit in the DCR selects the RAS down mode when set to 1 and the RAS up mode when cleared to O. • RAS Down Mode: When the RASD bit of DCR is set to 1, the DRAM access pauses and the RAS signal is held low throughout the access of the other space while waiting for the next access to the DRAM area. When the row address for the next DRAM access is the same as the previous DRAM access, burst operation continues. Figure 8.27 shows the timing of the RAS down mode when external memory space is accessed during burst operation. The RAS signal can be held down in the DRAM for a limited time; the RAS signal must be returned to high within the specified limits even when the RAS down mode is selected since the critical low level period is set. In this LSI, even when the RAS down mode is selected, the RAS signal automatically reverts to high when the DRAM is refreshed, so the BSC's refresh control function can be employed to set a CAS-before-RAS refresh that will keep operation within specifications. See section 8.5.6, Refresh Control, for details. HITACHI 145 DRAM access CK Column Column m~mory address 3 address 4 A21- AO ----~ • X 'f! . X'--_--,-JXr-·~---..X. .- X,....:..---"~---..X. ~ ><== Row address RASJ \~~~~--~~~--~--~~~~~ CAS WRJ C >-< Data 3 >-< Data 4 >- AD15- • • . . ' . . . ADO :=)>'-.- - - - - - - « Data 1 Data 2 >-< if • . >-< External memory data Figure 8.27 RAS Down Mode • RAS Up Mode: When the RASD bit is cleared to 0, the RAS signal reverts to high whenever a DRAM access pauses for access to another space. Burst operation continues only while DRAM access is continuous. Figure 8.28 shows the timing when an external memory space access occurs during burst operation in the RAS up mode. 146 HITACHI DRAM access CK A2~O~_ _~X X'--_. . . . X xx ~-~ X ~ XC ~--- I . Row address Row address RAS OJ! \'--;----;---;-~-'--___,J/ CASJ ~ AD15- :=J>--...,.-~-~~( Data 1 >< Data 1 X......,,----.Jr--------« Data 3 >- ADO • 11 External memory data Figure 8.28 RAS Up Mode 8.5.6 Refresh Control The BSC has a function for controlling DRAM refreshing. By setting the refresh mode bit (RMODE) in the refresh control register (RCR), either CAS-before-RAS refresh (CBR) or self- refresh can be selected. When no refresh is performed, the refresh timer counter (RTCNT) can be used as an 8-bit interval timer. CAS-Before-RAS Refresh (CBR): A refresh is performed at an interval determined by the input clock selected in the clock select bits 2-0 (CKS2-CKSO) of the refresh timer control/status register (RTCSR) and the value set in the refresh time constant register (RTCOR). Set the values of RTCOR and CKS2-CKSO so they satisfy the refresh interval specifications of the DRAM being used. To perform a CBR refresh, clear the RMODE bit of the RCR to 0 and then set the refresh control bit (RFSHE) bit to 1. Also write in the required values to RTCNT and RTCOR. When the clock is thereafter selected in the CKS2-CKSO bits of the RTCSR, the RTCNT will begin to increment from its current value. The RTCNT value is constantly compared to the RTCOR value and the CBR refresh is performed when they match. The RTCNT is simultaneously cleared to H'OO and incrementing begins again. When the clock is selected in the CKS2-CKSO bits, the RTCNT immediately begins to increment from its current value. This means that when the RTCOR cycle is set after the CKS2-CKSO bits are set, the RTCNT count may already be higher than the RTCOR cycle. When this occurs, the RTCNT will overflow once (H'FF goes to H'OO) and incrementing will start again. Since the CBR refresh will not be performed until the RTCNT again matches the RTCOR value, the initial refresh HITACHI 147 interval will be rather· long. It is thus advisable to set the RTCOR cycle prior to setting the CKS2- CKSO bits and start it incrementing. When CBR refresh control is being performed after its use as an 8-bit interval timer, the RTCNT count value may be in excess of the refresh cycle. For this reason, clear the RTCNT by writing H'OO before starting refresh control to assure a correct refresh interval. When the RWI bit of WCR I is set to I and the read cycle is set to long pitch, the number of wait states selected by the RLW I and RLWO bits of the RCR will be inserted into the CBR refresh cycle, regardless of the status of the WAIT signal. Figure 8.29 shows the RTCNT operation and figure 8.30 shows the timing of the CBR refresh. For details on timing, see section 20.3.3, Bus Timing. RTCNT Compare Compare Compare Compare value match match match match RTCOR ........ ":'lith. RTG9~...... 'N. it.h..Rl~9.~.... ":'Ii.t~.. RTC:9~.... ":'Iit~ .~TC:9~.. value ~ _ _ _ _-"'--_ _ _ _-'L_ _ _ _ ---"'---~ _ _ _" ' - _.... Time Clock CSR t t CSR CSR t t CSR selected with CKS2-GKSO CSR: CAS-before-RAS refresh Figure 8.29 Refresh Timer Counter (RTCNT) Operation I- TRp ·1- TRr ':- TRe ., CK ~ RAS I \ I CAS =.J \ / Figure 8.30 Output Timing for CAS-Before-RAS Refresh Signal Self-Refresh Mode: Some DRAMs have a self-refresh mode (parity back-up mode). This is a type of a standby mode in which the refresh timing and refresh addresses are generated inside the DRAM chip. When the RFSHE and RMODE bits of the RCR are both set to 1, the DRAM will enter the self-refresh mode when the CAS and RAS signals are output as shown in figure 8.31. See 148 HITACHI section 20.3.3, Bus Timing, for details. The DRAM self-refresh mode is cleared when the RMODE bit in the RCR is cleared to 0 (figure 8.31). The RFSHE bit should be left at 1 when this is done. Some DRAM vendors recommend that after exiting the self-refresh mode, all row addresses should be refreshed again. This can be done using the BCR's CBR refresh function to set all row addresses for refresh in software. To access a DRAM area in the self-refresh mode, clear the RMODE bit to 0 and exit the self- refresh mode. The LSI can be kept in the self-refresh state and shifted to standby mode by setting it to self- refresh mode, setting the standby bit (SBY) of the standby control register (SBYCR) to 1, and then executing a SLEEP instruction. TRe TRr T Rc T Rce -I- CK RAS / \ ~~ / CAS ==.; \ ~~ / Figure 8.31 Output Timing of Self-Refresh Signal Refresh Requests and Bus Cycle Requests: When a CAS-before-RAS refresh or self-refresh is requested during bus cycle execution, parallel execution is sometimes possible. Table 8.10 describes operation when the refresh and bus cycle are in contention. Table 8.10 Refresh and Bus Cycle Contention Type of Bus Cycle External Space Access External Memory Space, On-Chip ROM, On-Chip Multiplexed I/O Space _ _D_R_A_M_S_p_ac_e_ _ RAM , On-Chip Type of Refresh Read Cycle Write Cycle Read Cycle Write Cycle Peripheral Access CAS-before-RAS Yes No No No Yes refresh Self-refresh Yes Yes No No Yes Yes: Can be executed in parallel No: Cannot be executed in parallel HITACHI 149 When parallel execution is available, the RAS and CAS signals are output simult&neously during bus cycle execution and the refresh is executed. When parallel execution isnot available, refresh occurs after the bus cycle has ended. Using RTCNT as an 8-Bit Interval Timer: When not performing refresh control, RTCNT can be used as an 8-bit interval timer. Simply set the RFSHE bit of the RCR to O. To produce a compare match interrupt (CM!), set the compare match interrupt enable bit (CMIE) to I and set the interrupt generation timing in RTCOR. When the input clock is selected with the CKS2-CKSO bits of the RTCSR, RTCNT starts incrementing as an 8-bit interval timer. Its value is constantly being compared to RTCOR and when a match occurs, the CMF bit of RTCSR is set to 1 and a CMI interrupt is produced. RTCNT is cleared to H'OO. When the clock is selected with CKS2-CKSO bits, RTCNT starts incrementing immediately. This means that when the RTCOR cycle is set after the CKS2-CKSO bits are set, the RTCNT count may already be higher than the RTCOR cycle. When this occurs, the RTCNT will overflow once (H'FF goes to H'OO) and the count up will start again. No interrupt will be generated until the RTCNT again matches the RTCOR value. It is thus advisable to set the RTCOR cycle prior to setting the CKS2-CKSO bits. After its use as an 8-bit interval timer, the RTCNT count value may be in excess of the set cycle. For this reason, write H'OO to the RTCNT to clear it before starting to use it again with new settings. RTCNT can then be restarted and an interrupt obtained after the correct interval. 8.6 AddresslData Multiplexed 110 Space Access The BSC is equipped with a function that multiplexes input/output of address and data to pins ADIS-ADO in area 6. This allows the SH microprocessor to be directly connected to peripheral LSIs that required address/data multiplexing. 8.6.1 Basic Timing When the multiplexed 110 enable bit (lOE) of the BCR is set to 1, the area 6 space with address bit A27 as 0 (H'6000000-H'6FFFFFF) becomes an address/data multiplexed 110 space that, when accessed, multiplexes addresses and data. When the A 14 address bit is 0, the bus width is 8 bits and address output and data input/output are performed from the AD7-ADO pins. When the A14 address bit is 1, the bus width is 16 bits and address output and data input/output are performed from the AD1S-ADO pins. In the address/data multiplexed 110 space, access is controlled with the AH, RD and WR signals. Accesses in the address/data multiplexed I/O space is performed in 4 states, regardless of the WCR settings. Figure 8.32 shows the timing when the address/data multiplexed I/O space is accessed. 150 HITACHI T1 T2 T3 T4 •• CK A21-AO =x x= CS \ / AH :/ :\ RD \ / RMd{ AD15-ADO ( ) { wAH.WRL \ Write AD15-ADO ( Address >--:-< Data (output) Figure 8.32 Access Timing For AddresslData Multiplexed 1/0 Space The bigh-Ievel duty of the RD signal can be selected between 35% and 50% using the RD duty bit (RDDTY) of the BCR. When RDDTY is 1, the high-level duty is 35% of the T3 or Tw state, lengthening the access time for external devices. HITACHI 151 --------------.---~~----~~~~~~~~~- 8.6.2 Wait State Control When the address/data multiplexed I/O space is accessed, the WAIT pin input signal is sampled and a wait state inserted whenever a low level is detected, regardless of the setting of the WCR. Figure 8.33 shows an example in which a WAIT signal causes a wait state of 1 state to be inserted. Figure 8.33 Wait State Timing For AddresslData Multiplexed I/O Space Access 8.6.3 Byte Access Control The byte access control signals when the address/data multiplexed I/O space is being accessed are of two types (WRH, WRL. AO. or WR. HBS. LBS). just as for byte access control of external memory space access. These types can be selected using the BAS bit of the BCR. See section 8.4.3. Byte Access Control. for details. 152 HITACHI 8.7 Parity Check and Generation The BSC can check and generate parity for data input and output to or from in the DRAM space of area 1 and the external memory space of area 2. To check and generate parity, select the space (DRAM space only, or DRAM space and area 2) for which parity is to be checked and generated using the parity check enable bits (PCHK 1 and PCHKO) of the parity control register and select odd or even parity in the parity polarity bit (PEO). When data is input from the space selected in the PCHKl and PCHKO bits, the BSC checks the PEO bit to see if the polarity of the DPH pin input (upper byte parity data) is accurate for the ADl5-AD8 pin input (upper byte data) or if the DPL pin input (lower byte parity data) is accurate for the AD7-ADO pin input (lower byte data). If the check indicates that either the upper or lower byte parity is incorrect, a parity error interrupt is produced (PEl). When outputting data to the space selected in the PCHKl and PCHKO bits, the BSC outputs parity data output of the polarity set in the PED bit from the DPH pin for the AD IS-AD8 pin output (upper byte data) or from the DPL pin for the AD7-ADO pin input (lower byte data) using the same timing as the data output. The BSC is also able to force a parity output for use in testing the system's parity error check function. When the parity force output bit (PFRC) of the PCR is set to 1, a high level is forcibly output from the DPH and DPL pins when data is output to the space selected in the PCHK 1 and PCHKObits. 8.8 Warp Mode In warp mode, an external write cycle or DMA single address mode transfer cycle and an internal access cycle (read/write to on-chip memory or on-chip peripheral modules) operate independently in parallel. The warp mode is entered by setting the warp mode bit (WARP) in the BCR to I. This allows the LSI to be operated at high speed. When in the warp mode an external write cycle or DMA single address mode transfer cycle continues for at least 2 states and their is an internal access, only the external write cycle will be performed in the initial state. The external write cycle and internal access cycle will be performed in parallel from the next state on, without waiting for the end of the external write cycle. Figure 8.34 shows the timing when an access to an on-chip peripheral module and an external write cycle are performed in parallel. HITACHI 153 I On-chlpperlpheial module readlwrite I T1 ./: T2' .1" T3 .I~ T4 : T5 CK A21~ ===X~__________E_~_e_r_n_a~ls~p_a_ce__ad_d_r_es_s________________~ E~ernal space write \~--------~----------~/ AD15- -----.X Write data ADO _-=--.-J. '-:--- - - - - , - - - - - - , . . . . - - - - - - , - - - ; . . . . - >C. E~ernal space·· address II Internal address =:::X~ __--'---'X On-chip peripheral module addressX'---'-____-'--___ On-chip peri- l'ntema, write \ / pheral strobe module Internal write data bus ( Write data > Internal On-chip peri- read \ / strobe pheral module Internal read data bus < Read data > Figure 8.34 Warp Mode Timing (Access to On- Chip Peripheral Module and External Write Cycle) 8.9 Wait State Control The WCRl-WCR3 registers of the BSe can be set to control sampling of the WAIT signal when accessing various areas and the number of bus cycle states. Table 8.11 shows the number of bus cycle states when accessing various areas. 154 HITACHI Table 8.11 Bus Cycle States when Accessing Address Spaces CPU Read Cycle, DMAC Dual Mode Read Cycle, DMAC Single Mode Memory ReadlWrite Cycle Corresponding Bits in WCR1 Corresponding Bits in WCR1 Address Space and WCR2 =0 and WCR2 1 = External memory (areas 1 state fixed; WAIT signal ignored 2 states fixed + wait states from 1,3-5,7) WAIT signal External memory (Areas 1 state + long wait state*, WAIT 1 state + long wait state* + wait 0, 2, 6; long wait avail- signal ignored states from WAIT signal able) DRAM space (area 1) Column address cycle: 1 state, Column address cycle: 2 states + WAIT signal ignored (short pitch) wait states from WAIT signal (long pitch) Multiplexed I/O space 4 states + wait states from WAIT signal (area 6) On-chip peripheral 3 states fixed, WAIT signal ignored module space (area 5) On-chip ROM (area 0) 1 state fixed, WAIT signal ignored On-chip RAM (area 7) 1 state fixed, WAIT signal ignored CPU Write Cycle, DMAC Dual Mode Memory Write Cycle (WW1 of WCR1) Address Space WW1 of WCR1=0 WW1 of WCR1=1 External memory (areas 1, 2 states fixed + wait states from WAIT signal 3-5,7) External memory (Areas 0, 1 state + long wait state* + wait states from WAIT signal 2,6; long wait available) DRAM space (area 1) Column address cycle: 1 state, Column address cycle: 2 states + WAIT signal ignored (short pitch) wait states from WAIT signal (long pitch) Multiplexed I/O space 4 states + wait states from WAIT signal (area 6) On-chip peripheral module 3 states fixed, WAIT signal ignored space (area 5) On-chip ROM (area 0) 1 state fixed, WAIT signal ignored On-chip RAM (area 7) 1 state fixed, WAIT signal ignored Note: The number of long wait states (1. to 4) is set in WCR3. For details on bus cycles when external spaces are accessed, see section 8.4, External Memory Space Access, section 8.5, DRAM Space Access, and section 8.6, AddresslData Multiplexed 110 Space Access. HiTACHI 155 Accesses of on-chip spaces are as follows: On~chip peripheral module spaces (area 5 when address bit A27 is I) are always 3 states, regardless of the WCR, with no WAIT signal sampling. Accesses of on-chip ROM (area 0 when MD2-MDO are 010) and on-chip RAM (area 7 when address bit A27 is 0) are always performed in I state, regardless of the WCR, with no WAIT signal sampling. 8.10 Bus Arbitration The SH microprocessor can release the bus to external devices when they request the bus. It has two internal bus masters, the CPU and the DMAC. Priorities for releasing the bus for these two are as follows. Bus request from external device> DMAC > CPU Thus, an external device has priority when it generates a bus request, even when the DMAC is doing a burst transfer. Note that when a refresh request is generated while the bus is released to an external device, BACK becomes high level and the bus right can be acquired to perform the refresh upon receipt of a BREQ =high level response from the external device. Input all bus requests from external devices to the BREQ pin. The signal indicating that the bus has been released is output from the BACK pin. Figure 8.35 illustrates the bus release procedure. SH microprocessor External device Bus request BREQ received Strobe pin: High-level output '-_A_d_d_re_s,,-s'_d_a.,.ta_,_st_ro_b_e_p_in_:...J BACK / High Impedance / __ r BA_C_K_a_ck"",n_o_W,,-le_d_g_e_. Bus release response Bus released Figure 8.35 Bus Release Procedure 156 HITACHI 8.10.1 The Operation of Bus Arbitration This LSI has the bus arbitration function which can give bus ownership to an extemal device when the device requests the bus ownership. When BREQ is input and the bus cycle being executed by the CPU or DMAC is completed, BACK becomes low and a bus is released for an external device. At this time, the following operates when bus arbitration conflicts with refresh. 1. If DRAM refresh is requested in this LSI when a bus is released and BACK is low, BACK becomes high and the occurrence of the refresh request can be informed externally. At this time, the external device may generate a bus cycle when BREQ is low even if BACK is high. Therefore, a bus remains released to the external device. Then, when BREQ becomes high, this LSI gets bus ownership, and executes refresh and the bus cycle of the CPU or DMAC. After the external device gets bus ownership and BACK is low, refresh is requested when BACK becomes high even if the low level of BREQ is input. Therefore, tum BREQ high immediately to release a bus for this LSI to hold DRAM data (See figure 8.36). 2. When BREQ changes from high to low and internal refresh is requested at the timing of the bus release of this LSI, BACK may remain high (do not become low). A bus is released to the external device since the low level of BREQ is input. This operation is based on the above specification (1). To hold DRAM data, tum BREQ high and release a bus to this LSI immediately when the external device detects that BACK does not change to low during a fixed time this LSI (See figure 8.37). When a refresh request is generated and BACK returns to high, as shown in figure 8.37, a momentary narrow pulse-shaped spike may be output where BACK was originally supposed to become low. j { '-.\~_-....J~ - Refresh execution ~ Refresh damand Figure 8.36 BACK Operation by Refresh Demand (1) HITACHI 157 In case BACK does not become low level during a fixed period, ---- { .... . ,...------------ return BREQ to high level once.} t V______ Refresh dam and BACK = does not become low level. Figure 8.37 BACK Operation by Refresh Demand (2) 8.11 Usage Notes 8.11.1 Usage Notes on Manual Reset Condition: When DRAM (long-pitch mode) is used and manual reset is performed. The low width of RAS output may be shorter than usual in reset (2.5 tcyc ~ 1.5 tcyc), causing the specified value (tRAS) of DRAM not to be satisfied. Corresponding DRAM conditions: long pitch/normal mode long pitchlhigh-speed page mode There are no problems regarding operations except for the above conditions. There are the following four cases (Figure 8.38 to Figure 8.41) for the output states of DRAM control signals (RAS, CAS, and WR) corresponding to RES latch timing. Actual output levels are shown by solid lines (not by dashed lines). 158 HITACHI Tp Tr Tc1 Tc2 CK RES AOto A21 RAS CAS I I WR ADO to AD15 Data oufpuT----- Figure 8.38 Long - pitch Mode Write (1) CK RES AO to A21 ' .. _______ I' I WR ------, I --------- " ADO to AD15 -------------------------------------------------4C)r--------~(~\_-_- __-_-__-_-_-__-)r------ Data output Figure 8.39 Long ~ pitch Mode Write (2) HITACHI 159 Tp Tr Tc1 Tc2 CK RES AOtoA21----------------~·r-----~~--~~~--~~,r-----4------- \ ---------,' '----I. _________ } Figure 8.40 Long - pitch Mode Read (1) CK RES Manual reset AO to A21 RAS , -' CAS , \ ---------,' , RD J '.. _.. -- -- - - --- --' Figure 8.41 Long - pitch Mode Read (2) For the signal output shown by solid lines, DRAM data may not be held. Therefore, when DRAM data must be held after reset, take one of the countermeasures described as follows. 1. When resetting manually, do this in watchdog timer (WDT) condition. 2. Even if the Low width of RAS becomes as short as 1.5 tcyc as shown above, use with a frequency that satisfies the DRAM standard (tRAS). 3. Even in case the Low width of RAS has become 1.5 tcyc, proceed by using the external circuit so that a RAS signal with a Low width of 2.5 tcyc is input in the DRAM (in case the Low width of RAS is higher than 2.5 tcyc, operate so that the current waveform is input in the DRAM). 160 HITACHI The countermeasures are not required when DRAM data is initialized or loaded again after manual reset. 8.11.2 Usage Notes on Parity Data Pins DPH and DPL The following specifies the setup time tos of the parity dada DPH and DPL to CAS signal rising when the parity dada DPH and DPL are written to DRAM in long-pitch mode (early write). Table 8.12 Setup time of Parity Data DPH and DPL Hem Symbol Min Data setup time to CAS tos -5ns (for only DPH and DPL in long-pitch mode) Therefore, when writing parity data DPH and DPL to the DRAM in long-pitch mode, delay the WRH and WRL signals of this LSI and write with delayed writing. Normal data is also delay- written, causing no problems. SH Micro- RAS RAS DRAM computer CAS CAS AD OE WRHorWRL --[:>o{:>o- D a DWRHorDWRL WE ,.. p*2 CK " aP Notes: 1. For preventing signal racing 2. Negative edge latch Figure 8.42 Delayed-Write Control Circuit HITACHI 161 Section 9 Direct Memory Access Controller (DMAC) 9.1 ()vervielV The SH microprocomputer chip includes a four-channel direct memory access controller (DMAC). The DMAC can be used in place of the CPU to perform high speed transfers between external devices that have DACK (transfer request acknowledge signal), external memory, memory- mapped external devices, on-chip memory and on-chip peripheral modules (excluding the DMAC itself). Using the DMAC reduces the burden on the CPU and increases overall operating efficiency. 9.1.1 Features The DMAC has the following features. • Four channels • Four Gbytes of address space on the architecture • Byte or word selectable data transfer unit • 65536 transfers (maximum) • Single address mode transfers (channels 0 and I): Either the transfer source or transfer destination (peripheral device) is accessed by a DACK signal (selectable) while the other is accessed by address. I transfer unit of data is transferred in each bus cycle. Device combinations able to transfer: - External devices with DACK and memory-mapped external devices (including external I memories) - External devices with DACK and memory-mapped external memories • Dual address mode transfer: (channels 0-3): Both the transfer source and transfer destination are accessed by address. I transfer unit of data is transferred in 2 bus cycles. Device combinations able to transfer: - Two external memories - External memory and memory-mapped external devices - Two memory-mapped devices - External memory and on-chip memory - Memory-mapped external devices and on-chip peripheral module (excluding the DMAC itself) - External memory and on-chip memory - Memory-mapped external device and on-chip peripheral module (excluding the DMAC) - Two on-chip memories - On-chip memory and on-chip peripheral modules (excluding DMAC) - Two on-chip peripheral modules (excluding DMAC) HITACHI 163 • Transfer requests External request (From DREQ pins (channels 0 and 1 only). DREQ can be detected either by edge or by level) Requests from on-chip peripheral modules (serial communications interface (SCI), AID converter (AID) and 16-bit integrated-timer pulse unit (lTV» Auto-request (the transfer request is generated automatically within the DMAC) • Selectable bus modes: Cycle-steal mode or burst mode • Selectable channel priority levels: Fixed, round-robin, or external-pin round-robin modes • CPU can be asked for interrupt when data transfer ends • Maximum transfer rate 20 M wordsls (320 MB/s) For 5V and 20 MHz Bus mode: Burst mode Transmit size: Word 9.1.2 Block Diagram Figure 9.1 is a block diagram of the DMAC. 164 HITACHI DREQO,DREQ1 ----~~~r-~-. ITU -----+--I----+--t-....;-, SCI-----t--+---~~ NO converter ------1I--+--+--h DACKO, DACK1 ---+--+--l-~:::;::::::;-M DEln - - - - t - t - - - - t - t - - " ' - - - t - + - - l I/) :::I .0 Extemal device (memory mapped) Bus interface Extemal device (with acknowledge) DMAC DMAOR: DMA operation register SARn: DMA source address register DARn: DMA destination address register TCRn: DMA transfer count register CHCRn: DMA channel control register DEln: DMA transfer-end interrupt request to CPU. n:0-3 Figure 9.1 DMAC Block Diagram HITACHI 165 9.1.3 Pin Configuration Table 9.1 shows the DMAC pins. Table 9.1 Pin Configuration Channel Name Symbol va Function 0 DMA transfer request DREQO DMA transfer request input from external device to channel 0 DMA transfer request DACKO 0 DMA transfer request acknowledge acknowledge output from channel 0 to external device DMA transfer request DREQ1 DMA transfer request input from external device to channel 1 DMA transfer request DACK1 0 DMA transfer request acknowledge acknowledge output from channel 1 to external device 166 HITACHI 9.1.4 Register Configuration Table 9.2 summarizes the DMAC registers. DMAC has a total of 17 registers. Each channel has four control registers. One other control register is shared by all channels. Table 9.2 DMAC Registers Abbrevl- Initial Access Channel Name atlon RIW Value Address Size 0 oMA source address register 0 SARO*3 R/W Undefined H'SFFFF40 16,32 oMA destination address oARO*3 R/W Undefined H'SFFFF44 16,32 register 0 oMA transfer count register 0 TCRO*3 R/W Undefined H'SFFFF4A 16,32 oMA channel control register 0 CHCRO R/(W)*1 H'OOOO H'SFFFF4E 8,16,32 oMA source address register 1 SAR1*3 R/W Undefined H'SFFFFSO 16,32 oMA destination address oAR1*3 R/W Undefined H'SFFFFS4 16,32 register 1 oMA transfer count register 1 TCR1*3 R/W Undefined H'5FFFFSA 16,32 oMA channel control register 1 CHCR1 R/(W)*1 H'OOOO H'SFFFFSE 8,16,32 2 oMA source address register 2 SAR2*3 R/W Undefined H'SFFFF60 16,32 oMA destination address oAR2*3 R/W Undefined H'SFFFF64 16,32 register 2 oMA transfer count register 2 TCR2*3 R/W Undefined H'SFFFF6A 16,32 oMA channel control register 2 CHCR2 R/(W)*1 H'OOOO H'SFFFF6E 8,16,32 3 oMA source address register 3 SAR3*3 R/W Undefined H'SFFFF70 16,32 oMA destination address oAR3*3 R/W Undefined H'SFFFF74 16,32 register 3 oMA transfer count register 3 TCR3*3 R/W Undefined H'SFFFF7A 16,32 oMA channel control register 3 CHCR3 R/(W)*1 H'OOOO H'SFFFF7E 8, 16, 32 Shared oMA operation register oMAOR R/(W)*2 H'OOOO H'SFFFF48 8,16,32 Notes: 1. Write 0 alone in bit 1 of CHCR0-CHCR3 to clear flags. 2. Write 0 alone in bits 1 and 2 of the oMAOR to clear flags. 3. Access SARO-SAR3, oARD-oAR3, and TCRD-TCR3 by long word or word. If byte access is used when writing, the value of the register contents becomes undefined; if used when reading, the value read is undefined. HITACHI 167 9.2 Register Descriptions 9.2.1 DMA Source Address Registers 0-3 (SARO-SAR3) DMA source address registers 0-3 (SARO-SAR3) are 32-bit read/write registers that specify the source address of a DMA transfer. During a DMA transfer, these registers indicate the next source address (in single-address mode, SAR is ignored in transfers from external devices with DACK to memory-mapped external devices or external memory). The initial value after resets or in standby mode is undefined. Bit: 31 30 29 28 27 26 25 24 Bit name: 1 Initial value: R/W: R/W AIW R/W R/W RIW RIW AIW RIW Bit: 23 22 21 20 0 Bit name: 1 Initial value: R/W: RIW AIW R/W R/W RIW 9.2.2 DMA Destination Address Registers 0-3 (DARO-DAR3) DMA destination address registers 0-3 (DARO-DAR3) are 32-bit read/write registers that specify the destination address of a DMA transfer. During a DMA transfer, these registers indicate the next destination address (in single-address mode, DAR is ignored in transfers from memory- mapped external devices or external memory to external devices with DACK). The initial value after resets or in standby mode is undefined. Bit: 31 30 29 28 27 26 25 24 Bit name: ·r-I------.---.------.----.---.,.,,---.--------r----, Initial value: RIW: R/W AIW RIW R/W RIW RIW AIW RIW Bit: 23 22 21 20 o Bit name: r-I"-'.--.------, ,-1----,------, Initial value: RIW: R/W AIW RIW RIW RIW 168 HITACHI 9.2.3 DMA Transfer Count Registers 0-3 (TCRO-TCR3) DMA transfer count registers 0-3 (TCRO-TCR3) are 16-bit read/write registers that specify the DMA transfer count (bytes or words). The number of transfers is I when the setting is H'OOO I, 65535 when the setting is H'FFFF and 65536 (the maximum) when H'OOOO is set. During a DMA transfer, these registers indicate the remaining transfer count. The initial value after resets or in standby mode is undefined. Bit: 15 14 13 12 11 10 9 8 Bit name: ' I-----.------r-----,-----~------r_----~----_.----_. Initial value: RIW: RIW RIW RIW RIW RIW RIW RIW RIW Bit: 7 6 5 4 3 2 o Bit name: ' I- - - - - , - - - - - - r - - - - - , - - - - - - , - - - - - - , - - - - - , - - - - - - , - - - - - , Initial value: RIW: RIW RIW RIW RIW RIW RIW RIW RIW 9.2.4 DMA Channel Control Registers 0-3 (CHCRO-CHCR3) DMA channel control registers 0-3 (CHCRO-CHCR3) are 16-bit read/write registers that control the DMA transfer mode. They also indicate DMA transfer status. They are initialized to H'OOOO by a reset or standby mode. Bit: 15 14 13 12 11 10 9 8 Bit name: I DM1 DMO SM1 SMO RS3 RS2 RS1 RSO Initial value: 0 0 0 0 0 0 0 0 RIW: RIW RIW RIW RIW RIW RIW RIW R/W Bit: 7 6 5 4 3 2 1 0 Bit name: I AM AL DS TM TS IE TE DE Initial value: 0 0 0 0 0 0 0 0 RIW: RJ(W)'2 RJ(W) '2 RJ(W) '2 RIW RIW RIW R/(W)* RIW Notes: 1. Write only 0 to clear the flag. 2. Writing is effective only for CHCRO and CHCR1. HITACHI 169 • Bits 15 and 14 (destination address mode bits l, 0 (DMI and DMO»: DMl and DMO select whether the DMA destination address is incremented, decremented, or left fixed (in the single address mode, DM I and DMO are ignored when transfers are made from memory-mapped external devices or external memory to external devices with DACK). DMI and DMO are initialized to 00 by resets or in standby mode. Bit 15: DM1 Bit 14: DMO Description o o Fixed destination address (initial value) o Destination address is incremented (+1 or +2 depending on if the transfer size is word or byte) o Destination address is decremented (-1 or -2 depending on if the transfer size is word or byte) Reserved (illegal setting) • Bits I3 and 12 (source address mode bits 1,0 (SMI and SMO»: SMI and SMO select whether the DMA source address is incremented, decremented, or left fixed (in the single address mode, SMI and SMO are ignored when transfers are made from external devices with DACK to memory-mapped external devices or external memory). SMI and SMO are initialized to 00 by resets or in standby mode. Bit 13: SM1 Bit 12: SMO Description o o Fixed source address (initial value) o Source address is incremented (+1 or +2 depending on if the transfer size is word or byte) o Source address is decremented (-1 or -2 depending on if the transfer size is word or byte) Reserved (illegal setting) • Bits 11-8 (resource select bits 3-0 (RS3-RSO»: RS3-RSO specify which transfer requests will be sent to the DMAC. Do not change the transfer request source unless the DMA enable bit (DE) is O. The RS3-RSO bits are initialized to 0000 by resets or in standby mode. 170 HITACHI Bit 11: Bit 10: BIt9: Bit 8: RS3 RS2 RS1 RSO Description o o o o DREQ (External request*1. dual address mode) (initial value) o o o Reserved (illegal setting) o o o DREQ (External request*1. single address mode*2) o o DREQ (External request*1. single address mode*3) o o o RXIO (On-chip serial communication interface 0 receive data full interrupt transfer request)*4 o 1 o TXIO (On-chip serial communication interface 0 transmit data empty interrupt transfer request)*4 o 1 o RXI1 (On-chip serial communication interface 1 receive data full interrupt transfer request)*4 o TXI1 (On-chip serial communication interface 1 transmit data empty interrupt transfer request)*4 o o o IMIAO (On-chip ITUO input capture/compare-match A interrupt transfer request)*4 o o IMIA1 (On-chip ITU1 input capture/compare-match A interrupt transfer request)*4 o o IMIA2 (On-chip ITU2 input capture/compare-match A interrupt transfer request)*4 o IMIA3 (On-chip ITU3 input capture/compare-match A interrupt transfer request)*4 o o Auto-request (Transfer requests automatically generated within DMAC)*4 o ADI (AID conversion end interrupt request of on-chip AID converter)*4 o Reserved (illegal setting) Reserved (illegal setting) SCIO. SCI1: Serial communications interface channels 0 and 1. ITUo-ITU3: Channels Q-3 of the 16-bit integrated-timer pulse unit. Notes: 1. These bits are valid only in channels 0 and 1. None of these request sources can be selected in channels 2 and 3. 2. Transfer from memory-mapped extemal device or external memory to external device with DACK. 3. Transfer from external device with DACK to memory-mapped external device or external memory. 4. Dual address mode. HITACHI 171 • Bit 7 (acknowledge mode bit (AM»: In the dual address mode, AM selects whether the OACK signal is output during the data read cycle or write cycle. This bit is valid only in channels 0 and 1. The AM bit is initialized to 0 by resets or in standby mode. The AM bit is not valid in single address mode. Bit 7: AM Description o DACK is output in read cycle (initial value) DACK is output in write cycle • Bit 6 (acknowledge Level Bit (AL»: AL selects active high signal or active low signal for the OACK signal. This bit is valid only in channels 0 and 1. The AL bit is initialized to 0 by resets or in standby mode. Bit 6: AL Description o DACK is active high (initial value) DACK is active low • Bit 5 (OREQ select bit (OS»: OS selects the OREQ input detection method used. This bit is valid only in channels 0 and 1. The OS bit is initialized to 0 by resets or in standby mode. Bit 5: OS Description o DREQ detected by low level (initial value) DREQ detected by falling edge • Bit 4 (transfer bus mode bit (TM»: TM selects the bus mode for DMA transfers. The TM bit is initialized to 0 by resets or in standby mode. When the source of the transfer request is an on- chip peripheral module, see table 9.4, Selecting On-Chip Peripheral Module Request Modes with the RS Bit. Blt4:TM Description o Cycle-steal mode (initial value) Burst mode 172 HITACHI • Bit 3 (transfer size bit (TS»: TS selects the transfer unit size. If the on-chip peripheral module that is the source or destination of the transfer can only be accessed in bytes, byte must be selected in this bit. The TS bit is initialized to 0 by resets or in standby mode. Bit 3: TS Description o Byte (8 bits) (initial value) Word (16 bits) • Bit 2 (interrupt enable bit (IE»: IE determines whether or not to request a CPU interrupt at the end of a DMA transfer. When the IE bit is set to 1, an interrupt (DEI) is requested from the CPU when the lE bit is set. The IE bit is initialized to 0 by resets or in standby mode. Bit 2: IE Description o Interrupt request disabled (initial value) Interrupt requeste enabled • Bit 1 (transfer end flag bit (lE»: lE indicates that the transfer has ended. When a DMA transfer ends normally and the value in the DMA transfer count register (TCR) becomes 0, the lE bit is set to 1. This flag is not set if the transfer ends because of an NMI interrupt or address error, or because the DE bit or the DME bit of the DMA operation register (DMAOR) was cleared. To clear the lE bit, read 1 from it and then write O. When this flag is set, setting the DE bit to 1 does not enable a DMA transfer. The lE bit is initialized to 0 by resets or in standby mode. Bit 1: TE Description o DMA has not ended or was aborted (initial value) Cleared by reading 1 from the TE bit and then writing O. DMA has ended normally HITACHI 173 • Bit 0 (DMA enable bit (DE»: DE enables or disables DMA transfers. In the auto-request mode, the transfer starts when this bit or the DME bit of the DMAOR is set to 1. The TE bit and the NMIF and AE bits of the DMAOR must be all cleared to O. In external request mode or on-chip peripheral module request mode, the transfer begins when the DMA transfer request is received from said device or on-chip peripheral module, provided this bit and the DME bit are set to I. As with the auto request mode, the TE bit and the NMIF and AE bits of the DMAOR must be all cleared to O. The transfer can be stopped by clearing this bit to O. The DE bit is initialized to 0 by resets or in standby mode. Bit 0: DE Description o DMA transfer disabled (initial value) DMA transfer enabled 9.2.5 DMA Operation Register (DMAOR) The DMA operation register (DMAOR) is a 16-bit read/write register that controls the DMA transfer mode. It also indicates the DMA transfer status. It is initialized to H'OOOO by a reset or the standby mode. Bit: 15 14 13 12 11 10 9 8 Bit name: I PR1 PRO Initial value: 0 0 0 0 0 0 0 0 RJW: R R R R R R RIW RJW Bit: 7 6 5 4 3 2 0 Bit name: I AE NMIF DME Initial value: 0 0 0 0 0 0 0 0 RJW: R R R R R R/(W)* R/(W)* R Note: Write only 0 to clear the flag. 174 HITACHI • Bits 15-10 (reserved): These bits always read O. The write value should always be O. • Bits 9 and 8 (priority mode bits 1 and 0 (PRI and PRO»: PRl and PRO select the priority level between channels when there are transfer requests for multiple channels simultaneously. Bit 9: PR1 Bit 8: PRO Description o o Fixed priority order (Ch. 0 > Ch. 3 > Ch. 2 > Ch. 1) (initial value) o Fixed priority order (Ch. 1 > Ch. 3 > Ch. 2 > Ch. 0) o Round-robin mode priority order (the priority order immediately after a reset is Ch. 0 > Ch. 3> Ch. 2 > Ch. 1) External-pin round-robin mode priority order (the priority order immediately after a reset is Ch. 3 > Ch. 2 > Ch. 1 > Ch. 0) • Bits 7-3 (reserved): These bits always read O. The write value should always be O. • Bit 2 (address error flag bit (AE»: AE indicates that an address error occurred in the DMAC. When this flag is set to 1, the channel cannot be enabled even if the DE bit in the DMA channel control register (CHCR) and the DME bit are set to 1. To clear the AE bit, read 1 from it and then write O. It is initialized to 0 by a reset or the standby mode. Bit 2: AE Description o No DMAC address error (initial value) To clear the AE bit. read 1 from it and then write O. Address error by DMAC • Bit 1 (NMI Flag Bit (NMIF»: NMIF indicates that an NMI interrupt occurred. When this flag is set to 1, the channel cannot be enabled even if the DE bit in the CHCR and the DME bit are set to 1. To clear the NMIF bit, read 1 from it and then write O. It is initialized to 0 by a reset or the standby mode. Bit 1: NMIF Description o No NMI interrupt (initial value) To clear the NMIF bit. read 1 from it and then write O. NMI has occurred HITACHI 175 • Bit 0 (DMA master enable bit (DME»: DME enables or disables DMA transfers on all channels. A channel becomes enabled for a DMA transfer when the DE bit in each DMA's CHCR and the DME bit are set to I. For this to be effective, however, the TE bit of each CHCR and the NMIF and AE bits must all be O. When the DME bit is cleared, all channel DMA transfers are aborted. Bit 0: DME Description o Disable DMA transfers on all channels (initial value) Enable DMA transfers on all channels 9.3 Operation When there is a DMA transferrequest, the DMAC starts the transfer according to the predetermined channel priority order; when the transfer end conditions are satisfied, it ends the transfer. Transfers can be requested in three modes: auto-request, external request, and on-chip module request. Transfer can be in either the single address mode or the dual address mode. The bus mode can be either burst or cycle steal 9.3.1 DMA Transfer Flow After the DMA source address registers (SAR), DMA destination address registers (DAR), DMA transfer count registers (TCR), DMA channel control registers (CHCR), and DMA operation register (DMAOR) are set, the DMAC transfers data according to the following procedure: 1. Checks to see if transfer is enabled (DE = I, DME = 1, TE =0, NMIF =0, AE =0) .j 2. When a transfer request comes and transfer is enabled, the DMAC transfers 1 transfer unit of data (for an auto-request, the transfer begins automatically when the DE bit and DME bit are set to 1. The TCR value will be decremented by I). The actual transfer flows vary by address mode and bus mode. 3. When the specified number of transfer have been completed (when TCR reaches 0), the transfer ends normally. If the IE bit of the CHCR is set to 1 at this time, a DEI interrupt is sent to the CPU. 4. When an address error occurs in the DMAC or an NMI interrupt is generated, the transfer is aborted. Transfers are also aborted when the DE bit of the CHCR or the DME bit of the DMAOR are changed to O. Figure 9.2 is a flowchart of this procedure. 176 HITACHI Initial settings (SAR, DAR, TCR, CHCR, DMAOR) No Transfer (1 transfer unit); TCR-1 ~ TCR, SAR and DAR updated No DEI interrupt request (when IE= 1) Notes: 1. In auto-request mode, transfer begins when NMIF, AE and TE are all 0 and the DE and DME bits are set to 1. 2. DREQ = level detection in the burst mode (external request), or cycle steal mode. 3. DREQ = edge detection in the burst mode (external request), or auto request mode in burst mode. Figure 9.2 DMA Transfer Flowchart HITACHI 177 9.3.2 DMA Transfer Requests DMA transfer requests are basically generated in either the data transfer source or destination, but they can also be generated by devices and on-chip peripheral modules that are neither the source nor the destination. Transfers can be requested in three modes: auto-request, external request, and on-chip module request. The request mode is selected in the RS3-RSO bits of the DMA channel control registers 0-3 (CHCRO-CHCR3). Auto-Request Mode: When there is no transfer request signal from an external source, as in a memory-to-memory transfer or a transfer between memory and an on-chip peripheral module unable to request a transfer, the auto-request mode allows the DMAC to automatically generate a transfer request signal internally. When the DE bits of CHCRO-CHCR3 and the DME bit of the DMAOR are set to 1, the transfer begins (so long as the TE bits of CHCRO-CHCR3 and the NMIF and AE bits of DMAOR are all 0). External Request Mode: In this mode a transfer is performed at the request signal (DREQ) of an external device. Choose one of the modes shown in table 9.3 according to the application system. When this mode is selected, if the DMA transfer is enabled (DE = 1, DME = 1, TE = 0, NMIF = 0, AE = 0), a transfer is performed upon a request at the DREQ input. Choose to detect DREQ by either the falling edge or low level of the signal input with the DS bit of CHCRO-CHCR3 (DS = is level detection, DS = I is edge detection). The source of the transfer request does not have to be ° the data transfer source or destination. Table 9.3 Selecting External Request Modes with the RS Bits RS3 RS2 RS1 RSO Address Mode Source Destination 0 0 0 0 Dual address Any* Any* mode 0 0 0 Single address External memory or External device with mode memory-mapped DACK external device 0 0 Single address External device with External memory or mode DACK memory-mapped external device Note: External memory, memory-mapped external device, on-chip memory, on-Chip peripheral module (excluding DMAC) On-Chip Module Request: In this mode a transfer is performed at the transfer request signal (interrupt request signal) of an on-chip module. The transfer request signals include the receive data full interrupt (RXI) of the serial communication interface (SCI), the transmit data empty interrupt (TXI) of the SCI, the input capture Ncompare match A interrupt request (IMIA) of the 16-bit integrated-pulse timer (lTV), and the ND conversion end interrupt (ADI) of the NO converter (table 9.4). When this mode is selected, if the DMA transfer is enabled (DE = 1, DME = 1, TE = 0, NMIF = 0, AE = 0), a transfer is performed upon the input of a transfer request signal. 178 HITACHI The source of the transfer request does not have to be the data transfer source or destination. When RXI is set as the transfer request, however, the transfer source must be the SCI's receive data register (RDR). Likewise, when TXI is set as the transfer request, the transfer source must be the SCI's transmit data register (TOR). And if the transfer requester is the AID converter, the data transfer source must be the AID converter register. Table 9.4 Selecting On-Chip Peripheral Module Request Modes with the RS Bit DMA Transfer Request DMA Transfer Request Destln- Bus Mode RS3 RS2 RS1 RSO Source Signal Source atlon 0 0 0 SCIO RXIO (SCIO receive data full RORO Any· Cycle steal receiver interrupt transfer request) 0 0 SCIO TXIO (SCIO transmit data Any TORO Cycle steal transmitter empty interrupt transfer request) 0 0 SCI1 RXI1 (SCI1 receive data full ROR1 Any· Cycle steal receiver interrupt transfer request) 0 SCI1 TXI1 (SCI1 transmit data Any· TOR1 Cycle steal transmitter empty interrupt transfer request) 0 0 a ITua IMIAa (ITUa input capture AI Any· Any· Burst/Cycle compare-match A) steal a a ITU1 IMIA1 (ITU1 input capture AI Any· Any· Burst/Cycle compare-match A) steal a a ITU2 IMIA2 (ITU2 input capture AI Any· Any· Burst/Cycle compare-match A) steal a ITUS IMIAS (ITUS input capture AI Any· Any· Burst/Cycle compare-match A) steal a AID ADI (AID conversion end ADDR Any Burst/Cycle converter interrupt) steal SCIO, SCI1: Serial communications interface channels a and 1 ITUCHTUS: Channels o-S of the 16-bit integrated-timer pulse unit. RDRO, RDR1: Receive data registers a, 1 of SCI TORa, TOR1: Transmit data registers a, 1 of SCI ADDR: AID data register of AID converter Note: External memory, memory-mapped external device, on-chip memory, on-chip peripheral module (excluding DMAC) When outputting transfer requests from on-chip peripheral modules, the appropriate interrupt enable bits must be set to output the interrupt signals. Note that transfer request signals from on- chip peripheral modules (interrupt request signals) are sent not just to the DMAC but to the CPU HITACHI 179 as well. When an on-chip peripheral module is specified as the transfer request source, set the priority level values in the interrupt priority level registers (IPRC-IPRE) of the interrupt controller (INTC) at or below the levels set in the I3-IO bits of the CPU's status register (SR) so that the CPU does not acknowledge the interrupt request signal. The DMA transfer request signals of table 9.4 are automatically withdrawn when the corresponding DMA transfer is performed. If the cycle steal mode is being employed, the DMA transfer request (interrupt request) will be cleared at the first transfer; if the burst mode is being used, it will be cleared at the last transfer. 9.3.3 Channel Priority When the DMAC receives simultaneous transfer requests on two or more channels, it selects a channel according to a predetermined priority order. The three modes (fixed mode, round-robin mode, and external-pin round-robin mode) are selected by the priority bits PRI and PRO in the DMA operation register. Fixed Mode: In these modes, the priority levels among the channels remain fixed. When PR 1 and PRO bits are set 00, the priority order, high to low, is Ch. 0 > Ch. 3 > Ch. 2 > Ch. 1. When PR 1 and PRO bits are set 01, the priority order, high to low, is Ch. I > Ch. 3 > Ch. 2> Ch. O. Round-Robin Mode: Each time one word or byte is transferred on one channel, the priority order is rotated. The channel on which the transfer was just finished rotates to the bottom of the priority order. When necessary, the priority order of channels other than the one that just finished the transfer can also be shifted to keep the relationship between the channels from changing (figure 9.3). The priority order immediately after a reset is channel 0 > channel 3> channel 2 > channell. 180 HITACHI (1) When channel 0 transfers r-----------------~ Initial priority order chO> ch3 > ch2 > ch1 ~.---------------~ Channel 0 becomes bottom priority Priority order after transfer (2) When channel 3 transfers Initial priority order chO> ch3 > ch2 > ch1 ~~--.-----------~ Channel 3 becomes bottom priority. The priority of channel 0, which was higher than Priority order channel 3, is also shifted. after transfer Channel 2 becomes bottom (3) When channel 2 transfers r-----------------~ priority. The priority of channels Initial priority order Oand 3, which were higher than channel 2, are also shifted. If immediately thereafter there is a request to transfer channel Priority order 3 only, channel 3 becomes after transfer bottom priority and the priority of channels 0 and 1, which were higher than channel 3, Post-transfer priority order when r-"'----"-----''-----'-..., are also shifted. there is an immediate transfer request to channel 3 only (4) When channel 1 transfers r-----------------~ Initial priority order ~-------------r--~ Priority order does not change Priority order after transfer Figure 9.3 Round-Robin Mode Figure 9.4 shows how the priority order changes when channel 0 and channell transfers are requested simultaneously and a channel 3 transfer is requested during the channel 0 transfer. The DMAC operates as follows: 1. Transfer requests are generated simultaneously to channels I and O. HITACHI 181 2. Channel 0 has a higher priority, so the channel 0 transfer begins first (channell waits for transfer). 3. A channel 3 transfer request occurs during the channel 0 transfer (channels 1 and 3 are both waiting) 4. When the channel 0 transfer ends, channel 0 becomes lowest priority. 5. At this point, channel 3 has a higher priority than channell, so the channel 3 transfer begins (channell waits for transfer). 6. When the channel 3 transfer ends, channel 3 becomes lowest priority. 7. The channel 1 transfer begins. 8. When the channell transfer ends, channels 1 and 2 shift downward in priority so that channel 1 becomes the lowest priority. 'TranSfer request "Waiting channel(s) II DMAC operation I IChannel priority I (1) Channels 0 and 1 --.. (2) Channel 0 transfer starts . . . .1 - - - - - - 0>3>2>1 (3) Channel 3 ---. Priority order (4) Channel 0 changes 1,3 transfer ends • 3>2>1>0 (5) Channel 3 transfer starts ~ l (6) Channel 3 Priority order changes • 2>1>0>3 transfer ends (7) Channel 1 transfer starts ~ None l (8) Channel 1 Priority order changes • 0>3>2>1 transfer ends Figure 9.4 Changes in Channel Priority in Round-Robin Mode External-Pin Round-Robin Mode: External-pin round-robin mode switches the priority levels of channel 0 and channell, which are the channels that can receive transfer requests from external 182 HITACHI pins DREQO and DREQ I. The priority levels are changed after each (byte or word) transfer on channel 0 or channel I is completed. The channel which just finished the transfer rotates to the bottom of the priority order. The priority levels of channels 2 and 3 do not change. The initial priority order after a reset is channel 3 > channel 2 > channell> channel O. Figure 9.5 shows how the priority order changes when channel 0 and channel I transfers are requested simultaneously and a channel 0 transfer is requested again after both channels finish their transfers. The DMAC operates as follows: 1. Transfer requests are generated simultaneously to channels I and O. 2. Channell has a higher priority, so the channell transfer begins first (channel 0 waits for transfer). 3. When the channell transfer ends, channel I becomes lowest priority. 4. The channel 0 transfer begins. 5. When the channel 0 transfer ends, channel 0 becomes lowest priority. 6. A channel 0 transfer request occurs again. 7. The channel 0 transfer begins. 8. When the channel 0 transfer ends, the priority order does not change, because channel 0 is already the lowest priority. HITACHI 183 ITransfer request II Waiting channel(s) II DMAC operation I I Channel priority I (1) Channels - - - - . (2) Channel 1 oand 1 transfer starts • 3>2>1>0 0 ~ (3) Channel 1 Priority order changes transfer ends • 3>2>0>1 (4) Channel 0 transfer starts ~ None ! Priority order changes (5) Channel 0 transfer ends • 3>2>1>0 ~tingfOr transfer request (6) Channel 0 ----.. (7) Channel 0 transfer starts None ~ Priority order does not change (8) Channel 0 transfer ends • 3>2>1>0 Figure 9.5 Example of Changes in Priority in External-Pin Round-Robin Mode 184 HITACHI 9.3.4 DMA Transfer Types The DMAC supports the transfers shown in table 9.5. It can operate in the single address mode or dual address mode, which are defined by how many bus cycles the DMAC takes to access the transfer source and transfer destination. The actual transfer operation timing varies with the bus mode. The DMAC has two bus modes: cycle-steal mode and burst mode. Table 9.S Supported DMA Transfers Destination Memory- External Mapped On-Chip Device with External External On-Chip Peripheral Source DACK Memory Device Memory Module External device with DACK Not available Single Single Not available Not available External memory Single Dual Dual Dual Dual Memory-mapped external Single Dual Dual Dual Dual device On-chip memory Not available Dual Dual Dual Dual On-chip peripheral module Not available Dual Dual Dual Dual Single: Single address mode Dual: Dual address mode Address Modes: • Single Address Mode In the single address mode, both the transfer source and destination are external; one (selectable) is accessed by a DACK signal while the other is accessed by an address. In this mode, the DMAC performs the DMA transfer in I bus cycle by simultaneously outputting a transfer request acknowledge DACK signal to one external device to access it while outputting an address to the other end of the transfer. Figure 9.6 shows an example of a transfer between an external memory and an external device with DACK in which the external device outputs data to the data bus while that data is written in external memory in the same bus cycle. HITACHI 185 B A -. . .-. External address bus External data bus SH microcomputer ~--------- ., External DMAC i"-_J memory h -_ 1---/ Read Write + t G)® --- ~--------- External device with DACK '--.. DACK ------ i DREQ ----~: Data flow Note: The read/write direction is decided by the RS3-RSO bits of the CHCRn resisters. If RS3-RSO = 0010, the direction is shown as case 1 (circled number above); if RS3-RSO = 0011, the direction is shown as case 2. Also, DACK output (when reading) described in the Electric Characteristics section indicates case 1, and DACK output (when writing) indicates case 2. Figure 9.6 Data Flow in Single Address Mode Two types of transfers are possible in the single address mode: 1) transfers between external devices with DACK and memory-mapped external devices, and 2) transfers between external devices with DACK and external memory. The only transfer requests for either of these is the external request (DREQ). Figure 9.7 shows the DMA transfer timing for the single address mode. The DACK output when a transfer occurs from an external device with DACK to a memory- mapped external device is the write waveform. The DACK output when a transfer occurs from a memory-mapped external device to an external device with DACK is the read waveform. The setting of the acknowledge mode (AM) bits in the channel control registers (CHCRO, CHCRI) have no effect. 186 HITACHI CK A21-AO =><_____><== - Address output to external memory space 015-00 DACK ~ _ =>---<__--'~ - Data that is output from the external . device with DACK DACK signal to external devices with DACK (active low) WAH ______ r--- WAL '----' - WA signal to external memory space (a) External device with DACK to external memory space CK A21-AO =><____><== - Address output to external memory space D15-DO ( >--- - Data that is output from external memory space AD ~ - AD signal to external memory space DACK ~ - DACK signal to external device with DACK (active low) (b) External memory space to external device with DACK Figure 9.7 Example ofDMA Transfer Timing in the Single Address Mode • Dual Address Mode In the dual address mode, both the transfer source and destination are accessed (selectable) by an address. The source and destination can be located externally or internally. The source is accessed in the read cycle and the destination in the write cycle, so the transfer is performed in two separate bus cycles. The transfer data is temporarily stored in the DMAC. Figure 9.8 shows an example of a transfer between two external memories in which data is read from one memory in the read cycle and written to the other memory in the following write cycle. HITACHI 187 Extemal data bus SH miCj:::' F- 2 Extemal memory Extemal memory .----. : Data flow 1: Read cycle 2: Write cycle Figure 9.8 Data Flow in Dual Address Mode In the dual address mode transfers, external memory, memory-mapped external devices, on-chip memory and on-chip peripheral modules can be mixed without restriction. Specifically, this enables the following transfer types: 1. External memory and external memory transfer 2. External memory and memory-mapped external devices transfer 3. Memory-mapped external devices and memory-mapped external devices transfer 4. External memory and on-chip memory transfer 5. External memory and on-chip peripheral modules (excluding the DMAC) transfer 6. Memory-mapped external devices and on-chip memory transfer 7. Memory-mapped external devices and on-chip peripheral modules (excluding the DMAC) transfer 8. On-chip memory and on-chip memory transfer 9. On-chip memory and on-chip peripheral modules (excluding the DMAC) transfer 10. On-chip peripheral modules (excluding the DMAC) and on-chip peripheral modules (excluding the DMAC) transfer Transfer requests can be auto requests, external requests, or on-chip peripheral module requests. When the transfer request source is either the SCI or AID converter, however, either the data destination or source must be the SCI or AID converter (figure 9.4). In dual address mode, DACK is output in read or write cycles without internal memory and external peripheral modules. The CHCRcontrols the cycle of DACK output. Figure 9.9 shows the DMA transfer timing in the dual address mode. 188 HITACHI CK A21-AO =X_~_-.JX X,-__ '" Source address '" Destination address CSn ~~______.--_--_-:~<~--_--_--_.____~! 015-00 RD ~____...J! WRH ____________ ~ WRL '----1 OACK ' ____...J! Figure 9.9 DMA Transfer Timing in the Dual Address Mode (External memory space to external memory space transfer with DACK output in the read cycle) Bus Modes: There are two bus modes: cycle steal and burst. Select the mode in the TM bits of CHCRO-CHCR3. • Cycle-Steal Mode In the cycle steal mode, the bus right is given to another bus master after a one-trans fer-unit (word or byte) DMA transfer. When another transfer request occurs, the bus rights are obtained from the other bus master and a transfer is performed for one transfer unit. When that transfer ends, the bus right is passed to the other bus master. This is repeated until the transfer end conditions are satisfied. The cycle steal mode can be used with all categories of transfer destination, transfer source and transfer request. Figure 9.10 shows an example of DMA transfer timing in the cycle steal mode. Transfer conditions shown in the figure are: - Dual address mode - DREQ level detection HITACHI 189 DREQ ~. / \~.----------------~ Bus cycle Read Write Read Write Figure 9.10 Transfer Example in the Cycle-Steal Mode (Dual address mode, DREQlevel detection) • Burst Mode Once the bus right is obtained, the transfer is performed continuously until the transfer end condition is satisfied. In the external request mode with low level detection of the DREQ pin, however, when the DREQ pin is driven high, the bus passes to the other bus master after the bus cycle of the DMAC that currently has an acknowledged request ends, even if the transfer end conditions have not been satisfied. The burst mode cannot be used when the serial communications interface (SCI) is the transfer request source. Figure 9.11 shows an example of DMA transfer timing in the burst mode. The transfer conditions shown in the figure are: - Single address mode - DREQ level detection DREQ ~ / \~.----------------~ Bus cycle Figure 9.11 Transfer Example in the Burst Mode (Single address mode, DREQ level detection) Relationship between Request Modes and Bus Modes by DMA Transfer Category: Table 9.6 shows the relationship between request modes and bus modes by DMA transfer category. 190 HITACHI Table 9.6 Relationship of Request Modes and Bus Modes by DMA Transfer Category Address Bus Transfer Usable Mode Transfer Category Request Mode Mode Size (bits) Channels Single External device with DACK and External BIC 8116 0,1 external memory External device with DACK and External BIC 8116 0, 1 memory-mapped external device Dual External memory and external memory Everything*1 BIC External memory and memory-mapped Everything*1 BIC 8116 0-3*5 external device Memory-mapped external device and Everything*1 BIC 8116 0-3*5 memory-mapped external device External memory and on-chip memory Everything*' BIC 8116 0-3*5 External memory and on-chip Everything*2 B/C*3 8116*4 0-3*5 peripheral module Memory-mapped external device and Everything*1 BIC 8116 0-3*5 on-chip memory Memory-mapped external device and Everything*2 B/C*3 8116*4 0-3*5 on-chip peripheral module On-chip memory and on-chip memory Everything*1 BIC 8116 0-3*5 On-chip memory and on-chip Everything*2 B/C*3 8116*4 0-3*5 peripheral module On-chip peripheral module and on- Everything*2 B/C*3 8116*4 0-3*5 chip peripheral module B: Burst, C: Cycle steal Notes: 1. External requests, auto requests and on-chip peripheral module requests are all available. For on-chip peripheral module requests, however, SCI and AID converter cannot be specified as the transfer request source. 2. External requests, auto requests and on-chip peripheral module requests are all available. When the SCI or AID converter is also the transfer request source, however, the transfer destination or transfer source must be the SCI or AID converter, respectively. 3. If the transfer request source is the SCI, cycle steal only. 4. The access size permitted when the transfer destination or source is an on-chip peripheral module register. ° 5. If the transfer request is an external request, channels and 1 only. Bus Mode and Channel Priority Order: When a given channel (1) is transferring in burst mode and there is a transfer request to a channel (2) with a higher priority, the transfer of the channel with higher priority (2) will begin immediately. When channel 2 is also operating in the burst mode, the channell transfer will continue when the channel 2 transfer has completely finished. HITACHI 191 When channel 2 is in the cycle steal mode, channel I will begin operating again after channel 2 completes the transfer of one transfer unit, but the bus will then switch between the two in the order channel I, channel 2, channel I, channel 2. Since channel 1 is in burst mode, it will not give the bus to the CPU. This example is illustrated in figure 9; 12. Bus status ch2 ch1 ch2 DMAC ch1 DMAC ch 1 and ch2 DMAC ch1 CPU Burst mode Cycle steal mode Burst mode CPU Priority order is chO > ch3 > ch2 > ch1 (ch1 is burst mode and ch2 is cycle steal mode). Figure 9.12 Bus Handling when Multiple Channels Are Operating 9.3.5 Number of Bus Cycle States and DREQ Pin Sample Timing Number of States in Bus Cycle: The number of states in the bus cycle when the DMAC is the bus master is controlled by the bus state controller just as it is when the CPU is the bus master. The bus cycle in the dual address mode is controlled by wait state control register 1 (WCRl) while the single address mode bus cycle is controlled by wait state control register 2 (WCR2). For details, see section 8.9, Wait State Control. DREQ Pin Sampling Timing: Normally, when DREQ input is detected immediately prior to the rise edge of the clock pulse (CK) in external request mode, a DMAC bus cycle will be generated and the DMA transfer performed two states later at the earliest. The sampling timing after DREQ input detection differs by bus mode, address mode and method of DREQ input detection. • DREQ pin sampling timing in the cycle steal mode In the cycle steal mode, the sampling timing is the same regardless of whether the DREQ is detected by edge or level. When edge is being detected, however, once sampled it will not be sampled again until the next edge detection. Once DREQ input is detected, the next sampling is not performed until the first state, among those DMAC bus cycles thereby produced, in which a DACK signal is output (including the detection state itself). The next sampling occurs immediately prior to the rise edge of the clock pulse (CK) of the third state after the bus cycle previous to the bus cycle in which the DACK signal is output. Figure 9-13 to 9-22 show the sampling timing of the pin DREQ in the cycle steal mode for each bus cycle. When no DREQ input is detected at the sampling after the aforementioned DREQ 192 HITACHI detection, the next sampling occurs in the next state in which a DACK signal is output. If no DREQ input is detected at this time, sampling occurs at every state thereafter. CK Bus cycle DACK LJ Figure 9.13 DREQ Sampling Timing in Cycle Steal Mode (Output with DREQ level detection and DACK active low) (Single address mode, bus cycle = 1 state) CK Bus cycle DACK w DMAC (R): DMAC read cycle DMAC (W): DMAC write cycle Note: Illustrates the case when DACK is output during the DMAC Read cycle. Figure 9.14 DREQ Sampling Timing in Cycle Steal Mode (Output with DREQ level detection and DACK active low) (Dual address mode, bus cycle 1 state) = HITACHI 193 CK Bus cycle DACK Figure 9.15 DREQ Sampling Timing in Cycle Steal Mode (Output with DREQ level detection and DACK active low) (Single address mode, bus cycle =2 states) CK Bus cycle. DACK w .. .. DMAC (R): DMAC read cycle DMAC (W): DMAC write cycle Note: Illustrates the case when DACK is output during the DMAC write cycle. Figure 9.16 DREQ Sampling Timing in Cycle Steal Mode (Output with DREQ level = detection and DACK active low) (Dual address mode, bus cycle 2 states) 194 HITACHI . T1 . Tw: T2. :. . T1 . Tw. T2. CK Bus cycle DACK Note: When DREQ is negated at the third state of the DMAC cycle, the next DMA transfer will be executed because the sampling is done at the second state of the DMAC cycle. Figure 9.17 DREQ Sampling Timing in Cycle Steal Mode (Output with DREQ level detection and DACK active low) (Single address mode, bus cycle =2 states + 1 wait state) . T1 . Tw . T2 . T1 . Tw . T2 . CK Bus cycle DACK DMAC (R): DMAC read cycle DMAC (W): DMAC write cycle Figure 9.18 DREQ Sampling Timing in Cycle Steal Mode (Output with DREQ level detection and DACK active low) (Dual address mode, bus cycle = 2 states + 1 wait state) HITACHI 195 . Tc.Tc. . Tp Tr Tc. Tc . CK Bus cycle .:DMAC: . . :DMAC: DACK :. . LJ :~~~I' :~ LJJ j .. .j Note: When DREQ is negated at the fourth state of the DMAC cycle, the next DMA transfer will be executed because the sampling is done at the second state of the DMAC cycle. Figure 9.19 DREQ Sampling Timing in Cycle Steal Mode (Output with DREQ level = detection and DACK active low) (Single address mode, bus cycle DRAM bus cycle (long pitch normal mode» .Tp. TrTcTc. TpTrTcTc . :.' . . . CK Bus cycle DACK LJ . . LJ . . DMAC (R): DMAC read cycle DMAC (W): DMAC write cycle Note: When DREQ is negated at the fourth state of the DMAC cycle, the next DMA transfer will be executed because the sampling is done at the second state of the DMAC cycle. Figure 9.20 DREQ Sampling Timing in Cycle Steal Mode (Output with DREQ level = detection and DACK active low) (Dual address mode, bus cycle DRAM bus cycle (long pitch normal mode)) 196 HITACHI . T1 .. T2 .. T3 ..T4 . CK Bus cycle :DMAC: DACK u . . Note: When DREQ is negated at the fourth state of the DMAC cycle, the next DMA transfer will be executed because the sampling is done at the second state of the DMAC cycle. Figure 9.21 DREQ Sampling Timing in Cycle Steal Mode (Output with DREQ level detection and DACK active low) (Single address mode,bus cycle =Address/data multiplex 110 bus cycle) .T1.T2.T3.T4. .T1.T2.T3.T4. ;...... ;.....:..... ~ ......; ;...... ~ .....:..... ;.....; CK Bus cycle DACK LJ . . LJ. . DMAC (R): DMAC read cycle DMAC (W): DMAC write cycle Note: When DREQ is negated at the fourth state of the DMAC cycle, the next DMA transfer will be executed because the sampling is done at the second state of the DMAC cycle. Figure 9...22 DREQ Sampling Timing in Cycle Steal Mode (Output with DREQ level detection and DACK active low) (Dual address mode, bus cycle = Address/data multiplex 110 bus cycle) HITACHI 197 • DREQ pin sampling timing in the burst mode In the burst mode, the sampling timing differs depending on whether DREQ is detected by edge or level. When DREQ input is being detected by edge, once the falling edge of the DREQ signal is detected, the DMA transfer continues until the transfer end conditions are satisfied, regardless of the status of the DREQ pin. No sampling happens during this time. After the transfer ends, sampling occurs every state until the TE bit of the CHCR is cleared. When DREQ inputis being detected by level, once the DREQ input is detected, next sampling is performed at the end of every CPU or DMAC bus cycle in the single address mode. In the dual address mode. the next sampling.is performed at the start of every DMAC read cycle. In both the single address mode and dual address mode. if no DREQ input is detected at this time. sampling thereafter occurs at every state. Figures 9.23 and 9.24 show the DREQ pin sampling timing in burst mode when DREQ input is detected by low level. CK BUS~--__ Ir-~--__ Iir---~__~--~__~--~~,~--~~~~--~ cycle ~=-.=..JI~-=,-=---'li'---=-r=----JI~==r':=--..JI\"-=~=--'I\..-=-+"'''---( '----=::;..:-::~-r DACK Note: Single addres~ DREQ level detection, DACK aCtive low, 1 bus cycle = 2 states. Figure 9.23 DREQ Pin Sampling Timing in Burst Mode 198 HITACHI CK Bus cycle DACK Note: Dual address DREQ level detection, DACK active low, DACK output in read cycle, 1 bus cycle =2 states. Figure 9.24 DREQ Pin Sampling Timing in Burst Mode 9.3.6 DMA Transfer Ending Conditions The DMA transfer ending conditions vary for individual channels ending and all channels ending together. Individual Channel Ending Conditions: There are two ending conditions. A transfer ends when the value of the channel's DMA transfer count register (TCR) is 0, or when the DE bit of the channel's CHCR is cleared to O. • When TCR is 0: When the TCR value becomes 0 and the corresponding channel's DMA transfer ends, the transfer end flag bit (TE) is set in the CHCR. If the IE (interrupt enable) bit has been set, a DMAC interrupt (DEI) is requested to the CPU. • When DE of CHCR is 0: Software can halt a DMA transfer by clearing the DE bit in the channel's CHCR. The TE bit is not set when this happens. Conditions for Ending AU Channels Simultaneously: Transfers on all channels end when 1) the NMIF (NMI flag) bit or AE (address error flag) bit is set to 1 in the DMAOR, or 2) when the DME bit in the DMAOR is cleared to O. HITACHI 199 • Transfers ending when the NMIF or AE bit is set to I in DMAOR: When an NMI interrupt or DMAC address error occurs, the NMIF or AE bit is set to 1 in the DMAOR and all channels stop their transfers. The SAR, DAR, TCR are all updated by the transfer immediately preceding the halt. The TE bit is not set. To resume the transfers after NMI interrupt exception processing or address error exception processing, clear the appropriate flag bit to O. When a channel's DE bit is then set to 1, the transfer on that channel will restart. To avoid restarting a transfer on a particular channel, keep its DE bit cleared to O. In the dual address mode, the DMA transfer will be halted after the completion of the write cycle that follows the initial read cycle in which the address error occurs. SAR, DAR and TCR are updated by the final transfer. • Transfers ending when DME is cleared to 0 in DMAOR: Clearing the DME bit to 0 in the DMAOR forcibly aborts the transfers on all channels at the end of the current cycle. The TE bit is not set. 9.4 Examples of Use 9.4.1 DMA Transfer between On-Chip RAM and a Memory-Mapped External Device In the following example, data is transferred from an on-chip RAM to a memory-mapped external device with an input capture A/compare match A interrupt (IMIAO) from channel 0 of the 16-bit integrated-timer pulse unit (lTV) as the transfer request signal. The transfer is performed by DMAC channel 3. Table 9.7 shows the transfer conditions and register values. Table 9.7 Transfer Conditions and Register Settings for Transfer Between On-Chip RAM and Memory-Mapped External Device Transfer Conditions Register Setting Transfer source: on-chip RAM SAR3 H'FFFFEOO Transfer destination: memory-mapped external device DAR3 Destination address Number of transfers: 8 TCR3 H'OO08 Transfer destination address: fixed CHCR3 H'1805 Transfer source address: incremented Transfer request source (transfer request signal): ITU channel 0 (IMIAO) Bus mode: cycle steal Transfer unit: byte DEI interrupt request generated at end of transfer (channel 3 enabled for transfer) Channel priority order: fixed (0 > 3 > 2 > 1) (all channels DMAOR H'0001 transfer enabled) 200 HITACHI 9.4.2 Example of DMA Transfer between On-Chip SCI and External Memory In this example, receive data of on-chip serial communications interface (SCI) channel 0 is transferred to external memory using DMAC channel 3. Table 9.8 shows the transfer conditions and register settings. Table 9.8 Transfer Conditions and Register Settings for Transfer between On-Chip SCI and External Memory Transfer Conditions Register Setting Transfer source: RDRO of on-chip SCIO SAR3 H'FFFFEC5 Transfer destination: external memory DAR3 Destination address Number of transfers: 64 TCR3 H'0040 Transfer destination address: incremented CHCR3 H'4405 Transfer source address: fixed Transfer request source (transfer request signal): SCIO (RXIO) Bus mode: cycle steal Transfer unit: byte DEI interrupt request generated at end of transfer (channel 3 enabled for transfer Channel priority order: fixed (0) 3 > 2> 1) (all channels DMAOR H'0001 transfer enabled) HITACHI 201 9.4.3 Example ofDMA Transfer Between On-Chip AID Converter and External Memory In this example, the results of an AID conversion by the on-chip AID converter are transferred to external memory using DMAC channel 3. Input from channel 0 (ANO) is AID converted using the scan mode. Table 9.9 shows the transfer conditions and register settings. Table 9.9 Transfer Conditions and Register Settings for Transfer Between On-Chip AID Converter and External Memory Transfer Conditions Register Setting Transfer source: ADDRA of on-chip AID converter SAR3 H'FFFFEEO (register address of ADDRAH) Transfer destination: external memory DAR3 Destination address Number of transfers: 16 TCR3 H'OO10 Transfer destination address: incremented CHCR3 H'4DOD Transfer source address: fixed Transfer request source (transfer request signal): AID converter (ADI) Bus mode: cycle steal Transfer unit: word DEI interrupt request generated at end of transfer (channel 3 enabled for transfer Channel priority order: fixed (0 > 3 > 2 > 1) (ali channels DMAOR H'0001 transfer enabled) 202 HITACHI 9.5 Cautions 1. All registers other than the DMA operations register (DMAOR) and DMA channel control registers 0-3 (CHCRO-CHCR3) should be accessed in word or long word units. 2. Before rewriting the RSO-RS3 bits of CHCRO-CHCR3, first clear the DE bit to 0 (when rewriting CHCR with a byte access, be sure to set the DE bit to 0 in advance). 3. Even when the NMI interrupt is input when the DMAC is not operating, the NMIF bit of the DMAOR will be set. 4. Interrupt during DMAC Transfer When an interrupt occurs during DMAC transfer, the following operation takes place. a. When an NMI interrupt is input, the DMAC stops operation and returns the bus right to the CPU. The CPU then executes the interrupt processing. b. When an interrupt other than an NMI occurs. • When the DMAC is in burst mode. The DMAC does not return the bus right to the CPU in burst mode. Therefore, even when an interrupt is requested in DMAC operation, the CPU cannot get the bus right, causing the interrupt processing not to be executed. When the DMAC completes transfer and the CPU gets the bus right, the CPU executes the interrupt processing if the interrupt requested during DMAC transfer is not cleared. * Note: Clear condetions for an interrupt request. When an interrupt is requested from an on-chip peripheral module, the interrupt factor flag is cleared. When an interrupt is requested by IRQ (edge detection), the CPU begins the IRQ interrupt processing of the request source. When an interrupt is requested by IRQ (level detection), the IRQ interrupt request signal returned to high level. • When the DMAC is in cycle-steal mode. The DMAC returns the bus right to the CPU every when the DMAC completes a transfer unit in cycle-steal mode. Therefore, the CPU executes the requested interrupt processing when getting the bus right. 5. The CPU and DMAC leaves the bus right released and the operation of the LSI is stopped when the following conditions are satisfied. • The warp bit (WARP) of the bus control register (BCR) of the bus controller (BSC)is set. • The DMAC is in cycle-steal transfer mode. • The CPU accesses (reads/writes) the on-chip 110 space. Countermeasure: Set the warp bit of BCR to 0 and set it to normal mode. HITACHI 203 6. Notes on use of the SLEEP command a. Operation contents When the bus cycle of DMAC is entered immediately after executing the SLEEP command, there are cases when the DMA transfer is carried out correctly. b. Countermeasure • Stop the operation (for exemple, clearing of the DMA enable bit (DE) of the DMA channel control register(CHCRn» before entering SLEEP. • When using DMAC during SLEEP, operate DMAC after releasing SLEEP through interruption. In cases when the CPU does not carry out any other processing but is waiting for DMAC to end its transfer during DMAC operation, do not use the SLEEP command, but use the transfer end flag bit (TE) of the channel DMA control register and the polling software loop. 204 HITACHI Section 10 16-Bit Integrated-Timer Pulse Unit 10.1 Overview The SH microcomputer has an on-chip 16-bit integrated-timer pulse unit (ITU) with five channels of 16-bit timers. 10.1.1 Features lTU features are listed below: • Can process a maximum of twelve different pulse outputs and ten different pulse inputs. • Has ten general registers (GR), two per channel, that can be set to function independently as output compare or input capture. • Selection of eight counter input clock sources for all channels - Internal clock: 11>, 11>/2, 11>/4, 11>/8, - External clock: TCLKA, TCLKB, TCLKC, TCLKD • All channels can be set for the following operating modes: Compare match waveform output: 0 output/I output/selectable toggle output (0 output/I output for channel 2). Input capture function: Selectable rising edge, falling edge, or both rising and falling edges. Counter clearing function: Counters can be cleared by a compare match or input capture. Synchronizing mode: Two or more timer counters (TCNT) can be written to simultaneously. Two or more timer counters can be simultaneously cleared by a compare match or input capture. Counter synchronization functions enable synchronized input/output. I - PWM mode: PWM output can be provided with any duty cycle. When combined with the counter synchronizing function, enables up to five-phase PWM output. • Channel 2 can be set to the phase counting mode: Two-phase encoder output can be counted automatically. • Channels 3 and 4 can be set in the following modes: - Reset-synchronized PWM mode: By combining channels 3 and 4, 3-phase PWM output is possible with positive and negative waveforms. - Complementary PWM mode: By combining channels 3 and 4, 3-phase PWM output is possible with non-overlapping positive and negative waveforms. • Buffer operation: Input capture registers can be double-buffered. Output compare registers can be updated automatically. • High-speed access via internal 16-bit bus: The TCNT, GR, and buffer register (BR) 16-bit registers can be accessed at high speed via a 16-bit bus. • Fifteen interrupt sources: Ten compare match/input capture interrupts (2 sources per channel) and five overflow interrupts are vectored independently for a total of 15 sources. HITACHI 205 • Can activate DMAC: The compare match/input capture interrupts of channels 0-3 can start the DMAC (one for each of four channels). • Output trigger can be generated for the programmable timing pattern controller (TPC): The compare match/input capture signals of channel 0-3 can be used as output triggers for the TPc. Table 10.1 summarizes the lTV functions. 206 HITACHI Table 10.1 lTV Functions Item Channel 0 Channel 1 Channel 2 Channel 3 Channel 4 Counter clocks Internal: ., +12, +14, +Ie External: Independently selectable from TClKA, TClKB, TClKC, and TClKD General registers GRAO,GRBO GRA1, GRB1 GRA2, GRB2 GRA3, GRB3 GRA4, GRB4 (output compare/ input capture dual registers) Buffer registers No No No BRA3, BRB3 BRA4, BRB4 Input/output pins TIOCAO, TIOCA1, TIOCA2, TIOCA3, TIOCA4, TIOCBO TIOCB1 TIOCB2 TIOCB3 TIOCB4 Output pins No No No No TOCXA4, TOCXB4 Counter clear func- GRAO/GRBO GRA1/GRB1 GRA2/GRB2 GRA3/GRB3 GRA4/GRB4 tion (compare mat- ch or input capture) Compare 0 Yes Yes Yes Yes Yes match Yes Yes Yes Yes Yes output Toggle Yes Yes No Yes Yes output Input capture Yes Yes Yes Yes Yes function Synchronization Yes Yes Yes Yes Yes PWMmode Yes Yes Yes Yes Yes Reset-synchronized No No No Yes Yes PWMmode Complementary No No No Yes Yes PWMmode Phase counting No No Yes No No mode Buffer operation No No No Yes Yes DMAC activation GRAOcom- GRA1 com- GRA2 com- GRA3com- No pare match or pare match or pare match or pare match or input capture input capture input capture input capture Interrupt sources • Compare • Compare • Compare • Compare • Compare (three) match/input match/input match/input match/input match/input capture AO capture A1 capture A2 capture A3 capture A4 • Compare • Compare • Compare • Compare • Compare match/input match/input match/input match/input match/input capture BO capture B1 capture B2 capture B3 capture B4 • Overflow • Overflow • Overflow • Overflow • Overflow HITACHI 207 10.1.2 Block Diagram lTV Block Diagram (Complete): Figure 10.1 is the block diagram of the lTV. --------------------------------------, I I TCLKA-TCLKD I Clock selection 4>, 4>/2, 4>/4, 4>/8 TOCXA4, TOCXB4 TIOCAo-TIOCA4 TIOCBo-TIOCB4 CD CD CD c c c c c c as as as .s::. .s::. .s::. u u u .... Q) .... Q) .... Q) Internal .§ .§ .~ I data I bus I I I I I I I I IL _____________________________________ JI TOCR: Timer output control register (8 bits) TSTR: Timer start regsiter (8 bits TSNC: Timer synchronization register (8 bits) TMDR: Timer mode register (8 bits) TFCR: Timer function control register (8 bits) Figure 10.1 lTV Block Diagram 208 HITACHI Block Diagram of Channels 0 and 1: lTV channels 0 and 1 have the same function. Figure 10.2 is a block diagram of channels 0 and 1. TCLKA- TIOCAn TCLKD TIOCBn Clock selection ~,~2, ~4,~8 IMIAn Comparator Control logic IMIBn OVln c: c: c: IX) a: ~ a: a: o w CJ) C.!:I i= i= I- Module data bus TCNTn: Timer counter n (16 bits) GRAn, GRBn: General registers An, Bn (input capture/output compare dual use) (16 bits x 2) TCRn: Timer control register n (8 bits) TIORn: Timer I/O control register n (8 bits) TIERn: Timer interrupt enable register n (8 bits) TSRn: Timer status register n (8 bits) (n =0 or 1) Figure 10.2 Channels 0 and 1 Block Diagram (One Channel Shown) HITACHI 209 Block Diagram of Channel 2: Figure 10.3 is a block diagram of channel 2. Channel 2 is 0 outputll output only. TCLKA- TIOCA2 TCLKD TIOCB2 Clock selection $. $/2. <1>/4. $/8 ~ ~1 ~ IMIA2 IMIB2 __ c_o_m_p_a_ra_to_r__ c_o_n_t_ro_I_IO_9_iC__ L I_ _ _ OVI2 C\I C\I II: II: W ~ f= Module data bus TCNT2: Timer counter 2 (16 bits) GRA2. GRB2: General registers A2. B2 (input capture/output compare dual use) (16 bits x 2) TCR2: Timer control register 2 (8 bits) TIOR2: Timer I/O control register 2 (8 bits) TIER2: Timer interrupt enable register 2 (8 bits) TSR2: Timer status register 2 (8 bits) Figure 10.3 Channel 2 Block Diagram 210 HITACHI Block Diagrams of Channels 3 and 4: Figure 10.4 is a block diagram of channel 3; figure 10.5 is a block diagram of channel 4. TCLKA- TCLKD Clock selection TIOCA3 ell. c1112. TIOCB3 c1114. c1118 IMIA3 Comparator Control logic IMIB3 OVI3 Module data bus TCNT3: Timer counter 3 (16 bits) GRA3. GRB3: General registers A3. B3 (input capture/output compare dual use) (16 bits x 2) BRA3. BRB3: Buffer registers A3. B3 (input capture/output compare dual use) (16 bits x 2) TCR3: Timer control register 3 (8 bits) TIOR3: Timer I/O control register 3 (8 bits) TIER3: Timer interrupt enable register 3 (8 bits) TSR3: Timer status register 3 (8 bits) Figure 10.4 Channels 3 Block Diagram HITACHI 211 TCLKA- TOCXA4 TCLKD TOCXB4 Clock selection <1>. <1>/2. TIOCA4 <1>/4. <1>/8 TIOCB4 ~ __c_o_m_p_a_r_at_o_r__ ~1 1~___c_o_n_tr_o_I_IO_9_iC__ ~ IMIA4 IMIB4 OVI4 Module data bus TCNT4: Timer counter 4 (16 bits) GRA4. GRB4: General registers A4. B4 (input capture/output compare dual use) (16 bits x 2) BRA4. BRB4: Buffer registers A4. B4 (input capture/output compare dual use) (16 bits x 2) TCR4: Timer control register 4 (8 bits) TIOR4: Timer I/O control register 4 (8 bits) TIER4: Timer interrupt enable register 4 (8 bits) TSR4: Timer status register 4 (8 bits) Figure 10.5 Channel 4 Block Diagram 212 HITACHI 10.1.3 Input/Output Pins Table 10.2 summarizes the ITU pins. External pin functions should be set with the pin function controller to match to the ITU setting. See section 15, Pin Function Controller, for details. ITU pins need to be set using the pin function controller (PFC) after the LSI is set to the ITU mode. Table 10.2 Pin Configuration Channel Name Pin Name 110 Function Shared Clock input A TClKA External clock A input pin (A-phase input pin in phase counting mode) Clock input B TClKB External clock B input pin (B-phase input pin in phase counting mode) Clock input C TClKC External clock C input pin Clock input 0 TClKD I External clock 0 input pin 0 Input capture/output TIOCAO I/O GRAO output compare/GRAO input capture/PWM compare AO output pin (in PWM mode) Input capture/output TIOCBO I/O GRBO output compare/GRBO input capture compare eo Input capture/output TIOCA1 I/O GRA 1 output com pare/G RA 1 input capture/PWM compareA1 output pin (in PWM mode) Input capture/output TIOCB1 I/O GRB1 output compare/GRB1 input capture compare B1 2 Input capture/output TIOCA2 I/O GRA2 output compare/GRA2 input capture/PWM compareA2 output pin (in PWM mode) Input capture/output TIOCB2 I/O GRB2 output compare/GRB2 input capture compare B2 3 Input capture/output TIOCA3 I/O GRA3 output compare/GRA3 input capture/PWM compareA3 output pin (in PWM mode, complementary PWM mode, or reset-synchronized PWM mode) Input capture/output TIOCB3 I/O GRB3 output compare/GRB3 input capture/PWM compare B3 output pin (in complementary PWM mode or reset-synchronized PWM mode) 4 Input capture/output TIOCA4 I/O GRA4 output compare/GRA4 input capture/PWM compareA4 output pin (in PWM mode, complementary PWM mode or reset-synchronized PWM mode) Input capture/output TIOCB4 I/O GRB4 output compare/GRB4 input capture/PWM compare B4 output pin (in complementary PWM mode or reset-synchronized PWM mode) Output compare XA4 TOCXA4 I/O PWM output pin (in complementary PWM mode or reset-synchronized PWM mode) Output compare XB4 TOCXB4 I/O PWM output pin (in complementary PWM mode or reset-synchronized PWM mode) HITACHI 213 10.1.4 Register Configuration Table 10.3 summarizes the ITU register configuration. Table 10.3 Register Configuration Abbrevi- Initial Access Channel Name atian RIW Value Address·1 Size Shared Timer start register TSTA RIW H'EO/H'60 H'5FFFFOO 8 Timer synchro register TSNC RIW H'EO/H'60 H'5FFFF01 B Timer mode register TMDR RIW H'BO/H'OO H'5FFFF02 B Timer function control register TFCA RIW H'CO/H'40 H'5FFFF03 8 Timer output control register TOCR RIW H'FF/H'7F H'5FFFF31 B 0 Timer control register 0 TCRO RIW H'BO/H'OO H'5FFFF04 8 Timer I/O control register 0 TIORO RIW H'8B/H'08 H'5FFFF05 8 Timer interrupt enable registerTIERO RIW H'FB/H'7B H'5FFFF06 B 0 Timer status register 0 TSAO R/(W)*2 H'FB/H'7B H'5FFFF07 8 Timer counter 0 TCNTO RIW H'OO H'5FFFFOB B, 16, 32 H'5FFFF09 B, 16,32 General register AO GRAO RIW H'FF H'5FFFFOA B,16,32 H'5FFFFOB B,16,32 General register BO GRBO RIW H'FF H'5FFFFOC B,16 H'5FFFFOD B,16 Timer control register 1 TCA1 AIW H'80/H'OO H'5FFFFOE 8 Timer I/O control register 1 TIOR1 RIW H'BB/H'OB H'5FFFFOF B Timer interrupt enable registerTIER1 RIW H'FB/H'7B H'5FFFF10 B 1 Timer status register 1 TSR1 R/(W)*2 H'FB/H'7B H'5FFFF11 B Timer counter 1 TCNT1 RIW H'OO H'5FFFF12 B,16 H'5FFFF13 B,16 General register A 1 GRA1 RIW H'FF H'5FFFF14 B,16,32 H'5FFFF15 B,16,32 General register B 1 GAB1 RIW H'FF H'5FFFF16 B,16,32 H'5FFFF17 B,16,32 214 HITACHI Table 10.3 Register Configuration (cont) Abbrevl· Initial Access Channel Name atlon RIW Value Address·1 Size 2 Timer control register 2 TCR2 RIW H'80/H'OO H'5FFFF18 8 Timer I/O control register 2 TIOR2 RIW H'88/H'08 H'5FFFF19 8 Timer interrupt enable registerTIER2 RIW H'F8/H'78 H'5FFFF1A 8 2 Timer status register 2 TSR2 R/(W)*2 H'F8/H'78 H'5FFFF1B 8 Timer counter 2 TCNT2 RIW H'OO H'5FFFF1C 8,16,32 H'5FFFF1D 8,16,32 General register A2 GRA2 RIW H'FF H'5FFFF1E 8,16,32 H'5FFFF1F 8,16,32 General register B2 GRB2 RIW H'FF H'5FFFF20 8, 16 H'5FFFF21 8, 16 3 Timer control register 3 TCR3 RIW H'80/H'OO H'5FFFF22 8 Timer I/O control register 3 TIOR3 RIW H'88/H'08 H'5FFFF23 8 Timer interrupt enable registerTIER3 RIW H'F8/H'78 H'5FFFF24 8 3 Timer status register 3 TSR3 R/(W)*2 H'F8/H'78 H'5FFFF25 8 Timer counter 3 TCNT3 RIW H'OO H'5FFFF26 8, 16 H'5FFFF27 8, 16 General register A3 GRA3 RIW H'FF H'5FFFF28 8,16,32 H'5FFFF29 8, 16, 32 General register B3 GRB3 RIW H'FF H'5FFFF2A 8,16,32 H'5FFFF2B 8,16,32 Buffer register A3 BRA3 RIW H'FF H'5FFFF2C 8,16,32 H'5FFFF2D 8,16,32 Buffer register B3 BRB3 RIW H'FF H'5FFFF2E 8,16,32 H'5FFFF2F 8,16,32 4 Timer control register 4 TCR4 RIW H'80/H'OO H'5FFFF32 8 Timer I/O control register 4 TIOR4 RIW H'88/H'08 H'5FFFF33 8 Timer interrupt enable registerTIER4 RIW H'F8/H'78 H'5FFFF34 8 4 Timer status register 4 TSR4 R/(W)*2 H'F8/H'78 H'5FFFF35 8 HITACHI 215 Table 10.3 Register Configuration (cont) Abbrevi- Initial Access Channel Name ation RIW Value Address·1 Size 4 (cont) Timer counter 4 TCNT4H RIW H'OO H'SFFFF36 8, 16 H'SFFFF37 8, 16 General register A4 GRA4H RIW H'FF H'SFFFF38 8, 16, 32 H'SFFFF39 8, 16, 32 General register B4 GRB4H RIW H'FF H'SFFFF3A 8, 16, 32 H'SFFFF3B 8, 16, 32 Buffer register A4 BRA4H RIW H'FF H'SFFFF3C 8, 16, 32 H'SFFFF3D 8, 16, 32 Buffer register B4 BRB4H RIW H'FF H'SFFFF3E 8, 16, 32 H'SFFFF3F 8, 16, 32 Notes: 1. Only the values of bits A27-A24 and A8-AO are valid; bits A23-A9 are ignored. For details on the register addresses, see section 8.3.5, Description of Areas. 2. Write 0 to clear flags. 10.2 lTV Register Descriptions 10.2.1 Timer Start Register (TSTR) The timer start register (TSTR) is an eight-bit read/write register that starts and stops the timer counters (TCNT) of channels 0--4. TSTR is initialized to H'EO or H'60 upon reset or standby mode. Bit: 7 6 5 4 3 2 1 0 Bit name: I STR4 STR3 STR2 STR1 STRO Initial value: 0 0 0 0 0 RIW: RIW RIW RIW RIW RIW Note: Undefined • Bits 7-5 (reserved): Cannot be modified. Bit 7 is read as undefined. Bits 6 and 5 are always read as 1. The write value to bit 7 should be 0 or 1, and the write value to bits 6 and 5 should always be 1. 216 HITACHI • Bit 4 (count start 4 (STR4»: STR4 starts and stops TCNT4. Bit 4: STR4 Description o TCNT4 is halted (initial value) TCNT4 is counting • Bit 3 (count start 3 (STR3»: STR3 starts and stops TCNT3. Bit 3: STR3 Description o TCNT3 is halted (initial value) TCNT3 is counting • Bit 2 (count start 2 (STR2»: STR2 starts and stops TCNT2. Bit 2: STR2 Description o TCNT2 is halted (initial value) TCNT2 is counting • Bit 1 (count start 1 (STRl): STRI starts and stops TCNT!. Bit 1: STR1 Description o TCNT1 is halted (initial value) TCNT1 is counting • Bit 0 (count start 0 (STRO»: STRO starts and stops TCNTO. Bit 0: STRO Description o TCNTO is halted (initial value) TCNTO is counting HITACHI 217 10.2.2 Timer Synchro Register (TSNC) The timer synchro register (TSNC) is an eight-bit read/write register that selects timer synchronizing modes for channels 0--4. Channels for which I is set to the corresponding bit will be synchronized. TSNC is initialized to H'EO or H'60 upon reset or standby mode. Bit: 7 6 5 4 3 2 1 0 Bit name: I I SYNC41 SYNC31 SYNC21 SYNC1 I SYNCO I Initial value: o 0 0 0 0 RIW: RIW RIW RIW RIW RIW Note: Undefined • Bits 7-5 (reserved): Bit 7 is read as undefined. Bits 6 and 5 are always read as 1. The write value to bit 7 should be 0 or 1, and the write value to bits 6 and 5 should always be 1. • Bit 4 (timer synchro 4 (SYNC4»: SYNC4 selects the synchronizing mode for channe14. Bit 4: SYNC4 Description o The timer counter for channel 4 (TCNT4) operates independently (PreseVclear of TCNT4 is independent of other channels) (initial value) Channel 4 operates synchronously. Synchronized preseVclear of TNCT4 enabled. • Bit 3 (timer Synchro 3 (SYNC3»: SYNC3 selects the synchronizing mode for channel 3. Bit 3: SYNC3 Description o The timer counter for channel 3 (TCNT3) operates independently (PreseVclear of TCNT3 is independent of other channels) (initial value) Channel 3 operates synchronously. Synchronized preseVclear of TNCT3 enabled. • Bit 2 (timer synchro 2 (SYNC2»: SYNC2 selects the synchronizing mode for channel 2. Bit 2: SYNC2 Description o The timer counter for channel 2 (TCNT2) operates independently (PreseVclear of TCNT2 is independent of other channels) (initial value) Channel 2 operates synchronously. Synchronized preseVclear of TNCT2 enabled. 218 HITACHI • Bit 1 (timer synchro } (SYNCl): SYNC} selects the synchronizing mode for channell. Bit 1: SYNC1 Description o The timer counter for channel 1 (TCNT1) operates independently (PreseVclear of TCNT1 is independent of other channels) (initial value) Channel 1 operates synchronously. Synchronized preseVclear of TNCT1 enabled. • Bit 0 (timer synchro 0 (SYNCO»: SYNCO selects the synchronizing mode for channel O. Bit 0: SYNCO Description o The timer counter for channel 0 (TCNTO) operates independently (PreseVclear of TCNTO is independent of other channels) (initial value) Channel 0 operates synchronously. Synchronized preseVclear of TNCTO enabled. 10.2.3 Timer Mode Register (TMDR) The timer mode register (TMOR) is an eight-bit read/write register that selects the PWM mode for channels 0-4, sets the phase counting mode for channel 2, and sets the conditions for the overflow flag (OVF). TMOR is initialized to H'80 or H'OO by a reset or the standby mode. Bit: 7 6 5 4 3 2 0 Bit name: I MDF FDIR I PWM4 I PWM3 I PWM2 I PWM1 I PWMO I Initial value: * 0 0 0 0 0 0 0 RIW: RIW RIW RIW RIW RIW RIW RIW Note: Undefined • Bit 7 (reserved): Bit 7 is read as undefined. The write value should be 0 or I. • Bit 6 (phase counting mode (MOF»: MOF selects the phase counting mode for channel 2. Bit 6: MDF Description o Channel 2 operates normally (initial value) Channel 2 operates in phase counting mode HITACHI 219 When the MDF is set to 1 to select the phase counting mode, the timer counter (TCNT2) becomes an up/down counter and the TCLKA and TCLKB pins become count clock input pins. TCNT2 counts on both the rising and falling edges of TCLKA and TCLKB, with the increment/decrement chosen as follows: Count Direction Decrement Increment TCLKA pin Rising High Falling Low Rising High Falling Low TCLKB pin L Rising High Falling High Falling Low Rising In the phase counting mode, selections for external clock edge made in the CKEG 1 and CKEGO bits of the timer control register 2 (TCR2) and the selection for counter clock made in the TPSC2 -TPSCO bits are ignored. The phase counting mode described above takes priority. Settings for counter clear conditions in the CCLR 1 and CCLRO bits of TCR2 and settings for timer 110 control register 2 (TIOR2), timer interrupt enable register (TIER2) and timer status register 2 (TSR2) compare match/input capture functions and interrupts, however, are valid even in the phase counting mode. • Bit 5 (flag direction (FDIR»: FDIR selects the setting condition for the overflow flag (OYF) in timer status register 2 (TSR2). This bit is valid no matter which mode channel 2 is operating in. Bit 5: FDIR Description o OVF of TSR2 is set to 1 when TCNT2 overflows or underflows (initial value) OVF of TSR2 is set to 1 when TCNT2 overflows • Bit 4 (PWM Mode 4 (PWM4»: PWM4 selects the PWM mode for channel 4. When the PWM4 bit is set to 1 and the PWM mode entered, the TIOCA4 pin becomes a PWM output pin. 1 is output on a compare match of general register A4 (GRA4); 0 is output on a compare match of general register B4 (GRB4). When the complementary PWM mode or reset-synchronized PWM mode are set by the CMDl and CMDO bits of the timer function control register (TFCR), the setting of this bit is ignored in favor of the settings of CMDI and CMDO. Bit 4: PWM4 Description o Channel 4 operates normally (initial value) Channel 4 operates in PWM mode 220 HITACHI • Bit 3 (PWM Mode 3 (PWM3»: PWM3 selects the PWM mode for channel 3. When the PWM3 bit is set to I and the PWM mode entered, the TIOCA3 pin becomes a PWM output pin. I is output on a compare match of general register A3 (GRA3); 0 is output on a compare match of general register B3 (GRB3). When the complementary PWM mode or reset-synchronized PWM mode are set by the CMD I and CMDO bits of the timer function control register (TFCR), the setting of this bit is ignored in favor of the settings of CMD 1 and CMDO. Bit 3: PWM3 Description o Channel 3 operates normally (initial value) 1 Channel 3 operates in PWM mode • Bit 2 (PWM Mode 2 (PWM2»: PWM2 selects the PWM mode for channel 2. When the PWM2 bit is set to I and the PWM mode entered. the TIOCA2 pin becomes a PWM output pin. 1 is output on a compare match of general register A2 (GRA2); 0 is output on a compare match of general register B2 (GRB2). Bit 2: PWM2 Description o Channel 2 operates normally (initial value) 1 Channel 2 operates in PWM mode • Bit I (pWM Mode I (PWMI»: PWMI selects the PWM mode for channell. When the PWMI bit is set to I and the PWM mode entered. the TIOCAI pin becomes a PWM output pin. I is output on a compare match of general register Al (GRAI); 0 is output on a compare match of general register B I (GRB 1). Bit 1: PWM1 Description o Channel 1 operates normally (initial value) Channel 1 operates in PWM mode • Bit 0 (PWM Mode 0 (PWMO»: PWMO selects the PWM mode for channel O. When the PWMO bit is set to I and the PWM mode entered. the TIOCAO pin becomes a PWM output pin. I is output on a compare match of general register AO (GRAO); 0 is output on a compare match of general register BO (GRBO). Bit 0: PWMO Description o Channel 0 operates normally (initial value) Channel 0 operates in PWM mode HITACHI 221 10.2.4 Timer Function Control Register (TFCR) The timer function control register (TFCR) is an 8-bit read/write register that selects complementary PWM/reset-synchronized PWM for channels 3 and 4 and sets the buffer operation. TFCR is initialized on a reset or standby mode to H'CO or H'40. Bit: 7 6 5 4 3 2 0 Bit name: I CMD1 CMDO BFB4 BFA4 BFB3 BFA3 Initial value: * 0 0 0 0 0 0 RIW: RIW RIW RIW RIW RIW RIW Note: Undefined • Bits 7 and 6 (reserved): Bit 7 is read as undefined. Bit 6 is always read as 1. The write value to bit 7 should be 0 or I. The write value to bit 6 should always be 1. • Bits 5 and 4 (combination mode I and 0 (CMDI and CMDO»: CMDI and CMDO select the complementary PWM mode or reset-synchronized mode for channels 3 and 4. Set the complementary PWM/reset-synchronized PWM mode while the timer counter (TCNT) being used is off. When these bits are used to set the complementary PWM/reset-synchronized PWM mode, they take priority over the PWM4 and PWM3 bits of the TMDR. While the complementary PWM/reset-synchronized PWM mode settings and the SYNC4 and SYNC3 bit settings of the timersynchro register (TSNC) are valid simultaneously, when the complementary PWM mode is set, channels 3 and 4 should not be set to operate simultaneously (SYNC 4 and ~YNC 3 bits of TSNC should I)ot both be set to 1). Bit 5: CMD1 Bit 4: CMDO Description o o Channels 3 and 4 operate normally (initial value) Channels 3 and 4 operate normally o Channels 3 and 4 operate together in complementary PWM mode Channels 3 and 4 operate together in reset-synchronized PWM mode • Bit 3 (buffer mode B4 (BFB4»: BFB4 selects the buffer mode for GRB4 and BRB4 in channel 4. Bit 3: BFB4 Description o GRB4 operates normally in channel 4 (initial value) GRB4 and BRB4 operate in buffer mode in channel 4 222 HITACHI • Bit 2 (buffer mode A4 (BFA4»: BFA4 selects the buffer mode for GRA4 and BRA4 in channel 4. Bit 2: BFA4 Description o GRA4 operates normally in channel 4 (initial value) GRA4 and BRA4 operate in buffer mode in channel 4 • Bit 1 (buffer mode B3 (BFB3»: BFB3 selects the buffer mode for GRB3 and BRB3 in channel 3. Bit 1: BFB3 Description o GRB3 operates normally in channel 3 (initial value) GRB3 and BRB3 operate in buffer mode in channel 3 • Bit 0 (buffer Mode A3 (BFA3»: BFA3 selects the buffer mode for GRA3 and BRA3 in channel 3. Bit 0: BFA3 Description o GRA3 operates normally in channel 3 (initial value) GRA3 and BRA3 operate in buffer mode in channel 3 10.2.5 Timer Output Control Register (TOCR) The timer output control register (TOCR) is an eight-bit read/write register that inverts the output level of the complementary PWM mode/reset-synchronized PWM mode. Setting bits OLS3 and OLS4 is valid in only the complementary PWM mode and reset-synchronized PWM mode. In other output situations, these bits are ignored. The TOCR is initialized to H'FF or H'7F by a reset or in the standby mode. Bit: 7 6 5 4 3 2 0 Bit name: I OLS4 OLS3 Initial value: 1 1 R1W: RIW RIW Note: Undefined • Bits 7-2 (reserved): Bit 7 is read as undefined. Bits 6-2 are always read as 1. The write value to bit 7 should be 0 or 1. The write value to bits 6-2 should always be 1. HITACHI 223 • Bit 1 (output level select 4 (OLS4»: OLS4 selects the output level of the complementary PWM mode or reset-synchronized PWM mode. Bit 1: OLS4 Description o TIOCA3, TIOCA4, and TIOCB4 are inverted and output TIOCA3, TIOCA4, and TIOCB4 are output directly (initial value) • Bit 0 (output level select 3 (OLS3»: OLS3 selects the output level of the complementary PWM mode or reset-synchronized PWM mode. Bit 0: OLS3 Description o TIOCB3, TOCXA4, and TOCXB4 are inverted and output TIOCB3, TOCXA4, and TOCXB4 are output directly (initial value) 10.2.6 Timer Counters (TCNT) The ITU has five 16-bit timer counters (TCNT), one for each channel (table 10.4). Each TCNT is a 16-bit read/write counter that counts by input from a clock source. The clock source is selected by timer prescalar bits 2-0 (TPSC2-TPSCO) in the timer control register (TCR). TCNTO and TCNT 1 are strictly upcounters. Up/down counting occurs for TCNT2 when the phase counting mode is selected, or for TCNT3 and TCNT 4 when complementary PWM mode is selected. In other modes, they are upcounters. The TCNT can be cleared to H'OOOO by compare match with the corresponding general register A or B (GRA, GRB) or input capture to GRA or GRB (counter clear function). When the TCNT overflows (changes from H'FFFF-H'OOOO), the overflow flag (OVF) in the timer status register (TSR) is set to I. The OVF of the corresponding channel TSR is also set to I when the TCNT underflows (changes from H'OOOO-H'FFFF). The TCNT is connected to the CPU by a 16-bit bus, so it can be written or read by either word access or byte access. The TCNT is initialized to H'OOOO by a reset or in standby mode. 224 HITACHI Table 10.4 Timer Counters (TCNT) Channel Abbreviation Function 0 TCNTO Increment counter TCNT1 2 TCNT2 Phase counting mode: Increment/decrement All others: Increment 3 TCNT3 Complementary PWM mode: Increment/decrement 4 TCNT4 All others: Increment Bit: 15 14 13 12 11 10 9 8 Bit name: I Initial value: 0 0 0 0 0 0 0 0 RIW: RIW RIW RIW RIW RIW RIW RIW RIW Bit: 7 6 5 4 3 2 0 Bit name: I Initial value: 0 0 0 0 0 0 0 0 RIW: RIW RIW RIW RIW RIW RIW RIW RIW 10.2.7 General Registers A and B (GRA and GRB) Each of the five lTV channels has two 16-bit general registers (GR) for a total of ten registers (table 10.5). Each GR is a 16-bit read/write register that can function as either an output compare register or an input capture register. The function is selected by settings in the timer I/O control register (TIOR). When a general register (GRA/GRB) is used as an output compare register, its value is constantly compared with the timer counter (TeNT) value. When the two values match (compare match), the IMFAlIMFB bit is set to 1 in the timer status register (TSR). If compare match output is selected in the TIOR, a specified value is output at the output compare pin. When a general register is used as an input capture register, an external input capture signal is detected and the TeNT value is stored. The IMF AIIMFB bit of the corresponding TSR is set to I at the same time. The valid edge or edges of the input capture signal are selected in the TIOR. The TIOR setting is ignored when set for the PWM mode, complementary PWM mode or reset- synchronized PWM mode. HITACHI 225 General registers are connected to the CPU by a 16-bit bus, so general registers can be written or read by either word access or byte access. General registers are initialized to the output compare register (no pin output) by a reset or in standby mode. The initial value is H'FFFF. Table 10.5 General Registers A and B (GRA and GRB) Channel Abbreviation Function D GRAD, GRBD Output compare/input capture dual register 1 GRA1, GRB1 2 GRA2, GRB2 3 GRA3, GRB3 Output compare/input capture dual register. Can also be set for buffer 4 GRA4, GRB4 operation in combination with the buffer registers (BRA, BRB) Bit: 15 14 13 12 11 10 9 8 Bit name: I Initial value: 1 1 1 1 1 1 1 1 RIW: RIW RIW RIW RIW RIW RIW RIW RIW Bit: 7 6 5 4 3 2 0 Bit name: I Initial value: 1 1 1 1 1 1 1 1 RIW: RIW RIW RIW RIW RIW RIW RIW RIW 10.2.8 Buffer Registers A and B (BRA, BRB) Each buffer register is a 16-bit read/write register that is used in the buffer mode. The ITU has four buffer registers, two each for channels 3 and 4 (table 10.6). Buffer operation can be set independently by the timer function control register (TFCR) bits BFB4, BFA4, BFB3, and BFB3 bits. The buffer registers are paired with the general registers and their function changes automatically to match the function of its corresponding general register. The buffer registers are connected to the CPU by a 16-bit bus, so they can be written or read by either word or byte access. Buffer registers are initialized to H'FFFF by a reset or in standby mode. 226 HITACHI Table 10.6 Buffer Registers A and B (BRA, BRB) Channel Abbreviation Function 3 BAA3, BAB3 When used for buffer operation: -4----B-A-A-4-,-B-A-B-4--When the corresponding GAA and GAB are output compare registers, the buffer registers function as output compare buffer registers that can automatically transfer the BAA and BAB values to GAA and GAB upon a compare match. When the corresponding GAA and GAB are input capture registers, the buffer registers function as input capture buffer registers that can automatically transfer the values stored until an input capture in the GAA and GAB to the BAA and BAB. Bit: 15 14 13 12 11 10 9 8 Bit name: I Initial value: 1 1 1 1 1 1 1 R/W: R/W R/W R/W R/W AIW R/W R/W R/W Bit: 7 6 5 4 3 2 0 Bit name: I Initial value: 1 1 1 1 1 1 1 1 R/W: R/W R/W R/W R/W R/W R/W R/W R/W 10.2.9 Timer Control Register (TCR) The TCR is an 8-bit read/write register that selects the timer counter clock, the edges of the external clock source, and the counter clear source. Each ITU channel has one TCR. TCR is initialized H'80 or H'OO by a reset or the standby mode (table 10.7). Table 10.7 Timer Control Register (TCR) Abbrevi- Channel ation Function o TCAO The TCA controls the TCNTs. The TCAs have the same functions on all ----T-C-A-l--channels. When channel 2 is set for phase counting mode, setting the - - - - - - - C K E G 1, CKEG2 and TPSC2-TPSCO bits will have no effect. 2 TCA2 3 TCA3 4 TCA4 HITACHI 227 Bit: 7 6 5 4 3 2 1 0 Bit name: I I CCLR1 ICCLRO I CKEG1 I CKEGO I TPSC21 TPSC1 I TPSCO I Initial value: * o 0 0 0 0 0 0 RIW: RIW RIW RIW RIW RIW RIW RIW Note: Undefined • Bit 7 (reserved): Bit 7 is read as undefined. The write value should be 0 or 1. • Bits 6 and 5 (counter clear 1 and 0 (CCLRI and CCLRO»: CCLRI and CCLRO select the counter clear source. Bit 6: Bit 5: CCLR1 CCLRO Description o 0 TCNT is not cleared (initial value) ------------------------------------------------------------ 1 TCNT is cleared by general register A (GRA) compare match or input capture*1 o TCNT is cleared by general register B (GRB) compare match or input capture*1 Synchronizing clear: TCNT is cleared in synchronization with clear of other timer counters operating in sync.*2 Notes: 1. When GR is functioning as an output compare register, TCNT is cleared upon a compare match. When functioning as an input capture register, TCNT is cleared upon input capture. 2. The timer synchro register (TSNC) set the synchronization. • Bits 4 and 3 (external clock edge 1/0 (CKEG I and CKEGO»: CKEG 1 and CKEGO select external clock input edges. When channel 2 is set for phase counting mode, settings of the CKEG 1 and CKEGO of the TCR are ignored and the phase counting mode operation takes priority. Bit 4: Bit 3: CKEG1 CKEGO Description o 0 Count rising edges (initial value) Count falling edges Count both rising and falling edges • Bits 2-0 (timer prescalar 2-0 (TPS2-TPSO»: TPS2-TPSO select the counter clock source. When TPSC2 =0 and an internal clock source is selected, the timer counts only falling edges. When TPSC2 = 1 and an external clock is selected, the count edge is as set by CKEG 1 and CKEGO. When the phase counting mode is selected for channel 2 (MDF bit in the timer mode register is 1), the settings of TPSC2-TPSCO of TCR2 are ignored and the phase counting operation takes priority. 228 HITACHI Bit 2: Bit 1: Bit 0: TPSC2 TPSC1 TPSCO Counter Clock (and cycle when 4> = 10 MHz) 0 0 0 Internal clock 4> (initial value) Internal clock 4>/2 0 Internal clock 4>/4 Internal clock 4>/8 0 0 External clock A (TClKA) 1 External clock B (TClKB) 0 External clock C (TClKC) External clock 0 (TClKD) 10.2.10 Timer I/O Control Register (TIOR) The timer 110 control register (nOR) is an eight-bit read/write register that selects the output compare or input capture function for the general registers GRA and GRB. It also selects the function of the nOCA and nOCB pins. If output compare is selected, the TIOR also selects the output settings. If input capture is selected, the nOR also select the input capture edges. nOR is initialized to H'88 or H'08 on a reset or standby mode. Each lTV channel has one TIOR (table 10.8). Table 10.8 Timer I/O Control Register (TIOR) Abbrevl- Channel atlon Function o TIORO The TIOR controls the GRs. Some functions vary during PWM. When ----T-10-R-1-channels 3 and 4 are set for complementary PWM mode/reset-synchronized - - - - - - - P W M mode, TIOR3 and TIOR4 settings are not valid. 2 TIOR2 3 TIOR3 4 TIOR4 Bit: 7 6 5 4 3 2 0 Bit name: I IOB2 IOB1 lOBO 10A2 IOA1 10AO Initial value: 0 0 0 0 0 0 R/W: R/W R/W R/W R/W R/W R/W Note: Undefined • Bit 7 (reserved): Bit 7 is read as undefined. The write value should be 0 or 1. HITACHI 229 • Bits 6-4 (1/0 control B2-BO (lOB2-IOBO»: IOB2-IOBO selects the GRB function. Bit 6: Bit 5: Bit 4: IOB2 IOB1 lOBO GRB Function 0 0 0 GRB is an Compare match with pin output disabled (initial value) output compare 0 output at GRB compare match*1 register 0 1 output at GRB compare match*1 Output toggles at GRB compare match (1 output for channel 2 only)*1,*2 0 0 GRB is an GRB captures rising edge of input input capture GRB captures falling edge of input register 0 GRB captures both edges of input Notes: 1. After reset, the value output is 0 until the first compare match occurs. 2. Channel 2 has no compare-match driven toggle output function. If it is set for toggle, 1 is automatically selected as the output. • Bit 3 (reserved): Bit 3 always reads as I. The write value should always be I. • Bits 2-0 (I/O control A2-AO (IOA2-IOAO»: IOA2-IOAO select the GRB function. Bit 2: Bit 1: Bit 0: IOA2 IOA1 IOAO GRA Function 0 0 0 GRA is an Compare match with pin output disabled (initial value) 1 output compare 0 output at GRA compare match*1 register 0 1 output at GRA compare match*1 Output toggles at GRA compare match (1 output for channel 2 only)*1,*2 o o GRA is an GRA captures rising edge of input -1---input capture GRA captures falling edge of input ------register o GRA captures both edges of input Notes: 1. After reset, the value output is 0 until the first compare match occurs. 2. Channel 2 has no compare-match driven toggle output function. If it is set for toggle, 1 is automatically selected as the output. 10.2.11 Timer Status Register (TSR) The timer status register (TSR) is an eight-bit read/write register containing flags that indicate timer counter (TeNT) overflowlunderflow and general register (GRA/GRB) compare match or 230 HITACHI input capture. These flags are interrupt sources. If the interrupt is enabled by the corresponding bit in the timer interrupt enable register (TIER), an interrupt is requested of the CPU. TSR is initialized by a reset or standby mode to H'P8 or H'78. Each lTV channel has one TSR (table 10.9). Table 10.9 Timer Status Register (TSR) Channel Abbreviation Function o TSRO The TSR indicates input capture, compare match and -------T-S-R-1----overflow status. 2 TSR2 3 TSR3 4 TSR4 Bit: 7 6 5 4 3 2 o Bit name: I OVF IMFB IMFA Initial value: *1 o 0 0 RIW: RI(W)*2 RI(W)*2 RI(W)*2 Notes: 1. Undefined 2. Write 0 to clear the flag. • Bits 7-3 (reserved): Bit 7 is read as undefined. Bits 6-3 are always read as 1. The write value to bit 7 should be 0 or 1. The write value to bits 6-3 should always be 1. • Bit 2 (overflow flag (OVF»: OVP indicates a TCNT overflow/underflow has occurred. 81t2: OVF Description o Clearing condition: Read OVF when OVF = 1, then write 0 in OVF (initial value) Setting condition: TCNT overflowed from H'FFFF-H'OOOO or underflowed from H'OOOQ-H'FFFF. Note: A TCNT underflow occurs when the TCNT up/down counter is functioning. It may occur in the following cases: (1) When channel 2 is set in the phase counting mode (MDF bit of TMDR is 1), or (2) When channel 3 and 4 are set to the complementarY PWM mode (CMD1 bit of TFCR is 1 and CMDO bit is 0). HITACHI 231 • Bit 1 (input capture/compare match B (IMFB»: IMFB indicates a GRB compare match or input capture. Bit 1: IMFB Description o Clearing condition: Read IMFB when IMFB = 1, then write 0 in IMFB (initial value) Setting condition: • GRB is functioning as an output compare register and TCNT = GRB • GRB is functioning as an input capture register and the value of TCNT is transferred to GRB by an input capture signal • Bit 0 (input capture/compare match A (IMFA»: IMFA indicates a GRA compare match or input capture. Bit 0: IMFA Description o Read IMFA when IMFA = 1, then write 0 in IMFA (initial value). Clearing condition: DMAC is activated by an IMIA interrupt (only channels 0-3) Setting condition: • GRA is functions as an output compare register and TCNT = GRA • GRA is functioning as an input capture register and the value of TCNT is transferred to GRA by an input capture signal 10.2.12 Timer Interrupt Enable Register (TIER) The timer status interrupt enable register (TIER) is an eight-bit read/write register that controls enabling/disabling of overflow interrupt requests and general register compare match/input capture interrupt requests. TIER is initialized by a reset or standby mode to H'F8 or H'78. Each lTV channel has one TIER (table 10.10). Table 10.10 Timer Interrupt Enable Register (TIER) Channel Abbreviation Function 0 TIERO The TIER controls interrupt enable/disable. 1 TIER1 2 TIER2 3 TIER3 4 TIER4 232 HITACHI Bit: 7 6 5 4 3 2 1 0 Bit name: I OVIE IMIEB IMIEA Initial value: * 0 0 0 R/W: R/W R/W R/W Note: Undefined • Bits 7-3 (reserved): Bit 7 is read as undefined. Bits 6-3 are always read as 1. The write value to bit 7 should be 0 or 1. The write value to bits 6-3 should always be 1. • Bit 2 (overflow interrupt enable (OVIE»: When the TSR overflow flag (OVF) is set to I, OVIE enables or disables interrupt requests from the OVF. Bit 2: OVIE Description o Disables interrupt requests by the OVF (initial value) Enables interrupt requests from the OVF • Bit 1 (input capture/compare match interrupt enable B (IMIEB»: When the IMFB bit of the TSR is set to 1, IMIEB enables or disables the interrupt requests from the IMFB. Bit 1: IMIEB Description o Disables interrupt requests by the IMFB (IMIB) (initial value) Enables interrupt requests from the IMFB (IMIB) • Bit 0 (input capture/compare match interrupt enable A (IMIEA»: When the IMFA bit of the TSR is set to 1, IMIEA enables or disables the interrupt requests from the IMFA. Bit 0: IMIEA Description o Disables interrupt requests by the IMFA (IMIA) (initial value) 1 Enables interrupt requests from the IMFA (IMIA) 10.3 CPU Interface 10.3.1 16-Bit Accessible Registers The timer counters (TCNT), general registers A and B (GRA, GRB), and buffer registers A and B (BRA, BRB) are 16-bit registers. The SH CPU can access these registers a word at a time using a 16-bit data bus. Byte access is also possible. Read and write operations performed on the TCNT in word units are shown in figures 10.6 and 10.7. Byte-unit read and write operations on TCNTH and TCNTL are shown in figures 10.8-10.11. HITACHI 233 Internal data bus r - - - - - - - , Bus Module interface data bus <~> Figure 10.9 Accessing TCNT (CPU-TCNT (lower byte» Intemal data bus ,-------..., CPU Bus Module interface data bus <--=-------..J> Figure 10.10 Accessing TCNT (TCNT-CPU (upper byte» Intemal data bus ,-------..., Bus Module interface data bus Figure 10.11 Accessing TCNT (TCNT-CPU (lower byte») 10.3.2 8-Bit Accessible Registers All registers other than the TCNT, general registers, and buffer registers are 8-bit registers. These are connected to the CPU by an 8-bit data bus. Figures 10.12 and 10.13 illustrate reading and writing in byte units with the timer control register (TCR). These registers must be accessed by byte access. HITACHI 235 Internal data bus ,------, CPU <__> Bus interface Module data bus Figure 10.12 TCR Access (CPU-TCR) Internal data bus CPU< > Bus interface Module data bus I TCR J Figure 10.13 TCR Access (TCR-CPU ) 10.4 Description of Operation 10.4.1 Overview The operation modes are described below. Ordinary Operation: Each channel has a timer counter (TCNT) and general register (GR). The TCNT is an upcounter and can also operate as a free-running counter, periodic counter or external event counter. General registers A and B (GRA and GRB) can be used as output compare registers or input capture registers. Synchronized Operation: The TCNT of a channel set for synchronized operation does a synchronized preset. When any TCNT of a channel operating in the synchronized mode is rewritten, the TCNTs of other channels are simultaneously rewritten as well. The CCLRI and CCLRO bits of the timer control register of multiple channels set for synchronous operation can be set to clear the TCNTs simultaneously. PWM Mode: In PWM mode, a PWM waveform is output from the TIOCA pin. Output becomes 1 upon compare match A and 0 upon compare match B. GRA and GRB can be set so that the 236 HITACHI PWM waveform output has a duty cycle between 0% and 100%. When set for PWM mode, the GRA and GRB automatically become output compare registers. Reset-synchronized PWM Mode: Three pairs of positive and negative PWM waveforms can be obtained using channels 3 and 4 (the three phases of the PWM waveform share a transition point on one side). When set for reset-synchronized PWM mode, GRA3, GRB3, GRA4, and GRB4 automatically become output compare registers. The TIOCA3, TIOCB3, TIOCA4, TOCXA4, TIOCB4, and TOCXB4 pins also automatically become PWM output pins and TCNT3 becomes an upcounter. TCNT4 functions independently (although GRA and GRB are isolated from TCNT4). Complementary PWM Mode: Three pairs of complementary positive and negative PWM waveforms whose positive and negative phases do not overlap can be obtained using channels 3 and 4. When set for complementary PWM mode, GRA3, GRB3, GRA4, and GRB4 automatically become output compare registers. The TIOCA3, TIOCB3, TIOCA4, TOCXA4, TIOCB4, and TOCXB4 pins also automatically become PWM output pins while TCNT3 and TCNT4 become upcounters. Phase Counting Mode: In phase counting mode, the phase differential between two clocks input from the TCLKA and TCLKB pins is detected and the TCNT2 operates as an up/downcounter. In phase counting mode, the TCLKA and TCLKB pins become clock inputs and TCNT2 functions as an up/downcounter. Buffer Mode: • When GR is an output compare register: The BR value of each channel is transferred to the GR when a compare match occurs. • When GR is an input capture register: The TCNT value is transferred to the GR when an input capture occurs and simultaneously the value previously stored in the GR is transferred to the BR. • Complementary PWM mode: When the TCNT3 and TCNT4 change count directions, the BR value is transferred to the GR. • Reset-synchronized PWM mode: The BR value is transferred to GR upon a GRA3 compare match. 10.4.2 Basic Functions Counter Operation: When a start bit (STRO-STR4) in the timer start register (TSTR) is set to 1, the corresponding timer counter (TCNT) starts counting. There are two counting modes: a free- running mode and a periodic mode. HITACHI 237 • Procedure for selecting counting mode (figure 10.14): 1. Set bits TPSC2-TPSCO in the TCR to select the counter clock source. If an external clock source is selected, set bits CKEO 1 and CKEOO in the TCR to select the desired edges of the external clock signal. 2. To operate as a periodic counter, set CCLRI and CCLRO in the TCR to select whether to clear the TCNT at ORA compare match or ORB compare match. 3. Set the ORA or ORB selected in step 2 as an output compare register using the timer 110 control register (TIOR). 4. Write the desired cycle value in the ORA or ORB selected in step 1. 5. Set the STR bit in the TSTR to 1 to start counting. Counting mode selection Select counter clock CD No Periodic counter Free-running counter Select counter clear source @ Select output compare register @ Set period @ Start counting ® Start counting ® Periodic counter Free-running counter Figure 10.14 Procedure for Selecting the Counting Mode 238 HITACHI • Free-running count and periodic count A reset of the counters for channels ~ leaves them all in the free-running mode. When a corresponding bit in the TSTR is set to 1, the corresponding timer counter operates as a free- running counter and begins to increment. When the count wraps around from H'FFFF-H'ooOO, the overflow flag (OVF) in the timer status register (TSR) is set to I. If the OVIE bit in the timer's corresponding interrupt enable register (TIER) is set to 1, the CPU will be asked for an interrupt. After the TCNT overflows, counting continues from H'OOOO. Figure 10.15 shows an example of free-running counting. Periodic counter operation is obtained for a given channel's tCNT by selecting compare match as a TCNT clear source. (Set the GRA or GRB for period setting to output compare register and select counter clear upon compare match using the CCLR I and CCLRO bits of the timer control register (TCR).) After setting, the TCNT begins incrementing as a periodic counter when the corresponding bit ofTSTR is set to 1. When the count matches GRA or GRB, the IMFAIIMFB bit in the TSR is set to 1 and the counter is automatically cleared to H'OOOO. If the IMIEAlIMIEB bit of the corresponding TIER is set to I at this point, the CPU will be asked for an interrupt. After the compare match, TCNT continues counting from H'oooo. Figure 10.16 shows an example of periodic counting. TCNTvalue ::1/?1/?1=;: . . nme STRo-STR4 _ _ _--' OVF _ _ _ _ _ _ _ _ _ _---' Figure 10.15 Free-Running Counter Operation HITACHI 239 --_._----. TCNT value Counter cleared by r ~ GR COmpore match H;_m==~ . Time ··· .... ··· . . STRo-STR4 - - - - - - ' IMF - - - - - - - - - - - - - - ' Figure 10.16 Periodic Counter Operation • TCNT counter timing Internal clock source: Bits TPSC2-TPSCO in the TCR select the system clock (CK) or one of three internal clock sources (cp/2, cp/4, cp/8) obtained by prescaling the system clock. Figure 10.17 shows the timing. External clock source: The external clock input pin (TCLKA-TCLKD) source is selected by bits TPSC2-TPSCO in the TCR and its valid edges are selected with the CKEG 1 and CKEGO bits of the TCR. The rising edge, falling edge, or both edges can be selected. The pulse width of the external clock signal must be at least 1.5 system clocks when a single edge is selected and at least 2.5 system clocks when both edges are selected. Shorter pulses will not be counted correctly. Figure 10.18 shows the timing when both edges are detected. CK u--u-u--L Internal clock l { ~ I{ TCNTinput clock ~~ SS I TCNTvalue N-1 C N : X N+1 Figure 10.17 Count Timing for Internal Clock Sources 240 HITACHI CK External clock input pin I ( L TCNT input r j) clock ~s TCNT N -1 C N X N+1 Figure 10.18 Count Timing for External Clock Sources Compare-Match Waveform Output Function: For ITU channels 0, 1,3, and 4, the output from the corresponding TIOCA and TIOCB pins upon compare matches A and B can be in three modes: O-Ievel output, I-level output, or toggle. Toggle output cannot be selected in channel 2. • Procedure for selecting the waveform output mode (figure 10.19): 1. Set the TIOR to select 0 output, I output, or toggle output for compare match output. The ° compare match output pin will output until the first compare match occurs. 2. Set a value in the GRA or GRB to select the compare match timing. 3. Set the STR bit in the TSTR to I to start counting. Output selection Select waveform output mode CD Select output timing ® Start counting ® Waveform output Figure 10.19 Procedure for Selecting the Compare Match Waveform Output Mode HITACHI 241 • Waveform output operation Figure 10.20 illustrates 0 outputll output. In the example, TCNT is a free-running counter, 0 is output upon compare match A and I is output upon compare match B. When the pin level matches the set level, the pin level does not change. Figure 10.21 shows an example of toggle output. In the figure, the TCNT operates as a periodic counter cleared by ORB compare match with toggle output at both compare match A and compare match B. TCNTvalue H'FFFF GRB ......................... . GRA ....... -........... . ~--~-----+--~~---+----~--~----~----~--------~ Time TIOCB o : Does not change 0 : Does not change 1 output TIOCA e Does not change 0 Does not change o output Figure 10.20 Example of 0 Outputll Output 242 HITACHI Counter cleared at TCNTvalue GAB compare match GAB ................................................................................................................ GAA ....................................................................................................... . ~----~------~------~------~------~----~ Time Toggle TIOCB output TIOCA Toggle output Figure 10.21 Example of Toggle Output HITACHI 243 • Compare match output timing The compare match signal is generated in the last state in which the TCNT and the general register match (when the TCNT changes from the matching value to the next value). When a compare match signal is generated, the output value set in TIOR is output to the output compare pin (TIOCA, TIOCB). Accordingly, when the TCNT matches a general register, the compare match signal is not generated until the next counter clock pulse. Figure 10.22 shows the output timing of the compare match signal. CK TCNT input clock TCNT __________N________~X~ ____N_-_1_____________ GR N Compare match signal TIOCA TIOCB __________________ _______________ ~x~ Figure 10.22 Compare Match Signal Output Timing 244 HITACHI Input Capture Mode: In the input capture mode, the counter value is captured into a general register when the input edge is detected at an input capture/output compare pin (TIOCA, TIOCB). Detection can take place on the rising edge, falling edge, or both edges. Pulse width and cycle can be measured by using the input capture function. • Procedure for selecting the input capture mode (figure 10.23) 1. Set the TIOR to select the input capture function of the GR and select the rising edge, falling edge, or both edges as the input edge of the input capture signal. Put the corresponding port into input-capture using the pin function controller before setting the TIOR. 2. Set the STR bit in the TSTR to 1 to start the TCNT counting. Input selection I I Select input-capture input I I I Start counting I + Capture Figure 10.23 Procedure for Selecting Input Capture Mode HITACHI 245 • Input capture operation Figure 10.24 illustrates input capture. The falling edge of TIOCB and both edges of TIOCA are selected as input capture edges. In the example, TCNT is set to clear at the input capture of GRB. TCNT Counter cleared value / by TIOCB input If (falling edge) H'0180 H'0160 H'0005 H'OOoo L.oo:::::"-'~~ _ _ _ _ _ _ _ _ _---'_-\-~""::=;;-+-_ _ _ _ _ _ -+ Time TIOCB TIOCA GRA H'0005 GRBX~____________________~ H'0180 Figure 10.24 Input Capture Operation 246 HITACHI • Input capture timing Input capture on the rising edge, falling edge, or both edges can be selected by settings in the nOR. Figure 10.25 shows the timing when the rising edge is selected. The pulse width of the input capture signal must be at least 1.5 system clocks for single-edge capture, and 2.5 system clocks for capture of both edges. CK Input capture input Input capture signal TCNT N GRAlGRB ____________________________~)(~________N__________ Figure 10.25 Input Capture Signal Timing HITACHI 247 10.4.3 Synchronizing Mode In the synchronizing mode, two or more timer counters can be rewritten simultaneously (synchronized preset). Multiple timer counters can also be cleared simultaneously using TCR settings (synchronized clear). The synchronizing mode can increase the general registers for a single time base. All five channels can be set for synchronous operation. Procedure for Selecting the Synchronizing Mode (figure 10.26): 1. Set I in the SYNC bit of the timer synchro register (TSNC) to use the channels in the synchronizing mode. 2. When a value is written in the TCNT in any of the synchronized channels, the same value is simultaneously written in the TCNT in the other channels. 3. Set the counter to clear with compare matchlinput capture using bits CCLR 1 and CCLRO in the TCR. 4. Set the counter clear source to synchronized clear using the CCLRI and CCLRO bits. 5. Set the STR bits in the TSTR to 1 to start counting in the TCNT. Select synchronizing mode Set synchronizing mode Synchronized preset Synchronized clear Set TCNT ~------~--------~ ® Synchronizing preset Counter clear Synchronized clear Figure 10.26 Procedure for Selecting the Synchronizing Mode 248 HITACHI Synchronized Operation: Figure 10.27 shows an example of synchronized operation. Channels 0, I, and 2 are set to synchronized operation and PWM output. Channel 0 is set for a counter clear upon compare match with GRBO. Channels 1 and 2 are set for counter clears by synchronizing clears. Accordingly, their timers are sync preset, then sync cleared by a GRBO compare match, and then a three-phase PWM waveform is output from the TIOCAO, TIOCAI and TIOCA2 pins. See section 10.4.4, PWM Mode, for details on the PWM mode. TCNTo-TCNT2 values Synchronized clear on GABO compare match / / GABO ................................................................................................................... GABl ........... . GAAO ........... . ................................ ·l······~······ .......................... ·l······ .................. . GAB2 ··························:······~······r·· .. ····················[·····r·········· ............ . GAAl ...... ............. :......(.....( ....( ................ :.... "T ..... ......................... ~ GAA2 ............ :······r·····r·····r···r···· ...... ~ ...... :. ··r····;······ ............ ~~~--~--~:~~~~:--~~--~~--+-~--~~----. Time ···· .... i---i---i TIOCAO ~ L TIOCAl TIOCA2 Figure 10.27 Synchronized Operation Example HITACHI 249 10.4.4 PWM Mode The PWM mode is controlled using both the GRA and GRB in pairs. The PWM waveform is output from the TIOCA output pin. The PWM waveform's I output timing is set in GRA and the 0 output timing is set in GRB. A PWM waveform with duty cycle between 0% and 100% can be output from the TIOCA pin by having either compare match GRA or GRB be the counter clear source for the timer counter. All five channels can be set to PWM mode. Table 10.11 lists the combinations of PWM output pins and registers. Note that when the GRA and GRB are set to the same value, the output will not change even if a compare match occurs. Table 10.11 Combinations of PWM Output Pins and Registers Channel Output Pin 1 Output o Output 0 TIOCAO GRAO GRBO 1 TIOCA1 GRA1 GRB1 2 TIOCA2 GRA2 GRB2 3 TIOCA3 GRA3 GRB3 4 TIOCA4 GRA4 GRB4 Procedure for Selecting the PWM Mode (figure 10.28): 1. Set bits TPSC2-TPSCO in the TCR to select the counter clock source. If an external clock source is selected, set bits CKEG 1 and CKEGO in the TCR to select the desired edges of the external clock signal. 2. Set CCLRI and CCLRO in the TCR to select the counter clear source. 3. Set the time at which the PWM waveform should go to 1 in the GRA. 4. Set the time at which the PWM waveform should go to 0 in the GRB. 5. Set the PWM bit in TMDR to select the PWM mode. When the PWM mode is selected, regardless of the contents of TIOR, the GRA and GRB become output compare registers specifying the times at which the PWM waveform goes high and low. TIOCA automatically becomes a PWM output pin. TIOCB becomes whatever is set in the TIOR's lOBI and lOBO bits. 6. Set the STR bit in the TSTR to let the TCNT start counting. 250 HITACHI PWM mode Select counter clock CD Select counter clear source ® Set GRA ® Set GRB ® Select PWM mode ® Start counting ® PWM mode Figure 10.28 Procedure for Selecting the PWM Mode PWM Mode Operation: Figure 10.29 illustrates PWM mode operations. When the PWM mode is set, the TIOCA pin becomes the output pin. Output is 1 when the TCNT matches the GRA, and 0 when the TCNT matches the GRB. The TCNT can be cleared by compare match with either GRA or GRB. This can be used in both free-running and synchronized operation. Figure 10.30 shows examples ofPWM waveforms output with 0% and 100% duty cycles. A 0% duty waveform can be obtained by setting the counter clear source to GRB and then setting GRA to a larger value than GRB. A 100% duty waveform can be obtained by setting the counter clear source to GRA and then setting GRB to a larger value than GRA. HITACHI 251 TCNTvalue GRA ,Counter cleared by GRA compare match GRB ------- ~------+_------4L------~------~~----~------~~Time I I I I TIOCA '---------II a. Counter cleared by GRA TCNTvalue GRB , Counter cleared by GRB compare match --------------- --------------- -------------- GRA ------- ~------+_------~------~------~~----~------~~Time TIOCA l b. Counter cleared by GRB Figure 10.29 PWM Mode Operation Example 1 252 HITACHI TCNTvalue I-counter cleared on compare match B GAB ----------- ---~~~~~~~~~~~~~-~~ll---------- GRA I H'OOOO 1£----i----,r----'~-------fL__i_--+-----1_+ Time TIOCA _ _---I L t t GAAwrite GAAwrite a.O%duty TCNTvalue - -~~~~~~~~~~~~~-~~,l-~-~---~~-~ I-counter cleared on compare match A GAA ----------- GAB H'OOOO ~---I...--..;_~------*__;.-+-----++ Time I I I TIOCA '-------'~ t GAB write t GRB write b. 100% duty Figure 10.30 PWM Mode Operation Example 2 HITACHI 253 10.4.5 Reset-Synchronized PWM Mode In the reset-synchronized PWM mode, three pairs of complementary positive and negative PWM waveforms that share a common wave turning point can be obtained using channels 3 and 4. When set for reset-synchronized PWM mode, the TIOCA3, TIOCB3, TIOCA4, TOCXA4, TIOCB4, and TOCXB4 pins automatically become PWM output pins and TCNT3 becomes an upcounter. Table 10.12 shows the PWM output pins used and table 10.13 shows the settings of the registers used. Table 10.12 Output Pins for Reset-Synchronized PWM Mode Channel Output Pin Description 3 TIOCA3 PWM output 1 TIOCB3 PWM output l' (negative-phase waveform of PWM output 1) 4 TIOCA4 PWM output 2 TOCXA4 PWM output 2' (negative-phase waveform of PWM output 2) TIOCB4 PWM output 3 TOCXB4 PWM output 3' (negative-phase waveform of PWM output 3) Table 10.13 Register Settings for Reset-Synchronized PWM Mode Register Description of Contents TCNT3 Initial setting of H'OOOO TCNT4 Not used (functions independently) GRA3 Set count cycle for TCNT3 GRB3 Sets the turning point for PWM waveform output by the TIOCA3 and TIOCB3 pins GRA4 Sets the turning point for PWM waveform output by the TIOCA4 and TOCXA4 pins GRB4 Sets the turning point for PWM waveform output by the TIOCB4 and TOCXB4 pins Procedure for Selecting the Reset-Synchronized PWM Mode (figure 10.31): 1. Clear the STR3 bits in the TSTR to halt TCNT3. The reset-synchronized PWM mode must be set up while TCNT3 is halted. 2. Set bits TPSC2-TPSCO in the TCR to select the counter clock source for channel 3. If an external clock source is selected, select the external clock edges with bits CKEG 1 and CKEGO in the TCR. 3. Set bits CCLRI and CCLRO in the TCR3 to select GRA3 as a counter clear source. 4. Set bits CMDI and CMDO in TMDB to select the reset-synchronized PWM mode. TIOCA3- TIOCB4, TOCXA4, and TOCXB4 automatically become PWM output pins. 254 HITACHI 5. Reset the TeNT3 (to H'OOOO). The TCNT4 need not be set. 6. The GRA3 is the waveform period register. Set the waveform period value in the GRA3. Set the transition times of the PWM output waveforms in the GRB3, GRA4, and GRB4. Set times within the compare match range of the TCNT3. x S GRA3 (X: setting value) 7. Set the STR3 bits in the TSTR to 1 to let the TCNT3 start counting. Reset synchronized PWM mode J Stop counting G) I Select counter clock ® I Select counter clear source @ I Select reset-synchronized PWM mode @) I Set TCNT @ I Set general registers @ I Start counting (f) ~ Reset-synchronized PWM mode Figure 10.31 Procedure for Selecting the Reset-Synchronized PWM Mode HITACHI 255 Reset-Synchronized PWM Mode Operation: Figure 10.32 shows an example of operation in the reset-synchronized PWM mode. TCNT3 operates as an upcounter that is cleared to H'OOOO at compare match with ORA3. TCNT4 runs independently and is isolated from GRA4 and ORB4. The PWM waveform outputs toggle at each compare match (ORB3, GRA3, and GRB4 with TCNT3) and when the counter is cleared. See section 10.4.8, Buffer Mode, for details on simultaneously setting reset-synchronized PWM mode and buffer operation. TCNTvalue Counter cleared at GRA3 compare match GRA3 ~------------- -------------- - GRB3 ----------, -- , I GRA4 ------ I ---.1--- I I ----l--- I -. GRB4 1 I ,---- 1 - -'-r-- ---,---,--- - I I I 1 ~--~~--~i~~,~~--~--~--~,~-+--~---+:---+-+Time TIOCA3 --~r-~--~~~:--~--T-~t--l~,---r---r---~ I 1 , TIOCB3 U U I W- I I TIOCA4 -r-----'t----------il I ~ r I I I TOCXA4 '-----------l I I 1 1 TIOCB4 ~I------------lU I U I L 1 TOCXB4 I ~----,h h r- Figure 10.32 Reset-Synchronized PWM Mode Operation Example 1 10.4.6 Complementary PWM Mode In the complementary PWM mode, three pairs of complementary, non-overlapping, positive and negative PWM waveforms can be obtained using channels 3 and 4. In complementary PWM mode, the TIOCA3, TIOCB3, TIOCA4, TOCXA4, TIOCB4, and TOCXB4 pins automatically become PWM output pins and TCNT3 and TCNT4 become upcounters. Table 10.14 shows the PWM output pins used and table 10.15 shows the settings of the registers used. 256 HITACHI Table 10.14 Output Pins for Complementary PWM.Mode Channel Output Pin Description 3 TIOCA3 PWM output 1 TIOCB3 PWM output l' (non-overlapping negative-phase waveform of PWM output 1) 4 TIOCA4 PWM output 2 TOCXA4 PWM output 2' (non-overlapping negative-phase waveform of PWM output 2) TIOCB4 PWM output 3 TOCXB4 PWM output 3' (non-overlapping negative-phase waveform of PWM output 3) Table 10.15 Register Settings for Complementary PWM Mode Register Description of Contents TCNT3 Initial setting of non-overlap cycle (the difference with TCNT4) TCNT~ Initial setting of H'OOOO GRA3 Set upper limit of TCNT3-1 GRB3 Sets the turning point for PWM waveform output by the TIOCA3 and TIOCB3 pins. GRA4 Sets the turning point for PWM waveform output by the TIOCA4 and TOCXA4 pins. GRB4 Sets the turning point for PWM waveform output by the TIOCB4 and TOCXB4 pins. Procedure for Selecting the Complementary PWM Mode (figure 10.33): 1. Clear STR3 and STR4 bits in the TSTR to halt the timer counters. The complementary PWM mode must be set up while TCNT3 and TCNT4 are halted. 2. Set bits TPSC2-TPSCO in the TCR to select the same counter clock source for channels 3 and 4. If an external clock source is selected, select the external clock edges with bits CKEG I and CKEGO in the TCR. Do not select any counter clear source with bits CCLR I and CCLRO in the TCR. 3. Set bits CMDI and CMDO in TMDB to select the complementary PWM mode. TIOCA3- TIOCB4, TOCXA4, and TOCXB4 automatically become PWM pins. 4. Reset TCNT4 (to H'OOOO). Set the non-overlap offset in TCNT3. Do not set TCNT3 and TCNT4 to the same value. HITACHI 257 5. GRA3 is the waveform period register. Set the upper limit of TCNT3-1 *.. Set the transition times of the PWM output waveforms in GRB3, GRA4, and GRB4. Set times within the compare match range of TCNT3 and TCNT4. T~X (X: initial setting of GRB3. GRA4. and GRB4; T: initial setting of TCNT3) Note: GRA3 = [cycle countl2] + [count of non-overlaps] - 2cyc=[upper limit of TCNT3]-1 6. Set the STR3 and STR4 bits in the TSTR to 1 to let TCNT3 and TCNT4 start counting. Complementary PWM mode Stop counting 1 11---- BR GR Write on decrement Write on increment Figure 10.41 Example of Changing GR Settings with ButTer Operation (2) The above settings are made by detecting the occurrence of a GRA3 compare match or underflow of TCNT4 and then writing to BR. They can also be accomplished by starting up the DMAC with a GRA3 compare match. 10.4.7 Phase Counting Mode The phase counting mode detects the phase differential of two external clock inputs (TCLKA and TCLKB) and counts TCNT2 up or down. When set in the phase counting mode, the TCLKA and TCLKB pins automatically become external clock input pins, regardless of the settings of the TPSC2-TPSCO bits of TCR2 or the CKEG 1 and CKEGO bits. TCNT2 also becomes an up/down counter. Since the TCR2 CCLR lICCLRO bits, TIOR2, TIER2, TSR2, GRA2 and GRB2 are all enabled, input capture and compare match functions and interrupt sources can be used. Phase counting is available only in channel 2. Procedure for Selecting the Phase Counting Mode: Figure 10.42 shows the procedure for selecting the phase counting mode. 1. Set the MDF bit of the timer mode register (TMD R) to 1 to select the phase counting mode. 2. Select the flag set conditions using the FDIR bit of the TMDR. 3. Set the STR2 bit of the timer start register (TSTR) to 1 to start the count. 264 HITACHI Phase counting mode Select phase counting mode G) Select flag setting condition ® Start counting @ Phase counting mode Figure 10.42 Procedure for Selecting the Phase Counting Mode Phase Counting Operation: Figure 10.43 shows an example of phase counting mode operation. Table 10.16 lists the upcounting and downcounting conditions for TCNT2. The lTV counts on both rise and fall edges of TCLKA and TCLKB. The phase differential and overlap of TCLKA and TCLKB must be 1.5 cycles or more and the pulse width must be 2.5 cycles or more. TCNT2 value ~nt TCNT2 Time TClKB .-J f f f t TClKA f *+ f *+ f ~ *f ~ *f Figure 10.43 Phase Counting Mode Operation Table 10.16 Up/Down Counting Conditions Counting Direction Increment Decrement TClKB Rising High Falling low Rising low Falling High TClKA low Rising High Falling High Rising Low Falling . HITACHI 265 Phase Phas~ Pulse Pulse differential differential width width I '" ~I I '" I ~I '" I ' . TCLKA L TCLKB '.. ~' I ' . ~' Overlap Overlap Phase differential, overlap: 1.5 cycles minimum Pulse width: 2.5 cycles minimum Figure 10.44 Phase Differentials, Overlap and Pulse Width in the Phase Counting Mode 10.4.8 Buffer Mode In the buffer mode, the buffer operation functions differ depending on whether the general registers are set to output compare or input capture, the reset-synchronized PWM mode, or complementary PWM mode. The buffer mode is a function of channels 3 and 4 only. Buffer operations set this way function as follows. GR is an Output Compare Register: The value of the buffer registers of a channel is transferred to the OR when the channel experiences a compare match. This is illustrated in figure lO.45. Compare match signal ,--_B_R__ ~,---_G_R_-,R Comp~rator R TeNT Figure 10.45 Compare Match Buffer Operation GR is an Input Capture Register: TeNT values are transferred to GR when input capture occurs and the value previously stored in GR is transferred to BR. This operation is illustrated in figure lO.46. 266 HITACHI Input capture signal BR GR TCNT Figure 10.46 Input Capture Buffer Operation Complementary PWM Mode: When the count direction of TCNT3 and TCNT4 change. the BR value is transferred to the GR. The following timing is employed for this transfer: • Whenever TCNT3 and GRA3 compare-match • Whenever TCNT4 underflows Reset-Synchronized PWM Mode: The BR value is transferred to GR upon a GRA3 compare match. Procedure for Selecting the Buffer Mode (figure 10.47): 1. Set the TIOR to select the output compare or input capture function of the GR. 2. Set bits BFA3. BFB3 and BFB4 in the TFCR to select the buffer mode for the GR. 3. Set the STR bit in the TSTR to I to start the TCNT counting. Buffer mode Select general register function CD Select buffer mode ® Start counting ® Buffer mode Figure 10.47 Procedure for Selecting the Buffer Mode HITACHI 267 Buffer Mode Operation: Figure 10.48 shows an example of an operation in the buffer mode with GRA set as an output compare register and GRA and buffer register A (BRA) set for buffer operation. The TCNT operates as a periodic counter that is cleared by GRB compare match. TIOCA and TIOCB are set to toggle at compare matches A and B. Since buffer mode is selected, when TIOCA toggles at a compare match A, the BRA value is simultaneously transferred to the GRA. This operation is repeated at every compare match A. The transfer timing is shown in figure 10.49. TCNTvalue Counter cleared by compare match B GRB ------------_ H' 0250 H' 0200 ------ -t----- , ------- , ------------- ------ , I , ___ L ____________ _____ _ H' 0100 ----T---- ~ , H' 0000 1o<......._ _ _- ' - _ - - j L . -_ _--t-_ _-+<:..-_I---+_ _-+_... Time BRA _ _H_'_02_0_0-,--~_-'\ )-._ _ _-+--+-_....,.-' '--l..-..>~!-I_'_o2_o_0---.,.__ GRA H' 0250 : ------( H' 0200 ' , (---- Toggle TIOCB _ _ _ _---,_ _-' '-_---,_-+:__~! output TIOCA I I' . U' LToggle t t t t t output '~---------~v~----------------) Compare match A Figure 10.48 Buffer Mode Operation Example 1 (Output Compare Register) 268 HITACHI CK TCNT ____________n________~)(~_______n_+__ 1 ___________________ Compare match signal Buffer transfer signal BR GR _________n______~X~ ___N_J___________________ Figure 10.49 Compare Match Timing Example for ButTer Operation HITACHI 269 Figure 10.50 shows an example of input capture operation in the buffer mode between GRA and . BRA with GRA as an input capture register. The TCNT is cleared by input capture B. The falling edge is selected as the input capture edge at TIOCB. Both edges are selected as input capture edges at TIOCA. When the TCNT value is stored in GRA by input capture A, the previous GRA value is transferred to the BRA. The timing is shown in figure 10.51. TCNT value Counter cleared / at input capture B H'0180 H'0160 I I H' 0005 ~-----------------------r--~~ ~~~-------------------------+----~~------------~Time TIOCBI'-____;.-:__________--' I I TIOCA -.-J I GRA - - - { H'0005 BRA H' 0160 - - - { ' - - - - - - - - - - - - - - { '-----r--~ ' - - - - - - - GRB=x~______________________~X~ ____H_'_01_8_0___ t t t ~~---------~vr----------------) Input capture A Figure 10.50 Buffer Mode Operation Example 2 (Input Capture Register) 270 HITACHI CK ~ 5=l TIOC pin Input capture signal h :: TCNT n+1 N GA M n BA M Figure 10.51 Input Capture Timing Example for Buffer Operation An example of buffer operation in the complementary PWM mode between GRB3 and BRB3 is as shown in figure 10.52. By making GRB3 larger than GRA3 using the buffer operation, a PWM waveform with a duty cycle of 0% is generated. The transfer from BRB-GRB occurs upon TeNT3 and GRA compare match and TCNT4 underflow. TCNT3 and TCNT4 values TCNT3 GAB3 H'1FFF GAA3 I- -------J~~~~~~~~~~-~~~~~~~~~~l~ ______ _ I I I I I I , I , I I I H' 0999 --- H'OOQO Time I :1 ?F xi! " BAB3 H I 9 i H' 1FFF X H'~999 Ii :1 :1 I " GAB3 H' 0999 I H'1FFF I H'1FFF H' 0999 " " TIOCA3 11 , i, I !r- I ,! TIOCB3 ---J I L Figure 10.52 ButTer Operation 4 (Complementary PWM Mode) HITACHI 271 10.4.9 lTV Output Timing lTV outputs in channels 3 and 4 can be inverted with the TOCR. Output Inversion Timing with the TOCR: Output levels can be inverted by inverting the output level select bits (OLS4 and OLS3) of the TOCR in the complementary PWM mode and reset- synchronized PWM mode. Figure 10.53 illustrates the timing. I I : I+- T1-+1+- T2-+1+- T3-+1 CK I I I I I Address =><,-__T-!~_C_R_a_d_d_re-t-:s_s_ _--IC I I I TOCR i ~ . i : ::-=i ITU output pin ] i C Inyersion Figure 10.53 Example ofInverting lTV Output Levels by Writing to TOCR 272 HITACHI 10.5 Interrupts The lTV has two interrupt sources: input capture/compare match and overflow. 10.5.1 Timing of Setting Status Flags Timing for Setting IMFA and IMFB in a Compare Match: The IMF bits of the TSR are set to 1 by a compare match signal generated when the TeNT matches a general register. The compare match signal is generated in the last state in which the values match (when the TeNT is updated from the matching count to the next comit). Therefore, when the TeNT matches the GRA or GRB, the compare match signal is not generated until the next timer clock input. Figure 10.54 shows the timing of setting the IMF bits. CK TCNT input clock TCNT _________ N__ ~)(~_______________N_+__1_______________ GR N Compare match signal IMF IMI Figure 10.54 Timing of Setting Compare Match Flags (IMFA, IMFB) HITACHI 273 Timing of Setting IMFA, IMFB for Input Capture: The IMFA and IMFB are set to 1 by an input capture signal. At this time, the TeNT contents are transferred to the GR. Figure 10.55 shows the timing. CK Input capture signal IMF TCNT N GR ________________________)(~____________N_____________ IMI Figure 10.55 Timing of Setting IMF A and IMFB for Input Capture 274 HITACHI Timing of SetUng Overflow Flag (OVF): The OVF is set to 1 when the TCNT overflows from H'FFFF-H'OOOO or underflows from H'OOOO--H'FFFF. Figure 10.56 shows the timing. CK TCNT ____H_'_F_FF_F__~)(~______________H_'O_~ ________________ Overflow signal OVF OVI Figure 10.56 Timing of Setting OVF 10.5.2 Clear Timing of Status Flags The status flags are cleared by a write cycle in which I is read on the CPU and then 0 is written to it. This timing is shown in figure 10.57. TSR write cycle I.... T1 I ~.... T2 . .....I T3 I CK Address ______________ ~)(~______T_S_R_a_d_d_re_ss______~)(~_____ IMF,OVF Figure 10.57 Timing of Status Flag Clearing HITACHI 275 10.5.3 Interrupt Sources and Activating the DMAC The lTV has compare matchlinput capture A interrupts, compare matchlinput capture B interrupts and overflow interrupts for each channel. Each of the fifteen of these three types of interrupts are allocated their own independently vectored addresses. When the interrupt's interrupt request flag is set to 1 and the interrupt enable bit is set to I, the interrupt is requested. The channel priority order can be changed with the interrupt controller. For more information, see section 5, Interrupt Controller. The compare match/input capture A interrupts of channels 0-3 can start the DMAC to transfer data. Table 10.17 lists the interrupt sources. Table 10.17 lTU Interrupt Sources Interrupt DMAC Priority Channel Source Description Activation Order* 0 IMIAO Compare match or input capture AO Yes High IMIBO Compare match or input capture BO No i OVIO Overflow 0 No IMIA1 Compare match or input capture A1 Yes IMIB1 Compare match or input capture B1 No OVI1 Overflow 1 No 2 IMIA2 Compare match or input capture A2 Yes IMIB2 Compare match or input capture B2 No OVI2 Overflow 2 No 3 IMIA3 Compare match or input capture A3 Yes IMIB3 Compare match or input capture B3 No OVI3 Overflow 3 No 4 IMIA4 Compare match or input capture A4 No IMIB4 Compare match or input capture B4 No J, OVI4 Overflow 4 No Low Note: Indicates the initial status following reset. The ranking of channels can be altered using the interrupt controller. 276 HITACHI 10.6 Notes and Precautions This section describes contention and other matters requiring special attention during lTV operations. 10.6.1 Contention between TCNT Write and Clear If a counter clear signal occurs in the T3 state of a TeNT write cycle, clearing the counter takes priority and the write is not performed. The timing is shown in figure to.58. TCNT write cycle by CPU CK Address ~,--__T_C_N_T_a_d_d_re_s_s_ _~C Internal write signal Counter clear signal TCNT _ _ _ _ _N ___ -.-JX H' 0000 Figure 10.58 Contention between TCNT Write and Clear HITACHI 277 10.6.2 Contention between TCNT Word Write and Increment If an increment pulse occurs in the T3 state of a TCNT word write cycle, writing takes priority and the TCNT is not incremented. The timing is shown in figure 10.59. TCNT word write cycle by CPU I ~ T1 I .~ T2 I .~ T3 .I CK Add ress -V -.-I\'-__________ TCNT address -v-- ~ Internal write signal TCNT input clock TCNT __________~~ M _________N TCNT write data Figure 10.59 Contention between TCNT Word Write and Increment 278 HITACHI 10.6.3 Contention between TCNT Byte Write and Increment If an increment pulse occurs in the T2 state or T3 state of a TeNT byte write cycle, counter writing takes priority and the byte data on the side that was previously written is not incremented. The TeNT byte data that was not written is also not incremented and retains its previous value. The timing is shown in figure 10.60 (which shows an increment during state T2 of a byte write cycle to TeNTH). CK ---v _________V - Address -.I\~ TCNTH address ~ Internal write signal TCNT input clock ~CNTw~e ~ TCNTH M dam TCNTL X X X X+1 X Figure 10.60 Contention between TCNT Byte Write and Increment HITACHI 279 10.6.4 Contention between GR Write and Compare Match if a compare match occurs in the T3 state of a general register (GR) write cycle, writing takes priority and the compare match signal is inhibited. The timing is shown in figure 10.61. GR write cycle T1 T2 T3 CK Address ~~___G_R_a_d_d_re_s_s_ _--,X,--__ Internal write signal TCNT _______N ______ ---'X N+1 GR _ _ _ _ _N_ _ --'X ~ M / GR write data .................. Compare match signal .j+- Inhibited Figure 10.61 Contention between General Register Write and Compare Match 280 HITACHI 10.6.5 Contention between TCNT Write and OverflowlUnderfiow If an overflow occurs in the T3 state of a TeNT write cycle, writing takes priority over counter incrementing. The OVF is set to 1. The same applies to underflows. This timing is shown in figure 10.62. TCNT write cycle T1 T2 T3 11111 CK Address J . . .___T_C_N_T_a_d_d_re_s_s_---'X'-_ _ Internal write signal TCNT input clock Overflow signal TCNT _ _ _H_'F_F_F_F_ _ ---'X" M / TCNT write data OVF Figure 10.62 Contention between TCNT Write and Overflow HITACHI 281 10.6.6 Contention between General Register Read and Input Capture If an input capture signal is generated during the T3 state of a general register read cycle, the value before input capture is read. The timing is shown in figure 10.63. GR read cycle T1 T2 T3 CK Address -y.,~ ___G_R_a_d_d_re_s_s_ _--,X,-___ Internal read signal Input capture signal GR ____~X~ _______X ____M____ Internal data bus -----1('---_x---')>----- Figure 10.63 Contention between General Register Read and Input Capture 282 HITACHI 10.6.7 Contention Between Counter Clearing by Input Capture and Counter Increment If an input capture signal and counter increment signal occur simultaneously, the counter is cleared according to the input capture signal. The counter is not incremented by the increment signal. The TeNT value before the counter is cleared is transferred to the general register. The timing is shown in figure 10.64. CK Input capture signal Counter clear signal TCNT input clock TCNT N XH'OOOO GR __________~x N Figure 10.64 Contention between Counter Clearing by Input Capture and Counter Increment HITACHI 283 10.6.8 Contention between General Register Write and Input Capture If an input capture signal is generated during the T3 state of a general register write cycle, the input capture transfer takes priority and the write to the GR is not performed. The timing is shown in figure 10.65. GR write cycle T1 T2 T3 ~i CK Address ~~_ _G_R_a_d_d_re_s_s_ _--....JX~__ Internal write signal Input capture signal TCNT GR Figure 10.65 Contention between General Register Write and Input Capture 10.6.9 Note on Waveform Cycle Setting When a counter is cleared by compare match, the counter is cleared in the last state in which the TCNT value matches the GR value (when the TCNT is updated from the matching count to the next count). The actual counter frequency is therefore given by the following formula: f = q,/(N + 1) (f: counter frequency. q,: operating frequency. N: value set in the GR.) 284 HITACHI 10.6.10 Contention Between BR Write and Input Capture When a buffer register.(BR) is being used as an input capture register and an input capture signal is generated in the T3 state of the write cycle, the buffer operation takes priority over the BR write. The timing is shown in figure 10.66. SR write cycle T1 T2 T3 ~I CK Address =:xl-___ S_R_a_d_d_re_s_s_"_ _-'X'--__ Internal write signal Input capture signal '_:;;:~~ T-;-~-T-v-a-lu-e GR ______ : __ SR Figure 10.66 Contention between BR Write and Input Capture HITACHI 285 10.6.11 Note on Writing in the Synchronizing Mode After the synchronizing mode is selected, if the TCNT is written by byte access, all 16 bits of all synchronized counters assume the same value as the counter that Was addressed. Example: Figures 10.67 and 10.68 show byte write and word write when channels 2 and 3 are synchronized Write A to upper TCNT21 W X byte of channel 2 A X ... TCNT21 1 TCNT31 Y z TCNT31 A ·1 X Upper Lower Upper Lower Write A to lower byte byte byte byte --------. byte of channel 3 TC NT2 1 Y A TCNT31 Y A Upper Lower byte byte Figure 10.67 Byte Write to Channel 2 or Byte Write to Channel 3 TCNT21 W X TCNT21 A B ... TCNT31 y Z Word write of AB TCNT31 A B for channel 2 or 3 Upper Lower Upper Lower byte byte byte byte Figure 10.68 Word Write to Channel 2 or Word Write to Channel 3 10.6.12 Note on Setting Reset-synchronized PWM Mode/Complementary PWM Mode When the CMD 1 and CMDO bits of TFCR are set, note the following. 1. Writes to CMDI and CMDO should be done while TCNT3 and TCNT4 are halted. 2. Changes of setting from the reset-synchronized PWM mode to the complementary PWM mode and vice versa are inhibited. Set the reset-synchronized PWM mode or complementary PWM mode after first setting normal operation (clear CMDI bit to 0). 286 HITACHI 10.6.13 Clearing the Complementary PWM Mode Figure 10.69 shows the procedure for clearing the complementary PWM mode. First, reset the combination mode bits CMDI and CMDO in the timer function control register (TFCR) from 10 to either 00 or 01. The mode will switch from complementary PWM mode to normal operating mode. Next, wait for at least 1 clock of the counter input clock being used for channels 3 and 4 and then clear the counter start bits STR3 and STR4 of the timer start register (TSTR). The channels 3 and 4 counters TCNT3 and TCNT4 will stop counting. Clearing the complementary PWM mode by any other procedure may result in changes other than those set for the output waveform when complementary PWM mode is set again. Complementary PWM mode I 1. Clear the CMD1 bit of the TFCR to 0 Clear complementary to set channels 3 and 4 for normal operation PWMmode I 2. Wait at least 1 clock after setting channels 3 and 4 Halt count for normal operation and then clear the STR3 and STR4 bits of the TSTR to 0 to halt the TCNT3 and + Normal operation TCNT4 counters Figure 10.69 Clearing the Complementary PWM Mode 10.6.14 lTU Operating Modes Tables 10.18-10.22 show the lTV operating modes for channels 0-4. HITACHI 287 Table 10.18 lTV Operating Modes (Channel 0) Register Setting TSNC TMDR TFCR TOCR TIORO TCRO Reset Output Operat- Comp Sync Buf- Level Clear Clock Ing Mode Sync MDF FDIRPWM PWM PWM fer Select lOA lOB Select Select Synchron- SYNCO - ized preset =1 " " " " " PWM " PWMO =1 " " " Output compare A function " PWMO =0 " " " 10A2= o others free Output compare 8 function " " " " " 1082= 0, others free Input capture A function " PWMO =0 " " 10A2= 1, others free Input capture 8 function " PWMO =0 " " 1082= 1, others free Counter Clear Function Clear at compare match! " " " " CCLR1 " =0 CCLRO input =1 capture A Clear at compare match! " " " CCLR1 " =1 CCLRO input =0 capture 8 Synch- ronized clear SYNCO - =1 " " CCLR1" =1 CCLRO =1 ~: SeHable, -: Setting does not affect current mode Note: In PWM mode, the input capture function cannot be used. When compare match A and compare match 8 occur simultaneously, the compare match signal is inhibited. 288 HITACHI Table 10.19 ITU Operating Modes (Channell) Register Setting TSNC TMDR TFCR TOCR TIOR1 TCR1 Reset Output Operat- Comp Sync Buf- Level Clear Clock Ing Mode Sync MDF FDIRPWM PWM PWM fer Select lOA lOB Select Select Synch- ronized preset SYNC1 - =1 " " " " " PWM ...J PWM1 =1 ...J*1 " " Output compare A function ...J PWM1 =0 IOA2= ...J 0, others free " ...J Output ...J ...J ...J IOB2= ...J compare 0, others B function free Input capture A function ...J PWM1 =0 IOA2= ...J 1, others free " Input ...J PWM1 ...J IOB2= ...J capture B =0 1, others function free Counter Clear Function Clear at ...J ...J ...J CCLR1...J compare =0 match/ CCLRO input =1 capture A Clear at ...J ...J ...J CCLR1...J compare =1 match/ CCLRO input =0 capture B Synch- SYNC1 - ...J ...J CCLR1...J ronized =1 =1 clear CCLRO =1 ...J: Settable, -: Setting does not affect current mode Note: In PWM mode, the input capture function cannot be used. When compare match A and compare match B occur simultaneously, the compare match signal is inhibited. HITACHI 289 Table 10.20 lTV Operating Modes (Channel 2) Register Setting TSNC TMDR TFCR TOCR TIOR2 TCR2 Reset Output Operat- Comp Sync Buf- Level Clear Clock Ing Mode Sync MDF FDIRPWM PWM PWM fer Select lOA lOB Select Select Synch- ronized preset SYNC2 - =1 " " " " " PWM " PWM2 =1 " " " Output compare A function " PWM2 =0 " " " 10A2= 0, others free Output compare 8 function " " " " 1082= 0, others free Input capture A function " PWM2 =0 10A2= 1, others free " " Input capture 8 function " PWM2 =0 " 1082= 1, others free " Counter Clear Function Clear at compare match! " " " CCLR1 " =0 CCLRO input =1 capture A Clear at compare match! " " " CCLR1" =1 CCLRO input =0 capture 8 Synch- ronized clear SYNC2 - =1 " " CCLR1" =1 CCLRO =1 Phase counting " MDF " =1 " ~: Settable, -: Setting does not affect current mode " " " Note: In PWM mode, the input capture function cannot be used. When compare match A and compare match 8 occur simultaneously, the compare match signal is inhibited. 290 HITACHI Table 10.21 lTV Operating Modes (Channel 3) Register Setting TSNC TMDR TFCR TOCR TIOR3 TCR3 Reset Output Operating Comp Sync Buf- Level Clear Clock Mode Sync MDF FDIRPWM PWM PWM fer Select lOA lOB Select Select Synch- SYNC3 - v V*2 V V V v ronized =1 preset PWM v PWM3 CMD1 CMD1 v V*l V v mode =1 =0 =0 Output v PWM3 CMD1 CMD1 v 10A2= v v v compare A =0 =0 =0 0, others function free Output v v CMD1 CMD1 v v 1082 = v compare 8 =0 =0 0, oth- function ers free Input v PWM3 CMD1 CMD1 v IOA2= V V capture A =0 =0 =0 1, others function free Input v PWM3 CMD1 CMD1 v 1082 = v capture 8 =0 =0 =0 1, oth- function ers free Counter Clear Function Clear at v CMD1 V*3 v CCLR1V compare .= 1, =0 matchl CMDO CCLRO input =0 =1 capture A inhib- ited Clear at v CMD1 CMD1 v CCLR1v compare =0 =0 =1 matchl CCLRO input =0 capture 8 Synch- SYNC3 - v CMD1v v v CCLR1V ronized =1 = 1, =1 clear CMDO CCLRO =0 =1 inhib- ited HITACHI 291 Table 10.21 lTV Operating Modes (Channel 3) (cont) Counter Clear Function Register Setting TSNC TMDR TFCR TOCR TIOR3 TCR3 Reset Output Operating Comp Sync Buf- Level Clear Clock Mode Sync MDF FDIRPWM PWM PWM fer Select lOA lOB Select Select ,,*2 " Comple- CMD1 CMD1" CCLR1,,*4 mentary =1 =1 =0 PWM CMDOCMDO CCLRO mode =0 =0 =0 Reset synchron- ized PWM " CMD1 CMD1" = 1 =1 CMDOCMDO " CCLR1" =0 CCLRO mode =1 =1 =1 Buffer (BRA) " " " " BFA3 - = 1, others " " " free Buffer (BRB) " " " = BFB3 - 1, others " " " " free ,,: Settable, -: Setting does not affect current mode Notes: 1. In PWM mode, the input capture function cannot be used. When compare match A and compare match B occur simultaneously, the compare match signal is inhibited. 2. When set for complementary PWM mode, do not simultaneously set channel 3 and channel 4 to function synchronously. 3. Counter clearing by input capture A cannot be used when the reset-synchronized PWM mode is set. 4. Clock selection when the complementary PWM mode is set should be the same for channels 3 and 4. 292 HITACHI Table 10.22 lTU Operating Modes (Channel 4) Register Setting TSNC TMDR TFCR TOCR TlOR4 TCR4 Reset Output Operating Comp Sync Buf· Level Clear Clock. Mode Sync MDF FDIR PWM PWM PWM fer Select lOA lOB Select Select Synch- SYNC4- " ronized =1 preset ,,*1 PWM " PWM4 CMD1 CMD1 " =1 =0 =0 " " Output compare A function " PWM4 CMD1 CMD1 " =0 =0 =0 10A2= 0, others free " " " " " Output " CMD1 CMD1 " 1082 = " compare 8 =0 =0 0, function others free " Input 10A2= capture A function PWM4 CMD1 CMD1 " =0 =0 =0 1, others free " " Input capture 8 function " PWM4 CMD1 CMD1 " =0 =0 =0 1082 = " 1, others free Counter Clear Function Clear at compare match/ " CMD1,,*3 = 1, CMDO " CCLR1" =0 CCLRO input =0 =1 capture A inhibit ed " Clear at CMD1,,*3 " CCLR1" compare = 1, =1 match/ CMDO CCLRO input =0 =0 capture 8 inhibit ed HITACHI 293 Table 10.22 lTV Operating Modes (Channel 4) (cont) Counter Clear Function Register Setting TSNC TMDR TFCR TOCR TIOR4 TCR4 Reset Output Operating Comp Sync Buf- Level Clear Clock Mode Sync MDF FDIR PWM PWM PWM fer Select lOA lOB Select Select Synch- SYNC4- ~ CMD1 ~*3 ~ CCLR1 ~ ronized =1 = 1, =1 clear CMD1 CCLRO =0 =1 inhibit ed Comple- ~*2 CMD1 CMD1 ~ CCLR1 ~*4 mentary =1 = 1 =0 PWM CMDOCMDO CCLRO =0 =0 =0 Reset ~ CMD1 CMD1 ~ ~ synchron- =1 =1 ized PWM CMDOCMDO =1 =1 Buffer ~ ~ ~ .~ BFA4- (BRA) = 1, others free Buffer BFB4 - (BRB) = 1, others free ~: Settable, -: Setting does not affect current mode Notes: 1. In PWM mode, the input capture function cannot be used. When compare match A and compare match B occur simultaneously, the compare match signal is inhibited. 2. When set for complementary PWM mode, do not simultaneously set channel 3 and channel 4 to function synchronously. 3. Counter clearing works with the reset-synchronized PWM mode, but TCNT4 runs independently. The output waveform is not affected. 4. Clock selection when the complementary PWM mode is set should be the same for channels 3 and 4. 5. In the reset-synchronized PWM mode, TCNT4 runs independently. The output waveform is not affected. 294 HITACHI Section 11 Programmable Timing Pattern Controller 11.1 Overview The SH microcomputer has a built-in programmable timing pattern controller (TPC). The TPC can provide pulse outputs by using the 16-bit integrated-timer pulse unit (lTU) as a time base. The TPC pulse outputs are divided into 4-bit groups 3-0. These can operate simultaneously, or independently. 11.1.1 Features Features of the programmable timing pattern controller are listed below: • 16-bit output data: Maximum 16-bit data can be output. TPC output can be enabled on a bit-by- bit basis. • Four output groups: Output trigger signals can be selected in 4-bit groups to provide up to four different 4-bit outputs. • Selectable output trigger signals: Output trigger signals can be selected by group from the 4-channel compare-match signals of the 16-bit integrated-timer pulse unit (lTU). • Non-overlap mode: A non-overlap interval can be set to come between multiple pulse outputs. • Can connect to DMA controller: The compare-match signals selected as output trigger signals can activate the DMA controller for sequential output of data without CPU intervention. I HITACHI 295 11.1.2 Block Diagram Figure 11.1 is the block diagram of the TPc. ----------------------------------------------------, I ITU compare match signal I I I I I I I /' PBCR1 PBCR2 I NDERA NDERB ~ Control logic T TPMR TPCR TP15 +- Internal TP14 +- Pulse output p data TP12 := . . . . . . . . . . . . TP13 +- pin group 3 TP11 ....... NDRB····· I I I bus TP10 +- Pulse output 0 TPS := . . . . . . . . . . . . TP9 +- pin group 2 TP7 PBDR I I TP6 +- Pulse output ~ TP4 := . . . . . . . . . . . . TP5 +- pin group 1 TP3 ....... NDRA··· .. .. YI I I TP2 +- Pulse output I TP1 TPO := pin group 0 Q I I 'v ~-------------------------------------------TPC-----~ TPMR: TPC output mode register PBCR1: Port B control register 1 TPCR: TPC output control register PBCR2: Port B control register 2 NDERB: Next data enable register B NDRB: Next data register B NDERA: Next data enable register A NDRA: Next data register A PBDR: Port B data register Figure 11.1 TPC Block Diagram 296 HITACHI 11.1.3 Input/Output Pins Table 11.1 summarizes the TPC input/output pins. Table 11.1 TPC Pins Name Symbol Input/Output Function TPC output 0 TPO Output Group 0 pulse output TPC output 1 TP1 Output TPC output 2 TP2 Output TPC output 3 TP3 Output TPC output 4 TP4 Output Group 1 pulse output TPC output 5 TP5 Output TPC output 6 TP6 Output TPC output 7 TP7 Output TPC output 8 TP8 Output Group 2 pulse output TPC output 9 TP9 Output TPC output 10 TP10 Output TPC output 11 TP11 Output TPC output 12 TP12 Output Group 3 pulse output TPC output 13 TP13 Output TPC output 14 TP14 Output TPC output 15 TP15 Output HITACHI 297 11.1.4 Registers Table 11.2 summarizes the TPC registers. Table 11.2 TPC Registers Initial Access Name Abbreviation RJW Value Address*1 Size' Port B control register 1 PBCR1 RJW H'OOOO H'SFFFFCC 8,16 Port B control register 2 PBCR2 RJW H'OOOO H'SFFFFCE 8,16 Port B data register PBOR R/(W)*2 H'OOOO H'5FFFFC2 8, 16 TPC output mode register TPMR RJW H'FO H'5FFFFFO 8,16 TPC output control register TPCR RJW H'FF H'5FFFFF1 8, 16 Next data enable register B NOERB RJW H'OO H'5FFFFF2 8,16 Next data enable register A NOERA RJW H'OO H'SFFFFF3 8,16 Next data register A NORA RIW H'OO H'SFFFFF5/ 8, 16 H'5FFFFF7*3 Next data register B NORB RIW H'OO H'5FFFFF4/ 8, 16 H'5FFFFF6*3 Notes: 1. Only the values of bits A27-A24 and A8-AO are valid; bits A23-A9 are ignored. For details on the register addresses, see section 8.3.5, Description of Areas. 2. Bits used for TPC output cannot be written to. 3. These addresses change depending on TPCR settings. When TPC output groups 0 and 1 have the same output trigger, the NORA address is H'SFFFFFS; when their output triggers are different, the NORA address for group 0 is H'SFFFFF7 and the address for group 1 is H'SFFFFFS. Likewise, when TPC output groups 2 and 3 have the same output trigger, the NORB address is H'SFFFFF4; when their output triggers are different, the NORB address for group 0 is H'5FFFFF6 and the address for group 1 is H'SFFFFF4. 298 HITACHI 11.2 Register Descriptions 11.2.1 Port B Control Registers I and 2 (PBCRI, PCBR2) The port B control register 1 and 2 (PBCR 1 and PBCR2) are 16-bit read/write registers that set the functions of port B pins. Port B consists of the dual use pins TPI5-TPO. Bits corresponding to the pins to be used for TPC output must be set to 1. For details, see the port B description in the section 15, Pin Function Controller. PCBRI: Bit: 15 14 13 12 11 10 9 8 Bit name: Initial value: 0 o o o o o o o R/W: RIW RIW RIW RIW RIW RIW RIW R/W Bit: 7 6 5 4 Bit name: PB10 PB10 M01 MOO Initial value: 0 o o o o o o o RIW: RIW RIW RIW R/W RIW RIW RIW RIW PCBR2: Bit: 15 14 13 12 11 10 9 8 Bit name: I PB7M011 PB7MOO I PB6M011 PB6MOO I PB5M011 PB5MOoI PB4M011 PB4MOoI Initial value: 0 0 0 0 0 0 0 0 R/W: R/W R/W RIW RIW RIW RIW R/W RIW Bit: 7 6 5 4 3 2 1 0 I Bit name: I PB3M011 PB3MOO I PB2M011 PB2MOO PB1 M011 PB 1MOol PBOM011 PBOMOol Initial value: 0 0 0 0 0 0 0 0 R/W: RIW RIW RIW RIW RIW RIW R/W RIW HITACHI 299 11.2.2 Port B Data Register (PBDR) The port B data register is a 16-bit read/write register that, when used for TPC output stores, output data for groups 0-3. For details, see the port B description in section 16, I/O Ports. Bit: 15 14 13 12 11 10 9 B Bit name: IPB15DRI PB14DRlpB13DRI PB12DRI PB11DRlpB10DRI PB9DR I PBBDR I Initial value: 0 o 0 o o o o o RIW: R/(W)* R/(W)* R/(W)* R/(W) * R/(W)* R/(W)* R/(W)* R/{W)* Note: Bits set to TPC output by NDERA or NDERB are read-only. Bit: 7 6 5 4 3 2 1 0 Bit name: I PB7DR I PB6DR I PB5DR IPB4DR I PB3DR I PB2DR I PB1DR I PBODR I Initial value: 0 0 0 0 0 0 0 0 RIW: R/{W)* R/(W)* R/(W) * R/(W) * R/(W)* R/(W)* R/(W)* R/(W) * Note: Bits set to TPC output by NDERA or NDERB are read-only. 11.2.3 Next Data Register A (NDRA) NDRA is an eight-bit read/write register that stores the next output data for TPC output groups 1 and 0 (TP7-TPO). When used for TPC output, the contents of the NDRA are transferred to the corresponding PBDR bits when the ITU compare match specified in the TPC output control register TPCR occurs. The address of the NDRA differs depending on whether TPCR settings select the same trigger or different triggers for TPC output groups 1 and O. When reset, NDRA is initialized to H'OO. It is not initialized by standby mode. Same Trigger for TPC Output Groups 1 and 0: If TPC output groups 1 and 0 are triggered by the same compare match, the address of the NDRA is H'FFFFF5. The 4 upper bits becomes group 1 and the 4 lower bits become group o. Address H'5FFFFF7 in such cases consists entirely of reserved bits. These bits cannot be modified and always read as 1. Address H'5FFFFF5: • Bits 7-4 (next data 7-4 (NDR7-NDR4»: NDR7-NDR4 store the next output data for TPC output group 1. • Bits 3-0 (next data 3-0 (NDR3-NDRO»: NDR3-NDRO store the next output data for TPC output group O. 300 HITACHI Bit: 7 6 5 4 3 2 a Bit name: I NOR7 NOR6 NOR5 NOR4 NOR3 NOR2 NOR1 NORa Initial value: a a 0 0 a 0 0 0 R1W: RIW RIW RIW RIW RIW RIW RIW RIW Address H'SFFFFF7: • Bits 7-0 (reserved): These bits always read as 1. The write value should always be 1. Bit: 7 6 5 4 3 .2 a Bitname:I~----~------~----~-----'------'-----'------'-----' Initial value: R1W: Different Triggers for TPC Output Groups 1 and 0: If TPC output groups I and 0 are triggered by different compare matches, the address of the upper 4 bits of NDRA (group 1) is H'SFFFFFS and the address of the lower 4 bits of NDRA (group 0) is H'SFFFFF7. Bits 3-0 of address H'SFFFFFS and bits 7-4 of address H'SFFFFF7 are reserved bits. The write value should always be 1. These bits always read as 1. Address H'SFFFFFS: • Bits 7-4 (next data 7-4 (NDR7-NDR4»: NDR7-NDR4 store the next output data for TPC output group 1. • Bits 3-0 (reserved): These bits always read as 1. The write value should always be 1. Bit: 7 6 5 4 3 2 a Bit name: I NOR7 NOR6 NOR5 NOR4 Initial value: a 0 0 0 R1W: RIW RIW RIW RIW Address H'SFFFFF7: • Bits 7-4 {reserved): These bits always read as 1. The write value should always be 1. • Bits 3-0 (next data 3-0 (NDR3-NDRO»: NDR3-NDRO store the next output data for TPC output group O. HITACHI 301 Bit: 7 6 5 4 3 2 0 Bit name: I NDR3 NDR2 NDR1 NDRO Initial value: 0 0 0 0 RIW: RIW RIW RIW RIW 11.2.4 Next Data Register B (NDRB) NDRB is an eight-bit read/write register that stores the next output data for TPC output groups 3 and 2 (TPIS-TP8). When used for TPC output, the contents of the NDRB are transferred to the corresponding PBDR bits when the ITU compare match specified in the TPC output control register TPCR occurs. The address of the NDRB differs depending on whether TPCR settings select the same trigger or different triggers for TPC output groups 3 and 2. When reset, NDRB is initialized to H'OO. It is not initialized by standby mode. Same Trigger for TPC Output Groups 3 and 2: If TPC output groups 3 and 2 are triggered by the same compare match, the address of the NDRB is H'FFFFF4. The 4 upper bits becomes group 3 and the 4 lower bits become group 2. Address H'SFFFFF6 becomes completely reserved bits. These bits always read as I, and the write value should always be I. Address H'SFFFFF4: • Bits 7-4 (next data 15-12 (NDRIS-NDRI2»: NDR 1S-NDRI 2 store next output data for TPC output group 3. • Bits 3-0 (next data 11-8 (NDR Il-NDR8»: NDR Il-NDR8 store next output data for TPC output group 2. Bit: 7 6 5 4 3 2 0 Bit name: I NDR15 I NDR14 INDR13 I NDR12 I NDR11 I NDR10 I NDR9 NDR8 Initial value: 0 0 0 0 0 0 0 0 RIW: RIW RIW RIW RIW RIW RIW RIW RIW Address H'SFFFFF6: • Bits 7-0 (reserved): These bits always read as 1. The write value should always be 1. 302 HITACHI Bit: 7 6 5 4 3 2 o Bit name: rI - - - - - , - - - - - - , - - - - - , - - - - - - , - - - - - - , - - - - - , - - - - - - , - - - - - , Initial value: RIW: DitTerent Triggers for TPC Output Groups 3 and 2: If TPC output groups 3 and 2 are triggered by different compare matches, the address of the upper 4 bits of NDRB (group 3) is H'5FFFFF4 and the address of the lower 4 bits of NDRB (group 2) is H'5FFFFF6. Bits 3-0 of address H'5FFFFF4 and bits 7-4 of address H'5FFFFF6 are reserved bits. These bits always read as I. The write value should always be I. Address H'5FFFFF4: • Bits 7-4 (next data 15-12 (NDRI5-NDRI2»: NDR15-NDRI2 store next output data for TPC output group 3. • Bits 3-0 (reserved): These bits always read as 1. The write value should always be 1. Bit: 7 6 5 4 3 2 0 Bit name: I NOR15 I NOR14 I NOR13 I NOR12 I Initial value: 0 0 0 0 RIW: RIW RIW RIW RIW Address H'5FFFFF6: • Bits 7-4 (reserved): These bits always read as 1. The write value should always be 1. • Bits 3-0 (next data 11-8 (NDRII-NDR8»: NDRII-NDR8 store next output data for TPC output group 2. Bit: 7 6 5 4 3 2 0 Bit name: I NOR11 I NOR10 I NOR9 NORa Initial value: 0 0 0 0 RIW: RIW RIW RIW RIW HITACHI 303 11.2.5 Next Data Enable Register A (NDERA) NDERA is an eight-bit read/write register that enables TPC output groups 1 and 0 (TP7-TPO) on a bit-by-bit basis. When the bits enabled for TPC output by NDERA generate the ITV compare match selected in the TPC output control register, the value of the next data register A (NDRA) is automatically transferred to the corresponding PBDR bits and the output value is updated. For disabled bits, there is no transfer and the output value does not change. When reset, NDERA is initialized to H'OO. It is not initialized by standby mode. Bit: 7 6 S 4 3 2 1 0 Bit name: I NDER71 NDER61 NDERSI NDER41 NDER31 NDER21 NDER1 INDERO I Initial value: 0 0 0 0 0 0 0 0 RIW: RIW RIW RIW RIW RIW RIW RIW RIW • Bits 7-0 (next data enable 7-0 (NDER7-NDERO»: NDER7-NDERO select enable/disable for TPC output groups 1 and 0 (TP7-TPO) in bit units. Bit 7~: NDER7-NDERO Description o Disables TPC outputs TP7-TPO (transfer from NDR7-NDRO to PB7- PBO is disabled) (initial value) Enables TPC outputs TP7-TPO (transfer from NDR7-NDRO to PB7- PBO is enabled) 11.2.6 Next Data Enable Register B (NDERB) NDERB is an eight-bit read/write register that enables TPC output groups 3 and 2 (TPlS-TP8) on a bit-by-bit basis. When the bits enabled for TPC output by NDERB generate the lTV compare match selected in the TPC output control register, the value of the next data register B (NDRB) is automatically transferred to the corresponding PBDR bits and the output value is updated. For disabled bits, there is no transfer and the output value does not change. When reset, NDERB is initialized to H'OO. It is not initialized by standby mode. Bit: 7 6 S 4 3 2 1 0 Bit name: INDER1s1 NDER141NDER131 NDER121 NDER111NDER101 NDER91 NDERSI Initial value: 0 0 0 0 0 0 0 0 RIW: RIW RIW RIW RIW RIW RIW RIW RIW 304 HITACHI • Bits 7-0 (next data enable 15-8 (NDERI5-NDER8»: NDER1 5-NDER8 select enable/disable for TPC output groups 3 and 2 (TPI5-TP8) in bit units. Bit 7-0: NDER15-NDER8 Description o Disables TPC outputs TP15-TP8 (transfer from NDR15-NDR8 to PB15-PB8 is disabled) (initial value) Enables TPC outputs TP15-TP8 (transfer from NDR 15-NDR8 to PB 15-PB8 is enabled) 11.2.7 TPC Output Control Register (TPCR) TPCR is an eight-bit read/write register that selects output trigger signals for TPC outputs. When reset, TPCR is initialized to H'FF. It is not initialized by standby mode. Bit: 7 6 5 4 3 2 1 0 Bit name: IG3CMS 11 G3CMSOIG2CMS 11 G2CMSOi G 1CMS llG 1CMSoi GOCMS llGOCMSOi Initial value: 1 1 1 1 RIW: RIW RIW RIW RIW RIW RIW RIW RIW • Bits 7 and 6 (group 3 compare-match select 1 and 0 (G3CMSI and G3CMSO»: G3CMSI and G3CMSO select the compare match that triggers TPC output group 3 (TPI5-TPI2). Bit 7: G3CMS1 Bit 6: G3CMSO Descr.iption o o TPC output group 3 (TP15-TP12) output is triggered by compare-match in ITU channel 0 TPC output group 3 (TP15-TP12) output is triggered by compare-match in ITU channel 1 o TPC output group 3 (TP15-TP12) output is triggered by compare-match in ITU channel 2 TPC output group 3 (TP15-TP12) output is triggered by compare-match in ITU channel 3 (initial value) HITACHI 305 • Bits 5 and 4 (group 2 compare-match select 1 and 0 (G2CMSl and G2CMSO»: G2CMSI and G2CMSO select the lTV channel that triggers TPC output group 2 (TPII-TPS). Bit 5: G2CMS1 Bit 4: G2CMSO Description o o TPC output group 2 (TP11-TP18) output is triggered by compare-match"in ITU channel 0 TPC output group 2 (TP11-TP18) output is triggered by compare-match in ITU channel 1 o TPC output group 2 (TP11-TP18) output is triggered by compare-match in ITU channel 2 TPC output group 2 (TP11-TP18) output is triggered by compare-match in ITU channel 3 (initial value) • Bits 3 and 2 (group 1 compare-match select 1 and 0 (GICMSI and GICMSO»: GICMSI and GICMSO select the lTV channel that triggers TPC output group I (TP7-TP4). Bit 3: G1CMS1 Bit 2: G1CMSO Description o 0 TPC output group 1 (TP7-TP4) output is triggered by compare-match in ITU channel 0 TPC output group 1 (TP7-TP4) output is triggered by compare-match in ITU channel 1 o TPC output group 1 (TP7-TP4) output is triggered by compare-match in ITU channel 2 TPC output group 1 (TP7-TP4) output is triggered by compare-match in ITU channel 3 (initial value) • Bits 1 and 0 (group 0 compare-match select 1 and 0 (GOCMS 1 and GOCMSO»: GOCMS 1 and GOCMSO select the lTV channel that triggers TPC output group 0 (TP3-TPO). Bit 1: GOCMS1 Bit 0: GOCMSO Description o o TPC output group 0 (TP3-TPO) output is triggered by compare-match in ITU channel 0 TPC output group 0 (TP3-TPO) output is triggered by compare-match in ITU channel 1 o TPC output group 0 (TP3-TPO) output is triggered by compare-match in ITU channel 2 TPC output group 0 (TP3-TPO) output is triggered by compare-match in ITU channel 3 (initial value) 306 HITACHI 11.2.8 TPC Output Mode Register (TPMR) TPMR is an eight-bit read/write register that selects between the TPC's ordinary output and non- overlap output modes in group units. During non-overlap operation, the output waveform cycle is set in ITU general register B (GRB) for use as the output trigger and a non-overlap period is set in general register A (GRA). The output value then changes on compare matches A and B. For details, see section 11.3.4, TPC Output Non-Overlap Operation. TPMR is initialized to H'FO on a reset. It is not initialized in standby mode. Bit: 7 6 5 4 3 2 1 a Bit name: I I G3NOV I G2NOV I G1NOV I GaNOV I Initial value: a a a a R/W: R/W R/W R/W R/W • Bits 7-4 (reserved): These bits always read as 1. The write value should always be 1. • Bit 3 (group 3 non-overlap mode (G3NOV»: G3NOV selects the ordinary or non-overlap mode for TPC output group 3 (TP15-TP12). Bit 3: G3NOV Description a TPC output group 3 operates normally (output value updated according to compare-match A of the ITU channel selected by TPCR) (initial value) TPC output group 3 operates in non-overlap mode (1 output and a output can be performed independently according to compare-match A and B of the ITU channel selected by TPCR) • Bit 2 (group 2 non-overlap mode (G2NOV»: G2NOV selects the ordinary or non-overlap mode for TPC output group 2 (TP 11-TP8). Bit 2: G2NOV Description a TPC output group 2 operates normally (output value updated according to compare-match A of the ITU channel selected by TPCR) (initial value) TPC output group 2 operates in non-overlap mode (1 output and 0 output can be performed independently according to compare-match A and B of the ITU channel selected by TPCR) HITACHI3a7 • Bit 1 (group -1 non-overlap mode (G INDV»: G INDV selects the ordinary or non-overlap mode for TPC output group 1 (TP7-TP4). Bit 1: G1NOV Description o . TPC output group 1 operates normally (output value updated according to compare-match A of the ITU channel selected by TPCR) (initial value) TPC output group 1 operates in non-overlap mode (1 output and 0 output can be performed independently according to compare-match A and B of the ITU channel selected by TPCR) • Bit 0 (group 0 non-overlap mode (GONDV»: GONDV selects the ordinary or non-overlap mode for TPC output group 0 (TP3-TPO). Bit 0: GONOV Description o TPC output group 0 operates normally (output value updated according to compare-match A of the ITU channel selected by TPCR) (initial value) TPC output group 0 operates in non-overlap mode (1 output and 0 output can be performed independently according to compare-match A and B of the ITU channel selected by TPCR) 11.3 Operation 11.3.1 Overview When corresponding bits in the PBCRI, PBCR2, NOERA and NOERB registers are set to 1, TPC output is enabled and the PBOR data register values are output. After that, when the compare- match event selected by TPCR occurs, the next data register contents (NORA and NORB) are transferred to the PBOR and output values are updated. Figure 11.2 illustrates the TPC output operation. 308 HITACHI CR NOER Q Output trigger j signal D TPC output pin Port function select Q DR o Q NOR Internal o +- data bus Figure 11.2 TPC Output Operation If new data is written in next data registers A and B before the next compare-match occurs, a maximum 16 bits of data can be output at each successive compare-match. See section 11.3.4, TPC Output Non-Overlap Operation, for details on non-overlap operation. 11.3.2 Output Timing IfTPC output is enabled, next data register (NDRAINDRB) contents are transferred to the data register (PBDR) and output when the selected compare-match occurs. Figure 11.3 shows the timing of these operations. The example is of ordinary output upon compare match A with groups 2 and 3. HITACHI 309 CK TCNT ____~X~____ N____~X~ ___ N_+_1__~X~ ________ GRA N Compare match A signal NDRB n " S "":; PBDR m X n TP15-TP8 m X n Figure 11.3 Transfer and Output Timing for NOR Data 11.3.3 Examples of Use of Ordinary TPC Output Settings for Ordinary TPC Output (figure 11.4): 1. Select GRA as the output compare register (output disable) with the timer 110 control register (TIOR). 2. Set the TPC output trigger cycle. 3. Select the counter clock with the TPSC2-TPSCO bits of the timer control register (TCR). Select the counter clear sources with the CCLR I and CCLRO bits. 4. Set the timer interrupt enable register (TIER) to enable IMIA interrupts. Transfers to the NOR can also be set using the OMAC. 5. Set the initial output value in the 110 port data register to be used by TPC. 6. Set the 110 port control register to be used by TPC as the TP pin function (11). 7. Set to 1 the bit that performs TPC output to the next data enable register (NOER). 8. Select the ITU compare match that will be the TPC output trigger using the TPC output control register (TPCR). 9. Set the next TPC output value in the NOR. 10. Set 1 in the STR bit of the timer start register (TSTR) and start the timer counter counting. 11. Set the next output value in the. NOR whenever an IMIA interrupt is generated. 310 HITACHI Original TPC output operation Select GR function CD Set GRA ® ITU setting Set count operation ® Select interrupt request 0 Set initial output value ® Set port output ® Port and TPC Set TPC output enable (j) setting Select TPC output trigger ® Set next TPC output value ® ITU setting Start count @ Set next TPC output value @ Figure 11.4 Example of Setting Procedure for TPC Ordinary Output HITACHI 311 Five-Phase Pulse Output (figure 11.5): I.. Set the GRA of the ITU that serves as output trigger as the output compare register. Set the cycle time in the GRA of the lTV and select to clear the counter upon compare match A. Set the IMIEA bit of TIER to 1 to enable the compare match A interrupt. 2. Write H'FFCO in the PBCRI, write H'FS in the NDERB, and set G3CMSO, G3CMSI, G2CMS 1 and G2CMSO in the TPCR to set the lTV compare match selected in step I as the output trigger. Write output data H'SOin the NDRB. 3. When the selected lTV channel starts operating and a compare-match occurs, the values in the NDRB are transferred to the PBDR and output. The compare-match/input capture A (IMIA) interrupt service routine writes the next output data (H'CO) in the NDRB. 4. Five-phase pulse output can be obtained by writing H'40, H'60, H'20, H'30, H'lO, H'IS, H'OS, H'8S ... at successive compare-match interrupts. If the DMA controller is set for activation by compare-match, pulse output can be obtained without loading the CPU. TCNT G:f - H'QOOQ . T i m e I I I I I I I I i I I I I NORB PBOR I I TP15 --J ~ TP14 TP13 TP12 TP11 Figur~ 11.5 TPC putput Example (S-Phase Pulse Output) 312 HITACHI 11.3.4 TPC Output Non-Overlap Operation Setting Procedures for TPC Output Non-Overlap Operation (figure 11.6): 1. Select GRA and GRB as output compare registers (output disable) with the timer I/O control register (TIOR). 2. Set the TPC output trigger cycle to GRB and the non-overlap cycle to GRA. 3. Select the counter clock with the TPSC2-TPSCO bits of the timer control register (TCR). Select the counter clear sources with the CCLR I and CCLRO bits. 4. Set the timer interrupt enable register (TIER) to enable IMIA interrupts. Transfers to the NOR can also be set using the DMAC. 5. Set the initial output value in the I/O port data register to be used by TPC. 6. Set the I/O port control register to be used by TPC as the TP pin function (\ I). 7. Set to I the bit that performs TPC output to the next data enable register (NOER). 8. Select the ITU compare match that will be the TPC output trigger using the TPC output control register (TPCR). 9. Select the group that performs the non-overlap operation in the TPC output mode register (TPMR). 10. Set the next TPC output value in the NOR. 11. Set 1 in the STR bit of the timer start register (TSTR) and start the timer counter counting .. 12. Set the next output value in the NOR whenever an IMIA interrupt is generated. HITACHI 313 Select GR function CD Set GRA ® ITU setting Set count operation ® CD ® ® ® Port and TPC setting Select TPC output trigger ® Select non-overlap group ® @ Start count @ ITU setting No Yes Set next TPC output value @ Figure 11.6 Example of Setting Procedures for TPC Output Non-Overlap Operation 314 HITACHI TPC Output Non-Overlap Operation (Four-Phase Complementary Non-Overlap Output) (figure 11.7): 1. Set GRA and GRB of the ITU that serves as output trigger in the output compare registers. Set the cycle in the GRB and the non-overlap cycle time in the GRA and select to clear the counter upon compare match B. Set the IMIEA bit of TIER to 1 to enable the IMIA interrupt. 2. Write H'FFFF in the PBCR I, write H'FF in the NOERB, and set G3CMS I, G3CMSO, G2CMS I and G2CMSO in the TPCR to set the ITU compare match selected in step I as the output trigger. Set the G3NOV and G2NOV bits in the TPMR to 1 to set the non-overlap operation. Write output data H'95 in the NORB. 3. When the selected ITU channel starts operating and a GRB compare-match occurs, 1 output ° changes to output; when a GRA compare match occurs, 0 output changes to 1 output. (The change from 0 output to 1 output is delayed by the value set in GRA.) The IMIA interrupt service routine writes the next output data (H'65) in the NORB. 4. Four-phase complementary non-overlap output can be obtained by writing H'S9, H'S6, H'9S ... at successive IMIA interrupts. If the DMA controller is set for activation by compare-match, pulse output can be obtained without loading the CPU. HITACHI 315 TCNT value GRB GRA H'OOOO I I I I I NORB :65 !X 1 59 :X ]56 :X I I 95 !X i 65 :X I I I PBOR 100 1 I I I I TP15 ____~~~~:4--·~i-N--o-n+:o-v-e-r~ia-p--c-Yr~l-e~----+_~~~I__~__~__~ I i I I I I I I I I I I I I TP14 I I I I --...;---;...---+1----4 I , I TP13 --~--+I--~:-~~r:-~--_r-_+--_r-_+--_r-~~ TP12 ' --..!--.In I I I : I ir---' ,I-_....' ___ : I : : I I : r I I TP11 __~~~~__~r-l~-..!-~__~~~--+~ I TP10 I TP9 ----r---r---~---r----~--r_--~--~~~i---r----~--r---~---r TP8 Figure 11.7 Non-Overlap Output Example (Four-Phase Complementary Output) 316 HITACHI 11.3.5 TPC Output by Input Capture TPC can also be output by using input capture rather than ITU compare matches. The general register A (GRA) of the ITU selected by the TPCR functions as an input capture register and TPC output occurs upon an input capture signal. Figure 11.8 shows the timing. CK TICC pin _ _ _ _ _ _ _~ Input ~..,1----, capture . signal - - - - - - - - - - - - - - ' '-------------- NDR N DR----------M--~~~N Figure 11.8 TPC Output by Input Capture HITACHI 317 11.4 Usage Notes 11.4.1 Non-Overlap Operation During ~on-overlap operation, transfers from the NDR to data registers (DR) occurs as follows. 1. NDR contents are always transferred to the DR on compare match A. 2. The contents of the bit transferred by the NDR are only transferred on compare match B when they are O. No transfer occurs for a I. Figure 11.9 illustrates the TPC output operation during non-overlap. CR NDER Q f - - - - - Compare match A Compare match B D Port function select TPC output pin ......- - - -...... Q DR D 1+------'--1 Q NDR D Figure 11.9 TPC Output Non-Overlap Operation 318 HITACHI When a compare match B occurs before the compare match A, the 0 data transfer can be performed before the 1 data transfer, so a non-overlapping waveform can be output. In such cases, be sure not to change the NOR contents until the compare match A after the compare match B occurs (non-overlap period). This can be ensured by writing the next data to the NOR using the IMIA interrupt service routine. The OMAC can also be started up using an IMIA interrupt. However, these write operations should be performed prior to the next compare match B. The timing is shown in figure 11.10. Compare match A ____~Il~________~Il~________ Compare match B : NOR write NOR write + ----~--~~X~------~----~X~----- + NOR OR ____\~X~________\~X~______ ooutput 0/1 output ooutput 0/1 output ~I" ~I" NOR write period ~I" ~I" NOR write period NOR write NOR write disable period disable period Figure 11.10 Non-Overlap Operation and NDR Write Timing HITACHI 319 Section 12 Watchdog Timer 12.1 Overview The SH microcomputer has a one-channel watchdog timer (WDT) for monitoring system operations. If a system becomes uncontrolled and the timer counter overflows without being rewritten correctly by the CPU, an overflow signal (WDTOVF) is output externally. The WDT can simultaneously generate an internal reset signal for the entire chip. When this watchdog function is not needed, the WDT Can be used as an interval timer. In the interval timer operation, an interval timer interrupt is generated at each counter overflow. The WDT is also used in recovering from the standby mode. 12.1.1 Features • Watchdog timer mode and interval timer mode can be selected. • Outputs WDTOVF in the watchdog timer mode. When the counter overflows in the watchdog timer mode, overflow signal WDTOVF is output externally. You can select whether or not to reset the chip internally when this happens. Either the power-on reset or manual reset signal can be selected as the internal reset signal. • Generates interrupts in the interval timer mode. When the counter overflows, it generates an interval timer interrupt. • Used to clear the standby mode. • Selection of eight counter clock sources I HITACHI 321 12.1.2 Block Diagram Figure 12.1 is the block diagram of the WDT. ,---------------------------------------------1 ITI Owfuw ~ (interrupt 4>/64 signal) 4>/128 Clock Clock 4>/256 select 4>/512 cp/1024 WOTOVF 4>/4096 Internal control 4>/8192 reset signal* Internal clock sources Bus I ~ __________ ~~~~~ Module bus ____________J interface I I ----------------------- WOT ------------------ I TCSR: Timer control/status register TCNT: Timer counter RSTCSR: Reset control/status register Note: The internal reset signal can be generated by setting the register. The type of reset can be selected (power-on or manual resets). Figure 12.1 WDT Block Diagram 12.1.3 Pin Configuration Table 12.1 shows the pin configuration. Table 12.1 Pin Configuration Pin Abbreviation I/O Function Watchdog timer overflow WOTOVF o Outputs the counter overflow signal in the watchdog mode 322 HITACHI 12.1.4 Register Configuration Table 12.2 summarizes the three WDT registers. They are used to select the clock, switch the WDT mode, and control the reset signal. Table 12.2 WDT Registers Initial Address Name Abbreviation RIW Value Wrlte*1 Timer control/status register TCSR RI(W)*3 H'18 H'5FFFFB8 H'5FFFFB8 Timer counter TCNT RIW H'OO H'SFFFFB9 Reset control/status register RSTCSR RI(W)*3 H'3F H'SFFFFBA H'SFFFFBB Notes: 1. Write by word transfer. It cannot be written in byte or long word. 2. Read by byte transfer. It cannot be read in word or long word. 3. Only 0 can be written in bit 7 to clear the flag. 12.2 Register Descriptions 12.2.1 Timer Counter (TCNT) The TCNT is an eight-bit readable and writable upcounter. The TCNT differs from other registers in that it is more difficult to write. See section 12.2.4, Register Access, for details. When the timer enable bit (TME) in the timer control/status register (TCSR) is set to I, the timer counter starts counting pulses of an internal clock source selected by clock select bits 2-0 (CKS2-CKSO) in the TCSR. When the value of the TCNT overflows (changes from H'FF-H'OO), a watchdog timer overflow signal (WDTOVF) or interval timer interrupt (ITI) is generated, depending on the mode selected in the WTlIT bit of the TCSR. The TCNT is initialized to H'OO by a reset and when the TME bit is cleared to O. It is not initialized in the standby mode. Bit: 7 6 S 4 3 2 0 Bit name: I Initial value: 0 0 0 0 0 0 0 0 RIW: RIW RIW RIW RIW RIW RIW RIW RIW HITACHI 323 ,. ~.a_ .._ ..___,_ .... "______._... ___ .________ 12.2.2 Timer Control/Status Register (TCSR) The timer controVstatus register (TCSR) is an eight-bit readable and writable register. The TCSR differs from other registers in being more difficult to write. See section 12.2.4, Register Access, for details. Its functions include selecting the timer mode and clock source. Bits 7-5 are initialized to 000 by a reset or in standby mode. Bits 2-0 are initialized to 000 by a reset, but retain their values in the standby mode. Bit: 7 6 5 4 3 2 0 Bit name: I OVF WT/IT TME CKS2 CKS1 CKSO Initial value: 0 0 0 0 0 0 RIW: R/(W) * RIW RIW RIW RIW RIW • Bit 7 (overflow flag (OVF»: OVF indicates that the TCNT has overflowed from H'FF-H'OO. It is not set in the watchdog timer mode. Bit 7: OVF Description o No overflow of TCNT in interval timer mode (initial value) Cleared by reading OVF, then writing 0 in OVF TCNT overflow in the interval timer mode • Bit 6 (timer mode select (WT/IT»: WT/IT selects whether to use the WDT as a watchdog timer or interval timer. When the TCNT overflows, the WDT either generates an interval timer interrupt (m) or generates a WDTOVF signal, depending on the mode selected. Bit 6: wrnT Description o Interval timer mode: interval timer interrupt to the CPU when TCNT overflows (initial value) Watchdog timer mode: WDTOVF signal output externally when TCNT overflows. Section 12.2.3, Reset ControVStatus Register (RSTCSR), describes in detail what happens when TCNT overflows in the watchdog timer mode. • Bit 5 (timer enable (TME»: TME enables or disables the timer. Bit 5: TME Description o Timer disabled: TCNT is initialized to H'OO and count-up stops (initial value) Timer enabled: TCNT starts counting. A WDTOVF signal or interrupt is generated when TCNT overflows. 324 HITACHI • Bits 4 and 3 (reserved): These bits always read as 1. The write value should always be 1. • Bits 2-0 (clock Select 2-0 (CKS2-CKSO»: CKS2-CKSO select one of eight internal clock sources for input to the TCNT. The clock signals are obtained by dividing the frequency of the system clock (<<1». Description Bit 2: CKS2 Bit 1: CKS1 Bit 0: CKSO Clock Source Overflow Interval· ( = 20 MHz) 0 0 0 <1>/2 (initial value) 25.61ls 0 0 <1>/64 819.2 Ils 0 0 <1>/128 1.6 ms 0 <1>/256 3.3 ms 0 0 <1>/512 6.6 ms 0 <1>/1024 13.1 ms 0 $/4096 52.4 ms <1>/8192 104.9 ms Note: The overflow interval listed is the time from when the TCNT begins counting at H'OO until an overflow occurs. 12.2.3 Reset ControVStatus Register (RSTCSR) The RSTCSR is an eight-bit readable and writable register that controls output of the reset signal generated by timer counter (TCNT) overflow and selects the internal reset signal type. The RSTCSR differs from other registers in that it is more difficult to write. See section 12.2.4 Register Access, for details. RSTCR is initialized to H'lF by input of a reset signal from the RES pin, but is not initialized by the internal reset signal generated by the overflow of the WDT. It is initialized to H'lF in standby mode. Bit: 7 6 5 4 3 2 0 Bit name: I WOVF RSTE RSTS Initial value: 0 0 0 RIW: R/(W)* RJW RIW Note: Only 0 can be written in bit 7 to clear the flag. HITACHI 325 • Bit 7 (watchdog timer overflow (WOVF»: WOVF indicates that the TeNT has overflowed (H'FF ~ H'OO) in the watchdog timer mode. It is not set in the interval timer mode. Bit 7: WOVF Description o No TCNT overflow in watchdog timer mode (initial value) Cleared when software reads WOVF, then writes 0 in WOVF Set by TCNT overflow in watchdog timer mode • Bit 6 (reset enable (RSTE»: RSTE selects whether to reset the chip internally if the TeNT overflows in the watchdog timer mode. Bit 6: RSTE Description o Not reset when TCNT overflows (initial value). LSI not reset internally, but TCNT and TCSR reset within WDT. Reset when TCNT overflows • Bit 5 (reset select (RSTS»: RSTS selects the type of internal reset generated if the TeNT overflows in the watchdog timer mode. Bit 5: RSTS Description o Power-on reset initial value) Manual reset • Bits 4-0 (reserved): These bits always read as 1. The write value should always be 1. 326 HITACHI 12.2.4 Regi$ter Acce$$ The watchdog timer's TCNT, TCSR, and RSTCSR registers differ from other registers in that they are more difficult to write. The procedures for writing and reading these registers are given below. Writing to the TCNT and TCSR: These registers must be written by a word transfer instruction. They cannot be written by byte transfer instructions. The TCNT and TCSR both have the same write address. The write data must be contained in the lower byte of the written word. The upper byte must be H'SA (for the TCNT) or H'AS (for the TCSR) (figure 12,2). This transfers the write data from the lower byte to the TCNT or TCSR. Writing to the TCNT 1S 8 7 0 Address: H'SFFFFB8 \H'SA IWrite data Writing to the TCSR 1S 8 7 0 Address: H'SFFFFB8 IH'AS IWrite data Figure 12.2 Writing to the TCNT and TCSR Writing to the RSTCSR: The RSTCSR must be written by a word access to address H'SFFFFFBA. It cannot be written by byte transfer instructions. Procedures for writing 0 in WOVF (bit 7) and for writing to RSTE (bit 6) and RSTS (bit S) are different, as shown in figure 12.3. To write 0 in the WOVF bit, the write data must be H'A5 in the u.pper byte and H'OO in the lower byte. This clears the WOVF bit to o. The RSTE and RSTS bits are not affected. To write to the RSTE and RSTS bits, the upper byte must be H'SA and the lower byte must be the write data. The values of bits 6 and 5 of the lower byte are transferred to the RSTE and RSTS bits, respectively. The WOVF bit is not affected. Writing 0 to the WOVF bit 1S 8 7 o Address: H'SFFFFBA IH'AS I IH'OO Writing to the RSTE and RSTS bits 1S 8 7 0 Address: H'SFFFFBA IH'SA jwrite data Figure 12.3 Writing to the RSTCSR HITACHI 327 Reading from the TCNT, TCSR, and RSTCSR: TCNT, TCSR, and RSTCSR are read like other registers. Use byte transfer instructions. The read addresses are H'5FFFFB8 for the TCSR, H'SFFFFB9 for the TCNT, and H'SFFFFBB for the RSTCSR. 12.3 Operation 12.3.1 Operation in the Watchdog Timer Mode To use the WDT as a watchdog timer, set the WT/IT and TME bits of the TCSR to 1. Software must prevent TCNT overflow by rewriting the TCNT value (normally by writing H'OO) before overflow occurs. If the TCNT fails to be rewritten and overflows due to a system crash or the like, a WDTOVF signal is output (figure 12.4). The WDTOVF signal can be used to reset external system devices. The WDTOVF signal is output for 128<1> clock cycles. If the RSTE bit in the RSTCSR is set to 1, a signal to reset the chip will be generated internally simultaneous to the WDTOVF signal when TCNT overflows. Either a power-on reset or a manual reset can be selected by the RSTS bit. The internal reset signal is output for 512<1> clock cycles. When a watchdog reset is generated simultaneously with input at the RES pin, the software distinguishes the RES reset from the watchdog reset by checking the WOVF bit in the RSTCSR. The RES reset takes priority. The WOVF bit is cleared to O. 328 HITACHI TCNT value Overflow H'FF H'OO +-.--~t -----,--,--.Time t WTIIT = 1 "-t/ H'OO written WOVF= 1 WTIIT = 1 H'OO written TME= 1 in TCNT TME = 1 in TCNT WOTOVFand internal reset generated WOTOVF signal •u ~ 128$ clock Internal reset signal* ,.. ., 512$ clock WTIIT: Timer mode select bit TME: Timer enable bit Note: The internal reset signal is only generated when the RSTE bit is 1. Figure 12.4 Operation in the Watchdog Timer Mode HITACHI 329 12.3.2 Operation in the Interval Timer Mode To use the WDTas an interval timer, clear WTIIT to 0 and set TME to 1. An interval timer interrupt (ITI) is generated each time the timer counter overflows. This function can be used to generate interval timer interrupts at regular intervals (figure 12.5). TCNTvalue Overflow Overflow Overflow, Overflow H'FF H'OO '-f-----+-----l''------~----___!<'--.. Time WT/IT=O ITI ITI ITI ITI TME= 1 ITI: Interval timer interrupt request Figure 12.5 Operation in the Interval Timer Mode 12.3.3 Operation in the Standby Mode The watchdog timer has a special function to clear the standby mode with an NMI interrupt. When using the standby mode, set the WDT as described below. Transition to the Standby Mode: The TME bit in the TCSR must be cleared to 0 to stop the watchdog timer counter before it enters the standby mode. The chip cannot enter the standby mode while the TME bit is set to 1. Set bits CKS2-CKSO so that the counter overflow interval is equal to or longer than the oscillation settling time. See section 20.3, AC Characteristics, for the oscillation settling time. Recovery from the Standby Mode: When an NMI request signal is received in standby mode, the clock oscillator starts running and the watchdog timer starts counting at the rate selected by bits CKS2-CKSObefore the standby mode was entered. When the TCNT overflows (changes from H'FF-H'OO), the system clock (q»is presumed to be stable and usable; clock signals are supplied to the entire chip and the standby mode ends. For details on the standby mode, see section 19, Power Down States. 330 HITACHI 12.3.4 Timing of Setting the Overflow Flag (OVF) In the interval timer mode, when the TeNT overflows the OVF flag is set to 1 and an interval timer interrupt is requested (figure 12.6). TCNT ==1~ H'FF X'-H_'O_O_ _ _ _ _ _ _ _ _ __ Overflow signal (internal signal) \J'\, OvF _____~r--~rl ») . ------------ Figure 12.6 Timing of Setting the OVF 12.3.5 Timing of Setting the Watchdog Timer Overflow Flag (WOVF) When the TCNT overflows the WOVF bit of the RSTCSR is set to 1 and a WDTOVF signal is output. When the RSTE bit is set to I, TCNT overflow enables an internal reset signal to be generated for the entire chip (figure 12.7). TCNT ==J) H'FF X~H_'O_O- - - - - - - - - - 1 Overflow signal I (internal signal) _ _ _--I>~ WOVF _ _ _ _~~------~ Figure 12.7 Timing of Setting the WOVF Bit and Internal Reset HITACHI 331 12.4 Usage Notes 12.4.1 TCNT Write and Count Up Contention If a timer counter clock pulse is generated during the T3 state of a write cycle to the TCNT, the write takes priority and the timer counter is not incremented (figure 12.8). TCNT write cycle CK Address ________ ~)(~____T_C_N_T__ad_d_~_S_S____~)(~________ Internal write signal TCNT input clock TCNT _ _ _ _ _ _ _N_ _ --'X 7 )t M Counter write data Figure 12.8 Contention between TCNT Write and Increment 12.4.2 Changing CKS2-CKSO Bit Values If the values of bits CKS2-CKSO are altered while the WDT is running, the count may increment incorrectly. Always stop the watchdog timer (by clearing the TME bit to 0) before changing the values of bits CKS2-CKSO. 12.4.3 Changing Watchdog TimerlInterval Timer Modes To prevent incorrect operation, always stop the watchdog timer (by clearing the TME bit to 0) before switching between interval timer mode and watchdog timer mode. 332 HITACHI 12.4.4 System Reset With WDTOVF If a WDTOVF signal is input to the RES pin, the LSI cannot initialize correctly. Avoid logical input of the WDTOVF output signal to the RES input pin. To reset the entire system with the WDTOVF signal, use the circuit shown in figure 12.9. SH microprocessor Reset input 1 1 RES Reset signal to entire system 0------(1 WDTOVF Figure 12.9 Example of a System Reset Circuit with a WDTOVF Signal 12.4.5 Internal Reset With the Watchdog Timer If the RSTE bit is cleared to 0 in the watchdog timer mode, the LSI will not reset internally when a TCNT overflow occurs, but the TCNT and TCSR in WDT will reset. HITACHI 333 Section 13 Serial Communication Interface 13.1 Overview The SH microcomputer has a serial communication interface (SCI) with two independent channels. Both channels are functionally identical. The SCI supports both asynchronous and clocked synchronous serial communication. It also has a mUltiprocessor communication function for serial communication among two or more processors. 13.1.1 Features • Asynchronous mode Serial data communications are synched by start-stop in character units. The SCI can communicate with a universal asynchronous receiver/transmitter (UART), an asynchronous communication interface adapter (ACIA), or any other chip that employs a standard asynchronous serial communication. It can also communicate with two or more other processors using the multiprocessor communication function. There are twelve selectable serial data communication formats. Data length: seven or eight bits Stop bit length: one or two bits Parity: even, odd, or none Multiprocessor bit: one or none Receive error detection: parity, overrun, and framing errors Break detection: by reading the RxD level directly when a framing error occurs • Clocked synchronous mode Serial data communication is synchronized with a clock signal. The SCI can communicate with other chips having a clocked synchronous communication function. There is one serial data communication format. Data length: eight bits Receive error detection: overrun errors • Full duplex communication: The transmitting and receiving sections are independent, so the SCI can transmit and receive simultaneously. Both sections use double buffering, so continuous data I transfer is possible in both the transmit and receive directions. • On-chip baud rate generator with selectable bit rates • Internal or external transmit/receive clock. source: baud rate generator (internal) or SCK pin (external) • Four types of interrupts: Transmit-data-empty. transmit-end. receive-data-full, and receive-error interrupts are requested independently. The transmit-data-empty and receive-data-full interrupts can start the direct memory access controller (DMAC) to transfer data. HITACHI 335 13.1.2 Block Diagram Figure 13.1 shows a block diagram of the SCI. ------------------------------------------------1 - Q) 0 ~ :£ C!>~ ata bus nternal Module data bus Q) C/) :l II) - I ROR I TOR I SSR I BRR SCR cp RXO -rll RSR I II TSR ~ 1 A SMR Baud rate generator OIl ... 1 1 cp14 cp/16 1 Transmit! OIl : cp/64 receive control TXO Parity generation I' i Clock I Parity check ,j External clock SCK TEl TXI j RXI ERI L-------------------------------------SCI --------1 RSR: Receive shift register SMR: Serial mode register RDR: Receive data register SCR: Serial control register TSR: Transmit shift register SSR: Serial status register TOR: Transmit data register BRR: Bit rate register Figure 13.1 SCI Block Diagram 336 HITACHI 13.1.3 Input/Output Pins Table 13.1 summarizes the SCI pins by channel. Table 13.1 SCI Pins Channel Pin Name Abbreviation Input/Output Function 0 Serial clock pin SCKO Input/output SCIO clock input/output Receive data pin RxDO Input SCIO receive data input Transmit data pin TxDO Output SCIO transmit data output Serial clock pin SCK1 Input/output SCI1 clock input/output Receive data pin RxD1 Input SCI1 receive data input Transmit data pin TxD1 Output SCI1 transmit data output 13.1.4 Register Configuration Table 13.2 summarizes the SCI internal registers. These registers select the communication mode (asynchronous or clocked synchronous), specify the data format and bit rate, and control the transmitter and receiver sections. Table 13.2 Registers Initial Access Channel Address*1 Name Abbreviation RIW Value size 0 H'05FFFECO Serial mode register SMRO RIW H'OO 8, 16 H'05FFFEC1 Bit rate register BRRO RIW H'FF 8, 16 H'05FFFEC2 Serial control register SCRO RIW H'OO 8, 16 H'05FFFEC3 Transmit data register TDRO RIW H'FF 8, 16 H'05FFFEC4 Serial status register SSRO RI(W)*2 H'84 8, 16 H'05FFFECS Receive data register RDRO R H'OO 8, 16 H'05FFFEC8 Serial mode register SMR1 RIW H'OO 8, 16 H'OSFFFEC9 Bit rate register BRR1 RIW H'FF 8, 16 H'05FFFECA Serial control register SCR1 RIW H'OO 8, 16 H'05FFFECB Transmit data register TDR1 RIW H'FF 8, 16 H'OSFFFECC Serial status register SSR1 RI(W)*2 H'84 8, 16 H'05FFFECD Receive data register RDR1 R H'OO 8, 16 Notes: 1. Only the values of bits A27-A24 and AS-AO are valid; bits A23-A9 are ignored. For details on the register addresses, see section 8.3.S, Description of Areas. 2. Write 0 to clear flags. HITACHI 337 13.2 Register Descriptions 13.2.1 Receive Shift Register The receive shift register (RSR) receives serial data. Data input at the RxD pin are loaded into the RSR in the order received. LSB (bit 0) fIrst. In this way the SCI converts received data to parallel form. When one byte has been received. it is automatically transferred to the receive data register (RDR). The SH CPU cannot read or write the RSR directly. Bit: 7 6 5 4 3 2 o Bitname:I~----~------r-----'-----~------~----~-----r-----' RIW: 13.2.2 Receive Data Register The receive data register (RDR) stores serial receive data. The SCI completes the reception of one byte of serial data by moving the received data from the receive shift register (RSR) into the RDR for storage. The RSR is then ready to receive the next data. This double buffering allows the SCI to receive data continuously. The SH CPU can read but not write the RDR. The RDR is initialized to H'OO by a reset or in standby mode. Bit: 7 6 5 4 3 2 0 Bit name: I Initial value: 0 0 0 0 0 0 0 0 R/W: R R R R R R R R 13.2.3 Transmit Shift Register The transmit shift register (TSR) transmits serial data. The SCI loads transmit data from the transmit data register (TOR) into the TSR, then transmits the data serially from the TxD pin. LSB (bit 0) fIrst. After transmitting one data byte. the SCI automatically loads the next transmit data from the TOR into the TSR and starts tran~mitting again. If the TORE bit of the SSR is 1. however, the SCI does not load the TOR contents into the TSR. The SH CPU cannot read or write the TSR directly. Bit: 7 6 5 4 3 2 1 o Bitname:I~----~----~r-----'------.------~----~-----r-----. R/W: 338 HITACHI 13.2.4 Transmit Data Register The transmit data register (TOR) is an eight-bit register that stores data for serial transmission. When the SCI detects that the transmit shift register (TSR) is empty, it moves transmit data written in the TOR into the TSR and starts serial transmission. Continuous serial transmission is possible by writing the next transmit data in the TOR during serial transmission from the TSR. The SH CPU can always read and write the TOR. The TOR is initialized to H'FF by a reset or in standby mode. Bit: 7 6 5 4 3 2 a Bit name: I Initial value: 1 1 1 1 1 1 1 1 RIW: RIW RIW RIW RIW RIW RIW RIW RIW 13.2.5 Serial Mode Register The serial mode register (SMR) is an eight-bit register that specifies the SCI serial communication format and selects the clock source for the baud rate generator. The SH CPU can always read and write the SMR. The SMR is initialized to H'OO by a reset or in standby mode. Bit: 7 6 5 4 3 2 1 a Bit name: I CIA CHR PE OlE STOP MP CKS1 CKSO Initial value: a a a a a a a a RIW: RIW RIW RIW R/W R/W RIW RIW RIW • Bit 7 (communication mode (CiA»: CIA selects whether the SCI operates in the asynchronous or clocked synchronous mode. Bit 7,: CIA Description a Asynchronous mode (initial value) Clocked synchronous mode • Bit 6 (character length (CHR»: CHR selects seven-bit or eight-bit data in the asynchronous mode. In the clocked synchronous mode. the data length is always eight bits, regardless of the CHR setting. HITACHI 339 Bit 6: CHR Description o Eight-bit data (initial value) Seven-bit data. When seven-bit data is selected, the MSB (bit 7) of the transmit data register is not transmitted. • Bit 5 (parity enable (PE»: PE selects whether to add a parity bit to transmit data and check the parity of receive data, in the asynchronous mode. In the clocked synchronous mode, a parity bit is neither added nor checked, regardless of the PE setting. Bit 5: PE Description o Parity bit not added or checked (initial value) Parity bit added and checked. When PE is set to 1, an even or odd parity bit is added to transmit data, depending on the parity mode (OlE) setting. Receive data parity is checked according to the even/odd (OlE) mode setting. • Bit 4 (parity mode (OtE): OtE selects even or odd parity when parity bits are added and checked. The OtE setting is used only in asynchronous mode and only when the parity enable bit (PE) is set to 1 to enable parity addition and check. The OtE setting is ignored in the clocked synchronous mode, or in the asynchronous mode when parity addition and check is disabled. Bit 4: OlE Description o Even parity (initial value). If even parity is selected, the parity bit added to transmit data makes an even number of 1s in the transmitted character and parity bit combined. Receive data must have an even number of 1s in the received character and parity bit combined. Odd parity. If odd parity is selected, the parity bit added to transmit data makes an odd number of 1s in the transmitted character and parity bit combined. Receive data must have an odd number of 1s in the received character and parity bit combined. • Bit 3 (stop bit length (STOP»: STOP selects one or two bits as the stop bit length in the asynchronous mode. This setting is used only in the asynchronous mode. It is ignored in the clocked synchronous mode because no stop bits are added. In receiving, only the first stop bit is checked, regardless of the STOP bit setting. If the second stop bit is 1, it is treated as a stop bit. If the second stop bit is 0, it is treated as the start bit of the next incoming character. 340 HITACHI Bit 3: STOP Description o One stop bit (initial value). In transmitting, a single bit of 1 is added at the end of each transmitted character. Two stop bits. In transmitting, two bits of 1 are added at the end of each transmitted character. • Bit 2 (multiprocessor mode (MP»: MP selects multiprocessor format. When multiprocessor format is selected, settings of the parity enable (PE) and parity mode (OtE) bits are ignored. The MP bit setting is used only in the asynch~onous mode; it is ignored in the clocked synchronous mode. For the mUltiprocessor communication function, see section 13.3.3, Multiprocessor Communication. Bit 2: MP Description o Multiprocessor function disabled (initial value) Multiprocessor format selected • Bits 1 and 0 (clock select 1 and 0 (CKS I and CKSO»: CKS I and CKSO select the internal clock source of the on-chip baud rate generator. Four clock sources are available: 4>, 4>/4, 4>/16, and 4>/64. For further information on the clock source, bit rate register settings, and baud rate, see section 13.2.8, Bit Rate Register. Bit 1: CKS1 Bit 0: CKSO Description o o System clock ( (MHz) 1 1.2288 2 2.097152 Bit Rate Error Error Error Error (bitsls) n N (%) n N (%) n N (%) n N (%) 110 70 0.03 86 0.31 141 0.03 148 -0.04 150 0 207 0.16 0 255 0.00 103 0.16 108 0.21 300 0 103 0.16 0 127 0.00 0 207 0.16 0 217 0.21 600 0 51 0.16 0 63 0.00 0 103 0.16 a 108 0.21 1200 0 25 0.16 0 31 0.00 0 51 0.16 0 54 -0.70 2400 0 12 0.16 0 15 0.00 0 25 0.16 0 26 1.14 4800 0 7 0.00 0 12 0.16 0 13 -2.48 9600 0 3 0.00 0 6 -2.48 19200 0 0.00 31250 0 0 0.00 0 0.00 38400 0 0 0.00 HITACHI 349 Table 13.3 Bit Rates and BRR Settings in Asynchronous Mode (cont) (MHz) 2.4576 3 3.6864 Bit Rste{bitsls) n N Error (%) n N Error (%) n N Error (%) 110 174 -0.26 212 0.03 2 64 0.70 150 1 127 0.00 155 0.16 191 0.00 300 a 255 0.00 77 0.16 95 0.00 600 a 127 0.00 a 155 0.16 a 191 0.00 1200 a 63 0.00 a 77 0.16 a 95 0.00 2400 a 31 0.00 a 38 0.16 a 47 0.00 4800 a 15 0.00 a 19 -2.34 a 23 0.00 9600 a 7 0.00 a 9 -2.34 a 11 0.00 19200 a 3 0.00 a 4 -2.34 a 5 0.00 31250 a 2 0.00 38400 a 0.00 a 2 0.00 Table 13.3 Bit Rates and BRR Settings in Asynchronous Mode (cont) «Ii (MHz) 4 4.9152 5 Bit Rste(bltsls) n N Error (%) n N Error (%) n N Error (%) 110 2 70 0.03 2 86 0.31 2 88 -0.25 150 207 0.16 255 0.00 2 64 0.16 300 103 0.16 127 0.00 129 0.16 600 a 207 0.16 a 255 0.00 64 0.16 1200 a 103 0.16 a 127 0.00 a 129 0.16 2400 a 51 0.16 a 63 0.00 a 64 0.16 4800 a 25 0.16 a 31 0.00 a 32 -1.36 9600 a 12 0.16 a 15 0.00 a 15 1.73 19200 a 7 0.00 a 7 1.73 31250 a 3 0.00 a 4 -1.70 a 4 0.00 38400 a 3 0.00 a 3 1.73 350 HITACHI Table 13.3 Bit Rates and BRR Settings in Asynchronous Mode (cont) $ (MHz) 6 6.144 7.3728 Bit Rate(bltsls) n N Error (%) n N Error (%) n N Error (%) 110 2 106 -0.44 2 108 0.08 2 130 -0.07 150 2 77 0.16 2 79 0.00 2 95 0.00 300 1 155 0.16 159 0.00 191 0.00 600 77 0.16 79 0.00 95 0.00 1200 0 155 0.16 a 159 0.00 a 191 0.00 2400 a 77 0.16 a 79 0.00 0 95 0.00 4800 a 38 0.16 a 39 0.00 a 47 0.00 9600 a 19 -2.34 a 19 0.00 a 23 0.00 19200 a 9 -2.34 a 9 0.00 a 11 0.00 31250 a 5 0.00 a 5 2.40 38400 a 4 -2.34 a 4 0.00 a 5 0.00 Table 13.3 Bit Rates and BRR Settings in Asynchronous Mode (cont) (MHz) 8 9.8304 10 12 Bit Rate Error Error Error Error (blts/s) n N (%) n N (%) n N (%) n N (%) 110 2 141 0.03 2 174 -0.26 2 177 -0.25 2 212 0.03 150 2 103 0.16 2 127 0.00 2 129 0.16 2 155 0.16 300 207 0.16 255 0.00 2 64 0.16 2 77 0.16 600 103 0.16 127 0.00 129 0.16 155 0.16 1200 a 207 0.16 a 255 0.00 64 0.16 77 0.16 2400 a 103 0.16 0 127 0.00 a 129 0.16 a 155 0.16 4800 a 51 0.16 a 63 0.00 a 64 0.16 a 77 0.16 9600 a 25 0.16 a 31 0.00 a 32 -1.36 a 38 0.16 19200 0 12 0.16 a 15 0.00 a 15 1.73 a 19 -2.34 31250 a 7 0.00 a 9 -1.70 a 9 0.00 a 11 0.00 38400 a 7 0.00 a 7 1.73 a 9 -2.34 HITACHI 351 Table 13.3 Bit Rates and BRR Settings in Asynchronous Mode (cont) ~ (MHz) 12.288 14 14.7456 16 Bit Rate Error Error Error Error (bltS/s) n N (%) n N (%) n N (%) n N (%) 110 2 217 0.08 2 248 -0.17 3 64 0.70 3 70 0.03 150 2 159 0.00 2 181 0.16 2 191 0.00 2 207 0.16 300 2 79 0.00 2 90 0.16 2 95 0.00 2 103 0.16 600 159 0.00 181 0.16 191 0.00 1 207 0.16 1200 79 0.00 90 0.16 95 0.00 103 0.16 2400 o 159 0.00 0 181 0.16 0 191 0.00 0 207 0.16 4800 o 79 0.00 0 90 0.16 0 95 0.00 0 103 0.16 9600 o 39 0.00 a 45 -0.93 0 47 0.00 a 51 0.16 19200 o 19 0.00 a 22 -0.93 0 23 0.00 0 25 0.16 31250 o 11 2.40 a 13 0.00 0 14 -1.70 0 15 0.00 38400 o 9 0.00 o 11 0.00 a 12 0.16 Table 13.3 Bit Rates and BRR Settings in Asynchronous Mode (cont) ~ (MHz) 17.2032 18 19.6608 20 Bit Rate Error Error Error Error (bltS/s) n N (%) n N (%) n N (%) n N (%) 110 3 75 0.48 3 79 -0.12 3 86 0.31 3 88 -0.25 150 2 223 0.00 2 233 0.16 2 255 0.00 3 64 0.16 300 2 111 0.00 2 116 0.16 127 0.00 2 129 0.16 600 223 0.00 233 0.16 255 0.00 2 64 0.16 1200 111 0.00 116 0.16 0 127 0.00 129 0.16 2400 o 223 0.00 0 233 0.16 0 255 0.00 64 0.16 4800 a 111 0.00 0 116 0.16 0 127 0.00 0 129 0.16 9600 o 55 0.00 0 58 -0.69 0 63 0.00 0 64 0.16 19200 o 27 0.00 a 28 1.02 0 31 0.00 0 32 -1.36 31250 o 16 1.20 0 17 0.00 0 19 -1.70 a 19 0.00 38400 o 13 0.00 0 14 -2.34 0 15 0.00 0 15 1.73 352 HITACHI Table 13.4 Bit Rates and BRR Settings in Clocked Synchronous Mode $ (MHz) Bit Rate 1 2 4 8 10 16 20 (bitS/s) n N n N n N n N n N n N n N 110 3 70 250 249 2 124 2 249 3 124 3 249 500 124 249 2 124 2 249 3 124 1k 0 249 124 249 2 124 2 249 2.5k 0 99 0 199 99 199 249 2 99 2 124 5k 0 49 0 99 0 199 99 124 199 249 10k 0 24 0 49 0 99 0 199 0 249 99 124 25k 0 9 0 19 0 39 0 79 0 99 0 159 0 199 50k 0 4 0 9 0 19 0 39 0 49 0 79 0 99 100k 0 4 0 9 0 19 0 24 0 39 0 49 250k 0 0"; 0 0 3 0 7 0 9 0 15 0 19 500k 0 0"; 0 0 3 0 4 0 7 0 9 1M 0 O' 0 0 3 0 4 2.5M 0 O· 0 5M 0 O' Note Settings with an error of 1% or less are recommended. Blank: No setting available - Setting possible, but error occurs ,,: Continuous transmit/receive not possible The BRR setting is calculated as follows: Asynchronous mode N = [$/(64 x 22n - 1 x B)l x 106 -1 Clocked synchronous mode N = [$/(8 x 22n -1 x B)l x 106 - 1 B: bit rate (bit/s) N: BRR setting for baud rate generator (0 s N S 255) $: $ frequency (MHz) n: baud rate generator clock source (n = 0, 1, 2, 3) For the clock sources and values of n, see table 13.5. HITACHI 353 SMR Settings n 0 ,Clock Source CKS1 0 CKSO 0 ,/4 0 2 ,,16 0 3 ,,24 Find the bit rate error for the asynchronous mode by the following formula. Error ('Yo) ={(, x 106)I[(N + 1) x B x 64 X 22n -1] - 1 } x 100 354 HITACHI Table 13.5 indicates the maximum bit rates in the asynchronous mode when the baud rate generator is being used. Tables 13.6 and 13.7 show the maximum rates for external clock input. Table 13.5 Maximum Bit Rates for Various Frequencies with Baud Rate Generator (Asynchronous Mode) Settings «I> (MHz) Maximum Bit Rate (bits/s) n N 1 31250 0 0 1.2288 38400 0 0 2 62500 0 0 2.097152 65536 0 0 2.4576 76800 0 0 3 93750 0 0 3.6864 115200 0 0 4 125000 0 0 4.9152 153600 0 0 5 156250 0 0 6 187500 0 0 6.144 192000 0 0 7.3728 230400 0 0 8 250000 0 0 9.8304 307200 0 0 10 312500 0 0 12 375000 0 0 12.288 384000 0 0 14 437500 0 0 14.7456 460800 0 0 16 500000 0 0 17.2032 537600 0 0 18 562500 0 0 19.6608 614400 0 0 20 625000 0 0 HITACHI 355 Table 13.6 Maximum Bit Rates during External Clock Input (Asynchronous Mode) ,(MHz) External Input Clock (MHz) Maximum Bit Rate (bits/s) 0.2500 15625 1.2288 0.3072 19200 2 0.5000 31250 2.097152 0.5243 32768 2.4576 0.6144 38400 3 0.7500 46875 3.6864 0.9216 57600 4 1.0000 62500 4.9152 1.2288 76800 5 1.2500 78125 6 1.5000 93750 6.144 1.5360 96000 7.3728 1.8432 115200 8 2.0000 125000 9.8304 2.4576 153600 10 2.5000 156250 12 3.0000 187500 12.288 3.0720 192000 14 3.5000 218750 14.7456 3.6834 230400 16 4.0000 250000 17.2032 4.3008 268800 18 4.5000 281250 19.6608 4.9152 307200 20 5.0000 312500 356 HITACHI Table 13.7 Maximum Bit Rates during External Clock Input (Clocked Synchronous Mode) tP (MHz) External Input Clock (MHz) Maximum Bit Rate (bits/s) 2 0.3333 333333.3 4 0.6667 666666.7 6 1.0000 1000000.0 8 1.3333 1333333.3 10 1.6667 1666666.7 12 2.0000 2000000.0 14 2.3333 2333333.3 16 2.6667 2666666.7 18 3.0000 3000000.0 20 3.3333 3333333.3 13.3 Operation 13.3.1 Overview The SCI has an asynchronous mode in which characters are synchronized individually, and a clocked synchronous mode in which communication is synchronized with clock pulses. Serial communication is possible in either mode. Asynchronous/clocked synchronous mode and the communication format are selected in the serial mode register (SMR), as shown in table 13.8. The SCI clock source is selected by the CIA bit in the serial mode register (SMR) and the CKEI and CKEO bits in the serial control register (SCR). as shown in table 13.9. Asynchronous Mode: • Data length is selectable: seven or eight bits. • Parity and multiprocessor bits are selectable. So is the stop bit length (one or two bits). The preceding selections constitute the communication format and character length. • In receiving, it is possible to detect framing errors (FER). parity errors (PER), overrun errors CORER), and the break state. • An internal or external clock can be selected as the SCI clock source. When an internal clock is selected, the SCI operates using the on-chip baud rate generator, and can output a serial clock signal with a frequency matching the bit rate. When an external clock is selected. the external clock input must have a frequency 16 times the bit rate. (The on-chip baud rate generator is not used.) Clocked Synchronous Mode: • The communication format has a tixed eight-bit data length. HITACHI 357 • In receiving, it is possible to detect overrun errors (ORER). • An internal or external clock can be selected as the SCI clock source. - When an internal clock is selected, the SCI operates using the on-chip baud rate generator, and outputs a serial clock signal to external devices. - When an external clock is selected, the SCI operates on the input serial clock. The on-chip baud rate generator is not used. Table 13.8 Serial Mode Register Settings and SCI Communication Formats SMR Settings SCI Communication Format Bit 7: Bit 6: Bit 5: Bit 2: Bit 3: Data Parity Multipro- Stop Bit Mode CIA CHR PE MP STOP Length Bit cessor Bit Length Asynchronous 0 0 0 0 0 8-bit Absent Absent 1 bit 2 bits --- 0 Present 1 bit 2 bits 0 0 7-bit Absent 1 bit 1 2 bits 0 Present 1 bit 1 2 bits Asynchronous 0 * 0 8-bit Absent Present 1 bit (m ultiprocessor --- 2 bits format) 0 7-bit 1 bit 2 bits Clocked * 8-bit Absent None synchronous Note: Asterisks (*) in the table indicate don't-care bits. 358 HITACHI Table 13.9 SMR and SCR Settings and SCI Clock Source Selection SMR SCR Settings SCI Transmit/Receive Clock Bit 7: Bit 1: Bit 0: Mode CIA CKE1 CKEO Clock Source SCK Pin Function" Asynchronous 0 0 0 Internal SCI does not use the SCK pin mode Outputs a clock with frequency matching the bit rate 0 External Inputs a clock with frequency 16 times the bit rate Clocked synch- o o Internal Outputs the serial clock ronous mode o External Inputs the serial clock Note: Select the function in combination with the pin function controller (PFC). 13.3.2 Operation in Asynchronous Mode In the asynchronous mode, each transmitted or received character begins with a start bit and ends with a stop bit. Serial communication is synchronized one character at a time. The transmitting and receiving sections of the SCI are independent, so full duplex communication is possible. The transmitter and receiver are both double buffered, so data can be written and read while transmitting and receiving are in progress. enabling continuous transmitting and receiving. Figure 13.2 shows the general format of asynchronous serial communication. In asynchronous serial communication, the communication line is normally held in the mark (high) state. The SCI monitors the line and starts serial communication when the line goes to the space (low) state, indicating a start bit. One serial character consists of a start bit (low). data (LSB firs!). parity bit (high or low), and stop bit (high). in that order. When receiving in the asynchronous mode, the SCI synchronizes on the falling edge of the start bit. The SCI samples each data bit on the eighth pulse of a clock with a frequency 16 times the bit rate. Receive data is latched at the center of each bit. HITACHI 359 Idling (mark state) (LSB) (MSB) 1 S~oloo °1 07 1 0/1 11 ,1 data , . I Start I iParity: Stop , Ibit ,I . bit i bit I ~'II ~ Transmit/receive data ·~~~--------------------------~.~,~ __~.~.~4~--~~~· I i 1 bit I 7 or 8 bits 1 or 1 or i I no bit 2 bits i II' : One unit of communication (characters or frames) I 14 ·t Figure 13.2 Data Format in Asynchronous Communication (Example: 8-bit data with parity and two stop bits) 360 HITACHI TransmitIReceive Formats: Table 13.10 shows the 12 communication fonnats that can be selected in the asynchronous mode. The fonnat is selected by settings in the serial mode register (SMR). Table 13.10 Serial Communication Formats (asynchronous mode) SMR Bits CHR PE MP STOP 1 2 3 4 5 6 7 8 9 10 11 12 0 0 0 0 I START I a·Bit data STOP I 0 0 0 I START I a·Bit data I STOP STOP I 0 0 0 I START I a·Bit data P I STOP I 0 0 I START I a·Bit data P ! STOP ISTOP I 0 0 0 I START I 7·Bit data ISTOP 0 0 I START I 7·Bit data ISTOP ISTOP I 0 0 I START I 7·Bit data P I STOP I 0 I START I 7·Bit data P I STOP I STOP I 0 0 I START I a·Bit data I MPB I STOP I 0 I START I a·Bit data I MPB I STOP ISTOP I 0 I START I 7·Bit data I MPB I STOP I I STARTi 7·Bit data I MPB I STOP I STOP I -: Don't care bits. Note: START: Start bit STOP: Stop bit P: .parity bit MPB: Multiprocessor bit Clock: An internal clock generated by the on-chip baud rate generator or an external clock input from the SCK pin can be selected as the SCI transmit/receive clock. The clock source is selected by the ciA bit in the serial mode register (SMR) and bits CKEI and CKEO in the serial control register (SCR) (table 13.9). When an external clock is input at the SCK pin. it must have a frequency equal to 16 times the desired bit rate. HITACHI 361 When the SCI operates on an internal clock, it can output a clock signal at the SCK piri. The frequency ofthis output clock is equal to the bit rate. The phase is aligned as in figure 13.3 so that the rising edge of the clock occurs at the center of each transmit data bit. i 1 frame ~; Figure 13.3 Phase Relationship Between Output Clock and Serial Data (asynchronous mode) Transmitting and Receiving Data (SCI initialization (asynchronous mode»: Before transmitting or receiving, software must clear the TE and RE bits to 0 in the serial control register (SCR), then initialize the SCI as follows. When changing the communication mode or format, always clear the TE and RE bits to 0 before following the procedure given below. Clearing TE to 0 sets TDRE to I and initializes the transmit shift register (TSR). Clearing RE to 0, however, does not initialize the RDRF, PER, FER, and ORER flags and receive data register (RDR), which retain their previous contents. When an external clock is used, the clock should not be stopped during initialization or subsequent operation. SCI operation becomes unreliable if the clock is stopped. Figure 13.4 is a sample flowchart for initializing the SCI. The procedure for initializing the SCI is as follows: l. Select the communication format in the serial mode register (SMR). 2. Write the value corresponding to the bit rate in the bit rate register (BRR) unless an external clock is used. 3. Select the clock source in the serial control register (SCR). Leave RIE, TIE, TEIE, MPIE, TE and RE cleared to O. If clock output is selected in asynchronous mode, clock output starts immediately after the setting is made to SCR. 4. Wait for at least the interval required to transmit or receive one bit, then set TE or RE in the serial control register (SCR) to l. Also set RIE, TIE, TEIEand MPIE as necessary. Setting TE or RE enables the SCI to use the TxD or RxD pin. The initial states are the mark transmit state, and the idle receive state (waiting for a start bit). 362 HITACHI Start of initialization Clear TE and RE bits to 0 in SCR Select communication format in SMR CD Set value in BRR L -__________- .____________ ~ ® Set CKE1 and CKEO bits in SCR (leaving TE and RE cleared to 0) ® Set TE or RE to 1 in SCR; Set RIE, TIE, TEIE, and MPIE as necessary End Note: Circled numbers refer to the preceding procedure. Figure 13.4 Sample Flowchart for SCI Initialization Transmitting Serial Data (asynchronous mode): Figure 13.5 shows a sample flowchart for transmitting serial data. The procedure for transmitting serial data is as follows: 1. SCI initialization: select the TxO pin function with the PFC. 2. SCI status check and transmit data write: read the serial status register (SSR), check that the TDRE bit is I, then write transmit data in the transmit data register (TOR) and clear TORE to O. 3. To continue transmitting serial data: read the TORE bit to check whether it is safe to write (1): if so, write data in TOR. then clear TORE to O. When the OMAC is started by a transmit-data- empty interrupt request (TXI) to write data in TOR. the TORE bit is checked and cleared automatically. 4. To output a break signal at the end of serial transmission: set the OR bit to 0 (I/O data port register), then clear TE to 0 in SCR and set the TxO pin function as output port with the PFC. HITACHI 363 Initialize Start transmitting Read TORE bit in SSR ® No Write transmit data in TOR and clear TORE bit to 0 in SSR Read TEND bit in SSR No No Set DR =0 Clear TE bit of SCR to 0; Select theTxO pin function as an output port with the PFC Transmission ends Note: Circled numbers refer to the preceding procedure. Figure 13.S Sample Flowchart for Transmitting Serial Data 364 HITACHI In transmitting serial data, the SCI operates as follows: 1. The SCI monitors the TDRE bit in the SSR. When TDRE is cleared to 0, the SCI recognizes that the transmit data register (TDR) contains new data, and loads this data from the TDR into the transmit shift register (TSR). 2. After loading the data from the TDR into the TSR, the SCI sets the TDRE bit to 1 and starts transmitting. If the transmit-data-empty interrupt enable bit (TIE) is set to 1 in the SCR, the SCI requests a transmit-data-empty interrupt (TXI) at this time. Serial transmit data is transmitted in the following order from the TxD pin: 1. Start bit: one ° bit is output. 2. Transmit data: seven or eight bits of data are output, LSB first. 3. Parity bit or mUltiprocessor bit: one parity bit (even or odd parity) or one mUltiprocessor bit is output. Formats in which neither a parity bit nor a multiprocessor bit is output can also be selected. 4. Stop bit: one or two I bits (stop bits) are output. 5. Mark state: output of I bits continues until the start bit of the next transmit data. 6. The SCI checks the TDRE bit when it outputs the stop bit. If TDRE is 0, the SCI loads new data from the TDR into the TSR, outputs the stop bit, then begins serial transmission of the next frame. If TDRE is I, the SCI sets the TEND bit to I in the SSR, outputs the stop bit, then continues output of I bits in the mark state. If the transmit-end interrupt enable bit (TEIE) in the SCR is set to I, a transmit-end interrupt (TEl) is requested. Figure 13.6 shows an example of SCI transmit operation in the asynchronous mode. HITACHI 365 Start Parity Stop Start Parity Stop bit Data bit bit bit Data bit bit S~=~I 0 I Do I 0 1 I~~ I 0 7 I 0/1 I 1 I 0 I Do I 0 1 I~ 07 0/1 Idle ~:~~ ,\ TORE )) TEND TXI TXI interrupt equest handler writes TXI request t TEl request data in TOR and clears TORE toO 1 frame Figure 13.6 Example of SCI Transmit Operation in Asynchronous Mode (8-bit data with parity and one stop bit) Receiving Serial Data (asynchronous mode): Figure 13.7 shows a sample flowchart for receiving serial data. The procedure for receiving serial data is listed below. 1. SCI initialization: select the RxD pin function with the PFC. 2. Receive error handling and break detection: if a receive error occurs, read the ORER, PER and FER bits of the SSR to identify the error. After executing the necessary error handling, clear ORER, PER and FER all to O. Receiving cannot resume if ORER, PER or FER remains set to 1. When a framing error occurs, the RxD pin can be read to detect the break state. 3. SCI status check and receive data read: read the serial status register (SR), check that RDRF is set to 1, then read receive data from the receive data register (RDR) and clear RDRF to O. The RXI interrupt can also be used to determine if the RDRF bit has changed from 0 to 1. 4. To continue receiving serial data: read RDRF and RDR, and clear RDRF to 0 before the stop bit of the current frame is received. If the DMAC is started by a receive-data-full interrupt (RXI) to read RDR, the RDRF bit is cleared automatically so this step is unnecessary. 366 HITACHI Initialization CD Start receiving Read the ORER, PER, and FER bits of the SSR Yes ® Error handling Read the RDRF bit of the SSR ® No Read the RDR's receive data @ and clear the SSR's RDRF bit to 0 No Clear the RE bit of the SCR to 0 Reception ends Note: Circled numbers refer to the preceding procedure. Figure 13.7 Sample Flowchart for Receiving Serial Data HITACHI 367 Start of error handling N Overrun error handling No Framing error handling Clear RE bit to 0 in SCR No Parity error handling Clear ORER, PER, and FER to 0 in SSR End Note: Circled numbers refer to the preceding procedure. Figure 13.7 Sample Flowchart for Receiving Serial Data (cont) 368 HITACHI In receiving, the SCI operates as follows: 1. The SCI monitors the receive data line. When it detects a start bit (0), the SCI synchronizes internally and starts receiving. 2. Receive data is shifted into the RSR in order from the LSB to the MSB. 3. The parity bit and stop bit are received. After receiving these bits, the SCI makes the following checks: a. Parity check: The number of Is in the receive data must match the even or odd parity setting of the OtE bit in the SMR. b. Stop bit check: The stop bit value must be 1. If there are two stop bits, only the first stop bit is checked. c. Status check: RDRF must be 0 so that receive data can be loaded from the RSR into the RDR. If these checks all pass, the SCI sets RDRF to I and stores the received data in the RDR. If one of the checks fails (receive error), the SCI operates as indicated in table 13.11. Note: When a receive error flag is set, further receiving is disabled. The RDRF bit is not set to 1. Be sure to clear the error flags. 4. After setting RDRF to I, if the receive-data-full interrupt enable bit (RIE) is set to 1 in the SCR, the SCI requests a receive-data-full interrupt (RXI). If one of the error flags (ORER, PER, or FER) is set to 1 and the receive-data-full interrupt enable bit (RIE) in the SCR is also set to I, the SCI requests a receive-error interrupt (ERI). Figure 13.8 shows an example of SCI receive operation in the asynchronous mode. Table 13.11 Receive Error Conditions and SCI Operation Receive Error Abbreviation Condition Data Transfer Overrun error ORER Receiving of next data ends while Receive data not loaded RDRF is still set to 1 in SSR from RSR into RDR Framing error FER Stop bit is 0 Receive data loaded from RSR into RDR Parity error PER Parity of receive data differs from Receive data loaded from even/odd parity setting in SMR RSR into RDR HITACHI 369 Start Parity Stop Start Parity Stop 1 bit Data. bit bit bit Data bit bit Serial data I 0 I Do I 0 1 I~: I07 I0/1 I 1 I 0 I Do I 01 I~ 07 0/1 r:-Id-::-Ie-:-~~-;~-:-~ TORE I ss t FER RXI request (f RXI interrupt handler i Framing error, 1 frame reads data in ROR ERI request and clears RORF to 0 Figure 13.8 Example of SCI Receive Operation (8-bit data with parity and one stop bit) 13.3.3 Multiprocessor Communication The multiprocessor communication function enables several processors to share a single serial communication line. The processors communicate in the asynchronous mode using a format with an additional multiprocessor bit (multiprocessor format). In multiprocessor communication, each receiving processor is addressed by a unique ID. A serial communication cycle consists of an ID-sending cycle that identifies the receiving processor, and a data-sending cycle. The multiprocessor bit distinguishes ID-sending cycles from data-sending cycles. The transmitting processor starts by sending the ID of the receiving processor with which it wants to communicate as data with the multiprocessor bit set to I. Next the transmitting processor sends transmit data with the multiprocessor bit cleared to O. Receiving processors skip incoming data until they receive data with the multiprocessor bit set to 1. When they receive data with the mUltiprocessor bit set to I, receiving processors compare the data with their IDs. The receiving processor with a matching ID continues to receive further incoming data. Processors with IDs not matching the received data skip further incoming data until they again receive data with the multiprocessor bit set to I. Multiple processors can send and receive data in this way. Figure 13.9 shows the example of communication among processors using the multiprocessor format. 370 HITACHI Transmitting processor Serial communication line Receiving + Receiving + Receiving + Receiving processor A processor B processor C processor D (ID = 01) (ID = 02) (ID = 03) (ID = 04) serial~ data I I H'01 (MPB =1) ~~----~~ H'M n (MPB = 0) ~~--- ! jill ~I ID-sending cycle: Data-sending cycle: receiving processor address data sent to receiving processor specified by ID MPB: multiprocessor bit Figure 13.9 Example of Communication among Processors Using Multiprocessor Format (sending data H' AA to receiving processor A) Communication Formats: Four formats are available. Parity-bit settings are ignored when the multiprocessor format is selected. For details see table 13.8. Clock: See the description in the asynchronous mode section. Transmitting Multiprocessor Serial Data: Figure 13.10 shows a sample flowchart for transmitting multiprocessor serial data. The procedure for transmitting multiprocessor serial data is listed below. 1. SCI initialization: select the TxD pin function with the PFC. 2. SCI status check and transmit data write: read the serial status register (SSR). check that the TDRE bit is 1. then write transmit data in the transmit data register (TDR). Also set MPBT (multiprocessor bit transfer) to 0 or 1 in SSR. Finally. clear TDRE to o. 3. To continue transmitting serial data: read the TDRE bit to check whether it is safe to write (1); if so. write data in TDR. then clear TDRE to O. When the DMAC is started by a transmit-data- empty interrupt request (TXI) to write data in TDR. the TDRE bit is checked and cleared automatically. 4. To output a break signal at the end of serial transmission: set the DR bit to 0 (110 data port register). then clear TE to 0 in SCR and set the TxD pin function as output port with the PFC. HITACHI 371 Initialize Start transmitting Read TORE bit in SSR ® No Write transmit data in TOR and set MPBT in SSR Clear TORE bit to 0 No @ Read TEND bit in SSR No No @ Clear TE bit to 0 in SCR; select theTxO pin function as an output port with the PFC End Note: Circled numbers refer to the preceding procedure. Figure 13.10 Sample Flowchart for Transmitting Multiprocessor Serial Data 372 HITACHI In transmitting serial data, the SCI operates as follows: 1. The SCI monitors the TORE bit in the SSR. When TORE is cleared to 0 the SCI recognizes that the transmit data register (TOR) contains new data, and loads this data from the TOR into the transmit shift register (TSR). 2. After loading the data from the TOR into the TSR, the SCI sets the TORE bit to 1 and starts transmitting. If the transmit-data-empty interrupt enable bit (TIE) in the SCR is set to 1, the SCI requests a transmit-data-empty interrupt (TXI) at this time. Serial transmit data is transmitted in the following order from the TxO pin (figure 13.11): 1. Start bit: one 0 bit is output. 2. Transmit data: seven or eight bits are output, LSB first. 3. Multiprocessor bit: one multiprocessor bit (MPBT value) is output. 4. Stop bit: one or two I bits (stop bits) are output. 5. Mark state: output of 1 bits continues until the start bit of the next transmit data. 6. The SCI checks the TORE bit when it outputs the stop bit. If TORE is 0, the SCI loads data from the TOR into the TSR. outputs the stop bit, then begins serial transmission of the next frame. If TORE is 1, the SCI sets the TENO bit in the SSR to I, outputs the stop bit, then continues output of I bits in the mark state. If the transmit-end interrupt enable bit (TEIE) in the SCR is set to I, a transmit-end interrupt (TEl) is requested at this time. MUlti- Multi- Start processor Stop Start processor Slop 1 bit Data bit bit bit Data bit bit S~=~ I 0 I Do I 01 I~~ I 07 I 0/1 I 0 I Do I I~, I I I 01 07 0/1 1 Idle (mark state) TORE r-L.\-,__--'I TEND TXI TXI interrupt f TXI , t TEl request handler writes request' request : data in TOR and clears TORE to 0 ' . 1 frame Figure 13.11 Example of SCI Multiprocessor Transmit Operation (8-bit data with multiprocessor bit and one stop bit) HITACHI 373 Receiving Multiprocessor Serial Data: Figure 13.12 shows a sample flowchart for receiving multiprocessor serial data. The procedure for receiving multiprocessor serial data is listed below. 1. SCI initialization: select the RxD pin function with the PFC. 2. ID receive cycle: set the MPIE bit in the serial control register (SCR) to l. 3. SCI status check and compare to ID reception: read the serial status register (SSR), check that RDRF is set to 1, then read data from the receive data register (RDR) and compare with the processor's own ID. If the ID does not match the receive data, set MPIE to I again and clear RDRF to O. If the ID matches the receive data, clear RDRF to O. 4. Receive error handling and break detection: if a receive error occurs, read the ORER and FER bits in SSR to identify the error. After executing the necessary error handling, clear both ORER and FER to O. Receiving cannot resume if ORER or FER remain set to 1. When a framing error occurs, the RxD pin can be read to detect the break state. 5. SCI status check and data receiving: read SSR, check that RDRF is set to 1, then read data from the receive data register (RDR). 374 HITACHI Initialization CD Start receiving Set the MPIE bit of the SCR to 1 ® Read the ORER and FER bits of the SSR Yes Read the RDRF bit of the SSR @ No Read the receive data of the RDR No Yes Read the ORER and FER bits of the SSR Yes No Read the SSR's RDRF bit ® No Yes Read the RDR's receive data No @ Error handling Yes Clear the RE bit of the SCR to a Reception ends Figure 13.12 Sample Flowchart for Receiving Multiprocessor Serial Data HITACHI 375 Start of error handling No Overrun error handling No Framing error handling Clear RE bit to 0 in SCR Clear ORE A and FER to 0 in SSR End Figure 13.12 Sample Flowchart for Receiving Multiprocessor Serial Data (cont) 37SHITACHI Figure 13.13 shows an example of SCI receive operation using a multiprocessor format. Start Stop Start Stop bit Data ID1 MPB bit bit Data 1 MPB bit S~~~ I 0 I Do 1 D1 I~l§iJ 0 'I-Do"'-ID-1-'1 ~S [D7] 0 1'-1-:'-::d'-e-:-~~-a~~~ ~S MPB MPIE RDRF RDR \ value _ _ _7""--'7"~_ _ _ _ _.......J)O~_ _ _ _ _4--\~_ID_1_ _ _Ir-_ _ \ RXI request. RXI interrupt Not own ID. NoRXI (m ultiprocessor handler reads data so MPIE is interrupt. interrupt) MPIE = 0 in RDR and clears set to 1 again RDR maintains RDRF to 0 state Figure 13.13 Example of SCI Receive Operation (own ID does not match data) (8-bit data with multiprocessor bit and one stop bit) HITACHI 377 Stop MPB bit ~...,...,..,--:--~ 1 Idle (mark state) MP~ ____~______S~~____~ MPIE RDAF RDA-------------?~~~~r---r-----~~~---+-.r~----­ value ------------r'---?4--------1 L+-----------lc-\'r-----f~-1 '-_,------ RXI request, AXI interrupt Own 10, so receving MPIE (multiprocessor handler reads data continues, with data bit is again interrupt) in RDR and clears received at each AXI set to 1 MPIE= 0 RDRF toO Figure 13.13 Example of SCI Receive Operation (own ID matches data) (8-bit data with multiprocessor bit and one stop bit) (cont) 13.3.4 Clocked Synchronous Operation In the clocked synchronous mode, the SCI transmits and receives data in synchronization with clock pulses. This mode is suitable for high-speed serial communication. The SCI transmitter and receiver share the same clock but are otherwise independent, so full duplex communication is possible. The transmitter and receiver are also double buffered, so continuous transmitting or receiving is possible by reading or writing data while transmitting or receiving is in progress. Figure 13.14 shows the general format in clocked synchronous serial communication. 378 HITACHI • Transfer direction One unit (character or frame) of serial data Serial clock Serial data Note: . High except in continuous transmitting or receiving. Figure 13.14 Data Format in Clocked Synchronous Communication In clocked synchronous serial communication, each data bit is output on the communication line from one falling edge of the serial clock to the next. Data are guaranteed valid at the rising edge of the serial clock. In each character, the serial data bits are transmitted in order from the LSB (first) to the MSB (last). After output of the MSB, the communication line remains in the state of the MSB. In the clocked synchronous mode, the SCI transmits or receives data by synchronizing with the falling edge of the serial clock. Communication Format: The data length is fixed at eight bits. No parity bit or multiprocessor bit can be added. Clock: An internal clock generated by the on-chip baud rate generator or an external clock input from the SCK pin can be selected as the SCI transmit/receive clock. The clock source is selected by the CIA bit in the serial mode register (SMR) and bits CKE I and CKEO in the serial control register (SCR). See table l3.6. When the SCI operates on an internal clock, it outputs the clock signal at the SCK pin. Eight clock pulses are output per transmitted or received character. When the SCI is not transmitting or receiving, the clock signal remains in the high state. Figure 13.15 shows an example of SCI transmit operation. In transmitting serial data, the SCI operates as follows. 1. The SCI monitors the TDRE bit in the SSR. When TDRE is cleared to 0 the SCI recognizes that the transmit data register (TDR) contains new data. and loads this data from the TDR into the transmit shift register (TSR). 2. After loading the data from the TDR into the TSR, the SCI sets the TDRE bit to 1 and starts transmitting. Ifthe transmit-data-empty interrupt enable bit (TIE) in the SCR is set to 1, the SCI requests a transmit-data-empty interrupt (TXI) at this time. HITACHI 379 If clock output is selected, the SCI outputs eight serial clock pulses. If an external clock source is selected, the SCI outputs data in synchronization with the input clock. Data are output from the TxD pin in order from the LSB (bit 0) to the MSB (bit 7). 3. The SCI checks the TDRE bit when it outputs the MSB (bit 7). If TDRE is 0, the SCI loads data from the TDR into the TSR, transmits the MSB, then begins serial transmission of the next frame. IfTDRE is I, the SCI sets the TEND bit in the SSR to 1, transmits the MSB, then holds the transmit data pin (TxD) in the MSB state. If the transmit-end interrupt enable bit (TEIE) in the SCR is set to 1, a transmit-end interrupt (TEl) is requested at this time. 4. After the end of serial transmission, the SCK pin is held in the high state. ~Transmit direction Serial clock Serial data : : : --+-J+ - - 1 TXI --+--1 ~:t- -t--1-----4~ TXI interrupt -+-\ TXI TEl request handler writes request request data in TOR and clears TORE to 0 1 frame Figure 13.1S Example of SCI Transmit Operation Transmitting and Receiving Data: SCI Initialization (clocked synchronous mode): Before , (SCR), then initialize the SCI as follows. ° transmitting or receiving, software must clear the TE and RE bits to in the serial control register When changing the communication mode or format, always clear the TE and RE bits to before ° ° following the procedure given below. Clearing TE to sets TDRE to 1 and initializes the transmit shift register (TSR). Clearing RE to 0, however, does not initialize the RDRF, PER, FER, and ORER flags and receive data register (RDR), which retain their previous contents. Figure 13.16 is a sample flowchart for initializing the SCI. The procedure for initializing the SCI is listed below. 380 HITACHI 1. Select the communication format in the serial mode register (SMR). 2. Write the value corresponding to the bit rate in the bit rate register (BRR) unless an external clock is used. 3. Select the clock source in the serial control register (SCR). Leave RIE, TIE, TEIE, MPIE, TE and RE cleared to O. 4. Wait for at least the interval required to transmit or receive one bit, then set TE or RE in the serial control register (SCR) to I. Also set RIE, TIE, TEIE and MPIE. Setting the corresponding bit of the pin function controller, TE and RE enables the SCI to use the TxD or RxDpin. Start of initialization Clear TE and RE bits to 0 in SCR Select communication format in SMR CD Set value in BRR ® Set RIE, TIE, TEIE, MPIE, CKE1, and CKEO bits in SCR ® (leaving TE and RE cleared to 0) No Set TE or RE to 1 in SCR; Set RIE, TIE, TEIE, and MPIE End Note: High except in continuous transmitting or receiving. Figure 13.16 Sample Flowchart for SCI Initialization HITACHI 381 Transmitting Serial Data (clocked synchronous mode): Figure 13.17 shows a sample flowchart for transmitting serial data. The procedure for transmitting serial data is listed below. 1. SCI initialization: select the TxD pin function with the PFC. 2. SCI status check and transmit data write: read the serial status register (SSR), check that the TDRE bit is 1, then write transmit data in the transmit data register (TDR) and clear TDRE to O. The RXI interrupt can also be used to determine if the RDRF bit has changed from 0 to 1. 3. To continue transmitting serial data: read the TDRE bit to check whether it is safe to write (1); if so, write data in TDR, then clear TDRE to O. When the DMAC is started by a transmit-data- empty interrupt request (TXI) to write data in TDR, the TDRE bit is checked and cleared automatically. Initialize Start transmitting Read TORE bit in SSR No Write transmit data in TOR and clear TORE bit to 0 in SSR No Read TENO bit in SSR No Clear TE bit SCR to 0 Transmission ends Figure 13.17 Sample Flowchart for Serial Transmitting 382 HITACHI Receiving Serial Data (clocked synchronous mode): Figure 13.18 shows a sample flowchart for receiving serial data. When switching from the asynchronous mode to the clocked synchronous mode, make sure that ORER, PER, and FER are cleared to O. If PER or FER is set to 1, the RDRF bit will not be set and both transmitting and receiving will be disabled. Figure 13.19 shows an example of SCI recieve operation. The procedure for recieving serial data is listed below. 1. SCI initialization: select the RxD pin function with the PFC. 2. Receive error handling: if a receive error occurs, read the ORER bit in SSR to identify the error. After executing the necessary error handling, clear ORER to O. Transmitting/receiving cannot resume if ORER remains set to 1. 3. SCI status check and receive da~ read: read the serial status register (SSR), check that RDRF is set to 1, then read receive data from the receive data register (RDR) and clear RDRF to O. The RXI interrupt can also be used to determine if the RDRF bit has changed from 0 to 1. 4. To continue receiving serial data: read RDR, and clear RDRF to 0 before the frame MSB (bit 7) of the current frame is received. If the DMAC is started by a receive-data-full interrupt (RXI) to read RDR, the RDRF bit is cleared automatically so this step is unnecessary. HITACHI 383 Initialization Start receiving Read the ORER bit of the SSR Read RDRF bit of the SSR ® No Yes Read the RDR's receive data @ and clear the SSR's RDRF bit to 0 No Clear the RE bit of the SCR to 0 Reception ends Figure 13.18 Sample Flowchart for Serial Receiving 384 HITACHI Error handling No Overrun error handling Clear ORER bit of SSR to 0 End Figure 13.18 Sample Flowchart for Serial Receiving (cont) SI RDRF~ I ORER _ _+-....,..' --+---1~'r)---- -_-_~~i\-\-_____I\__---__!I -_ IRXI interrupt handler \ II t RXI request i reads data in RDR RXI request Overrun I and clears RDRF to 0 , error, ERI request i4 ~i 1 frame Figure 13.19 Example of SCI Receive Operation In receiving, the SCI operates as follows: 1. The SCI synchronizes with serial clock input or output and initializes internally. 2. Receive data is shifted into the RSR in order from the LSB to the MSB. After receiving the data, the SCI checks that RDRF is 0 so that receive data can be loaded from the RSR into the RDR. If this check passes, the SCI sets RDRF to 1 and stores the received data in the RDR. If HITACHI 385 the check does not pass (receive error), the SCI operates as indicated in table 13.8. When the error flag is set to 1 and the RDRF bit is cleared to 0, the RDRF bit will not be set to I during reception. When restarting the reception, make sure to clear the error flag to O. 3. After setting RDRF to I, if the receive-data-full interrupt enable bit (RIE) is set to I in the SCR, the SCI requests a receive-data-full interrupt (RXI).lfthe ORER bit is set to 1 and the receive-data-full interrupt enable bit (RIE) in the SCR is also set to 1, the SCI requests a receive-error interrupt (ERI). Transmitting and Receiving Serial Data Simultaneously (clocked synchronous mode): Figure 13.20 shows a sample flowchart for transmitting and receiving serial data simultaneously. The procedure for transmitting and receiving serial data simultaneously is listed below. 1. SCI initialization: select the TxD and RxD pin function with the PFC. 2. SCI status check and transmit data write: read the serial status register (SSR), check that the TDRE bit is 1, then write transmit data in the transmit data register (TDR) and clear TDRE to O. The TXI interrupt can also be used to determine if the TDRE bit has changed from 0 to I. 3. Receive error handling: if a receive error occurs, read the ORER bit in SSR to identify the error. After executing the necessary error handling, clear ORER to O. Transmitting/receiving cannot resume if ORER remains set to I. 4. SCI status check and receive data read: read the serial status register (SSR), check that RDRF is set to 1, then read receive data from the receive data register (RDR) and clear RDRF to O. The RXI interrupt can also be used to determine if the RDRF bit has changed from 0 to 1. 5. To continue transmitting and receiving serial data: read the RDRF bit and RDR, and clear RDRF to 0 before the frame MSB (bit 7) of the current frame is received. Also read the TDRE bit to check whether it is safe to write (I); if so, write data in TDR, then clear TDRE to 0 before the MSB (bit 7) of the current frame is transmitted. When the DMAC is started by a transmit-data-empty interrupt request (TXI) to write data in TDR, the TDRE bit is checked and cleared automatically. When the DMAC is started by a receive-data-full interrupt (RXI) to read RDR, the RDRF bit is cleared automatically. 386 HITACHI Initialization Start transmitting and receiving Read TORE bit of the SSR ® No Write transmit data to the TOR and clear the TORE bit of the SSR toO Read the ORER bit of the SSR Yes ® Error handling Read the SSR's RORF bit @ No Read the receive data of the ROR and clear the RORF bit of ® the SSR to 0 No Clear the TE and RE bits of the SCR to 0 Transmitting/receiving ends Note: In switching from transmitting or receiving to simultaneous transmitting and receiving, clear both TE and RE to 0, then set both TE and RE to 1. Figure 13.20 Sample Flowchart for Serial Transmitting HITACHI 387 13.4 SCI Interrupt Sources and the DMAC The SCI has four interrupt sources in each channel: transmit-end (TEl), receive-error (ERI), receive-data-full (RXI), and transmit-data-empty (TXI). Table 13.12 lists the interrupt sources and indicates their priority. These interrupts can be enabled and disabled by the TIE, RIE, and TEIE bits in the serial control register (SCR). Each interrupt request is sent separately to the interrupt controller. TXI is requested when the TDRE bit in the SSR is set to 1. TXI can start the direct memory access controller (DMAC) to transfer data. TDRE is automatically cleared to 0 when the DMAC executes the data transfer to the transmit data register (TDR). RXI is requested when the RDRF bit in the SSR is set to 1. RXI can start the DMAC to transfer data. RDRF is automatically cleared to 0 when the DMAC executes the data transfer to the receive data register (RDR). ERI is requested when the ORER, PER, or FER bit in the SSR is set to 1. ERI cannot start the DMAC. TEl is requested when the TEND bit in the SSR is set to 1. TEl cannot start the DMAC. A TXI interrupt indicates that transmit data writing is enabled. A TEl interrupt indicates that the transmit operation is complete. Table 13.12 SCI Interrupt Sources Interrupt Source Description DMAC Availability Priority ERI Receive error (ORER, PER. or FER) No High RXI Receive data full (RDRF) Yes i TXI Transmit data empty (TDRE) Yes J, TEND Transmit end (TEND) No Low 13.5 Usage Notes Note the following points when using the SCI. TDR Write and TDRE Flags: The TDRE bit in the serial status register (SSR) is a status flag indicating loading of transmit data from the TDR into the TSR. The SCI sets TDRE to 1 when it transfers data from the TDR to the TSR. If new data is written in the TDR when TDRE is 0, the old data stored in the TDR will be lost because these data have not yet been transferred to the TSR. Before writing transmit data to the TDR, be sure to check that TDRE is set to 1. Simultaneous Multiple Receive Errors: Table 13.13 indicates the state of the SSR status flags when multiple receive errors occur simultaneously. When an overrun error occurs, the RSR contents cannot be transferred to the RDR, so receive data is lost. 388 HITACHI Table 13.13 SSR Status Flags and Transfer of Receive Data Receive Data SSR Status Flags Transfer Receive Error Status RDRF ORER FER PER RSR~ RDR Overrun error 0 0 X Framing error o 0 0 0 Parity error o 0 0 0 Overrun error + framing error 0 X Overrun error + parity error 0 X Framing error + parity error 0 0 0 Overrun error + framing error + parity X error 0: Receive data is transferred from RSR-RDR. X: Receive data is not transferred from RSR-RDR. Break Detection and Processing: Break signals can be detected by reading the RxD pin directly when a framing error (FER) is detected. In the break state, the input from the RxD pin consists of all Os, so FER is set and the parity error flag (PER) may also be set. In the break state, the SCI receiver continues to operate, so if the FER bit is cleared to 0, it will be set to 1 again. Sending a Break Signal: When TE is cleared to 0 the TxD pin becomes an lIO port, the level and direction (input or output) of which are determined by the data register (DR) of the I/O port and the control register (CR) of the PFC. This feature can be used to send a break signal. The DR value substitutes for the mark state until the PFC setting is performed. The DR bits should therefore be set as an output port that outputs 1 beforehand. To send a break signal during serial transmission, clear the DR bit to 0, and select output port as the TxD pin function by the PFC. When TE is cleared to 0, the transmitter is initialized. regardless of its current state. Receive Error Flags and Transmitter Operation (clocked synchronous mode only): When a receive error flag (ORER, PER, or FER) is set to 1, the SCI will not start transmitting even if TDRE is set to 1. Be sure to clear the receive error flags to 0 before starting to transmit. Note that clearing RE to 0 does not clear the receive error flags. Receive Data Sampling Timing and Receive Margin in the Asynchronous Mode: In the asynchronous mode, the SCI operates on a base clock of 16 times the bit rate frequency. In receiving, the SCI synchronizes internally with the falling edge of the start bit, which it samples on the base clock. Receive data is latched on the rising edge of the eighth base clock pulse. See figure 13.21. HITACHI 389 16 clocks I.. i.. 8 clocks ~' Internal 01234567891011121314150123456789101112131415012345 base clock .. -7.5 clocks +7.5 clocks ~ Receive data (RxD) l .,-_S;::..:t::::.ar:..:..t-=.bl:.:...·t_ _ _ _ _ _'--_ _---'=O'-"'O_ _ _ _ _---'-_-=O:...!.1_ Synchronization sampling -1t_________________________ timing Data sampling _ _ _ _ _---'fY....__________...JfY....__________ timing Figure 13.21 Receive Data Sampling Timing in Asynchronous Mode The receive margin in the asynchronous mode can therefore be expressed as in equation 1. Equation 1: M = 1(0.5 - 2~) - (L - 0.5)F - ID -N 0.51(1 + F)I x 100% M: Receive margin (%) N: Ratio of clock frequency to bit rate (N = 16) D: Clock duty cycle (D = 0-1.0) L: Frame length (L = 9-12) F: Absolute deviation of clock frequency From equation (1), ifF =0 and D =0.5 the receive margin is 46.875%, as given by equation 2. Equation 2: D =0.5, F =0 M = (0.5 -1/(2 x 16)) x 100% =46.875% (2) This is a theoretical value. A reasonable margin to allow in system designs is 20-30%. Constraints on DMAC Use: • When using an external clock source for the serial clock, update the TDR with the DMAC, and then after five system clocks or more elapse, input a transmit clock. If a transmit clock is input in the first four system clocks after the TDR is written, an error may occur (figure 13.22). 390 HITACHI • Before reading the receive data register (RDR) with the DMAC, select the receive-data-full interrupt of the SCI as a start-up source using the resource select bit (RS) in the channel control register (CHCR). SCK TORE 1,--.....__ ....1 Note: During external clock operation, an error may occur if t is 4/8 AN3 Analog Control circuit ~----"- <1>/16 AN4 mUlti- ANs plexer ANs Sample-and- AN? hold circuit ADI ' - - - - - - - - t - interrupt I ADTRG~----------------------------~ I signal I - - - - - - - - - - - - - - - - - - - - - - - - - - - --AID converter- - - - - - - __ 1 ADCR: AID control register ADCSR: AID control/status register ADORA: AID data register A ADDRB: AID data register B ADDRC: AID data register C ADDRD: AID data register E Figure 14.1 Block Diagram of the AID Converter 394 HITACHI 14.1.3 Configuration of Input Pins Table 14.1 lists input pins for the AID converter. The eight analog input pins are grouped into two sets. Group 0 is analog input pins 0-3 (ANo-AN3) and group I is pins 4-7 (AN4-AN7). Pins AVec and A V ss are the power supply for the analog circuit of the AID converter. A V ref is the analog reference voltage for AID conversion. Table 14.1 Input Pins Pin Name Abbreviation 110 Function Analog supply voltage AVec Power supply for the analog circuits Analog ground AVss Ground and reference voltage for the analog circuits Analog reference AVref Reference voltage for the analog circuits power supply Analog input 0 ANa Analog input pins. group 0 Analog input 1 AN1 Analog input 2 AN2 Analog input 3 AN3 Analog input 4 AN4 Analog input pins. group 1 Analog input 5 ANs Analog input 6 ANs Analog input 7 AN7 AID conversion trigger ADTRG External trigger input input HITACHI 395 14.1.4 Configuration of AID Registers The AID converter includes the registers listed in table 14.2. Table 14.2 AID Registers Register Name Abbreviation RIW Initial Value Address*1 Access Size AID data register A (high) ADDRAH R H'OO H'05FFFEEO 8, 16 AID data register A (low) ADDRAl R H'OO H'05FFFEE1 16 AID data register B (high) ADDRBH R H'OO H'05FFFEE2 8, 16 AID data register B (low) ADDRBl R H'OO H'05FFFEE3 16 AID data register C (high) ADDRCH R H'OO H'05FFFEE4 8, 16 AID data register C (low) ADDRCl R H'OO H'05FFFEE5 16 AID data register D (high) ADDRDH R H'OO H'05FFFEE6 8, 16 AID data register D (low) ADDRDl R H'OO H'05FFFEE7 16 AID control/status register ADCSR RI(W)*2 H'OO H'05FFFEE8 8,16 AID control register ADCR RIW H'7F H'05FFFEE9 8,16 Notes: 1. Only the values of bits A27-A24 and A8-AO are valid; bits A23-A9 are ignored. For details on the register addresses, see section 8.3.5, Description of Areas. 2. Only 0 can be written into bit 7 to clear the flag. 14.2 Register Descriptions 14.2.1 AID Data Registers A-D (ADDRA-ADDRD) The four AID data registers (ADDRA-ADDRD) are 16-bit read-only registers that store the results of the AID conversion. Each result consists of 10 bits. The first 8 bits are stored in the upper byte of the data register corresponding to the selected channel. The last two bits are stored in the lower byte of the data register. Bits 5-0 of the lower byte are reserved and always read O. Each data register is assigned to two analog input channels (table 14.3). The AID data registers are always readable by the CPU. The upper byte can be read directly and the lower byte is read via a temporary register (TEMP). See section 14.3, CPU Interface, for details. The AID data registers are initialized to H'OOOO at a reset or in standby modes. 396 HITACHI Bit: 15 14 13 12 11 10 9 8 ADORn: I AD9 AD8 AD7 I AD6 AD5 AD4 AD3 AD2 Initial value: 0 0 0 0 0 0 0 0 RIW: R R R R R R R R Bit: 7 6 5 4 3 2 0 ADORn: I AD1 ADO Initial value: 0 0 0 0 0 0 0 0 RIW: R R R R R R R R n=A-D Table 14.3 Assignment of Data Registers to Analog Input Channels Analog Input Channel GroupO Group 1 AID Data Register ANO AN4 ADORA AN1 AN5 ADDRB AN2 AN6 ADDRC AN3 AN7 ADDRD 14.2.2 AID Control/Status Register (ADCSR) The AID control/status register (ADCSR) is an 8-bit read/write register that controls the operation of the AID converter (mode selection, etc.). ADCSR is initialized to H'OO at a reset or in standby modes. Bit: 7 6 5 4 3 2 1 0 Bit name: I ADF ADIE ADST SCAN CKS CH2 CH1 CHO Initial value: 0 0 0 0 0 0 0 0 RIW: R/(W)* RIW RIW RIW RIW RIW RIW RIW Note: Write 0 to clear the flag. HITACHI 397 • Bit 7 (AID end flag (ADF»: ADF indicates that AID conversion is completed. Bit 7 (ADF) Description o Cleared to 0 under the following conditions (initial value): • The CPU reads the ADF bit while the bit is set to 1, then writes 0 into the bit • The ADI starts the DMAC and the NO conversion register is accessed Set to 1 at the following times: • Single mode: When NO conversion is complete • Scan mode: When AID conversion of all selected channel are complete • Bit 6 (AID interrupt enable (ADIE»: ADIE selects whether or not to request an AID interrupt (ADI) when AID conversion is completed. Bit 6 (ADIE) Description o The NO interrupt (ADI) request is disabled (initial value) The AID interrupt (ADI) request is enabled • Bit 5 (AID start (ADST»: ADST selects the start or halt of AID conversion. Whenever the AID converter is operating, this bit is set to 1. It can also be set to 1 by the AID conversion trigger input pin (ADTRG). Bit 5 (ADST) Description o NO conversion is halted (initial value) • Single mode: NO conversion is performed. This bit is automatically cleared to o at the end of the conversion. • Scan mode: NO conversion starts and continues cyclically on the selected channels until this bit is cleared to 0 by software, reset, or the standby mode. • Bit 4 (scan mode (SCAN»: SCAN selects either scan mode or single mode for operation. See section 14.4, Operation, for descriptions of these modes. The mode should be changed only when the ADST bit is cleared to O. Bit 4 (SCAN) Description o Single mode (initial value) Scan mode 398 HITACHI • Bit 3 (clock select (CKS»: CKS selects the AID conversion time. The conversion time should be changed only when the ADST bit is cleared to O. Bit 3 (CKS) Description a Conversion time =266 states (maximum) (initial value) Conversion time =134 states (maximum) • Bits 2-0 (channel select 2-0 (CH2-CHO»: CH2-CHO selects analog input channels with the SCAN bit. The channel selection should be changed only when the ADST bit is cleared to O. Group Select Channel Select Selected Channels CH2 CH1 CHO Single Mode Scan Mode a a a ANa ANa (initial value) a AN1 ANa andAN1 a AN2 ANO-AN2 AN3 ANO-AN3 a a AN4 AN4 a 1 AN5 AN4 and AN5 a AN6 AN4-AN6 AN7 AN4-AN7 14.2.3 AID Control Register (ADCR) The AID control register (ADCR) is an 8-bit read/write register that selects whether or not to start the AID conversion when an external trigger is input. The ADCR is initialized to H'7F at a reset or in standby mode. Bit: 7 6 5 4 3 2 a Bit name: I TRGE I Initial value: a R/W: R/W HITACHI 399 • Bit 7 (trigger enable (TRGE»; TRGE selects whether or not to start the AID conversion when an external trigger is input. Bit 7 (TRGE) Description o When an external trigger is input. the NO conversion does not start (initial value) The NO conversion starts at the falling edge of an input signal from the external trigger pin (AOTRG). • Bits 6-0 (reserved); These bits always read as 1. The write value should always be 1. 14.3 CPU Interface The data buses for the CPU are 8-bit buses. but the AID data registers (ADDRA-ADDRD) are 16- bit registers. Therefore. the upper byte of each register can be read directly. but the lower byte is accessed through an 8-bit temporary register (TEMP). When the CPU reads the upper byte of an AID data register. the upper byte is transferred to the . CPU and the lower byte to the TEMP. When the lower byte is accessed. the value in the TEMP is transferred to the CPU. A program should first read the upper byte. then the lower byte of the AID data register. This can be performed by reading ADDR from the upper byte end using a word transfer instruction (MOV.W or the like). Reading only the upper byte would assure the CPU of obtaining consistent data. If the program reads only the lower byte. however. consistent data will not be guaranteed. Figure 14.2 shows the data flow during the access to AID data registers. 400 HITACHI Upper byte read CPU Bus Module internal data bus receives .....~1111111~ interface r-I...- ...- - - -...- - - - - . data H'AA ADORn H n = A to 0 [H'AA] Lower byte read CPU Bus Module internal data bus receives .....~1111111~ interface 1-41...- , . . - - - -...- - - - - . data H'40 ADORn H n = A to 0 [H'AA] Figure 14.2 Read Access to AID Data Register (When Register Contains H'AA40) HITACHI 401 14.4 Operation The AID converter operates by successive approximation with a lO-bit resolution. Its two modes, single mode and scan mode, are described below. 14.4.1 Single Mode (SCAN = 0) In the single mode, ND conversion is performed on a single channel. AID conversion starts when the ADST bit of the AID controllstatus register (ADCSR) is set to I by software or an external trigger input. During the conversion process the ADST bit remains set at I. When the conversion is completed, the ADST bit is automatically cleared to O. When the conversion is completed, the ADF bit is set to I. If the interrupt enable bit (ADIE) of the ADCSR is also set to I, an AID conversion interrupt (AD I) is requested. When the ADCSR is read and 1 is written in the ADF bit, the ADF bit is clearedto O. Before changing a mode or analog input channel, clear the ADST bit in the ADCSR to 0 to stop the AID conversion in order to prevent malfunctions. Setting the ADST bit to I after changing the mode or channel starts the AID conversion again (changing the mode or channel and setting the ADST bit can be performed simultaneously). The following is an example of the AID conversion process in the single mode when channel I (ANI) is selected. See figure 14.3 for the timing. 1. The program selects the single mode (SCAN = 0) and input channel ANI (CH2 = CHI = 0, CHO = 1), enables the AID interrupt request (ADIE = I), and sets the ADST bit to 1 to start the AID conversion. 2. At the end of the conversion process the AID converter transfers the result to register ADDRB, sets the ADF bit to I, clears the ADST bit to 0, and halts. 3. Since ADF = 1 and ADIE = 1, an AID interrupt is requested. 4. The AID interrupt-handling routine is started. 5. The interrupt-handling routine reads the ADF value; since it is 1, it writes a 0 into the ADF bit. 6. The interrupt-handling routine reads and processes the AID conversion result (ADDRB). 7. The routine ends. Steps 2-7 can now be repeated by setting the ADST bit to 1 again. 402 HITACHI z ~ 01!j ;' 0 0 =e AOIE _____. . .,Set* r--- a .... ::I ~ t a AOST ... II) a ~ =e t/) AOF 0 '"' 5 1 5" - $ D! c·::s ;. Q. 0" Channel 0 (ANa) operating 5" Channel 1 (AN 1) 00 2l. Waitin ;. 2 operating ta- U fD 0" Channel 2 (AN 2 ) :: C> ::I ~ :a. 00 ~ ~ III ::J g_. III::e ADST ______________ .Set*1 r,-- ~J' .Clear*l I 0 ::J (Q .... 0. ADF 0 n III "0 o ::: ... ~ ::J0 CB ::e ._ Channeloperating 0 (ANo) .... 110) S· ~ (i) a0' = s:r 0. (j)' -. !2. (i) Channel 1 (AN 1) (Q (J) I:/:l operating n 110) 5 5' (i) .... _ (J) ::= 0 0. . .... c: 9- Channel 2 (AN 2 ) operating I Waiting Waiting Q. o· ::J ~ ---~ (i) >< (i) Channel 3 (AN3) :r ~ n c: operating n= a;- 0. :r 110) cr '< ADDRA AID conversion result 4 = ~ = (J) 0 ;::: r;; ::e II> ADDRB AID conversion result 2 ie; iD ~ ADDRC X AID conversion result 3 I:/:l ~ :I: ~I ADDRD =i » 0 ± - Q. ~ 0 U1 14.4.3 Input Sampling Time and AID Conversion Time With a built-in sample-and-hold circuit, the ND converter performs input sampling at time to after the ADST bit of the AID controllstatus register (ADCSR) is set to 1. The actual AID conversion begins after the sampling is completed. See figure 14.5 for AID conversion timing and table 14.4 for AID conversion times. The total conversion time includes to and the input sampling time, as shown in figure 14.5. The purpose of to is to synchronize the ADCSR write time with the AID conversion process, therefore the duration of to is variable. As a result, the total conversion time ranges as shown in table 14.4. In the scan mode, the ranges given in table 14.4 apply to the first conversion. The duration of the second and subsequent conversion processes is fixed at 256 states (CKS =0) or 128 states (CKS = 1). CK Address Write signal Input sampling timing AOF i r-- -+I------T-------r'--------~~~------~, i.. tD .:.. tSPL~ i..,.- 'teoNV I tD NO start delay tSPL Input sampling time teoNv NO conversion time Notes: 1. AOSCR write cycle 2. AOSCR address Figure 14.5 AID Conversion Timing 406 HITACHI Table 14.4 AID Conversion Time (Single Mode) CKS=O CKS=1 Hem Symbol Min Typ Max Min Typ Max AID start delay to 10 11 6 9 Input sampling time tSPL 64 32 Total AID conversion time tooNV 259 266 131 134 Note: Values are in number of states (tcyc). 14.4.4 AID Conversion Start by External Trigger Input The AID converter can be started when an external trigger is input. The external trigger is input from the ADTRG input pin when the trigger enable (TRGE) bit in the AID control register (ADCR) is set to 1. When the ADTRG input pin is asserted low, the AID start (ADST) bit in the AID control/status register (ADCSR) is set to 1 and the AID conversion begins. All other operations are the same as when the ADST bit is set to 1, regardless of whether the mode is single or scan. For the timing, see figure 14.6. CK ADTRG External trigger Signal ADST .. AID conversion Figure 14.6 External Trigger Input Timing 14.5 Interrupts and DMA Transfer Requests The AID converter can generate an AID interrupt (ADI) request at the end of conversion. The ADI request is enabled by setting the ADIE bit in the ADCSR to 1, or is disabled by clearing the bit to O. When the ADI is generated, the DMAC can be started. DMA transfers can be performed by requesting a ADI interrupt by setting the resource select bits (RS3-RSO) of the DMA channel control register (CHCR) of the direct memory access controller (DMAC). The ADF bit in the ADCSR is automatically cleared to 0 when the DMAC transfers data. HITACHI 407 14.6 Definitions of AID Conversion Accuracy The AID converter compares an analog value input from an analog input channel to its analog reference value and converts it into 10-bit digital data. The absolute accuracy of this AID conversion is the deviation between the input analog value and the output digital value. It includes the following errors: • Offset error • Full-scale error • Quantization error • Nonlinearity error These four error quantities are explained below using figure 14.9. In the figure, the 10 bits of the AID converter have been simplified to 3 bits. Offset error is the deviation between actual and ideal AID conversion characteristics when the digital output value changes from the minimum (zero voltage) 0000000000 (000 in the figure) to 000000001 (001 in the figure)(figure 14.7, item (1). Full-scale error is the deviation between actual and ideal AID conversion characteristics when the digital output value changes froni the 1111111110 (110 in the figure) to the maximum 1111111111 (111 in the figure)(figure 14.9, item (2». Quantization error is the intrinsic error of the AID converter and is expressed as 112 LSB (figure 14.9, item (3». Nonlinearity error is the deviation between actual and ideal AID conversion characteristics between zero voltage and full-scale voltage (figure 14.9, item (4». Note that it does not include offset, full-scale or quantization error. I 408 HITACHI (2) Full-scale error Digital output Digital output 1J..1 Ideal AID conversion ---+ Ideal AID 111 characteristics conversion -""""7""----1-......,- characteristics 110 101 100 I 011 / error I I 010 / Actual ":1D ~ convertlOn 001 characteristics 1/8 2/8 3/8 4/8 5/8 6/8 7/8 FS FS Analog input Analog input FS: Full-scale voltage voltage voltage Figure 14.7 Definitions of AID Conversion Accuracy 14.7 AID Converter Usage Notes When using the AID converter, note the points listed in section 14.7.1 below. 14.7.1 Setting Analog Input Voltage • Analog Input Voltage Range: During ND conversion, the voltages input to the analog input pins ANn should be in the range AVSS ~ ANn ~ AVREF. • Relationships of AVee and AVSS to Vee and VSS: AVee. AVss. Vee and Vss should be related as follows: AVee =Vee ± 10% and AVss =Vss. If the converter is not used, AVee = Vee and AVss =Vss· • AVref Input Range: The analog reference voltage input at the AVref pin should be in the range AVref ~ AVee. If the converter is not used, set AVref =Vee. • When the converter is neither in use nor in standby, connect AVec and AVref to the power voltage (Vee). 14.7.2 Handling of Analog Input Pins To prevent damage from voltage surges at the analog input pins (ANO-AN?). connect an input protection circuit like the one shown in figure 14.8. The circuit shown also includes an RC filter to suppress noise. This circuit is shown as an example: The circuit constants should be selected HITACHI 409 according to actual application conditions. Table 14.4 list the analog input pin specifications and figure 14.9 shows an equivalent circuit diagram of the analog input ports. ' AVec SH microprocessor AND-AN? AVss Notes: 1. Figure 14.8 Example of Analog Input Protection Circuit ; - - - - - - - - ----11--------1 11.0 kO II I ...i. ..J\ II I AND-AN? T r I -v II : : ~ 20 pF II ~ 1 MO I I II <:" I II I : 11?1T I II _______ ...JI IL _ _ _ _ _ _ _ _ _ _ _ II Figure 14.9 Analog Input Pin Equivalent Circuit Table 14.5 Analog Input Pin Ratings Item Min Max Unit Analog input capacitance 20 pF Allowable signal-source impedance 3 kO 410 HITACHI Section 15 Pin Function Controller 15.1 Overview The pin function controller (PFC) is composed of registers for selecting the function of multiplexed pins and the direction of input/output. The pin function and input/output direction can be selected for each pin individually without regard to the operating mode of the LSI. Table 15.1 lists the multiplexed pins. Table 15.1 List of Multiplexed Pins Function 1 (rel- Function 2 (rel- Function 3 (rel- Function 4 Port ated module) ated module) ated module) (related module) Pin # A PA15 1/0 (port) IR03 input (INTG) DRE01 input 69 (DMAC) A PA 14 I/O (port) IR02 input (INTC) DACK1 output 68 (DMAC) A PA13 1/0 (port) IR01 input (INTC) TCLKS input (ITU) DREOO input (DMAC) 67 A PA12 I/O (port) IROO input (INTC) TCLKA input (ITU) DACKO output (DMAC) 66 A PA 11 I/O (port) DPH 1/0 (D bus) TIOCS1 1/0 (ITU) 65 A PA10 1/0 (port) DPL I/O (D bus) TIOCA 1 1/0 (ITU) 64 A PA91/0 (port) AH output (BSC) ADTRG input (AID) IRQOUT output (lNTC) 63 A PA81/0 (port) BREQ input (system)- 62 A PA7 1/0 (port) BACK output 60 (system) A PA61/0 (port) RD output (BSC) 59 A PA5 I/O (port) WRH output (BSC) 58 (LBS output (BSC))*1 A PA41/0 (port) WRL output (BSC) 57 (WR output (BSC))*1 A PA3 I/O (port) CS7 output (BSC) WAIT input (BSC) 56 A PA2 1/0 (port) CS6 output (BSC) TIOCBO I/O (ITU) 55 A PA 1 1/0 (port) CS5 output (SSC) RAS output (BSG) 54 TIOCAO 1/0 (ITU) I A PAO 1/0 (port) CS4 output (BSC) 53 HITACHI 411 Table 15.1 List of Multiplexed Pins (cont) Function 1 (rei- Function 2 (rei- Function 3 (rei- Function 4 Port sted module) sted module) sted module) (related module) Pin #. B PB1SI/Q (port) IR07 input (INTC) TP1S output (TPC) 2 B PB14 1/0 (port) IR06 input(INTC) TP14 output (TPC) B PB 13 1/0 (port) IROS input (INTC) SCK1 1/0 (SCI) TP13 output (TPC) 112 B PB 12 1/0 (port) IR04 input (INTC) . SCKO 1/0 (SCI) TP12 output (TPC) 111 B PB 11 1/0 (port) TxD1 output (SCI) TP11 output (TPC) 110 B PB10 1/0 (port) RxD1 input (SCI) TP10 output (TPC) 109 B PB9 1/0 (port) TxDO output (SCI) TP9 output (TPC) 108 B PB8 1/0 (port) RxDO input (SCI) TP8 output (TPC) 107 B PB7 1/0 (port) TClKD input (ITU) TOCXB4 output TP7 output (TPC) 105 (ITU) B PB6 1/0 (port) TClKC input (ITU) TOCXA4 output TP6 output (TPC) 104 (ITU) B PBS 1/0 (port) TIOCB4 1/0 (ITU) TP5 output (TPC) 103 B PB4 1/0 (port) TIOCA4 I/O (ITU) TP4 output (TPC) 102 B PB3 1/0 (port) TIOCB3 1/0 (ITU) TP3 output (TPC) 101 B PB2 1/0 (port) TIOCA3 1/0 (ITU) TP2 output (TPC) 100 B PB 1 1/0 (port) TIOCB2 1/0 (ITU) TP1 output (TPC) 98 B PBO 1/0 (port) TIOCA2 1/0 (ITU) TPO output (TPC) 97 C PC7 input (port) AN7 input (AID) 9S*2 C PC6 input (port) AN6 input (AID) 94*2 . C PC5 input (port) AN5 input(AlD) 93*2 C PC4 input (port) AN4 input (AID) 92*2 C PC3 input (port) AN3 input (AID) 90*2 C PC2 input (port) AN2 input (AID) 89*2 C PC1 input (port) AN1 input (AID) 88*2 C PCO input (port) ANO input (AID) 87*2 CS1 output CASH output (BSC) - 49 (BSC) CS3 output CASl output (BSC) S1 (BSC) INTC: Interrupt controller DMAC: Direct memory access controller ITU: 16-bit integrated timer pulse unit o bus: Data bus control 412 HITACHI BSC: Bus state controller System: System control AID: AID converter SCI: Serial communications interface TPC: Programmable timing pattern controller Port: 1/0 port Notes: 1. The bus control register of the bus state controller handles switching between the two functions. 2. The function of port C pins automatically changes to analog input (ANQ-AN7) when the AID converter begins to operate. 15.2 Register Configuration Table 15.2 summarizes the registers of the pin function controller. Table 15.2 Pin Function Controller Registers Name Abbreviation RIW Initial Value Address Access Size Port A 1/0 register PAIOR RIW H'OOOO H'SFFFFC4 8,16,32 Port A control register 1 PACR1 RIW H'3302 H'SFFFFC8 8,16,32 Port A control register 2 PACR2 RIW H'FF9S H'SFFFFCA 8,16,32 Port B I/O register PBIOR RIW H'OOOO H'SFFFFC6 8,16,32 Port B control register 1 PBCR1 RIW H'OOOO H'SFFFFCC 8,16,32 Port B control register 2 PBCR2 RIW H'OOOO H'SFFFFCE 8,16,32 Column address strobe CASCR RIW H'SFFF H'SFFFFEE 8,16,32 pin control register 15.3 Register Descriptions 15.3.1 Port A 110 Register (PAIOR) The port A I/O register (PAIOR) is a l6-bit read/write register that selects input or output for individual pins on a bit-by-bit basis. Bits PA1510R-PAOIOR correspond to pins PA15IIRQ3IDREQl-PAO/CS41TIOCAO. PAIOR is enabled when the port A pins function as input/outputs (PA15-PAO) and for lTV input capture and output compare (TIOCAl, TIOCAO, TIOCBI, and TIOCBO). For other functions, they are disabled. For portA pin functions PAIS- PAO and TIOCA 1, TIOCAO, TIOCB 1, and TIOCBO, a given pin in port A is an output pin if its corresponding PAlOR bit is set to 1, and an input pin if the bit is cleared to O. PAIOR is initialized to H'OOOO by power-on resets; however, it is not initialized for manual resets, standby mode, or sleep mode. HITACHI 413 Bit: 15 14 12 11 9 8 Bit name: Initial value: 0 0 0 0 0 0 0 0 RIW: RIW RIW RIW RIW RIW RIW RIW RIW Bit: 7 6 5 4 3 0 Bit name: Initial value: 0 0 0 0 RIW: RIW RIW RIW RIW RIW RIW RIW RIW 15.3.2 Port A Control Registers (PACRI and PACR2) PACRI and PACR2 are 16-bit read/write registers that select the functions of the sixteen multiplexed pins of port A. PACR 1 selects the function of the top eight bits of port A; PACR2 selects the function of the bottom eight bits of port A. PACR 1 and PACR2 are initialized to H'3302 and H'FF95 respectively by power-on resets but are not initialized for manual resets, standby mode, or sleep mode. PACRl: Bit: 15 14 13 12 11 10 9 8 Bit name: Initial value: 0 1 1 0 1 1 RIW: RIW RIW RIW RIW RIW RIW RIW Bit: 7 6 5 4 3 2 0 Bit name: Initial value: 0 0 0 0 0 RIW: RIW RIW RIW RIW RIW RIW • Bits 15 and 14 (PA15 mode (PA15MDI and PA15MDO»: PA15MD1 and PA15MDO select the function of the PA15/IRQ3IDREQI pin. 414 HITAcHI Bit 15: Bit 14: PA15MD1 PA15MDO Function o o Input/output (PA 15) (initial value) Interrupt request input (IR03) o Reserved DMA transfer request input (DRE01) • Bits 13 and 12 (PAI4 mode (PAI4MDl and PAI4MDO»: PAl4MDI and PAl4MDO select the function of the PAI4/IRQ2IDACKI pin. Bit 13: Bit 12: PA14MD1 PA14MDO Function o o Input/output (PA14) Interrupt request input (IR02) o Reserved DMA transfer acknowledge output (DACK1) (initial value) • Bits II and 10 (PA13 Mode (PA13MDI and PA13MDO»: PA13MDl and PA13MDO select the function of the PA 13/IRQ IIDREQOrrCLKB pin. Bit 11: Bit 10: PA13MD1 PA13MDO Function o o Input/output (PA13) (initial value) Interrupt request input (IR01) o ITU timer clock input (TCLKB) DMA transfer request input (DREQO) • Bits 9 and 8 (PAI2 mode (PA12MDl and PAI2MDO»: These bits select the function of the PAI2/IRQOIDACKOrrCLKA pin. Bit 9: BitS: PA12MD1 PA12MDO Function o o Input/output (PA12) 1 Interrupt request input (IROO) o ITU timer clock input (TCLKA) DMA transfer acknowledge output (DACKO) (initial value) HITACHI 415 • Bits 7 and 6 (pAIl mode (PA 11 MD 1 and PAIl MDO»: These bits select the function of the PA lllDPHffIOCB 1 pin. Bit 7: Bit 6: PA11MD1 PA11MDO Function o o Input/output (PA 11) (initial value) Upper data bus parity input/output (DPH) o ITU input capture/output compare (TIOCB 1) Reserved • Bits 5 and 4 (PAlO mode (PAI0MDl and PAlOMDO»: These bits select the function of the PAlO/DPLffIOCAI pin. Bit 5: Bit 4: PA10MD1 PA10MDO Function o o Input/output (PA 10) (initial value) Lower data bus parity input/output (DPL) o ITU input capture/output compare (TIOCA 1) Reserved • Bits 3 and 2 (PA9 mode (PA9MDI and PA9MDO»: These bits select the function of the PA9/AHIIRQOUT/ADTRG pin. Bit 3: Bit 2: PA9MD1 PA9MDO Function o o Input/output (PA9) (initial value) Address hold output (AH) o AID conversion trigger input (ADTRG) Interrupt request output (IRQOUT) • Bit 1 (reserved): This bit always reads as 1. The write value should always be 1. • Bit 0 (PA8 mode (PA8MD»: PA8MD selects the function of the PA8IBREQ. Bit 0: PA8MD Function o Input/output (PA8) (initial value) Bus request input (BREQ) 416 HITACHI PACR2: Bit: 15 14 13 12 11 10 9 8 Bit name: I I PA7MD I I PA6MD I I PA5MD I I PA4MD I Initial value: 1 1 1 1 RIW: RIW RIW RIW RIW Bit: 7 6 5 4 3 2 1 0 Bit name: IPA3MD11PA3MDOlpA2MD11PA2MDOlpA1MD11PA1MDOlpAOMD11PAOMDol Initial value: 1 0 0 1 0 1 0 1 RIW: RIW RIW RIW RIW RIW RIW RIW RIW • Bit IS (reserved): This bit always reads as l. The write value should always be l. • Bit 14 (PA7 mode (PA7MD)): PA7MD selects the function of the PA7/BACK pin. Bit 14: PA7MD Function o Input/output (PA7) Bus request acknowledge output (BACK) (initial value) • Bit 13 (reserved): This bit always reads as 1. The write value should always be 1. • Bit 12 (PA6 mode (PA6MD»: PA6MD selects the function of the PA6/RD pin. Bit 12: PA6MD Function o Input/output (PA6) Read output (RD) (initial value) • Bit 11 (reserved): This bit always reads as 1. The write value should always be 1. • Bit 10 (PAS mode (PASMD»: PASMD selects the function of the PASIWRH (LBS) pin. Bit 10: PA5MD Function o Input/output (PA5) Upper write output (WRH) or lower byte strobe output (LBS) (initial value) • Bit 9 (reserved): This bit always reads as l. The write value should always be l. HITACHI 417 • Bit 8 (PA4 mode (PA4MD»: PA4MD selects the function of the PA4IWRL (WR) pin. Bit 8: PA4MD Function o InpuVoutput (PA4) Lower write output (WRL) or write output (WR) (initial value) • Bits 7 and 6 (PA3 mode (PA3MDI and PA3MDO»: PA3MDI and PA3MDO select the function of the PA3/CS71W AIT pin. This pin has a pull-up MOS that is used when it functions as a WAIT pin to allow selection of pull up or no pull up (for the WAIT pin) using the wait state control register of the bus state controller (BSC). There is no pull up when if functions as PA3 or CS7. Bit 7: PA3MD1 Bit 6: PA3MDO Function o 0 InpuVoutput (PA3) Chip select output (CS7) o Wait state input (WAIT) (initial value) Reserved • Bits 5 and 4 (PA2 mode (PA2MDI and PA2MDO»: PA2MDI and PA2MDO s~lect the function of the PA2/CS6ITIOCBO pin. Bit 5: PA2MD1 Bit 4: PA2MDO Function o 0 Input/output (PA2) Chip select output (CS6) (initial value) o ITU input capture/output compare (TIOCBO) Reserved • Bits 3 and 2 (PAl mode (PAIMDI and PAIMDO»): PAIMDI and PAlMDO select the fun<;tion of the PAlICS5IRAS pin. Bit 3: PA1MD1 Bit 2: PA1MDO Function o 0 InpuVoutput (PA 1) Chip select output (CS5) (initial value) o Row address strobe output (RAS) Reserved 418 HITACHI • Bits 1 and 0 (PAO mode (pAOMDl and PAOMDO»: PAOMDl and PAOMDO select the function of the PAO/CS4fTIOCAO pin. Bit 1: PAOMD1 Bit 0: PAOMDO Function o o InpuVoutput (PAO) Chip select output (CS4) (initial value) o ITU input capture/output compare (TIOCAO) Aeserved 15.3.3 Port B I/O Register (PBIOR) The port B I/O register (PBIOR) is a 16-bit read/write register that selects input or output for individual pins on a bit-by-bit basis. Bits PB 1510R-PBOIOR correspond to pins of port B. PBIOR is enabled when the port B pins function as input/outputs (PB 15-PBO), for ITU input capture and output compare (TIOCA4, TIOCA3, TIOCA2, TIOCB4, TIOCB3, and TIOCB2), and as serial clocks (SCK 1, SCKO). For other functions, they are disabled. For port B pin functions PB 15-PBO, and TIOCA4, TIOCA3, TIOCA2, TIOCB4, TIOCB3, and TIOCB2, and SCKlISCKO, a given pin in port B is an output pin if its corresponding PBIOR bit is set to I, and an input pin if the bit is cleared to O. PBIOR is initialized to H'OOOO by power-on resets; however, it is not initialized for manual resets, standby mode, or sleep mode. Bit: 15 14 13 12 11 10 8 Bit name: Initial value: 0 0 0 0 0 0 0 0 RIW: RIW AIW RIW RIW AIW RIW RIW RIW Bit: 7 5 4 3 2 0 Bit name: Initial value: 0 0 0 0 0 0 0 0 RIW: AIW RIW AIW AIW RIW RIW RIW RIW HITACHI 419 15.3.4 Port B Control Registers (PBCRI and PBCR2) PBCRl and PBCR2 are l6-bit read/write registers that select the functions of the sixteen multiplexed pins of port B. PB<;:R I selects the function of the top eight bits of port B; PBCR2 selects the function of the bottom eight bits of port B. PBCR 1 and PBCR2 are initialized to H'OOOO by power-on resets but are not initialized for manual resets, standby mode, or sleep mode. PBCR1: Bit: 15 14 13 12 11 9 8 Bit name: Initial value: 0 0 0 0 0 0 0 R/W: R/W RIVV R/W R/W RIVV RIVV RIVV RIVV Bit: 7 6 5 4 3 2 0 Bit name: Initial value: 0 0 0 0 0 0 0 0 R/W: R/W RIVV R/W R/W R/W RIVV RIVV R/W • Bits 15 and 14 (PBlS mode (PBlSMDl and PBlSMDO»: PBlSMDI and PBlSMDO select the function of the PB1SrrP1S/IRQ7 pin. Bit 15: PB15MD1 Bit 14: PB15MDO Function o o InpuVoutput (PB 15) (initial value) Interrupt request input (IR07) o Reserved Timing pattern output (TP15) • Bits 13 and 12 (PBI4 mode (PBI4MDl and PBI4MDO»: PBl4MDl and PB14MDO select the function of the PBI4rrPl4IIRQ6 pin. Bit 13: PB14MD1 Bit 12: PB14MDO Function o 0 InpuVoutput (PB14) (initial value) Interrupt request input (IR06) o Reserved Timing pattern output (TP14) 420 HITACHI • Bits 11 and 10 (PB13 mode (PB13MDl and PBI3MDO»: PB 13MDI and PB13MDO select the function of the PB 13ffP13/IRQS/SCKI pin. Bit 11: PB13M01 Bit 10: PB13MOO Function o 0 Input/output (PB13) (initial value) Interrupt request input (IR05) o -------------------- Serial clock input/output (SCK1) Timing pattern output (TP13) • Bits 9 and 8 (PBI2 mode (PBI2MDl and PBI2MDO»: PB12MDI and PBI2MDO select the function of the PB 12ffPI2/IRQ4/SCKO pin. Bit 9: PB12M01 Bit 8: PB12MOO Function o o Input/output (PB12) (initial value) Interrupt request input (IR04) o Serial clock input/output (SCKO) Timing pattern output (TP12) • Bits 7 and 6: PBll mode (PBllMDl and PBllMDO): PBIIMDI andPBIIMDO select the function of the PBllffPllffxDI pin. Bit 7: PB11M01 Bit 6: PB11 MOO Function o o Input/output (PB 11) (initial value) Reserved o Transmit data output (TxD1) Timing pattern output (TP11) • Bits 5 and 4 (PB 10 mode (PB I OMD I and PB 10MDO): PB I OMD I and PB IOMDO select the function of the PB lOffPI O/RxD I pin. Bit 5: PB10M01 Bit 4: PB10MOO Function o o Input/output (PB10) (initial value) Reserved o Receive data input (RxD1) Timing pattern output (TP10) HITACHI 421 • Bits 3 and 2 (PB9 mode (PB9MDI and PB9MDO»: PB9MDI and PB9MDO select the function of the PB9ffP9ffxDO pin. Bit 3: PB9MD1 Bit 2: PB9MDO Function o o Input/output (PB9) (initial value) Reserved o Transmit data output (TxDO) Timing pattern output (TP9) • Bits 1 and 0 (PBS mode (PBSMDI and PBSMDO»: PBSMDI and PBSMDO select the function of the PBSffPSlRxDO pin. Bit 1: PB8MD1 Bit 0: PB8MDO Function o o Input/output (PB8) (initial value) Reserved o Receive data input (RxDO) Timing pattern output (TP8) PBCR2: Bit: 15 14 13 12 11 10 9 8 Bit name: I PB7MD11 PB7MDO IPB6MD11 PB6MDO I PB5MD11 PB5MDOI PB4MD11 PB4MDOI Initial value: 0 0 0 0 0 0 0 0 RIW: RIW RIW RIW RIW RIW RIW RIW RIW Bit: 7 6 5 4 3 2 1 0 Bit name: IPB3MD11PB3MDOlpB2MD11PB2MDOlpB1MD11PB1MDOlpBOMD11PBOMDol Initial value: 0 0 0 0 0 0 0 0 RIW: RIW RIW RIW RIW RIW RIW RIW RIW 422 HITACHI • Bits 15 and 14 (PB7 mode (PB7MDI and PB7MDO»: PB7MDI and PB7MDO select the function of the PB7rrP7rrOCXB4rrCLKD pin. Bit 15: Bit 14: PB7MD1 PB7MDO Function o o InpuVoutput (PB7) (initial value) ITU timer clock input (TClKD) o ITU output compare (TOCXB4) Timing pattern output (TP7) • Bits 13 and 12 (PB6 mode (PB6MDl and PB6MDO»: PB6MDI and PB6MDO select the function of the PB6ffP6rrOCXA4ffCLKC pin. Bit 13: Bit 12: PB6MD1 PB6MDO Function o o InpuVoutput (PB6) (initial value) ITU timer clock input (TClKC) o ITU output compare (TOCXA4) Timing pattern output (TP6) • Bits 11 and 10 (PB5 mode (PB5MDI and PB5MDO»: PB5MD I and PB5MDO select the function of the PB5rrp5ffIOCB4 pin. Bit 11: Bit 10: PB5MD1 PB5MDO Function o o InpuVoutput (PB5) (initial value) Reserved o ITU input capture/output compare (TIOCB4) Timing pattern output (TP5) • Bits 9 and 8 (PB4 mode (PB4MDI and PB4MDO»: PB4MDI and PB4MDO select the function of the PB4ffP4ffIOCA4 pin. Bit 9: PB4MD1 Bit 8: PB4MDO Function o o InpuVoutput (PB4) (initial value) 1 Reserved o ITU input capture/output compare (TIOCA4) Timing pattern output (TP4) HITACHI 423 • Bits 7 and 6 (PB3 mode (PB3MDI and PB3MDO»: PB3MDl and PB3MDO select the function of th: PB3ITP3ITIOCB3 pin. Bit 7: PB3MD1 Bit 6: PB3MDO Function o 0 Input/output (PB3) (initial value) Reserved o ITU input capture/output compare (TIOCB3) Timing pattern output (TP3) • Bits 5 and 4 (PB2 mode (PB2MDl and PB2MDO»: PB2MDI and PB2MDO select the function of the PB21TP2ITIOCA3 pin. Bit 5: PB2MD1 Bit 4: PB2MDO Function o 0 Input/output (PB2) (initial value) Reserved o ITU input capture/output compare (TIOCA3) Timing pattern output (TP2) • Bits 3 and 2 (PBI mode (PBIMOI and PBIMOO»: PBIMOl and PBlMOO select the function of the PB lITPlITIOCB2 pin. Bit 3: PB1MD1 Bit 2: PB1MDO Function o 0 Input/output (PB 1) (initial value) Reserved o ITU input capture/output compare (TIOCB2) Timing pattern output (TP1) • Bits 1 and 0 (PBO mode (PBOMOl and PBOMDO»: PBOMOl and PBOMOO select the function of the PBOITPOITIOCA2 pin. Bit 1: PBOMD1 Bit 0: PBOMDO Function o o Input/output (PBO) (initial value) Reserved o ITU input capture/output compare (TIOCA2) Timing pattern output (TPO) 424 HITACHI 15.3.5 Column Address Strobe Pin Control Register (CASCR) CASCR is a 16-bit read/write register that allows selection between column address strobe and chip select pin functions. The CASCR is initialized to H'5FFF by power-on resets but is not initialized for manual resets, standby mode, or sleep mode. Bit: 15 14 13 12 11 10 9 8 Bit name: I CASH M01 CASH MOO CASL M01 CASL MOO Initial value: 0 1 0 R/W: R/W R/W R/W R/W Bit: 7 6 5 4 3 2 0 Bit name: I Initial value: R/W: • Bits 15 and 14 (CASH mode (CASHMDI and CASHMDO»: CASHMDI and CASHMDO select the function of the CS l/CASH pin. Bit 15: Bit 14: CASHMD1 CASHMDO Function o o Reserved Chip select output (CS1) (initial value) o Column address strobe output (CASH) Reserved • Bits 13 and 12 (CASL mode (CASLMDI and CASLMDO»: CASLMDI and CASLMDO select the function of the CS3/CASL pin. Bit 13: Bit 12: CASLMD1 CASLMDO Function o o Reserved Chip select output (CS3) (initial value) o Column address strobe output (CASL) Reserved • Bits II-D (reserved): This bit always reads as 1. The write value should always be 1. HITACHI 425 Section 16 Parallel I/O Ports 16.1 Overview There are three ports, A, B and C. Ports A and Bare 16-bit I/O ports, while port C is an 8-bit input port. The pins of the ports are all multiplexed for use as general-purpose I/Os (or inputs in the case of port C) or for other functions. (Use the pin function controller (PFC) to select the function of multiplexed pins.) Ports A, Band C each have one data register for storing pin data. 16.2 PortA Port A is a 16-pin input/output port, as shown in figure 16.1. The PA3/CS71WAIT pin of port A has a pull-up MOS so that when it is functioning as a WAIT pin, the wait state control register of the bus state controller can be used to select whether to pull up the WAIT pin or not. It is not pulled up when the pin is functioning as either PA3 or CS7. PA 1S (Input/output)/IR03 (Input)/DRE01 (Input) PA 14 (Input/output)/IR02 (Input)/DACK1 (Output) PA 13 (Input/output)/IR01 (Input)/DREOO (Input)fTCLKB (Input) PA 12 (Input/output)/IROO (Input)/DACKO (Output)fTCLKA (Input) PA 11 (lnput/output)/DPH (Input/output)fTlOCB 1 (Input/output) PA 10 (Input/output)/DPL (Input/output)fTlOCA 1 (Input/output) PAg (Input/output)/AH (Output)/IROOUT (Output)/ADTRG (Input) PAs (Input/output)/BREO (Input) Port A PA7 (Input/output)/BACK (Output) PA6 (Input/output)/RD (Output) PAs (Input/output)/wRH (Output) (LBS (Output)) PA4 (Input/output)/wRL (Output) (WR (Output)) PA3 (lnput/output)/CS7 (Output)/wAIT (Input) PA2 (Input/output)/CS6 (Output)fTlOCBO (Input/output) PA 1 (Input/output)/CS5 (Output)/RAS (Output) PAo (Input/output)/CS4 (Output)fTlOCAO (Input/output) Figure 16.1 Port A Configuration 16.2.1 Register Configuration Table 16.1 summarizes the port A register. I HITACHI 427 Table 16.1 Port A Register Name Abbreviation R/W Initial Value Address Access Size Port A data register PADR RIW H'OOOO H'5FFFFCO 8, 16, 32 16.2.2. Port A Data Register (PADR) PADR is a 16-bit read/write register that stores data for port A. The bits PA lSDR-PAODR correspond to the PAlS/IRQ3IDREQI-PAOICS4fTIOCAO pins. When the pins are used as ordinary outputs, they will output whatever value is written in the PADR; when PADR is read, the register value will be output regardless of the pin status. When the pins are used as ordinary inputs, the pin status rather than the register value is read directly when PADR is read. When a value is written to PADR, that value can be written into PADR, but it will not affect the pin status. Table 16.2 shows the read/write operations of the port A data register. PADR is initialized by a power-on reset. However, PADR is not initialized for manual reset, standby mode, or sleep mode. Bit: 15 14 13 12 11 10 9 8 Bit name: IPA15DRI PA14DRlpA13DRI PA12DRI PA11DRlpA10DRI PA9DR I PA8DR I Initial value: 0 0 0 0 0 0 0 0 R1W: RIW RIW RIW RIW RIW RIW RIW RIW Bit: 7 6 5 4 3 2 1 0 Bit name: I PA7DR I PA6DR I PA5DR I PA4DR I PA3DR I PA2DR I PA1DR I PAODR I Initial value: 0 0 0 0 0 0 0 0 RIW: RIW RIW RIW RIW RIW RIW RIW RIW Table 16.2 ReadlWrite Operation of the Port A Data Register (PADR) PAIOR Pin Status Read Write 0 Input Pin status Can write to PADR, but it has no effect on pin status. Other function Pin status Can write to PADR, but it has no effect on pin status. Output PADR value Value written is output by pin Other function PADR value Can write to PADR, but it has no effect on pin status. 428 HITACHI 16.3 Port B Port B is a 16-bit input/output port as shown in figure 16.2. PB 15 {lnput!output)fTP 15 {Output)/IR07 {Input) PB 14 {lnput!output)fTP 14 {Output)/IR06 (Input) PB 13 {lnput!output)fTP 13 {Output)/IR05 {lnput)/SCK1 (Input!output) PB 12 {lnput!output)fTP 12 {Output)/IR04 {Input)/SCKO (Input!output) PB 11 (Input!output)fTP 11 (Output)fTxD1 (Output) PB 10 (Input!output)fTP 1O (Output)/RxD1 (Input) PB 9 (Input!output)fTP 9 (Output)fTxDO (Output) PBs {lnput!output)fTPs (Output)/RxDO (Input) Port B PB7 (Input!output)fTP7 {Output)fTOCXB4 {Output)fTCLKD (Input) PB6 (Input!output)fTP6 (Output)fTOCXA4 (Output)fTCLKC (Input) PB 5 (Input!output)fTP 5 {Output)fTlOCB4 (Output) PB4 {lnput!output)fTP 4 {Output)fTlOCA4 (Output) PB 3 {lnput!output)fTP3 {Output)fTlOCB3 (Input!output) PB 2 (Input!output)fTP 2 (Output)fTlOCA3 (Input!output) PB 1 {lnput!output)fTP 1 (Output)fTlOCB2 (Input!output) PBo (Input!output)fTPo (Output)fTlOCA2 (Input!output) Figure 16.2 Port B Configuration 16.3.1 Register Configuration Table 16.3 summarizes the port B register. Table 16.3 Port B Register Name Abbreviation R/W Initial Value Address Access Size Port B data register PBOR R/W H'OOOO H'5FFFFC2 8, 16,32 HITACHI 429 16.3.2 Port B Data Register (PBDR) PBDR is a 16-bit read/write register that stores data for port B. The bits PB 15DR-PBODR correspond to the PB 15ITP15/IRQ7-PBOffPOITIOCA2 pins. When the pins are used as ordinary outputs, they will output whatever value is written in the PBDR; when PBDR is read, the register value will be output regardless of the pin status. When the pins are used as ordinary inputs, the pin status rather than the register value is read directly when PBDR is read. When a value is written to PBDR, that value can be written into PBDR, but it will not affect the pin status. When the pin function is set to timing pattern output and the TPC output is enabled by the TPC next data enable register (NDER), no value can be written to PBDR. Table 16.4 shows the read/write operations of the portH data register. PBDR is initialized by a power-on reset. However, PBDR is not initialized for a manual reset, standby mode, or sleep mode. Bit: 15 14 13 12 11 10 9 8 Bit name: [PB15DR[ PB14DR[PB13DR[ PB12DR[ PB11DR[PB10DR[ PB9DR [ PB8DR [ Initial value: 0 0 0 0 0 0 0 0 RIW: RIW RIW RIW RIW RIW RIW RIW RIW Bit: 7 6 5 4 3 2 1 0 Bit name: [ PB7DR [ PB6DR I PB5DR I PB4DR I PB3DR [ PB2DR I PB1DR I PBODR I Initial value: 0 0 0 0 0 0 0 0 RIW: RIW RIW RIW RIW RIW RIW RIW RIW Table 16.4 ReadlWrite Operation of the Port B Data Register (PBDR) PBIOR Pin Status Read Write 0 Input Pin status Can write to PBDR, but it has no effect on pin status TPn Pin status Disabled Other function Pin status Can write to PBDR, but it has no effect on pin status Output PBDR value Value written is output by pin TPn PBDR value Disabled Other function PBDR value Can write to PBDR, but it has no effect on pin status TPn: Timing pattern output 430 HITACHI 16.4 Port C Port C is an eight-bit input port as shown in figure 16.3. PC7 (Input)/AN7 (Input) PC s (Input)/AN6 (Input) PC 5 (Input)/AN5 (Input) PC 4 (Input)/AN4 (Input) PC 3 (Input)/AN3 (Input) PC2 (Input)/AN2 (Input) PC 1 (Input)/AN1 (Input) PC o (Input)/ANO (Input) Figure 16.3 Port C Configuration 16.4.1 Register Configuration Table 16.5 summarizes the port C register. Table 16.5 Port C Register Name Abbreviation RIW Initial Value Address Access Size Port C data register PCDR RIW H'5FFFFDO 8,16,32 HITACHI 431 16.4.2 Port C Data Register (PCDR) PCDR is an 16-bit read-only register that stores data for port C (bits 15-8 can be written to, but are ignored and always read as undefined). The bitsPC7DR-PCODR correspond to the PC7/AN7- PCO/ANO pins respectively. Any values written to these bits will be ignored and will not affect pin status. When the bits are read, the pin status rather than the bit value is read directly. When analog inI?ut of the AID converter is being sampled, however, every bit reads as I. Table 16.6 shows the read/write operations for the port C data register (bits 7-0). PCDR is not initialized by power-on resets, manual resets, standby mode, or sleep mode (bits 15-8 are always undefined; bits 7-0 always reflect the pin status). Bit: 15 14 13 12 11 10 9 8 Bit name: I Initial value: * R1W: R R R R R R R R Bit: 7 6 5 4 3 2 1 0 Bit name: I PC70R I PC60R IPC50R I PC40R I PC30R IPC20R I PC10R I PCOOR I Initial value: * * * * * * R1W: R R R R R R R R *. Not determined Table 16.6 ReadlWrite Operation of the Port C Data Register (PCDR) Pin 110 Pin Function Read Write Input General purpose Pin status read Ignored (no effect on pin status) ANn Reads as 1 Ignored (no effect on pin status) ANn: Analog input 432 HITACHI Section 17 ROM 17.1 Overview The SH7034 microcomputer has 64 kbytes of on-chip ROM (mask ROM or PROM). The on-chip ROM is connected to the CPU and the direct memory access controller (DMAC) through a 32-bit data bus (figure 17.1). The CPU can access the on-chip ROM in 8-, 16- and 32-bit widths and the DMAC can access the ROM in 8- and 16-bit widths. Data in the on-chip ROM can always be accessed in one cycle. Internal data bus (32 bits) /'" /'" /'1 /'" "'/ H'OOOOOOO ''.j H'OOOOOO1 "') H'OOOOOO2 "'/ H'OOOOOO3 H'OOOOOO4 H'OOOOOOS H'OOOOOO6 H'OOOOOO7 r-.... V ,-.... J ,-.... J ,-.... J r-.... J r-.... r-......../ r On-chip ROM r-...... r-...... H'OOOFFFC H'OOOFFFD H'OOOFFFE H'OOOFFFF Note: The addresses shown in the figure are the first shadow addresses in the on-chip ROM space. Figure 17.1 Block Diagram of ROM The operating mode determines whether the on-chip ROM is valid or not. The operating mode is selected using mode-setting pins MDO-MD2 as shown in table 17.1. If you are using the on-chip ROM, select mode 2; if you are not, select mode 0 or 1. The on-chip ROM is allocated to address H'OOOOOOO-H'OOOFFFF of memory area O. Memory area 0 (H'OOOOOOO-H'OFFFFFF and H'8000000-H'8FFFFFF) is divided into 64-kbyte shadows. No matter which shadow is accessed, the on-chip ROM is accessed. See section 8, Bus State Controller. for more information on shadows. HITACHI 433 I Table 17.1 Operating Modes and ROM Mode Setting Pin Operating Mode M02 M01 MOO Area 0 Mode 0 (MCU mode 0) o o o On-chip ROM invalid, external a-bit space Mode 1 (MCU mode 1) o o On-chip ROM invalid, external 16-bit space Mode 2 (MCU mode 2) 0 o On-chip ROM valid Mode 7 (PROM mode) 1 0: Low 1: High When the SH7034 is set to PROM mode, the PROM version can write programs exactly like ordinary EPROM using a general purpose EPROM writer. 17.2 PROM Mode 17.2.1 Setting the PROM Mode To program the on-chip PROM, set the pins as shown in figure 17.2 and use the chip in PROM mode. 17.2.2 Socket Adapter Pin Correspondence and Memory Map Mount the socket adapter (HS7030ESHO lH) to the SH7034 as shown in figure 17.2. This allows the on-chip PROM to be programmed in exactly the same way as ordinary 32-pin EPROMs (HN27C 101). Figure 17.2 shows the correspondence of SH7034 pins and HN27C 101 pins.' Figure 17.3 shows the memory map of the on-chip ROM. The address range of the HN27CI0l (128 kbytes) is H'OOOOO-H'IFFFF. The on-chip PROM (64 kbytes) is not found in the latter half (H'lOOO-H'IFFFF). When programming with a PROM writer, the program address range must be set to H'OOOO-H'FFFF. The data for the H'IOOOO- H'IFFFF address area of the PROM writer should all be H'FF. 434 HITACHI SH7034 EPROM Socket HN27C101 Pin Number Pin Name Adapter -. ;-_ .. -_ ...... -_ .. Pin Name Pin Number 77 Vpp , ,, Vpp 1 76 NMI ,, ,, A9 26 ,, 4 ADO ,, 1/00 13 5 AD1 ,, ,, 1/01 14 6 AD2 ,, ,, 1/02 15 7 AD3 , ,, 1/03 17 8 AD4 ,, ,, 1/04 18 9 AD5 ,, , 1/05 19 10 AD6 ,, ,, 1/06 20 11 AD7 ,, ,, 1/07 21 23 AOIHBS , ,, AO 12 24 A1 ,, ,, A1 11 25 A2. ,, , A2 10 26 A3 ,, ,, A3 9 27 A4 ,, ,, A4 8 28 A5 , ,, A5 7 29 A6 ,, A6 6 ,,, 30 A7 ,, , A7 5 32 A8 ,, ,, A8 27 33 A9 ,, ,, OE 24 34 A10 , ,, A10 23 35 A11 ,, ,, A11 25 ,, 36 A12 ,, A12 4 37 A13 ,, , , A13 28 ,, 38 A14 ,, A14 29 39 A15 , , , A15 3 41 A16 ,, ,, A16 2 55 PA2./CS6fT10CBO ,, ,, PGM 31 56 PA3/CS7No! AIT ,, ,, CE 22 42 A17 , , Vr.r. 32 44 A18 -+- ----:.- VP,p, 16 15 43 70 75 83 84 99 80 Vee MDO +-- +-. • Vpp: PROM program 81 82 MD1 MD2 +-- -t--' power adapter ,, • A 16-AO: Address input ,,, • 1/07-1/00: Data inpuV 85 86 79 AVec, AVref RES -:- , ,, output , ,, • OE: Output enable 3,12,22,31,40, Vss ,,, ,, • PGM: Program enable 52,61,72,96,106 , ,,, ,,, ,, • CE: Chip enable 87-90,92-95 PCO/ANo-PC3/AN3 PC4/AN4-PC7/AN7 ,, ,, , ,, 91 AVss , ' .. _ - - - _ ... _____ 1 Pin other than the above NC (release) Figure 17.2 Correspondence Between SH7034 Pins and HN27CI01 Pins HITACHI 435 Addresses in MCU Addresses in modes 0, 1, and 2* PROM mode H'OOOOOOO H'OOOO On-chip ROM space (area 0) H'OOOFFFF H'FFFF Note: Addresses in the figure are the uppermost shadow addresses of the on-chip ROM space. Figure 17.3 Memory Map of On-chip ROM 17.3 PROM Programming The write/verify specifications in PROM mode are the same as for the standard EPROM HN27CIOl. The page program system is .not supported, so do not set the PROM writer to the page programming mode. Naturally, PROM writers that only support the page programming mode cannot be used. When selecting a PROM writer, check that the high-speed, high-reliability programming system for each byte is supported. 17.3.1 Selecting the Programming Mode There are two on-chip PROM programming modes: write and verify (which reads and confirms the data written). Use the pins to select the modes (table 17.2). 436 HITACHI Table 17.2 Select PROM Programming Mode Pin Mode CE OE PGM Vpp Vee I/07-UOO A16-AO Write 0 1 0 Vpp Vee Data input Address input ----~------------ Verify 0 0 Data output Program inhibit 0 0 0 High impedance 0 0 0 1 Symbols: 0: Low 1: High Vpp: Vpp level Vee: Vee level 17.3.2 WriteNerify and Electrical Characteristics WriteNerify: Write/verify can be accomplished by an efficient high-speed high-reliability programming system. This system can write data quickly and accurately without placing voltage stress on the device. The basic flowchart for this high-speed, high-reliability programming system is shown in figure 17.4. HITACHI 437 Set EPROM writer to write/verify mode (Vee = 6.0 V ± 0.25 V, = Vpp 12.5 V ± 0.3 V) Yes Address + 1 ~ Address Set EPROM writer to read mode (Vee = 5.0 V ± 0.25 V, Vpp = Vee> No good Vee: Power supply V pp: PROM program power supply tpw: Initial programming pul$e width lopw: Over programming pulse width Figure 17.4 Basic Flowchart of High-Speed High-Reliability Programming 438 HITACHI Electrical Characteristics: Tables 17.3 and 17.4 show the electrical characteristics of programming. Figure 17.5 shows the timing. Table 17.3 DC Characteristics (Vee = 6.0 V ± 0.2S V, V pp = 12.S ± 0.3 V, V ss = 0 V, Ta = 2S± SOC) Measurement Item Pins Symbol Min Typ Max Unit Conditions Input high 1/07-1/00. A16-AO. V1H 2.4 Vee +0.3 V voltage OE.CE.PGM Input low 1/07-1/00. A16-AO. VIL -0.3 0.8 V voltage OE. CE;"PGM" Output high 1/07-1/00 VOH 2.4 V IOH =-200 J.IA voltage Output low 1/07-1/00 VOL 0.45 V IOL = 1.6 mA voltage Input leak 1/07-1/00. A16-AO. lIul 2 IJ.A VIN =5.25 VlO.5 V current QE.CE. PGM Vee current lee 40 mA Vpp current Ipp 40 mA HITACHI 439 ------------------ Table 17.4 AC Characteristics (Vee =6.0 V ± 0.25 V, Vpp = 12.5 ± 0.3 V, VSS =0 V, Ta = 25 ± SOC) Measurement Item Symbol Min Typ Max Unit Conditions Address setup time tAS 2 I1S Figure 17.5*1 OE setup time tOES 2 I1 s Data setup time tos 2 I1 s Address hold.time tAH 0 I1S Data hold time tOH 2 Il S Data output disable time tOF*2 130 ns Vpp setup time tvps 2 Il s PGM pulse width in initial programming tpw 0.19 0.20 0.21 ms PGM pulse width in over programming topw· 3 0.19 5.25 ms V CC setup time tvcs 2 Il s CE setup time tCES 2 Ils Data output delay time tOE 0 150 ns . Notes: 1. Input pulse level: 0.45-2.4 V Input rise, fall time:::; 20 ns Input timing reference levels: 0.8 V, 2.0 V Output timing reference levels: 0.8 V, 2.0 V 2. tOF is defined as when output reaches the release state and the output level could not be referenced. 3. topw is defined as the value given in the flowchart. 440 HITACHI .. Write • Verify Address ~ K tAS tAH ~ i Data ---< Write data -'!< ..., ! Read data ~ tos tOH tOF ~ ~ / Vpp ~ tvps I ~ tvcs ---, f\ iI ' I tCEs i .... I Ii Note: topw is defined as the value given in the flowchart. Figure 17.5 Write/Verify Timing 17.3.3 Points to Note About Writing 1. Always write using the prescribed voltage and timing. The write voltage (programming voltage) Vpp is 12.5 V (when the EPROM writer is set to the Hitachi specifications for HN27C101, Vpp becomes 12.5 V.) Applying a voltage in excess of the rated voltage may damage the device. Pay particular attention to overshooting in the EPROM writer. 2. Before programming, always check that the indexes of the EPROM writer socket, socket adapter, and devices are consistent with each other. If they are not mounted in the proper location, an overcurrent may be generated, damaging the device. 3. Do not touch the socket adapter or device during writing. Contact can cause malfunctions that prevent data from being written accurately. HITACHI 441 4. You cannot write in the page programming mode. Always set the equipment to the byte programming mode. 5. The capacity of the on-chip ROM is 64 kbytes, so the data of PROM writer addresses H'IOOOO-H'IFFFF should be H'FF. Always set the range for PROM addresses to H'OOOO- H'FFFF. 6. When write errors occur on consecutive addresses, stop writing. Check to see if there are any abnormalities in the EPROM writer and socket adapter. 17.3.4 Reliability After Writing After programming, we recommend letting the device stand at high temperature (125-150°C) for 24-48 hours to increase the reliability of data retention. Letting it stand at high temperature is a type of screening method that can get rid of initial data retention defects of the on-chip PROM's memory cell within a short period of time. Figure 17.6 shows the. flow from programming of the .on-chip PROM, including screening, to mounting on the device board. Writing and verification of program I} Flow chart from figure 17.4 '------'--r'-I----' Let stand in nonconductive, high temperature environment (125-150°C, 24--48 hours) I Data read and verification = (Vee 5.0 V) I Mount on board ) Figure 17.6 Screening Flow If abnormalities are found when the program is written and verified or the program is read and checked after the writing/verification or letting the chip stand at high temperature, contact Hitachi's engineering departments. 442 HITACHI 18.1 Overview Section 18 RAM I The SH7032 microcomputer has8-kbytes of on-chip RAM; the SH7034 has 4 kbytes. The on-chip RAM is linked to the CPU and direct memory access controller (DMAC) with a 32-bit data bus (figure 18.1). The CPU can access data in the on-chip RAM in byte, word, or long word units. The DMAC can access byte or word data. On-chip RAM data can always be accessed in one state, making the RAM ideal for use as a program area, stack area, or data area, which require high- speed access. The contents of the on-chip RAM are held in both the sleep and standby modes. Memory area 7 addresses H'FFFEOOO to H'FFFFFFF are allocated to the on-chip RAM in the SH7032. In the SH7034, addresses H'FFFFOOO to H'FFFFFFF are allocated. HITACHI 443 SH7032 Internal data bus (32 bits) \ ( '1 I /1 v H'FFFEOOO H'FFFEOO1 H'FFFEOO2 H'FFFEOO3 H'FFFEOO4 H'FFFEOO5 H'FFFEOO6 H'FFFEOO7 I On-chip RAM H'FFFFFFC H'FFFFFFD H'FFFFFFE H'FFFFFF SH7034 Internal data bus (32 bits) .-------~----------~----------~----------~------~/ H'FFFFOOO H'FFFF001 H'FFFF002 H'FFFF003 H'FFFF004 H'FFFF005 H'FFFF006 H'FFFF007 "'r-"" '" I "'r-"" "'r-"" On-chip RAM H'FFFFFFC H'FFFFFFD H'FFFFFFE H'FFFFFFF Figure IS. 1 Block Diagram of RAM 18.2 Operation Accesses to addresses H'FFFEOOO-H'FFFFFFF (SH7032) or addresses H'FFFFOOO-H'FFFFFFF (SH7034) are directed to the on-chip RAM. Memory area 7 (H'FOOOOOO-H'FFFFFFF) is divided into shadows in 8 kbyte units for the SH7032 and 4-kbyte units for the SH7034. All shadow accesses are on-chip RAM accesses. For more information on shadows, see section 8, Bus State Controller. 444 HITACHI Section 19 Power-Down States 19.1 Overview In the power-down mode, all CPU functions are halted. This lowers power consumption dramatically. I 19.1.1 Power-Down Modes The SH microprocessor has two power-down modes. 1. Sleep mode 2. Standby mode The sleep mode and standby mode are entered from the program execution state according to the transition conditions given in table 19.1. Table 19.1 also describes procedures for canceling each mode and the states of the CPU and peripheral functions. Table 19.1 Power-Down States State Entering Peripheral CPU I/O Ports Canceling Mode Procedure Clock CPU Functions Registers RAM Procedure Sleep Execute Run Halt Run Held Held Held • Interrupt mode SLEEP • DMA instruction address error with SBY bit set to 0 in • Power-on SBYCR reset • Manual reset Standby Execute Halt Halt Halt*1 Held Held Held or • NMI mode SLEEP high-Z*2 • Power-on instruction reset with SBY bit set to 1 in • Manual reset SBYCR SBYCR: Standby control register SBY: Standby bit Notes: 1. Some of the registers of the on-chip peripheral modules are not initialized in the standby mode. For details, see table 19.3, Status of Registers in the Standby Mode in section 19.4.1, Transition to the Standby Mode, or the descriptions of registers given where the on-chip peripheral modules are covered. 2. The status of I/O ports in the standby mode are set by the port high-impedance bit (HIZ) of the SBYCR. See section 19.2, Standby Control Register (SBYCR) for details. The status of pins other than the I/O ports are described in appendix B, Pin States. HITACHI 445 19.1.2 Register Table 19.2 summarizes the register related to the power-down state. Table 19.2 Standby Control Register (SBYCR) Name Abbreviation RIW Initial Value Address Access size Standby control register SBYCR R/W H'1F H'SFFFFBC 8, 16, 32 19.2 Standby Control Register (SBYCR) The standby control register (SBYCR) is an 8-bit register that can be read or written to. It is set in order to enter the standby mode and also sets the port states in standby mode. The SBYCR is initialized to H'lF when reset. Bit: 7 6 S 4 3 2 0 Bit name: I SBY HIZ Initial value: 0 0 0 R/W: R/W RfW • Bit 7 (standby (SBY»: SBY enables transition to the standby mode. The SBY bit cannot be set to 1 while the timer enable bit (bit TME) in timer control/status register TCSR of watchdog timer WDT is set to 1. To enter the standby mode, clear the TME bit to 0 to halt the WDT and set the SBY bit. SBV Description o Executing SLEEP instruction puts the LSI into sleep mode (initial value) Executing SLEEP instruction puts the LSI into standby mode • Bit 6 (port high-impedance (HIZ»: HIZ selects whether 110 ports remain in their previous states during standby, or are placed in the high-impedance state when the standby mode is entered. The HIZ bit cannot be set to 1 while the TME bit is set to 1. To place the pins of the I/O ports in high impedance, clear the TME bit to 0 before setting the HIZ bit. HIZ Description o Port states are maintained during standby (initial value) Ports are placed in the high-impedance state in standby • Bits 5-0 (reserved): Bit 5 is a read-only bit that always reads as O. Only write 0 to bit 5. Writing to bits 4-0 is disabled. These bits always read 1. 446 HITACHI 19.3 Sleep Mode 19.3.1 Transition to the Sleep Mode Execution of the SLEEP instruction when the standby bit (SBY) in the standby control register (SBYCR) is cleared to 0 causes a transition from the program execution state to the sleep mode. Although the CPU halts immediately after executing the SLEEP instruction, the contents of its internal registers remain unchanged. The on-chip peripheral modules do not halt in the sleep mode. 19.3.2 Canceling the Sleep Mode The sleep mode is canceled by an interrupt, DMA address error, power-on reset, or manual reset. Cancellation by an Interrupt: When an interrupt occurs, the sleep mode is canceled and interrupt exception processing is executed. The sleep mode is not canceled if the interrupt cannot be accepted because its priority level is equal to or less than the mask level set in the CPU's status register (SR). Likewise, the sleep mode is not canceled if the interrupt is disabled by the on-chip peripheral module. Cancellation by a DMA Address Error: If the DMAC operates during the sleep mode and a DMA address error occurs, the sleep mode is canceled and DMA address error exception- processing is executed. Cancellation by a Power-On Reset: If the RES signal goes low while the NMI signal is high, the sleep mode is canceled and the power-on reset state is entered. If the NMI signal is brought from low to high in order to set the LSI for power-on resets, an NMI interrupt will occur whenever the rising edge of the NMI is selected as the valid edge (in NMI edge select bit NMIE of the interrupt control register ICR of the interrupt controller). When this occurs, the NMI interrupt cancels the sleep mode. Cancellation by a Manual Reset: If the RES signal goes low while the NMI signal is low, the sleep mode is canceled and the manual reset state is entered. If the NMI signal is brought from high to low in order to set the LSI for manual resets, the sleep mode will be canceled by an NMI interrupt whenever the falling edge of the NMI is selected as the valid edge (in the NMIE bit). 19.4 Standby Mode 19.4.1 Transition to the Standby Mode To enter the standby mode. set the standby bit (SBY) to 1 in the standby control register (SBYCR). then execute the SLEEP instruction. The LSI moves from the program execution state to the standby mode. The standby mode greatly reduces power consumption by halting not only the CPU, but the clock and on-chip peripheral modules as well. Some registers of the on-chip peripheral modules are initialized, others are not (See table 19.3). As long as the specified voltage is supplied, however, CPU register contents and on-chip RAM data are held. The 110 port state HITACHI 447 (hold or high impedance) depends on the port high-impedance bit (HIZ) in the SByeR. For details on the states of these pins. see appendix B. Pin States. Table 19.3 Register States in the Standby Mode Module Register Initialized Registers That Hold Data Interrupt controller (INTC) All registers User break controller (UBC) All registers Bus state controller (BSC) All registers Pin function controller (PFC) All registers 1/0 ports All registers Direct memory access controller All registers (DMAC) Watchdog timer (WDT) • Bits 7-5 (OVF, WT/IT, TME) • Bits 2-0 (CKS2-CKSO) of of the timer control status the timer control status register (TCSR) register (TCSR) • Reset control/status register • Timer counter (TCNT) (RSTCSR) 16-bit integrated timer pulse unit All registers (ITU) Programmable timing pattern All registers controller (TPC) Serial communications interface • Receive data register (RDR) (SCI) • Transmit data register (TDR) • Serial mode register (SMR) • Serial control register (SCR) • Serial status register (SSR) • Bit rate register (BBR) AID converter (AID) All registers Power-down state register Standby control register '(SBYCR) 448 HITACHI 19.4.2 Canceling the Standby Mode The standby mode is canceled by an NMI interrupt, a power-on reset, or a manual reset. Cancellation by an NMI: When a rising edge or falling edge (as selected by the NMIE bit in interrupt control register ICR of interrupt controller INTC) is detected at the NMI pin, the clock oscillator begins operating. At first, clock pulses are supplied only to the watchdog timer. After the time that was selected before entering the standby mode using clock select bits 2-0 (CKS2-CKSO) in the timer controVstatus register TCSR of the watchdog timer WDT, the watchdog timer overflows. After the overflow, the clock is considered stable and supplied to the entire chip. The standby mode is canceled and the NMI exception-processing sequence begins. When the standby mode is cleared by an NMI interrupt, bits CKS2-CKSO must be set so that the WDT overflow interval is equal to or greater than the clock settling time. When the standby mode is cleared when the fall edge has been selected in the NMI bit, be sure that the NMI pin is high when standby is entered (when the clock is halted) and low when the chip returns from standby (clock starts up after oscillator is stabilized). Likewise, when the standby mode is cleared when the rise edge has been selected in the NMI bit, be sure that the NMI pin is low when standby is entered (clock halted) and high when the chip returns from standby (clock starts up after oscillator is stabilized). Cancellation by a Power-On Reset: If the RES signal goes low while the NMI signal is high, the standby mode is canceled and the power-on reset state is entered. If the NMI signal is brought from low to high in order to set the LSI for power-on resets, the standby mode will not be canceled by an NMI interrupt, because the NMI signal is initialized for the falling edge in the standby mode (by the NMIE bit). Cancellation by a Manual Reset: If the RES signal goes low while the NMI signal is low, the standby mode is canceled and the manual reset state is entered. If the NMI signal is brought from high to low in order to set the LSI for manual resets, the standby mode will first be canceled by an NMI interrupt, because the NMI signal is initialized for the falling edge in the standby mode (by the NMIE bit). HITACHI 449 19.4.3 Standby Mode Application In this example, the standby mode is entered on the falling edge of the NMI signal and canceled on the rising edge of the NMI signal. Figure 19.1 shows the timing. After an NMI interrupt is accepted (high goes to low) while the NMI edge select bit NMIE in the interrupt control register ICR is cleared to 0 to select detection of the falling edge, the NMI exception service routine sets the NMIE to I (selecting detection of the rising edge) and sets the SBY bit to L Finally, it executes a SLEEP instruction to enter the standby mode. The standby mode is canceled on the rising edge of the NMI signal. Oscillator I I I I I I I I II I I I I I I II )) ~I I I I I I I I I I NMI ~~'r--------\~r--l )) NMIE SSBY Clock setting time .--- .. f------.. .. +-----....... .. .--.. . . ... I-----i.~ + _ - - - - NMI Exception Standby Oscillation Time NMI exception service mode start set exception processing routine time in processing SBY = 1 WDT SLEEP instruction Figure 19.1 NMI Timing for the Standby Mode (Example) 450 HITACHI Section 20 Electrical Characteristics 20.1 Absolute Maximum Ratings Table 20.1 Absolute Maximum Ratings Item Power supply voltage Program voltage Symbol Vee Vpp Rating -0.3 to +7.0 -0.3 to + 13.5 Unit V V I Input voltage (except port C) Vin -0.3 to Vee + 0.3 V Input voltage (port C) Vin -0.3 to AVee + 0.3 V Analog power supply voltage AVee -0.3 to +7.0 V Analog reference voltage AVref -0.3 to AVee + 0.3 V Analog input voltage VAN -0.3 to AVee + 0.3 V Operating temperature Topr -20 to +75* ·C Storage temperature Tstg -55 to +125 ·C Caution: Operating the LSI in excess of the absolute maximum rating may result in permanent damage. Note: Normal Products: Topr =-40 to +85°C for wide-temperature range products HITACHI 451 """""""--"-"--""""-------'- 20.2 DC Characteristics Table 20.2 lists DC characteristics. Table 20.3 lists the permissible output current values. Usage Conditions: • Do not release A Vee, AV ref and A V ss when the AfD converter is not in use. Connect A Vee and AVrefto Vee and AVss to Vss. • The current consumption value is measured under conditions OfV 1H min =Vee - 0.5 V and V1L max =0.5 V with no load on any output pin and the on-chip pull-up MOS off. • Even when the AID converter is not used or is stand-by, connect AVec to A Vref the power voltage(Vcd. Table 20.2 DC Characteristics (1) Conditions: Vee = 5.0 V ±10%, AVee = 5.0 V ±10%, AVee = Vee ±1O%, AV ref = 4.5 V to AVec, Vss =AVss =0 V, cj> =20 MHz, Ta =-20 to +75°C*) Normal Products: Ta =-40 to +85°C for wide-temperature range products. Measurement Item Symbol Min Typ Max Unit Conditions Input high- RES, NMI, MD2-MDO VIH Vee - 0.7- Vee + 0.3 V level EXTAL VeexO.7- Vee+ 0.3 V voltage Port C 2.2 AVec + 0.3 V Other input pins 2.2 Vee + 0.3 V Input low- RES, NMI, MD2-MDO VIL -0.3 0.5 V level Other input pins -0.3 0.8 V voltage Schmidt PA13--PA10, PA2, V trigger PAO,PB7- input PBO 1.0 V voltage V Input leak RES llinl 1.0 I1A Vin = 0.5 to Vee - 0.5 V ----------------~------------------------------------------ current NMI, MD2-MDO 1.0 I1A Vin =0.5 to Vee - 0.5 V PortC 1.0 I1A Vin=0.5toAVee-0.5V 3-state Ports A and B, CS3-- IITSII 1.0 I1A Vin = 0.5 to Vee - 0.5 V leak CSO, A21-AO, AD15- current ADO (while off) Input pull- PA3 -Ip 20 - 300 I1A Vin =OV upMOS current Output All output pins VOH Vee- 0.5 - V IOH = -200 I1A high-level 3.5 voltage 452 HITACHI Table 20.2 DC Characteristics (2) = = Conditions: Vee 5.0 V ±10%, AVec 5.0 V ±10%, AVec = Vee±10%, AVref = 4.5 V to AVec, Vss = AVss = 0 V, 4» = 20 MHz, Ta = -20 to +75°C*) Normal Products: Ta = -40 to +85°C for wide-temperature range products. Measurement nem Symbol Min Typ Max Unit Conditions Output low level All output pins VOL 0.4 V IOL = 1.6 mA voltage 1.2 V IOL = 8 mA Input capacitance RES Cin 30 pF Vin =OV NMI 30 pF f = 1 MHz Ta =2SoC All other input 20 pF pins Current consumption Ordinary Icc 60 90 mA f = 12.S MHz operation 80 110 mA f = 16.6 MHz 100 130 mA f =20 MHz Sleep 40 70 mA f = 12.S MHz SO 80 mA f = 16.6 MHz 60 90 mA f =20 MHz Standby 0.01 S·, ~ Tas; SO°C 20.0'2 ~ SO°C = 12.5 MHz. Ta = -20 to +75°C*) Normal Products: Ta = -40 to +85°C for wide-temperature range products. Measurement Item Symbol Min Typ Max Unit Conditions Input high- RES, NMI, MD2-MDO V1H Vee xO.9 Vee + 0.3 V level voltage EXTAL V Vee xO.7 Vee + 0.3 Port C Vee x 0.7 AVec + 0.3 V Other input pins Vee xO.7 Vee + 0.3 V Input low- RES, NMI, MD2-MDO VIL -Q.3 Vee xO.1 V level voltage Other input pins -Q.3 V Vee xO.2 Schmidt PA13-10, PA2, PAO, Vr+ Vee xO.9 V trigger input PB7-PBO voltage Vr- V Vee xO.2 Vr+-Vr- Vee x 0.07 - V Input leak RES lIinl 1.0 flA Vin = 0.5 to Vee current -0.5 V NMI, MD2-MDO 1.0 flA Vin = 0.5 to Vee -0.5 V Port C 1.0 flA Vin = 0.5 to AVee-0.5 V 3-state leak Ports A and B, CS3- IIrs,1 1.0 flA Vin =0.5 to Vee current (while CSO, A21-'AO, AD15- -0.5 V off) ADO Input pull-up PA3 -Ip 20 300 flA Vin = OV MOS current Output high- All output pins VOH Vee- O.S V IOH =-200 flA level voltage Vee- 1.O V IOH =-1 mA Output low All output pins VOL 0.4 V IOL = 1.6 mA level voltage 1.2 V IOL = 8 mA 456 HITACHI Table 20.2 DC Characteristics (6) Conditions: Vee = 3.0 V to 5.5 V. AVec = 3.0 to 5.5 V. AVec = Vcc±10%. AVrer= 3.0 V to AVec. Vss = AVss = 0 V. q> = 12.5 MHz. Ta";' -20 to +75°C*) Nonnal Products: Ta = -40 to +85°C for wide-temperature range products. Measurement Hem Symbol Min Typ Max Unit Conditions Input RES Cin 30 pF Vin =OV capacitance NMI 30 pF f = 1 MHz All other input 20 pF Ta = 25°C pins Current Ordinary lee 60 90 mA f = 12.S MHz consumption operation Sleep 40 70 mA f = 12.S MHz Standby 0.01 S·l JlA TasSO°C 20.0.2 JlA SO°C = 20 MHz, Ta = -20 to +75°C* Normal Products: Ta = -40 to +85°C for wide-temperature range products. Item Symbol Min Max Unit Figures Address delay time tAD 20.1 ns 20.8, 20.9, 20.11-20.14, 20.19, 20.20 CS delay time 1 tCSD1 25 ns 20.8, 20.9, 20.20 CS delay time 2 tcsD2 25 ns CS delay time 3 tCSD3 20 ns 20.19 CS delay time 4 tCSD4 20 ns Access time 1 35% duty·2 tRDAC1 tcyc x 0.65- ns 20.8, from read strobe 20 50% duty tcyc x 0.5 - 20 - ns Access time 2 35% dut/2 tRDAC2 tcyc x (n+ 1.65) - ns 20.9,20.10 from read strobe - 20*3 50% duty tcyc x (n+ 1.5) - ns -20*3 Access time 3 35% dut/2 tRDAC3 tcyc x (n+0.65) - ns 20.19 from read strobe - 20*3 50% duty tcyc x (n+0.5) ns - 20*3 Read strobe delay time tRsD 20 ns 20.8, 20.9, 20.11-20.15, 20.19, 20.24-20.28 Read data setup time tRDS 15 ns 20.8,20.9,20.11-20.14, Read data hold time tRDH 0 ns 20.19 Write strobe delay time 1 tWSD1 20 ns 20.9, 20.13, 20.14, 20.19, 20.20 Write strobe delay time 2 tWSD2 20 ns 20.9, 20.13, 20.14, 20.19 Write strobe delay time 3 twsD3 20 ns 20.11,20.12 Write strobe delay time 4 twsD4 20 ns 20.11, 20.12, 20.20 Write data delay time 1 tWDD1 35 ns 20.9, 20.13, 20.14, 19 Write data delay time 2 tWDD2 20 ns 20.11,20.12 Write data hold time tWDH 0 ns 20.9, 20.11-20.14 464 HITACHI Table 20.6 Bus Timing (1) (cont) . Conditions: Vee = 5.0 V ±10%, AVec = 5.0 V ±lO%,AVee = Vee±10%, AVref= 4.5 V to AVec, Vss = AVss = 0 V, «I> = 20 MHz, Ta = -20 to +75°C* Normal Products: Ta = -40 to +85°C for wide-temperature range products. Item Symbol Min Max Unit Figures Parity output delay time 1 tWPDD1 40 ns 20.9, 20.13, 20.14 Parity output delay time 2 tWPDD2 20 ns 20.11, 20.12 Parity output hold time tWPDH 0 ns 20.9, 20.11-20.14 Wait setup time tWTS 14 ns 20.10,20.15,20.19 Wait hold time tWTH 10 ns Read data access time 1 tACC1 lcyc - 30*4 ns 20.8,20.11,20.12 Read data access time 2 tACC2 tcyc x (n+2) - ns 20.9, 20.10, 20.13, 30.3 20.14 RAS delay time 1 tRASD1 20 ns 20.11-20.14, RAS delay time 2 30 ns 20.16-20.18 tRASD2 CAS delay time 1 tCASD1 20 ns 20.11 CAS delay time 2 tCASD2 20 ns 20.13,20.14, CAS delay time 3 20 ns 20.16-20.18 tCASD3 Column address setup time tASC 0 ns 20.11, 20.12 Read data access 35% duty·2 tCAC1 tcyc x 0.65- ns 19 time from CAS 1 50% duty ns lcyc x 0.5 -19 - Read data access time from tCAC2 lcyc x (n+1) - - ns 20.13,20.14,20.15 CAS 2 25.3 Read data access time from tRAC1 tcyc x 1.5 - 20 - ns 20.11,20.12 RAS 1 Read data access time from tRAC2 lcyc x (n+2.5) ns 20.13,20.14,20.15 RAS2 -20.3 High-speed page mode CAS tcp lcyc x 0.25 ns 20.12 precharge time HITACHI 465 Table 20.6 Bus Timing (1) (cont) Conditions: Vee = = 5.0 V ±10%, AVee 5.0 V ±1O%, AVee =Vee ±1O%, AVref =4.5 V to AVee, Vss = AVss = 0 V, = 20 MHz, Ta = -20 to +75°C* Normal Products: Ta = -40 to +85°C for wide-temperature range products. Item Symbol Min Max Unit Figures AH delay time 1 . tAHD1 20 ns 20.19 AH delay time 2 tAH02 20 ns Multiplexed address delay time tMAO 30 ns Multiplexed address hold time tMAH 0 ns DACKO, DACK1 delay time 1 tDAC01 23 ns 20.8,20.9, 20.11- 20.14, 20.19, 20.20 DACKO, DACK1 delay time 2 tDACD2 23 ns DACKO, DACK1 delay time 3 tDACD3 20 ns 20.9, 20.13, 20.14, 20.19 DACKO, DACK1 delay time 4 tDACD4 20 ns 20.11, 20.12 DACKO, DACK1 delay time 5 tDAC05 20 ns Read delay time 35% duty*2 tRoD tcyc x 0.35 + 12 ns 20.8, 20.9, 20.11- 20.15, 20.19, 20.24- 50% duty tcyc x 0.5 + 15 ns 20.28 Data setup time for CAS tDS 0*5 ns 20.11,20.13 CAS setup time for RAS tCSR 10 ns 20.16,20.17,20.18 Row address hold time tRAH 10 ns 20.11, 20.13 Write command hold time tWCH 15 ns Write command 35% duty*2 twcs 0 ns 20.11 setup time 50% duty 0 ns twcs Access time from tACP tcyc ns 20.12 CAS precharge -20 Notes: 1. HBS and LBS signals are 25 ns. 2. When frequency is 10 MHz or more. 3. n is the number of wait cycles. 4. Access time from addresses AO to A21 is tcyc-25. 5. -5ns for parity output of DRAM long-pitch access. 466 HITACHI Table 20.7 Bus Timing (2) Conditions: Vee = 5.0 V ±lO%, AVee = 5.0 V ±lO%, AVee = Vee ±10%, AVreC= 4.5 V to AVee, Vss = AVss = 0 V" = 16.6 MHz, Ta =-20 to +75°C* Nonna! Products: Ta =-40 to +85°C for wide-temperature range products. Hem Symbol Min Max Unit Figures Address delay time tAD 25"1 ns 20.8,20.9,20.11-20.14, 20.19,20.20 CS delay time 1 tCSD1 30 ns 20.8, 20.9, 20.20 ~ delay time 2 tcSD2 25 ns CS delay time 3 tCSD3 25 ns 20.19 CS delay time 4 tCSD4 25 ns Access time 1 35% duty"2 tRDAC1 tcyc x 0.65- ns 20.8,20.9, from read strobe 20 50% duty tcyc x 0.5 - 20 - ns Access time 2 35% duty·2 tRDAC2 tcyc x (n + ns 20.9,20.10 from read strobe 1.65) - 20"3 50% duty tcyc x (n + ns 1.5) - 20"3 Access time 3 35% duty"1 tRDAC3 tcyc x (n + ns 20.19 from read strobe 0.65) -20"3 50% duty tcyc x (n + ns 0.5) - 20.3 Read strobe delay time tRSD 25 ns 20.8, 20.9, 20.19 Read data setup time tRDS 15 ns 20.8, 20.9,20.11-20.14, Read data hold time tRDH 0 ns 20.19 Write strobe delay time 1 tWSD1 25 ns 20.9,20.13,20.14,20.19, 20.20 Write strobe delay time 2 tWSD2 25 ns 20.9,20.13,20.14,20.19 Write strobe delay time 3 tWSD3 25 ns 20.11,20.12 Write strobe delay time 4 tWSD4 25 ns 20.11, 20.12, 20.20 Write data delay time 1 tWDD1 45 ns 20.9,20.13,20.14,20.19 Write data delay time 2 tWDD2 25 ns 20.11,20.12 Write data hold time tWDH 0 ns 20.9,20.11-20.14 Parity output delay time 1 tWPDD1 45 ns 20.9, 20.13, 20.14 Parity output delay time 2 tWPDD2 25 ns 20.11,20.12 Parity output hold time tWPDH 0 ns 20.9,20.11-20.14 HITACHI 467 _..._---- - ......... _.. _-_. __.__._ ... -------------- ------------~--.-- Table 20.7 Bus Timing (2) (cont) Conditions: Vee =5.0 V ±1O%, A Vee =5.0 V ±1O%. A V cc = Vee ±I 0%. A Vref =4.5 V to AVec, Vss = AVss =0 v, = 16.6 MHz, Ta =-20 to +75°C* Normal Products: Ta =-40 to +85°C for wide-temperature range products. Item Symbol Min Max Unit Figures Wait setup time tWTS 19 ns 20.10,20.15,20.19 Wait hold time tWTH 10 ns Read data access time 1 tACCl tcyc - 30*4 ns 20.8,20.11,20.12 Read data access time 2 tACC2 tcyc x (n+2) - ns 20.9, 20.10, 20.13, 20.14 30'3 RAS delay time 1 tRASD1 25 ns 20.11-20.14, 20.1~20.18 RAS delay time 2 tRAsD2 35 ns CAS delay time 1 tCAsD1 25 ns 20.11 CAS delay time 2 tCASD2 25 ns 20.13,20.14, 20.1~20.18 CAS delay time 3 tCASD3 25 ns Column address setup time tASC 0 ns 20.11,20.12 Read data access 35% duty'2 tCAC1 tcyc x 0.65- ns time from CAS 1 19 50% duty tcyc x 0.5 - 19 - ns Read data access time from tCAC2 tcyc x (n+1)-- ns 20.13,20.14,20.15 CAS 2 25'3 Read data access time from tRAC1 tcyc x 1.5 - 20 - ns 20.11,20.12 RAS 1 Read data access time from tRAC2 tcyc x (n + 2.5) - ns 20.13,20.14,20.15 RAS2 -20'3 High-speed page mode CAS tcp tcyc x 0.25 ns 20.12 precharge time AH delay time 1 tAHD1 25 ns 20.19 AH delay time 2 tAHD2 25 ns Multiplexed address delay time tMAD 30 ns Multiplexed address hold time tMAH 0 ns 468 HITACHI Table 20.7 Bus Timing (2) (cont) Conditions: Vee = 5.0 V ±10%, AVec = 5.0 V ±IO%, AVec = Vee±10%, AVref= 4.5 V to = = = = AVec, Vss AVss 0 V, el 16.6 MHz, Ta -20 to +75°C* Nonnal Products: Ta = -40 to +85°C for wide-temperature range products. Hem Symbol Min Max Unit Figures DACKO, DACK1 delay time 1 tOAC01 25 ns 20.8,20.9,20.11-20.14, DACKO, DACK1 delay time 2 25 ns 20.19, 20.20 tOAC02 DACKO, DACK1 delay time 3 tOAC03 25 ns 20.9,20.13,20.14,20.19 DACKO, DACK1 delay time 4 tOACD4 25 ns 20.11,20.12 DACKO, DACK1 delay time 5 tOAC05 25 ns Read delay time 35% duty°2 tROD tcyc x 0.35 + 12 ns 20.8,20.9,20.11-20.15, 20.19, 20.24-20.28 50% duty tcyc x 0.5 + 15 ns Data setup time for CAS tos 0.5 ns 20.11,20.13 CAS setup time for RAS tesR 10 ns 20.16,20.17,20.18 Row address hold time tRAH 10 ns 20.11,20.13 Write command hold time tWCH 15 ns Write command 35% duty·2 twcs 0 ns 20.11 setup time 50% duty 0 ns Access time from CAS tACP tcyc ns 20.12 precharge -20 Notes 1. HBS and LBS signals are 30 ns. 2. When frequency is 10 MHz or more 3. n is the number of wait cycles. 4. Access time from addresses AO to A21 is tcyc-25. 5. -5ns for parity output of DRAM long-pitch access HITACHI 469 - ----------_. - --~~-.-- ---- CK A21-AO HBS. LBS :tCSD2 : ~.: :.;i~t': I I I . -t: :I : RD (Read) AD15-ADO DPH.DPL (Read) DACKO DACK1 Notes: 1. For tRDAC1. use tcye x 0.65 - 20 (for 35% duty) or tcyc x 0.5 - 20 (for 50% duty) instead of tcyc - tRDD - tRDS· 2. For tACC1. use !eye - 30 instead of tcyc - tAD (or tCSD1) - tRDS. 3. tRDH is measured from A21-AO. CSn. or RD. whichever is negated first. Figure 20.8 Basic Bus Cycle: One-State Access 470 HITACHI T1 T2 OIl • -.If- \ I \ f- CK tAD A21-AO HBS, LBS ~ K tCSD1 tCSD2 .1 \ .. .., t tROD tRDAC2 *1 t RSD RD (Read) \ f- "l I tACC2 *2 t RDs ~H*3 AD15-ADO 1 ~ \. I .., DPH,DPL ~ (Read) tDACD1 i tDACD2 DACKO 14--+1 ~ I DACK1 (Read) tWSD2 ~1 WRH, WRL, ~ i WR (Write) \1 tWOO1 I I t WOH ! !+-+j AD15-ADO ~f-... i -T (Write) ~ + tWPD01 I I i!WP~,H 1 I ------iVl/I~_t--!_~- DPH,DPL (Write) DACKO DACK1 (Write) ------------l...~>t itOACD3' ' It-------------- !~ Notes: For tRDAC2, use teye x (n + 1.65) - 20 (for 35% duty) or loye x (n + 1.5) - 20 (for 50% duty) instead of loye x (n + 2) - tROD - tRDS' 2 For tACC2, use teye x (n + 2) - 30 instead of teye x (n + 2) - tAD (or tcsD1) - tRDS' 3 tRDH is measured from A21-AO, CSn, or RD, whichever is negated first. Figure 20.9 Basic Bus Cycle: Two-State Access HITACHI 471 .. ... Tw . .. CK A21-AO HBS, LBS : i i, !, ,, RD (Read) ! I , ; ! ; AD15-ADO DPH,DPL (Read) ! j DACKO DACK1 (Read) : , , : I : WRH, WRL, : i WR (Write) i : :i AD15-ADO ,I DPH,DPL (Write) ----~<~i~!----~!~i------~ : ! : i _ X i i ::f-------++Ii----J DACKO DACK1 (Write) :! i i twrs i I twrH twrs i twrH 'I' ~~ ~~ j VI \'------- Notes: 1. For tRDAC2, use tcyc x (n+1.65) - 20 (for 35% duty) or tcyc x (n+1.5) - 20 (for 50% duty) instead of tcyc x (n+2) - tROD - tRDS. 2. For tACC2, use tcyc x (n+2) - 30 instead of tcyc x (n+2) - tAD (or tCSD1) - tRDS· Figure 20.10 Basic Bus Cycle: Two States + Wait State 472 HITACHI CK I \ I \ ~ ~ tAD ~ A21-AO X Row Column K tRASDl I tRASD2 tRt H ~ ~ \ I f4r--- tDS tCASDl tASC ~ r+i CAS RD(Read) ~ ~ i I ~ tROD i, 1- rf i I tWr.H~ tRSI?J ~ ~ I WRH, WRL, I I I \!dl~~Dl I WR(Read) / I I tDACD2 '\ DACKO I f4---'~ DACK1 I I) ( (Read) tC~Cl*l -tI :~l AD15-ADO tRAc,3 iI I t' I ArC1 *2 I Ii I I I I i I J RQ§ b H*4 1< DPH,DPL *", (Read) I II I I RD(Write) ~ !tWSD3 I ! I twsD4 "-- WRH,WRL, WR(Write) AD15-ADO ' .. ! ! - til I itWDD211 .Itwcs I Q. ~ (Write) ----')>----------iR~!---+kVP2----- tWPDD2H : :...-- I~! ~-- DPH,DPL (Write) -----') ,tDACD4 itDACD5 DACKO i4-'-+! ~ DACK1 ------------------~x===x---------- (Write) -------------~ , ,-------- Notes; 1. For tCAC1, use teye x 0.65 - 19 (for 35% duty) or teye x 0.5 - 19 (for 50% duty) instead of teye - tAD - tASC - tRDS· 2. For tACC1, use teye - 30 instead of teye - tAD - tRDS· 3. For tRAC1, use teye x 1.5 - 20 instead of teye x 1.5 - tRASDl - tRDS· 4. tRDH is measured from A21-AO, RAS, or CAS, whichever is negated first. Figure 20.11 DRAM Bus Cycle (Short Pitch, Normal Mode) HITACHI 473 Tp Tr CK ~i , \l ~ !! i >t:olum~X Column X Column X C;!;lumn: ~'--_ _ I A21-AO - - - - - - - . ) ( Ii tRASD1 ~ Row,·. . ,: ! i ! I: I 'fi rt tRASD2 RAS J ~,.~+'~; - Ii i ~' I I --------~'I:,~i,f--- :: : !tASe! i tcp ~!~ !!~ -,------+~~~ ir--~- CAS RD(Read) WRH, WRL, J WR(Read) AD15-ADO DPH,DPL (Read) DACKO DACK1 (Read) RD(Write) OJ WRH, WRL, WR(Write) AD15-ADO (Write) ----~tW~D~D2fh=t:t==P '--_.,..JX,--_~XC:::~=>--­ I DPH,DPL tWPDD2 (Write) DACKO DACK1 (Write) Notes: 1. For tCAC1, use !eye X 0.65 - 19 (for 35% duty) or tcye x 0.5 - 19 (for 50% duty) instead of !eye - tAD - tAse - tRDS· 2. For tACC1, use !eye - 30 instead of teye - tAD - tRDS· 3. For tRAC1, use !eye x 1.5 - 20 instead of teye x 1.5 - tRASD1 - tRDS· 4. tRDH is measured from A21-AO or CAS, whichever is negated first. 5. tRDH is measured from A21-AO, RAS, or CAS, whichever is negated first. Figure 20.12 DRAM Bus Cycle (Short Pitch, High-Speed Page Mode) 474 HITACHI l TP Tr Tc1 Tc2 I. "---.J~ <---./ ~~ ~ Ir-------... CK A21-AO ~ )[ Row ~ tAD Jj :;olumn I K tRAS01 tRAH J tRAS02 --.I fT r--- tos ~ teA 02 tCAS03 CAS --.I tROD itf tRS~ J RD(Read) { WRH,WRL, --.I I "- -.J tWCH. ~ WR(Read) AD15-ADO DPH,DPL (Read) tRAC2· 3 tACC2·2 tCAC2*1 ~ tROS ... tROH*4 I DACKO tOACD1 ~ ~D2 DACK1 )[ ){ I I (Read) RD(Write) -.I L tWSD1 tWSD2 WRH, WRL, WR(Write) H I -~ 1 AD15-ADO tWDD1 ~ ~ (Write) I tWPDD1 ~ ~H DPH,DPL (Write) I ~D3 ~D3 DACKO DACK1 x:: )it; (Write) Notes: 1. For tCAC2, use tcyc x (n + 1) - 25 instead of tcyc x (n + 1) - tCASD2 - tRDS. 2. For tACC2, use tcyc x (n + 2) - 30 instead of tcyc x (n + 2) - tAD - tRDS. 3. For tRAC2, use tcyc x (n + 2.5) - 20 instead of lcyc x (n + 2.5) - tRAsD1 - tRDS· 4. tROH is measured from A21-AO, CAS, or RAS, whichever is negated first. Figure 20.13 DRAM Bus Cycle: (Long Pitch, Normal Mode) HITACHI 475 ------ .. ~--.-.-- .. ~~- Tp CK A21-AO RAS J CAS J RD(Read) J WRH,WRL, J WR (Read) AD15-ADO DPH,DPL (Read) DACKO DACK1 (Read) RD(Write) J i i _________-+--i4+ itWSD1 ItWSD2 ,.. :tWSD1 ~ :tWSD~i J " WRH, WRL, i \~:--t--'it ; \'----<-'~: i WR(Write) ~.tW~Dl {~Dl· AD15-ADO (Write) ----.:.-+~1'=t=:jj,. ~ I!WP~D1 t~Hi!WP~D1 i n ItWDH ~DH --------~!~~.~=~~ I ~ DPH,DPL (Write) DACKO __________~i~- tD>(:ACD3 ~.itDACD3 itDACD3 !tDACD3 ~ ++~;-~:~.~~~' ------- DACK1 ~~--~X~-~~~-------- (Write) Notes: 1. For tCAC2, use tcyc x (n + 1) - 25 instead of tcyc x (n + 1) - tCASD2 - tRDS' 2. For tACC2, use tcyc x (n + 2) - 30 instead of tcyc x (n + 2) - tAD - tRDS' . 3. For tRAC2, use tcyc x (n + 2.5) - 20 instead of tcyc x (n + 2.5) - tRASD1 - tRDS' 4. tRDH is measured from A21-AO or CAS, whichever is negated first. 5. tRDH is measured from A21-AO, RAS, or CAS whichever is negated first. Figure 20.14 DRAM Bus Cycle: (Long Pitch, High-Speed Page Mode) 476 HITACHI Tp Tr TC1 Tw Tc2 CK ~~ ~ ~~ . A21-AO x Row )! Column; ~ x- ~ ---.I » ,.-tRsD " ~ CAS ---.I ItRDD . " r f-- RD(Read) ---.I pc WRH.WRL. . WR(Read) ---.I " tCAC2,"1 tACC2,"2 tRAC2,"3 AD15-ADO DPH.DPL " (Read) DACKO . DACK1 X ~ ~ (Read) RD(Write) ~ L WRH.WRL. WR(Write) "" AD15-ADO . ;; (Write) ~ DPH.DPL ;;" (Write) " DACKO . DACK1 X Ii ~ X (Write) tWTs tWTH tWTS .j.M tWTH ~. WAIT ~~ .IT ~ / Notes: 1. For tCAC2. use loyc x (n + 1) - 25 instead of loyc x (n + 1) - tCASD2 - tRDS· 2. For tACC2. use loyc x (n + 2) - 30 instead of loyc x (n + 2) - tAD - tRDS. 3. For tRAC2. use loyc x (n + 2.5) - 20 instead of lcyc x (n + 2.5) - tRAsD1 - tRDS. Figure 20.15 DRAM Bus Cycle: (Long PitCh, High-Speed Page Mode + Wait State) HITACHI4n 'I' " CK ! ,tRAS01 10-+, i,tRASO~,~i -~--r----i-----'\j i /,.,_ _ _ _- RAS ~ ~:,~tC~S~R~~~--------~n-----------;~-J' : i !~OO i--.i tCAS 02 " , i ~~-~----~\~--------~n----------~X~-- WRH,~ WRL, WR Figure 20.16 CAS-before-RAS Refresh (Short Pitch) !,tRAso~1 Il I.~SM!~~- ------------~~~I--------------~~ WRH, ~ WRL, WR Figure 20.17 CAS-before-RAS Refresh (Long Pitch) 478 HITACHI CK tCASD3 Figure 20.18 Self Refresh HITACHI479 C K . I I . ItAD i i ! i : ~ ! ' ! ' ! i ; I I I ! I i I, 'i I I '.. I I ! ! . A21-AO HBS, LBS =x~ .' I :~: i' i i i ; i I ! i i ' X'--_ _ , ;tCS03 • ! tCS04 CS6 ,i ---+I-----:;+-i~ -+! 14- i i ii 17-+---- j i:! i~~ tAH01 itAH02:: ___~ !i I' 'I I,. i '}. i, I ----+- ' I, I I i i! tRooi itRSO RD i i4 :! 11----+---+----- a I, II (Read) !I ,\ I ji i AD15-ADO (Read) ----+-,~~ I,t ItMAO Ii! i'MAH i4----+----- I JI I . (Input) I DACKO tOAC01: ..., iii ~I! JtOAC02 DACK1 ----t-----__ .Jr_---+t--t---_____ r _ - t - - - t - - - - - !I (Read) 1-++---+---' 1'--+----+----- WRH, WRL, WR (Write) tWDH AD1~ADO (Write) -----C--A,;~;_it~~~r---rlat~~~-, Address DACKO -----------~--__ . J r _ - - -___ r_------- DACK1 (Write) WAIT _ _ _ _ _ _ _ _ _~ Figure 20.19 Address/Data Multiplex 110 Bus Cycle 480 HITACHI .. T1 ~ CK \ I .-J t .. AD ~ A21-AO HBS, [8S" }. tcSDl ~SD2 \- j. t WSD1 t WSD4 ....-.. .-. WRH,WRL, \r j.f- WR (Write) DACKO tDACDl ...... , tDACD2 DACK1 }. ). (Write) Figure 20.20 DMA Single Transferll State Access Write HITACHI 481 Table 20.8 Bus Timing (3) =3.0 to 5.5 V, AVee =Vee ±10%, AVref =3.0 V to Conditions: Vee = 3.0 to 5.5 V, AVee AVee, Vss =AVss =0 V, «I> = 12.5 MHz, Ta =-20 to +75°C* Normal Products: Ta =-40 to +85°C for wide-temperature range products. Item Symbol Min Max Unit Figures Address delay time tAD 40 ns 20.21,20.22,20.24- 20.27,20.32,20.33 CS delay time 1 tCSD1 40 ns 20.21, 20.22, 20.33 CS delay time 2 tCSD2 40 ns CS delay time 3 tcsD3 40 ns 20.32 CS delay time 4 tcsD4 40 ns Access time 1 35% duty'1 tRDAC1 !eye x 0.65 - 35 ns 20.21, from read strobe 50% duty !eye x 0.5 - 35 ns Access time 2 35% duty'1 tRDAC2 !eye x (n+1.65) - 35'2 ns 20.22, 20.23 from read strobe 50% duty !eye x (n+ 1.5) - 35 '2 ns Access time 3 35% duty'1 tRDAC3 !eye X (n+0.65) - 35'2 ns 20.32 from read strobe 50% duty !eye X (n+0.5) - 35'2 ns Read strobe delay time tRSD 40 ns 20.21, 20.22, 20.32 Read data set-up time tRDs 25 ns 20.21, 20.22, Read data hold time tRDH 0 ns 20.24-20.27, 20.32 Write strobe delay time 1 tWSD1 40 ns 20.22, 20.26, 20.27, 20.32, 20.33 Write strobe delay time 2 tWSD2 30 ns 20.22, 20.26, 20.27, 20.32 Write strobe delay time 3 tWSD3 40 ns 20.24, 20.25 Write strobe delay time 4 tWSD4 40 ns 20.24, 20.25, 20.33 Write data delay time 1 tWDD1 70 ns 20.22, 20.26, 20.27, 20.32 Write data delay time 2 tWDD2 40 ns 20.24, 20.26 Write data hold time tWDH -10 ns 20.22, 20.24-20.27, 20.32 Parity output delay time 1 tWPDD1 80 ns 20.22, 20.24, 20.27 Parity output delay time 2 tWPDD2 40 ns 20.24, 20.25 Parity output hold time tWPDH -10 ns 20.22, 20.23-20.27 482 HITACHI Table 2008 Bus Timing (3) (cont) Conditions: Vee = 3.0 to 5.5 V, AVec = 3.0 to 5.5 V, AVec = Vee±lO%, AVref= 3.0 V to AVec, Vss = AVss = 0 V, cp = 12.5 MHz, Ta =-20 to +75°C* Normal Products: Ta = -40 to +85°C for wide-temperature range products. Hem Symbol Min Max Unit Figures Wait setup time twrs 40 ns 20.23, 20.28, 20.32 Wait hold time twrH 10 ns Read data access time 1 tACC1 tcyc - 44 ns 20.21, 20.24, 20.25 Read data access time 2 tACC2 tcyc x (n+2) - 44°2 ns 20.22, 20.23, 20.26, 20.28 RAS delay time 1 tRASD1 40 ns 20.24-20.27, 20.29- RAS delay time 2 40 ns 20.31 tRASD2 CAS delay time 1 tCASD1 40 ns 20.24 CAS delay time 2 tCASD2 40 ns 20.26, 20.27, 20.29- CAS delay time 3 40 ns 20.31 tCASD3 Column address setup time tASC 0 ns 20.24, 20.25 Read data 35% duty°1 tCAC1 tcyc x 0.65 - 35 ns access time from 50% duty tcyc x 0.5 - 35 ns CAS 1 Read data access time from tCAC2 tcyc x (n+1) - 35°2 ns 20.26, 20.27, 20.28 CAS 2 Read data access time from tRAC1 tcyc x 1.5 - 35 ns 20.24, 20.25 RAS 1 Read data access time from tRAC2 tcyc x (n+2.5) - 35 °2 ns 20.26, 20.27, 20.28 RAS2 Highospeed page mode CAS tcp tcyc x 0.25 ns 20.25 precharge time AH delay time 1 tAHD1 40 ns 20.32 AH delay time 2 tAHD2 40 ns Multiplexed address delay tMAD 40 ns time Multiplexed address hold tMAH -10 ns time HITACHI 483 Table 20.8 Bus Timing (3) (cont) Conditions: Vee = 3.0 to 5.5 V, AVee = 3.0 to 5.5 V, Vee = AVee ±10%, AVref= 3.0 V to AVee, Vss = AVss = 0 V, q> = 12.5 MHz, Ta =-20 to +75°C* Normal Products: Ta =-40 to +85°C for wide-temperature range products Item Symbol Min Max Unit Figures DACKO, DACK1 delay time 1 tOAC01 40 ns 20.21,20.22, 20.24- DACKO, DACK1 delay time 2 tOACD2 40 ns 20.27, 20.32, 20.33 DACKO, DACK1 delay time 3 tOAc03 40 ns 20.22, 20.26, 20.27, 20.32 DACKO, DACK1 delay time 4 tOAC04 40 ns 20.24, 20.25 DACKO, DACK1 delay time 5 tOAC05 40 ns Read delay time 35% duty'1 tROD teye x 0.35 + 35 ns 20.21,20.22, 20.24- 50% duty ns 20.28, 20.32 teye x 0.5 + 35 Data setup time for CAS tos 0*3 ns 20.24, 20.26 CAS setup time for RAS tcsR 10 ns 20.29-20.31 Row address hold time tRAH 10 ns 20.24, 20.26 Write command hold time tWCH 15 ns Write command 35% duty"l twcs 0 ns 20.24 setup time 50% duty twcs 0 ns Access time from CAS tACP tcyc - ns 20.25 precharge -20 Notes: 1. When frequency is 10 MHz or more. 2. n is the number of wait cycles. 3. -5 ns for parity output of DRAM long-pitch access 484 HITACHI T1 CK -.If- \.. .., t 4 AD • A21-AO HBS, LBS J. K tCSD1 tCSD2 \ Vr tRDAC1 *1 tRSD tROD RD (Read) \. Vr tACC1 *2 tRDS t RDH *3 AD15-ADO 14+ I'- k- DPH,DPL f- (Read) DACKO b,' tDACD2 ~ DACK1 J. f Notes: 1. For tRDAC1, use lcyc x 0.65 - 35 (for 35"10 duty) or tcyc x 0.5 - 35 (for 50"10 duty) instead of !eye - tROD - tRDS. 2. For tACC1, use tcye - 44 instead of tcyc - tAD (or tCSD1) - tRDS· 3. tRDH is measured from A21-AO, CSn, or RD, whichever is negated first. Figure 20.21 Basic Bus Cycle: One-State Access HITACHI 485 i I t ASD i I:.. ..: RD (Read) Ii I! t,--- i I 1- i I! ! tACC2 *2 ' t' i t ADH *3 ___----'>..·~----------r--Io~t. .tt-~~~ i : ADS: ~~~~!~ I tDACD1 I.. tDACD2 i =c= I i '4---+j ~ DACKO DACK1 . ){.-----+-!--+-1 (Read) :tWSD1 I j tWSD2 --r- I WRH, WRL, WR (Write) ~ \- Hr----+-,I-- II I. I i tWDD1 I I i tWDH I. ~I I~ ----~~~------~----~I~~~--- AD1S-ADO (Write) I~ tWPDD1~~_ _ _ _-+-_ _ _ _I=lIWPOH --~uJlA DPH,DPL (Write) i II ->---- !~AC~ ~________ DACKO DACK1 (Write) ' ~ 4 Notes: 1. For tADAC2, use teye x (n + 1.65) - 35 (for 35% duty) or teye x (n + 1.5) - 35 (for 50% duty) instead of teye x (n + 2) - tADD - tADS' 2. For tACC2, use !eye X (n + 2) - 44 instead of teye x (n + 2) - tAD (or tCSD1) - tADS. 3. tADH is measured from A21-AO, CSn, or RD, whichever is negated first. Figure 20.22 Basic Bus Cycle: Two-State Access 486 HITACHI Tw ~ ~ CK /- j / / » A21-AO J-: \\ HBS, LBS » \\ \ .. )l \\ tRDAC2*1 r RD (Read) \ .. ~~ \\ * tACC2 2 AD15-ADO I I I'- DPH,DPL ~~ \\ (Read) Ir" ~~ \\ DACKO DACK1 II \\ (Read) I WRH,WRL, WR (Write) ~~ I / : I AD15-ADO DPH,DPL (Write) II )- I' DACKO DACK1 (Write) tWTs tWTH ;; ~ II I tWTH x ~ ~ , ~ \r- I JlII \ Notes: 1. For tRDAC2, use tcyc x (n + 1.65) - 35 (for 35% duty) or tcyc x (n + 1.5) - 35 (for 50% duty) instead of tcyc x (n + 2) - tROD - tRDS. 2. For tACC2, use tcyc x (n + 2) - 44 instead of tcyc x (n + 2) - tAD (or tCSD1) - tRDS· Figure 20.23 Basic Bus Cycle: Two States + Wait State HITACHI 487 --~-~ ----~- --~-----'---------- ~I CK A21-AO =>< __ ~--------~X~ R~O~w~~Xr--.C-o-IU-m-n~!:----X_______ tRA ' . tRASD2! _ _-r-_ _ _ _ _~tR~A~SD'2.:1~'.~~.,..,.,.:ll!:l!..H+.---,~ .• ". r------- RAS "-----J \ ., :; t , ........... tDS ,; ~ ----.----------+---+--....;:.:;..1. . .;. . :,it:~C. !'.' :it~CASD~ .. _ _ ___ CAS "-----J . tROD : .. .. ",. !4 'iii i l_~ ,; : : ! I tRSD : RD(Read) -----r------'---+--...--r--.~! '. !!trt-I--'~"'--- I j WRH, WRL, ~j :. II , tWCH .. ~.: ri, "---- WR(Read) I DACKO DACK1 (Read) AD15-ADO DPH,DPL ~-- (Read) ~ RD(Write) WRH, WRL, tWes' -----------~W~S~D3~i.~~~j~l:i~~i t . Ut ~~W~S~D~4------ WR(Write) : ,..........-+,---+'~I : tWDD2' I ! tWDH AD15-ADO (Write) ) :11 I ' . fJ-- !tWPD~ tWPDD2 f i ~ ~-+t--------~)~---- DPH,DPL ) : - - - : 1 . (Write) I I I tDACD4 I!DA~p5 DACKO DACK1 (Write) ---:0-- Notes: 1. For tCAC1, use !eye X 0.65 - 35 (for 35% duty) or teye x 0.5 - 35 (for 50% duty) instead of teye - tAD - tASC - tRDS' 2. For tACC1, use !eye - 44 instead of tcye - tAD - tRDS. 3. For tRAC1, use !eye X 1.5 - 35 instead of teye x 1.5 - tRAsD1 - tRDS. 4. tRDH is measured from A21-AO, RAS, or CAS, whichever is negated first. Figure 20.24 DRAM Bus Cycle (Short Pitch, Normal Mode) 488 HITACHI CK RAS --r----'-".=.;;.."-,. ~+__H--_++---------------+_~~----- CAS RO(Read) -~----+-+. . .I '+++---+++-"1 WRH.WRL. -,-----~~~~~~------+_~4_-~- WR(Read) A015-AOO _ _ _ _~t~RA~C~1..::.3:'::i=~=1:=t~ OPH.OPL (Read) OACKO _ _ _ _ _ _ _~~~~~,r___...,~r_~~~ OACK1 (Read) RO(Write) WRH. WRL. -------+--.... WR(Write) l'+--+--------+----J (Write) ___________~~~jpt===~======~==~----- A015-AOO OPH. OPL ------~tt~~===x:==¢=J-­ (Write) OACKO _ _ _ _ _ _~~r~\~__....r-..... r~,r___...J-~r~J~---- OACK1 _ _ _ _ _ _~~~~J~-J~~~-J~-J'~J~----- (Write) Notes: 1. For tCAC1. use lcvc x 0.65 - 35 (for 35% duty) or loyc x 0.5 - 35 (for 50% duty) instead of loyc - tAD - tASC - tRDS· 2. For tACC1. use lcvc - 44 instead of tcyc - tAD - tRDS· 3. For tRAC1. use loyc x 1.5 - 35 instead of tcyC x 1.5 - tRASD1 - tRDS. 4. tRDH is measured from A21-AO or CAS. whichever is negated first. 5. tRDH is measured from A21-AO. RAS. or CAS. whichever is negated first. Figure 20.25 DRAM Bus Cycle (Short Pitch, High-Speed Page Mode) HITACHI 489 ----~------- CK : tAD ' tAD ~ ~, A21-AO ==:x~----,X ROw: X: Column )<_____ t~H :; ' I ilt I' _ - - r -_ _ _ _ t_R_A_SD~... '-'!-' • I i I_RASD2f,~.....:,1 _ _ RAS =--.; '\ i , f i -tDS' !: I ItCASD2"': I i i-----tJtCASD3 -----,~--------'---+llt-R-D,D-+i-+!--+! CAS=--'; ;hi' 1 : M - '--', ,--,'i,' '!II"i iI ,I i~RD~1 ,! RD(Read)----,/-------+--~' ' I I,' l:rl-I",----,,-- ~ }i iii, 1 ~ WRH, WRL, =--.; : i itWCH~ ' II i I II I' -c= WR(Read) ! : ! i itcAc2',1 i I- ' .. ,I I tACC2,2 I'i I! AD15-ADO DPH,DPL (Read) .- '., tRAF2' , 3 ! " Ii f 'tRDH*4 ItRDS J.:..+, ,I I r- DACKO tDAcD1l-- 1 i i ~:,tDACD2 DACK1 ---------'I!~'xf: _Ic--_- , 11', I '----- (Read) : RD(Write) =-; tWSD1~' tWSD2~ WRH, WRL, '\~ i ! I~--t-I- - - WR(Write) I l' i ti ItWDH AD15-ADO t WDD1 !--:ir-_-+-_-+R--, (Write) ---~)~--------------~i~~~,--~I---+~~--- DPH,DPL _ _--.)~--------W-P-D-D1+r==1-~ t il • : ~H,------- ===t------- (Write) I!DA~p3 ItDACD3 ========================'==~~~=====~==:=========== DACKO DACK1 (Write) Notes: 1. For tCAC2, use tcye x (n + 1) - 35 instead of teye x (n + 1) - tCASD2 - tRDS· 2. For tACC2, use teye x (n + 2) - 44 instead of teye x (n + 2) - tAD - tRDS· 3. For tRAC2, use teye x (n + 2.5) - 35 instead of teye x (n + 2.5) - tRASD1 - tRDS· 4. tRDH is measured from A21-AO, CAS, or RAS, whichever is negated first. Figure 20,26 DRAM Bus Cycle: (Long Pitch, Normal Mode) 490 HITACHI Tc2 ~r-->f-----I ~~ r---,~I\....-.J ~ CK A21-AO ~)[ Row ~ tAD rl- Column Column tRAS~1 iH UtRASD2 J ~ tC~SD2 ~tCASD3 ~ASD3 J k'I' RD(Read) WRH,WRL, J tROD 4 '1 ~ WR(Read) J t *1 '- tACC2*2 - CA~1tRDS tRDH *4 tRDH*5 AD15-ADO rl·~·1 ~ tRAC2*3 DPH,DPL I 1 tD!~~ ~ACD1 (Read) I DACKO I!2ACD1 !2ACD2 DACK1 )[ )[ )[ )[ (Read) RD(Write) --../ -C ~SD1 ~SD~ ~SD1 ~SD2 WRH,WRL, I I .l WR(Write) ,~~1 JtWDH ~D1 tWDH ..i.j' AD15-ADO (Write) I ~1 ~H I~WP~D1 ~DH DPH,DPL (Write) ~ACD3 ~ACD3 ~CD3 ~CD3 DACKO )[ )[ )[ )[ DACK1 (Write) Notes: 1. For tCAC2, use tcyc x (n + 1) - 35 instead of tcyc x (n + 1) - tCASD2 - tRDS. 2. For tACC2, use tcyc x (n + 2) - 44 instead of tcyc x (n + 2) - tAD - tRDS. 3. For tRAC2, use tcyc x (n + 2.5) - 35 instead of tcyc x (n + 2.5) - tRASD1 - tRDS. 4. tRDH is measured fromA21-AO or CAS, whichever is negated first. 5. tRDH is measured from A21-AO, RAS, or CAS whichever is negated first. Figure 20.27 DRAM Bus Cycle: (Long Pitch, High-Speed Page MOde) HITACHI 491 ~~~- .. _-_..-_._--- Tp CK A21-AO x Row; >C il Column II :: !: tRDS RAS :=.; '\ '~ tRoD i:" II :: CAS :=.; I, il l'lt- " , i .: II , , i!;1 ~: I RD(Read) I " I. I I ,t- : WRH, WRL, :=.; 1/ Ii i: WR(Read) tCAC2*1 : , II .: Ii tACC2*2 :! I i, I. tRAC2*3 i i .; AD15-ADO .~ !i DPH,DPL 1/ Ii )- (Read) Ii 'I DACKO 11 i! DACK1 (Read) X iiii i: I:II ><= ,,. RD(Write) :=.; i' ,i C !:II ii WRH, WRL, iiII WR(Write) \ iI II " / II ii AD15-ADO (Write) i; ,I II II >-- " DPH,DPL (Write) 11 II il I' )- II II DACKO DACK1 (Write) X Ii II tWTsiitWTH ~-, q tWTsi tWTH X WAIT \!. .v ;r-~1\ Notes: 1. For tCAC2, use tcyc x (n + 1) - 35 instead of tcyc x (n + 1) - tCASD2 - tROS· 2. For tACC2, use tcyc x (n + 2) - 44 instead of tcyc x (n + 2) - tAD - tROS· 3. For tRAC2, use tcyc x (n + 2.5) - 35 instead of tcyc x (n + 2.5) - tRAS01 - tROS. Figure 20.28 DRAM Bus Cycle: (Long Pitch, High-Speed Page Mode + Wait State) 492 HITACHI CK tRASD2 tCASD3 _ - ,_ _ _ _--.,;.:...,.. tCASD2 CAS WRH.~ WRL. WR Figure 20.29 CAS-before-RAS Refresh (Short Pitch) CK tCASD3 Figure 20.30 CAS-before-RAS Refresh (Long Pitch) HITACHI 493 TAr TAc T Acc" tl· CK I I itRASD1 tAASD2 I H "I RAS :J I tCSA 'i 1/ J ; I- II itCASD3 ~ ~tCASD2 CAS :J II { Figure 20.31 Self Refresh 494 HITACHI t.-- _ ~~~ ~ CK J \ ~ ----..I tAD A21-AO ~ HBS. LBS ... ~3 ... tCSD4 ~D1 ~D2 ;t 1\. tROD tRSD RD H (Read) \ ~ tMAD h- - tMAH 1- 1A~ ......, ntRDH AD15-ADO 7< 11. (Read) lI. Address Data I'" ~ '" (input) tDAC~ ~ _ tOA~2 DACKO DACK1 )[ )[ 1 - (Read) WRH.WRL. .... tWS02 "f-- WR (Write) A - tMAH ~O1 tMAO tWOH ~- AD15-ADO I 7< 11. 7< (Write) 11. Address 'I.. Data (output) DACKO tOAC03 +--+I I~C03 DACK1 )[ )[ (Write) tWTH • tWT~ ~ A '\ Figure 20.32 AddressIData Multiplex 110 Bus Cycle HITACHI 495 ~- ......- . -.- - ,' - .- , - , -~-"",,~- ----- '--~.~-.--.-,--- CK A21-AO HBS, LBS i tCS02 I~ r I 1,----- I!+-+l , tWS01 I I!:s~~. ! , _ _ _ __ WRH, WRL, - - - - + - Ii. :---..\!. ' f Wi1(Write) I -\ I I Ii itOAC01 ItOAC02 '~-!l- DACKO DACK1 (Write) Figure 20.33 DMA Single TransferlSingle State Access Write 20.3.4 DMAC Timing Table 20.9 DMAC Timing = = Case A: Vee 3.0 to 5.5 V. AVee 3.0 to 5.5 V. AVee =Vee ±10%. AVref =3.0 V to AVee. = = = Vss AVss 0 V. Ta -20 to +75°C* Case B: Vee =5.0 V ±1O%. AVee =5.0 V ±10%. AVee =Vec±lO%, AVref =4.5 V to AVee. Vss =AVss =0 V. Ta =-20 to +75°C* Normal Products: Ta =-40 to +85°C for wide-temperature range products. C8seA CaseB 12.5 MHz 16.6 MHz 20 MHz Hem Symbol Min Max Min Max Min Max Unit Figure DRECio, DRECi1 setup time tORaS 80 40 27 ns 20.34 [)REao, [)RE01 hold time tORaH 30 30 30 ns DREOO, DRE01 low level width tDRQW 1.5 1.5 1.5 Icyc 20.35 496 HITACHI CK 7 LtOROS DREOO, DREQ1 level 'f tOROS tORaH DREOO, DRE01 edge \ ... V tOROS DREQO, DREQ1 level release If- Figure 20.34 DREQO, DREQI Input Timing (I) CK~~ 1 ~~ DREOO,DRE01 edge I tOROW I 14 ·1 Figure 20.35 DREQO, DREQI Input Timing (2) HITACHI 497 20.3.5 16-bit Integrated Timer Pulse Unit Timing Table 20.10 16-bit Integrated Timer Pulse Unit Timing Case A: Vee = 3.0 to 5.5 V, AVee = 3.0 to 5.5 V, AVee = Vee ±1O%, AVref = 3.0 V to AVee, Vss = AVss = 0 V, Ta =-20 to +75°C* Case B: Vee =5.0 V ±10%, AVee = 5.0 V ±10%, AVee = Vce ±1O%, AVref = 4.5 V to AVec, Vss =AVss = 0 V, Ta = -20. to +75°C* Normal Products: Ta =-40 to +85°C for wide-temperature range products. Case A CaseB 12.5 MHz 16.6 MHz 20 MHz Item Symbol Min Max Min Max Min Max Unit Figure Output compare delay time tTOCD 100 100 100 ns 20.36 Input capture setup time tTICS 50 45 35 ns Timer clock input setup time tTcKS 50 50 50 ns 20.37 Timer clock pulse width tTCKWH/L 1.5 1.5 1.5 tcyc (single edge) Timer clock pulse width tTCKWUL 2.5 2.5 2.5 tcyc (both edges) CK Output compare*1 Output ---------------...,V capture*2 It--------- Notes: 1. TIOCA~TIOCA4, TIOCB~TIOCB4, TOCXA4, TOCXB4 2. TIOCA~TIOCA4, TIOCB~TIOCB4 Figure 20.36 lTV Input/Output Timing 498 HITACHI trcKS TCLKA- TCLKD trCKWL trcKWH Figure 20.37 ITU Clock Input Timing 20.3.6 Programmable Timing Pattern Controller and VO Port Timing Table 20.11 Programmable Timing Pattern Controller and VO Port Timing Case A: Vee = 3.0 to 5.5 V, AVec = 3.0 to 5.5 V, AVec = Vee±IO%, AVreC= 3.0V to AVec, Vss = AVss = 0 V" = 12.5 MHz, Ta = -20 to +75°C* Case B: Vee =5.0 V ±1O%, AVec = 5.0 V ±1O%, AVec = Vee±lO%, AVref= 4.5 V to AVec, Vss = AVss = 0 V, ,= 16.6 MHz, Ta = -20 to +75°C* Case C: Vee = 5.0 V ±1O%, AVec = 5.0V ±1O%, AVec = Vee±lO%, AVreC= 4.5 V to AVec, Vss = AVss =0 V" = 20 MHz, Ta,=-20to +75°C* Normal Products: Ta = -40 to +85°C for wide-temperature range products. cases A, Band C Item Symbol Min Max Unit Figure Port output delay time tPWD 100 ns 20.38 Port input hold time tpRH 50 ns Port input setup time tpRs 50 ns HITACHI 499 t=~1 T; j. CK . tpRS I !tpRH I .'~! ========== \4 l<4-:-~! PortsA-C (read) ___>¢i !~ ----------------~~~-------- Ports A-C (write) Figure 20.38 Programmable Timing Pattern Controller Output Timing 20.3.7 Watchdog Timer Timing Table 20.12 Watchdog Timer Timing Case A: Vee = 3.0 to 5.5 V, AVec = 3.0 to 5.5 V, AVec = Vee ±10%, AVref= 3.0 V to AVec, Vss = AVss = 0 V" = 12.5 MHz, Ta =-20 to +75°C* Case B: Vee = 5.0 V ±10%, AVec = 5.0 V ±10%, AVec = Vee±lO%, AV ref=4.5 V to AVec, Vss = AVss = 0 V" = 16.6 MHz, Ta =-20 to +75°C* CaseC: Vee =5.0 V ±10%, AVec =5.0V±10%, AVec = Vee±10%, AVref=4.5 V to AVec, Vss = AVss = 0 V" = 20 MHz, Ta=-20 to +75°C* Normal Products: Ta = -40 to +85°C for wide-temperature range products. Cases A, Band C Item Symbol Min Max Unit Figure WDTOVF delay time tWOVD 100 ns 20.39 CK \ WDTOVF Figure 20.39 Watchdog Timer Olltput Timing 500 HITACHI 20.3.8 Serial Communications Interface Timing Table 20.13 Serial Communications Interface Timing Case A: Vee = 3.0 to 5.5 V, AVee = 3.0 to 5.5 V, AVee = Vee ±l0%, AVref = 3.0 V to AVee, Vss = AVss = 0 V, cj) = 12.5 MHz, Ta = -20 to +75°C* Case B: Vee = 5.0 V ±1O%, AVee = 5.0 V ±10%, AVee = Vee ±10%, AV ref = 4.5 V to AVee, Vss = AVss = 0 V, cj) = 16.6 MHz, Ta = -20 to +75°C* Case C: Vee = 5.0 V ±1O%, AVee = 5.0 V ±1O%, AVec = Vee±lO%, AVref= 4.5 V to AVee, Vss = AVss = 0 V, cj) = 20 MHz, Ta = -20 to +75°C* Nomal Products: Ta = -40 to +85°C for wide-temperature range products. Cases A, Band C Item Symbol Min Max Unit Rgure Input clock cycle tscyc 4 tcyc 20.40 Input clock cycle (clocked synchronization) tscyc 6 tcyc Input clock pulse width tsckw 0.4 0.6 tscyc Input clock rise time 1.5 tcyc Input clock fall time 1.5 tcyc Transmission data delay time (clocked tTXD 100 ns 20.41 synchronization) Receive data setup time (clocked 100 ns synchronization) Receive data hold time (clocked tRXH 100 ns synchronization) SCKO, SCK1 Figure 20.40 Input Clock Timing HITACHI 501 tscyc ,---..... ! SCKO, SCK1 I itrXD ~ . TxDO, TxD1 (transm iss ion _----JX,--------.X~:~ ----.X'----~)( data) tRXS i : tRXH ~~ RxDO,RxD1 (reception data) -----'X'-------JX= 12.5 MHz, Ta=-20to+75°C* Case B: Vee = 5.0 V ±10%, AVee = 5.0 V ±10%, AVee = Vee ±1O%, AVref = 4.5 V to AVee, Vss = AVss = 0 V, «I> = 16.6 MHz, Ta =-20 to +75°C* CaseC: Vee = 5.0 V ±10%, AVee = 5.0 V ±10%, AVec = Vee ±10%, AVrec=4.5 V to AVee, Vss = AVss = 0 V, «I> = 20 MHz, Ta = -20 to +75°C* Normal Products: Ta = -40 to +85°C for wide-temperature range products. Cases A, Band C Hem Symbol Min Max Unit Figure External trigger input start delay time tTRGS 50 ns 20.42 AID converter time (266 cycles) tCONV 266 tcyc 20.43 AID converter time (134 cycles) tCONV 134 tcyc 502 HITACHI cle CK ADTRG input ADCR Figure 20.42 External Trigger Input Timing tcoNv to tSPL No more than 3 cycles 14 cycles CK Address Analog input sampling signals ADF Figure 20.43 Analog Conversion Timing HITACHI 503 20.3.10 AC Characteristics Measurement Conditions LSI 0 - - - + - - - - ( Device under output pin test output Vref IOH CL is set as follows for each pin. 30pF: CK, CASH, CASL, CSO-CS7, BAEQ, BACK, AH, LAQOUT, AAS, DACKO, DACK1 50pF: A21-AO, AD15-ADO, DPH, DPL, AD, WAH, WAL, HBS, LBS, WA 70pF: All port outputs and peripheral module output pins other than the above. IOL and IOH values are as shown in section 20.2, DC Characteristics, and table 20.3, Permitted Output Current Values. Figure 20.44 Output Load Circuit 504 HITACHI 20.4 AID Converter Characteristics Table 20.15 AID Converter Characteristics (1) Conditions: Vee = 5.0 V ±1O%, AVee = 5.0 V ±1O%, AVee = Vee ±1O%, AVref= 4.5 V to AVee, Vss = AVss = 0 V, Ta = -20 to +75°C* Normal Products: Ta = -40 to +85°C for wide-temperature range products. 12.5 MHz 16.6 MHz 20 MHz Hem Min Typ Max Min Typ Max Min Typ Max Unit Resolution 10 10 10 10 10 10 10 10 10 bit Conversion time 11.2 8.4 6.7 IlS Analog input capacitance 20 20 20 pF Permissible signal-source impedance 3 3 3 kn Nonlinearity error ±3 ±3 ±3 LSB Offset error ±3 ±3 ±3 LSB Full-scale error ±3 ±3 ±3 LSB Quantization error ±0.5 ±0.5 ±0.5 LSB Absolute accuracy ±4 ±4 ±4 LSB Table 20.15 AID Converter Characteristics (2) Conditions: Vee = 3.0 to 5.5 V, AVee = 3.0 to 5.5 V, AVee =Vee ±10%, AVref = 3.0 V to AVee , Vss = AVss = 0 V, Ta = -20 to +75°C* Normal Products: Ta =-40 to +85°C for wide-temperature range products. 12.5 MHz Hem Min Typ Max Unit Resolution 10 10 10 bit Conversion time 11.2 IlS Analog input capaCitance 20 pF Permissible signal-source impedance 3 kn Nonlinearity error ±4.0 LSB Offset error ±4.0 LSB Full-scale error ±4.0 LSB Quantization error ±a.5 LSB Absolute accuracy ±6.0 LSB HITACHI 505 Appendix A On-Chip Peripheral Module Registers A.I List of Registers The addresses and bit names of the on-chip peripheral module registers are listed below. 16- and 32-bit registers are expressed as two or four levels of 8 bits each. I HITACHI 507 TableA.l 8-Bit Access Space (8-bit and 16-bit accessible, 32-bit access disabled) Bit Name Address Register 7 6 5 4 3 2 1 0 Module H'5FFFEOo- H'5FFFEBF H'5FFFECO SMRO CIA CHR PE OlE STOP MP CKS1 CKSO SCI H'5FFFEC1 BRRO (channel 0) H'5FFFEC2 SCRO TIE RIE TE RE MPIE TEIE CKE1 CKEO H'5FFFEC3 TDRO H'5FFFEC4 SSRO TORE RDRF ORER FER PER TEND MPB MPBT H'5FFFEC5 RDRO H'5FFFEC6 H'5FFFEC? H'5FFFECS SMR1 CiA CHR PE OlE STOP MP CKS1 CKSO SCI H'5FFFEC9 BRR1 (channel 1) H'5FFFECA SCR1 TIE RIE TE RE MPIE TEIE CKE1 CKEO H'5FFFECB TDR1 H'5FFFECC SSR1 TORE RDRF ORER FER PER TEND MPB MPBT H'5FFFECD RDR1 H'5FFFECE- H'5FFFEDF H'5FFFEEO ADDRAH AD9 ADS AD? AD6 AD5 AD4 AD3 AD2 AID H'5FFFEE1 ADORAL AD1 ADO H'5FFFEE2 ADDRBH AD9 ADS AD? AD6 AD5 AD4 AD3 AD2 H'5FFFEE3 ADDRBl AD1 ADO H'5FFFEE4 ADDRCH AD9 ADS AD? AD6 AD5 AD4 AD3 AD2 H'5FFFEE5 ADDRCl AD1 ADO H'5FFFEE6 ADDRDH AD9 ADS AD? AD6 AD5 AD4 AD3 AD2 H'5FFFEE? ADDRDl AD1 AOO H'5FFFEES ADCSR ADF ADIE ADST SCAN CKS CH2 CH1 CHO H'5FFFEE9 ADCR TRGE - H'5FFFEEA- H'5FFFEEF 508 HITACHI Table A.2 16-bit Access Space (In Principle, 8-bit, 16-bit and 32-bit Accessible) (cont) Bit Name Address Register 7 6 5 4 3 2 1 0 Module H'SFFFF22 TCR3*' CCLR1 CCLRO CKEG1 CKEGO TPSC2 TPSC1 TPSCO ITU (chan- H'SFFFF23 TIOR3*' IOB2 IOB1 lOBO 10A2 lOA 1 10AO nel 3) H'SFFFF24 TIER3*' OVIE IMIEB IMIEA H'SFFFF2S TSR3*' OVF IMFB IMFA H'SFFFF26 TCNT3 H'SFFFF27 H'SFFFF28 GRA3 H'SFFFF29 H'SFFFF2A GRB3 H'SFFFF2B H'SFFFF2C BRA3 H'SFFFF2D H'SFFFF2E BRB3 H'SFFFF2F H'SFFFF31 TOCR*' OLS4 OLS3 ITU (chan- nels 0-4 shared) H'SFFFF32 TCR4*' CCLR1 CCLRO CKEG1 CKEGO TPSC2 TPSC1 TPSCO ITU (chan- H'SFFFF33 TIOR4*' IOB2 IOB1 lOBO 10A2 IOA1 10AO nel4) H'SFFFF34 TIER4*1 OVIE IMIEB IMIEA H'SFFFF3S TSR4*1 OVF IMFB IMFA H'SFFFF36 TCNT4 H'SFFFF37 H'SFFFF38 GRA4 H'SFFFF39 H'SFFFF3A GRB4 H'SFFFF3B H'SFFFF3C BRA4 H'SFFFF3D H'SFFFF3E BRB4 H'SFFFF3F S10HITACHI Table A.2 16-bit Access Space (In Principle, 8-bit, 16-bit and 32-bit Accessible) (cont) Bit Name Address Register 7 6 5 4 3 2 1 0 Module H'5FFFF40 SARO" DMAC H'5FFFF41 channel 0 H'SFFFF42 H'5FFFF43 H'5FFFF44 DARO" H'SFFFF45 H'5FFFF46 H'5FFFF47 H'SFFFF48 DMAOR'2 - PR1 PRO H'SFFFF49 AE NMIF DME H'SFFFF4A TCRO" H'5FFFF4B H'5FFFF4C - H'5FFFF4D - H'SFFFF4E CHCRO DM1 DMO SM1 SMO RS3 RS2 RS1 RSO H'5FFFF4F AM AL OS TM TS IE TE DE H'SFFFF50 SAR1" DMAC H'5FFFFS1 channel 1 H'5FFFF52 H'5FFFFS3 H'5FFFF54 DAR1" H'SFFFF55 H'SFFFF56 H'5FFFF57 H'SFFFFS8 H'5FFFF59 H'5FFFFSA TCR1" H'SFFFF5B H'5FFFF5C - H'5FFFF5D - H'5FFFFSE CHCR1 DM1 DMO SM1 SMO RS3 RS2 RS1 RSO H'5FFFF5F AM AL OS TM TS IE TE DE HITACHI 511 ---.-." ----~~---- -~-- ---~~---~-- -'-'-"""~------- TableA.2 16-bit Access Space (In Principle, 8-bit, 16-bit and 32-bit Accessible) (cont) BltName Address Register 7 6 5 4 3 2 1 0 Module H'5FFFF60 SAR2*1 DMAC H'5FFFF61 channel 2 H'5FFFF62 H'5FFFF63 H'5FFFF64 DAR2*1 H'5FFFF65 H'5FFFF66 H'5FFFF67 H'5FFFF68 H'5FFFF69 H'5FFFF6A TCR2*1 H'5FFFF6B H'5FFFF6C - H'5FFFF6D - H'5FFFF6E CHCR2 DM1 DMO SM1 SMo RS3 RS2 RS1 RSO H'5FFFF6F AM AL OS TM TS IE TE DE H'5FFFF70 SAR3*1 DMAC H'5FFFF71 channel 3 H'5FFFF72 H'5FFFF73 H'5FFFF74 DAR3*1 H'5FFFF75 H'5FFFF76 H'5FFFF77 H'5FFFF78 H'5FFFF79 H'5FFFF7A TCR3*1 H'5FFFF7B H'5FFFF7C - H'5FFFF7D - H'5FFFF7E CHCR3 DM1 DMO SM1 SMO RS3 RS2 RS1 RSO H5FFFF7F AM AL OS TM TS IE TE DE 512 HITACHI Table A.2 16-bit Access Space (In Principle, 8-bit, 16-bit and 32-bit Accessible) (cont) BitName Address Register 7 6 5 4 3 2 1 o Module H'SFFFF80- - INTC H'SFFFF83 H'SFFFF84 IPRA H'SFFFFB5 H'SFFFFB6 IPRB H'SFFFFB7 H'SFFFFBB IPRC H'SFFFFB9 H'SFFFFBA IPRO H'SFFFFBB H'SFFFFBC IPRE H'SFFFFBO H'SFFFFBE ICR NMIL - NMIE H'SFFFFBF IROOS IR01S IR02S IR03S IR04S IR05S IR06S IR07S H'SFFFF90 BARH BA31 BA30 BA29 BA2B BA27 BA26 BA25 BA24 UBC H'SFFFF91 BA23 BA22 BA21 BA20 BA19 BA1B BA17 BA16 H'5FFFF92 BARL BA15 BA14 BA13 BA12 BA11 BA10 BA9 BAB H'5FFFF93 BA7 BA6 BA5 BA4 BA3 BA2 BA1 BAO H'5FFFF94 BAMRH BAM31 BAM30 BAM29 BAM2B BAM27 BAM26 BAM25 BAM24 H'SFFFF9S BAM23 BAM22 BAM21 BAM20 BAM 19 BAM 1B BAM 17 BAM 16 H'5FFFF96 BAMRL BAM15 BAM14 BAM13 BAM12 BAM11 BAM10 BAM9 BAMB H'SFFFF97 BAM7 BAM6 BAM5 BAM4 BAM3 BAM2 BAM1 BAMO H'SFFFF9B BBR H'5FFFF99 C01 COO 101 100 RW1 RWO SZ1 SZO H'5FFFF9A-- H'SFFFF9F HITACHI 513 TableA.2 16-bit Access Space (In Principle, 8-bit, 16-bit and 32-bit Accessible) (cont) BitName Address Register 7 6 5 4 3 2 1 0 Module H'SFFFFAO BCR DRAME IOE WARP RDDTYBAS BSC H'SFFFFA1 H'SFFFFA2 WCR1 RW7 RW6 RWS RW4 RW3 RW2 RW1 RWO H'SFFFFA3 WW1 H'SFFFFA4 WCR2 DRW7 DRW6 DRWS DRW4 DRW3 DRW2 DRW1 DRWO H'SFFFFAS DWW7 DWW6 DWWS DWW4DWW3DWW2DWW1DWWO H'SFFFFA6 WCR3 WPU A02LW1 A02LWO A6LW1 A6LWO- H'SFFFFA7 H'SFFFFA8 OCR CW2 RASD TPC BE CDTY MXE MXC1 MXCO HSFFFFA9 H'SFFFFM PCR PEF PFRC PEO PCHK1 PCHKO H'SFFFFAB H'SFFFFAC RCR H'SFFFFAD RFSHE RMODE RLW1 RLWO H'SFFFFAE RTCSR H'SFFFFAF CMF CMIE CKS2 CKS1 CKSO H'SFFFFBO RTCNT H'SFFFFB1 H'SFFFFB2 RTCOR H'SFFFFB3 H'SFFFFB4- - H'SFFFFB7 H'SFFFFBB TCSR*3 OVF WTIIT TME CKS2 CKS1 CKSO WDT H'SFFFFB9 TCNT*3 H'SFFFFBA H'SFFFFBB RSTCSR*3 WOVF RSTE RSTS H'SFFFFBC SBYCR SBY HIZ Power down state H'SFFFFBD-- H'SFFFFBF 514 HITACHI TableA.2 16-bit Access Space (In Principle, 8-bit, 16-bit and 32-bit Accessible) (cont) BitName Address Register 7 6 5 4 3 2 1 0 Module H'SFFFFCO PAOR PA15 PA14 PA13 PA12 PA11 PA10 PA9 PA8 Port A DR DR DR DR DR DR DR DR H'SFFFFC1 PA7 PAS PAS PA4 PA3 PA2 PA1 PAD DR DR DR DR DR DR DR DR H'SFFFFC2 PBoR PB1S PB14 PB13 PB12 PB11 PB10 PB9 PB8 Port B DR DR DR DR DR DR DR DR H'SFFFFC3 PB7 PBS PBS PB4 PB3 PB2 PB1 PBO DR DR DR DR DR DR DR DR H'SFFFFC4 PAIOR PA1S PA14 PA13 PA12 PA11 PA10 PA9 PA8 PFC lOR lOR lOR lOR lOR lOR lOR lOR H'SFFFFCS PA7 PAS PAS . PA4 PA3 PA2 PA1 PAD lOR lOR lOR lOR lOR lOR lOR lOR H'SFFFFCS PBIOR PB15 PB14 PB13 PB12 PB11 PB10 PB9 PB8 lOR lOR lOR lOR lOR lOR lOR lOR H'SFFFFC7 PB7 PBS PB5 PB4 PB3 PB2 PB1 PBO lOR lOR lOR lOR lOR lOR lOR lOR H'5FFFFC8 PACR1 PA1S PA1S PA14 PA14 PA13 PA13 PA12 PA12 Mo1 MOO M01 MOO M01 MOO M01 MOO H'5FFFFC9 PA11 PA11 PA10 PA10 PA9 PA9 PA8 M01 MOO M01 MOO M01 MOO MO H'5FFFFCA PACR2 PA7 PAS PAS PA4 MO MO MO Mo H'5FFFFCB PA3 PA3 PA2 PA2 PA1 PA1 PAD PAD M01 MOO M01 MOO M01 MOO MD1 MOO H'5FFFFCC PBCR1 PB15 PB1S PB14 PB14 PB13 PB13 PB12 PB12 M01 MOO M01 MOO Mo1 MOO M01 MOO H'5FFFFCO PB11 PB11 PB10 PB10 PB9 PB9 PBS PB8 M01 MOO M01 MOO Mo1 MOO M01 MOO H'5FFFFCE PBCR2 PB7 PB7 PBS PBS PB5 PB5 PB4 PB4 M01 MOO M01 MOO M01 MOO Mo1 MOO H'5FFFFCF PB3 PB3 PB2 PB2 PB1 PB1 PBO PBO M01 MOO M01 MOO M01 MOO M01 MOO H'5FFFFOO PCoR PortC H'SFFFFo1 PC7 PCS PCS PC4 PC3 PC2 PC1 PCO DR DR DR DR DR DR DR DR HITACHI 515 Table A.2 16-bit Access Space (In Principle, 8-bit, 16-bit and 32-bit Accessible) (cont) BitName Address Register 7 6 5 4 3 2 1 o Module H'SFFFF02- - PFC H'SFFFFEO H'SFFFFEE CASCR CASH CASH CASL CASL M01 MOO M01 MOO H'SFFFFEF TPC H'SFFFFFO TPMR G3N G2N G1N GON OV OV OV OV H'SFFFFF1 TPCR G3C G3C G2C G2C G1C G1C GOC GOC MS1 MSO MS1 MSO MS1 MSO MS1 MSO H'SFFFFF2 NOERH NOE NOE NOE NOE NOE NOE NOE NOE R1S R14 R13 R12 R11 R10 R9 R8 H'SFFFFF3 NOERL NOE NOE NOE NOE NOE NOE NOE NOE R7 R6 RS R4 R3 R2 R1 RO H'SFFFFF4 NORB NOR1S NOR14 NOR13 NOR12- H'SFFFFFS NORA NOR7 NOR6 NORS NOR4 H'SFFFFF6 NORB NOR11 NOR10NOR9 NOR8 H'SFFFFF7 NORA NOR3 NOR2 NOR1 NORO H'SFFFFF8- - H'SFFFFFF Notes 1. Only 16·bit and 32·bit accessible. 8·bit access disabled. 2. Register shared by all channels. 3. Address for read. For writing, the addresses are H'SFFFFB8 for TCR and TCNT and H'SFFFFBA for RSTCSR. For more information, see section 12, Watchdog nmer, particularly section 12.2.4, Points to Note When Accessing Registers. 4. When the output triggers for TPC output group 0 and TPC output group 1 set by TPCR are the same, the NORA address is H'SFFFFFS; when the output triggers are different, the NORA for group 0 is H'SFFFFF7 and the NORA address for group 1 is H'SFFFFFS. Likewise, when the output triggers for TPC output group 2 and TPC output group 3 set by TPCR are the same, the NORB address is H'SFFFFF4; when the output triggers are different, the NORB for group 2 is H'SFFFFF6 and the NORB address for group 3 is H'SFFFFF4. S16 HITACHI A.2 Register Tables A.2.1 Serial Mode Register (SMR) SCI • Top Address: H'5FFFECO (channel 0), H'5FFFEC8 (channell) • Bus Width: 8/16 Register Overview: Bit: 7 6 5 4 3 2 1 0 Bit name: I CIA CHR PE OlE STOP MP CKS1 CKSO Initial value: 0 0 0 0 0 0 0 0 RJW: RJW RJW PJW PJW RJW PJW RJW RJW TableA.3 SMR Bit Functions Bit Bit name Value* Description 7 Communications mode (CIA) 0 Start-stop synchronous mode (initial setting) Clock synchronous mode 6 Character length (CHR) 0 8-bit data (initial setting) 1 7-bit data 5 Parity enable (PE) 0 Add parity bit and disable check (initial setting) 1 Add parity bit and enable check 4 Parity mode (OlE) 0 Even parity (initial setting) Odd parity 3 Stop bit length (STOP) 0 1 stop bit (initial setting) 2 stop bits 2 Multiprocessor mode (MP) 0 Multiprocessor function disabled (initial setting) Multiprocessor function selected 1,0 Clock select 1, 0 (CKS1, CKSO) 0 0 ~ clock (initial setting) 0 ~/4 clock 0 ~16clock ~/64 clock Note: When 2 or more bits are treated as a group, the left side is the top bit and the right the lower bit. ' HITACHI 517 --_----:--_-_-.""--.- -~. - 0 - : - - ... -_ . _ . . _ ._ . . _ . _____-. . ____ ._~ __ "._. __ ." _______ _ A.2.2 Bit Rate Register (BRR) SCI - Top Address: H'5FFFECI (channel 0), H'5FFFEC9 (channel l) - Bus Width: 8/16 -Register Overview: Bit: 7 6 5 4 3 2 0 Bit name: I Initial value: 1 1 1 1 1 1 1 1 RIW: RIW RNV RIW RIW RIW RIW RNV RIW Table A.4 BBR Bit Functions Bit Bit name Description 7-0 (Bit rate setting) Set serial transmission/reception bit rate A.2.3 Serial Control Register (SCR) SCI - Top Address: H'5FFFEC2 (channel 0), H'5FFFECA (channel 1) - Bus Width: 8/16 Register Overview: Bit: 7 6 5 4 3 2 0 Bit name: I TIE RIE TE RE MPIE TEIE CKE1 CKEO Initial value: 0 0 0 0 0 0 0 0 RIW: RIW RNV RIW RIW RNV RIW RNV RIW 518 HITACHI Table A.S SCR Bit Functions Bit Bit Name Value Description 7 Transmit interrupt o Disables transmission data empty interrupt request (TXI) (initial enable (TIE) setting) Enables transmission data empty interrupt request (TXI) 6 Receive interrupt o Disables receive data full interrupt request (RXI) and receive enable (RIE) error interrupt request (ERI) (initial setting) Enables receive data full interrupt request (RXI) and receive error interrupt request (ERI) 5 Transmit enable (TE) 0 Disables transmission operation (initial setting) 1 Enables transmission operation 4 Receive enable (RE) 0 Disables reception operation (initial setting) Enables reception operation 3 Multiprocessor int- O Multiprocessor interrupts disabled (Does ordinary receive errupt enable (MPIE) operation; initial setting). Clear conditions: (1) MPIE bit cleared to zero; (2) When the data MPB = 1 is received. Multiprocessor interrupts enabled. Disables reception inter- rupts until the data multiprocessor bit = 1 is received (RXI), reception error interrupts (ERI) and setting of flags for RDRF, FER and ORER of SSR. 2 Transmit end inter- o Disables transmission interrupt requests (TEl) (Initial setting) rupt enable (TEIE) Enables transmission interrupt requests (TEl) Clock enable 1 o 0 Start-stop synch- Internal clock/SCK pin is input pin (input (CKE1) ronous mode signal ignored) or output pin (output level undetermined) (initial setting) Clock synch-ronous Internal clock/SCK pin is synch-ronous mode clock output (initial setting) o Start-stop synch- Internal clock/SCK pin is clock output ronous mode Clock synch-ronous Internal clock/SCK pin is synchronous mode clock output o Clock enable 0 o Start-stop synch- External clock/SCK pin is clock input (CKEO) ronous mode Clock synch-ronous External clock/SCK pin is synchronous mode clock input Start-stop synch- External clock/SCK pin is clock input ronous mode Clock synch-ronous External clock/SCK pin is synchronous mode clock input HITACHI 519 A.2.4 Transmit Data Register (TDR) SCI • Top Address: H'SFFFEC3 (channel 0), H'SFFFECB (channel I) • Bus Width: 8/16 Register Overview: Bit: 7 6 5 4 3 2 0 Bit name: I I Initial value: 1 1 1 1 1 1 1 1 RIW: RIW RIW RIW RIW RIW RIW RIW RIW Table A.6 TDR Bit Functions Bit Bit name Description 7-0 (Transmit data storage) Store data to be serial transmitted A.2.S Serial Status Register (SSR) SCI • Top Address: H'SFFFEC4 (channel 0), H'SFFFECC (channell) - Bus Width: 8/16 -Register Overview: Bit: 7 6 5 4 3 2 0 Bit name: I TORE RDRF ORER FER PER TEND MPB I MPBT I Initial value: 1 0 0 0 0 1 0 0 RIW: R/(W)* R/(W)* R/(W)* R/(W)* R/(W)* R R RIW Note: Write 0 to clear the flags. 520 HITACHI Table A.7 SSR Bit Functions Bit Bit name Value Description 7 Transmit data 0 Indicates that valid transmission data has been written to TOR register empty Clear Conditions: (1) 0 written after TORE = 1 status is read; (2) Data (TORE) written to TOR by OMAC Indicates that there is no valid transmission data in TOR (Initial setting) Set Conditions: (1) Reset or standby mode; (2) TE bit of SCR is 0; (3) Data transferred to TSR from TOR and data writing to TOR enabled. (Initial setting) 6 Receive data 0 Indicates that there is no valid reception data stored in RDR register full Clear Conditions: (1) Reset or standby mode; (2) 0 written after RDRF (RDRF) =1 status is read; (3) Data read to ROR by DMAC Indicates that valid reception data is stored to RDA. (Initial setting) Set Conditions: Serial reception ends normally and reception data is transferred to RDR from RSR 5 Overrun error 0 Indicates that it is receiving or reception has ended normally (Initial (ORER) setting) Clear Conditions: (1) Reset or standby mode; (2) 0 written after ORER =1 status is read Indicates that an overrun error'occurred in reception Set Conditions: The next serial reception ends while RDRF = 1 4 Framing error 0 Indicates that it is receiving or reception has ended normally (Initial (FER) setting) Clear Conditions: (1) Reset or standby mode; (2) 0 written after FER = 1 status is read Indicates that a framing error occurred in reception Set Conditions: When the stop bit at the very end of the reception data when the SCI finishes receiving has been checked to see if it is 1 or not and the stop bit is 0 3 Parity error 0 Indicates that it is receiving or reception has ended normally (Initial (PER) setting) Clear Conditions: (1) Reset or standby mode; (2) 0 written after PER = 1 status is read Indicates that a parity error occurred in reception Set Conditions: When the number of 1's in the reception data and parity bit together during recept~n is not consistent with the even/odd parity setting specified in the OlE bit of the serial mode register (SMR). HITACHI 521 Table A.ll SSR Bit Functions (cont) Bit Bit name Value Description 2 Transmit end 0 Indicates that it is transmitting (TEND) Clear Conditions: (1) 0 written to the TORE flag after TORE = 1 is read; (2) Data written to TOR by DMAC Indicates that transmission has ended (Initial setting) Set Conditions: (1) Reset or standby mode; (2) TE bit of SCR is 0; (3) when TORE = 1 when the final bit of a 1-byte serial transmission character is transmitted Multiprocessor 0 Displays that the multiprocessor bit = 0 data has been received (initial bit (MPB) setting) Displays that the multiprocessor bit = 1 data has been received o Multiprocessor 0 0 transmitted as the multiprocessor bit (initial setting) bit transfer ---1-tr-a-n-sm-itt-e-d-a-s-th-e-m-ul-tip-r-o-ce-s-s-o-rb-i-t- - - - - - - - - - - (MPBT) A.2.6 Receive Data Register (RDR) SCI • Top Address: H'SFFFECS (channel 0), H'SFFFECD (channel 1) • Bus Width: 8/16 Register Overview: Bit: 7 6 5 4 3 2 0 Bit name: I Initial value: 0 0 0 0 0 0 0 0 RIW: R R R R R R R R Bit Bit name Description 7-0 (Receive serial data storage) Store the serial data received. 522 HITACHI A.2.7 AID Data Register AH-DL (ADDRAH-ADDRL) AID - Top Address: H'SFFFEEO, H'SFFFEEl, H'SFFFEE2, H'SFFFEE3, H'SFFFEE4, H'SFFFEES, H'SFFFEE6, H'SFFFEE7 - Bus Width: 8/16 -Register Overview: Bit: 15 14 13 12 11 10 9 a Bit name: I AD9 ADa AD7 AD6 AD5 AD4 AD3 AD2 Initial value: 0 0 0 0 0 0 0 0 R/W: R R R R R R R R Bit: 7 6 5 4 3 2 0 Bit name: I AD1 ADO Initial value: 0 0 0 0 0 0 0 0 R/W: R R R R R R R R TableA.8 ADDRAH-ADDRL Bit Functions Bit Bit name Description 15-8 AID data 9-2 Stores top a bits of AID conversion results 7,6 AID data 1,0 Stores top 2 bits of AID conversion results A.2.8 AID Control/Status Register (ADCSR) AID - Top Address: H'SFFFEF8 - Bus Width: 8/16 Register Overview: Bit: 7 6 5 4 3 2 0 Bit name: I ADF ADIE ADST SCAN CKS CH2 CH1 CHO Initial value: 0 0 0 0 0 1 0 0 R/W: R/(W)* R/W RIW R/W R/W R/W R/W RIW Note: Write 0 to clear the flags. HITACHI 523 Table A.9 ADCSR Bit Functions Bit Bit name Value Description 7 AID end flag (ADF) a Clear conditions: (1) a written to ADF after ADF is read while ADF = 1; (2) DAMC started up by ADI interrupt and AID converter register is accessed (Initial setting) Set Conditions: (1) Single mode: AID conversion ends; (2) Scan mode: AID conversion of all channels set has ended. 6 AID interrupt enable a Disable interrupt requested by AID conversion (ADI) (initial (AD F) setting) Enable interrupt requested by AID conversion (ADI) 5 AID start (ADST) a Disable AID conversion (initial setting) (1) Single mode: Start AID conversion and when conversion ends, automatically cleared to zero; (2) Scan mode: Start AID conversion and sequentially continue converting the selected channels until zeroed out by software, reset or standby mode. 4 Scan mode (SCAN) a Single mode (initial setting) --------~------------------------------------ 1 Scan mode 3 Clock select (CKS) a Conversion time =236 cycles 0 (initial setting) ---------------------------------------------- Conversion time = 134 cycles 0 2-0 Channel select 2-0 CH2 CH1 CHa Single mode Scan mode a a a ANa (initial) ANa (initial) AN1 ANa, AN1 a AN2 ANo-AN2 AN3 ANo-AN3 a a a AN4 AN4 AN5 AN4, AN5 a AN6 AN4-AN6 AN7 AN4-AN7 Note: a or 1 524 HITACHI A.2.9 AID Control Register (ADCR) AID - Top Address: H'SFFFEE9 - Bus Width: 8/16 Register Overview: Bit: 7 6 5 4 3 2 o Bit name: I TRGE I Initial value: 0 RIW: RIW Table A.tO ADCR Bit Functions Bit Bit name Value Description 7 Trigger enable bit (TRGE) 0 Disable start of AID conversion by extemal trigger (initial setting) Enable start of AID conversion by rise edge of extemal conversion trigger input pin (ADTRG) A.2.tO Timer Start Register (TSTR) ITU - Top Address: H'SFFFFOO - Bus Width: 8 -Register Overview: Bit: 7 6 5 4 3 2 0 Bit name: I STR4 STR3 STR2 STR1 STRO Initial value: 0 0 0 0 0 RIW: RIW RIW RIW RIW RIW HITACHI 525 Table A.ll TSTR Bit Functions Bit Bit name Value Description 4 Counter start 4 (STR4) 0 Count operation of TCNT4 stops (initial setting) TCNT 4 counts 3 Counter start 3 (STR3) 0 Count operation of TCNT 3 stops (initial setting) TCNT3 counts 2 Counter start 2 (STR2) 0 Count operation of TCNT 2 stops (initial setting) TCNT2 counts Counter start 1 (STR 1) 0 Count operation of TCNT 1 stops (initial setting) TCNT1 counts 0 Counter start 0 (STRO) 0 Count operation of TCNT 0 stops (initial setting) TCNTO counts A.2.11 Timer Synchronization Register (TSNC) ITU - Top Address: H'5FFFFOl - Bus Width: 8 -Register Overview: Bit: 7 6 5 4 3 2 1 0 Bit name: II I SYNC41 SYNC31 SYNC21 SYNC1 I SYNCO I Initial value: o 0 0 0 0 R/W: RIW R/W R/W RIW R/W Note: Not determined. 526 HITACHI Table A.12 TSNC Bit Functions Bit Bit name Value Description 4 Timer sync 4 (SYNC4) 0 Independent operation of channel 4 timer counter (TCNT4) (initial setting) (preseVclear of TCNT4 is unrelated to other channels) Channel 4 operation is synchronous. TCNT4 sync preseVsync clear enabled. 3 Timer sync 3 (SYNC3) 0 Independent operation of channel 3 timer counter (TCNT3) (initial setting) (preseVclear of TCNT3 is unrelated to other channels) Channel operation is synchronous. TCNT3 sync preseVsync clear enabled. 2 Timer sync 2 (SYNC2) 0 Independent operation of channel 2 timer counter (TCNT2) (initial setting) (preseVclear of TCNT2 is unrelated to other channels) Channel operation is synchronous. TCNT2 sync preseVsync clear enabled. Timer sync 1 (SYNC1) 0 Independent operation of channel 1 timer counter (TCNT1) (initial setting) (preseVclear of TCNT1 is unrelated to other channels) Channel operation is synchronous. TCNT1 sync preseVsync clear enabled. 0 Timer sync 0 (SYNCO) 0 Independent operation of channel 0 timer counter (TCNTO) (initial setting) (preseVclear of TCNTO is unrelated to other channels) Channel operation is synchronous. TCNTO sync preseVsync clear enabled. HITACHI 527 A.l.ll Timer Mode Register (TMDR) lTU - Top Address: H'5FFFF02 - Btis Width: 8 -Register Overview: Bit: 7 6 5 4 3 2 1 0 Bit nam~: I MOF FOIA I PWM4 I PWM3 I PWM2 I PWM1 I PWMO I Initial value: * 0 0 0 0 0 0 0 R1W: RJW RIW RIW RIW RIW AIW RIW Note: Initial value not determined. table A.13 TMDR Bit Functions Sit Bit name Value Description a Phase count mode (MOF) 0 Channel 2 operates normally (initial setting) Channel 2 in phase count mode 5 Flag direction (FOIA) 0 OVF of TSA2 set to 1 when TCNT2 overflows or underflows (initial setting) 1 OVF of TSA2 set to 1 when TCNT2 overflows 4- PWM mode 4 (PWM4) 0 Channel 4 operates normally (initial setting) Channel 4 in PWM mode 3 PWM mode 3 (PWM3) 0 Channel 3 operates normally (initial setting) Channel 3 in PWM mode 2 PWM mode 2 (PWM2) 0 Channel 2 operates normally (initial setting) 1 Channel 2 in PWM mode PWM mode 1 (PWM 1) 0 Channel 1 operates normally (initial setting) 1 Channel 1 in PWM mode 0 PWM mode 0 (PWMO) 0 Channel 0 operates normally (initial setting) Channel 0 in PWM mode 428 HITACHI A.2.13 Timer Function Control Register (TFCR) lTV - Top Address: H'5FFFF03 - Bus Width: 8 -Register Overview: Bit: 7 6 5 4 3 2 0 Bit name: I CMD1 CMDO BFB4 BFA4 BFB3 BFA3 Initial value: * 0 0 0 0 0 0 RIW: RIW RIW RIW RIW RIW RIW Note: Not determined Table A.14 TFCR Bit Functions Bit Bltname Value Description 5,4 Combination modes 1, 0 (CMD1, 0 0 Channel 3 and 4 always operate (initial setting) CMDO) o 1 Channel 3 and 4 always operate o Channels 3 and 4 are combined to operate in complementary PWM mode Channels 3 and 4 are combined to operate in reset synchronization PWM mode 3 Buffer mode B4 (BFB4) 0 GRB4 always operates (initial setting) 1 GRB4 and BRB4 operate as buffers 2 Buffer mode A4 (BFA4) 0 GRA4 always operates (initial setting) GRA4 and BRA4 operate as buffers Buffer mode B3 (BFB3) 0 GRB3 always operates (initial setting) 1 GRB3 and BRB3 operate as buffers 0 Buffer mode A3(BFA3) 0 GRA3 always operates (initial setting) GRA3 and BRA3 operate as buffers HITACHI 529 A.2.14 Timer Control Registers 0-4 (TCRO-TCR4) lTU - Top Address: H'5FFFF04 (channel 0), H'5FFFFOE (channel 1), H'5FFFFlS (channel 2), H'5FFFF22 (channel 3), H'5FFFF32 (channel 4) - Bus Width: S -Register Overview: Bit: 7 6 5 4 3 2 1 0 Bit name: ;-,--,'--C-C-l-A1---'-,C-C-l-AO--"r--C-K-EG-1-','--C-K-EG-0-..-,T-P-S-C2--"r--T-P-SC-1-','--T-P-S-CO--', Initial value: * o o o o o o o R1W: AIW RIW RIW RIW RIW RIW RIW Note: Not determined Table A.IS TCRO-TCR4 Bit Functions Bit Bit name Value Description 6,5 Counter clear 1, 0 (CClA1, 0 0 Disable TCNT clear (initial setting) CClAO) 0 Clear TCNT upon GAA compare match/input capture 0 Clear TCNT upon GAB compare match/input capture Synchronization clear. Clear TCNT synchronous to the counter clear of other timer operating in sync. 4,3 Clock edge 1, 0 (CKEG1, 0 0 Count upon rise edge (initial setting) CKEGO) 0 Count upon fall edge 2-0 Timer prescalar 2-0 0 -0 Count on both rise and fall edges. 0 Internal clock: Count upon (initial setting) channel 3 > (PR1,PRO) channel 2 > channel 1) 0 Priority order is fixed (Channel 1 > channel 3 > channel 2 > channel 0) 0 Round-robin priority order (Immediately after reset: Channel 0 > channel 3 > channel 2 > channel 1) External-pin-alterriating mode priority order (Immediately after reset: Channel 1 > channel 3 > channel 2 > channel 0) 2 Address error flag bit 0 No errors caused by DMAC (initial setting) (AE) Clear Conditions: Write 0 after reading the AE bit Address error caused by DMAC NMI flag bit (NMF) 0 No NMI interrupt (initial setting) Clear Conditions: Write 0 after reading the NMIF bit NMI interrupt generated 0 DMA master enable 0 DisableDMA transfers for all channels (initial setting) bit (DME) Enable DMA transfers for all channels 546 HITACHI A.2.29 Interrupt Priority Setting Register A (IPRA) INTC • Top Address: H'5FFFF84 • Bus Width: 8116/32 Register Overview: Bit: 15 14 13 12 11 10 9 8 Bit name: I Initial value: 0 0 0 0 0 0 0 0 R/W: R/W R/W R/W R/W R/W R/W R/W RIW Bit: 7 6 5 4 3 2 0 Bit name: I Initial value: 0 0 0 0 0 0 0 0 R/W: R/W R/W RIW R/W R/W R/W R/W RIW Table A.30 IPRA Bit Functions Bit Bit name Description 15-12 (Set IROO priority level) Sets the IROO priority level value. 11-8 (Set IR01 priority level) Sets the IR01 priority level value. 7-4 (Set IR02 priority level) Sets the IR02 priority level value. 3-0 (Set IR03 priority level) Sets the IR03 priority level value. HITACHI 547 A.2.30 Interrupt Priority Setting Register B (lPRB) INTC • Top Address: H'5FFFF86 • Bus Width: 8/16/32 Register Overview: Bit: 15 14 13 12 11 10 9 8 Bit name: I Initial value: 0 0 0 0 a 0 0 a R/W: R/W RIW R/W R/W R/W R/W RIW R/W Bit: 7 6 5 4 3 2 a Bit name: I Initial value: a a a a a 0 a a R/W: R/W RIW R/W R/W R/W R/W RIW R/W Table A.31 IPRB Bit Functions Bit Bit name Description 15-12 (Set IR04 priority level) Sets the IR04 priority level value. 11-8 (Set IR05 priority level) Sets the IR05 priority level value. 7-4 (Set IR06 priority level) Sets the IR06 priority level value. 3-0 (Set IR07 priority level) Sets the IR07 priority level value. 548 HITACHI A.2.31 Interrupt Priority Setting Register C (IPRC) INTC • Top Address: H'SFFFF88 • Bus Width: 8/16/32 Register Overview: Bit: 15 14 13 12 11 10 9 8 Bit name: I Initial value: 0 0 0 0 0 0 0 0 RIW: RIW RIW RIW RIW RIW RIW RIW RIW Bit: 7 6 5 4 3 2 0 Bit name: I Initial value: 0 0 0 0 0 0 0 0 F1!W: RIW RIW RIW RIW RIW RIW RIW RIW Table A.32 IPRC Bit Functions Bit Bit name Description 15-12 (Set DMACO and DMAC 1 priority Sets the DMACO and DMAC 1 priority level values. levels) 11--8 (Set DMAC2 and DMAC3 priority Sets the DMAC2 and DMAC3 priority level values. levels) 7-4 (Set ITUO priority level) Sets the ITUO priority level value. 3-0 (Set ITU1 priority level) Sets the ITU 1 priority level value. HITACHI 549 A.2.32 Interrupt Priority Setting Register D (IPRD) INTC • Top Address: H'5FFFF8A • Bus Width: 8/16/32 Register Overview: Bit: 15 14 13 12 11 1a 9 8 Bit name: I Initial value: a a a a a a a a RIW: RIW AIW RIW RIW RIW RIW AIW RIW Bit: 7 6 5 4 3 2 a Bit name: I Initial value: a a a a a a a a RIW: RIW AIW RIW RIW RIW RIW RIW RIW Table A.33 IPRD Bit Functions Bit Bit name Description 15-12 (Set ITU2 priority level) Sets the ITU2 priority level value. 11-8 (Set ITU3 priority level) Sets the ITU3 priority level value. 7-4 (Set ITU4 priority level) Sets the ITU4 priority level value. 3-0 (Set SCI a priority level) Sets the SCI a priority level value. 550 HITACHI A.2.33 Interrupt Priority Setting Register E (IPRE) INTC • Top Address: H'5FFFF8C • Bus Width: 8116/32 Register Overview: Bit: 15 14 13 12 11 10 9 8 Bit name: I Initial value: 0 0 0 0 0 0 0 0 RIW: RIW RIW RIW RIW RIW RIW RIW RIW Bit: 7 6 5 4 3 2 0 Bit name: I Initial value: 0 0 0 0 0 0 0 0 RIW: RIW RIW RIW RIW TableA.34 IPRE Bit Functions BH Bit name Description 15-12 (Set SCI1 priority level) Sets the SC1 priority level value. 11-8 (Set PRr 1 and AID priority levels) Sets the PRT*1 and AID priority level values. 7-4 (Set WDT and REp2 priority Sets the WDT and REF*2 priority level value. levels) Notes 1. PRT: Parity control section within the bus state controller. See section 8, Bus State Controller, for more information. 2. REF: DRAM refresh control section within bus state controller. See section 8, Bus State Controller, for more information. HITACHI 551 ~-~~-~---~ ~~~- A.2.34 Interrupt Control Register (ICR) INTC • Top Address: H'SFFFF8E • Bus Width: 8/16/32 Register Overview: Bit: 15 14 13 12 11 10 9 8 Bit name: I NMIE Initial value: 0 0 0 0 0 o 0 ·RIW: R RIW Bit: 7 6 5 4 3 2 1 0 Bit name: I IROOS IIR01S IIR02S IIR03S I IR04S IIR05S IIR06S IIR07S I Initial value: 0 0 0 0 0 0 0 0 RIW: RIW RNI RIW RIW RIW RIW RNI RIW Note: Note determined Table A.35 ICR Bit Functions Bit Bit Name Value Description 15 NMI input level (NMIL) o Low is input to NMI pin High is input to NMI pin 8 NMI edge select (NMIE) o Interrupt request sensed at the fall edge of the NMI input (initial setting) Interrupt request sensed at the rise edge of the NMI input 7-0 IROQ-7 sense select (lROQ- o Interrupt request sensed at i'ROinput low IR07) (initial setting) Interrupt request sensed at IRO input high (initial setting) 552 HITACHI A.2.35 Break Address Register H (BARH) UBC • Top Address: H'SFFFF90 • Bus Width: 8/16/32 Register Overview: Bit: 15 14 13 12 11 10 9 8 Bit name: I BA31 BA30 BA29 BA28 BA27 BA26 BA25 BA24 Initial value: 0 0 0 0 0 0 0 0 RIW: RIW RIW RIW RIW RIW RIW RIW RIW Bit: 7 6 5 4 3 2 0 Bit name: I BA23 BA22 BA21 BA20 BA19 BA18 BA17 . BA16 Initial value: 0 0 0 0 0 0 0 0 RIW: RIW RIW RIW RIW RIW R/W RIW RIW Table A.36 BARH Bit Functions Bit Bit name Description 15-{) Set break addresses 31-16 Specifies the top end of the address, which is the (BA31-BA16) break condition (bits 31-16) HITACHI 553 A.l.36 Break Address Register L (BARL) UBC • Top Address: H'SFFFF92 • Bus Width: 8/16/32 Register Overview: Bit: 15 14 13 12 11 10 9 S Bit name: I BA15 BA14 BA13 BA12 BA11 BA10 BA9 BAS Initial value: 0 0 0 0 0 0 0 0 R/W: R/W RIW R/W R/W R/W RIW RIW R/W Bit: 7 6 5 4 3 2 1 0 Bit name: I . BA7 BA6 BA5 BA4 BA3 BA2 BA1 BAO Initial value: 0 0 0 0 0 0 0 0 R/W: R/W RIW R/W R/W R/W R/W RIW R/W Table A.37 BARL Bit Functions Bit Bit name Description 15-0 Set break addresses 15-0 Specifies the bottom end of the address, which is the (BA15-BAO) break condition (bits 15-0) 554 HITACHI A.2.37 Break Address Mask Register H (BAMRH) UBC • Top Address: H'SFFFF94 • Bus Width: 8/16/32 Register Overview: Bit: 15 14 13 12 11 10 9 8 Bit name: BAM31I I BAM30 I BAM29 I BAM28 I BAM27 I BAM26 I BAM25 I BAM24 I Initial value: 0 o o o o o o o R/W: R/W R/W ANI R/W R/W R/W R/W ANI Bit: 7 6 5 4 3 2 1 0. Bit name: BAM23I I BAM22 IBAM21 I BAM20 I BAM19 I BAM18 I BAM 17 I BAM16 I Initial value: 0 0 0 0 0 0 0 0 R/W: R/W RIW ANI RIW RIW RIW RIW ANI Table A.38 BAMRH Bit Functions Bit Bit name Description 1~ Break address masks 31-16 Specifies the bit to mask the break address specified (BAM31-8AM16) in BAAH HITACHI 555 A.2.38 Break Address Mask Register L (BAMRL) UBC • Top Address:H'5FFFF96 • Bus Width: 8116/32 Register Overview: Bit: 15 14 13 12 11 10 9 8 Bit name: BAM15I I BAM14 I BAM13 I BAM12 I BAM11 I BAM!OTBAM9 BAM8 Initial value: 0 0 0 0 0 0 0 a RIW: RIW RIW RIW RIW RIW RIW RIW RIW Bit: 7 6 5 4 3 2 0 Bit name: I BAM7 BAM6 BAM5 BAM4 BAM3 BAM2 BAM1 BAMO Initial value: 0 0 0 0 a 0 0 0 RIW: RIW RIW RIW RIW RIW RIW RIW RIW Table A.39 BAMRL Bit Functions Bit Bit name Description 1~ Break address masks 15-0 Specifies the bit to mask the break address specified (BAM 15-BAMO) in BARL 556 HITACHI A.2.39 Break Bus Cycle Register (BBR) UBC • Top Address: H'5FFFF98 • Bus Width: 8/16/32 Register Overview: Bit: 15 14 13 12 11 10 9 8 Bit name: I Initial value: 0 0 0 0 0 0 0 0 RIW: Bit: 7 6 5 4 3 2 0 Bit name: I C01 COO 101 100 RW1 RWO SZ1 SZO Initial value: 0 0 0 0 0 0 0 0 RIW: RIW RIW RIW RIW RIW RIW RIW RIW HITACHI 557 Table A.40 BBR Bit Functions Bit Bit name Value Description 7,6 CPU cycle/OMA cycle 0 0 User break interrupt not generated (initial setting) select (C01, COO) The CPU cycle is the break condition. 0 0 The OMA cycle is the break condition. The CPU cycle and OMA cycle are both break conditions. 5,4 Instruction fetch/data 0 0 User break interrupt not generated (initial setting) access select (101, 0 The instruction fetch cycle is the break condition. 100) 0 The data access cycle is the break condition. The instruction fetch cycle and data access cycle are both break conditions. 3,2 Read/write select 0 0 User break interrupt not generated (initial setting) (RW1, RWO) 1 The read cycle is the break condition. 0 0 The write cycle is the break condition. The read cycle and write cycle are both break conditions. 1,0 Operand size select 0 0 Operand size not included in the break conditions (initial (SZ1, SZO) setting) 0 Byte access is the break condition. 0 Word access is the break condition. Long word access is the break condition. 558 HITACHI A.2.40 Bus Control Register (BCR) BSC • Top Address: H'SFFFFAO • Bus Width: 8/16/32 Register Overview: Bit: 15 14 13 12 11 10 9 8 Bit name: L-ID_R_A_M_E-'-I_I_O_E---'-I_W_A_R_P---'I_R_D_D_TY----'-I_B_A_S---'-_ _-'-_ _-'--_---' Initial value: 0 0 0 0 o o o RIW: RIW RIW RIW RIW RIW Bit: 7 6 5 4 3 2 o Bitname:~1----~------~----.------.------.-----.------.-----. Initial value: o o o o o o o o RIW: Table A.41 BCR Bit Functions 81t Bit Name Value Description 15 DRAM enable (DRAME) o Area 1 is external memory space (initial setting) Area 1 is DRAM space 14 Multiplex I/O enable (IOE) o Area 6 is external memory space (initial setting) Area 6 is address/data multiplex I/O space 13 Warp mode (WARP) o Normal mode: External access and internal access not conducted simultaneously (initial setting) Warp mode: External access and internal access conducted simultaneously 12 RD duty (RDDTY) o RD signal high width duty ratio is 50"10 (initial setting) RD signal high width duty ratio is 35"10 11 Byte access select (BAS) o WRH, WRL and AO signals valid (initial setting) WR, HBS and LBS and signals valid HITACHI 559 A.2.4t Wait State Control Register t (WCRt) BSe • Top Address: H'5FFFFA2 • Bus Width: 8116/32 Register Overview: Bit: 15 14 13 12 11 10 9 8 Bit name: I RW7 RW6 RW5 RW4 RW3 RW2 RW1 RWO Initial value: 1 1 1 1 1 RIW: RIW RIW RIW RIW RIW RIW RIW Bit: 7 6 5 4 3 2 0 Bit name: I WW1 Initial value: RIW: RIW* Note: Only write 0 to the WW1 bit when area 1 is DRAM space. When it is external memory space, do not write O. Table A.42 WCR Bit Functions Number of read cycles WAIT External space Internal space pin External Multi- On-chip On-chip Signal memory DRAM plex peri- ROM, Bit Bit Name Value input space space I/O pherals RAM 15-8 During reads, 0 Do not • Areas 1, 3-5, 7: Column Wait Fixed at Fixed at 1 wait state sample fixed at 1 cycle address state 3 cycles cycle control (AW7- during cycle: Fixed is4 • Areas 0, 2, 6: 1 AWO) read cycle + long wait at 1 cycle cycles cycle state (short pitch) plus WAIT Sample • Areas 1, 3-5, 7: Column during wait state is 2 cycle address read plus WAIT cycle: Wait cycle state is 2 • Areas 0, 2, 6: 1 (initial cycle + long wait cycles plus setting) state or wait state WAIT (long from 'WAIT pitch)* 560 HITACHI Table A.42 Bit Functions (cont) Description External memory space of area 1 Bit Bit Name Value DRAM space (BCRDRAME =1) (BCRDRAME =1) During writes, 0 Column address cycle: 1 cycle Setting disabled wait state (short pitch) control (WW1) 1 Column address cycle: Wait state Wait state is 2 cycles + WAIT is 2 cycles + WAIT (long pitch) (initial setting) Note: During a CBR refresh, the WAIT signal is ignored and the wait state inserted using the RLW1 and RLWO bits. A.2.42 Wait State Control Register 2 (WCR2) BSC • Top Address: H'SFFFFA4 • Bus Width: 8116/32 Register Overview: Bit: 15 14 13 12 11 10 9 8 Bit name: I DRW71 DRW6 I DRW51 DRW4 DRW3 ! DRW2! DRW1 I DRWO I Initial value: 1 1 1 RIW: RIW RIW RIW RIW RIW RIW RIW RIW Bit: 7 6 5 4 3 2 1 0 Bit name: I DWW7 I DWW61 DWW51 DWW41 DWW31 DWW21 DWW1 I DWWO I Initial value: 1 1 1 1 1 1 1 1 RIW: RIW RIW RIW RIW RIW RIW RIW RIW HITACHI 561 Table A.43 WCR2 Bit Functions Description Number of Single Mode DMA External Space Cycle States WAIT Pin External Memory Bit Bit Name Value Signal Input Space DRAM Space Multiplex va 15-8 Wait state control 0 Do not sample· Areas 1, 3-5, 7: Column Wait state is 4 during a single during single fixed at 1 cycle address cycle: cycles plus mode DMA mode DMA • Areas 0, 2, 6: 1 Fixed at 1 WAIT memory reads memory read cycle + long wait cycle (short (DRW7 -DRWO) cycle state pitch) Sample during • Areas 1, 3-5, 7: Column single mode wait state is 2 cycle address cycle: DMA memory plus WAIT Wait state is 2 read cycle • Areas 0 2 6· 1 cycles plus (initial setting) cycle + lo'ng' w~it ~AIT (long state, or wait state pitch) from WAIT 7-0 Wait state control 0 Do not sample • Areas 1, 3-5, 7: Column Wait state is 4 during a single during single fixed at 1 cycle address cycle: cycles plus mode DMA mode DMA. • Areas 0, 2, 6: 1 Fixed at 1 WAIT memory writes memory write cycle + long wait cycle (short (DWW7 -DWWO) cycle state pitch) Sample during • Areas 1, 3-5, 7: Column single mode wait state is 2 cycle address cycle: DMA memory plus WAIT Wait state is 2 write cycle • Areas 0 2 6: 1 cycles plus (initial setting) cycle + Idng' wait ~AIT (long state, or wait state pitch) from WAIT 562 HITACHI A.2.43 Wait State Control Register 3 (WCR3) BSC • Top Address: H'5FFFFA6 • Bus Width: 8116/32 Register Overview: Bit: 15 14 13 12 11 10 9 8 Bit name: I WPU IA02LW11A02LWO I A6LW1 I A6LWO I Initial value: 1 1 1 1 1 0 0 0 R/W: R/W R/W R/W R/W R/W Bit: 7 6 5 4 3 2 0 Bit name: I Initial value: 0 0 0 0 0 0 0 0 R/W: Table A.44 WCR3 Bit Functions Bit Bit Name Value Description 15 Wait pin pull-up control o Do not pull up WAIT pin WPU) 1 Pull up WAIT pin (initial setting) 14,13 Areas 0 and 2 long wait o 0 Insert a 1-cycle long wait state insert 1, 0 (A02LW1, A02LWO) o Insert a 2-cycle long wait state o Insert a 3-cycle long wait state 1 1 Insert a 4-cycle long wait state (initial setting) 12,11 Area 6 long wait insert 1, 0 0 0 Insert a 1-cycle long wait state (A6LW1, A6LWO) o 1 Insert a 2-cycle long wait state o Insert a 3-cycle long wait state Insert a 4-cycle long wait state (initial setting) HITACHI 563 A.2.44 DRAM Area Control Register (OCR) BSC • Top Address: H'SFFFFA8 • Bus Width: 8/16/32 Register Overview: Bit: 15 14 13 12 11 10 9 8 Bit name: I CW2 RASD TPC BE CDTY MXE MXC1 MXCO Initial value: 0 0 0 0 0 0 0 0 RIW: RIW RIW RIW RIW RIW RIW RIW RIW Bit: 7 6 5 4 3 2 0 Bit name: I Initial value: 0 0 0 0 0 0 0 0 RIW: 564 HITACHI Table A.4S DCR Bit Functions Bit Bit Name Value Description 15 2 CAS system/2 WE system 0 2 CAS system: CASH, CASL, and WRL signals are (CW2) valid (initial setting) 2 WE system: CASL, WRH, and WRL signals are valid 14 RAS down (RASD) o RAS up mode: Returns RAS signal to high and waits for next DRAM access (initial setting) RAS down mode: Leaves RAS signal at low and waits for next DRAM access 13 Number of RAS pre-charge 0 Insert a 1-cycle pre-charge cycle (initial setting) cycles (TPC) Insert a 2-cycle pre-charge cycle 12 Burst operation enable (BE) 0 Normal mode: Full access High-speed page mode: Burst operation 11 CAS duty (CDTY) 0 CAS signal high width duty ratio is 50"10 (initial setting) CAS signal high width duty ratio is 35"10 10 Multiplex enable (MXE) 0 Do not multiplex low address and column address (initial setting) Multiplex low address and column address 9,8 Multiplex shift count 1,0 Low address shift Low address for comparison (MXC1, MXCO) (MXE = 1) during burst (MXE = 0 or 1) 0 0 8 bits (initial setting) A27-A8 (initial setting) 0 1 9 bits A27-A9 0 10 bits A27-A10 Reserved Reserved HITACHI 565 A.2.45 Parity Control Register (PCR) BSC • Top Address: H'5FFFFAA • Bus Width: 8/16/32 Register Overview: Bit: 15 14 13 12 11 10 9 8 Bit name: I PEF PFRC PEa I PCHK1 I PCHKO I Initial value: 0 0 0 o o o o o R/W: R/W RMI R/W R/W R/W Bit: 7 6 5 4 3 2 o Bit name: I Initial value: 0 0 0 o o o o o R/W: Table A.46 PCR Bit Functions Bit Bit Name Value Description 15 Parity error flag (PEF) o No parity error (initial setting) Clear Conditions: PEF read and then 0 written Parity error occurred 14 Parity force output (PFRC) 0 No forced parity output (initial setting) Forced high-level output 13 Parity polarity (PEa) 0 Even parity (initial setting) Odd parity 12,11 Parity check enable 1, 0 0 0 Parity not checked or generated (initial setting) (PCHK1, PCHKO) Parity checked and generated in DRAM space 0 0 Parity checked and generated in DRAM space and area 2 Reserved 566 HITACHI A.l.46 Refresh Control Register (RCR) BSC • Top Address: H'SFFFFAC • Bus Width: 8116/32 (read), 16 (write) 'Register Overview: Bit: 15 14 13 12 11 10 9 8 Bit name: I.-----.----.----r----.----.-----,.-----~-__, Initial value: o o o o o o o o R/W: Bit: 7 6 5 4 3 2 0 Bit name: I RFSHE IRMODE I RLW1 RLWO Initial value: 0 0 0 0 0 0 0 0 R/W: R/W R/W R/W R/W Table A.47 RCR Bit Functions Bit Bit Name Value Description 7 Refresh control (RFSHE) 0 No refresh control (initial setting) (RTCNT can be used as an interval timer) 1 Refresh control 6 Refresh mode (RMODE) 0 Do a CAS-before-RAS refresh (initial setting) Do a self-refresh 5,4 Insert wait state during CBR 0 0 Insert a 1-cycle wait state (initial setting) refresh 1,0 (RLW1, RLWO) 0 Insert a 2-cycle wait state o Insert a 3-cycle wait state Insert a 4-cycle wait state HITACHI 567 A.2.47 Refresh Timer Control/Status Register (RSTCR) BSC • Top Address: H'5FFFFAE • Bus Width: 8116/32 (read), 16 (write) Register Overview: Bit: 15 14 13 12 11 10 9 8 Bit name: I Initial value: 0 0 0 0 o o o o RIW: Bit: 7 6 5 4 3 2 0 Bit name: I CMF CMIE CKS2 CKS1 CKSO Initial value: 0 0 0 0 0 0 0 0 RIW: RIW RIW RIW RIW RIW Table A.48 RSTCR Bit Functions Bit Bit Name Value Description 7 Compare match flag (CMF) 0 RTCNT and RTCOR values do not match (initial setting) Clear Conditions: CMF read and then 0 written RTCNT and RTCOR values match 6 Compare match interrupt o Disable compare match interrupt (CMI) (initial setting) enable (CMIE) Enable compare match interrupt (CMI) 5-3 Clock select 2-0 (CKS2- o 0 o Clock input disabled (initial setting) CKSO) o 0 cp/2 o o cp/8 o 1 cp/32 1 0 0 11>/128 o 11>/512 o cp/2048 11>/4096 568 HITACHI A.2.48 Refresh Timer Counter Register (RTCNT) BSC • Top Address: H'SFFFFBO • Bus Width: 8116/32 (read), 16 (write) Register Overview: Bit: 15 14 13 12 11 10 9 8 Bit name: I Initial value: 0 0 0 0 0 0 0 0 RIW: Bit: 7 6 5 4 3 2 0 Bit name: I I Initial value: 0 0 0 0 0 0 0 0 RIW: RIW RIW RIW RIW RIW RIW RIW Table A.49 RTCNT Bit Functions Bit Bit Name Description 7-0 (Count value) Input clock count value HITACHI 569 A.2.49 Refresh Timer Constant Register (RTCOR) BSC • Top Address: H'SFFFFB2 • Bus Width: 8/16/32 (read), 16 (write) Register Overview: Bit: 15 14 13 12 11 10 9 8 Bit name: 1 Initial value: 0 0 0 0 0 0 0 0 RIW: Bit: 7 6 5 4 3 2 0 Bit name: 1 Initial value: 0 1 1 1 1 1 1 1 RIW: RfW RIW RIW RIW RIW RfW RIW Table A.50 RTCOR Bit Functions Bit Bit Name Description 7-0 (Compare match cycle) Set compare match cycle A.2.50 Timer Control/Status Register (TCSR) WDT • Top Address: H'SFFFFB8 • Bus Width: 8 (read), 16 (write) Register Overview: Bit: 7 6 5 4 3 2 1 0 Bit name: _O_V_F--''--WT_/IT--'_T_M_E--1._----:--1._ _--1._C_K_S_2--'-_C_K_S_1--'-_C_K_S_O--' 1-1 Initial value: 0 0 0 0 0 0 RIW: R/(W)* RIW RIW RIW RfW RIW Note: Write 0 to clear the flag. 570 HITACHI Table A.Sl TCSR Bit Functions Bit Bit Name Value Description 7 Overflow flag (OVF) 0 No TCNT overflow in interval timer mode (initial setting) Clear Conditions: OVF is read and then 0 is written TCNT overflow generated in interval timer mode 6 Timer mode select (WTlln 0 Interval timer mode: When TCNT overflows, interval timer interrupt (ITI) requested of CPU (initial setting) Watchdog timer mode: When TCNT overflows, WDTOVF signal output externally.* 5 Timer enable (TME) 0 Timer disable: TCNT initialized at H'OO and count-up halted (initial setting) Timer enable: TCNT starts count up. When TCNT overflows,·a WDTOVF signal or interrupt· is generated. 2-0 Clock select 2-0 Clock Overflow cycle (~=20 MHz) (CKS2-GKSO) 0 0 0 ,/2 (initial setting) 25.611S 0 0 ~/64 . 819.211S 0 0 ,/128 1.6ms 0 ,/256 3.3ms 0 0 0 ~/512 6.6ms 0 0 ,/1024 13.1 ms 0 0 ~/4096 52.4 ms 0 ,/8192 104.9 ms * When the RSTE bit of RSTCSR is 1, an internal reset signal is also generated simultaneous with the WDTOVF signal when· the TCNT overflows in watchdog timer mode. HITACHI 571 A.2.St Timer Counter (TCNT) WDT • Top Address: H'5FFFFB9 (read), H'5FFFFBS (write) • Bus Width: S (read), 16 (write) Register Overview: Bit: 7 6 5 4 3 2 0 Bit name: I Initial value: 0 0 0 0 0 0 0 0 R/W: R/W R/W R/W R/W R/W R/W RIW R/W Table A.52 TCNT Bit Functions Bit Bit Name Description 7-0 Count value Input clock count value A.2.S2 Reset Control/Status Register (RSTCSR) WDT • Top Address: H'5FFFFBB (read), H'5FFFFBA (write) • Bus Width: 8 (read), 16 (write) Register Overview: Bit: 7 6 5 4 3 2 o Bit name: I WOVF I RSTE RSTS Initial value: 0 0 0 R/W: R/(W)* R/W R/W Note: Write 0 to clear the flag. 572 HITACHI Table A.53 RSTCSR Bit Functions Bit Bit Name Value Description 7 Watchdog timer overflow flag 0 No TCNT overflow in watchdog timer mode (initial (WOVF) setting) Clear Conditions: WOVF is read and then 0 is written TCNT overflow generated in watchdog timer mode 6 Reset enable (RSTE) 0 When TCNT overflows. no intemal reset* (initial setting) When TCNT overflows. internal reset 5 Reset select (RSTS) 0 Power-on reset (initial setting) Manual reset Note: The microprocessor within this LSI is not reset. but the TCNT and TCSR within the WDT are. A.2.53 Standby Control Register (SBYCR) Power-Down State • Top Address: H'5FFFFBC • Bus Width: 8/16/32 Register Overview: Bit: 7 6 5 4 3 2 o Bit name: I SBY HIZ Initial value: 0 0 0 RIW: RIW RIW Table A.54 SBYCR Bit Functions Bit Bit Name Value Description 7 Standby (SBY) 0 Shift to sleep mode upon execution of SLEEP instruction (initial setting) Shift to standby mode upon execution of SLEEP instruction 6 Port high impedance (HIZ) 0 Maintains pin state while in standby mode (initial setting) Change pins to high impedance while in standby mode HITACHI 573 A.2.54 Port A Data Register (PADR) PortA • Top Address: H'SFFFFCO • Bus Width: 8116/32 Register Overview: Bit: 15 14 13 12 11 10 9 8 Bit name: !PA15DRlpA14DRlpA13DRlpA12DRlpA11DRlpA10DRI PA9DR I PA8DR I Initial value: 0 0 0 0 0 0 0 0 R!W: R!W RIW R!W R!W R!W R!W RIW R!W Bit: 7 6 5 4 3 2 1 0 Bit name: I PA7DR I PA6DR I PA5DR ! PA4DR I PA3DR I PA2DR I PA1DR I PAODR I Initial value: 0 0 0 0 0 0 0 0 R!W: R!W RIW RIW R!W RIW R!W RIW R!W Table A.55 PADR Bit Functions PAIOR Pin Function Read Write 0 General input Pin status Can write to PADR, but it does not affect pin status. All other Pin status Can write to PADR, but it does not affect pin status. General input PADR value Value written is output from pin. All other PADR value Can write to PADR, but it does not affect pin status. 574 HITACHI A.2.SS Port B Data Register (PBDR) PortB • Top Address: H'5FFFFC2 • Bus Width: 8/16/32 Register Overview: Bit: 15 14 13 12 11 10 9 8 I I I I I Bit name: PB 15DR PB 14DR PB 13DR PB 12DR PB 11DR PB 1ODR PB9DR I I I PB8DR I Initial value: 0 0 0 0 0 0 0 0 R1W: RIW RIW RIW RIW RIW RIW RIW RIW Bit: 7 6 5 4 3 2 1 0 Bit name: I PB7DR I PB6DR I PB5DR I PB4DR I PB3DR I PB2DR I PB1DR I PBODR I Initial value: 0 0 0 0 0 0 0 0 R1W: RIW RIW RIW RIW RIW RIW RIW RIW Table A.56 Bit Functions PAIOR Pin Function Read Write 0 General input Pin status Can write to PBDR, but it does not affect pin status. TPn Pin status Cannot write All other Pin status Can write to PBDR, but it does not affect pin status. General input PBDR value Value written is output from pin. TPn PBDR value Cannot write All other PBDR value Can write to PBDR, but it does not affect pin status. HITACHI 575 ...\.2.56 Port C Data Register (PCDR) PortC • Top Address: H'SFFFFDO • aus Width: 8/16/32 Register Overview: Bit: 15 14 13 12 11 10 9 8 Bit name: I 0 0 0 0 0 0 0 0 Initial value: * * * * * * * R/W: R R R R R R R R Bit: 7 S 5 4 3 2 1 0 I I I I I Bit name: PC7 DR PCS DR PC5 DR PC4 DR PC3 DR PC2 DR PCl DR PCO DR I I I I Initial value: * * * * * * * * R/W: R R R R R R R R Note: Note determined Table A.S7 PCDR Bit Functions PlrllIO Pin Function Read Write Input General input Pin status Ignored (no affect on pin status) ANn Ignored (no affect on pin status) 576 HITACHI A.2.57 Port A VO Register (PAIOR) Pre • Top Address: H'SFFFFC4 • Bus Width: 8/16132 Register Overview: Bit: 14 10 9 8 Bit name: Initial value: 0 0 0 0 0 0 RIW: R/W RIW RIW RIW RIW R/W RIW Bit: 6 5 4 3 2 0 Bit name: Initial value: 0 0 0 RIW: R/W R/W R/W RIW R/W R/W RIW Table A.58 PAIOR Bit Functions Bit Bit Name Value Description 1~ Port A I/O (PA1510R~ 0 Input (initial setting) PAOIOR) Output HITACHI 577 A.2.SS Port B Data Register (PBIOR) PFC • Top Address: H'5FFFFC6 • Bus Width: 8/16/32 Register Overview: Bit: 15 10 9 8 Bit name: Initial value: 0 0 0 0 0 0 0 0 RIW: RIW RIW RIW RIW RIW RIW RIW RIW Bit: 7 6 5 4 3 2 0 Bit name: Initial value: 0 0 0 0 0 0 RIW: RIW RIW RIW RIW RIW RIW RIW RIW Table A.S9 PBIOR Bit Functions Bit Bit Name Value Description 15-0 Port B I/O (PB1510R- 0 Input (initial setting) PBOIOR) Output 578 HITACHI A.2.S9 Port A Control Register 1 (PACRl) PFC • Top Address: H'5FFFFC8 • Bus Width: 8116132 Register Overview: Bit: 14 10 9 8 Bit name: Initial value: 0 0 1 1 0 1 1 RIW: RIW RIW RIW RIW RIW RIW RIW Bit: 7 6 5 4 3 2 0 Bit name: Initial value: 0 0 0 0 0 0 RIW: RIW RIW RIW RIW RIW RIW RIW HITACHI 579 Table A.60 PACRl Bit Functions Bit Bit Name Value Description 15,14 PA15 mode bit 1,0 0 0 General purpose input output (P A 15) (initial setting) (PA15MD1, PA15MDO) 0 Interrupt request input (IR03) 0 Reserved DMA transfer request input (DRE01) 13,12PA14 mode bit 1,0 0 0 General purpose input output (PA14) (PA14MD1, PA14MDO) 0 Interrupt request input (IR02) 0 Aeserved DMA transfer request acknowledge output (DACK1) (initial setting) 11,10 PA13 mode bit 1,0 0 0 General purpose input output (PA13) (initial setting) (PA13MD1, PA13MDO) 0 Interrupt request input (IR01) 1 0 ITU timer clock input (TClKB) DMA transfer request input (DRE01) 9,8 PA12 mode bit 1,0 0 0 General purpose input output (PA12) (PA12MD1, PA12MDO) 0 1 Interrupt request input (IROO) 0 ITU timer clock input (TCKlA) DMA transfer request acknowledge output (DACKO) (initial setting) 7,6 PA11 mode bit 1,0 0 0 General purpose input output (PA 11) (initial setting) (PA11MD1, PA11MDO) 0 1 High side data bus parity inpuVoutput (DPH) 0 ITU input capture inpuVoutput compare output (TIOCB1) Reserved 5,4 PA10 mode bit 1,0 0 0 General purpose input output (PA1O) (PA10MD1, PA10MDO) 0 low side data bus parity inpuVoutput (DPl) 0 ITU input capture inpuVoutput compare output (TIOCA1) Reserved 3,2 PA9 mode bit 1,0 0 0 General purpose input output (PA9) (initial setting) (PA9MD1, PA9MDO) 0 Address hold output (AH) 1 0 NO conversion trigger input (ADTRG) 1 Interrupt request output (IROOUT) 0 PA8 mode bit 1,0 (PA8MD) 0 General purpose inpuVoutput (PA8) (initial setting) Bus request input (BREO) 580 HITACHI A.2.60 Port A Control Register 2 (PACRl) PFC • Top Address: H'5FFFFCA • Bus Width: 8116/32 Register Overview: Bit: 15 14 13 12 11 10 9 8 Bit name: 1r-------,.I-p-A7-M- O-r-I--r-1P-A-SM-O--rI---rI-PA-5-M-O"T""-I--\'--P-A4-M-"O1 Initial value: 1 1 1 1 RIW: RIW RIW RIW RIW Bit: t 7 S 5 4 3 2 .1 0 Bit name: \PA3M01IPA3MOolpA2M01IpA2MOolpA1M01\PA1MOolpAOM01\PAOMO01 Initial value: 1 o o 1 o 1 o 1 RIW: RIW RIW RIW RIW RIW RIW RIW HITACHI 581 ... - .. -.~- - .• .. --.-.~.... . ....... ~-.~- .. ~-~ Table A.61 PACR2 Bit Functions Bit Bit Name Value Description 14 PA7 mode bit (PA7MD) 0 General purpose input output (PA7) Bus request acknowledge output (BACK) (initial setting) 12 PA6 mode bit (PA6MD) 0 General purpose input output (PA6) Read output (RD) (initial setting) 10 PA5 mode bit (PA5MD) 0 General purpose input output (PA5) High side write output (WRH) or low side byte strobe output (LBS) (initial setting) 8 PA4 mode bit (PA4MD) 0 General purpose input output (PA4) Low side write output (WRL) or write output (WR) (initial setting) 7,6 PA3 mode bit 1,0 0 0 General purpose input output (PA3) (PA3MD1, PA3MDO) 0 Chip select output (CS7) 0 Wait state input (WAIT) (initial setting) Reserved 5,4 PA2 mode bit 1,0 0 0 General purpose input output (PA2) (PA2MD1, PA2MDO) 0 Chip select output (CS6) (initial setting) 0 ITU input capture inpuVoutput compare output (TIOCBO) Reserved 3,2 PA1 mode bit 1,0 0 0 General purpose input output (PA1) (PA1MD1, PA1MDO) 0 External chip select output (CS5) (initial setting) 0 Low address strobe output (RAS) 1 1 Reserved 1,0 PAO mode bits 1,0 0 0 General purpose inpuVoutput (PAO) (PAOMD1, PAOMDO) 0 Chip select output (CS4) (initial setting) 0 ITU input capture inpuVoutput compare output (TIOCAO) Reserved 582 HITACHI A.2.61 Port B Control Register 1 (PBCRl) PFC • Top Address: H'SFFFFCC • Bus Width: 8/16/32 Register Overview: Bit: 14 12 9 8 Bit name: Initial value: 0 0 0 0 0 0 R/W: R/W R/W R/W R/W R/W R/W R/W Bit: 7 6 5 3 2 0 Bit name: Initial value: 0 0 0 0 0 0 0 R/W: R/W R/W RIW RIW R/W R/W R/W RIW HITACHI 583 Table A.62 PBCRI Bit Functions Bit Bit Name Value Description 15,14 PB15 mode bit 1,0 0 0 General purpose input output (PB15) (initial setting) (PB15MD1, PB15MDO) 0 Interrupt request input (lRO?) 0 Reserved Timing pattern output (TP15) 13,12 PB 14 mode bit 1,0 0 0 General purpose input output (PB14) (initial setting) (PB14MD1, PB14MDO) 0 Interrupt request input (IROG) 0 Reserved Timing pattern output (TP14) 11,10 PB13 mode bit 1,0 0 0 General purpose input output (PB 13) (initial setting) (PB13MD1, PB13MDO) 0 Interrupt request input (IR05) 0 Serial clock inpuVoutput (SCK1) Timing pattern output (TP13) 9,8 PB12 mode bit 1,0 0 0 General purpose input output (PB12) (initial setting) (PB12MD1, PB12MDO) 0 Interrupt request input (IR04) 0 Serial clock inpuVoutput (SCKO) Timing pattern output (TP12) 7,6 PB11 mode bit 1,0 0 0 General purpose input output (PB 11) (initial setting) (PB11MD1, PB11MDO) 0 Reserved 0 Transmission data input (TxD1) Timing pattern output (TP11) 5,4 PB10 mode bit 1,0 0 0 General purpose input output (PB1 0) (initial setting) (PB10MD1, PB10MDO) Reserved 0 1 0 Reception data input (RxD1) 1 1 Timing pattern output (TP10) 3,2 PB9 mode bit 1,0 0 0 General purpose input output (PB9) (initial setting) (PB9MD1, PB9MDO) 0 Reserved 0 Transmission data input (TxDO) 1 Timing pattern output (TP9) 0 PB8 mode bits 1,0 0 0 General purpose inpuVoutput (PB8) (initial setting) (PB8MD1, PB8MDO) 0 Reserved 0 Reception data input (RxDO) Timing pattern output (TP8) 584 HITACHI A.2.62 Port B Control Register 2 (PBCR2) PFC • Top Address: H'5FFFFCE • Bus Width: 8116/32 Register Overview: Bit: 15 14 13 12 11 10 9 8 I I I Bit name: PB7MD11 PB7MDO PB6MD11 PB6MDO PB5MD11 PB5MDOI PB4MD11 PB4MDOI Initial value: 0 o o o o o o o RIW: RIW RIW RIW RIW RIW RIW RIW RIW Bit: 7 6 5 4 3 2 1 0 Bit name: I PB3MD11 PB3MDO I PB2MD11 PB2MDO I PB1 MD11 PB1 MDOI PBOMD11 PBOMDOI Initial value: 0 0 0 0 0 0 0 0 RIW: RIW RIW RIW RIW RIW RIW RIW RIW HITACHI 585 Table A.63 PBCR2 Bit Functions Bit Bit Name Value Description 15.14 PB7 mode bit 1.0 0 0 General purpose input output (PB7) (initial setting) (PB7MD1, PB7MDO) 0 1 ITU timer clock input (TCLKD) 0 ITU output compare output (TOCXB4) Timing pattern output (TP7) 13,12 PB6 mode bit 1,0 0 0 General purpose input output (PB6) (initial setting) (PB6MD1. PB6MDO) 0 ITU timer clock input (TClKC) 0 ITU output compare output (TOCXA4) 1 1 Timing pattern output (TP6) 11.10 PB5 mode bit 1.0 0 0 General purpose input output (PB5) (initial setting) (PB5MD1, PB5MDO) Reserved 0 0 ITU input capture inpuVoutput compare output (TIOCB4) 1 Timing pattern output (TP5) 9.8 PB4 mode bit 1,0 0 0 General purpose input output (PB4) (initial setting) (PB4MD1. PB4MDO) 0 1 Reserved 0 ITUinput capture inpuVoutput compare output (TIOCA4) 1 1 Timing pattern output (TP4) 7.6 PB3 mode bit 1.0 0 0 General purpose input output (PB3) (initial setting) (PB3MD1. PB3MDO) 0 1 Reserved 0 ITU input capture inpuVoutput compare output (TIOCB3) 1 Timing pattern output (TP3) 5.4 PB2 mode bit 1,0 0 0 General purpose input output (PB2) (initial setting) (PB2MD1. PB2MDO) 1 Reserved 0 0 ITU input capture inpuVoutput compare output (TIOCA3) 1 Timing pattern output (TP2) 3.2 PB1 mode bit 1.0 0 0 General purpose input output (PB1) (initial setting) (PB1MD1. PB1MDO) 0 Reserved 0 ITU input capture inpuVoutput compare output (TIOCB2) 1 1 Timing pattern output (TP1) 1.0 PBO mode bits 1.0 0 0 General purpose inpuVoutput (PBO) (initial setting) (PBOMD1. PBOMDO) 0 1 Reserved 0 ITU input capture inpuVoutput compare output (TIOCA2) Timing pattern output (TPO) 586 HITACHI A.2.63 Column Address Strobe Pin Control Register (CASCR) PFC • Top Address: H'SFFFFEE • Bus Width: 8/16/32 Register Overview: Bit: 15 14 13 12 11 10 9 8 Bit name: I CASH M01 CASH MOO CASL M01 CASL MOO Initial value: 0 1 0 1 RIW: RIW RIW RIW RIW Bit: 7 6 5 4 3 2 0 Bit name: I Initial value: 1 RIW: Table A.64 CASCR Bit Functions Bit Bit Name Value Description 15,14 CASH mode bits 1,0 0 0 Reserved (CASHMD1, CASHMOO) 0 1 Chip select output (CS1) (initial setting) 1 0 Column address strobe output (CASH) 1 1 Reserved 13,12 CASL mode bits 1,0 0 0 Reserved (CASLM01, CASLMDO) 0 1 Chip select output (CS3) (initial setting) 0 Column address strobe output (CASL) Reserved HITACHI 587 A.2.64 TPC Output Mode Register (TPMR) TPC • Top Address: H'SFFFFFO • Bus Width: 8116 Register Overview: Bit: 7 6 5 4 3 2 1 0 Bit name: IL-__'---_--L.._ _-'--_--'-I_G_3N_O_V--"-I_G_2N_O_V-'I_G_1_NO_V--'--IG_O_N_Ov---,1 Initial value: 0 0 0 0 R1W: RIW RIW RIW RIW Table A.65 TPMR Bit Functions Bit Bit Name Value Description 3 Group 3 non- 0 TPC output group 3 operates always (the output value is updat- overlap (G3NOV) ed at every compare match A of the selected ITU) (initial setting) TPC output group 3 operates in non-overlap (1 output and 0 output can be performed independently upon compare matches A and B of the selected ITU) 2 Group 2 non- 0 TPC output group 2 operates always (the output value is updat- overlap (G2NOV) ed at every compare match A of the selected ITU) (initial setting) TPC output group 2 operates in non-overlap (1 output and 0 output can be performed independently upon compare matches A and B of the selected ITU) Group 1 non- 0 TPC output group 1 operates always (the output value is updat- overlap (G 1NOV) ed at every compare match A of the selected ITU) (initial setting) TPC output group 1 operates in non-overlap (1 output and 0 output can be performed independently upon compare matches A and B of the selected ITU) 0 Group 0 non- 0 TPC output group 0 operates always (the output value is updat- overlap (GONOV) ed at every compare match A of the selected ITU) (initial setting) TPC output group 0 operates in non-overlap (1 output and 0 output can be performed independently upon compare matches A and B of the selected ITU) 588 HITACHI A.2.65 TPC Output Control Register (TPCR) TPC • Top Address: H'5FFFFFl • Bus Width: 8/16 Register Overview: Bit: 7 6 5 4 3 2 1 0 Bit name: IG3CMS11 G3CMSOIG2CMS11 G2CMSOI G1CMS 11G 1CMSol GOCMS11GOCMSOI Initial value: 1 1 1 1 1 1 Am: Am Am Am Am Am Am Am Am HITACHI 589 Table A.66 TPCR Bit Functions Bit Bit Name Value Description 7,6 Group 3 compare match sel- 0 0 The output trigger of TPC output group 3 (pins TP15- ect 1, 0 (G3CMS1, G3CMSO) TP12) is the.ITU channel 0 compare match 0 The output trigger of TPC output group 3 (pins TP15- TP12) is the ITU channel 1 compare match 0 The output trigger of TPC output group 3 (pins TP15- TP12) is the ITU channel 2 compare match The output trigger of TPC output group 3 (pins TP15- TP12) is the ITU channel 3 compare match* 5,4 Group 2 compare match sel- 0 0 The output trigger of TPC output group 2 (pins TP11- ect 1, 0 (G2CMS1, G2CMSO) TP8) is the ITU channel 0 compare match 0 The output trigger of TPC output group 2 (pins TP11- TP8) is the ITU channel 1 compare match 0 The output trigger of TPC output group 2 (pins TP11- TP8) is the ITU channel 2 compare match The output trigger of TPC output group 2 (pins TP11- TP8) is the ITU channel 3 compare match· 3,2 Group 1 compare match sel- 0 0 The output trigger of TPC output group 1 (pins TP7- ect 1, 0 (G1CMS1, G1CMSO) TP4) is the ITU channel 0 compare match 0 The output trigger of TPC output group 1 (pins TP7- TP4) is the ITU channel 1 compare match 0 The output trigger of TPC output group 1 (pins TP7- TP4) is the ITU channel 2 compare match The output trigger of TPC output group 1 (pins TP7- TP4) is the ITU channel 3 compare match· 1,0 Group 0 compare match sel- 0 0 The output trigger of TPC output group 0 (pins TP3- ect 1, 0 (GOCMS1, GOCMSO) TPO) is the ITU channel 0 compare match 0 The output trii:Jger of TPC output group 0 (pins TP3- TPO) is the ITU channel 1 compare match 0 The output trigger of TPC output group 0 (pins TP3- TPO) is the ITU channel 2 compare match The output trigger of TPC output group 0 (pins TP3- TPO) is the ITU channel 3 compare match* Note: Initial setting. 590 HITACHI A.2.66 Next Data Enable Register A (NDERA) TPC • Top Address: H'5FFFFF3 • Bus Width: 8116 Register Overview: Bit: 7 6 S 4 3 2 1 0 Bit name: I NDER71 NDER61 NDERSI NDER41 NDER31 NDER21 NDER1 I NDERO I Initial value: 0 0 0 0 0 0 0 0 R/W: R/W R/W R/W R/W R/W R/W R/W R/W Table A.67 NDERA Bit Functions Bit Bit Name Value Description 7-0 Next data enable 7-0 o Disable TPC output TP7-TPO (initial setting) (Disable (NDER7-NDERO) transfer from NDR7-NDRO to PB7-PBO) Enable TPC output TP7-TPO (Enable transfer from NDR7-NDRO to PB7-PBO) A.2.67 Next Data Enable Register B (NDERB) TPC • Top Address: H'5FFFFF2 • Bus Width: 8116 Register Overview: Bit: 7 6 S 4 3 2 1 0 Bit name: INDER1S1 NDER141NDER131 NDER121 NDER111NDER101 NDER91 NDERSI Initial value: 0 0 0 0 0 0 0 0 R/W: R/W R/W R/W R/W R/W R/W R/W R/W Table A.68 NDERB Bit Functions Bit Bit Name Value Description 7-0 Next data enable 7-0 o Disable TPC output TP15-TPS (initial setting) (NDER15-NDERS) (Disable transfer from NDR15-NDRS to PB 15-PBS) Enable TPC output TP15-TPS (Enable transfer from NDR15-NDRS to PB15-PBS) HITACHI 591 A.2.68 Next Data Register A (NDRA) TPC (When the output triggers of TPC output groups 0 and 1 are the same) • Top Address: H'5FFFFF5 • Bus Width: 8116 Register Ov-erview: Bit: 7 6 5 4 3 2 a Bit name: I NOR7 NOR6 NOR5 NOR4 NOR3 NOR2 NOR1 NORa Initial value: a a a a a a a a RIW: RIW RIW RIW RIW RIW RIW RIW RIW Table A.69 NDRA Bit Functions Bit Bit Name Description 7-4 Next data 7-4 (NOR7- Stores the next output data for the TPC output group 1 NOR4) 3-0 Next data 3-0 (NOR3- Stores the next output data for the TPC output group 0 NORO) A.2.69 Next Data Register A (NDRA) TPC (When the output triggers of TPC output groups 0 and 1 are the same) • Top Address: H'5FFFFF7 • Bus Width: 8/16 Register Overview: Bit: 7 6 5 4 3 2 a Bit name: rl---,------r---r----r----.-----.---,---- Initial value: RIW: Table A.70 NDRA Bit Functions Bit Bit Name Description 7-(J Reserved bit When read while writing is invalid, always read 1. 592 HITACHI A.2.70 Next Data Register A (NDRA) TPC (When the output triggers of TPC output groups 0 and 1 are different) • Top Address: H'5FFFFF5 • Bus Width: 8116 Register Overview: Bit: 7 6 5 4 3 2 Bit name: I NOR71 NOR6 NOR5 NOR4 ° Initial value: RIW: ° RIW ° RIW ° RIW ° RIW Table A.71 NDRA Bit Functions Bit Bit Name Description 7-4 Next data 7-4 (NOR7- Stores the next output data for the TPC output group 1 NOR4) A.2.71 Next Data Register A (NDRA) TPC (When the output triggers of TPC output groups 0 and 1 are different) • Top Address: H'5FFFFF7 • Bus Width: 8/16 Register Overview: Bit: 7 6 5 4 3 2 ° I 0-J Bit name: L..._ _----L-_ _---1..._ _---1..._ _--'-_N_O_R_3--1_N_O_R_2-I.-_N_O_R_1-L-._N_O_R_ Initial value: RIW: ° RIW ° RIW ° RIW ° RIW Table A.72 NDRA Bit Functions Bit Bit Name Description 3-0 Next data 3-0 (NOR3- NORO) Stores the next output data for the TPC output group ° HITACHI 593 A.2.72. Next Data Register B (NDRB) TPC (When the output triggers of TPC output groups 2 and 3 are the same) • Top Address: H'SFFFFF4 • Bus Width: 8/16 Register Overview: Bit: 7 6 5 4 3 2 0 Bit name: I NDR15 I NDR14 I NDR13 I NDR12 I NDR11 I NDR10 I NDR9 NDR8 Initial value: 0 0 0 0 0 0 0 0 R/W: R/W RIW R/W . R/W R/W R/W RIW R/W Table A.73 NDRB Bit Functions Bit Bit Name Description 7-4 Next data 15-12 (NDR15- Stores the next output data for the TPC output group 3 NDR12) 3-0 Next data 11-8 (NDR11- Stores the next output data for the TPC output group 2 NOR8) A.2.73 Next Data Register B (NDRB) TPC (When the outp-ut triggers ofTPC output groups 2 and 3 are the same) • Top Address: H'SFFFFF6 • Bus Width: 8/16 • Module: TPC Register Overview: Bit: 7 6 5 4 3 2 o Bit name: I,.----.--.........,.---,.----,...----,----,------,-----, Initial value: R/W: Table A.74 NDRB Bit Functions Bit Bit Name Description 7-0 Reserved bits When read while writing is disabled, always read 1. 594 HITACHI A.l.74 Next Data Register B (NDRB) TPC (When the output triggers of TPC output groups 1 and 3 are different) • Top Address: H'5FFFFF4 • Bus Width: 8/16 Register Overview: B~ 7 6 5 4 3 2 o Bit name: 1 NOR15 1 NOR14 1 NDR13 1 NOR12 I Initial value: 0 o o o 1 1 RIW: RIW RIW RIW RIW Table A.7S NORB Bit Functions Bit Bit Name Description 7-4 Next data 15-12 (NOR15- Stores the next output data for the TPC output group 3 NOR12) A.l.7S Next Data Register B (NORB) TPC (When the output triggers of TPC output groups 1 and 3 are different) • Top Address: H'5FFFFF6 • Bus Width: 8/16 Register Overview: Bit: 7 6 5 4 3 2 1 0 Bit name: - - . - - - - - r - - - . - - - - - r - IN-O-R-1-1 N-O-R- "--1 "-1 --r-1-N-OR-9--r-1-N-OR-a---'I 10 Initial value: 0 0 0 0 RIW: RIW RIW RIW RIW Table A.76 NORB Bit Functions Bit Bit Name Description 3-0 Next data 3-0 (NOR11- Stores the next output data for the TPC output group 2 NORa) HITACHI 595 A.3 Register Status in Reset and Power-Down States Table A.77 shows the register status in reset and power-down states. TableA.77 Register Status in Reset and Power-Down States Reset State Power-Down State Category Abbreviation Power On Manual Standby Sleep CPU RD-R15 Initialization Initialization Store Store SR GBR VBR MACH,MACL PR PC Interrupt controller (INTC) IPRA-IPRE Initialization Initialization Store Store ICR User break controller (UBC) BARH,BARL Initialization Initialization Store Store BAMRH,BAMRL BBR Bus state controller (BSC) BCR Initialization Store Store Store WCR1-WCR3 OCR RCR RTSCR RTCNT RTCOR PCR Direct memory access SARD-SAR3 Initialization Initialization Initiali- Store controller (DMAC) DARD-DAR3 zation TCRD-TCR3 CHCRQ-CHCR3 DMAOR 596 HITACHI Table A.77 Register Status in Reset and Power-Down States (cont) Reset State Power-Down State category Abbreviation Power On Manual Standby Sleep 16-bit integrated timer pulse TSTR Initialization Initialization Initiali- Store unit (ITU) TSNC zation TMOA. TMOB TCNTQ-TCNT4 GRAO-GRA4. GRBo-GRB4 BRA3. BRA4. BRB3. BRB4 TCRo-TCR4 TIORQ-TIOR4 TIERQ-TIER4 TSRQ-TSR4 Programmable timer pattern TPMR Initialization Initialization Store Store controller (TPC) TPCR NOERA.NOERB NORA. NORB Watchdog timer (WOT) TCNT Initialization Initialization Store Store TCSR *1 RSTCR Initiali- zation Serial communications SMR Initialization Initialization Initiali- Store interface (SCI) zation BRR seR TOR TSR Store SSR Initiali- ROR zalion RSR Store Notes: 1. Bits 7-5 (OVF. WT/IT. TME) are initialized. bits 2-0 (CKS2-CKSO) are stored. HITACHI 597 Table A.'S Register Status in Reset and Power-Down States (cont) Reset State Power-Down State ) Category Abbreviation Power On Manual Standby Sleep AID converter ADDRA-ADDRD Initialization Initialization Initiali- Store ADCSR zation ADCR Pin function controller (PFC) PAIOR,PBIOR Initialization Store Store Store PACR1,PACR2,P BCR1,PBCR2 CASCR Parallel I/O port (I/O) PADR,PBDR Initialization Store Store Store PCDR *2 *2 *2 *2 Power-down-state related SBYCR Initialization Initialization Store Store Notes: 2. Bits 15-8 are always undetermined, bits 7-0 always reflect the state of the correspond- ingpin. 598 HITACHI Appendix B Pin States Table B.1 Pin State During Resets, Power-Down State and Bus Release State Pin State Reset Power-Down Bus category Pin At Power On Manual Standby Sleep Released Clock CK 0 0 H*1 0 0 System control RES I WDTOVF H H H*l 0 0 BREQ z I BACK Z 0 Z 0 L Interrupt NMI I I I I IRQ7-IRQO I z I I IRQOUT 0 0*1 H 0 Address bus A21-AO H 0 Z H Z Data bus AD15-ADO Z Z Z Z Z DPH,DPL Z Z Z Z Bus control WAIT 1*2 1*2 Z 1*2 1*2 CS7 0 Z H Z es6-cSO z 0 Z H Z RD H 0 Z H Z WRH (LBS),WRL H 0 Z H Z (WR) RAS 0 0*1 0 Z CA$H,CASL 0 0 0 Z AH 0 Z H Z Direct memory access DREQO,DREQ1 I Z I controller (DMAC) DACKO,DACK1 Z 0 K*l 0 0 16-bit integrated timer TIOCAo-TIOCA4 K*l 1/0 1/0 pulse unit (ITU) TIOCBo-TIOCB4 K*l 1/0 1/0 TOCXA4, TOCXB4 K*l 0 0 TCLKA-TCLKD Z I I Timing pattern TP15-TPO K*l 0 0 controller (TPC) HITACHI 599 Table B.l Pin State During Resets, Power-Down State and Bus Release State (cont) Pin State Reset Power-Down Bus Category Pin At Power On Manual Standby Sleep Released Serial communication TxOO-Tx01 Z K*l 0 0 interface (SCI) RxOO,Rx01 Z SCKO,SCK1 Z I/O I/O NO converter AN7-ANO Z Z Z AOTRG Z I/O port PA14, PA12, PA7- I/O I/O PAO PA15, PA13, PA11- Z I/O I/O PAS PC7-PCO Z Z -: Not initial value I: Input 0: Output H: High L: Low Z: High impedance K: Input pin is high impedance, output pin holds the state Notes: 1. When the port high impedance bit (HIZ) of the standby control register (SBYCR) is made 1, the output pins become high impedance. 2. When the pin pull-up control bit (WPU) of the wait state control register (WCR3) is made 1, the WAIT pin is pulled up, but if set to 0, it is not pulled up. 600 HITACHI The following table shows the states of bus control pins and external bus pins in accesses of various address spaces. TableB.2 'Pin States in Accesses of Address Spaces On-Chip Peripheral Modules On-Chlp On-Chlp 16-Blt Space Pin Name R/W ROM Space RAM Space 8-blt Space High Byte Low Byte Word CS7~ High High High High High High ~ High High High High High High ~ High High High High High High eAS[ High High High High High High AH Low Low Low Low Low Low Ri) R High High High High High High W High High High High High WRH R High High High High High High W High High High High High WRL R High High High High High High W High High High High High AO AO AO AO AO AO AO A21-A1 Address Address Address Address Address Address AD15-AD8 High-Z High-Z High-Z High-Z High-Z High-Z AD7-ADO High-Z High-Z High-Z High-Z High-Z High-Z DPH High-Z High-Z High-Z High-Z High-Z High-Z DPL High-Z High-Z High-Z High-Z High-Z High-Z R: Read W:Write HITACHI 601 Table D.2 Pin States in Accesses of Address Spaces (cont) Address!Data Multiplex va Space 16-bit Space 8-bit WRH, WRL, AO System WR, HBS, LBS System Pin Name RIW Space High Byte Low Byte Word High Byte Low Byte Word CS7, CS5- High High High High High High High CSO CS6 Low Low Low Low Low Low Low RAS High High High High High High High CASH High High High High High High High CASL High High High High High High High AH AH AH AH AH AH AH AH RD R Low Low Low Low Low Low Low W High High High High High High WRH!LBS R High High High High High Low Low W High Low High Low High Low Low WRUWR R High High High High High High High W Low High Low Low Low Low Low AD!HBS AD Low High Low Low High Low A21-A1 Address Address Address Address Address Address Address AD15-AD8 High-Z Address! Address Address! Address! Address Address! data data data data AD7-ADD Address/ Address Address! Address/ Address Address/ Address/ data data data data data R: Read W: Write AH: When addresses are output from AD15-ADO, an address hold signal is output. 602 HITACHI TableB.2 Pin States in Accesses of Address Spaces (cont) DRAM Space 16-blt Space 8-blt Two CAS system Two WE system Pin Name RIW Space High Byte Low Byte Word High Byte Low Byte Word CS7-CS2, High High High High High High High CSO csr Low Low Low Low RAS RAS RAS RAS RAS RAS RAS RAS CASH High CASH High CASH High High High CAS[ CAS High CASL CASL CASL CASL CASL AH Low Low Low Low Low Low Low RD R Low Low Low Low Low Low Low W High High High High High High High WRHILBS' R High High High High High High High W High High High High Low High Low WRL.JWR R High High High High High High High W Low Low Low Low High Low Low AO/HBS AO AO AO AO AO AO AO A21-A1 Address Address Address Address Address Address Address AD15-AD8 High-Z Data High-Z Data High-Z Data Data AD7-ADO Data High-Z Data Data Data High-Z Data DPH High·Z Parity High-Z Parity Parity High-Z Parity DPL Parity High-Z Parity Parity High-Z Parity Parity R:Read W: Write -: The CS1 pin is used as the CASH signal output pin. RAS: When a low address is output from A21-AO, an address strobe signal is output. CAS: When a column address is output from A21-AO, an address strobe signal is output. CASH: When a column address is output from A21-AO during a high byte access, an address strobe Signal is output. CASL: When a column address is output from A21-AO during a low byte access, an address strobe signal is output. Parity: When a DRAM space parity check is selected with the parity check enable bit (PCHK1,PCHKO) of the parity control register (PCR), it is used as the parity pin. HITACHI 603 Table B.2 Pin States in Accesses of Address Spaces (cont) External Memory Space 16-bit Space 8-bit WRH, WRL, AO System WR, HBS, LBS System Pin Name RJW Space High Byte Low Byte Word High Byte Low Byte Word CS7-CSO Valid Valid Valid Valid Valid Valid Valid RAS High High High High High High High CASH High High High High High High High CASL High High High High High High High AH Low Low Low Low Low Low Low RD R Low Low Low Low Low Low Low W High High High High High High High WRH/LBS R High High High High High Low Low W High Low High Low High Low Low WRLlWR R High High High High High High High W Low High Low Low Low Low Low AO/HBS AO AO AO AO Low High Low A21-A1 Address Address· Address Address Address Address Address AD15-AD8 High-Z Data High-Z Data High-Z Data Data AD7-ADO Data High-Z Data Data Data High-Z Data DPH High-Z Parity High-Z Parity Parity High-Z Parity DPL Parity High-Z Parity Parity High-Z Parity Parity R: Read W: Write Valid: Chip select signal for the area accessed is Low; other chip select signals are High. Parity: When an area 2 parity check is selected with the parity check enable bit (PCHK1 ,PCHKO) of the parity control register (PCR), it is used as the parity pin. 604 HITACHI Appendix C External Dimensions Figure C.I shows the external dimensions of the SH microcomputer (FP-112). . -. 232+03 020 84 57 85 56 Cf) o +1 ~ N Cf) N 112 29 OUI 28 "~ x 0.30±0.\0 .II 0.131 ~~ III 1: '" +1'"0 0 0 1.6 ...d.... .- 0.8 o Figure C.I External Dimensions HITACHI 605 NOTES NOTES HITACHr ~ Hitachi Arne'rica, Ltd. Semiconductor & I.C. Division Engineering Facility Manufacturing Facility San Francisco Center Hitachi Micro Systems, Inc. Hitachi Semiconductor (America) Inc. 2000 Sierra Point Parkway 179 East Tasman Drive 6321 Longhorn Drive Brisbane, CA 94005-1835 San Jose, CA 95134 Irving, TX 75063-2712 (415) 583-4207 AREA OFFICES • • • • • • • • • • • • • • • • • • • • • •iMKM.ttiW!WrWJWrW'Z~ttKwii1i1i!l!rmlmHim:1 Western Central Eastern Hitachi America, Ltd. Hitachi America, Ltd. Hitachi America, Ltd. 1740 Technology Drive Two Lincoln Centre . 5511 Capitol Center Drive Suite 500 5420 LBJ Freeway, Suite 1446 Suite 204 San Jose, CA 9511 0 Dallas, TX 75240 Raleigh, NC 27606 (408) 451-9570 (214) 991-4510 (919) 233-0800 REGIONALIDISTRICT OFFICES Southwest North Central Mid-Atlantic Ottawa Hitachi America, Ltd. Hitachi America, Ltd. Hitachi America, Ltd. Hitachi (Canadian), Ltd. 2030 Main Street 500 Park Boulevard 325 Columbia Turnpike 320 March Road Suite 450 Suite 415 Suite 203 Suite 602 Irvine, CA 92714 Itasca, IL 60143 Florham Park, NJ 07932 Kanata, Ontario, (714) 553-8500 (708) 773-4864 (201) 514-2100 Canada K2K2E3 (613) 591-1990 Mountain Pacific South Central Southeast Hitachi America, Ltd. Hitachi America, Ltd. Hitachi America, Ltd. Toronto 4600 S. Ulster Street One Westchase Center 4901 N.W. 17th Way Hitachi (Canadian), Ltd. Suite 690 10777 Westheimer Drive Suite 302 6740 Campobello Road Denver, CO 80237 Suite 1040 Ft. Lauderdale, FL 33309 Mississauga, Ontario (303) 779-5535 Houston, TX 77042 (305) 491-6154 Canada L5N 2L8 (713) 974-0534 (416) 826-4100 Bloomington IBM Hitachi America, Ltd. IBM Engineering Hitachi America, Ltd. 3800 W. 80th Street Hitachi America, Ltd. 21 Old Main Street Suite 1550 6907 Capitol of Texas Suite 206 Bloomington, MN 55431 Highway Fishkill, NY 12524 (612) 896-3444 Suite 340 (914) 897-3000 Austin, TX78731 Great Lakes (512) 418-9360 Hitachi America, Ltd. Fairlane Plaza North Northeast Suite 311 Hitachi America, Ltd. 290 Town Center Drive 77 S. Bedford Street Dearborn, MI 48126 Burlington, MA 01803 (313) 271-4410 (617) 229-2150 REPRESENTATIVE OFFICES Electri-Rep • Electronic Sales & Engineering Inc .• EIR, Inc .• Longman Sales, Inc .• M. Gottlieb Associates, Inc .• Mycros Electronica • The Novus Group, Inc .• Parker-Webster Company' QuadRep, Inc .• QuadRep Crown, Inc .• QuadRep Sierra, Inc .• QuadRep Southern, Inc .• Robert Electronic Sales' Strategic Sales, Inc .• Sumer Inc .• System Sales of Arizona, Inc .• System Sales of New Mexico' Technology Sales, Inc .• TekRep, Inc .• Thompson & Associates, Inc .• West Associates' Wes Tech Associates DISTRIBUTORS Marsh Electronics' Marshall Industries' Milgray Electronics' Reptron Electronics' Sterling Electronics' Vantage Components © 1995 Hitachi America, Ltd. Printed in U.S.A. @ Printed on Recycled Paper 1095/1500/BantalM FM Order Number: M27T005A Area Offices Hitachi America. Ltd. 1740 Technolo Drive I' " For literature fulfillment request contact Hitachi Literature Fulfillment at 1-800-285-1601