Part Number Hot Search : 
C5385 PS2602 MR1722 C5122J1M CP3612 8550SLT1 SM350 BD4720G
Product Description
Full Text Search
 

To Download HD6477042AVF16 Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  hitachi superh risc engine sh7040 series hardware manual ade-602-117d rev. 5.0 3/19/00 hitachi, ltd.
cautions 1. hitachi neither warrants nor grants licenses of any rights of hitachi? or any third party? patent, copyright, trademark, or other intellectual property rights for information contained in this document. hitachi bears no responsibility for problems that may arise with third party? rights, including intellectual property rights, in connection with use of the information contained in this document. 2. products and product specifications may be subject to change without notice. confirm that you have received the latest product standards or specifications before final design, purchase or use. 3. hitachi makes every attempt to ensure that its products are of high quality and reliability. however, contact hitachi? sales office before using the product in an application that demands especially high quality and reliability or where its failure or malfunction may directly threaten human life or cause risk of bodily injury, such as aerospace, aeronautics, nuclear power, combustion control, transportation, traffic, safety equipment or medical equipment for life support. 4. design your application so that the product is used within the ranges guaranteed by hitachi particularly for maximum rating, operating supply voltage range, heat radiation characteristics, installation conditions and other characteristics. hitachi bears no responsibility for failure or damage when used beyond the guaranteed ranges. even within the guaranteed ranges, consider normally foreseeable failure rates or failure modes in semiconductor devices and employ systemic measures such as fail-safes, so that the equipment incorporating hitachi product does not cause bodily injury, fire or other consequential damage due to operation of the hitachi product. 5. this product is not designed to be radiation resistant. 6. no one is permitted to reproduce or duplicate, in any form, the whole or part of this document without written approval from hitachi. 7. contact hitachi? sales office for any questions regarding this document or hitachi semiconductor products.
preface the sh7040 series (sh7040, sh7041, sh7042, sh7043, sh7044, sh7045) single-chip risc (reduced instruction set computer) microprocessors integrate a hitachi-original risc cpu core with peripheral functions required for system configuration. the cpu has a risc-type instruction set . most instructions can be executed in one clock cycle, which greatly improves instruction execution speed . in addition, the 32-bit internal-bus architecture enhances data processing power. with this cpu, it has become possible to assemble low cost, high performance/high-functioning systems, even for applications that were previously impossible with microprocessors, such as real-time control, which demands high speeds. in particular, the sh7040 series has a 1-kbyte on-chip cache, which allows an improvement in cpu performance during external memory access. in addition, the sh7040 series includes on-chip peripheral functions necessary for system configuration, such as large-capacity rom and ram, timers, a serial communication interface (sci), an a/d converter, an interrupt controller, and i/o ports. memory or peripheral lsis can be connected efficiently with an external memory access support function. this greatly reduces system cost. there are versions of on-chip rom: mask rom, prom, and flash memory. the flash memory can be programmed with a programmer that supports sh7040 series programming, and can also be programmed and erased by software. this hardware manual describes the sh7040 series hardware. refer to the programming manual for a detailed description of the instruction set. related manual sh7040 series instructions sh-1/sh-2/sh-dsp programming manual please consult your hitachi sales representative for details for development environment system.
i contents section 1 sh7040 series overview ............................................................................. 1 1.1 sh7040 series overview .................................................................................................. 1 1.1.1 sh7040 series features........................................................................................ 1 1.2 block diagram.............................................................................................................. ..... 11 1.3 pin arrangement and pin functions.................................................................................. 13 1.3.1 pin arrangment .................................................................................................... 13 1.3.2 pin arrangement by mode ................................................................................... 16 1.3.3 pin functions........................................................................................................ 37 1.4 the f-ztat version onboard programming .................................................................. 42 section 2 cpu ..................................................................................................................... 45 2.1 register configuration ..................................................................................................... .45 2.1.1 general registers (rn) ......................................................................................... 45 2.1.2 control registers.................................................................................................. 46 2.1.3 system registers .................................................................................................. 47 2.1.4 initial values of registers .................................................................................... 47 2.2 data formats............................................................................................................... ....... 48 2.2.1 data format in registers...................................................................................... 48 2.2.2 data format in memory ....................................................................................... 48 2.2.3 immediate data format........................................................................................ 48 2.3 instruction features ....................................................................................................... .... 49 2.3.1 risc-type instruction set ................................................................................... 49 2.3.2 addressing modes................................................................................................ 52 2.3.3 instruction format ................................................................................................ 56 2.4 instruction set by classification........................................................................................ 59 2.5 processing states .......................................................................................................... ..... 72 2.5.1 state transitions ................................................................................................... 72 2.5.2 power-down state................................................................................................ 74 section 3 operating modes ............................................................................................ 77 3.1 operating modes, types, and selection............................................................................ 77 3.2 explanation of operating modes....................................................................................... 78 3.3 pin configuration .......................................................................................................... .... 79 section 4 clock pulse generator (cpg) ..................................................................... 81 4.1 overview................................................................................................................... ......... 81 4.1.1 block diagram...................................................................................................... 81 4.2 oscillator................................................................................................................. ........... 81 4.2.1 connecting a crystal oscillator............................................................................ 81
ii 4.2.2 external clock input method ............................................................................... 82 4.2.3 notes on board design ........................................................................................ 83 4.3 prescaler .................................................................................................................. .......... 84 4.4 oscillator halt function ................................................................................................... .84 section 5 exception processing ..................................................................................... 85 5.1 overview................................................................................................................... ......... 85 5.1.1 types of exception processing and priority ........................................................ 85 5.1.2 exception processing operations ......................................................................... 86 5.1.3 exception processing vector table...................................................................... 87 5.2 resets..................................................................................................................... ............ 88 5.2.1 power-on reset.................................................................................................... 89 5.2.2 manual reset........................................................................................................ 89 5.3 address errors ............................................................................................................. ...... 90 5.3.1 address error exception processing.................................................................... 91 5.4 interrupts................................................................................................................. ........... 91 5.4.1 interrupt priority level......................................................................................... 92 5.4.2 interrupt exception processing ............................................................................ 92 5.5 exceptions triggered by instructions................................................................................ 92 5.5.1 trap instructions .................................................................................................. 93 5.5.2 illegal slot instructions ........................................................................................ 93 5.5.3 general illegal instructions .................................................................................. 94 5.6 when exception sources are not accepted..................................................................... 94 5.6.1 immediately after a delayed branch instruction.................................................. 94 5.6.2 immediately after an interrupt-disabled instruction............................................ 94 5.7 stack status after exception processing ends................................................................... 95 5.8 notes on use............................................................................................................... ....... 96 5.8.1 value of stack pointer (sp).................................................................................. 96 5.8.2 value of vector base register (vbr) ................................................................. 96 5.8.3 address errors caused by stacking of address error exception processing...... 96 section 6 interrupt controller (intc) ......................................................................... 97 6.1 overview ................................................................................................................... ........ 97 6.1.1 features ................................................................................................................ 9 7 6.1.2 block diagram...................................................................................................... 97 6.1.3 pin configuration ................................................................................................. 99 6.1.4 register configuration ......................................................................................... 99 6.2 interrupt sources.......................................................................................................... ...... 100 6.2.1 nmi interrupts...................................................................................................... 100 6.2.2 user break interrupt ............................................................................................. 100 6.2.3 irq interrupts ...................................................................................................... 100 6.2.4 on-chip peripheral module interrupts ................................................................ 101 6.2.5 interrupt exception vectors and priority rankings ............................................. 101
iii 6.3 description of registers ................................................................................................... . 106 6.3.1 interrupt priority registers a? (ipra?prh) .................................................. 106 6.3.2 interrupt control register (icr) .......................................................................... 107 6.3.3 irq status register (isr) .................................................................................... 108 6.4 interrupt operation ........................................................................................................ .... 110 6.4.1 interrupt sequence................................................................................................ 110 6.4.2 stack after interrupt exception processing .......................................................... 112 6.5 interrupt response time.................................................................................................... 1 12 6.6 data transfer with interrupt request signals ................................................................... 114 6.6.1 handling dtc activating and cpu interrupt sources, but not dmac activating sources................................................................................................ 115 6.6.2 handling dmac activating sources but not cpu interrupt or dtc activating sources................................................................................................ 116 6.6.3 handling dtc activating sources but not cpu interrupt or dmac activating sources................................................................................................ 116 6.6.4 treating cpu interrupt sources but not dtc or dmac activating sources.... 116 section 7 user break controller (ubc) ..................................................................... 117 7.1 overview.................................................................................................................... ........ 117 7.1.1 features ................................................................................................................ 1 17 7.1.2 block diagram...................................................................................................... 117 7.1.3 register configuration ......................................................................................... 118 7.2 register descriptions...................................................................................................... ... 119 7.2.1 user break address register (ubar)................................................................. 119 7.2.2 user break address mask register (ubamr) ................................................... 120 7.2.3 user break bus cycle register (ubbr).............................................................. 121 7.3 operation .................................................................................................................. ......... 124 7.3.1 flow of the user break operation........................................................................ 124 7.3.2 break on on-chip memory instruction fetch cycle ........................................... 126 7.3.3 program counter (pc) values saved ................................................................... 126 7.4 use examples ............................................................................................................... ..... 126 7.4.1 break on cpu instruction fetch cycle ................................................................ 126 7.4.2 break on cpu data access cycle........................................................................ 127 7.4.3 break on dma/dtc cycle.................................................................................. 128 7.5 cautions on use............................................................................................................ ..... 128 7.5.1 on-chip memory instruction fetch ..................................................................... 128 7.5.2 instruction fetch at branches ............................................................................... 128 7.5.3 contention between user break and exception handling ................................... 129 7.5.4 break at non-delay branch instruction jump destination.................................. 129 section 8 data transfer controller (dtc) ................................................................ 131 8.1 overview................................................................................................................... ......... 131 8.1.1 features ................................................................................................................ 1 31
iv 8.1.2 block diagram...................................................................................................... 132 8.2 register configuration ..................................................................................................... . 133 8.2.1 dtc mode register (dtmr) .............................................................................. 133 8.2.2 dtc source address register (dtsar)............................................................. 136 8.2.3 dtc destination address register (dtdar)..................................................... 136 8.2.4 dtc initial address register (dtiar) ............................................................... 137 8.2.5 dtc transfer count register a (dtcra) ......................................................... 137 8.2.6 dtc transfer count register b (dtcrb).......................................................... 138 8.2.7 dtc enable registers (dter)............................................................................ 138 8.2.8 dtc control/status register (dtcsr) ............................................................... 139 8.2.9 dtc information base register (dtbr) ............................................................ 141 8.3 operation .................................................................................................................. ......... 141 8.3.1 overview of operation ......................................................................................... 141 8.3.2 activating sources................................................................................................ 143 8.3.3 dtc vector table ................................................................................................ 143 8.3.4 register information placement ........................................................................... 146 8.3.5 normal mode........................................................................................................ 147 8.3.6 repeat mode ........................................................................................................ 147 8.3.7 block transfer mode............................................................................................ 148 8.3.8 operation timing ................................................................................................. 149 8.3.9 dtc execution state counts................................................................................ 149 8.3.10 dtc usage procedure.......................................................................................... 151 8.3.11 dtc use example................................................................................................ 151 8.4 cautions on use............................................................................................................ ..... 152 section 9 cache memory (cac) .................................................................................. 153 9.1 overview................................................................................................................... ......... 153 9.1.1 features ................................................................................................................ 1 53 9.1.2 block diagram...................................................................................................... 154 9.1.3 register configuration ......................................................................................... 154 9.2 register explanation....................................................................................................... ... 155 9.2.1 cache control register (ccr)............................................................................. 155 9.3 address array and data array .......................................................................................... 156 9.3.1 cache address array read/write space.............................................................. 157 9.3.2 cache data array read/write space ................................................................... 157 9.4 cautions on use............................................................................................................ .... 158 9.4.1 cache initialization .............................................................................................. 158 9.4.2 forced access to address array and data array ................................................ 158 9.4.3 cache miss penalty and cache fill timing ......................................................... 158 9.4.4 cache hit after cache miss.................................................................................. 160 section 10 bus state controller (bsc) ......................................................................... 161 10.1 overview.................................................................................................................. .......... 161
v 10.1.1 features ................................................................................................................ 161 10.1.2 block diagram...................................................................................................... 162 10.1.3 pin configuration ................................................................................................. 163 10.1.4 register configuration ......................................................................................... 164 10.1.5 address map ........................................................................................................ 165 10.2 description of registers .................................................................................................. .. 167 10.2.1 bus control register 1 (bcr1)............................................................................ 167 10.2.2 bus control register 2 (bcr2)............................................................................ 170 10.2.3 wait control register 1 (wcr1) ......................................................................... 173 10.2.4 wait control register 2 (wcr2) ......................................................................... 175 10.2.5 dram area control register (dcr).................................................................. 176 10.2.6 refresh timer control/status register (rtcsr) ................................................ 179 10.2.7 refresh timer counter (rtcnt) ........................................................................ 181 10.2.8 refresh time constant register (rtcor).......................................................... 182 10.3 accessing ordinary space................................................................................................. 1 83 10.3.1 basic timing ........................................................................................................ 183 10.3.2 wait state control ................................................................................................ 184 10.3.3 cs assertion period extension ............................................................................ 186 10.4 dram access ............................................................................................................... .... 187 10.4.1 dram direct connection.................................................................................... 187 10.4.2 basic timing ........................................................................................................ 188 10.4.3 wait state control ................................................................................................ 189 10.4.4 burst operation .................................................................................................... 193 10.4.5 refresh timing ..................................................................................................... 195 10.5 address/data multiplex i/o space access........................................................................ 197 10.5.1 basic timing ........................................................................................................ 197 10.5.2 wait state control ................................................................................................ 198 10.5.3 cs assertion extension........................................................................................ 199 10.6 waits between access cycles ........................................................................................... 199 10.6.1 prevention of data bus conflicts ......................................................................... 199 10.6.2 simplification of bus cycle start detection ........................................................ 201 10.7 bus arbitration ........................................................................................................... ....... 201 10.8 memory connection examples ......................................................................................... 203 10.9 on-chip peripheral i/o register access............................................................................ 208 10.10 cpu operation when program is in external memory..................................................... 209 section 11 direct memory access controller (dmac) .......................................... 211 11.1 overview.................................................................................................................. .......... 211 11.1.1 features ................................................................................................................ 211 11.1.2 block diagram...................................................................................................... 213 11.1.3 pin configuration ................................................................................................. 214 11.1.4 register configuration ......................................................................................... 215 11.2 register descriptions..................................................................................................... .... 216
vi 11.2.1 dma source address registers 0? (sar0?ar3) ........................................... 216 11.2.2 dma destination address registers 0? (dar0?ar3) .................................. 217 11.2.3 dma transfer count registers 0? (dmatcr0?matcr3) ......................... 218 11.2.4 dma channel control registers 0? (chcr0?hcr3).................................... 219 11.2.5 dmac operation register (dmaor) ................................................................. 224 11.3 operation ................................................................................................................. ........... 226 11.3.1 dma transfer flow.............................................................................................. 226 11.3.2 dma transfer requests........................................................................................ 228 11.3.3 channel priority .................................................................................................... 230 11.3.4 dma transfer types ............................................................................................ 233 11.3.5 address modes...................................................................................................... 233 11.3.6 dual address mode .............................................................................................. 235 11.3.7 bus modes............................................................................................................. 24 2 11.3.8 relationship between request modes and bus modes by dma transfer category ................................................................................................................ 243 11.3.9 bus mode and channel priority order.................................................................. 244 11.3.10 number of bus cycle states and dreq pin sample timing............................... 244 11.3.11 source address reload function .......................................................................... 261 11.3.12 dma transfer ending conditions........................................................................ 262 11.3.13 dmac access from cpu ..................................................................................... 263 11.4 examples of use........................................................................................................... ...... 263 11.4.1 example of dma transfer between on-chip sci and external memory........... 263 11.4.2 example of dma transfer between external ram and external device with dack............................................................................................................ 264 11.4.3 example of dma transfer between a/d converter and on-chip memory (address reload on) (excluding a mask) ........................................................... 264 11.4.4 example of dma transfer between a/d converter and internal memory (address reload on) (a mask) ............................................................................ 266 11.4.5 example of dma transfer between external memory and sci1 send side (indirect address on)............................................................................................ 268 11.5 cautions on use........................................................................................................... ....... 270 section 12 multifunction timer pulse unit (mtu) ................................................... 271 12.1 overview .................................................................................................................. .......... 271 12.1.1 features ................................................................................................................ . 271 12.1.2 block diagram ...................................................................................................... 274 12.1.3 pin configuration.................................................................................................. 276 12.1.4 register configuration .......................................................................................... 278 12.2 mtu register descriptions................................................................................................ 2 81 12.2.1 timer control register (tcr) .............................................................................. 281 12.2.2 timer mode register (tmdr) ............................................................................. 286 12.2.3 timer i/o control register (tior) ...................................................................... 288 12.2.4 timer interrupt enable register (tier) ............................................................... 304
vii 12.2.5 timer status register (tsr) ................................................................................ 307 12.2.6 timer counters (tcnt)....................................................................................... 310 12.2.7 timer general register (tgr) ............................................................................ 311 12.2.8 timer start register (tstr)................................................................................ 311 12.2.9 timer synchro register (tsyr).......................................................................... 312 12.2.10 timer output master enable register (toer).................................................... 313 12.2.11 timer output control register (tocr) .............................................................. 315 12.2.12 timer gate control register (tgcr).................................................................. 316 12.2.13 timer subcounter (tcnts)................................................................................. 318 12.2.14 timer dead time data register (tddr)............................................................ 319 12.2.15 timer period data register (tcdr).................................................................... 319 12.2.16 timer period buffer register (tcbr) ................................................................. 320 12.3 bus master interface...................................................................................................... .... 320 12.3.1 16-bit registers.................................................................................................... 320 12.3.2 8-bit registers...................................................................................................... 321 12.4 operation ................................................................................................................. .......... 322 12.4.1 overview .............................................................................................................. 32 2 12.4.2 basic functions .................................................................................................... 323 12.4.3 synchronous operation ........................................................................................ 328 12.4.4 buffer operation .................................................................................................. 331 12.4.5 cascade connection mode ................................................................................... 334 12.4.6 pwm mode .......................................................................................................... 335 12.4.7 phase counting mode .......................................................................................... 339 12.4.8 reset-synchronized pwm mode ......................................................................... 346 12.4.9 complementary pwm mode ............................................................................... 350 12.5 interrupts................................................................................................................ ............ 375 12.5.1 interrupt sources and priority ranking................................................................ 375 12.5.2 dtc/dmac activation ....................................................................................... 377 12.5.3 a/d converter activation .................................................................................... 377 12.6 operation timing .......................................................................................................... .... 378 12.6.1 input/output timing ............................................................................................ 378 12.6.2 interrupt signal timing ........................................................................................ 383 12.7 notes and precautions..................................................................................................... ... 387 12.7.1 input clock limitations........................................................................................ 387 12.7.2 note on cycle setting .......................................................................................... 387 12.7.3 contention between tcnt write and clear........................................................ 388 12.7.4 contention between tcnt write and increment ................................................ 389 12.7.5 contention between buffer register write and compare match ........................ 390 12.7.6 contention between tgr read and input capture.............................................. 392 12.7.7 contention between tgr write and input capture ............................................. 393 12.7.8 contention between buffer register write and input capture ............................ 394 12.7.9 contention between tgr write and compare match ......................................... 395 12.7.10 tcnt2 write and overflow/underflow contention in cascade connection ..... 395
viii 12.7.11 counter value during complementary pwm mode stop.................................... 397 12.7.12 buffer operation setting in complementary pwm mode ................................... 397 12.7.13 reset sync pwm mode buffer operation and compare match flag.................. 398 12.7.14 overflow flags in reset sync pwm mode.......................................................... 400 12.7.15 notes on compare match flags in complementary pwm mode ........................ 403 12.7.16 contention between overflow/underflow and counter clearing ........................ 405 12.7.17 contention between tcnt write and overflow/underflow................................ 406 12.7.18 cautions on transition from normal operation or pwm mode 1 to reset-synchronous pwm mode....................................................................... 407 12.7.19 output level in complementary pwm mode and reset-synchronous pwm mode ........................................................................................................... 407 12.7.20 cautions on using the chopping function in complementary pwm mode or reset synchronous pwm mode (a mask excluded) ...................................... 407 12.7.21 cautions on carrying out buffer operation of channel 0 in pwm mode (a mask excluded) ............................................................................................... 407 12.7.22 cautions on restarting with sync clear of another channel in complementary pwm mode (a mask excluded)............................................ 408 12.8 mtu output pin initialization ........................................................................................... 40 9 12.8.1 operating modes ................................................................................................... 409 12.8.2 reset start operation ............................................................................................ 409 12.8.3 operation in case of re-setting due to error during operation, etc.................. 410 12.8.4 overview of initialization procedures and mode transitions in case of error during operation, etc................................................................................... 410 12.9 port output enable (poe).................................................................................................. 441 12.9.1 features ................................................................................................................ . 441 12.9.2 block diagram ...................................................................................................... 442 12.9.3 pin configuration .................................................................................................. 443 12.9.4 register configuration .......................................................................................... 443 12.10 poe register descriptions ................................................................................................ . 444 12.10.1 input level control/status register (icsr).......................................................... 444 12.10.2 output level control/status register (ocsr) ..................................................... 447 12.11 operation ................................................................................................................ ............ 449 12.11.1 input level detection operation........................................................................... 449 12.11.2 output-level compare operation ........................................................................ 450 12.11.3 release from high-impedance state..................................................................... 450 12.11.4 poe timing............................................................................................................ 4 51 section 13 watchdog timer (wdt) ............................................................................... 453 13.1 overview .................................................................................................................. .......... 453 13.1.1 features ................................................................................................................ . 453 13.1.2 block diagram ...................................................................................................... 454 13.1.3 pin configuration .................................................................................................. 454 13.1.4 register configuration .......................................................................................... 455
ix 13.2 register descriptions..................................................................................................... .... 455 13.2.1 timer counter (tcnt) ........................................................................................ 455 13.2.2 timer control/status register (tcsr) ................................................................ 456 13.2.3 reset control/status register (rstcsr) ............................................................ 458 13.2.4 register access .................................................................................................... 459 13.3 operation ................................................................................................................. .......... 460 13.3.1 watchdog timer mode ........................................................................................ 460 13.3.2 interval timer mode ............................................................................................ 462 13.3.3 clearing the standby mode.................................................................................. 462 13.3.4 timing of setting the overflow flag (ovf)........................................................ 463 13.3.5 timing of setting the watchdog timer overflow flag (wovf)........................ 463 13.4 notes on use.............................................................................................................. ........ 464 13.4.1 tcnt write and increment contention............................................................... 464 13.4.2 changing cks2?ks0 bit values...................................................................... 464 13.4.3 changing between watchdog timer/interval timer modes................................ 464 13.4.4 system reset with wdtovf ............................................................................. 465 13.4.5 internal reset with the watchdog timer.............................................................. 465 section 14 serial communication interface (sci) .................................................... 467 14.1 overview.................................................................................................................. .......... 467 14.1.1 features ................................................................................................................ 467 14.1.2 block diagram...................................................................................................... 468 14.1.3 pin configuration ................................................................................................. 469 14.1.4 register configuration ......................................................................................... 469 14.2 register descriptions..................................................................................................... .... 470 14.2.1 receive shift register (rsr)............................................................................... 470 14.2.2 receive data register (rdr) .............................................................................. 470 14.2.3 transmit shift register (tsr).............................................................................. 470 14.2.4 transmit data register (tdr) ............................................................................ 471 14.2.5 serial mode register (smr)................................................................................ 471 14.2.6 serial control register (scr).............................................................................. 474 14.2.7 serial status register (ssr)................................................................................. 477 14.2.8 bit rate register (brr)....................................................................................... 481 14.3 operation ................................................................................................................. .......... 499 14.3.1 overview .............................................................................................................. 49 9 14.3.2 operation in asynchronous mode........................................................................ 501 14.3.3 multiprocessor communication ........................................................................... 511 14.3.4 clock synchronous operation.............................................................................. 519 14.4 sci interrupt sources and the dmac/dtc...................................................................... 530 14.5 notes on use.............................................................................................................. ........ 531 14.5.1 tdr write and tdre flags ................................................................................ 531 14.5.2 simultaneous multiple receive errors ................................................................ 531 14.5.3 break detection and processing........................................................................... 532
x 14.5.4 sending a break signal ........................................................................................ 532 14.5.5 receive error flags and transmitter operation (clock synchronous mode only) ........................................................................ 532 14.5.6 receive data sampling timing and receive margin in the asynchronous mode..................................................................................................................... 532 14.5.7 constraints on dmac/dtc use.......................................................................... 534 14.5.8 cautions for clock synchronous external clock mode ...................................... 534 14.5.9 caution for clock synchronous internal clock mode ......................................... 534 section 15 high speed a/d converter (excluding a mask) ................................. 535 15.1 overview.................................................................................................................. .......... 535 15.1.1 features ................................................................................................................ 535 15.1.2 block diagram...................................................................................................... 536 15.1.3 pin configuration ................................................................................................. 536 15.1.4 register configuration ......................................................................................... 537 15.2 register descriptions..................................................................................................... .... 538 15.2.1 a/d data registers a? (addra?ddrh).................................................... 538 15.2.2 a/d control/status register (adcsr)................................................................ 539 15.2.3 a/d control register (adcr)............................................................................. 542 15.3 bus master interface...................................................................................................... .... 543 15.4 operation ................................................................................................................. .......... 546 15.4.1 select-single mode .............................................................................................. 546 15.4.2 select-scan mode................................................................................................. 547 15.4.3 group-single mode.............................................................................................. 548 15.4.4 group-scan mode ................................................................................................ 549 15.4.5 buffer operation .................................................................................................. 550 15.4.6 simultaneous sampling operation ....................................................................... 553 15.4.7 conversion start modes ....................................................................................... 555 15.4.8 conversion start by external input ...................................................................... 558 15.4.9 a/d conversion time ......................................................................................... 559 15.5 interrupts................................................................................................................ ............ 560 15.6 notes on use.............................................................................................................. ........ 561 section 16 mid-speed a/d converter (a mask) ....................................................... 565 16.1 overview.................................................................................................................. .......... 565 16.1.1 features ................................................................................................................ 565 16.1.2 block diagram...................................................................................................... 566 16.1.3 pin configuration ................................................................................................. 567 16.1.4 register configuration ......................................................................................... 568 16.2 register descriptions..................................................................................................... .... 569 16.2.1 a/d data register a? (addra0?ddrd0, addra1?ddrd1)............ 569 16.2.2 a/d control/status register (adcsr0, adcsr1) ............................................ 570 16.2.3 a/d control register (adcr0, adcr1)............................................................ 572
xi 16.3 interface with cpu ........................................................................................................ .... 573 16.4 operation ................................................................................................................. .......... 574 16.4.1 single mode (scan=0) ....................................................................................... 574 16.4.2 scan mode (scan=1).......................................................................................... 576 16.4.3 input sampling and a/d conversion time.......................................................... 578 16.4.4 external trigger input timing ............................................................................. 579 16.5 interrupt and dma, dtc transfer requests...................................................................... 580 16.6 a/d conversion precision definitions.............................................................................. 581 16.7 usage notes ............................................................................................................... ........ 582 16.7.1 analog voltage settings....................................................................................... 582 16.7.2 handling of analog input pins............................................................................. 582 section 17 compare match timer (cmt) ................................................................... 585 17.1 overview.................................................................................................................. .......... 585 17.1.1 features ................................................................................................................ 585 17.1.2 block diagram...................................................................................................... 585 17.1.3 register configuration ......................................................................................... 587 17.2 register descriptions..................................................................................................... .... 588 17.2.1 compare match timer start register (cmstr) ................................................. 588 17.2.2 compare match timer control/status register (cmcsr).................................. 589 17.2.3 compare match timer counter (cmcnt).......................................................... 590 17.2.4 compare match timer constant register (cmcor).......................................... 591 17.3 operation ................................................................................................................. .......... 591 17.3.1 period count operation........................................................................................ 591 17.3.2 cmcnt count timing ........................................................................................ 592 17.4 interrupts................................................................................................................ ............ 592 17.4.1 interrupt sources and dtc activation................................................................. 592 17.4.2 compare match flag set timing ......................................................................... 592 17.4.3 compare match flag clear timing...................................................................... 593 17.5 notes on use............................................................................................................... ....... 594 17.5.1 contention between cmcnt write and compare match ................................... 594 17.5.2 contention between cmcnt word write and incrementation .......................... 595 17.5.3 contention between cmcnt byte write and incrementation ............................ 596 section 18 pin function controller ................................................................................ 597 18.1 overview................................................................................................................... ......... 597 18.2 register configuration ..................................................................................................... . 605 18.3 register descriptions...................................................................................................... ... 606 18.3.1 port a i/o register h (paiorh) ........................................................................ 606 18.3.2 port a i/o register l (paiorl) ......................................................................... 607 18.3.3 port a control register h (pacrh) ................................................................... 607 18.3.4 port a control registers l1, l2 (pacrl1 and pacrl2) ................................. 610 18.3.5 port b i/o register (pbior)................................................................................ 615
xii 18.3.6 port b control registers (pbcr1 and pbcr2)................................................... 616 18.3.7 port c i/o register (pcior)................................................................................ 620 18.3.8 port c control register (pccr) .......................................................................... 621 18.3.9 port d i/o register h (pdiorh) ........................................................................ 624 18.3.10 port d i/o register l (pdiorl) ......................................................................... 625 18.3.11 port d control registers h1, h2 (pdcrh1 and pdcrh2)................................ 625 18.3.12 port d control register l (pdcrl).................................................................... 632 18.3.13 port e i/o register (peior) ................................................................................ 636 18.3.14 port e control registers 1, 2 (pecr1 and pecr2) ............................................ 636 18.3.15 irqout function control register (ifcr)........................................................ 641 18.4 cautions on use........................................................................................................... ...... 643 section 19 i/o ports (i/o) .................................................................................................. 645 19.1 overview.................................................................................................................. .......... 645 19.2 port a.................................................................................................................... ............. 645 19.2.1 register configuration ......................................................................................... 648 19.2.2 port a data register h (padrh)........................................................................ 648 19.2.3 port a data register l (padrl) ........................................................................ 649 19.3 port b .................................................................................................................... ............. 650 19.3.1 register configuration ......................................................................................... 650 19.3.2 port b data register (pbdr)............................................................................... 651 19.4 port c .................................................................................................................... ............. 652 19.4.1 register configuration ......................................................................................... 652 19.4.2 port c data register (pcdr)............................................................................... 653 19.5 port d.................................................................................................................... ............. 654 19.5.1 register configuration ......................................................................................... 656 19.5.2 port d data register h (pddrh)........................................................................ 657 19.5.3 port d data register l (pddrl) ........................................................................ 658 19.6 port e .................................................................................................................... ............. 659 19.6.1 register configuration ......................................................................................... 659 19.6.2 port e data register (pedr) ............................................................................... 660 19.7 port f .................................................................................................................... ............. 661 19.7.1 register configuration ......................................................................................... 661 19.7.2 port f data register (pfdr)................................................................................ 661 section 20 64/128/256kb mask rom .......................................................................... 663 20.1 overview.................................................................................................................. .......... 663 section 21 128kb prom .................................................................................................. 667 21.1 overview .................................................................................................................. ......... 667 21.2 prom mode................................................................................................................. ..... 668 21.2.1 prom mode settings .......................................................................................... 668 21.2.2 socket adapter pin correspondence and memory map ...................................... 668
xiii 21.3 prom programming ......................................................................................................... 6 72 21.3.1 programming mode selection.............................................................................. 672 21.3.2 write/verify and electrical characteristics.......................................................... 673 21.3.3 cautions on writing ............................................................................................. 677 21.3.4 post-write reliability........................................................................................... 678 section 22 256kb flash memory (f-ztat) ............................................................... 679 22.1 features.................................................................................................................. ............ 679 22.2 overview.................................................................................................................. .......... 680 22.2.1 block diagram...................................................................................................... 680 22.2.2 mode transition diagram .................................................................................... 681 22.2.3 onboard program mode ....................................................................................... 682 22.2.4 flash memory emulation in ram....................................................................... 684 22.2.5 differences between boot mode and user program mode.................................. 685 22.2.6 block configuration ............................................................................................. 686 22.3 pin configuration ......................................................................................................... ..... 687 22.4 register configuration .................................................................................................... .. 687 22.5 description of registers .................................................................................................. .. 688 22.5.1 flash memory control register 1 (flmcr1)..................................................... 688 22.5.2 flash memory control register 2 (flmcr2)..................................................... 690 22.5.3 erase block register 1 (ebr1)............................................................................ 693 22.5.4 erase block register 2 (ebr2)............................................................................ 693 22.5.5 ram emulation register (ramer) ................................................................... 694 22.6 on-board programming mode.......................................................................................... 696 22.6.1 boot mode............................................................................................................ 697 22.6.2 user program mode ............................................................................................. 701 22.7 programming/erasing flash memory................................................................................ 702 22.7.1 program mode (n = 1 for addresses h'0000?'1ffff, n = 2 for addresses h'20000?'3ffff) .............................................................. 702 22.7.2 program-verify mode (n = 1 for addresses h'0000?'1ffff, n = 2 for addresses h'20000?'3ffff) .............................................................. 703 22.7.3 erase mode (n = 1 for addresses h'0000?'1ffff, n = 2 for addresses h'20000?'3ffff) .............................................................. 709 22.7.4 erase-verify mode (n = 1 for addresses h'00000?'1ffff, n = 2 for addresses h'20000?'3ffff) .............................................................. 710 22.8 protection................................................................................................................ ........... 716 22.8.1 hardware protection............................................................................................. 716 22.8.2 software protection .............................................................................................. 717 22.8.3 error protection .................................................................................................... 718 22.9 flash memory emulation in ram.................................................................................... 720 22.10 note on flash memory programming/erasing.................................................................. 722 22.11 flash memory programmer mode .................................................................................... 722 22.11.1 socket adapter pin correspondence diagrams ................................................... 723
xiv 22.11.2 programmer mode operation............................................................................... 726 22.11.3 memory read mode............................................................................................. 727 22.11.4 auto-program mode ............................................................................................ 731 22.11.5 auto-erase mode.................................................................................................. 733 22.11.6 status read mode................................................................................................. 734 22.11.7 status polling........................................................................................................ 7 35 22.11.8 programmer mode transition time..................................................................... 736 22.11.9 cautions concerning memory programming ...................................................... 737 section 23 ram ................................................................................................................... 739 23.1 overview.................................................................................................................. .......... 739 23.2 operation ................................................................................................................. .......... 739 section 24 power-down state .......................................................................................... 741 24.1 overview.................................................................................................................. .......... 741 24.1.1 power-down states .............................................................................................. 741 24.1.2 related register.................................................................................................... 742 24.2 standby control register (sbycr).................................................................................. 742 24.3 sleep mode................................................................................................................ ........ 743 24.3.1 transition to sleep mode ..................................................................................... 743 24.3.2 canceling sleep mode.......................................................................................... 743 24.4 standby mode.............................................................................................................. ...... 743 24.4.1 transition to standby mode ................................................................................. 743 24.4.2 canceling the standby mode................................................................................ 745 24.4.3 standby mode application example.................................................................... 746 section 25 electrical characteristics (5v, 33.3 mhz version) ............................. 747 25.1 absolute maximum ratings.............................................................................................. 747 25.2 dc characteristics ........................................................................................................ ..... 748 25.3 ac characteristics ........................................................................................................ ..... 750 25.3.1 clock timing........................................................................................................ 750 25.3.2 control signal timing.......................................................................................... 752 25.3.3 bus timing ........................................................................................................... 755 25.3.4 direct memory access controller timing........................................................... 766 25.3.5 multifunction timer pulse unit timing .............................................................. 768 25.3.6 i/o port timing .................................................................................................... 769 25.3.7 watchdog timer timing ...................................................................................... 770 25.3.8 serial communication interface timing.............................................................. 771 25.3.9 mid-speed converter timing (a mask) ............................................................... 772 25.3.10 measuring conditions for ac characteristics ..................................................... 774 25.4 a/d converter characteristics .......................................................................................... 775
xv section 26 electrical characteristics (5v, 28.7 mhz version) ............................. 777 26.1 absolute maximum ratings.............................................................................................. 777 26.2 dc characteristics ........................................................................................................ ..... 778 26.3 ac characteristics ........................................................................................................ ..... 780 26.3.1 clock timing........................................................................................................ 780 26.3.2 control signal timing.......................................................................................... 782 26.3.3 bus timing ........................................................................................................... 785 26.3.4 direct memory access controller timing........................................................... 796 26.3.5 multifunction timer pulse unit timing .............................................................. 798 26.3.6 i/o port timing .................................................................................................... 799 26.3.7 watchdog timer timing ...................................................................................... 800 26.3.8 serial communication interface timing.............................................................. 801 26.3.9 high-speed a/d converter timing (excluding a mask) ..................................... 802 26.3.10 mid-speed converter timing (a mask) ............................................................... 804 26.3.11 measuring conditions for ac characteristics ..................................................... 806 26.4 a/d converter characteristics .......................................................................................... 807 section 27 electrical characteristics (3.3v, 16.7 mhz version) .......................... 809 27.1 absolute maximum ratings.............................................................................................. 809 27.2 dc characteristics ........................................................................................................ ..... 810 27.3 ac characteristics ........................................................................................................ ..... 812 27.3.1 clock timing........................................................................................................ 812 27.3.2 control signal timing.......................................................................................... 814 27.3.3 bus timing ........................................................................................................... 817 27.3.4 direct memory access controller timing........................................................... 828 27.3.5 multifunction timer pulse unit timing .............................................................. 830 27.3.6 i/o port timing .................................................................................................... 831 27.3.7 watchdog timer timing ...................................................................................... 832 27.3.8 serial communication interface timing.............................................................. 833 27.3.9 high-speed a/d converter timing (excluding a mask) ..................................... 834 27.3.10 mid-speed converter timing (a mask) ............................................................... 836 27.3.11 measurement conditions for ac characteristic .................................................. 838 27.4 a/d converter characteristics .......................................................................................... 839 appendix a on-chip supporting module registers ............................................... 841 a.1 addresses ................................................................................................................... ....... 841 appendix b block diagrams .......................................................................................... 854 appendix c pin states ...................................................................................................... 893 appendix d notes when converting the f?tat application software to the mask-rom versions .................................................................... 903
xvi appendix e product code lineup ................................................................................ 904 appendix f package dimensions .................................................................................. 906
1 section 1 sh7040 series overview 1.1 sh7040 series overview the sh7040 series (sh7040/41/42/43/44/45) cmos single-chip microprocessors integrate a hitachi-original architecture, high-speed cpu with peripheral functions required for system configuration. the cpu has a risc-type instruction set . most instructions can be executed in one clock cycle, which greatly improves instruction execution speed . in addition, the 32-bit internal-bus architecture enhances data processing power. with this cpu, it has become possible to assemble low cost, high performance/high-functioning systems, even for applications that were previously impossible with microprocessors, such as real-time control, which demands high speeds. in particular, the sh7040 series has a 1-kbyte on-chip cache, which allows an improvement in cpu performance during external memory access. in addition, the sh7040 series includes on-chip peripheral functions necessary for system configuration, such as large-capacity rom and ram, timers, a serial communication interface (sci), an a/d converter, an interrupt controller, and i/o ports. memory or peripheral lsis can be connected efficiently with an external memory access support function. this greatly reduces system cost. in addition to the masked-rom versions of the sh7040 series, the sh7042 and sh7043 have a ztat* 1 version with user-programmable on-chip prom and the sh7044 and sh7045 have an f-ztat tm * 2 version with on-chip flash memory. these versions enable users to respond quickly and flexibly to changing application specifications, growing production volumes, and other conditions. notes: 1. ztat (zero turn-around time) is a registered trademark of hitachi, ltd. 2. f-ztat (flexible ztat) is a trademark of hitachi, ltd. 1.1.1 sh7040 series features cpu: ? original hitachi architecture ? 32-bit internal data bus ? general-register machine ? sixteen 32-bit general registers ? three 32-bit control registers ? four 32-bit system registers ? risc-type instruction set
2 ? instruction length: 16-bit fixed length for improved code efficiency ? load-store architecture (basic operations are executed between registers) ? delayed branch instructions reduce pipeline disruption during branch ? instruction set based on c language ? instruction execution time: one instruction/cycle (35 ns/instruction at 28.7-mhz operation) ? address space: architecture supports 4 gbytes ? on-chip multiplier: multiplication operations (32 bits ? 32 bits 64 bits) and multiplication/accumulation operations (32 bits ? 32 bits + 64 bits 64 bits) executed in two to four cycles ? five-stage pipeline cache memory: ? 1-kbyte instruction cache ? caching of instruction codes and pc relative read data ? 4-byte line length (1 longword: 2 instruction lengths) ? 256 entry cache tags ? direct map method ? on-chip rom/ram, and on-chip i/o areas not objects of cache ? used in common with on-chip ram; 2 kbytes of on-chip ram used as address array/data array when cache is enabled interrupt controller (intc): ? nine external interrupt pins (nmi, irq0 irq7 ) ? forty-three internal interrupt sources (forty-four for a mask) ? 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 an on-chip debugger bus state controller (bsc): ? supports external extended memory access ? 16-bit (qfp-112, tqfp-120), or 32-bit (qfp-144) external data bus ? memory address space divided into five areas (four areas of sram space, one area of dram space) with the following settable features: ? bus size (8, 16, or 32 bits) ? number of wait cycles
3 ? outputs chip-select signals for each area ? during dram space access: ? outputs ras and cas signals for dram ? can generate a ras precharge time assurance tp cycle ? dram burst access function ? supports high-speed access mode for dram ? dram refresh function ? programmable refresh interval ? supports cas-before-ras refresh and self-refresh modes ? wait cycles can be inserted using an external wait signal ? address data multiplex i/o devices can be accessed direct memory access controller (dmac) (4 channels): ? supports cycle-steal transfers ? supports dual address transfer mode ? can be switched between direct and indirect transfer modes (channel 3 only) ? direct transfer mode: transfers the data at the transfer source address to the transfer destination address ? indirect transfer mode: regards the data at the transfer source address as an address and transfers the data at that address to the transfer destination address data transfer controller (dtc): ? data transfer independent of the cpu possible through peripheral i/o interrupt requests ? transfer mode can be set for each interrupt factor (transfer mode set in memory) ? multiple data transfers possible for one activating factor ? abundant transfer modes ? normal mode/repeat mode/block transfer mode selectable ? transfer unit can be set to byte/word/longword ? interrupts activating the dtc requested of the cpu ? interrupts can be generated to the cpu after completion of one data transfer ? interrupts can be generated to the cpu after completing all designated data transfers ? transfer can be activated by software multifunction timer/pulse unit (mtu): ? maximum 16 types of waveform output or maximum 16 types of pulse i/o processing possible based on 16-bit timer, 5 channels ? 16 dual-use output compare/input capture registers
4 ? 16 independent comparators ? 8 types of counter input clock ? input capture function ? pulse output mode ? one shot, toggle, pwm, phase-compensated pwm, reset-synchronized pwm ? multiple counter synchronization function ? phase-compensated pwm output mode ? non-overlapping waveform output for 6-phase inverter control ? automatic setting for dead time ? pwm duty cycle can be set from 0 to 100% ? output off function ? reset-synchronized pwm mode ? 3-phase output of any duty cycle positive phase/reverse phase pwm waveforms ? phase calculation mode ? 2-phase encoder calculation processing compare match timer (cmt) (two channels): ? 16-bit free-running counter ? one compare register ? generates an interrupt request upon compare match watchdog timer (wdt) (one channel): ? watchdog timer or interval timer ? count overflow can generate an internal reset, external signal, or interrupt serial communication interface (sci) (two channels): (per channel): ? asynchronous or clock-synchronous mode is selectable ? can transmit and receive simultaneously (full duplex) ? on-chip dedicated baud rate generator ? multiprocessor communication function i/o ports: ? qfp 112 (sh7040, sh7042, sh7044), tqfp-120 (sh7040, sh7042) ? input/output: 74 ? input: 8
5 ? total: 82 ? qfp 144 (sh7041, sh7043, sh7045) ? input/output: 98 ? input: 8 ? total: 106 a/d converter: ? 10 bits 8 channels ? conversion upon external trigger possible ? sample and hold function: two on-chip units (two channels can be sampled simultaneously) ? depending on the product, there is a high speed, mid-accuracy a/d on-chip type and a mid- speed, high accuracy a/d on-chip type. for details, see the product lineup. large capacity on-chip memory: ? rom (128 kbytes prom, 256 kbytes/128 kbytes/64 kbytes mask rom, 256 kbytes flash rom) ? sh7044, sh7045: 256 kbytes (flash rom, mask rom) ? sh7042, sh7043: 128 kbytes (ztat, mask rom) ? sh7040, sh7041: 64 kbytes (mask rom) ? ram: 4 kbytes (2 kbytes when cache is used) operating modes: ? operating modes ? expanded mode with rom disabled ? expanded mode with rom enabled ? single-chip mode ? processing states ? program execution state ? exception processing state ? bus-released state ? power-down modes ? sleep mode ? software standby mode clock pulse generator (cpg): ? on-chip clock pulse generator ? on-chip clock-doubling pll circuit
7 type abbreviation mask version on-chip rom external bus width a/d accuracy (5vversion) package operating temp frequency voltage type name notes on the sh7040 series specifications (for details, see each section in this manual) a/d electrical intc dtc dmac mtu converter rom characteristics ztat sh7042 128 kb 16 bits ?5lsb (high-speed) qfp2020-112 ?0? to 75? 28 mhz 16 mhz 5 v 3.3 v hd6477042f28 hd6477042vf16 see ?igh- speed a/d converter see ?28 kb ztat rom see ?lectrical characteristics sh7042a a mask 128 kb 16 bits ?lsb (mid-speed) qfp2020-112 tqfp1414-120 qfp2020-112cu* ?0? to 75? 28 mhz 16 mhz 16 mhz 33 mhz 28 mhz 16 mhz 5 v 3.3 v 3.3 v 5 v 5 v 3.3 v hd6477042af28 HD6477042AVF16 hd6477042avx16 hd6477042af33 hd6477042acf28 hd6477042avcf16 change the interrupt vectors related a/d converter change the dter access methods and dtc vectors change the setting methods on transfer requests change the usage notes see ?id- speed a/d converter see ?28 kb ztat rom see ?lectrical characteristics sh7043 128 kb 32 bits ?5lsb (high-speed) qfp2020-144 ?0? to 75? 28 mhz 16 mhz 5 v 3.3 v hd6477043f28 hd6477043vf16 see ?igh- speed a/d converter see ?28 kb ztat rom see ?lectrical characteristics sh7043a a mask 128 kb 32 bits ?lsb (mid-speed) qfp2020-144 qfp2020-144cu* ?0? to 75? 28 mhz 16 mhz 33 mhz 28 mhz 16 mhz 5 v 3.3 v 5 v 5 v 3.3 v hd6477043af28 hd6477043avf16 hd6437043af33 hd6437043acf28 hd6437043avcf16 change the interrupt vectors related a/d converter change the dter access methods and dtc vectors change the setting methods on transfer requests change the usage notes see ?id- speed a/d converter see ?28 kb ztat rom see ?lectrical characteristics flash sh7044f a mask 256 kb 16 bits ?lsb (mid-speed) qfp2020-112 ?0? to 75? 28 mhz 5 v hd64f7044f28 change the interrupt vectors related a/d converter change the dter access methods and dtc vectors change the setting methods on transfer requests change the usage notes see ?id- speed a/d converter see ?56 kb flash memory see ?lectrical characteristics sh7045f a mask 256 kb 32 bits ?lsb (mid-speed) qfp2020-144 ?0? to 75? 28 mhz 5 v hd64f7045f28 change the interrupt vectors related a/d converter change the dter access methods and dtc vectors change the setting methods on transfer requests change the usage notes see ?id- speed a/d converter see ?56 kb flash memory see ?lectrical characteristics mask sh7040a a mask 64 kb 16 bits ?lsb (mid-speed) qfp2020-112 tqfp1414-120 qfp2020-112cu* ?0? to 75? 28 mhz 16 mhz 16 mhz 33 mhz 28 mhz 16 mhz 5 v 3.3 v 3.3 v 5 v 5 v 3.3 v hd6437040af28 hd6437040avf16 hd6437040avx16 hd6437040af33 hd6437040acf28 hd6437040avcf16 change the interrupt vectors related a/d converter change the dter access methods and dtc vectors change the setting methods on transfer requests change the usage notes see ?id- speed a/d converter see ?4 kb mask rom see ?lectrical characteristics sh7041a a mask 64 kb 32 bits ?lsb (mid-speed) qfp2020-144 qfp2020-144cu* ?0? to 75? 28 mhz 16 mhz 33 mhz 28 mhz 16 mhz 5 v 3.3 v 5 v 5 v 3.3 v hd6437041af28 hd6437041avf16 hd6437041af33 hd6437041acf28 hd6437041avcf16 change the interrupt vectors related a/d converter change the dter access methods and dtc vectors change the setting methods on transfer requests change the usage notes see ?id- speed a/d converter see ?4 kb mask rom see ?lectrical characteristics sh7042 128 kb 16 bits ?5lsb (high-speed) qfp2020-112 ?0? to 75? 28 mhz 16 mhz 5 v 3.3 v hd6437042f28 hd6437042vf16 see ?igh- speed a/d converter see ?28 kb mask rom see ?lectrical characteristics sh7042a a mask 128 kb 16 bits ?lsb (mid-speed) qfp2020-112 tqfp1414-120 qfp2020-112cu* ?0? to 75? 28 mhz 16 mhz 16 mhz 33 mhz 28 mhz 16 mhz 5 v 3.3 v 3.3 v 5 v 5 v 3.3 v hd6437042af28 hd6437042avf16 hd6437042avx16 hd6437042af33 hd6437042acf28 hd6437042avcf16 change the interrupt vectors related a/d converter change the dter access methods and dtc vectors change the setting methods on transfer requests change the usage notes see ?id- speed a/d converter see ?28 kb mask rom see ?lectrical characteristics sh7043 128 kb 32 bits ?5lsb (high-speed) qfp2020-144 ?0? to 75? 28 mhz 16 mhz 5 v 3.3 v hd6437043f28 hd6437043vf16 see ?igh- speed a/d converter see ?28 kb mask rom see ?lectrical characteristics sh7043a a mask 128 kb 32 bits ?lsb (mid-speed) qfp2020-144 qfp2020-144cu* ?0? to 75? 28 mhz 16 mhz 33 mhz 28 mhz 16 mhz 5 v 3.3 v 5 v 5 v 3.3 v hd6437043af28 hd6437043avf16 hd6437043af33 hd6437043acf28 hd6437043avcf16 change the interrupt vectors related a/d converter change the dter access methods and dtc vectors change the setting methods on transfer requests change the usage notes see ?id- speed a/d converter see ?28 kb mask rom see ?lectrical characteristics
9 type abbreviation mask version on-chip rom external bus width a/d accuracy (5vversion) package operating temp frequency voltage type name notes on the sh7040 series specifications (for details, see each section in this manual) a/d electrical intc dtc dmac mtu converter rom characteristics mask sh7044 a mask 256 kb 16 bits ?lsb (mid-speed) qfp2020-112 ?0? to 75? 28 mhz 5 v hd6437044f28 change the interrupt vectors related a/d converter change the dter access methods and dtc vectors change the setting methods on transfer requests change the usage notes see ?id- speed a/d converter see ?56 kb mask rom see ?lectrical characteristics sh7045 a mask 256kb 32bits ?lsb (mid-speed) qfp2020-144 -20? to 75? 28 mhz 5 v hd6437045f28 change the interrupt vectors related a/d converter change the dter access methods and dtc vectors change the setting methods on transfer requests change the usage notes see ?id- speed a/d converter see ?56 kb mask rom see ?lectrical characteristics rom less sh7040a a mask 16 bits ?lsb (mid-speed) qfp2020-112 qfp2020-112cu* -20? to 75? 28 mhz 16 mhz 33 mhz 28 mhz 16 mhz 5 v 5 v 5 v 5 v 3.3 v hd6417040af28 hd6417040avf16 hd6417040af33 hd6417040acf28 hd6417040avcf16 change the interrupt vectors related a/d converter change the dter access methods and dtc vectors change the setting methods on transfer requests change the usage notes see ?id- speed a/d converter see the ?4 kb mask rom see ?lectrical characteristics sh7041a a mask 32 bits ?lsb (mid-speed) qfp2020-144 qfp2020-144cu* -20? to 75? 28 mhz 16 mhz 33 mhz 28 mhz 16 mhz 5 v 3.3 v 5 v 5 v 3.3 v hd6417041af28 hd6417041avf16 hd6417041af33 hd6417041acf28 hd6417041avcf16 change the interrupt vectors related a/d converter change the dter access methods and dtc vectors change the setting methods on transfer requests change the usage notes see ?id- speed a/d converter see ?4 kb mask rom see ?lectrical characteristics note: package with copper used as the lead material.
11 1.2 block diagram figure 1.1 is a block diagram of the sh7040 series qfp-112 pin and tqfp-120 pin. figure 1.2 is a block diagram of the sh7040 series qfp-144 pin. pc15/a15 pc14/a14 pc13/a13 pc12/a12 pc11/a11 pc10/a10 pc9/a9 pc8/a8 pc7/a7 pc6/a6 pc5/a5 pc4/a4 pc3/a3 pc2/a2 pc1/a1 pc0/a0 pd15/d15 pd14/d14 pd13/d13 pd12/d12 pd11/d11 pd10/d10 pd9/d9 pd8/d8 pd7/d7 pd6/d6 pd5/d5 pd4/d4 pd3/d3 pd2/d2 pd1/d1 pd0/d0 md3 md2 md1 md0 nmi extal xtal v cc /fwp* 1 v cc v cc pllvcc pllcap pllvss v cc v cc v ss v ss v ss v ss v ss v ss v ss v ss av cc av ss res /v pp * 2 wdtovf pb9/ irq7 /a21/ adtrg pb8/ irq6 /a20/ wait pb7/ irq5 /a19/ breq pb6/ irq4 /a18/ back pb5/ irq3 / poe3 /rdwr pb4/ irq2 / poe2 / cash pb3/ irq1 / poe1 / casl pb2/ irq0 / poe0 / ras pb1/a17 pb0/a16 pa15/ck pa14/ rd pa13/ wrh pa12/ wrl pa11/ cs1 pa10/ cs0 pa9/tclkd/ irq3 pa8/tclkc/ irq2 pa7/tclkb/ cs3 pa6/tclka/ cs2 pa5/sck1/ dreq1 / irq 1 pa4/txd1 pa3/rxd1 pa2/sck0/ dreq0 / irq 0 pa1/txd0 pa0/rxd0 pe15/tioc4d/dack1/ irqout pe14/tioc4c/dack0/ ah pe13/tioc4b/ mres pe12/tioc4a pe11/tioc3d pe10/tioc3c pe9/tioc3b pe8/tioc3a pe7/tioc2b pe6/tioc2a pe5/tioc1b pe4/tioc1a pe3/tioc0d/drak1 pe2/tioc0c/ dreq1 pe1/tioc0b/drak0 pe0/tioc0a/ dreq0 : peripheral address bus : peripheral data bus : internal address bus : internal upper data bus : internal lower data bus pll pf7/an7 pf6/an6 pf5/an5 pf4/an4 pf3/an3 pf2/an2 pf1/an1 pf0/an0 flash rom/prom/ mask rom 256kbytes/ 128 kbytes/64 kbytes ram/cache 4 kbytes/1 kbyte cpu data transfer controller direct memory access controller interrupt controller user break bus state controller serial communi- cation interface ( 2 channels) multifunction timer/ pulse unit compare match timer ( 2 channels) a/d converter watch- dog timer v ss v ss v ss notes: 1. v cc in the mask and ztat versions; fwp in the f-ztat version (however, fwe in writer mode) 2. v pp : ztat version only figure 1.1 block diagram of the sh7040, sh7042, sh7044 (qfp-112 pin), sh7040, sh7042 (tqfp-120 pin)
12 pc15/a15 pc14/a14 pc13/a13 pc12/a12 pc11/a11 pc10/a10 pc9/a9 pc8/a8 pc7/a7 pc6/a6 pc5/a5 pc4/a4 pc3/a3 pc2/a2 pc1/a1 pc0/a0 pd15/d15 pd14/d14 pd13/d13 pd12/d12 pd11/d11 pd10/d10 pd9/d9 pd8/d8 pd7/d7 pd6/d6 pd5/d5 pd4/d4 pd3/d3 pd2/d2 pd1/d1 pd0/d0 pd31/d31/ adtrg pd30/d30/ irqout pd29/d29/ cs3 pd28/d28/ cs2 pd27/d27/dack1 pd26/d26/dack0 pd25/d25/ dreq1 pd24/d24/ dreq0 pd23/d23/ irq7 pd22/d22/ irq6 pd21/d21/ irq5 pd20/d20/ irq4 pd19/d19/ irq3 pd18/d18/ irq2 pd17/d17/ irq1 pd16/d16/ irq0 md3 md2 md1 md0 nmi extal xtal pllvcc pllcap pllvss res /v pp * 2 wdtovf pb9/ irq7 /a21/ adtrg pb8/ irq6 /a20/ wait pb7/ irq5 /a19/ breq pb6/ irq4 /a18/ back pb5/ irq3 / poe3 /rdwr pb4/ irq2 / poe2 / cash pb3/ irq1 / poe1 / casl pb2/ irq0 / poe0 / ras pb1/a17 pb0/a16 pa23/ wrhh pa22/ wrhl pa21/ cashh pa20/ cashl pa19/ back /drak1 pa18/ breq /drak0 pa17/ wait pa16/ ah pa15/ck pa14/ rd pa13/ wrh pa12/ wrl pa11/ cs1 pa10/ cs0 pa9/tclkd/ irq3 pa8/tclkc/ irq2 pa7/tclkb/ cs3 pa6/tclka/ cs2 pa5/sck1/ dreq1 / irq1 pa4/txd1 pa3/rxd1 pa2/sck0/ dreq0 / irq0 pa1/txd0 pa0/rxd0 pe15/tioc4d/dack1/ irqout pe14/tioc4c/dack0/ ah pe13/tioc4b/ mres pe12/tioc4a pe11/tioc3d pe10/tioc3c pe9/tioc3b pe8/tioc3a pe7/tioc2b pe6/tioc2a pe5/tioc1b pe4/tioc1a pe3/tioc0d/drak1 pe2/tioc0c/ dreq1 pe1/tioc0b/drak0 pe0/tioc0a/ dreq0 pll pf7/an7 pf6/an6 pf5/an5 pf4/an4 pf3/an3 pf2/an2 pf1/an1 pf0/an0 flash rom/prom/ mask rom 256 kbytes/ 128 kbytes/64 kbytes ram/cache 4 kbytes/1 kbyte cpu data transfer controller direct memory access controller interrupt controller user break bus state controller serial communi- cation interface ( 2 channels) multifunction timer/ pulse unit compare match timer ( 2 channels) a/d converter watch- dog timer v cc /fwp* 1 v cc v cc v cc v cc v cc v cc v cc v cc v ss v ss v ss v ss v ss v ss v ss v ss v ss v ss v ss v ss v ss v ss av ss av ref av cc : peripheral address bus : peripheral data bus : internal address bus : internal upper data bus : internal lower data bus notes: 1. v cc in the mask and ztat versions; fwp in the f-ztat version (however, fwe in writer mode) 2. v pp : ztat version only figure 1.2 block diagram of the sh7041, sh7043, sh7045 (qfp-144 pin)
13 1.3 pin arrangement and pin functions 1.3.1 pin arrangment figure 1.3 shows the pin arrangement for the qfp-112 (top view). pe0/tioc0a/ dreq0 pe1/tioc0b/drak0 pe2/tioc0c/ dreq1 pe3/tioc0d/drak1 pe4/tioc1a v ss pf0/an0 pf1/an1 pf2/an2 pf3/an3 pf4/an4 pf5/an5 av ss pf6/an6 pf7/an7 av cc v ss pe5/tioc1b v cc pe6/tioc2a pe7/tioc2b pe8/tioc3a pe9/tioc3b pe10/tioc3c v ss pe11/tioc3d pe12/tioc4a pb13/tioc4b/ mres 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 res /v pp * 2 pa15/ck pllvss pllcap pllvcc md0 md1 v cc (fwp* 1 ) nmi md2 extal md3 xtal v ss pd0/d0 pd1/d1 pd2/d2 pd3/d3 pd4/d4 v cc pd5/d5 pd6/d6 pd7/d7 v ss pd8/d8 pd9/d9 pd10/d10 pd11/d11 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 pd12/d12 v ss pd13/d13 pd14/d14 pd15/d15 pa0/rxd0 pa1/txd0 pa2/sck0/ dreq0 / irq0 pa3/rxd1 pa4/txd1 pa5/sck1/ dreq1 / irq1 pa7/tclkb/ cs3 pa8/tclkc/ irq2 pa10/ cs0 pa11/ cs1 v ss pa12/ wrl v cc pa13/ wrh wdtovf pa14/ rd v ss pb9/ irq7 /a21/ adtrg pb8/ irq6 /a20/ wait pb7/ irq5 /a19/ breq pb6/ irq4 /a18/ back pa6/tclka/ cs2 pa9/tclkd/ irq3 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 pe14/tioc4c/dack0/ ah pe15/tioc4d/dack1/ irqout v ss pc0/a0 pc1/a1 pc2/a2 pc3/a3 pc4/a4 pc5/a5 pc6/a6 pc7/a7 pc11/a11 pc12/a12 pc13/a13 pc14/a14 pc15/a15 pb0/a16 v cc pb1/a17 pb2/ irq0 / poe0 / ras pb3/ irq1 / poe1 / casl pb4/ irq2 / poe2 / cash v ss pb5/ irq3 / poe3 /rdwr pc8/a8 pc9/a9 pc10/a10 v ss qfp-112 notes: 1. v cc in the mask and ztat versions; fwp in the f-ztat version (however, fwe in writer mode) 2. v pp : ztat version only figure 1.3 sh7040, sh7042, sh7044 pin arrangement (qfp-112 top view)
14 figure 1.4 shows the pin arrangement for the tfp-120 (top view). tqfp-120 pe15/tioc4d/dack1/ irqout vss pc0/a0 pc1/a1 pc2/a2 pc3/a3 pc4/a4 pc5/a5 nc pe14/tioc4c/dack0/ ah pc6/a6 pc7/a7 pc8/a8 pc9/a9 pc10/a10 pc11/a11 pc12/a12 pc13/a13 pc14/a14 pc15/a15 pb0/a16 vcc pb1/a17 vss pb2/ irq0 / poe0 / ras pb3/ irq1 / poe1 / casl pb4/ irq2 / poe2 / cash vss pb5/ irq3 / poe3 /rdwr nc nc pb6/ irq4 /a18/ back pb7/ irq5 /a19/ breq pb8/ irq6 /a20/ wait pb9/ irq7 /a21/ adtrg vss pa14/ rd wdtovf pa13/ wrh vcc pa12/ wrl vss pa11/ cs1 pa10/ cs0 pa9/tclkd/ irq3 pa8/tclkc/ irq2 pa7/tclkb/ cs3 pa6/tclka/ cs2 pa5/sck1/ dreq1 / irq1 pa4/txd1 pa3/rxd1 pa2/sck0/ dreq0 / irq0 pa1/txd0 pa0/rxd0 pd15/d15 pd14/d14 pd13/d13 vss pd12/d12 nc nc res /(vpp * ) pa15/ck pllvss pllcap pllvcc md0 md1 vcc nmi md2 extal md3 xtal vss pd0/d0 pd1/d1 pd2/d2 pd3/d3 pd4/d4 vcc pd5/d5 pd6/d6 pd7/d7 vss pd8/d8 pd9/d9 pd10/d10 pd11/d11 nc nc pe13/tioc4b/ mres pe12/tioc4a pe11/tioc3d vss pe10/tioc3c pe9/tioc3b pe8/tioc3a pe7/tioc2b pe6/tioc2a vcc pe5/tioc1b vss avcc pf7/an7 pf6/an6 avss pf5/an5 pf4/an4 pf3/an3 pf2/an2 pf1/an1 pf0/an0 vss pe4/tioc1a pe3/tioc0d/drak1 pe2/tioc0c/ dreq1 pe1/tioc0b/drak0 nc 120 119 118 117 116 115 114 113 112 111 110 109 108 107 106 105 104 103 102 101 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 pe0/tioc0a/ dreq0 note: * vpp: ztat version only figure 1.4 sh7040, sh7042 pin arrangement (tqfp-120 top view)
15 figure 1.5 shows the pin arrangement for the qfp-144 (top view). 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 pa23/ wrhh pe14/tioc4c/dack0/ ah pa22/ wrhl pa21/ cashh pe15/tioc4d/dack1/ irqout v ss pc0/a0 pc1/a1 pc2/a2 pc3/a3 pc4/a4 pc6/a6 pc7/a7 pc8/a8 pc9/a9 pc10/a10 pc11/a11 pc12/a12 pc13/a13 pc15/a15 pb0/a16 v cc pb1/a17 v ss v cc pc5/a5 v ss pc14/a14 29 30 31 32 33 34 35 36 pa20/ cashl pa19/ back /drak1 pb3/ irq1 / poe1 / casl pa18/ breq /drak0 pb4/ irq2 / poe2 / cash v ss pb5/ irq3 / poe3 /rdwr pb2/ irq0 / poe0 / ras res /v pp * 2 pa15/ck pllvss pllcap pllvcc md0 md1 pa17/ wait pa16/ ah v cc (fwp* 1 ) nmi md2 extal md3 xtal v ss pd0/d0 pd1/d1 pd2/d2 pd3/d3 pd4/d4 v ss pd5/d5 v cc pd6/d6 pd7/d7 pd8/d8 pd9/d9 108 107 106 105 104 103 102 101 100 99 98 94 93 92 91 90 89 88 87 85 84 83 82 81 97 96 95 86 pd10/d10 v ss pd11/d11 v cc pd12/d12 pd13/d13 pd14/d14 pd15/d15 80 79 77 76 75 74 73 78 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 72 pd16/d16/ irq0 v ss pd17/d17/ irq1 pd18/d18/ irq2 pd19/d19/ irq3 pd20/d20/ irq4 pd21/d21/ irq5 pd22/d22/ irq6 pd23/d23/ irq7 v cc pd24/d24/ dreq0 pd27/d27/dack1 pd28/d28/ cs2 pd29/d29/ cs3 v ss pa6/tclka/ cs2 pa7/tclkb/ cs3 pa8/tclkc/ irq2 pa9/tclkd/ irq3 pa11/ cs1 pa12/ wrl pa13/ wrh pd30/d30/ irqout pd31/d31/ adtrg v ss pd25/d25/ dreq1 pd26/d26/dack0 pa10/ cs0 wdtovf pa14/ rd pb9/ irq7 /a21/ adtrg v cc pb8/ irq6 /a20/ wait pb7/ irq5 /a19/ breq pb6/ irq4 /a18/ back v ss 109 110 111 112 113 114 115 116 117 118 119 123 124 125 126 127 128 129 130 132 133 134 135 136 120 121 122 131 pe0/tioc0a/ dreq0 pe1/tioc0b/drak0 pe2/tioc0c/ dreq1 v cc pe3/tioc0d/drak1 pe4/tioc1a pe5/tioc1b pe6/tioc2a v ss pf0/an0 pf1/an1 pf2/an2 pf3/an3 pf4/an4 pf5/an5 av ss pf6/an6 pf7/an7 av ref av cc v ss pa0/rxd0 pa1/txd0 pa2/sck0/ dreq0 / irq0 pa3/rxd1 pa4/txd1 v cc pa5/sck1/ dreq1 / irq1 pe7/tioc2b pe8/tioc3a pe9/tioc3b pe10/tioc3c v ss pe11/tioc3d pe12/tioc4a pe13/tioc4b/ mres 137 138 140 141 142 143 144 139 qfp-144 notes: 1. v cc in the mask and ztat versions; fwp in the f-ztat version (however, fwe in writer mode) 2. v pp : ztat version only figure 1.5 sh7041, sh7043, sh7045 pin arrangement (qfp-144 top view)
16 1.3.2 pin arrangement by mode table 1.2 pin arrangement by mode for sh7040, sh7042 (qfp-112 pin) pin no. mcu mode prom mode 1 pe14/tioc4c/dack0/ ah v cc 2 pe15/tioc4d/dack1/ irqout ce 3v ss v ss 4 pc0/a0 a0 5 pc1/a1 a1 6 pc2/a2 a2 7 pc3/a3 a3 8 pc4/a4 a4 9 pc5/a5 a5 10 pc6/a6 a6 11 pc7/a7 a7 12 pc8/a8 a8 13 pc9/a9 nc 14 pc10/a10 a10 15 pc11/a11 a11 16 pc12/a12 a12 17 pc13/a13 a13 18 pc14/a14 a14 19 pc15/a15 a15 20 pb0/a16 a16 21 v cc v cc 22 pb1/a17 nc 23 v ss v ss 24 pb2/ irq0 / poe0 / ras nc 25 pb3/ irq1 / poe1 / casl oe 26 pb4/ irq2 / poe2 / cash pgm 27 v ss v ss 28 pb5/ irq3 / poe3 /rdwr v cc
17 table 1.2 pin arrangement by mode for sh7040, sh7042 (qfp-112 pin) (cont) pin no. mcu mode prom mode 29 pb6/ irq4 /a18/ back nc 30 pb7/ irq5 /a19/ breq nc 31 pb8/ irq6 /a20/ wait nc 32 pb9/ irq7 /a21/ adtrg nc 33 v ss v ss 34 pa14/ rd nc 35 wdtovf nc 36 pa13/ wrh nc 37 v cc v cc 38 pa12/ wrl nc 39 v ss v ss 40 pa11/ cs1 nc 41 pa10/ cs0 nc 42 pa9/tclkd/ irq3 nc 43 pa8/tclkc/ irq2 nc 44 pa7/tclkb/ cs3 nc 45 pa6/tclka/ cs2 nc 46 pa5/sck1/ dreq1 / irqi nc 47 pa4/txd1 nc 48 pa3 /rxd1 nc 49 pa2/sck0/ dreq0 / irq0 nc 50 pa1/txd0 nc 51 pa0/rxd0 nc 52 pd15/d15 nc 53 pd14/d14 nc 54 pd13/d13 nc 55 v ss v ss 56 pd12/d12 nc 57 pd11/d11 nc 58 pd10/d10 nc
18 table 1.2 pin arrangement by mode for sh7040, sh7042 (qfp-112 pin) (cont) pin no. mcu mode prom mode 59 pd9/d9 nc 60 pd8/d8 nc 61 v ss v ss 62 pd7/d7 d7 63 pd6/d6 d6 64 pd5/d5 d5 65 v cc v cc 66 pd4/d4 d4 67 pd3/d3 d3 68 pd2/d2 d2 69 pd1/d1 d1 70 pd0/d0 d0 71 v ss v ss 72 xtal nc 73 md3 v cc 74 extal v ss 75 md2 v cc 76 nmi a9 77 v cc v cc 78 md1 v cc 79 md0 v cc 80 pllvcc v cc 81 pllcap v ss 82 pllvss v ss 83 pa15/ck nc 84 res v pp 85 pe0/tioc0a/ dreq0 nc 86 pe1/tioc0b/drak0 nc 87 pe2/tioc0c/ dreq1 nc 88 pe3/tioc0d/drak1 nc
19 table 1.2 pin arrangement by mode for sh7040, sh7042 (qfp-112 pin) (cont) pin no. mcu mode prom mode 89 pe4/tioc1a nc 90 v ss v ss 91 pf0/an0 v ss 92 pf1/an1 v ss 93 pf2/an2 v ss 94 pf3/an3 v ss 95 pf4/an4 v ss 96 pf5/an5 v ss 97 av ss v ss 98 pf6/an6 v ss 99 pf7/an7 v ss 100 av cc v cc 101 v ss v ss 102 pe5/tioc1b nc 103 v cc v cc 104 pe6/tioc2a nc 105 pe7/tioc2b nc 106 pe8/tioc3a nc 107 pe9/tioc3b nc 108 pe10/tioc3c nc 109 v ss v ss 110 pe11/tioc3d nc 111 pe12/tioc4a nc 112 pe13/tioc4b/ mres nc
20 table 1.3 pin arrangement by mode for sh7040, sh7042 (tqfp-120 pin) tqfp120 pin no. mcu mode prom mode 1nc nc 2 pe14/tioc4c/dack0/ ah v cc 3 pe15/tioc4d/dack1/ irqout ce 4v ss v ss 5 pc0/a0 a0 6 pc1/a1 a1 7 pc2/a2 a2 8 pc3/a3 a3 9 pc4/a4 a4 10 pc5/a5 a5 11 pc6/a6 a6 12 pc7/a7 a7 13 pc8/a8 a8 14 pc9/a9 nc 15 pc10/a10 a10 16 pc11/a11 a11 17 pc12/a12 a12 18 pc13/a13 a13 19 pc14/a14 a14 20 pc15/a15 a15 21 pb0/a16 a16 22 v cc v cc 23 pb1/a17 nc 24 v ss v ss 25 pb2/ irq0 / poe0 / ras nc 26 pb3/ irq1 / poe1 / casl oe 27 pb4/ irq2 / poe2 / cash pgm 28 v ss v ss 29 pb5/ irq3 / poe3 /rdwr v cc 30 nc nc 31 nc nc
21 table 1.3 pin arrangement by mode for sh7040, sh7042 (tqfp-120 pin) (cont) tqfp120 pin no. mcu mode prom mode 32 pb6/ irq4 /a18/ back nc 33 pb7/ irq5 /a19/ breq nc 34 pb8/ irq6 /a20/ wait nc 35 pb9/ irq7 /a21/ adtrg nc 36 v ss v ss 37 pa14/ rd nc 38 wdtovf nc 39 pa13/ wrh nc 40 v cc v cc 41 pa12/ wrl nc 42 v ss v ss 43 pa11/ cs1 nc 44 pa10/ cs0 nc 45 pa9/tclkd/ irq3 nc 46 pa8/tclkc/ irq2 nc 47 pa7/tclkb/ cs3 nc 48 pa6/tclka/ cs2 nc 49 pa5/sck1/ dreq1 / irq1 nc 50 pa4/txd1 nc 51 pa3/rxd2 nc 52 pa2/sck0/ dreq0 / irq0 nc 53 pa1/txd0 nc 54 pa0/rxd0 nc 55 pd15/d15 nc 56 pd14/d14 nc 57 pd13/d13 nc 58 v ss v ss 59 pd12/d12 nc 60 nc nc 61 nc nc 62 pd11/d11 nc
22 table 1.3 pin arrangement by mode for sh7040, sh7042 (tqfp-120 pin) (cont) tqfp120 pin no. mcu mode prom mode 63 pd10/d10 nc 64 pd9/d9 nc 65 pd8/d8 nc 66 v ss v ss 67 pd7/d7 d7 68 pd6/d6 d6 69 pd5/d5 d5 70 v cc v cc 71 pd4/d4 d4 72 pd3/d3 d3 73 pd2/d2 d2 74 pd1/d1 d1 75 pd0/d0 d0 76 v ss v ss 77 xtal nc 78 md3 v cc 79 extal v ss 80 md2 v cc 81 nmi a9 82 v cc v cc 83 md1 v cc 84 md0 v cc 85 pllv cc v cc 86 pllcap v ss 87 pllv ss v ss 88 pa15/ck nc 89 res v pp 90 nc nc 91 nc nc 92 pe0/tioc0a/ dreq0 nc 93 pe1/tioc0b/ drak0 nc
23 table 1.3 pin arrangement by mode for sh7040, sh7042 (tqfp-120 pin) (cont) tqfp120 pin no. mcu mode prom mode 94 pe2/tioc0c/ dreq1 nc 95 pe3/tioc0d/ drak1 nc 96 pe4/tioc1a nc 97 v ss v ss 98 pf0/an0 v ss 99 pf1/an1 v ss 100 pf2/an2 v ss 101 pf3/an3 v ss 102 pf4/an4 v ss 103 pf5/an5 v ss 104 av ss v ss 105 pf6/an6 v ss 106 pf7/an7 v ss 107 av cc v cc 108 v ss v ss 109 pe5/tioc1b nc 110 nc nc 111 v cc v cc 112 pe6/tioc2a nc 113 pe7/tioc2b nc 114 pe8/tioc3a nc 115 pe9/tioc3b nc 116 pe10/tioc3c nc 117 v ss v ss 118 pe11/tioc3d nc 119 pe12/tioc4a nc 120 pe13/tioc4b/ mres nc
24 table 1.4 pin arrangement by mode for sh7041, sh7043 (qfp-144 pin) pin no. mcu mode prom mode 1 pa23/ wrhh nc 2 pe14/tioc4c/dack0/ ah v cc 3 pa22/ wrhl nc 4 pa21/ cashh nc 5 pe15/tioc4d/dack1/ irqout ce 6v ss v ss 7 pc0/a0 a0 8 pc1/a1 a1 9 pc2/a2 a2 10 pc3/a3 a3 11 pc4/a4 a4 12 v cc v cc 13 pc5/a5 a5 14 v ss v ss 15 pc6/a6 a6 16 pc7/a7 a7 17 pc8/a8 a8 18 pc9/a9 nc 19 pc10/a10 a10 20 pc11/a11 a11 21 pc12/a12 a12 22 pc13/a13 a13 23 pc14/a14 a14 24 pc15/a15 a15 25 pb0/a16 a16 26 v cc v cc 27 pb1/a17 nc 28 v ss v ss 29 pa20/ cashl nc 30 pa19/ back /drak1 nc
25 table 1.4 pin arrangement by mode for sh7041, sh7043 (qfp-144 pin) (cont) pin no. mcu mode prom mode 31 pb2/ irq0 / poe0 / ras nc 32 pb3/ irq1 / poe1 / casl oe 33 pa18/ breq /drak0 nc 34 pb4/ irq2 / poe2 / cash pgm 35 v ss v ss 36 pb5/ irq3 / poe3 /rdwr v cc 37 pb6/ irq4 /a18/ back nc 38 pb7/ irq5 /a19/ breq nc 39 pb8/ irq6 /a20/ wait nc 40 v cc v cc 41 pb9/ irq7 /a21/ adtrg nc 42 v ss v ss 43 pa14/ rd nc 44 wdtovf nc 45 pd31/d31/ adtrg nc 46 pd30/d30/ irqout nc 47 pa13/ wrh nc 48 pa12/ wrl nc 49 pa11/ cs1 nc 50 pa10/ cs0 nc 51 pa9/tclkd/ irq3 nc 52 pa8/tclkc/ irq2 nc 53 pa7/tclkb/ cs3 nc 54 pa6/tclka/ cs2 nc 55 v ss v ss 56 pd29/d29/ cs3 nc 57 pd28/d28/ cs2 nc 58 pd27/d27/dack1 nc 59 pd26/d26/dack0 nc 60 pd25/d25/ dreq1 nc
26 table 1.4 pin arrangement by mode for sh7041, sh7043 (qfp-144 pin) (cont) pin no. mcu mode prom mode 61 v ss v ss 62 pd24/d24/ dreq0 nc 63 v cc v cc 64 pd23/d23/ irq7 nc 65 pd22/d22/ irq6 nc 66 pd21/d21/ irq5 nc 67 pd20/d20/ irq4 nc 68 pd19/d19/ irq3 nc 69 pd18/d18/ irq2 nc 70 pd17/d17/ irq1 nc 71 v ss v ss 72 pd16/d16/ irq0 nc 73 pd15/d15 nc 74 pd14/d14 nc 75 pd13/d13 nc 76 pd12/d12 nc 77 v cc v cc 78 pd11/d11 nc 79 v ss v ss 80 pd10/d10 nc 81 pd9/d9 nc 82 pd8/d8 nc 83 pd7/d7 d7 84 pd6/d6 d6 85 v cc v cc 86 pd5 /d5 d5 87 v ss v ss 88 pd4/d4 d4 89 pd3/d3 d3 90 pd2/d2 d2
27 table 1.4 pin arrangement by mode for sh7041, sh7043 (qfp-144 pin) (cont) pin no. mcu mode prom mode 91 pd1/d1 d1 92 pd0/d0 d0 93 v ss v ss 94 xtal nc 95 md3 v cc 96 extal v ss 97 md2 v cc 98 nmi a9 99 v cc v cc 100 pa16/ ah nc 101 pa17/ wait nc 102 md1 v cc 103 md0 v cc 104 pllvcc v cc 105 pllcap v ss 106 pllvss v ss 107 pa15/ck nc 108 res v pp 109 pe0/tioc0a/ dreq0 nc 110 pe1/tioc0b/drak0 nc 111 pe2/tioc0c/ dreq1 nc 112 v cc v cc 113 pe3/tioc0d/drak1 nc 114 pe4/tioc1a nc 115 pe5/tioc1b nc 116 pe6/tioc2a nc 117 v ss v ss 118 pf0/an0 v ss 119 pf1/an1 v ss 120 pf2/an2 v ss
28 table 1.4 pin arrangement by mode for sh7041, sh7043 (qfp-144 pin) (cont) pin no. mcu mode prom mode 121 pf3/an3 v ss 122 pf4/an4 v ss 123 pf5/an5 v ss 124 av ss v ss 125 pf6/an6 v ss 126 pf7/an7 v ss 127 avref v cc 128 av cc v cc 129 v ss v ss 130 pa0/rxd0 nc 131 pa1/txd0 nc 132 pa2/sck0/ dreq0 / ireq0 nc 133 pa3/rxd1 nc 134 pa4/txd1 nc 135 v cc v cc 136 pa5 /sck1/ dreq1 / ireq1 nc 137 pe7/tioc2b nc 138 pe8/tioc3a nc 139 pe9/tioc3b nc 140 pe10/tioc3c nc 141 v ss v ss 142 pe11/tioc3d nc 143 pe12/tioc4a nc 144 pe13/tioc4b / mres nc
29 table 1.5 pin arrangement by mode for sh7044 (qfp-112 pin) pinno. mcu writer mode 1 pe14/tioc4c/dack0/ ah nc 2 pe15/tioc4d/dack1/ irqout nc 3v ss v ss 4 pc0/a0 a0 5 pc1/a1 a1 6 pc2/a2 a2 7 pc3/a3 a3 8 pc4/a4 a4 9 pc5/a5 a5 10 pc6/a6 a6 11 pc7/a7 a7 12 pc8/a8 a8 13 pc9/a9 a9 14 pc10/a10 a10 15 pc11/a11 a11 16 pc12/a12 a12 17 pc13/a13 a13 18 pc14/a14 a14 19 pc15/a15 a15 20 pb0/a16 a16 21 v cc v cc 22 pb1/a17 nc 23 v ss v ss 24 pb2/ irq0 / poe0 / ras nc 25 pb3/ irq1 / poe1 / casl nc 26 pb4/ irq2 / poe2 / cash a17 27 v ss v ss 28 pb5/ irq3 / poe3 /rdwr nc 29 pb6/ irq4 /a18/ back nc 30 pb7/ irq5 /a19/ breq nc 31 pb8/ irq6 /a20/ wait nc 32 pb9/ irq7 /a21/ adtrg nc
30 table 1.5 pin arrangement by mode for sh7044 (qfp-112 pin) (cont) pinno. mcu writer mode 33 v ss v ss 34 pa14/ rd nc 35 wdtovf nc 36 pa13/ wrh nc 37 v cc v cc 38 pa12/ wrl nc 39 v ss v ss 40 pa11/ cs1 nc 41 pa10/ cs0 nc 42 pa9/tclkd/ irq3 ce 43 pa8/tclkc/ irq2 oe 44 pa7/tclkb/ cs3 we 45 pa6/tclka/ cs2 nc 46 pa5/sck1/ dreq1 / irq1 v cc 47 pa4/txd1 nc 48 pa3/rxd1 nc 49 pa2/sck0/ dreq0 / irq0 v cc 50 pa1/txd0 v cc 51 pa0/rxd0 nc 52 pd15/d15 nc 53 pd14/d14 nc 54 pd13/d13 nc 55 v ss v ss 56 pd12/d12 nc 57 pd11/d11 nc 58 pd10/d10 nc 59 pd9/d9 nc 60 pd8/d8 nc 61 v ss v ss 62 pd7/d7 d7 63 pd6/d6 d6 64 pd5/d5 d5
31 table 1.5 pin arrangement by mode for sh7044 (qfp-112 pin) (cont) pinno. mcu writer mode 65 v cc v cc 66 pd4/d4 d4 67 pd3/d3 d3 68 pd2/d2 d2 69 pd1/d1 d1 70 pd0/d0 d0 71 v ss v ss 72 xtal xtal 73 md3 md3 74 extal extal 75 md2 md2 76 nmi v cc 77 v cc (fwp) * fwe 78 md1 md1 79 md0 md0 80 pllv cc pllv cc 81 pllcap pllcap 82 pllv ss pllv ss 83 pa15/ck nc 84 res res 85 pe0/tioca/ dreq0 nc 86 pe1/tiocb/drak0 nc 87 pe2/tiocc/ dreq1 nc 88 pe3/tiocd/drak1 nc 89 pe4/tioc1a nc 90 v ss v ss 91 pf0/an0 v ss 92 pf1/an1 v ss 93 pf2/an2 v ss 94 pf3/an3 v ss 95 pf4/an4 v ss 96 pf5/an5 v ss note: * v cc in the mask version; fwp in the f-ztat version (however, fwe in the writer mode)
32 table 1.5 pin arrangement by mode for sh7044 (qfp-112 pin) (cont) pinno. mcu writer mode 97 av ss v ss 98 pf6/an6 v ss 99 pf7/an7 v ss 100 av cc v cc 101 v ss v ss 102 pe5/tioc1b nc 103 v cc v cc 104 pe6/tioc2a nc 105 pe7/tioc2b nc 106 pe8/tioc3a nc 107 pe9/tioc3b nc 108 pe10/tioc3c nc 109 v ss v ss 110 pe11/tioc3d nc 111 pe12/tioc4a nc 112 pe13/tioc4b/ mres nc
33 table 1.6 pin arrangement by mode for sh7045 (qfp-144 pin) pinno. mcu writer mode 1 pa23/ wrhh nc 2 pe14/tioc4c/dack0/ ah nc 3 pa22/ wrhl nc 4 pa21/ cashh nc 5 pe15/tioc4d/dack1/ irqout nc 6v ss v ss 7 pc0/a0 a0 8 pc1/a1 a1 9 pc2/a2 a2 10 pc3/a3 a3 11 pc4/a4 a4 12 v cc v cc 13 pc5/a5 a5 14 v ss v ss 15 pc6/a6 a6 16 pc7/a7 a7 17 pc8/a8 a8 18 pc9/a9 a9 19 pc10/a10 a10 20 pc11/a11 a11 21 pc12/a12 a12 22 pc13/a13 a13 23 pc14/a14 a14 24 pc15/a15 a15 25 pb0/a16 a16 26 v cc v cc 27 pb1/a17 nc 28 v ss v ss 29 pa20/ cashl nc 30 pa19/ back /drak1 nc 31 pb2/ irq0 / poe0 / ras nc 32 pb3/ irq1 / poe1 / casl nc 33 pa18/ breq /drak0 nc 34 pb4/ irq2 / poe2 / cash a17 35 v ss v ss 36 pb5/ irq3 / poe3 /rdwr nc
34 table 1.6 pin arrangement by mode for sh7045 (qfp-144 pin) (cont) pinno. mcu writer mode 37 pb6/ irq4 /a18/ back nc 38 pb7/ irq5 /a19/ breq nc 39 pb8/ irq6 /a20/ wait nc 40 v cc v cc 41 pb9/ irq7 /a21/ adtrg nc 42 v ss v ss 43 pa14/ rd nc 44 wdtovf nc 45 pd31/d31/ adtrg nc 46 pd30/d30/ irqout nc 47 pa13/ wrh nc 48 pa12/ wrl nc 49 pa11/ cs1 nc 50 pa10/ cs0 nc 51 pa9/tclkd/ irq3 ce 52 pa8/tclkc/ irq2 oe 53 pa7/tclkb/ cs3 we 54 pa6/tclka/ cs2 nc 55 v ss v ss 56 pd29/d29/ cs3 nc 57 pd28/d28/ cs2 nc 58 pd27/d27/dack1 nc 59 pd26/d26/dack0 nc 60 pd25/d25/ dreq1 nc 61 v ss v ss 62 pd24/d24/ dreq0 nc 63 v cc v cc 64 pd23/d23/ irq7 nc 65 pd22/d22/ irq6 nc 66 pd21/d21/ irq5 nc 67 pd20/d20/ irq4 nc 68 pd19/d19/ irq3 nc 69 pd18/d18/ irq2 nc 70 pd17/d17/ irq1 nc 71 v ss v ss 72 pd16/d16/ irq0 nc
35 table 1.6 pin arrangement by mode for sh7045 (qfp-144 pin) (cont) pinno. mcu writer mode 73 pd15/d15 nc 74 pd14/d14 nc 75 pd13/d13 nc 76 pd12/d12 nc 77 v cc v cc 78 pd11/d11 nc 79 v ss v ss 80 pd10/d10 nc 81 pd9/d9 nc 82 pd8/d8 nc 83 pd7/d7 d7 84 pd6/d6 d6 85 v cc v cc 86 pd5/d5 d5 87 v ss v ss 88 pd4/d4 d4 89 pd3/d3 d3 90 pd2/d2 d2 91 pd1/d1 d1 92 pd0/d0 d0 93 v ss v ss 94 xtal xtal 95 md3 md3 96 extal extal 97 md2 md2 98 nmi v cc 99 v cc (fwp)* fwe 100 pa16/ ah nc 101 pa17/ wait nc 102 md1 md1 103 md0 md0 104 pllv cc pllv cc 105 pllcap pllcap 106 pllv ss pllv ss 107 pa15/ck nc note: * v cc in the mask version; fwp in the f-ztat version (however, fwe in the writer mode)
36 table 1.6 pin arrangement by mode for sh7045 (qfp-144 pin) (cont) pinno. mcu writer mode 108 res res 109 pe0/tioc0a/ dreq0 nc 110 pe1/tioc0b/drak0 nc 111 pe2/tioc0c/ dreq1 nc 112 v cc v cc 113 pe3/tioc0d/drak1 nc 114 pe4/tioc1a nc 115 pe5/tioc1b nc 116 pe6/tioc2a nc 117 v ss v ss 118 pf0/an0 v ss 119 pf1/an1 v ss 120 pf2/an2 v ss 121 pf3/an3 v ss 122 pf4/an4 v ss 123 pf5/an5 v ss 124 av ss v ss 125 pf6/an6 v ss 126 pf7/an7 v ss 127 avref v cc 128 av cc v cc 129 v ss v ss 130 pa0/rxd0 nc 131 pa1/txd0 v cc 132 pa2/sck0/ dreq0 / irq0 v cc 133 pa3/rxd1 nc 134 pa4/txd1 nc 135 v cc v cc 136 pa5/sck1/ dreq1 / irq1 v cc 137 pe7/tioc2b nc 138 pe8/tioc3a nc 139 pe9/tioc3b nc 140 pe10/tioc3c nc 141 v ss v ss 142 pe11/tioc3d nc 143 pe12/tioc4a nc 144 pe13/tioc4b/ mres nc
37 1.3.3 pin functions table 1.7 lists the pin functions. table 1.7 pin functions classification symbol i/o name function power supply v cc i supply connects to power supply. connect all v cc pins to the system supply. no operation will occur if there are any open pins. v ss i ground connects to ground. connect all v ss pins to the system ground. no operation will occur if there are any open pins. v pp i program supply connects to the power supply (v cc ) during normal operation. when in prom mode, apply 12.5 v. clock pllvcc i pll supply on-chip pll oscillator supply. pllvss i pll ground on-chip pll oscillator ground. pllcap i pll capacitance on-chip pll oscillator external capacitance connection pin. extal i external clock connect a crystal oscillator. also, an external clock can be input to the extal pin. xtal i crystal connect a crystal oscillator. ck o system clock supplies the system clock to peripheral devices. system control res i power-on reset power-on reset when low mres i manual reset manual reset when low wdtovf o watchdog timer overflow overflow output signal from wdt breq i bus request goes low when external device requests bus right release back o bus request acknowledge indicates that bus right has been released to external device. the device that output the breq signal receives the back signal, notifying the device that it has obtained the bus right.
38 table 1.7 pin functions (cont) classification symbol i/o name function operating mode control md0?d3 i mode set determines the operating mode. do not change input value during operation. fwp i flash memory write protect protects flash memory from being written or deleted. interrupts nmi i non-maskable interrupt non-maskable interrupt request pin. enables selection of whether to accept on the rising or falling edge. irq0 irq7 i interrupt requests 0? maskable interrupt request pins. allows selection of level input and edge input. irqout o interrupt request output indicates that interrupt cause has occurred. enables notification of interrupt generation also during bus release. address bus a0?21 o address bus outputs addresses. data bus d0?15 (qfp-112) d0?31 (qfp-144) i/o data bus 16-bit (qfp-112 pin and tqfp-120 pin versions) or 32-bit (qfp-144 pin version) bidirectional data bus. bus control cs0 cs3 o chip selects 0? chip select signals for external memory or devices. rd o read indicates reading from an external device. wrh o upper write indicates writing the upper 8 bits (15?) of external data. wrl o lower write indicates writing the lower 8 bits (7?) of external data. wait i wait input causes insertion of wait cycles into the bus cycle during external space access. ras o row address strobe timing signal for dram row address strobe. cash o upper column address strobe timing signal for dram column address strobe. output when the upper 8 bits of data are accessed.
39 table 1.7 pin functions (cont) classification symbol i/o name function bus control (cont) casl o lower column address strobe timing signal for dram column address strobe. output when the lower 8 bits of data are accessed. rdwr o dram read/write dram write strobe signal. ah o address hold address hold timing signal for devices using an address/data multiplex bus. wrhh (qfp-144) o hh write indicates the writing of bits 31 to 24 of external data. wrhl (qfp-144) o hl write indicates the writing of bits 23 to 16 of external data. cashh (qfp-144) o hh column address strobe timing signal for dram column address strobe. output when bits 31 to 24 of data are accessed. cashl (qfp-144) o hl column address strobe timing signal for dram column address strobe. output when bits 23 to 16 of data are accessed. bus control multifunction timer/pulse unit tclka tclkb tclkc tclkd i mtu timer clock input input pins for external clocks to the mtu counter. tioc0a tioc0b tioc0c tioc0d i/o mtu input capture/ output compare (channel 0) channel 0 input capture input/output compare output/pwm output pins. tioc1a tioc1b i/o mtu input capture/output compare (channel 1) channel 1 input capture input/output compare output/pwm output pins. tioc2a tioc2b i/o mtu input capture/output compare (channel 2) channel 2 input capture input/output compare output/pwm output pins.
40 table 1.7 pin functions (cont) classification symbol i/o name function bus control multifunction timer/pulse unit (cont) tioc3a tioc3b tioc3c tioc3d i/o mtu input capture/output compare (channel 3) channel 3 input capture input/output compare output/pwm output pins. tioc4a tioc4b tioc4c tioc4d i/o mtu input capture/output compare (channel 4) channel 4 input capture input/output compare output/pwm output pins. direct memory access controller (dmac) dreq0 dreq1 i dma transfer request (channels 0, 1) input pin for external requests for dma transfer. drak0 drak1 o dreq request acknowledgment (channels 0, 1) output the input sampling acknowledgment of external dma transfer requests. dack0 dack1 o dma transfer strobe (channels 0, 1) output a strobe to the external i/o of external dma transfer requests. serial communication interface (sci) txd0 txd1 o transmit data (channels 0, 1) sci0, sci1 transmit data output pins. (txd1 is used for data transfer during boot mode of f-ztat) rxd0 rxd1 i receive data (channels 0, 1) sci0, sci1 receive data input pins. (rxd1 is used for data transfer during boot mode of f-ztat) sck0 sck1 i/o serial clock (channels 0, 1) sci0, sci1 clock input/output pins. a/d converter av cc i analog supply analog supply; connected to v cc . av ss i analog ground analog supply; connected to v ss . avref (qfp-144 only) i analog reference supply analog reference supply input pin. (connected to av cc internally in qfp-112 and tqfp-120.) an0?n7 i analog input analog signal input pins. adtrg i a/d conversion trigger input external trigger input for a/d conversion start.
41 table 1.7 pin functions (cont) classification symbol i/o name function i/o ports poe0 poe3 i port output enable input pin for port pin drive control when general use ports are established as output. pa0 pa15 (qfp-112) pa0 pa23 (qfp-144) i/o general purpose port general purpose input/output port pins. each bit can be designated for input/output. pb0?b9 i/o general purpose port general purpose input/output port pins. each bit can be designated for input/output. pc0 pc15 i/o general purpose port general purpose input/output port pins. each bit can be designated for input/output. pd0 pd15 (qfp-112) pd0 pd31 (qfp-144) i/o general purpose port general purpose input/output port pins. each bit can be designated for input/output. pe0 pe15 i/o general purpose port general purpose input/output port pins. each bit can be designated for input/output. pf0?f7 i general purpose port general purpose input port pins. usage notes 1. unused input pins should be pulled up or pulled down. 2. the wdtovf pin should not be pulled down in the sh7044/sh7045 f-ztat version. however, if it is necessary to pull this pin down, a resistance of 100 k or higher should be used.
42 1.4 the f-ztat version onboard programming there are 2 modes on the f-ztat version: a mode that writes and overwrites programs using the special writer and a mode that writes and overwrites programs onboard the application system. when rebooting after setting each mode pin and fwp pin during the reset condition, the microcomputer will transfer to one of the modes indicated in figure 1.6. in the user mode, data can be read from the flash memory but cannot be written or deleted. use the boot mode and the user program mode to write to the flash memory or delete data. in the boot mode, sci1 (txd1, rxd1) is used for data transfer. it is possible to automatically adjust the transfer bit rate to the transfer bit rate of the host. table 1.8 pins during the onboard programming mode notation i/o function fwp input hardware protected flash memory write/delete md1 input user programming mode/boot mode setting md2 input clock mode (pll) setting md3 input clock mode (pll) setting txd1 output serial sent data output rxd1 input serial receive data input user mode power-on reset condition user program mode boot mode onboard programming mode * * fwp=1 md1=1, fwp=1 res =0 md1=1, fwp=0 res =0 fwp=0 md1=1, fwp=0 res =0 note: for transferring between user mode and user program mode, proceed while cpu is not accessing the flash memory. * ram emulation permitted figure 1.6 condition transfer for flash memory
43 write control program write control program area boot program area application program application program rxd1 txd1 boot program sci 1 figure. 1.7 data transfer during boot mode
45 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. 2.1.1 general registers (rn) the sixteen 32-bit general registers (rn) are numbered r0?15. general registers are used for data processing and address calculation. r0 is also used as an index register. several instructions have r0 fixed as their only usable register. r15 is used as the hardware stack pointer (sp). saving and recovering the status register (sr) and program counter (pc) in exception processing is accomplished by referencing the stack using r15. figure 2.1 shows the general registers. r0* 1 r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 r11 r12 r13 r14 r15, sp (hardware stack pointer)* 2 0 31 1. 2. r0 functions as an index register in the indirect indexed register addressing mode and indirect indexed gbr addressing mode. in some instructions, r0 functions as a fixed source register or destination register. r15 functions as a hardware stack pointer (sp) during exception processing. notes: figure 2.1 general registers
46 2.1.2 control registers the 32-bit 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 base address for the indirect gbr addressing mode to transfer data to the registers of on-chip peripheral modules. the vector base register functions as the base address of the exception processing vector area (including interrupts). figure 2.2 shows a control register. 9876543210 mqi3 i2 i1 i0 st 0 0 31 31 gbr vbr sr 31 s bit: used by the mac instruction. reserved bits. this bit always read 0. the write value should always be 0. reserved bits. 0 is read. write only. bits i0?3: interrupt mask bits. m and q bits: used by the div0u, div0s, and div1 instructions. global base register (gbr): indicates the base address of the indirect gbr addressing mode. the indirect gbr addressing mode is used in data transfer for on-chip peripheral modules register areas and in logic operations. vector base register (vbr): stores the base address of the exception processing vector area. sr: status register t bit: the movt, cmp/cond, tas, tst, bt (bt/s), bf (bf/s), sett, and clrt instructions use the t bit to indicate true (1) or false (0). the addv, addc, subv, subc, div0u, div0s, div1, negc, shar, shal, shlr, shll, rotr, rotl, rotcr, and rotcl instructions also use the t bit to indicate carry/borrow or overflow/underflow. figure 2.2 control registers
47 2.1.3 system registers system registers consist of four 32-bit registers: high and low multiply and accumulate registers (mach and macl), the procedure register (pr), and the 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. figure 2.3 shows a system register. macl pr pc mach 31 0 0 0 31 31 multiply and accumulate (mac) registers high and low (mach, macl): stores the results of multiply and accumulate operations. procedure register (pr): stores a return address from a subroutine procedure. program counter (pc): indicates the 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 registers r0?14 undefined r15 (sp) value of the stack pointer in the vector address table control registers sr bits i3?0 are 1111 (h'f), reserved bits are 0, and other bits are undefined gbr undefined vbr h'00000000 system registers mach, macl, pr undefined pc value of the program counter in the vector address table
48 2.2 data formats 2.2.1 data format in registers register operands are always longwords (32 bits). when the memory operand is only a byte (8 bits) or a word (16 bits), it is sign-extended into a longword when loaded into a register (figure 2.4). 31 0 longword figure 2.4 longword operand 2.2.2 data format in memory memory data formats are classified into bytes, words, and longwords. 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 longword data starting from an address other than 4n. in such cases, the data accessed cannot be guaranteed. the hardware stack area, referred to by the hardware stack pointer (sp, r15), uses only longword data starting from address 4n because this area holds the program counter and status register (figure 2.5). 31 0 15 23 7 byte byte byte byte word word address 2n address 4n longword address m address m + 2 address m + 1 address m + 3 figure 2.5 byte, word, and longword alignment 2.2.3 immediate data format byte (8-bit) immediate data resides in an instruction code. immediate data accessed by the mov, add, and cmp/eq instructions is sign-extended and handled in registers as longword data. immediate data accessed by the tst, and, or, and xor instructions is zero-extended and handled as longword data. consequently, and instructions with immediate data always clear the upper 24-bits of the destination register.
49 word or longword immediate data is not located in the instruction code, but instead is stored in a memory table. an immediate data transfer instruction (mov) accesses the memory table using the pc relative addressing mode with displacement. 2.3 instruction features 2.3.1 risc-type instruction set all instructions are risc type. this section details their functions. 16-bit fixed length : all instructions are 16 bits long, increasing program code efficiency. one instruction per cycle : the microprocessor can execute basic instructions in one cycle using the pipeline system. instructions are executed in 35 ns at 28.7 mhz. data length : longword is the standard data length for all operations. memory can be accessed in bytes, words, or longwords. byte or word data accessed from memory is sign-extended and handled as longword data. immediate data is sign-extended for arithmetic operations or zero- extended for logic operations. it also is handled as longword data (table 2.2). table 2.2 sign extension of word data sh7040 series cpu description example of conventional cpu mov.w @(disp,pc),r1 add r1,r0 ......... .data.w h'1234 data is sign-extended to 32 bits, and r1 becomes h'00001234. it is next operated upon by an add instruction. add.w #h'1234,r0 note: @(disp, pc) accesses the immediate data. load-store architecture : basic operations are executed between registers. for operations that involve memory access, 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. executing the instruction that follows the branch instruction and then branching reduces pipeline disruption during branching (table 2.3). there are two types of conditional branch instructions: delayed branch instructions and ordinary branch instructions.
50 table 2.3 delayed branch instructions sh7040 series cpu description example of conventional cpu bra trget add r1,r0 executes an add before branching to trget add.w r1,r0 bra trget multiplication/accumulation operation : 16-bit 16-bit 32-bit multiplication operations are executed in one to two cycles. 16-bit 16-bit + 64-bit 64-bit multiplication/accumulation operations are executed in two to three cycles. 32-bit 32-bit 64-bit and 32-bit 32-bit + 64bit 64-bit multiplication/accumulation operations are executed in two to four cycles. t bit : the t bit in the status register changes according to the result of the comparison, and in turn is the condition (true/false) that determines if the program will branch. the number of instructions that change the t bit is kept to a minimum to improve the processing speed (table 2.4). table 2.4 t bit sh7040 series cpu description example of conventional cpu cmp/ge r1,r0 bt trget0 bf trget1 t bit is set when r0 r1. the program branches to trget0 when r0 r1 and to trget1 when r0??1. cmp.w r1,r0 bge trget0 blt trget1 add #1,r0 cmp/eq #0,r0 bt trget t bit is not changed by add. t bit is set when r0 = 0. the program branches if r0 = 0. sub.w #1,r0 beq trget immediate data : byte (8-bit) immediate data resides in instruction code. word or longword immediate data is not input via instruction codes but is stored in a memory table. an immediate data transfer instruction (mov) accesses the memory table using the pc relative addressing mode with displacement (table 2.5).
51 table 2.5 immediate data accessing classification sh7040 series cpu example of conventional cpu 8-bit immediate mov #h'12,r0 mov.b #h'12,r0 16-bit immediate mov.w @(disp,pc),r0 ................. .data.w h'1234 mov.w #h'1234,r0 32-bit immediate mov.l @(disp,pc),r0 ................. .data.l h'12345678 mov.l #h'12345678,r0 note: @(disp, pc) accesses the immediate data. absolute address : when data is accessed by absolute address, the value already in the absolute address is placed in the memory table. loading the immediate data when the instruction is executed transfers that value to the register and the data is accessed in the indirect register addressing mode (table 2.6). table 2.6 absolute address accessing classification sh7040 series cpu example of conventional cpu absolute address mov.l @(disp,pc),r1 mov.b @r1,r0 .................. .data.l h'12345678 mov.b @h'12345678,r0 note: @(disp,pc) accesses the immediate data. 16-bit/32-bit displacement : when data is accessed by 16-bit or 32-bit displacement, the pre- existing displacement value is placed in the memory table. loading the immediate data when the instruction is executed transfers that value to the register and the data is accessed in the indirect indexed register addressing mode (table 2.7). table 2.7 displacement accessing classification sh7040 series cpu example of conventional cpu 16-bit displacement mov.w @(disp,pc),r0 mov.w @(r0,r1),r2 .................. .data.w h'1234 mov.w @(h'1234,r1),r2 note: @(disp,pc) accesses the immediate data.
52 2.3.2 addressing modes table 2.8 describes addressing modes and effective address calculation. table 2.8 addressing modes and effective addresses addressing mode instruction format effective addresses calculation equation direct register addressing rn the effective address is register rn. (the operand is the contents of register rn.) indirect register addressing @rn the effective address is the content of register rn. rn rn rn post-increment indirect register addressing @rn+ the effective address is the content of register rn. a constant is added to the content of rn after the instruction is executed. 1 is added for a byte operation, 2 for a word operation, and 4 for a longword operation. rn rn 1/2/4 + rn + 1/2/4 rn (after the instruction executes) byte: rn + 1 rn word: rn + 2 rn longword: rn + 4 rn pre-decrement indirect register addressing @?n the effective address is the value obtained by subtracting a constant from rn. 1 is subtracted for a byte operation, 2 for a word operation, and 4 for a longword operation. rn 1/2/4 rn ?1/2/4 rn ?1/2/4 byte: rn ?1 rn word: rn ?2 rn longword: rn ?4 rn (instruction executed with rn after calculation)
53 table 2.8 addressing modes and effective addresses (cont) addressing mode instruction format effective addresses calculation equation indirect register addressing with displacement @(disp:4, rn) the effective address is rn plus a 4-bit displacement (disp). the value of disp is zero- extended, and remains the same for a byte operation, is doubled for a word operation, and is quadrupled for a longword operation. rn rn + disp 1/2/4 + 1/2/4 disp (zero-extended) byte: rn + disp word: rn + disp 2 longword: rn + disp 4 indirect indexed register addressing @(r0, rn) the effective address is the rn value plus r0. rn r0 rn + r0 + rn + r0 indirect gbr addressing with displacement @(disp:8, gbr) the effective address is the gbr value plus an 8-bit displacement (disp). the value of disp is zero- extended, and remains the same for a byte opera- tion, is doubled for a word operation, and is quadrupled for a longword operation. gbr 1/2/4 gbr + disp 1/2/4 + disp (zero-extended) byte: gbr + disp word: gbr + disp 2 longword: gbr + disp 4
54 table 2.8 addressing modes and effective addresses (cont) addressing mode instruction format effective addresses calculation equation indirect indexed gbr addressing @(r0, gbr) the effective address is the gbr value plus the r0. gbr r0 gbr + r0 + gbr + r0 pc relative addressing with displacement @(disp:8, pc) the effective address is the pc value plus an 8-bit displacement (disp). the value of disp is zero- extended, and is doubled for a word operation, and quadrupled for a longword operation. for a longword?peration, the lowest two bits of the pc value are masked. pc h'fffffffc pc + disp 2 or pc & h'fffffffc + disp 4 + 2/4 & (for longword) disp (zero-extended) word: pc + disp 2 longword: pc & h'fffffffc + disp 4
55 table 2.8 addressing modes and effective addresses (cont) addressing mode instruction format effective addresses calculation equation pc relative addressing disp:8 the effective address is the pc value sign-extended with an 8-bit displacement (disp), doubled, and added?o the pc value. pc 2 + disp (sign-extended) pc + disp 2 pc + disp 2 disp:12 the effective address is the pc value sign-extended with a 12-bit displacement (disp), doubled, and added?o the pc value. pc 2 + disp (sign-extended) pc + disp 2 pc + disp ? rn the effective address is the register pc value plus rn. pc rn pc + rn + pc + rn immediate addressing #imm:8 the 8-bit immediate data (imm) for the tst, and, or, and xor instructions are zero-extended. #imm:8 the 8-bit immediate data (imm) for the mov, add, and cmp/eq instructions are sign-extended. #imm:8 the 8-bit immediate data (imm) for the trapa instruction is zero-extended and is quadrupled.
56 2.3.3 instruction format table 2.9 lists the instruction formats for the source operand and the destination operand. the meaning of the operand depends on the instruction code. the symbols are used as follows: ? xxxx: instruction code ? mmmm: source register ? nnnn: destination register ? iiii: immediate data ? dddd: displacement table 2.9 instruction formats instruction formats source operand destination operand example 0 format xxxx xxxx xxxx xxxx 15 0 nop n format nnnn: direct register movt rn xxxx xxxx xxxx nnnn 15 0 control register or system register nnnn: direct register sts mach,rn control register or system register nnnn: indirect pre- decrement register stc.l sr,@-rn m format mmmm: direct register control register or system register ldc rm,sr xxxx mmmm xxxx xxxx 15 0 mmmm: indirect post-increment register control register or system register ldc.l @rm+,sr mmmm: direct register jmp @rm mmmm: pc relative using rm braf rm
57 table 2.9 instruction formats (cont) instruction formats source operand destination operand example nm format mmmm: direct register nnnn: direct register add rm,rn nnnn xxxx xxxx 15 0 mmmm mmmm: direct register nnnn: indirect register mov.l rm,@rn mmmm: indirect post-increment register (multiply/ accumulate) nnnn*: indirect post-increment register (multiply/ accumulate) mach, macl mac.w @rm+,@rn+ mmmm: indirect post-increment register nnnn: direct register mov.l @rm+,rn mmmm: direct register nnnn: indirect pre- decrement register mov.l rm,@-rn mmmm: direct register nnnn: indirect indexed register mov.l rm,@(r0,rn) md format xxxx dddd 15 0 mmmm xxxx mmmmdddd: indirect register with displacement r0 (direct register) mov.b @(disp,rm),r0 nd4 format xxxx xxxx dddd 15 0 nnnn r0 (direct register) nnnndddd: indirect register with displacement mov.b r0,@(disp,rn) nmd format nnnn xxxx dddd 15 0 mmmm mmmm: direct register nnnndddd: indirect register with displacement mov.l rm,@(disp,rn) mmmmdddd: indirect register with displacement nnnn: direct register mov.l @(disp,rm),rn note: in multiply/accumulate instructions, nnnn is the source register.
58 table 2.9 instruction formats (cont) instruction formats source operand destination operand example d format dddd xxxx 15 0 xxxx dddd dddddddd: indirect gbr with displacement r0 (direct register) mov.l @(disp,gbr),r0 r0(direct register) dddddddd: indirect gbr with displacement mov.l r0,@(disp,gbr) dddddddd: pc relative with displacement r0 (direct register) mova @(disp,pc),r0 dddddddd: pc relative bf label d12 format dddd xxxx 15 0 dddd dddd dddddddddddd: pc relative bra label (label = disp + pc) nd8 format dddd nnnn xxxx 15 0 dddd dddddddd: pc relative with displacement nnnn: direct register mov.l @(disp,pc),rn i format iiiiiiii: immediate indirect indexed gbr and.b #imm,@(r0,gbr) xxxx xxxx i i i i 15 0 i i i i iiiiiiii: immediate r0 (direct register) and #imm,r0 iiiiiiii: immediate trapa #imm ni format nnnn i i i i xxxx 15 0 i i i i iiiiiiii: immediate nnnn: direct register add #imm,rn
59 2.4 instruction set by classification table 2.10 classification of instructions classification types operation code function no. of instructions data transfer 5 mov data transfer, immediate data transfer, peripheral module data transfer, structure data transfer 39 mova effective address transfer movt t bit transfer swap swap of upper and lower bytes xtrct extraction of the middle of registers connected arithmetic 21 add binary addition 33 operations addc binary addition with carry addv binary addition with overflow check cmp/cond comparison div1 division div0s initialization of signed division div0u initialization of unsigned division dmuls signed double-length multiplication dmulu unsigned double-length multiplication dt decrement and test exts sign extension extu zero extension mac multiply/accumulate, double-length multiply/accumulate operation mul double-length multiply operation muls signed multiplication mulu unsigned multiplication neg negation negc negation with borrow sub binary subtraction subc binary subtraction with borrow subv binary subtraction with underflow
60 table 2.10 classification of instructions (cont) classification types operation code function no. of instructions logic 6 and logical and 14 operations not bit inversion or logical or tas memory test and bit set tst logical and and t bit set xor exclusive or shift 10 rotl one-bit left rotation 14 rotr one-bit right rotation rotcl one-bit left rotation with t bit rotcr one-bit right rotation with t bit shal one-bit arithmetic left shift shar one-bit arithmetic right shift shll one-bit logical left shift shlln n-bit logical left shift shlr one-bit logical right shift shlrn n-bit logical right shift branch 9 bf conditional branch, conditional branch with delay (branch when t = 0) 11 bt conditional branch, conditional branch with delay (branch when t = 1) bra unconditional branch braf unconditional branch bsr branch to subroutine procedure bsrf branch to subroutine procedure jmp unconditional branch jsr branch to subroutine procedure rts return from subroutine procedure
61 table 2.10 classification of instructions (cont) classification types operation code function no. of instructions system 11 clrt t bit clear 31 control clrmac mac register clear ldc load to control register lds load to system register nop no operation rte return from exception processing sett t bit set sleep shift into power-down mode stc storing control register data sts storing system register data trapa trap exception handling total: 62 142 table 2.11 shows the format used in tables 2.12 to 2.17, which list instruction codes, operation, and execution states in order by classification.
62 table 2.11 instruction code format item format explanation instruction op.sz src,dest op: operation code sz: size (b: byte, w: word, or l: longword) src: source dest: destination rm: source register rn: destination register imm: immediate data disp: displacement* 1 instruction code msb lsb mmmm: source register nnnn: destination register 0000: r0 0001: r1 . . . 1111: r15 iiii: immediate data dddd: displacement operation , direction of transfer (xx) memory operand m/q/t flag bits in the sr & logical and of each bit | logical or of each bit ^ exclusive or of each bit ~ logical not of each bit <>n n-bit right shift execution cycles value when no wait states are inserted* 2 t bit value of t bit after instruction is executed. an em-dash (? in the column means no change. notes: 1. depending on the operand size, displacement is scaled 1, 2, or 4. for details, see the sh-1/sh-2/sh-dsp programming manual . 2. instruction execution cycles: the execution cycles shown in the table are minimums. the actual number of cycles may be increased when (1) 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.
63 table 2.12 data transfer instructions instruction instruction code operation execu- tion cycles t bit mov #imm,rn 1110nnnniiiiiiii #imm sign extension rn 1 mov.w @(disp,pc),rn 1001nnnndddddddd (disp 2 + pc) sign extension rn 1 mov.l @(disp,pc),rn 1101nnnndddddddd (disp 4 + pc) rn 1 mov rm,rn 0110nnnnmmmm0011 rm rn 1 mov.b rm,@rn 0010nnnnmmmm0000 rm (rn) 1 mov.w rm,@rn 0010nnnnmmmm0001 rm (rn) 1 mov.l rm,@rn 0010nnnnmmmm0010 rm (rn) 1 mov.b @rm,rn 0110nnnnmmmm0000 (rm) sign extension rn 1 mov.w @rm,rn 0110nnnnmmmm0001 (rm) sign extension rn 1 mov.l @rm,rn 0110nnnnmmmm0010 (rm) rn 1 mov.b rm,@?n 0010nnnnmmmm0100 rn? rn, rm (rn) 1 mov.w rm,@?n 0010nnnnmmmm0101 rn? rn, rm (rn) 1 mov.l rm,@?n 0010nnnnmmmm0110 rn? rn, rm (rn) 1 mov.b @rm+,rn 0110nnnnmmmm0100 (rm) sign extension rn,rm + 1 rm 1 mov.w @rm+,rn 0110nnnnmmmm0101 (rm) sign extension rn,rm + 2 rm 1 mov.l @rm+,rn 0110nnnnmmmm0110 (rm) rn,rm + 4 rm 1 mov.b r0,@(disp,rn) 10000000nnnndddd r0 (disp + rn) 1 mov.w r0,@(disp,rn) 10000001nnnndddd r0 (disp ? 2 + rn) 1 mov.l rm,@(disp,rn) 0001nnnnmmmmdddd rm (disp ? 4 + rn) 1 mov.b @(disp,rm),r0 10000100mmmmdddd (disp + rm) sign extension r0 1 mov.w @(disp,rm),r0 10000101mmmmdddd (disp ? 2 + rm) sign extension r0 1 mov.l @(disp,rm),rn 0101nnnnmmmmdddd (disp ? 4 + rm) rn 1 mov.b rm,@(r0,rn) 0000nnnnmmmm0100 rm (r0 + rn) 1
64 table 2.12 data transfer instructions (cont) instruction instruction code operation execu- tion cycles t bit mov.w rm,@(r0,rn) 0000nnnnmmmm0101 rm (r0 + rn) 1 mov.l rm,@(r0,rn) 0000nnnnmmmm0110 rm (r0 + rn) 1 mov.b @(r0,rm),rn 0000nnnnmmmm1100 (r0 + rm) sign extension rn 1 mov.w @(r0,rm),rn 0000nnnnmmmm1101 (r0 + rm) sign extension rn 1 mov.l @(r0,rm),rn 0000nnnnmmmm1110 (r0 + rm) rn 1 mov.b r0,@(disp,gbr) 11000000dddddddd r0 (disp + gbr) 1 mov.w r0,@(disp,gbr) 11000001dddddddd r0 (disp ? 2 + gbr) 1 mov.l r0,@(disp,gbr) 11000010dddddddd r0 (disp ? 4 + gbr) 1 mov.b @(disp,gbr),r0 11000100dddddddd (disp + gbr) sign extension r0 1 mov.w @(disp,gbr),r0 11000101dddddddd (disp ? 2 + gbr) sign extension r0 1 mov.l @(disp,gbr),r0 11000110dddddddd (disp ? 4 + gbr) r0 1 mova @(disp,pc),r0 11000111dddddddd disp ? 4 + pc r0 1 movt rn 0000nnnn00101001 t rn 1 swap.b rm,rn 0110nnnnmmmm1000 rm swap the bottom two bytes rn 1 swap.w rm,rn 0110nnnnmmmm1001 rm swap two consecutive words rn 1 xtrct rm,rn 0010nnnnmmmm1101 rm: middle 32 bits of rn ?n 1
65 table 2.13 arithmetic operation instructions instruction instruction code operation execu- tion cycles t bit add rm,rn 0011nnnnmmmm1100 rn + rm rn 1 add #imm,rn 0111nnnniiiiiiii rn + imm rn 1 addc rm,rn 0011nnnnmmmm1110 rn + rm + t rn, carry t 1 carry addv rm,rn 0011nnnnmmmm1111 rn + rm rn, overflow t 1 overflow cmp/eq #imm,r0 10001000iiiiiiii if r0 = imm, 1 t 1 comparison result cmp/eq rm,rn 0011nnnnmmmm0000 if rn = rm, 1 t 1 comparison result cmp/hs rm,rn 0011nnnnmmmm0010 if rn rm with unsigned data, 1 t 1 comparison result cmp/ge rm,rn 0011nnnnmmmm0011 if rn rm with signed data, 1 t 1 comparison result cmp/hi rm,rn 0011nnnnmmmm0110 if rn > rm with unsigned data, 1 t 1 comparison result cmp/gt rm,rn 0011nnnnmmmm0111 if rn > rm with signed data, 1 t 1 comparison result cmp/pl rn 0100nnnn00010101 if rn > 0, 1 t 1 comparison result cmp/pz rn 0100nnnn00010001 if rn 0, 1 t 1 comparison result cmp/str rm,rn 0010nnnnmmmm1100 if rn and rm have an?quivalent byte, 1 ? 1 comparison result div1 rm,rn 0011nnnnmmmm0100 single-step division (rn/rm) 1 calculation result div0s rm,rn 0010nnnnmmmm0111 msb of rn q, msb of rm m, m?? t 1 calculation result div0u 0000000000011001 0 m/q/t 1 0
66 table 2.13 arithmetic operation instructions (cont) instruction instruction code operation execu- tion cycles t bit dmuls.l rm,rn 0011nnnnmmmm1101 signed operation of rn ? rm mach, macl 32 ? 32 64 bit 2 to 4* dmulu.l rm,rn 0011nnnnmmmm0101 unsigned operation of rn ? rm mach, macl 32 ? 32 64 bit 2 to 4* dt rn 0100nnnn00010000 rn ?1 rn, when rn is 0, 1 t. when rn is nonzero, 0 t 1 comparison result exts.b rm,rn 0110nnnnmmmm1110 a byte in rm is sign- extended rn 1 exts.w rm,rn 0110nnnnmmmm1111 a word in rm is sign- extended rn 1 extu.b rm,rn 0110nnnnmmmm1100 a byte in rm is zero- extended rn 1 extu.w rm,rn 0110nnnnmmmm1101 a word in rm is zero- extended rn 1 mac.l @rm+,@rn+ 0000nnnnmmmm1111 signed operation of (rn) ? (rm) + mac mac 32 ? 32 64 bit 3/(2 to 4)* mac.w @rm+,@rn+ 0100nnnnmmmm1111 signed operation of (rn) ? (rm) + mac mac 16 ? 16 + 64 64 bit 3/(2)* mul.l rm,rn 0000nnnnmmmm0111 rn ? rm macl, 32 ? 32 32 bit 2 to 4* muls.w rm,rn 0010nnnnmmmm1111 signed operation of rn ? rm mac 16 ? 16 32 bit 1 to 3* mulu.w rm,rn 0010nnnnmmmm1110 unsigned operation of rn ? rm mac 16 16 32 bit 1 to 3* neg rm,rn 0110nnnnmmmm1011 0?m rn 1 negc rm,rn 0110nnnnmmmm1010 0?m? rn, borrow t 1 borrow
67 table 2.13 arithmetic operation instructions (cont) instruction instruction code operation execu- tion cycles t bit sub rm,rn 0011nnnnmmmm1000 rn?m rn 1 subc rm,rn 0011nnnnmmmm1010 rn?m? rn, borrow t 1 borrow subv rm,rn 0011nnnnmmmm1011 rn?m rn, underflow t 1 overflow note: the normal minimum number of execution cycles. (the number in parentheses is the number of cycles when there is contention with following instructions.)
68 table 2.14 logic operation instructions instruction instruction code operation execu- tion cycles t bit and rm,rn 0010nnnnmmmm1001 rn & rm rn 1 and #imm,r0 11001001iiiiiiii r0 & imm r0 1 and.b #imm,@(r0,gbr) 11001101iiiiiiii (r0 + gbr) & imm (r0? gbr) 3 not rm,rn 0110nnnnmmmm0111 ~rm rn 1 or rm,rn 0010nnnnmmmm1011 rn | rm rn 1 or #imm,r0 11001011iiiiiiii r0 | imm r0 1 or.b #imm,@(r0,gbr) 11001111iiiiiiii (r0 + gbr) | imm (r0? gbr) 3 tas.b @rn 0100nnnn00011011 if (rn) is 0, 1 t; 1 msb of (rn)* 4 test result tst rm,rn 0010nnnnmmmm1000 rn & rm; if the result is 0, 1 t 1 test result tst #imm,r0 11001000iiiiiiii r0 & imm; if the result is 0, 1 t 1 test result tst.b #imm,@(r0,gbr) 11001100iiiiiiii (r0 + gbr) & imm; if the result is 0, 1 t 3 test result xor rm,rn 0010nnnnmmmm1010 rn ^ rm rn 1 xor #imm,r0 11001010iiiiiiii r0 ^ imm r0 1 xor.b #imm,@(r0,gbr) 11001110iiiiiiii (r0 + gbr) ^ imm (r0? gbr) 3 note: the on-chip dmac/dtc bus cycles are not inserted between the read and write cycles of tas instruction execution. however, bus release due to breq is carried out.
69 table 2.15 shift instructions instruction instruction code operation execu- tion cycles t bit rotl rn 0100nnnn00000100 t rn msb 1 msb rotr rn 0100nnnn00000101 lsb rn t 1 lsb rotcl rn 0100nnnn00100100 t rn t 1 msb rotcr rn 0100nnnn00100101 t rn t 1 lsb shal rn 0100nnnn00100000 t rn 0 1 msb shar rn 0100nnnn00100001 msb rn t 1 lsb shll rn 0100nnnn00000000 t rn 0 1 msb shlr rn 0100nnnn00000001 0 rn t 1 lsb shll2 rn 0100nnnn00001000 rn<<2 rn 1 shlr2 rn 0100nnnn00001001 rn>>2 rn 1 shll8 rn 0100nnnn00011000 rn<<8 rn 1 shlr8 rn 0100nnnn00011001 rn>>8 rn 1 shll16 rn 0100nnnn00101000 rn<<16 rn 1 shlr16 rn 0100nnnn00101001 rn>>16 rn 1
70 table 2.16 branch instructions instruction instruction code operation exec. cycles t bit bf label 10001011dddddddd if t = 0, disp 2 + pc pc; if t = 1, nop 3/1* bf/s label 10001111dddddddd delayed branch, if t = 0, disp 2 + pc pc; if t = 1, nop 3/1* bt label 10001001dddddddd if t = 1, disp ? 2 + pc pc; if t = 0, nop 3/1* bt/s label 10001101dddddddd delayed branch, if t = 1, disp ? 2 + pc pc; if t = 0, nop 2/1* bra label 1010dddddddddddd delayed branch, disp ? 2 + pc pc 2 braf rm 0000mmmm00100011 delayed branch, rm + pc pc 2 bsr label 1011dddddddddddd delayed branch, pc pr, disp ? 2 + pc pc 2 bsrf rm 0000mmmm00000011 delayed branch, pc pr, rm??c pc 2 jmp @rm 0100mmmm00101011 delayed branch, rm pc 2 jsr @rm 0100mmmm00001011 delayed branch, pc pr, rm ?c 2 rts 0000000000001011 delayed branch, pr pc 2 note: one state when it does not branch.
71 table 2.17 system control instructions instruction instruction code operation exec. cycles t bit clrt 0000000000001000 0 t10 clrmac 0000000000101000 0 mach, macl 1 ldc rm,sr 0100mmmm00001110 rm sr 1 lsb ldc rm,gbr 0100mmmm00011110 rm gbr 1 ldc rm,vbr 0100mmmm00101110 rm vbr 1 ldc.l @rm+,sr 0100mmmm00000111 (rm) sr, rm + 4 rm 3 lsb ldc.l @rm+,gbr 0100mmmm00010111 (rm) gbr, rm + 4 rm 3 ldc.l @rm+,vbr 0100mmmm00100111 (rm) vbr, rm + 4 rm 3 lds rm,mach 0100mmmm00001010 rm mach 1 lds rm,macl 0100mmmm00011010 rm macl 1 lds rm,pr 0100mmmm00101010 rm pr 1 lds.l @rm+,mach 0100mmmm00000110 (rm) mach, rm + 4 rm 1 lds.l @rm+,macl 0100mmmm00010110 (rm) macl, rm + 4 rm 1 lds.l @rm+,pr 0100mmmm00100110 (rm) pr, rm + 4 rm 1 nop 0000000000001001 no operation 1 rte 0000000000101011 delayed branch, stack area pc/sr 4 sett 0000000000011000 1 t11 sleep 0000000000011011 sleep 3* stc sr,rn 0000nnnn00000010 sr rn 1 stc gbr,rn 0000nnnn00010010 gbr rn 1 stc vbr,rn 0000nnnn00100010 vbr rn 1 stc.l sr,@?n 0100nnnn00000011 rn? rn, sr (rn) 2 stc.l gbr,@?n 0100nnnn00010011 rn? rn, gbr (rn) 2 stc.l vbr,@?n 0100nnnn00100011 rn? rn, br (rn) 2 sts mach,rn 0000nnnn00001010 mach rn 1 sts macl,rn 0000nnnn00011010 macl rn 1 sts pr,rn 0000nnnn00101010 pr rn 1
72 table 2.17 system control instructions (cont) instruction instruction code operation exec. cycles t bit sts.l mach,@?n 0100nnnn00000010 rn? rn, mach (rn) 1 sts.l macl,@?n 0100nnnn00010010 rn? rn, macl (rn) 1 sts.l pr,@?n 0100nnnn00100010 rn? rn, pr (rn) 1 trapa #imm 11000011iiiiiiii pc/sr stack area, (imm ?4 + vbr) pc 8 note: the number of execution cycles before the chip enters sleep mode: the execution cycles shown in the table are minimums. the actual number of cycles may be increased when (1) 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. 2.5 processing states 2.5.1 state transitions the cpu has five processing states: reset, exception processing, bus release, program execution and power-down. figure 2.6 shows the transitions between the states.
73 res = 0 power-on reset state manual reset state sleep mode standby mode program execution state bus release state exception processing state res = 1 mres = 1 res = 1 when an interrupt source or dma address error occurs nmi interrupt source occurs exception processing ends bus request generated exception processing source occurs bus request cleared bus request generated bus request cleared sby bit cleared for sleep instruction sby bit set for sleep instruction from any state when res = 0 from any state when res = 1 and mres = 0 reset states power-down state bus request generated bus request cleared figure 2.6 transitions between processing states reset state: the cpu resets in the reset state. when the res pin level goes low, a power-on reset results. when the res pin is high and mres is low, a manual reset will occur. exception processing state : the exception processing state is a transient state that occurs when exception processing sources such as resets or interrupts alter the cpu? processing state flow.
74 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. bus release state : in the bus release state, the cpu releases access rights to the bus to the device that has requested them. 2.5.2 power-down state besides the ordinary program execution states, the cpu also has a power-down state in which cpu operation halts, lowering power consumption. there are two power-down state modes: sleep mode and standby mode. sleep mode : when 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 cache (or on-chip ram) is maintained. the on-chip peripheral modules other than the cpu do not halt in the sleep mode. to return from sleep mode, use a reset (power-on or manual), any interrupt, or a dma address error; the cpu returns to the ordinary program execution state through the exception processing state. 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 peripheral module, and oscillator functions are halted. however, when entering standby mode, the dma master enable bit of the dmac should be set to 0. if multiplication-related instructions are being executed at the time of entry into standby mode, the values of mach and macl will become undefined. to return from standby mode, use a reset (power-on or manual) or an nmi interrupt. for resets, the cpu returns to ordinary program execution state through the exception processing state when placed in a reset state for the duration of the oscillator stabilization time. for nmi interrupts, the
75 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.18). table 2.18 power-down state state mode transition conditions clock cpu on-chip peripheral modules cpu registers on-chip cache or on-chip ram i/o port pins canceling sleep execute sleep instruction with sby bit cleared to 0 in sbycr run halt run held held held ? interrupt ? dma address error ? power-on reset ? manual reset stand- by execute sleep instruction with sby bit set to 1 in sbycr halt halt halt and initialize * held held held or hi-z (select- able) ? nmi interrupt ? power-on reset ? manual reset note: differs depending on the peripheral module and pin.
77 section 3 operating modes 3.1 operating modes, types, and selection this lsi has five operating modes and three clock modes, determined by the setting of the mode pins (md3?d0). do not change the mode pin settings during lsi operation (while power is on). (in the f-ztat version, however, md1 can be changed in the power-on reset state.) table 3.1 indicates the setting method for the operating mode. table 3.1 operating mode setting mode pin setting mode on-chip cs0 area no. fwp md3* 1 md2* 1 md1 md0 name rom 112 pin 144 pin 0 1 x x 0 0 mcu mode 0 not active 8-bit space 16-bit space 1 1 x x 0 1 mcu mode 1 not active 16-bit space 32-bit space 2 1 x x 1 0 mcu mode 2 active 8/16-bit space* 2 8/16/32-bit space* 2 3 1 x x 1 1 single chip mode active 4 1 1 1 1 1 prom mode* 3 active 0 x x 0 0 boot mode* 4 active 8/16-bit space* 2 8/16/32-bit space* 2 0xx01 0 x x 1 0 user programming mode* 4 active 8/16-bit space* 2 8/16/32-bit space* 2 0xx11 1 1 1 0 1 flash programmer mode* 4 active notes: 1. md2 and md3 pins select the clock mode in modes 0? (table 3.2). 2. set by bcr2 of bsc. 3. only ztat. 4. only f-ztat.
78 table 3.2 indicates the setting method for the clock mode. table 3.2 clock mode setting md3 md2 clock mode 0 0 pll on 1 0 1 pll on 2 1 0 pll on 4 1 1 reserved (prom mode only) 3.2 explanation of operating modes table 3.3 describes the operating modes. table 3.3 operating modes mode description (mcu) mode 0 cs0 area becomes an external memory space with 8-bit bus width for the 112-pin version, and 16-bit for the 144-pin version. (mcu) mode 1 cs0 area becomes an external memory space with 16-bit bus width for the 112-pin version, and 32-bit for the 144-pin version (mcu) mode 2 the on-chip rom becomes effective. the bus width for the on-chip rom space is 32 bit. mode 3 (single chip mode) any port can be used, but external addresses can not be employed. mode 4 (prom mode) on-chip rom can be programmed using a general prom writer. clock mode the input waveform frequency can be used as is, doubled or quadrupled as an internal clock in modes 0 to 3.
79 3.3 pin configuration table 3.4 describes the function of each operating mode related pin. table 3.4 operating mode pin function pin name input/output function xtal input connects to a crystal oscillator extal input connects to a crystal oscillator, or used for external clock input pin pllcap input connects to a capacitor for pll circuit operation md0 input designates operating mode through the level applied to this pin md1 input designates operating mode through the level applied to this pin md2 input designates clock mode through the level applied to this pin md3 input designates clock mode through the level applied to this pin
81 section 4 clock pulse generator (cpg) 4.1 overview the sh7040 series has an on-chip clock pulse generator (cpg) that generates the system clock ( f ), as well as the internal clock ( f /2 to f /8192). the cpg consists of an oscillator, a pll, and a prescaler. 4.1.1 block diagram a block diagram of the clock pulse generator is shown in figure 4.1. pllcap ck extal xtal md2 md3 oscillator pll circuit clock mode control circuitry prescaler within the lsi f f /2 to f /8192 figure 4.1 block diagram of the clock pulse generator 4.2 oscillator clock pulses can be supplied from a connected crystal resonator or an external clock. 4.2.1 connecting a crystal oscillator circuit configuration: a crystal oscillator can be connected as shown in figure 4.2. use the damping resistance (rd) listed in table 4.1. use a 4?0 mhz crystal oscillator (consult your dealer concerning the compatibility of the crystal oscillator and the lsi).
82 xtal extal c l1 c l2 r d 4?0 mhz c l1 = c l2 = 18?2 pf (recommended value) figure 4.2 connection of the crystal oscillator (example) table 4.1 damping resistance values (recommended values) frequency (mhz) parameter 4 8 10 rd ( ) 500 200 0 crystal oscillator: figure 4.3 shows an equivalent circuit of the crystal oscillator. use a crystal oscillator with the characteristics listed in table 4.2. co extal c l lrs xtal figure 4.3 crystal oscillator equivalent circuit table 4.2 crystal oscillator parameters frequency (mhz) parameter 4 8 10 rs max ( w ) 120 80 60 co max (pf) 7 7 7 4.2.2 external clock input method figure 4.4 shows an example of an external clock input connection. in this case, make the external clock high level to stop it when in standby mode. during operation, make the external input clock frequency 4?0 mhz.
83 when leaving the xtal pin open, make sure the parasitic capacitance is less than 10 pf. even when inputting an external clock, be sure to delay until after the oscillation stabilization time (upon power-on) or after release from standby, in order to ensure the pll stabilization time. extal xtal open external clock input 4?0 mhz figure 4.4 example of external clock connection 4.2.3 notes on board design when connecting a crystal oscillator, observe the following precautions: ? to prevent induction from interfering with correct oscillation, do not route any signal lines near the oscillator circuitry. ? when designing the board, place the crystal oscillator and its load capacitors as close as possible to the xtal and extal pins. figure 4.5 shows the precautions regarding oscillator block board settings. crossing of signal lines prohibited c l1 xtal extal c l2 figure 4.5 cautions for oscillator circuit system board design
84 external circuitry such as that shown in figure 4.6 is recommended around the pll. pllcap pllv cc pllv ss v cc v ss r1: 3 k w c1: 470 pf rp: 200 w cpb: 0.1 m f* cb: 0.1 m f* *: cb and cpb are laminated ceramic capacitors (recommended values) figure 4.6 cautions for use of pll oscillator circuit place oscillation stabilization capacitor c1 and resistor r1 near the pll cap pin, and ensure that these lines do not cross any other signal lines. supply the c1 ground from pll v ss . also, separate pll v cc and pll v ss , and the other v cc and v ss pins, from the board power supply source, and be sure to insert bypass capacitors cpb and cb close to the pins. 4.3 prescaler the prescaler divides the system clock ( f ) to generate an internal clock ( f /2 to f /8192) for supply to peripheral modules. 4.4 oscillator halt function this cpg can detect a clock halt and automatically cause the timer pins to become high- impedance when any system abnormality causes the oscillator to halt. that is, when a change of extal has not been detected, the high-current six pins (pe9/tioc3b, pe11/tioc3d, pe12/tioc4a, pe13/tioc4b/ mres , pe14/tioc4c/dack0/ah, pe15/tioc4d/dack1/ irqout ) are set to high-impedance regardless of pfc setting. even in standby mode, these six pins become high-impedance regardless of pfc setting. these pins enter the normal state after standby mode is cancelled.when abnormalities that halt the oscillator occur except in standby mode, other lsi operations become undefined. in this case, lsi operations, including these six pins, become undefined even when the oscillator operation starts again.
85 section 5 exception processing 5.1 overview 5.1.1 types of exception processing and priority exception processing is started by four sources: resets, address errors, interrupts and instructions and have the priority shown in table 5.1. when several exception processing sources occur at once, they are processed according to the priority shown. table 5.1 types of exception processing and priority order exception source priority reset power-on reset high manual reset address cpu address error error dmac/dtc address error interrupt nmi user break irq on-chip peripheral modules: ? direct memory access controller (dmac) ? multifunction timer/pulse unit (mtu) ? serial communications interface (sci) ? a/d converter (a/d) * 3 ? data transfer controller (dtc) ? compare match timer (cmt) ? watchdog timer (wdt) ? bus state controller (bsc) ? port output enable control section instructions trap instruction (trapa instruction) general illegal instructions (undefined code) illegal slot instructions (undefined code placed directly after a delay branch instruction* 1 or instructions that rewrite the pc* 2 ) low notes: 1. delayed branch instructions: jmp, jsr, bra, bsr, rts, rte, bf/s, bt/s, bsrf, braf. 2. instructions that rewrite the pc: jmp, jsr, bra, bsr, rts, rte, bt, bf, trapa, bf/s, bt/s, bsrf, braf. 3. a mask products: a/d0, a/d1.
86 5.1.2 exception processing operations the exception processing sources are detected and begin processing according to the timing shown in table 5.2. table 5.2 timing of exception source detection and the start of exception processing exception source timing of source detection and start of processing reset power-on reset starts when the res pin changes from low to high. manual reset starts when the res pin is high and the mres pin changes from low to high. address error detected when instruction is decoded and starts when the previous executing instruction finishes executing. interrupts detected when instruction is decoded and starts when the previous executing instruction finishes executing. instructions trap instruction starts from the execution of a trapa instruction. general illegal instructions starts from the decoding of undefined code anytime except after a delayed branch instruction (delay slot). illegal slot instructions starts from the decoding of undefined code placed in a delayed branch instruction (delay slot) or of instructions that rewrite the pc. when exception processing starts, the cpu operates as follows: 1. exception processing triggered by reset: the initial values of the program counter (pc) and stack pointer (sp) are fetched from the exception processing vector table (pc and sp are respectively the h'00000000 and h'00000004 addresses for power-on resets and the h'00000008 and h'0000000c addresses for manual resets). see section 5.1.3, exception processing vector table, for more information. 0 is then written to the vector base register (vbr) and 1111 is written to the interrupt mask bits (i3?0) of the status register (sr). the program begins running from the pc address fetched from the exception processing vector table. 2. exception processing triggered by address errors, interrupts and instructions: sr and pc are saved to the stack indicated by r15. for interrupt exception processing, the interrupt priority level is written to the sr? interrupt mask bits (i3?0). for address error and instruction exception processing, the i3?0 bits are not affected. the start address is then fetched from the exception processing vector table and the program begins running from that address.
87 5.1.3 exception processing vector table before exception processing begins running, the exception processing vector table must be set in memory. the exception processing vector table stores the start addresses of exception service routines. (the reset exception processing table holds the initial values of pc and sp.) all exception sources are given different vector numbers and vector table address offsets, from which the vector table addresses are calculated. during exception processing, the start addresses of the exception service routines are fetched from the exception processing vector table, which indicated by this vector table address. table 5.3 shows the vector numbers and vector table address offsets. table 5.4 shows how vector table addresses are calculated. table 5.3 exception processing vector table exception sources vector numbers vector table address?ffset power-on reset pc 0 h'00000000?'00000003 sp 1 h'00000004?'00000007 manual reset pc 2 h'00000008?'0000000b sp 3 h'0000000c?'0000000f general illegal instruction 4 h'00000010?'00000013 (reserved by system) 5 h'00000014?'00000017 slot illegal instruction 6 h'00000018?'0000001b (reserved by system) 7 h'0000001c?'0000001f (reserved by system) 8 h'00000020?'00000023 cpu address error 9 h'00000024?'00000027 dmac/dtc address error 10 h'00000028?'0000002b interrupts nmi 11 h'0000002c?'0000002f user break 12 h'00000030?'00000033 (reserved by system) 13 : 31 h'00000034?'00000037 : h'0000007c?'0000007f trap instruction (user vector) 32 : 63 h'00000080?'00000083 : h'000000fc?'000000ff
88 table 5.3 exception processing vector table (cont) exception sources vector numbers vector table address?ffset interrupts irq0 64 h'00000100?'00000103 irq1 65 h'00000104?'00000107 irq2 66 h'00000108?'0000010b irq3 67 h'0000010c?'0000010f irq4 68 h'00000110?'00000113 irq5 69 h'00000114?'00000117 irq6 70 h'00000118?'0000011b irq7 71 h'0000011c?'0000011f on-chip peripheral module* 72 : 255 h'00000120?'00000124 : h'000003fc?'000003ff note: the vector numbers and vector table address offsets for each on-chip peripheral module interrupt are given in section 6, interrupt controller, and table 6.3, interrupt exception processing vectors and priorities. table 5.4 calculating exception processing vector table addresses exception source vector table address calculation resets vector table address = (vector table address offset) = (vector number) 4 address errors, interrupts, instructions vector table address = vbr + (vector table address offset) = vbr + (vector number) 4 notes: 1. vbr: vector base register 2. vector table address offset: see table 5.3. 3. vector number: see table 5.3. 5.2 resets resets have the highest priority of any exception source. there are two types of resets: manual resets and power-on resets. as table 5.5 shows, both types of resets initialize the internal status of the cpu. in power-on resets, all registers of the on-chip peripheral modules are initialized; in manual resets, they are not.
89 table 5.5 types of resets conditions for transition to reset status internal status type res mres cpu on-chip peripheral module power-on reset low initialized initialized manual reset high low initialized not initialized 5.2.1 power-on reset when the res pin is driven low, the lsi does a power-on reset. to reliably reset the lsi, the res pin should be kept at low for at least the duration of the oscillation settling time when applying power or when in standby mode (when the clock circuit is halted) or at least 20 t cyc (when the clock circuit is running). during power-on reset, cpu internal status and all registers of on-chip peripheral modules are initialized. see appendix c, pin states, for the status of individual pins during the power-on reset status. in the power-on reset status, power-on reset exception processing starts when the res pin is first driven low for a set period of time and then returned to high. the cpu will then operate as follows: 1. the initial value (execution start address) of the program counter (pc) is fetched from the exception processing vector table. 2. the initial value of the stack pointer (sp) is fetched from the exception processing vector table. 3. the vector base register (vbr) is cleared to h'00000000 and the interrupt mask bits (i3?0) of the status register (sr) are set to h'f (1111). 4. the values fetched from the exception processing vector table are set in the program counter (pc) and sp and the program begins executing. be certain to always perform power-on reset processing when turning the system power on. 5.2.2 manual reset when the res pin is high and the mres pin is driven low, the lsi does a manual reset. to reliably reset the lsi, the mres pin should be kept at low for at least the duration of the oscillation settling time when in standby mode (when the clock is halted) or at least 20 t cyc when the clock is operating. during manual reset, the cpu internal status is initialized. registers of on- chip peripheral modules are not initialized. since the bsc is not affected, the dram refresh control functions remain operational even when the manual reset status continues for a long period of time. when the lsi enters manual reset status in the middle of a bus cycle, manual reset exception processing does not start until the bus cycle has ended. thus, manual resets do not abort bus cycles. however, the bus cycle ends once mres is driven low. hold at low level until manual
90 reset mode. (keep at low level for at least the longest bus cycle). see appendix c, pin states, for the status of individual pins during manual reset mode. in the manual reset status, manual reset exception processing starts when the mres pin is first kept low for a set period of time and then returned to high. the cpu will then operate the same as described for power-on resets. 5.3 address errors address errors occur when instructions are fetched or data read or written, as shown in table 5.6. table 5.6 bus cycles and address errors bus cycle type bus master bus cycle description address errors instruction cpu instruction fetched from even address none (normal) fetch instruction fetched from odd address address error occurs instruction fetched from other than on-chip peripheral module space* none (normal) instruction fetched from on-chip peripheral module space* address error occurs instruction fetched from external memory space when in single chip mode address error occurs data cpu or word data accessed from even address none (normal) read/write dmac word data accessed from odd address address error occurs or dtc longword data accessed from a longword boundary none (normal) longword data accessed from other than a long- word boundary address error occurs byte or word data accessed in on-chip peripheral module space* none (normal) longword data accessed in 16-bit on-chip peripheral module space* none (normal) longword data accessed in 8-bit on-chip peripheral module space* address error occurs external memory space accessed when in single chip mode address error occurs note: see section 10, bus state controller.
91 5.3.1 address error exception processing when an address error occurs, the bus cycle in which the address error occurred ends. when the executing instruction then finishes, address error exception processing starts up. the cpu operates as follows: 1. the status register (sr) is saved to the stack. 2. the program counter (pc) is saved to the stack. the pc value saved is the start address of the instruction to be executed after the last executed instruction. 3. the exception service routine start address is fetched from the exception processing vector table that corresponds to the address error that occurred and the program starts executing from that address. the jump that occurs is not a delayed branch. 5.4 interrupts table 5.7 shows the sources that start up interrupt exception processing. these are divided into nmi, user breaks, irq and on-chip peripheral modules. table 5.7 interrupt sources type request source number of sources nmi nmi pin (external input) 1 user break user break controller 1 irq irq0 irq7 (external input) 8 on-chip peripheral module direct memory access controller (dmac) 4 multifunction timer/pulse unit (mtu) 24 serial communications interface (sci) 8 a/d converter 1* data transfer controller (dtc) 1 compare match timer (cmt) 2 watchdog timer (wdt) 1 bus state controller (bsc) 1 port 1 note: for a mask products, (a/d0, a/d1) is 2 each interrupt source is allocated a different vector number and vector table offset. see section 6, interrupt controller, and table 6.3, interrupt exception processing vectors and priorities, for more information on vector numbers and vector table address offsets.
92 5.4.1 interrupt priority level the interrupt priority order is predetermined. when multiple interrupts occur simultaneously (overlap), the interrupt controller (intc) determines their relative priorities and starts up processing according to the results. the priority order of interrupts is expressed as priority levels 0?6, with priority 0 the lowest and priority 16 the highest. the nmi interrupt has priority 16 and cannot be masked, so it is always accepted. the user break interrupt priority level is 15. irq interrupts and on-chip peripheral module interrupt priority levels can be set freely using the intc? interrupt priority level setting registers a through h (ipra?prh) as shown in table 5.8. the priority levels that can be set are 0?5. level 16 cannot be set. see section 6.3.1, interrupt priority registers a-h (ipra-iprh), for more information on ipra to iprh. table 5.8 interrupt priority order type priority level comment nmi 16 fixed priority level. cannot be masked. user break 15 fixed priority level. irq 0?5 set with interrupt priority level setting registers a through h (ipra?prh). on-chip peripheral module 0?5 set with interrupt priority level setting registers a through h (ipra?prh). 5.4.2 interrupt exception processing when an interrupt occurs, its priority level is ascertained by the interrupt controller (intc). nmi is always accepted, but other interrupts are only accepted if they have a priority level higher than the priority level set in the interrupt mask bits (i3?0) of the status register (sr). when an interrupt is accepted, exception processing begins. in interrupt exception processing, the cpu saves sr and the program counter (pc) to the stack. the priority level value of the accepted interrupt is written to sr bits i3?0. for nmi, however, the priority level is 16, but the value set in i3?0 is h'f (level 15). next, the start address of the exception service routine is fetched from the exception processing vector table for the accepted interrupt, that address is jumped to and execution begins. see section 6.4, interrupt operation, for more information on the interrupt exception processing. 5.5 exceptions triggered by instructions exception processing can be triggered by trap instructions, general illegal instructions, and illegal slot instructions, as shown in table 5.9.
93 table 5.9 types of exceptions triggered by instructions type source instruction comment trap instructions trapa illegal slot instructions undefined code placed immediately after a delayed branch instruction (delay slot) and instructions that rewrite the pc delayed branch instructions: jmp, jsr, bra, bsr, rts, rte, bf/s, bt/s, bsrf, braf instructions that rewrite the pc: jmp, jsr, bra, bsr, rts, rte, bt, bf, trapa, bf/s, bt/s, bsrf, braf general illegal instructions undefined code anywhere besides in a delay slot 5.5.1 trap instructions when a trapa instruction is executed, trap instruction exception processing starts up. the cpu operates as follows: 1. the status register (sr) is saved to the stack. 2. the program counter (pc) is saved to the stack. the pc value saved is the start address of the instruction to be executed after the trapa instruction. 3. the exception service routine start address is fetched from the exception processing vector table that corresponds to the vector number specified in the trapa instruction. that address is jumped to and the program starts executing. the jump that occurs is not a delayed branch. 5.5.2 illegal slot instructions an instruction placed immediately after a delayed branch instruction is said to be placed in a delay slot. when the instruction placed in the delay slot is undefined code, illegal slot exception processing starts up when that undefined code is decoded. illegal slot exception processing also starts up when an instruction that rewrites the program counter (pc) is placed in a delay slot. the processing starts when the instruction is decoded. the cpu handles an illegal slot instruction as follows: 1. the status register (sr) is saved to the stack. 2. the program counter (pc) is saved to the stack. the pc value saved is the jump address of the delayed branch instruction immediately before the undefined code or the instruction that rewrites the pc. 3. the exception service routine start address is fetched from the exception processing vector table that corresponds to the exception that occurred. that address is jumped to and the program starts executing. the jump that occurs is not a delayed branch.
94 5.5.3 general illegal instructions when undefined code placed anywhere other than immediately after a delayed branch instruction (i.e., in a delay slot) is decoded, general illegal instruction exception processing starts up. the cpu handles general illegal instructions the same as illegal slot instructions. unlike processing of illegal slot instructions, however, the program counter value stored is the start address of the undefined code. 5.6 when exception sources are not accepted when an address error or interrupt is generated after a delayed branch instruction or interrupt- disabled instruction, it is sometimes not accepted immediately but stored instead, as shown in table 5.10. when this happens, it will be accepted when an instruction that can accept the exception is decoded. table 5.10 generation of exception sources immediately after a delayed branch instruction or interrupt-disabled instruction exception source point of occurrence address error interrupt immediately after a delayed branch instruction *1 not accepted not accepted immediately after an interrupt-disabled instruction *2 accepted not accepted notes: 1. delayed branch instructions: jmp, jsr, bra, bsr, rts, rte, bf/s, bt/s, bsrf, braf 2. interrupt-disabled instructions: ldc, ldc.l, stc, stc.l, lds, lds.l, sts, sts.l 5.6.1 immediately after a delayed branch instruction when an instruction placed immediately after a delayed branch instruction (delay slot) is decoded, neither address errors nor interrupts are accepted. the delayed branch instruction and the instruction located immediately after it (delay slot) are always executed consecutively, so no exception processing occurs during this period. 5.6.2 immediately after an interrupt-disabled instruction when an instruction immediately following an interrupt-disabled instruction is decoded, interrupts are not accepted. address errors are accepted.
95 5.7 stack status after exception processing ends the status of the stack after exception processing ends is as shown in table 5.11. table 5.11 types of stack status after exception processing ends types stack status address error 32 bits 32 bits sr address of instruction after executed instruction sp trap instruction 32 bits 32 bits sr address of instruction after trapa instruction sp general illegal instruction 32 bits 32 bits sr start address of illegal instruction sp interrupt 32 bits 32 bits sr address of instruction after executed instruction sp illegal slot instruction 32 bits 32 bits sr jump destination address of delay branch instruction sp
96 5.8 notes on use 5.8.1 value of stack pointer (sp) the value of the stack pointer must always be a multiple of four. if it is not, an address error will occur when the stack is accessed during exception processing. 5.8.2 value of vector base register (vbr) the value of the vector base register must always be a multiple of four. if it is not, an address error will occur when the stack is accessed during exception processing. 5.8.3 address errors caused by stacking of address error exception processing when the stack pointer is not a multiple of four, an address error will occur during stacking of the exception processing (interrupts, etc.) and address error exception processing will start up as soon as the first exception processing is ended. address errors will then also occur in the stacking for this address error exception processing. to ensure that address error exception processing does not go into an endless loop, no address errors are accepted at that point. this allows program control to be shifted to the address error exception service routine and enables error processing. when an address error occurs during exception processing stacking, the stacking bus cycle (write) is executed. during stacking of the status register (sr) and program counter (pc), the sp is ? for both, so the value of sp will not be a multiple of four after the stacking either. the address value output during stacking is the sp value, so the address where the error occurred is itself output. this means the write data stacked will be undefined.
97 section 6 interrupt controller (intc) 6.1 overview the interrupt controller (intc) ascertains the priority of interrupt sources and controls interrupt requests to the cpu. the intc has registers for setting the priority of each interrupt which can be used by the user to order the priorities in which the interrupt requests are processed. 6.1.1 features the intc has the following features: 16 levels of interrupt priority: by setting the eight interrupt-priority level registers, the priorities of irq interrupts and on-chip peripheral module interrupts can be set in 16 levels for different request sources. nmi noise canceler function: nmi input level bits indicate the nmi pin status. by reading these bits with the interrupt exception service routine, the pin status can be confirmed, enabling it to be used as a noise canceler. notification of interrupt occurrence can be reported externally ( irqout pin). for example, it is possible to request bus rights if an external bus master is informed that a peripheral module interrupt has occurred when the lsi has released the bus rights. 6.1.2 block diagram figure 6.1 is a block diagram of the intc.
98 cpu sr interrupt request com- parator cpu/ dtc request judg- ment priority ranking judg- ment input control (interrupt request) (interrupt request) (interrupt request) (interrupt request) (interrupt request) (interrupt request) (interrupt request) isr icr ipr dter dtc ipra?prh module bus bus interface internal bus i3 i2 i1 i0 intc irqout nmi irq0 irq1 irq2 irq3 irq4 irq5 irq6 irq7 ubc dmac mtu cmt sci a/d dtc (interrupt request) (interrupt request) (interrupt request) wdt bsc i/o ubc: dmac: mtu: cmt: sci: a/d: dtc: wdt: bsc: user break controller direct memory access controller multifunction timer pulse unit compare match timer serial communication interface a/d converter data transfer controller watchdog timer bus state controller (dram refresh control section) i/o: icr: isr: dter: ipraeiprh: sr: i/o port (port output control section) interrupt control register irq ststus register dtc enable register interrupt priority level setting registers a to h status register figure 6.1 intc block diagram
99 6.1.3 pin configuration table 6.1 shows the intc pin configuration. table 6.1 pin configuration name abbreviation i/o function non-maskable interrupt input pin nmi i input of non-maskable interrupt request signal interrupt request input pins irq0 irq7 i input of maskable interrupt request signals interrupt request output pin irqout o output of notification signal when an interrupt has occurred 6.1.4 register configuration the intc has the 10 registers shown in table 6.2. these registers set the priority of the interrupts and control external interrupt input signal detection. table 6.2 register configuration name abbr. r/w initial value address access sizes interrupt priority register a ipra r/w h'0000 h'ffff8348 8, 16, 32 interrupt priority register b iprb r/w h'0000 h'ffff834a 8, 16, 32 interrupt priority register c iprc r/w h'0000 h'ffff834c 8, 16, 32 interrupt priority register d iprd r/w h'0000 h'ffff834e 8, 16, 32 interrupt priority register e ipre r/w h'0000 h'ffff8350 8, 16, 32 interrupt priority register f iprf r/w h'0000 h'ffff8352 8, 16, 32 interrupt priority register g iprg r/w h'0000 h'ffff8354 8, 16, 32 interrupt priority register h iprh r/w h'0000 h'ffff8356 8, 16, 32 interrupt control register icr r/w * 1 h'ffff8358 8, 16, 32 irq status register isr r(w) * 2 h'0000 h'ffff835a 8, 16, 32 notes: 1. the value when the nmi pin is high is h'8000; when the nmi pin is low, it is h'0000. 2. only 0 can be written, in order to clear flags.
100 6.2 interrupt sources there are four types of interrupt sources: nmi, user breaks, irq, and on-chip peripheral modules. each interrupt has a priority expressed as a priority level (0 to 16, with 0 the lowest and 16 the highest). giving an interrupt a priority level of 0 masks it. 6.2.1 nmi interrupts the nmi interrupt has priority 16 and is always accepted. input at the nmi pin is detected by edge. use the nmi edge select bit (nmie) in the interrupt control register (icr) to select either the rising or falling edge. nmi interrupt exception processing sets the interrupt mask level bits (i3?0) in the status register (sr) to level 15. 6.2.2 user break interrupt a user break interrupt has a priority of level 15, and occurs when the break condition set in the user break controller (ubc) is satisfied. user break interrupt requests are detected by edge and are held until accepted. user break interrupt exception processing sets the interrupt mask level bits (i3?0) in the status register (sr) to level 15. for more information about the user break interrupt, see section 7, user break controller. 6.2.3 irq interrupts irq interrupts are requested by input from pins irq0 e irq7 . set the irq sense select bits (irq0seirq7s) of the interrupt control register (icr) to select low level detection or falling edge detection for each pin. the priority level can be set from 0 to 15 for each pin using the interrupt priority registers a and b (ipraeiprb). when irq interrupts are set to low level detection, an interrupt request signal is sent to the intc during the period the irq pin is low level. interrupt request signals are not sent to the intc when the irq pin becomes high level. interrupt request levels can be confirmed by reading the irq flags (irq0feirq7f) of the irq status register (isr). when irq interrupts are set to falling edge detection, interrupt request signals are sent to the intc upon detecting a change on the irq pin from high to low level. irq interrupt request detection results are maintained until the interrupt request is accepted. confirmation that irq interrupt requests have been detected is possible by reading the irq flags (irq0feirq7f) of the irq status register (isr), and by writing a 0 after reading a 1, irq interrupt request detection results can be withdrawn. in irq interrupt exception processing, the interrupt mask bits (i3ei0) of the status register (sr) are set to the priority level value of the accepted irq interrupt.
101 6.2.4 on-chip peripheral module interrupts on-chip peripheral module interrupts are interrupts generated by the following on-chip peripheral modules: direct memory access controller (dmac) multifunction timer/pulse unit (mtu) compare match timer (cmt) serial communications interface (sci) a/d converter (a/d) data transfer controller (dtc) watchdog timer (wdt) bus state controller (bsc) i/o port (i/o) 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 between 0 and 15 can be assigned to individual on-chip peripheral modules in interrupt priority registers ceh (iprce iprh). on-chip peripheral module interrupt exception processing sets the interrupt mask level bits (i3ei0) in the status register (sr) to the priority level value of the on-chip peripheral module interrupt that was accepted. 6.2.5 interrupt exception vectors and priority rankings table 6.3 lists interrupt sources and their vector numbers, vector table address offsets and interrupt priorities. each interrupt source is allocated a different vector number and vector table address offset. vector table addresses are calculated from vector numbers and address offsets. in interrupt exception processing, the exception service routine start address is fetched from the vector table indicated by the vector table address. see table 5.4, calculating exception processing vector table addresses. irq interrupts and on-chip peripheral module interrupt priorities can be set freely between 0 and 15 for each pin or module by setting interrupt priority registers aeh (ipraeiprh). the ranking of interrupt sources for iprceiprh, however, must be the order listed under priority order within ipr setting range in table 6.3 and cannot be changed. a power-on reset assigns priority level 0 to irq interrupts 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 6.3.
102 table 6.3 interrupt exception processing vectors and priorities interrupt vector interrupt priority interrupt source vector no. vector table address offset priority (initial value) corre- sponding ipr (bits) within ipr setting range default priority nmi 11 h'0000002c h'0000002f 16 high user break 12 h'00000030 h'00000033 15 irq0 64 h'00000100 h'00000103 0?5 (0) ipra (15?2) irq1 65 h'00000104 h'00000107 0?5 (0) ipra (11?) irq2 66 h'00000108 h'0000010b 0?5 (0) ipra (7?) irq3 67 h'0000010c h'0000010f 0?5 (0) ipra (3?) irq4 68 h'00000110 h'00000113 0?5 (0) iprb (15?2) irq5 69 h'00000114 h'00000117 0?5 (0) iprb (11?) irq6 70 h'00000118 h'0000011b 0?5 (0) iprb (7?) irq7 71 h'0000011c h'0000011f 0?5 (0) iprb (3?) dmac0 dei0 72 h'00000120 h'00000123 0?5 (0) iprc (15?2) dmac1 dei1 76 h'00000130 h'00000133 0?5 (0) iprc (11?) dmac2 dei2 80 h'00000140 h'00000143 0?5 (0) iprc (7?) dmac3 dei3 84 h'00000150 h'00000153 0?5 (0) iprc (3?) low
103 table 6.3 interrupt exception processing vectors and priorities (cont) interrupt vector interrupt priority interrupt source vector no. vector table address offset priority (initial value) corre- sponding ipr (bits) within ipr setting range default priority mtu0 tgi0a 88 h'00000160 h'00000163 0?5 (0) iprd (15?2) high high tgi0b 89 h'00000164 h'00000167 0?5 (0) tgi0c 90 h'00000168 h'0000016b 0?5 (0) tgi0d 91 h'0000016c h'0000016f 0?5 (0) low tci0v 92 h'00000170 h'00000173 0?5 (0) iprd (11?) mtu1 tgi1a 96 h'00000180 h'00000183 0?5 (0) iprd (7?) high tgi1b 97 h'00000184 h'00000187 0?5 (0) low tci1v 100 h'00000190 h'00000193 0?5 (0) iprd (3?) high tci1u 101 h'00000194 h'00000197 0?5 (0) low mtu2 tgi2a 104 h'000001a0 h'000001a3 0?5 (0) ipre (15?2) high tgi2b 105 h'000001a4 h'000001a7 0?5 (0) low tci2v 108 h'000001b0 h'000001b3 0?5 (0) ipre (11?) high tci2u 109 h'000001b4 h'000001b7 0?5 (0) low low
104 table 6.3 interrupt exception processing vectors and priorities (cont) interrupt vector interrupt priority interrupt source vector no. vector table address offset priority (initial value) corre- sponding ipr (bits) within ipr setting range default priority mtu3 tgi3a 112 h'000001c0 h'000001c3 0?5 (0) ipre (7?) high high tgi3b 113 h'000001c4 h'000001c7 0?5 (0) tgi3c 114 h'000001c8 h'000001cb 0?5 (0) tgi3d 115 h'000001cc h'000001cf 0?5 (0) low tci3v 116 h'000001d0 h'000001d3 0?5 (0) ipre (3?) mtu4 tgi4a 120 h'000001e0 h'000001e3 0?5 (0) iprf (15?2) high tgi4b 121 h'000001e4 h'000001e7 0?5 (0) tgi4c 122 h'000001e8 h'000001eb 0?5 (0) tgi4d 123 h'000001ec h'000001ef 0?5 (0) low tci4v 124 h'000001f0 h'000001f3 0?5 (0) iprf (11?) high reserved 125 h'000001f4 h'000001f7 0?5 (0) low sci0 eri0 128 h'00000200 h'00000203 0?5 (0) iprf (7?) high rxi0 129 h'00000204 h'00000207 0?5 (0) txi0 130 h'00000208 h'0000020b 0?5 (0) tei0 131 h'0000020c h'0000020f 0?5 (0) low low
105 table 6.3 interrupt exception processing vectors and priorities (cont) interrupt vector interrupt priority interrupt source vector no. vector table address offset priority (initial value) corre- sponding ipr (bits) within ipr setting range default priority sci1 eri1 132 h'00000210 h'00000213 0?5 (0) iprf (3?) high high rxi1 133 h'00000214 h'00000217 0?5 (0) txi1 134 h'00000218 h'0000021b 0?5 (0) tei1 135 h'0000021c h'0000021f 0?5 (0) low a/d* adi 136 h'00000220 h'00000223 0?5 (0) iprg (15?2) dtc swdtce 140 h'00000230 h'00000233 0?5 (0) iprg (11?) cmt0 cmi0 144 h'00000240 h'00000243 0?5 (0) iprg (7?) cmt1 cmi1 148 h'00000250 h'00000253 0?5 (0) iprg (3?) wdt iti 152 h'00000260 h'00000263 0?5 (0) iprh (15?2) high bsc cmi 153 h'00000264 h'00000267 0?5 (0) low i/o oei 156 h'00000270 h'00000273 0?5 (0) iprh (11?) low note: for a mask products, a/d is as follows a/d adi0 136 h'00000220 h'00000223 0?5 (0) iprg (15?2) high adi1 137 h'00000224 h'00000227 0?5 (0) low
106 6.3 description of registers 6.3.1 interrupt priority registers a? (ipra?prh) interrupt priority registers a? (ipra?prh) are 16-bit readable/writable registers that set priority levels from 0 to 15 for irq interrupts and on-chip peripheral module interrupts. correspondence between interrupt request sources and each of the ipra?prh bits is shown in table 6.4. bit: 15 14 13 12 11 10 9 8 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 bit: 7 6 5 4 3 2 1 0 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 6.4 interrupt request sources and ipra?prh bits register 15?2 11? 7? 3? interrupt priority register a irq0 irq1 irq2 irq3 interrupt priority register b irq4 irq5 irq6 irq7 interrupt priority register c dmac0 dmac1 dmac2 dmac3 interrupt priority register d mtu0 mtu0 mtu1 mtu1 interrupt priority register e mtu2 mttu2 mtu3 mtu3 interrupt priority register f mtu4 mtu4 sci0 sci1 interrupt priority register g a/d(a/d0, a/d1)* dtc cmt0 cmt1 interrupt priority register h wdt, bsc i/o reserved reserved note: excluding a mask products are a/d, a mask products are a/d0 and a/d1.
107 as indicated in table 6.4, four irq pins or groups of 4 on-chip peripheral modules are allocated to each register. each of the corresponding interrupt priority ranks are established by setting a value from h'0 (0000) to h'f (1111) in each of the four-bit groups 15e12, 11e8, 7e4 and 3e0. interrupt priority rank becomes level 0 (lowest) by setting h'0, and level 15 (highest) by setting h'f. if multiple on-chip peripheral modules are assigned to wdt and bsc, those multiple modules are set to the same priority rank. ipraeiprh are initialized to h'0000 by a power-on reset or a manual reset. they are not initialized in standby mode. 6.3.2 interrupt control register (icr) the icr is a 16-bit register that sets the input signal detection mode of the external interrupt input pin nmi and irq0 e irq7 and indicates the input signal level to the nmi pin. a power-on reset initializes icr but the standby mode does not. bit: 15 14 13 12 11 10 9 8 nmil nmie initial value: * 0 0 0 0 0 0 0 r/w: r r r r r r r r/w bit: 7 6 5 4 3 2 1 0 irq0s irq1s irq2s irq3s irq4s irq5s irq6s irq7s 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 note: when nmi input is high: 1; when nmi input is low: 0 bit 15?nmi input level (nmil): sets the level of the signal input at the nmi pin. this bit can be read to determine the nmi pin level. this bit cannot be modified. bit 15: nmil description 0 nmi input level is low 1 nmi input level is high bits 14e9?reserved: these bits always read as 0. the write value should always be 0.
108 bit 8?nmi edge select (nmie) bit 8: nmie description 0 interrupt request is detected on falling edge of nmi input (initial value) 1 interrupt request is detected on rising edge of nmi input bits 7e0?irq0eirq7 sense select (irq0seirq7s): these bits set the irq0eirq7 interrupt request detection mode. bits 7-0: irq0s?rq7s description 0 interrupt request is detected on low level of irq input (initial value) 1 interrupt request is detected on falling edge of irq input 6.3.3 irq status register (isr) the isr is a 16-bit register that indicates the interrupt request status of the external interrupt input pins irq0 e irq7 . when irq interrupts are set to edge detection, held interrupt requests can be withdrawn by writing a 0 to irqnf after reading an irqnf = 1. a power-on reset initializes isr but the standby mode does not. bit: 15 14 13 12 11 10 9 8 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 1 0 irq0f irq1f irq2f irq3f irq4f irq5f irq6f irq7f 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 bits 15e8?reserved: these bits always read as 0. the write value should always be 0.
109 bits 7e0?irq0eirq7 flags (irq0feirq7f): these bits display the irq0eirq7 interrupt request status. bits 7-0: irq0f?rq7f detection setting description 0 level detection no irqn interrupt request exists. clear conditions: when irqn input is high level edge detection no irqn interrupt request was detected. (initial value) clear conditions: 1. when a 0 is written after reading irqnf = 1 status 2. when irqn interrupt exception processing has been executed 3. when a dtc transfer due to irqn interrupt has been executed 1 level detection an irqn interrupt request exists. set conditions: when irqn input is low level edge detection an irqn interrupt request was detected. set conditions: when a falling edge occurs at an irqn input irq pin edge detection selection cpu interrupt request dtc activation request judgment (irqn interrupt acceptance/dtc transfer completion/irqnf = 0 write after irqnf = 1 read) s r resirqn q irqns (0: level, 1: edge) isr.irqnf level detection dtc figure 6.2 external interrupt process
110 6.4 interrupt operation 6.4.1 interrupt sequence the sequence of interrupt operations is explained below. figure 6.3 is a flowchart of the operations. 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 levels set in interrupt priority level setting registers a? (ipra?prh). lower-priority interrupts are ignored. they are held pending until interrupt requests designated as edge-detect type are accepted. for irq interrupts, however, withdrawal is possible by accessing the irq status register (isr). see section 6.2.3, irq interrupts, for details. interrupts held pending due to edge detection are cleared by a power-on reset or a manual reset. if two of these interrupts have the same priority level or if multiple interrupts occur within a single module, the interrupt with the highest default priority or the highest priority within its ipr setting range (as indicated in table 6.3) is selected. 3. the interrupt controller compares the priority level of the selected interrupt request with the interrupt mask bits (i3?0) in the cpu? status register (sr). if the request priority level is equal to or less than the level set in i3?0, the request is ignored. if the request priority level is higher than the level in bits i3?0, the interrupt controller accepts the interrupt and sends an interrupt request signal to the cpu. 4. when the interrupt controller accepts an interrupt, a low level is output from the irqout pin. 5. the cpu detects the interrupt request sent from the interrupt controller when it decodes the next instruction to be executed. instead of executing the decoded instruction, the cpu starts interrupt exception processing (figure 6.4). 6. sr and pc are saved onto the stack. 7. the priority level of the accepted interrupt is copied to the interrupt mask level bits (i3ei0) in the status register (sr). 8. when the accepted interrupt is sensed by level or is from an on-chip peripheral module, a high level is output from the irqout pin. when the accepted interrupt is sensed by edge, a high level is output from the irqout pin at the point when the cpu starts interrupt exception processing instead of instruction execution as noted in (5) above. however, if the interrupt controller accepts an interrupt with a higher priority than one it is in the midst of accepting, the irqout pin will remain low level. 9. the cpu reads the start address of the exception service routine from the exception vector table for the accepted interrupt, jumps to that address, and starts executing the program there. this jump is not a delay branch.
111 no yes nmi? no yes user break? no yes level 15 interrupt? no yes i3 to i0 level 14? no yes level 14 interrupt? no yes yes i3 to i0 level 13? no yes level 1 interrupt? no yes i3 to i0 = level 0? no program execution state irqout = low level* 1 save sr to stack save pc to stack irqout = high level* 2 branches to exception service routine i3 to i0: interrupt mask bits of status register interrupt? copy accept-interrupt level to i3 to i0 reads exception vector table notes: 1. 2. irqout is the same signal as the interrupt request signal to the cpu (see figure 6.1). thus, it is output when there is a higher priority interrupt request than the one in the i3 to i0 bits of the sr. when the accepted interrupt is sensed by edge, the irqout pin becomes high level at the point when the cpu starts interrupt exception processing instead of instruction execution (before sr is saved to the stack). if the interrupt controller has accepted another interrupt with a higher priority and has output an interrupt request to the cpu, the irqout pin will remain low level. figure 6.3 interrupt sequence flowchart
112 6.4.2 stack after interrupt exception processing figure 6.4 shows the stack after interrupt exception processing. 32 bits 32 bits pc* 1 sr address 4n? 4n? 4n sp* 2 notes: 1. 2. pc: start address of the next instruction (return destination instruction) after the executing instruction always be certain that sp is a multiple of 4 figure 6.4 stack after interrupt exception processing 6.5 interrupt response time table 6.5 indicates the interrupt response time, which is the time from the occurrence of an interrupt request until the interrupt exception processing starts and fetching of the first instruction of the interrupt service routine begins. figure 6.5 shows the pipeline when an irq interrupt is accepted.
113 table 6.5 interrupt response time number of states item nmi, peripheral module irq notes dmac/dtc active judgment 0 or 1 1 1 state required for interrupt signals for which dmac/dtc activation is possible compare identified inter- rupt priority with sr mask level 23 wait for completion of sequence currently being executed by cpu x ( 3 0) the longest sequence is for interrupt or address-error exception processing (x = 4 + m1 + m2 + m3 + m4). if an interrupt-masking instruction follows, however, the time may be even longer. time from start of interrupt exception processing until fetch of first instruction of exception service routine starts 5 + m1 + m2 + m3 performs the pc and sr saves and vector address fetch. interrupt total: 7 + m1 + m2 + m3 9 + m1 + m2 + m3 response minimum: 10 12 0.35?.42 ? at 28.7 mhz time maximum: 12 + 2 (m1 + m2 + m3) + m4 13 + 2 (m1 + m2 + m3) + m4 0.67?.70 ? at 28.7 mhz* note: when m1 = m2 = m3 = m4 = 1 m1?4 are the number of states needed for the following memory accesses. m1: sr save (longword write) m2: pc save (longword write) m3: vector address read (longword read) m4: fetch first instruction of interrupt service routine
114 fde mee mme ee fd f 3 1 3 interrupt acceptance irq m1 m2 1 m3 1 5 + m1 + m2 + m3 instruction (instruction replaced by interrupt exception processing) overrun fetch interrupt service routine start instruction f: d: e: m: instruction fetch (instruction fetched from memory where program is stored). instruction decoding (fetched instruction is decoded). instruction execution (data operation and address calculation is performed according to the results of decoding). memory access (data in memory is accessed). figure 6.5 pipeline when an irq interrupt is accepted 6.6 data transfer with interrupt request signals the following data transfers can be done using interrupt request signals: activate dmac only, without generating cpu interrupt activate dtc only, cpu interrupts according to dtc settings among interrupt sources, those designated as dmac activating sources are masked and not input to the intc. the masking condition is listed below: mask condition = dme ?(de0 ?source selection 0 + de1 source selection 1 + de2 source selection 2 + de3 ?source selection 3) the intc masks cpu interrupts when the corresponding dte bit is a 1. the dte clear condition and interrupt source flag clear condition are listed below. dte clear condition = dtc transfer end ?dteclr interrupt source flag clear condition = dtc transfer end ? dteclr + dmac transfer end where: dteclr = disel + counter 0. figure 6.6 shows a control block diagram.
115 interrupt source interrupt source flag clear (by dmac) interrupt source (those not designated as dmac activating sources) cpu interrupt request dtc activation request dteclr transfer end dte clear interrupt source flag clear (by dtc) dter dmac figure 6.6 interrupt control block diagram 6.6.1 handling dtc activating and cpu interrupt sources, but not dmac activating sources 1. either do not select the dmac as a source, or clear the dme bit to 0. 2. for dtc, set the corresponding dte bits and disel bits to 1. 3. activating sources are applied to the dtc when interrupts occur. 4. when the dtc performs a data transfer, it clears the dte bit to 0 and sends an interrupt request to the cpu. the activating source does not clear. 5. the cpu clears interrupt sources with its interrupt processing routine. it then confirms the transfer counter value. when the transfer counter value 0, it sets the dte bit to 1 and allows the next data transfer. if the transfer counter value = 0, it performs the necessary end processing in the interrupt processing routine.
116 6.6.2 handling dmac activating sources but not cpu interrupt or dtc activating sources 1. select the dmac as a source and set the dme bit to 1. cpu interrupt sources and dtc activating sources are masked regardless of the interrupt priority level register settings or dtc register settings. 2. activating sources are applied to the dmac when interrupts occur. 3. the dmac clears activating sources at the time of data transfer. 6.6.3 handling dtc activating sources but not cpu interrupt or dmac activating sources 1. either do not select the dmac as a source, or clear the dme bit to 0. 2. for dtc, set the corresponding dte bits to 1 and clear the disel bits to 0. 3. activating sources are applied to the dtc when interrupts occur. 4. when the dtc performs a data transfer, it clears the activating source. an interrupt request is not sent to the cpu, because the dte bit is maintained as a 1. 5. however, when the transfer counter value = 0 the dte bit is cleared to 0 and an interrupt request is sent to the cpu. 6. the cpu performs the necessary end processing in the interrupt processing routine. 6.6.4 treating cpu interrupt sources but not dtc or dmac activating sources 1. either do not select the dmac as a source, or clear the dme bit to 0. 2. for dtc, clear the corresponding dte bits to 0. 3. when interrupts occur, interrupt requests are sent to the cpu. 4. the cpu clears the interrupt source and performs the necessary processing in the interrupt processing routine.
117 section 7 user break controller (ubc) 7.1 overview the user break controller (ubc) provides functions that simplify program debugging. break conditions are set in the ubc and a user break interrupt is generated according to the conditions of the bus cycle generated by the cpu, dmac, or dtc. this function makes it easy to design an effective self-monitoring debugger, enabling the chip to easily debug programs without using a large in-circuit emulator. 7.1.1 features the features of the user break controller are: break compare conditions can be set: ? address ? cpu cycle or dma/dtc cycle ? instruction fetch or data access ? read or write ? operand size: byte/word/longword user break interrupt generated upon satisfying break conditions. a user-designed user break interrupt exception processing routine can be run. select either to break in the cpu instruction fetch cycle before the instruction is executed or after. 7.1.2 block diagram figure 7.1 shows a block diagram of the ubc.
118 internal bus bus interface break condition comparator module bus ubbr ubamrh ubarh ubamrl ubarl interrupt request interrupt controller user break interrupt generating circuit ubc ubarh, ubarl: ubamrh, ubamrl: ubbr: user break address registers h, l user break address mask registers h, l user break bus cycle register figure 7.1 user break controller block diagram 7.1.3 register configuration the ubc has the five registers shown in table 7.1. break conditions are established using these registers.
119 table 7.1 register configuration name abbr. r/w initial value address* access size user break address register h ubarh r/w h'0000 h'ffff8600 8, 16, 32 user break address register l ubarl r/w h'0000 h'ffff8602 8, 16, 32 user break address mask register h ubamrh r/w h'0000 h'ffff8604 8, 16, 32 user break address mask register l ubamrl r/w h'0000 h'ffff8606 8, 16, 32 user break bus cycle register ubbr r/w h'0000 h'ffff8608 8, 16, 32 7.2 register descriptions 7.2.1 user break address register (ubar) the user break address register (ubar) consists of user break address register h (ubarh) and user break address register l (ubarl). both are 16-bit readable/writable registers. ubarh stores the upper bits (bits 31?6) of the address of the break condition, while ubarl stores the lower bits (bits 15?). resets and hardware standbys initialize both ubarh and ubarl to h'0000. they are not initialized in manual reset or software standby mode. ubarh: bit: 15 14 13 12 11 10 9 8 ubarh uba31 uba30 uba29 uba28 uba27 uba26 uba25 uba24 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 bit: 7 6 5 4 3 2 1 0 ubarh uba23 uba22 uba21 uba20 uba19 uba18 uba17 uba16 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
120 ubarl: bit: 15 14 13 12 11 10 9 8 ubarl uba15 uba14 uba13 uba12 uba11 uba10 uba9 uba8 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 bit: 7 6 5 4 3 2 1 0 ubarl uba7 uba6 uba5 uba4 uba3 uba2 uba1 uba0 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 ubarh bits 15e0?user break address 31e16 (uba31euba16): these bits store the upper bit values (bits 31e16) of the address of the break condition. ubarl bits 15e0?user break address 15e0 (uba15euba0): these bits store the lower bit values (bits 15e0) of the address of the break condition. 7.2.2 user break address mask register (ubamr) the user break address mask register (ubamr) consists of user break address mask register h (ubamrh) and user break address mask register l (ubamrl). both are 16-bit readable/writable registers. ubamrh designates whether to mask any of the break address bits established in the ubarh, and ubamrl designates whether to mask any of the break address bits established in the ubarl. resets and hardware standbys initialize both ubamrh and ubamrl to h'0000. they are not initialized in manual reset or software standby mode. ubamrh: bit: 15 14 13 12 11 10 9 8 ubamrh ubm31 ubm30 ubm29 ubm28 ubm27 ubm26 ubm25 ubm24 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 bit: 7 6 5 4 3 2 1 0 ubamrh ubm23 ubm22 ubm21 ubm20 ubm19 ubm18 ubm17 ubm16 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
121 ubamrl: bit: 15 14 13 12 11 10 9 8 ubamrl ubm15 ubm14 ubm13 ubm12 ubm11 ubm10 ubm9 ubm8 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 bit: 7 6 5 4 3 2 1 0 ubamrl ubm7 ubm6 ubm5 ubm4 ubm3 ubm2 ubm1 ubm0 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 ubamrh bits 15e0?user break address mask 31e16 (ubm31eubm16): these bits designate whether to mask any of the break address 31e16 bits (uba31euba16) established in the ubarh. ubamrl bits 15e0?user break address mask 15e0 (ubm15eubm0): these bits designate whether to mask any of the break address 15e0 bits (uba15euba0) established in the ubarl. bits 15 0: ubmn description 0 break address uban is included in the break conditions (initial value) 1 break address uban is not included in the break conditions note: n = 31? 7.2.3 user break bus cycle register (ubbr) user break bus cycle register (ubbr) is a 16-bit readable/writable register that selects from among the following four break conditions: 1. cpu cycle/ dmac/dtc cycle 2. instruction fetch/data access 3. read/write 4. operand size (byte, word, longword) resets and hardware standbys initialize the ubbr to h'0000. it is not initialized in software standby mode.
122 bit: 15 14 13 12 11 10 9 8 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 1 0 cp1 cp0 id1 id0 rw1 rw0 sz1 sz0 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 bits 15??eserved: these bits always read as 0. the write value should always be 0. bits 7 and 6?cpu cycle/peripheral cycle select (cp1, cp0): these bits designate break conditions for cpu cycles or peripheral cycles (dma/dtc cycles). bit 7: cp1 bit 6: cp0 description 0 0 no user break interrupt occurs (initial value) 1 break on cpu cycles 1 0 break on peripheral cycles 1 break on both cpu and peripheral cycles bits 5 and 4?instruction fetch/data access select (id1, id0): these bits select whether to break on instruction fetch and/or data access cycles. bit 5: id1 bit 4: id0 description 0 0 no user break interrupt occurs (initial value) 1 break on instruction fetch cycles 1 0 break on data access cycles 1 break on both instruction fetch and data access cycles
123 bits 3 and 2?read/write select (rw1, rw0): these bits select whether to break on read and/or write cycles. bit 3: rw1 bit 2: rw0 description 0 0 no user break interrupt occurs (initial value) 1 break on read cycles 1 0 break on write cycles 1 break on both read and write cycles bits 1 and 0?operand size select (sz1, sz0): these bits select operand size as a break condition. bit 1: sz1 bit 0: sz0 description 0 0 operand size is not a break condition (initial value) 1 break on byte access 1 0 break on word access 1 break on longword access note: when breaking on an instruction fetch, set the sz0 bit to 0. all instructions are considered to be word-size accesses (even when there are instructions in on-chip memory and 2 instruction fetches are done simultaneously in 1 bus cycle). operand size is word for instructions or determined by the operand size specified for the cpu/dmac data access. it is not determined by the bus width of the space being accessed.
124 7.3 operation 7.3.1 flow of the user break operation the flow from setting of break conditions to user break interrupt exception processing is described below: 1. the user break addresses are set in the user break address register (ubar), the desired masked bits in the addresses are set in the user break address mask register (ubamr) and the breaking bus cycle type is set in the user break bus cycle register (ubbr). if even one of the three groups of the ubbr? cpu cycle/peripheral cycle select bits (cp1, cp0), instruction fetch/data access select bits (id1, id0), and read/write select bits (rw1, rw0) is set to 00 (no user break interrupt is generated), no user break interrupt will be generated even if all other conditions are in agreement. when using user break interrupts, always be certain to establish bit conditions for all of these three groups. 2. the ubc uses the method shown in figure 7.2 to judge whether set conditions have been fulfilled. when the set conditions are satisfied, the ubc sends a user break interrupt request signal to the interrupt controller (intc). 3. the interrupt controller checks the accepted user break interrupt request signal? priority level. the user break interrupt has priority level 15, so it is accepted only if the interrupt mask level in bits i3?0 in the status register (sr) is 14 or lower. when the i3?0 bit level is 15, the user break interrupt cannot be accepted but it is held pending until user break interrupt exception processing can be carried out. consequently, user break interrupts within nmi exception service routines cannot be accepted, since the i3?0 bit level is 15. however, if the i3?0 bit level is changed to 14 or lower at the start of the nmi exception service routine, user break interrupts become acceptable thereafter. section 6, interrupt controller, describes the handling of priority levels in greater detail. 4. the intc sends the user break interrupt request signal to the cpu, which begins user break interrupt exception processing upon receipt. see section 6.4, interrupt operation, for details on interrupt exception processing.
125 sz1 sz0 user break interrupt rw1 rw0 id1 id0 cp1 cp0 ubarh/ubarl ubamrh/ubamrl 32 32 32 32 32 internal address bits 31? cpu cycle dma/dtc cycle instruction fetch data access read cycle write cycle byte size word size longword size figure 7.2 break condition judgment method
126 7.3.2 break on on-chip memory instruction fetch cycle on-chip memory (on-chip rom and/or ram) is always accessed as 32 bits in 1 bus cycle. therefore, 2 instructions can be retrieved in 1 bus cycle when fetching instructions from on-chip memory. at such times, only 1 bus cycle is generated, but by setting the start addresses of both instructions in the user break address register (ubar) it is possible to cause independent breaks. in other words, when wanting to effect a break using the latter of two addresses retrieved in 1 bus cycle, set the start address of that instruction in ubar. the break will occur after execution of the former instruction. 7.3.3 program counter (pc) values saved break on instruction fetch (before execution): the program counter (pc) value saved to the stack in user break interrupt exception processing is the address that matches the break condition. the user break interrupt is generated before the fetched instruction is executed. if a break condition is set in an instruction fetch cycle placed immediately after a delayed branch instruction (delay slot), or on an instruction that follows an interrupt-disabled instruction, however, the user break interrupt is not accepted immediately, but the break condition establishing instruction is executed. the user break interrupt is accepted after execution of the instruction that has accepted the interrupt. in this case, the pc value saved is the start address of the instruction that will be executed after the instruction that has accepted the interrupt. break on data access (cpu/peripheral): the program counter (pc) value is the top address of the next instruction after the last instruction executed before the user break exception processing started. when data access (cpu/peripheral) is set as a break condition, the place where the break will occur cannot be specified exactly. the break will occur at the instruction fetched close to where the data access that is to receive the break occurs. 7.4 use examples 7.4.1 break on cpu instruction fetch cycle 1. register settings: ubarh = h'0000 ubarl = h'0404 ubbr = h'0054 conditions set: address: h'00000404 bus cycle: cpu, instruction fetch, read (operand size not included in conditions) a user break interrupt will occur before the instruction at address h'00000404. if it is possible for the instruction at h'00000402 to accept an interrupt, the user break exception processing will be executed after execution of that instruction. the instruction at h'00000404 is not executed. the pc value saved is h'00000404.
127 2. register settings: ubarh = h'0015 ubarl = h'389c ubbr = h'0058 conditions set: address: h'0015389c bus cycle: cpu, instruction fetch, write (operand size not included in conditions) a user break interrupt does not occur because the instruction fetch cycle is not a write cycle. 3. register settings: ubarh = h'0003 ubarl = h'0147 ubbr = h'0054 conditions set: address: h'00030147 bus cycle: cpu, instruction fetch, read (operand size not included in conditions) a user break interrupt does not occur because the instruction fetch was performed for an even address. however, if the first instruction fetch address after the branch is an odd address set by these conditions, user break interrupt exception processing will be done after address error exception processing. 7.4.2 break on cpu data access cycle 1. register settings: ubarh = h'0012 ubarl = h'3456 ubbr = h'006a conditions set: address: h'00123456 bus cycle: cpu, data access, write, word a user break interrupt occurs when word data is written into address h'00123456. 2. register settings: ubarh = h'00a8 ubarl = h'0391 ubbr = h'0066 conditions set: address: h'00a80391 bus cycle: cpu, data access, read, word a user break interrupt does not occur because the word access was performed on an even address.
128 7.4.3 break on dma/dtc cycle 1. register settings: ubarh = h'0076 ubarl = h'bcdc ubbr = h'00a7 conditions set: address: h'0076bcdc bus cycle: dma/dtc, data access, read, longword a user break interrupt occurs when longword data is read from address h'0076bcdc. 2. register settings: ubarh = h'0023 ubarl = h'45c8 ubbr = h'0094 conditions set: address: h'002345c8 bus cycle: dma/dtc, instruction fetch, read (operand size not included in conditions) a user break interrupt does not occur because no instruction fetch is performed in the dma/dtc cycle. 7.5 cautions on use 7.5.1 on-chip memory instruction fetch two instructions are simultaneously fetched from on-chip memory. if a break condition is set on the second of these two instructions but the contents of the ubc break condition registers are changed so as to alter the break condition immediately after the first of the two instructions is fetched, a user break interrupt will still occur when the second instruction is fetched. 7.5.2 instruction fetch at branches when a conditional branch instruction or trapa instruction causes a branch, instructions are fetched and executed as follows: 1. conditional branch instruction, branch taken: bt, bf instruction fetch cycles: conditional branch instruction fetch ? next-instruction overrun fetch ? next-instruction overrun fetch ? branch destination instruction fetch instruction execution: conditional branch instruction execution ? branch destination instruction execution 2. trapa instruction, branch taken: trapa instruction fetch cycles: trapa instruction fetch ? next-instruction overrun fetch ? next-instruction overrun fetch ? branch destination instruction fetch
129 instruction execution: trapa instruction execution ? branch destination instruction execution 3. conditional delay branch instruction, branch taken: bt/s, bf/s instruction fetch cycles: conditional delay branch instruction fetch ? next-instruction fetch (delay slot) ? next-instruction overrun fetch ? branch destination instruction fetch instruction execution: conditional delay branch instruction execution ? delay slot instruction execution ? branch destination instruction execution when a conditional branch instruction or trapa instruction causes a branch, the branch destination will be fetched after the next instruction or the one after that does an overrun fetch. however, because the instruction that is the object of the break first breaks after a definite instruction fetch and execution, the kind of overrun fetch instructions noted above do not become objects of a break. if data access breaks are also included with instruction fetch breaks as break conditions, a break occurs because the instruction overrun fetch is also regarded as becoming a data break. 7.5.3 contention between user break and exception handling if a user break is set for the fetch of a particular instruction, and exception handling with higher priority than a user break is in contention and is accepted in the decode stage for that instruction (or the next instruction), user break exception handling may not be performed after completion of the higher-priority exception handling routine (on return by rte). thus, if a user break condition has been set for the fetch of the branch destination instruction following a branch (bra, braf, bt, bf, bt/s, bf/s, bsr, bsrf, jmp, jsr, rts, rte, exception handling), and exception handling for this branch destination instruction with a higher priority than a user break interrupt is accepted, user break exception handling will not be performed after completion of that exception handling routine. therefore, a user break condition must not be set for the fetch of the branch destination instruction following a branch. 7.5.4 break at non-delay branch instruction jump destination when a branch instruction with no delay slot (including exception handling) jumps to the jump destination instruction on execution of the branch, a user break will not be generated even if a user break condition has been set for the first jump destination instruction fetch.
131 section 8 data transfer controller (dtc) 8.1 overview the sh7040 series has an on-chip data transfer controller (dtc), which is activated either by interrupts or software and can perform data transfers. 8.1.1 features arbitrary channel number transfer setting possible ? transfer information can be established for each interrupt source ? transfer information stored in memory ? multiple data transfers possible (chain transfers) for one activating source address space: 32-bit addresses can be designated for both transfer source and destination transfer devices ? memory: on-chip rom, on-chip ram, external rom, external ram ? on-chip peripheral modules (excluding dmac/dtc) ? memory-mapped external devices abundant transfer modes ? can select between normal mode/repeat mode/block transfer mode ? can select between increment/decrement/fixed for source/destination address transfer units can be set as byte/word/longword interrupts activating the dtc can be requested of the cpu ? interrupt requests can be generated to the cpu after completion of a data transfer ? interrupt requests generated to the cpu after completion of all designated data transfers transfers can be activated by software
132 8.1.2 block diagram figure 8.1 shows the dtc block diagram. dtc transfer information is located in memory. cpu interrupt request source clear control interrupt request dtc on-chip rom on-chip ram on-chip peripheral module peripheral bus external bus external memory bus controller register control activation control request priority control bus interface dtc module bus dtmr dtcr dtsar dtdar dtiar dter dtcsr dtbr internal bus dtmr: dtcr: dtsar: dtdar: dtc mode register dtc count register dtc source address register dtc destination address register dtiar: dter: dtcsr: dtbr: dtc initial address register dtc enable register dtc control/status register dtc information base register external device (memory- mapped) figure 8.1 dtc block diagram
133 8.2 register configuration the dtc has five registers in memory used for storing transfer data: dtmr, dtcr, dtsar, dtdar, and dtiar. it is controlled by the three registers dter (dtea?tee), dtcsr, and dtbr. the register configurations are listed in table 8.1. table 8.1 register configuration* 1 name abbr. r/w initial value address access size* 1 dtc mode register dtmr ? 2 undefined ? 2 ? 2 dtc source address register dtsar ? 2 undefined ? 2 ? 2 dtc destination address register dtdar ? 2 undefined ? 2 ? 2 dtc initial address register dtiar ? 2 undefined ? 2 ? 2 dtc transfer count register a dtcra ? 2 undefined ? 2 ? 2 dtc transfer count register b dtcrb ? 2 undefined ? 2 ? 2 dtc enable register a dtea r/w* 4 h'00 h'ffff8700 8, 16, 32 dtc enable register b dteb r/w* 4 h'00 h'ffff8701 8, 16, 32 dtc enable register c dtec r/w* 4 h'00 h'ffff8702 8, 16, 32 dtc enable register d dted r/w* 4 h'00 h'ffff8703 8, 16, 32 dtc enable register e dtee r/w* 4 h'00 h'ffff8704 8, 16, 32 dtc control/status register dtcsr r/(w)* 3 h'0000 h'ffff8706 8, 16, 32 dtc information base register dtbr r/w undefined h'ffff8708 16, 32 notes: 1. dtc registers cannot be accessed by dmac/dtc. 2. dtc internal registers cannot be directly accessed. 3. only a 0 write after a 1 read is possible for the nmif, ae bits of the dtcsr. 8.2.1 dtc mode register (dtmr) the dtc mode register (dtmr) is a 16-bit register that controls the dtc operation mode. the contents of this register is located in memory.
134 bit: 15 14 13 12 11 10 9 8 sm1 sm0 dm1 dm0 md1 md0 sz1 sz0 initial value: * * * * * * * * r/w: bit: 7 6 5 4 3 2 1 0 bit name: dts chne disel nmim initial value: * * * * * * * * r/w: note: initial value undefined. bits 15e14?source address mode 1, 0 (sm1, sm0): these bits designate whether to hold, increment, or decrement the dtsar after a data transfer. bit 15 (sm1) bit 14 (sm0) description 0 dtsar remains fixed 1 0 dtsar is incremented after transfer (+1 for byte unit transfer, +2 for word, +4 for longword) 1 1 dtsar is decremented after transfer (? for byte unit transfer, ? for word, ? for longword) bits 13e12?destination address mode 1, 0 (dm1, dm0): these bits designate whether to hold, increment or decrement the dtdar after a data transfer. bit 13 (dm1) bit 12 (dm0) description 0 dtdar remains fixed 1 0 dtdar is incremented after transfer (+1 for byte unit transfer, +2 for word, +4 for longword) 1 1 dtdar is decremented after transfer (? for byte unit transfer, ? for word, ? for longword)
135 bits 11e10?dtc mode 1, 0 (md1, md0): these bits designate the dtc transfer mode. bit 11 (md1) bit 10 (md0) description 0 0 normal mode 0 1 repeat mode 1 0 block transfer mode 1 1 reserved (setting prohibited) bits 9e8?dtc data transfer size 1, 0 (sz1, sz0): these bits designate the data size for data transfers. bit 9 (sz1) bit 8 (sz0) description 0 0 byte (8 bits) 0 1 word (16 bits) 1 0 longword (32 bits) 1 1 reserved (setting prohibited) bit 7?dtc transfer mode select (dts): when in repeat mode or block transfer mode, this bit designates whether the source side or destination side will be the repeat area or block area. bit 7 (dts) description 0 destination side is the repeat area or block area 1 source side is the repeat area or block area bit 6?dtc chain enable (chne): this bit designates whether to perform continuous dtc data transfers with the same activating source. continued transfer information is read after the 16th byte from the start address of the previous transfer information. bit 6 (chne) description 0 dtc data transfer end (activation wait state ensues) 1 dtc data transfer continue (read continue register information, execute transfer)
136 bit 5?dtc interrupt select (disel): this bit designates whether to prohibit or allow interrupt requests to the cpu after one-time dtc transfers. bit 5 (disel) description 0 prohibit interrupts to the cpu after dtc data transfer completion if the transfer counter is not 0 (dtc clears the interrupt source flag of the activating source to 0) 1 allow interrupts to the cpu after dtc data transfer completion (dtc clears the dter bit for the interrupt of the activating source to 0) bit 4?dtc nmi mode (nmim): this bit designates whether to terminate transfers when an nmi is input during dtc transfers. bit 4 (nmim) description 0 terminate dtc transfer upon an nmi 1 continue dtc transfer until end of transfer being executed bits 3e0?reserved: they have no effect on dtc operation. 8.2.2 dtc source address register (dtsar) the dtc source address register (dtsar) is a 32-bit register that specifies the dtc transfer source address. an even address indicates that the transfer size is word; a multiple-of-four address means it is longword. the contents of this register is located in memory. bit: 31 30 29 28 27 43210 initial value: * * * * * ***** r/w: note: initial value is undefined. 8.2.3 dtc destination address register (dtdar) the dtc destination address register (dtdar) is a 32-bit register that specifies the dtc transfer destination address. an even address indicates that the transfer size is word; a multiple-of-four address means it is longword. the contents of this register are located in memory.
137 bit: 31 30 29 28 27 43210 initial value: * * * * * ***** r/w: note: initial value is undefined. 8.2.4 dtc initial address register (dtiar) the dtc initial address register (dtiar) specifies the initial transfer source/transfer destination address in repeat mode. in repeat mode, when the dts bit is set to 1, specify the initial transfer source address in the repeat area, and when the dts bit is cleared to 0, specify the initial transfer destination address in the repeat area. the contents of this register are located in memory. bit: 31 30 29 28 27 43210 initial value: * * * * * ***** r/w: note: initial value is undefined. 8.2.5 dtc transfer count register a (dtcra) dtcra is a 16-bit register that specifies the number of dtc transfers. the contents of this register are located in memory. in normal mode it functions as a 16-bit transfer counter. the number of transfers is 1 when the set value is h'0001, 65535 when it is h'ffff, and 65536 when it is h'0000. in repeat mode, dtcrah maintains the transfer count and dtcral functions as an 8-bit transfer counter. the number of transfers is 1 when the set value is dtcrah = dtcral = h'01, 255 when they are h'ff, and 256 when it is h'00. in block transfer mode it functions as a 16-bit transfer counter. the number of transfers is 1 when the set value is h'0001, 65535 when it is h'ffff, and 65536 when it is h'0000.
138 bit: 15 14 8 dtcrah initial value: * * * * * * * * r/w: bit: 7 6 0 dtcral initial value: * * * * * * * * r/w: note: initial value is undefined. 8.2.6 dtc transfer count register b (dtcrb) the dtcrb is a 16-bit register that designates the block length in block transfer mode. the contents of this register is located in memory. the block length is 1 when the set value is h'0001, 65535 when it is h'ffff, and 65536 when it is h'0000. bit: 15 14 13 12 11 10 9 8 initial value: * * * * * * * * r/w: bit: 7 6 5 4 3 2 1 0 initial value: * * * * * * * * r/w: note: initial value is undefined. 8.2.7 dtc enable registers (dter) the dter (dtea?tee) are five 8-bit readable/writable registers with bits allocated to each interrupt source that activates the dtc. they set disable/enable for dtc activation for each interrupt source. when a bit is 1, dtc activation by the corresponding interrupt source is enabled. interrupt sources for each of the dtea?tee registers are indicated in table 8.2. the dter are initialized to h'00 by a power-on reset or in standby mode. manual reset does not initialize dter.
139 for the a mask, overwrite this register as follows: when clearing bit to 0: read the 1 bit to clear and write 0. when setting bit to 1: read the 0 bit to set and write 1. bit: 7 6 5 4 3 2 1 0 dte7 dte6 dte5 dte4 dte3 dte2 dte1 dte0 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* note: dter bits can only be modified by writing 1 after reading 0, or writing 0 after reading 1. 8.2.8 dtc control/status register (dtcsr) the dtcsr is a 16-bit readable/writable register that sets disable/enable for dtc activation by software, as well as the dtc vector addresses for software activation. it also indicates the dtc transfer status. the dtcsr is initialized to h'0000 by power-on resets and in standby mode. manual reset does not initialize dtcsr. bit: 15 14 13 12 11 10 9 8 nmif ae swdte initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r/w* 1 r/w* 1 r/w* 2 bit: 7 6 5 4 3 2 1 0 bit name: dtvec7 dtvec6 dtvec5 dtvec4 dtvec3 dtvec2 dtvec1 dtvec0 initial value: 0 0 0 0 0 0 0 0 r/w: r/w* 3 r/w* 3 r/w* 3 r/w* 3 r/w* 3 r/w* 3 r/w* 3 r/w* 3, 4 notes: 1. for the nmif and ae bits, only a 0 write after a 1 read is possible. 2. for the swdte bit, a 1 write is always possible, but a 0 write is possible only after a 1 is read. 3. for the dtvec7?tvec0 bits, writes are possible only when swdte = 0. 4. be sure to write 0 to the dtvec0 bit. bits 15?1?eserved: these bits always read as 0. the write value should always be 0.
140 bit 10?nmi flag bit (nmif): indicates that an nmi interrupt has occurred. when the nmif bit is set, dtc transfers are not allowed even if the dter bit is set to 1. if, however, a transfer has already started with the nmim bit of the dtmr set to 1, execution will continue until that transfer ends. to clear the nmif bit, read the 1 from it, then write a 0. the nmif bit is initialized to 0 by power-on resets and in standby mode. bit 10 (nmif) description 0 no nmi interrupts (initial value) (clear condition) write a 0 after reading the nmif bit 1 nmi interrupt has been generated bit 9?address error flag (ae): indicates that an address error by the dtc has occurred. when the ae bit is set, dtc transfers are not allowed even if the dter bit is set to 1. to clear the ae bit, read the 1 from it, then write a 0. the ae bit is initialized to 0 by power-on resets and in standby mode. bit 9 (ae) description 0 no address error by the dtc (initial value) (clear condition) write a 0 after reading the ae bit 1 an address error by the dtc occurred bit 8?dtc software activation enable bit (swdte): this bit enables/disables dtc activation by software. the ae bit is initialized to 0 by resets and standby mode. for details, see section 8.3.2, activating sources. bit 8 (swdte) description 0 dtc activation by software disabled (initial value) 1 dtc activation by software enabled bits 7e0?software activation vectors 7e0 (dtvec7edtvec0): these bits set the dtc vector addresses for dtc activation by software. a vector address is calculated as h'0400 + dtvec[7:0]. always specify 0 for dtvec0. 8 bits are available, so you can specify values h'00 (0)eh'fe (254).
141 8.2.9 dtc information base register (dtbr) the dtbr is a 16-bit readable/writable register that specifies the upper 16 bits of the memory address containing dtc transfer information. always access the dtbr in word or longword units. if it is accessed in byte units the register contents will become undefined at the time of a write, and undefined values will be read out upon reads. the dtbr is not initialized either by resets or in standby mode. bit: 15 14 13 12 11 10 9 8 initial value: * * * * * * * * r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 7 6 5 4 3 2 1 0 initial value: * * * * * * * * r/w: r/w r/w r/w r/w r/w r/w r/w r/w note: initial value is undefined. 8.3 operation the dtc stores transfer information in memory. when there are dtc transfer requests, it reads that transfer information and performs data transfers based on it. it rewrites the transfer information to memory after data transfers. storing transfer information in memory makes it possible to perform data transfers for an arbitrary number of channels. further, setting the chne bit to 1 makes it possible to perform multiple transfers continuously through one dtc transfer request. there are three dtc transfer modes: normal mode, repeat mode, and block transfer mode. after a dtc transfer, the transfer source address and transfer destination address are incremented, decremented, or kept the same, according to the respective setting. 8.3.1 overview of operation figure 8.2 shows a flowchart of dtc operation.
142 yes no yes yes yes yes no no no no start initial settings dtmr, dtcr, dtiar, dtsar, dtdar transfer request generated? nmif = ae = 0? dtc vector read transfer information read dtcra = dtcra ?1 (normal/block transfer mode) dtcral = dtcral ?1 (repeat mode) dtsar, dtdar update dtcrb = dtcrb ?1 (block transfer mode) transfer (1 transfer unit) block transfer mode and dtcrb 1 0? transfer information write nmi or address error end transfer information write chne = 0? nmif nmim + ae = 1? when disel = 1 or dtcra = 0 (normal/block transfer mode) when disel = 1 (repeat transfer mode) cpu interrupt request figure 8.2 dtc operation flowchart
143 8.3.2 activating sources the dtc performs write operations to the dtcsr with either interrupt sources or software as its activating sources. each interrupt source is designated by specific dter bits to determine whether it becomes an interrupt request to the cpu or a dtc activating source. when the disel bit is 1, an interrupt, established as the dtc activating source, is requested of the cpu after each data transfer in drc. when the disel bit is a 0, a request is made only after the completion of a designated number of data transfers. when the activating source interrupt is requested of the cpu, the corresponding dter bit is automatically cleared. in the case of software activation also, when the disel bit is a 1, a software dtc activation interrupt (swdtce) is requested of the cpu after each data transfer. when the disel bit is a 0, a request is made only after the completion of a designated number of data transfers. when no swdtce interrupt is requested of the cpu, the swdte bit of the dtcsr is automatically cleared. when a request is made of the cpu, the swdte bit is maintained as a 1. when multiple dtc activating sources occur simultaneously, they are accepted and the dtc is activated in accordance with the default priority rankings shown in table 8.2. figure 8.3 shows a block diagram of activating source control. irq on-chip peripheral interrupt requests source flag clear source flag clear interrupt requests (those not designated as dmac activating sources) cpu interrupt requests (those not designated as dtc activating sources) clear dtc activation request dtc control dter dtc intc dmac figure 8.3 activating source control block diagram 8.3.3 dtc vector table figure 8.4 shows the correspondence between dtc vector addresses and register information placement. for each dtc activating source there are 2 bytes in the dtc vector table, which contain the register information start address. table 8.2 shows the correspondence between activating sources and vector addresses. when activating with software, the vector address is calculated as h'0400 + dtvec[7:0].
144 through dtc activation, a register information start address is read from the vector table, then register information placed in memory space is read from that register information start address. always designate register information start addresses in multiples of four. register information start address dtbr (upper 16 bits) memory space dtc vector table register information dtc vector address register information start address (lower 16 bits) figure 8.4 correspondence between dtc vector address and register information
145 table 8.2 interrupt sources and dtc vector addresses source generator activating source dtc vector address dte bit transfer source transfer destination priority mtu tgi4a h'00000400?'00000401 dtea7 arbitrary* 1 arbitrary* 1 high (ch4) tgi4b h'00000402?'00000403 dtea6 arbitrary* 1 arbitrary* 1 tgi4c h'00000404?'00000405 dtea5 arbitrary* 1 arbitrary* 1 tgi4d h'00000406?'00000407 dtea4 arbitrary* 1 arbitrary* 1 tci4v h'00000408?'00000409 dtea3 arbitrary* 1 arbitrary* 1 mtu tgi3a h'0000040a?'0000040b dtea2 arbitrary* 1 arbitrary* 1 (ch3) tgi3b h'0000040c?'0000040d dtea1 arbitrary* 1 arbitrary* 1 tgi3c h'0000040e?'0000040f dtea0 arbitrary* 1 arbitrary* 1 tgi3d h'00000410?'00000411 dteb7 arbitrary* 1 arbitrary* 1 mtu tgi2a h'00000412?'00000413 dteb6 arbitrary* 1 arbitrary* 1 (ch2) tgi2b h'00000414?'00000415 dteb5 arbitrary* 1 arbitrary* 1 mtu tgi1a h'00000416?'00000417 dteb4 arbitrary* 1 arbitrary* 1 (ch1) tgi1b h'00000418?'00000419 dteb3 arbitrary* 1 arbitrary* 1 mtu tgi0a h'0000041a?'0000041b dteb2 arbitrary* 1 arbitrary* 1 (ch0) tgi0b h'0000041c?'0000041d dteb1 arbitrary* 1 arbitrary* 1 tgi0c h'0000041e?'0000041f dteb0 arbitrary* 1 arbitrary* 1 tgi0d h'00000420?'00000421 dtec7 arbitrary* 1 arbitrary* 1 a/d adi(adi0)* 2 h'00000422?'00000423 dtec6 addr arbitrary* 1 irq0 pin irq0 h'00000424?'00000425 dtec5 arbitrary* 1 arbitrary* 1 irq1 pin irq1 h'00000426?'00000427 dtec4 arbitrary* 1 arbitrary* 1 irq2 pin irq2 h'00000428?'00000429 dtec3 arbitrary* 1 arbitrary* 1 irq3 pin irq3 h'0000042a?'0000042b dtec2 arbitrary* 1 arbitrary* 1 irq4 pin irq4 h'0000042c?'0000042d dtec1 arbitrary* 1 arbitrary* 1 irq5 pin irq5 h'0000042e?'0000042f dtec0 arbitrary* 1 arbitrary* 1 irq6 pin irq6 h'00000430?'00000431 dted7 arbitrary* 1 arbitrary* 1 irq7 pin irq7 h'00000432?'00000433 dted6 arbitrary* 1 arbitrary* 1 cmt (ch0) cmi0 h'00000434?'00000435 dted5 arbitrary* 1 arbitrary* 1 cmt (ch1) cmi1 h'00000436?'00000437 dted4 arbitrary* 1 arbitrary* 1 low
146 table 8.2 interrupt sources and dtc vector addresses (cont) source generator activating source dtc vector address dte bit transfer source transfer destination priority sci0 rxi0 h'00000438?'00000439 dted3 rdr0 arbitrary* 1 high txi0 h'0000043a?'0000043b dted2 arbitrary* 1 tdr0 sci1 rxi1 h'0000043c?'0000043d dted1 rdr1 arbitrary* 1 txi1 h'0000043e?'0000043f dted0 arbitrary* 1 tdr1 bsc cmi h'00000440?'00000441 dtee7 arbitrary* 1 arbitrary* 1 software write to dtcsr h'00000400 + dtvec[7:0] to h'00000401 + dtvec[7:0] arbitrary* 1 arbitrary* 1 low notes:1. external memory, memory-mapped external devices, on-chip memory, on-chip peripheral modules (excluding dmac and dtc) 2. excluding a mask products are adi, a mask products are adi0. 8.3.4 register information placement figure 8.5 shows the placement of register information in memory space. the register information start addresses are designated by dtbr for the upper 16 bits, and the dtc vector table for the lower 16 bits. the placement in order from the register information start address in normal mode is dtmr, dtcra, 4 bytes empty (no effect on dtc operation), dtsar, then dtdar. in repeat mode it is dtmr, dtcra, dtiar, dtsar, and dtdar. in block transfer mode, it is dtmr, dtcra, 2 bytes empty (no effect on dtc operation), dtcrb, dtsar, then dtdar. fundamentally, certain ram areas are designated for addresses storing register information.
147 register information start address memory space memory space memory space register information normal mode repeat mode block transfer mode dtmr dtcra dtsar dtdar dtmr dtcra dtsar dtdar dtiar dtmr dtcra dtsar dtdar dtcrb figure 8.5 dtc register information placement in memory space 8.3.5 normal mode performs the transfer of one byte, one word, or one longword for each activation. the total transfer count is 1 to 65536. an interrupt request is generated to the cpu when the transfer with dtcra = 1 ends. transfers of a number of bytes specified by the sci are possible. table 8.3 shows the register functions for normal mode. table 8.3 normal mode register functions values written back upon a transfer information write register function when dtcra is other than 1 when dtcra is 1 dtmr operation mode control dtmr dtmr dtcra transfer count dtcra ?1 dtcra ?1 (= h'0000) dtsar transfer source address increment/decrement/ fixed increment/decrement/ fixed dtdar transfer destination address increment/decrement/ fixed increment/decrement/ fixed 8.3.6 repeat mode performs the transfer of one byte, one word, or one longword for each activation. either the transfer source or transfer destination is designated as the repeat area.
148 the total transfer count is specified between 1 and 256. when the specified number of transfers ends, the address register of the designated repeat area is returned to its initial state and the transfer is repeated. other address registers are consecutively incremented, decremented, or remain fixed. while disel = 0, no interrupt request is made to the cpu, even if the transfer with dtcral = 1 ends. pulses for driving the stepping motor can be output. table 8.4 shows the register functions for repeat mode. table 8.4 repeat mode register functions values written back upon a transfer information write register function when dtcra is other than 1 when dtcra is 1 dtmr operation mode control dtmr dtmr dtcrah transfer count maintenance dtcrah dtcrah dtcral transfer count dtcral ?1 dtcrah dtiar initial address (not written back) (not written back) dtsar transfer source address increment/decrement/ fixed (dts = 0) increment/ decrement/ fixed (dts = 1) dtiar dtdar transfer destination address increment/decrement/ fixed (dts = 0) dtiar (dts = 1) increment/ decrement/ fixed 8.3.7 block transfer mode performs the transfer of one block for each one activation. either the transfer source or transfer destination is designated as the block area. the block length is specified between 1 and 65536. when a 1-block transfers ends, the address register of the designated block area is returned to its initial state. other address registers are consecutively incremented, decremented, or remain fixed. the block transfer count is 1 to 65536. an interrupt request is generated to the cpu when the transfer with dtcra = 1 ends. a/d converter group mode transfers and phase compensation pwm data transfers are possible. table 8.5 shows the register functions for block transfer mode.
149 table 8.5 block transfer mode register functions register function values written back upon a transfer information write dtmr operation mode control dtmr dtcra transfer count dtcra ?1 dtcrb block length (not written back) dtsar transfer source address (dts = 0) increment/ decrement/ fixed (dts = 1) dtsar initial value dtdar transfer destination address (dts = 0) dtdar initial value (dts = 1) increment/ decrement/ fixed 8.3.8 operation timing figure 8.6 shows a dtc operation timing example. activating source dtc request address vector read data transfer transfer information read transfer information write r w f figure 8.6 dtc operation timing example (normal mode) when register information is located in on-chip ram, each mode requires 4 cycles for transfer information reads, and 3 cycles for writes. 8.3.9 dtc execution state counts table 8.6 shows the execution state for one dtc data transfer. furthermore, table 8.7 shows the state counts needed for execution state.
150 table 8.6 execution state of dtc mode vector read i register information read/write j data read k data write l internal operation m normal 1 7 1 1 1 repeat 1 7 1 1 1 block transfer 1 7 n n 1 note: n: block size (default set values of dtcrb) table 8.7 state counts needed for execution state access objective on- chip ram on- chip rom internal i/o register external device bus width 32 32 32 8 16 32 access state 112* 1 3* 2 222 execution vector read s i ? 4 2 2 state register information read/write s j 11 842 byte data read s k 1123222 word data read s k 1123422 long word data read s k 1146842 byte data write s l 1123222 word data write s l 1123422 long word write s l 1146842 internal operation s m 1 notes: 1. two state access module : port, int, cmt, sci, etc. 2. three state access module : wdt, cache, ubc, etc. the execution state count is calculated using the following formula. indicates the number of transfers by one activating source (count + 1 when chne bit is 1). execution state count = i ?s i + (j ?s j + k ?s k + l ?s l ) + m ?s m
151 8.3.10 dtc usage procedure the procedure for dtc interrupt activation is as follows: 1. transfer data (dtmr, dtcra, dtsar, dtdar, dtcrb, and dtiar) is located in memory space. 2. establish the register information start address with dtbr and the dtc vector table. 3. set the corresponding dter bit to 1. 4. the dtc is activated when an interrupt source occurs. 5. when interrupt requests are not made to the cpu, the interrupt source is cleared, but the dter is not. when interrupts are requested, the interrupt source is not cleared, but the dter is. 6. interrupt sources are cleared within the cpu interrupt routine. when doing continuous dtc data transfers, set the dter to 1. the procedure for dtc software activation is as follows: 1. transfer data (dtmr, dtcra, dtsar, dtdar, dtcrb, and dtiar) is located in memory space. 2. establish the register information start address with dtbr and the dtc vector table. 3. confirm that the swdte bit of the dtcsr is 0. when the swdte bit is 1, the dtc is already being driven by software. 4. write a 1 to the swdte bit and a vector number to the dtvec (byte data). 5. when swdtce interrupt requests are not made to the cpu, the swdte bit is cleared. when interrupts are requested, the swdte bit is maintained as a 1. 6. the swdte bit is cleared to 0 within the cpu interrupt routine. for continuous dtc data transfers, set the swdte to 1. 8.3.11 dtc use example the following is a dtc use example of a 128-byte data reception by the sci: 1. the settings are: dtmr source address fixed (sm1 = 0), destination address incremented (dm1 = 1, dm0 = 0), normal mode (md1 = md0 = 0), byte size (sz1 = sz0 = 0), one transfer per activating source (chne = 0), and a cpu interrupt request after the designated number of data transfers (disel = 0). 128 (h'0080) is set in dtcra, the rdr address of the sci is set in dtsar, and the start address of the ram storing the receive data is set in dtdar. 2. establish the register information start address with dtbr and the dtc vector table. 3. set the corresponding dter bit to 1. 4. set the sci to a specific receive mode and enable rxi interrupts.
152 5. the rdrf flag of the ssr is set to 1 by each completion of a 1-byte data reception by the sci, an rxi interrupt is generated, and the dtc is activated. the received data is transferred from rdr to ram by the dtc, and the rdrf flag is 0 cleared. 6. after completion of 128 data transfers (dtcra = 0), the dter is cleared while the rdrf is maintained as 1, and an rxi interrupt request is made to the cpu. the interrupt processing routine clears the rdrf, and performs the other completion processing. 8.4 cautions on use dmac and dtc register access by the dtc is prohibited. dtc register access by the dmac is prohibited. when setting a bit in dter, first ensure that all transfers on the dtc channel corresponding to that dter have ended, or disable the transfer source for each channel so that dtc transfer corresponding to that dter will not occur. the above restrictions do not apply for a mask due to change in the access method of dter. however, take caution when changing lsi to a mask, since modification of the program is required.
153 section 9 cache memory (cac) 9.1 overview the lsi has an on-chip cache memory (cac) with 1 kbyte of cache data and a 256-entry cache tag. the cache data and cache tag space can be used as on-chip ram space when the cache is not being used. 9.1.1 features the cac has the following features. the cache tag and cache data configuration is shown in figure 9.1. 1-kbyte capacity external memory (cs space and dram space) instruction code and pc relative data caching 256 entry cache tag (tag address 15 bits) 4-byte line length direct map replacement algorithm valid flag (1 bit) included for purges cache tag 256 entries data (32 bits) tag address (15 bits) cache data data bus hit signal cpu address tag address entry address offset valid bit (1 bit) cmp 15 8 2 figure 9.1 cache tag and cache data configuration
154 9.1.2 block diagram figure 9.2 shows a block diagram of the cache. ccr: cache control register cache tag cache controller cache data internal address bus internal data bus bus state controller external bus interface ccr cache figure 9.2 cache block diagram 9.1.3 register configuration the cache has one register, which can be used to control the enabling or disabling of each cache space. the register configuration is shown in table 9.1.
155 table 9.1 register configuration name abbreviation r/w initial value address access size (bits) cache control register ccr r/w h'0000* h'ffff8740 8, 16, 32 note: bits 15? are undefined. 9.2 register explanation 9.2.1 cache control register (ccr) the cache control register (ccr) selects the cache enable/disable of each space. the ccr is a 16-bit readable/writable register. it is initialized to h'0000 by power on resets, but is not initialized by manual resets or standby mode. bit: 15 14 13 12 11 10 9 8 initial value: * * * * * * * * r/w: r r r r r r r r bit: 7 6 5 4 3 2 1 0 ce dram ce cs3 ce cs2 ce cs1 ce cs0 initial value: * * * 0 0 0 0 0 r/w: r r r r/w r/w r/w r/w r/w note: bits 15? are undefined. bits 15e5?reserved: reading these bits gives undefined values. the write value should always be 0. bit 4?dram space cache enable (cedram): selects whether to use dram space as a cache object (enable) or to exclude it (disable). a 0 disables, and a 1 enables such use. bit 4 (cedram) description 0 dram space cache disabled (initial value) 1 dram space cache enabled
156 bit 3?cs3 space cache enable (cecs3): selects whether to use cs3 space as a cache object (enable) or to exclude it (disable). a 0 disables, and a 1 enables such use. bit 3 (cecs3) description 0 cs3 space cache disabled (initial value) 1 cs3 space cache enabled bit 2?cs2 space cache enable (cecs2): selects whether to use cs2 space as a cache object (enable) or to exclude it (disable). a 0 disables, and a 1 enables such use. bit 2 (cecs2) description 0 cs2 space cache disabled (initial value) 1 cs2 space cache enabled bit 1?cs1 space cache enable (cecs1): selects whether to use cs1 space as a cache object (enable) or to exclude it (disable). a 0 disables, and a 1 enables such use. bit 1 (cecs1) description 0 cs1 space cache disabled (initial value) 1 cs1 space cache enabled bit 0?cs0 space cache enable (cecs0): selects whether to use cs0 space as a cache object (enable) or to exclude it (disable). a 0 disables, and a 1 enables such use. bit 0 (cecs0) description 0 cs0 space cache disabled (initial value) 1 cs0 space cache enabled 9.3 address array and data array there is a special cache space for controlling the cache. this space is divided into an address array and a data array, where addresses (tag address, including valid bit) and data (4-byte line length) for cache control are recorded. the special cache space is shown in table 9.2. it can be used as on-chip ram space when the cache is not being used.
157 table 9.2 special cache space space classification address size bus width address array h'fffff000?'fffff3ff 1 kbyte 32 bit data array h'fffff400?'fffff7ff 1 kbyte 32 bit 9.3.1 cache address array read/write space the cache address array has a compulsory read/write (figure 9.3). address upper 22 bits of the address array space address (22 bits) (2 bits) entry address (8 bits) 31 0 21 10 9 data (6 bits) (10 bits) tag address (15 bits) valid bit (1 bit) 31 0 10 9 26 25 24 figure 9.3 cache address array address array read: designates entry address and reads out the corresponding tag address value/valid bit value. address array write: designates entry address and writes the designated tag address value/valid bit value. 9.3.2 cache data array read/write space the cache data array has a compulsory read/write (figure 9.4). address upper 22 bits of the data array space address (22 bits) (2 bits) entry address (8 bits) 31 0 21 10 9 data data (32 bits) 31 0 figure 9.4 cache data array data array read: designates entry address and reads out the corresponding line of data. data array write: designates entry address and writes designated data to the corresponding line.
158 9.4 cautions on use 9.4.1 cache initialization always initialize the cache before enabling it. specifically, use an address array write to write 0 to all valid bits for all entries (256 times), that is,those in the address range h'fffff000 h'fffff3ff. writes to the address array or data array by the cpu, dmac, or dtc are not possible while the cache is enabled. for reads, undefined values will be read out. 9.4.2 forced access to address array and data array while the cache is enabled, it is not possible to write to the address array or data array via the cpu, dmac, or dtc, and a read will return an undefined value. the cache must be disabled before making a forced access to the address array or data array. 9.4.3 cache miss penalty and cache fill timing when a cache miss occurs, a single idle cycle is generated as a penalty immediately before the cache fill (access from external memory in the event of a cache miss), as shown in figure 9.5. however, in the case of consecutive cache misses, idle cycles are not generated for the second and subsequent cache misses, as shown in figure 9.6. as the timing for a cache fill from normal space, the cs assert period immediately before the end of the bus cycle (or the last bus cycle when two or four bus cycles are generated, such as in a word access to 8-bit space) is extended by an additional cycle, as shown in figures 9.5 and 9.6. similarly, as the timing for a cache fill from dram space, the ras assert period immediately before the end of the bus cycle is extended by an additional cycle. in ras down mode, the next bus cycle is delayed by one cycle as shown in figure 9.8.
159 miss-hit ck internal address address csn rd data idle cycle idle cycle idle cycle cs assert extension figure 9.5 cache fill timing in case of non-consecutive cache miss from normal space (no wait, no cs assert extension) miss-hit ck internal address address csn rd data cs assert additional extension figure 9.6 cache fill timing in case of consecutive cache misses from normal space (nowait, cs assert extension)
160 idle cycle idle cycle idle cycle ck internal address address ras casxx data row column miss-hit ras assert extension figure 9.7 cache fill timing in case of non-consecutive cache miss from dram space (normal mode, tpc = 0, rcd = 0, no wait) miss-hit row column cs space wait column ras assert extension ck internal address address ras casxx data dram access cs space access dram access miss-hit figure 9.8 cache fill timing in case of consecutive cache misses from dram space (ras down mode, tpc = 0, rcd = 0, no wait) 9.4.4 cache hit after cache miss the first cache hit after a cache miss is regarded as a cache miss, and a cache fill without idle cycle generation is performed. the next hit operates as a cache hit.
161 section 10 bus state controller (bsc) 10.1 overview the bus state controller (bsc) divides up the address spaces and outputs control for various types of memory. this enables memories like dram, sram, and rom to be linked directly to the lsi without external circuitry. 10.1.1 features the bsc has the following features: ? address space is divided into five spaces ? a maximum linear 2 mbytes for on-chip rom effective mode, and a maximum linear 4-mbyte for on-chip rom ineffective mode for address space cs0 ? a maximum linear 4 mbytes for each of the address spaces cs1?s3 ? a maximum linear 16 mbytes for dram dedicated space ? bus width can be selected for each space (8, 16, or 32 bits) ? wait states can be inserted by software for each space ? wait states can be inserted via the wait pin in external memory spce accesses. ? outputs control signals for each space according to the type of memory connected ? on-chip rom and ram interfaces ? on-chip ram access of 32 bits in 1 state ? on-chip rom access of 32 bits in 1 state ? direct interface to dram ? multiplexes row/column addresses according to dram capacity ? supports high-speed page mode and ras down mode ? access control for each type of memory, peripheral lsi ? address/data multiplex function ? refresh ? supports cas-before-ras refresh (auto-refresh) and self-refresh ? refresh counter can be used as an interval timer ? interrupt request generated upon compare match (cmi interrupt request signal)
162 10.1.2 block diagram figure 10.1 shows the bsc block diagram. wcr1 wcr2 bcr1 bcr2 dcr rd cmi interrupt request wait rtcsr rtcnt rtcor internal bus interrupt controller bus interface area control unit comparator module bus cs0 to cs3 ah rdwr wait control unit memory control unit peripheral bus wrhh , wrhl wrh , wrl cashh , cashl cash , casl ras bsc wcr1: wcr2: bcr1: bcr2: wait control register 1 wait control register 2 bus control register 1 bus control register 2 dcr: rtcnt: rtcor: rtscr: dram area control register refresh timer counter refresh timer constant register refresh timer control/status register figure 10.1 bsc block diagram
163 10.1.3 pin configuration table 10.1 shows the bus state controller pin configuration. table 10.1 pin configuration signal i/o description a21?0 o address output (a21?18 will become input ports with power-on reset) d31?0 i/o 32-bit data bus. d15-d0 are address output and data i/o during address/data multiplex i/o. cs0 cs3 o chip select rd o strobe that indicates the read cycle for ordinary space/multiplex i/o. also output during dram access. wrhh o strobe that indicates a write cycle to the most significant byte (d31?24) for ordinary space/multiplex i/o. also output during dram access. wrhl o strobe that indicates a write cycle to the 2nd byte (d23?16) for ordinary space/multiplex i/o. also output during dram access. wrh o strobe that indicates a write cycle to the 3rd byte (d15?8) for ordinary space/multiplex i/o. also output during dram access. wrl o strobe that indicates a write cycle to the least significant byte (d7?0) for ordinary space/multiplex i/o. also output during dram access. rdwr o strobe indicating a write cycle to dram (used for dram space) ras o ras signal for dram (used for dram space) cashh o cas signal when accessing the most significant byte (d31?24) of dram (used for dram space) cashl o cas signal when accessing the 2nd byte (d23?16) of dram (used for dram space) cash o cas signal when accessing the 3rd byte (d15?8) of dram (used for dram space) casl o cas signal when accessing the least significant byte (d7?0) of dram (used for dram space) ah o signal to hold the address during address/data multiplex wait i wait state request signal breq i bus release request input back o bus use enable output
164 10.1.4 register configuration the bsc has eight registers. these registers are used to control wait states, bus width, and interfaces with memories like dram, rom, and sram, as well as refresh control. the register configurations are listed in table 10.2. all registers are 16 bits. do not access dram space before completing the memory interface settings. all bsc registers are all initialized by a power-on reset, but are not by a manual reset. values are maintained in standby mode. table 10.2 register configuration name abbr. r/w initial value address access size bus control register 1 bcr1 r/w h'200f h'ffff8620 8, 16, 32 bus control register 2 bcr2 r/w h'ffff h'ffff8622 8, 16, 32 wait state control register 1 wcr1 r/w h'ffff h'ffff8624 8, 16, 32 wait state control register 2 wcr2 r/w h'000f h'ffff8626 8, 16, 32 dram area control register dcr r/w h'0000 h'ffff862a 8, 16, 32 refresh timer control/status register rtcsr r/w h'0000 h'ffff862c 8, 16, 32 refresh timer counter rtcnt r/w h'0000 h'ffff862e 8, 16, 32 refresh time constant register rtcor r/w h'0000 h'ffff8630 8, 16, 32
165 10.1.5 address map figure 10.2 shows the address format used by the sh7040 series. a31?24 a23, a22 a21 output address: output from the address pins space selection: not output externally; used to select the type of space on-chip rom space or cs space when 00000000 (h'00) dram space when 00000001 (h'01) reserved (do not access) when 00000010 to 11111110 (h'02 to h'fe) on-chip peripheral module space or on-chip ram space when 11111111 (h'ff) cs space selection: decoded, outputs cs0 to cs3 when a31 to a24 = 00000000 a0 figure 10.2 address format this lsi uses 32-bit addresses: ? a31?24 are used to select the type of space and are not output externally. ? bits a23 and a22 are decoded and output as chip select signals ( cs0 cs3 ) for the corresponding areas when bits a31?24 are 00000000. ? a21?0 are output externally. table 10.3 shows an address map for on-chip rom effective mode. table 10.4 shows an address map for on-chip rom ineffective mode.
166 table 10.3 address map for on-chip rom effective mode address space memory size bus width h'00000000?'0003ffff* 1 on-chip rom on-chip rom memory 256 kbytes 32 bits h'00040000?'001fffff reserved reserved h'00200000?'003fffff cs0 space ordinary space 2 mbytes 8/16/32 bits* 2 h'00400000?'007fffff cs1 space ordinary space 4 mbytes 8/16/32 bits* 2 h'00800000?'00bfffff cs2 space ordinary space 4 mbytes 8/16/32 bits* 2 h'00c00000?'00ffffff cs3 space ordinary space or multiplex i/o space 4 mbytes 8/16/32 bits* 3 h'01000000?'01ffffff dram space dram 16 mbytes 8/16/32 bits* 2 h'02000000?'ffff7fff reserved reserved h'ffff8000?'ffff87ff on-chip peripheral module on-chip peripheral module 2 kbytes 8/16 bits h'ffff8800?'ffffefff reserved reserved h'fffff000?'ffffffff on-chip ram on-chip ram 4 kbytes 32 bits notes: 1. with the 64-kbyte version of on-chip rom, the rom address is h'0000000 h'0000ffff, and address h'00010000?'0003ffff is reserved space. with the 128-kbyte version of on-chip rom, the rom address is h'00000000 h'0001ffff, and address h'00020000?'0003ffff is reserved space. 2. selected by on-chip register settings. 3. ordinary space: selected by on-chip register settings. multiplex i/o space: 8/16 bit selected by the a14 bit. 4. do not access reserved spaces. operation cannot be guaranteed if they are accessed.
167 table 10.4 address map for on-chip rom ineffective mode address space memory size bus width h'00000000?'003fffff cs0 space ordinary space 4 mbytes 8/16/32 bist* 1 h'00400000?'007fffff cs1 space ordinary space 4 mbytes 8/16/32 bits* 2 h'00800000?'00bfffff cs2 space ordinary space 4 mbytes 8/16/32 bits* 2 h'00c00000?'00ffffff cs3 space ordinary space or multiplex i/o space 4 mbytes 8/16/32 bits* 3 h'01000000?'01ffffff dram space dram 16 mbytes 8/16/32 bits* 2 h'02000000?'ffff7fff reserved reserved h'ffff8000?'ffff87ff on-chip peripheral module on-chip peripheral module 2 kbytes 8/16 bits h'ffff8800?'ffffefff reserved reserved h'fffff000?'ffffffff on-chip ram on-chip ram 4 kbytes 32 bits notes: 1. selected by the mode pin: 8/16 bit when 112 pin and 120 pin. 16/32 bit when 144 pin. 2. selected by on-chip register settings. 3. ordinary space: selected by on-chip register settings. multiplex i/o space: 8/16 bit selected by the a14 bit. 4. do not access reserved spaces. operation cannot be guaranteed if they are accessed. 5. in the single-chip mode, spaces other than on-chip rom, on-chip ram and on-chip peripheral modules are unavailable. 10.2 description of registers 10.2.1 bus control register 1 (bcr1) bcr1 is a 16-bit read/write register that enables access to the mtu control register, selects multiplex i/o, and specifies the bus size of the cs spaces. with the 112-pin version (sh7040/sh7042/sh7044), and the 120-pin version (sh7040/sh7042), specify the bus width as word (16 bits) or less. write bits 8? of bcr1 during the initialization stage after a power-on reset, and do not change the values thereafter. in on-chip rom effective mode, do not access any of the cs spaces until after completion of register initialization. in on-chip rom ineffective mode, do not access any cs space other than cs0 until after completion of register initialization. bcr1 is initialized by power-on resets to h'200f, but is not initialized by manual resets or software standbys.
168 bit: 15 14 13 12 11 10 9 8 mtu rwe ioe initial value: 0 0 1 0 0 0 0 0 r/w: r r r/w r r r r r/w bit: 7 6 5 4 3 2 1 0 a3lg a2lg a1lg a0lg a3sz a2sz a1sz a0sz initial value: 0 0 0 0 1 1 1 1 r/w: r/w r/w r/w r/w r/w r/w r/w r/w ? bits 15, 14, 12??eserved: these bits always read as 0. the write value should always be 0. ? bit 13?tu read/write enable (mturwe): when this bit is 1, mtu control register access is enabled. see section 12, multifunction timer pulse unit (mtu), for details. bit 13 (mturwe) description 0 mtu control register access is disabled 1 mtu control register access is enabled (initial value) ? bit 8?ultiplex i/o enable (ioe): selects the use of cs3 space as ordinary space or address/data multiplex i/o space. a 0 selects ordinary space and a 1 selects address/data multiplex i/o space. when address/data multiplex i/o space is selected, the address and data are multiplexed and output from the data bus. when cs3 space is an address/data multiplex i/o space, bus size is decided by the a14 bit (a14 = 0: 8 bit, a14 = 1: 16 bit). bit 8 (ioe) description 0 cs3 space is ordinary space (initial value) 1 cs3 space is address/data multiplex i/o space ? bit 7?s3 space long size specification (a3lg): specifies the cs3 space bus size. this is effective only when cs3 space is ordinary space. when cs3 space is an address/data multiplex i/o space, bus size is decided by the a14 bit. bit 7 (a3lg) description 0 according to the a3sz bit specified value (initial value) 1 longword (32 bit) size
169 ? bit 6?s2 space long size specification (a2lg): specifies the cs2 space bus size. bit 6 (a2lg) description 0 according to the a2sz bit value (initial value) 1 longword (32 bit) size ? bit 5?s1 space long size specification (a1lg): specifies the cs1 space bus size. bit 5 (a1lg) description 0 according to the a1sz bit value (initial value) 1 longword (32 bit) size ? bit 4?s0 space long size specification (a0lg): specifies the cs0 space bus size. bit 4 (a0lg) description 0 according to the a0sz bit value (initial value) 1 longword (32 bit) size note: a0lg is effective only in on-chip rom effective mode. when in on-chip rom ineffective mode, the cs0 space bus size is specified by the mode pin. ? bit 3?s3 space size specification (a3sz): specifies the cs3 space bus size when a3lg = 0. this is effective only when cs3 space is ordinary space. when cs3 space is an address/data multiplex i/o space, bus size is decided by the a14 bit. bit 3 (a3sz) description 0 byte (8 bit) size 1 word (16 bit) size (initial value) note: this bit is ignored when a3lg = 1; cs3 space bus size becomes longword (32 bit) (for ordinary space). ? bit 2?s2 space size specification (a2sz): specifies the cs2 space bus size when a2lg = 0. bit 2 (a2sz) description 0 byte (8 bit) size 1 word (16 bit) size (initial value) note: this bit is ignored when a2lg = 1; cs2 space bus size becomes longword (32 bit).
170 ? bit 1?s1 space size specification (a1sz): specifies the cs1 space bus size when a1lg = 0. bit 1 (a1sz) description 0 byte (8 bit) size 1 word (16 bit) size (initial value) note: this bit is ignored when a1lg = 1; cs1 space bus size becomes longword (32 bit). ? bit 0?s0 space size specification (a0sz): specifies the cs0 space bus size when a0lg = 0. bit 0 (a0sz) description 0 byte (8 bit) size 1 word (16 bit) size (initial value) note: a0sz is effective only in on-chip rom effective mode. in on-chip rom ineffective mode, the cs0 space bus size is specified by the mode pin. however, even in on-chip rom effective mode, this bit is ignored when a0lg = 1; cs0 space bus size becomes longword (32 bit). 10.2.2 bus control register 2 (bcr2) bcr2 is a 16-bit read/write register that specifies the number of idle cycles and cs signal assert extension of each cs space. bcr2 is initialized by power-on resets to h'ffff, but is not initialized by manual resets or software standbys. bit: 15 14 13 12 11 10 9 8 iw31 iw30 iw21 iw20 iw11 iw10 iw01 iw00 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 bit: 7 6 5 4 3 2 1 0 cw3 cw2 cw1 cw0 sw3 sw2 sw1 sw0 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
171 ? bits 15??dles between cycles (iw31, iw30, iw21, iw20, iw11, iw10, iw01, iw00): these bits specify idle cycles inserted between consecutive accesses when the second one is to a different cs area after a read. idles are used to prevent data conflict between rom (and other memories, which are slow to turn the read data buffer off), fast memories, and i/o interfaces. even when access is to the same area, idle cycles must be inserted when a read access is followed immediately by a write access. the idle cycles to be inserted comply with the area specification of the previous access . refer to section 10.6, waits between access cycles, for details. iw31, iw30 specify the idle between cycles for cs3 space; iw21, iw20 specify the idle between cycles for cs2 space; iw11, iw10 specify the idle between cycles for cs1 space and iw01, iw00 specify the idle between cycles for cs0 space. bit 15 (iw31) bit 14 (iw30) description 0 0 no idle cycle after accessing cs3 space 1 inserts one idle cycle after accessing cs3 space 1 0 inserts two idle cycles after accessing cs3 space 1 inserts three idle cycles after accessing cs3 space ( initial value) bit 13 (iw21) bit 12 (iw20) description 0 0 no idle cycle after accessing cs2 space 1 inserts one idle cycle 1 0 inserts two idle cycles 1 inserts three idle cycles ( initial value) bit 11 (iw11) bit 10 (iw10) description 0 0 no idle cycle after accessing cs1 space 1 inserts one idle cycle 1 0 inserts two idle cycles 1 inserts three idle cycles ( initial value)
172 bit 9 (iw01) bit 8 (iw00) description 0 0 no idle cycle after accessing cs0 space 1 inserts one idle cycle 1 0 inserts two idle cycles 1 inserts three idle cycles ( initial value) ? bits 7??dle specification for continuous access (cw3, cw2, cw1, cw0): the continuous access idle specification makes insertions to clearly delineate the bus intervals by once negating the csn signal when doing consecutive accesses of the same cs space. when a write immediately follows a read, the number of idle cycles inserted is the larger of the two values specified by iw and cw. refer to section 10.6, waits between access cycles, for details. cw3 specifies the continuous access idles for cs3 space; cw2 specifies the continuous access idles for cs2 space; cw1 specifies the continuous access idles for cs1 space and cw0 specifies the continuous access idles for cs0 space. bit 7 (cw3) description 0 no cs3 space continuous access idle cycles 1 one cs3 space continuous access idle cycle (initial value) bit 6 (cw2) description 0 no cs2 space continuous access idle cycles 1 one cs2 space continuous access idle cycle (initial value) bit 5 (cw1) description 0 no cs1 space continuous access idle cycles 1 one cs1 space continuous access idle cycle (initial value) bit 4 (cw0) description 0 no cs0 space continuous access idle cycles 1 one cs0 space continuous access idle cycle (initial value)
173 ? bits 3? cs assert extension specification (sw3, sw2, sw1, sw0): the cs assert cycle extension specification is for making insertions to prevent extension of the rd signal or wrx signal assert period beyond the length of the csn signal assert period. extended cycles insert one cycle before and after each bus cycle, which simplifies interfaces with external devices and also has the effect of extending write data hold time. refer to section 10.3.3, cs assert period extension, for details. sw3 specifies the cs assert extension for cs3 space access; sw2 specifies the cs assert extension for cs2 space access; sw1 specifies the cs assert extension for cs1 space access and sw0 specifies the cs assert extension for cs0 space access. bit 3 (sw3) description 0 no cs3 space cs assert extension 1 cs3 space cs assert extension (initial value) bit 2 (sw2) description 0 no cs2 space cs assert extension 1 cs2 space cs assert extension (initial value) bit 1 (sw1) description 0 no cs1 space cs assert extension 1 cs1 space cs assert extension (initial value) bit 0 (sw0) description 0 no cs0 space cs assert extension 1 cs0 space cs assert extension (initial value) 10.2.3 wait control register 1 (wcr1) wcr1 is a 16-bit read/write register that specifies the number of wait cycles (0?5) for each cs space. wcr1 is initialized by power-on resets to h'ffff, but is not initialized by manual resets or software standbys.
174 bit: 15 14 13 12 11 10 9 8 w33 w32 w31 w30 w23 w22 w21 w20 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 bit: 7 6 5 4 3 2 1 0 w13 w12 w11 w10 w03 w02 w01 w00 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 ? bits 15?2?s3 space wait specification (w33, w32, w31, w30): specifies the number of waits for cs3 space access. bit 15 (w33) bit 14 (w32) bit 13 (w31) bit 12 (w30) description 0000no wait (external wait input disabled) 00011 wait external wait input enabled 111115 wait external wait input enabled (initial value) ? bits 11??s2 space wait specification (w23, w22, w21, w20): specifies the number of waits for cs2 space access. bit 11 (w23) bit 10 (w22) bit 9 (w21) bit 8 (w20) description 0000no wait (external wait input disabled) 00011 wait external wait input enabled 111115 wait external wait input enabled (initial value)
175 ? bits 7??s1 space wait specification (w13, w12, w11, w10): specifies the number of waits for cs1 space access. bit 7 (w13) bit 6 (w12) bit 5 (w11) bit 4 (w10) description 0000no wait (external wait input disabled) 00011 wait external wait input enabled 111115 wait external wait input enabled (initial value) ? bits 3??s0 space wait specification (w03, w02, w01, w00): specifies the number of waits for cs0 space access. bit 3 (w03) bit 2 (w02) bit 1 (w01) bit 0 (w00) description 0000no wait (external wait input disabled) 00011 wait external wait input enabled 111115 wait external wait input enabled (initial value) 10.2.4 wait control register 2 (wcr2) wcr2 is a 16-bit read/write register that specifies the number of access cycles for dram space and cs space for dma single address mode transfers. do not perform any dma single address transfers before wcr2 is set. wcr2 is initialized by power-on resets to h'000f, but is not initialized by manual resets or software standbys. bit: 15 14 13 12 11 10 9 8 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 1 0 ddw1 ddw0 dsw3 dsw2 dsw1 dsw0 initial value: 0 0 0 0 1 1 1 1 r/w: r r r/w r/w r/w r/w r/w r/w
176 ? bits 15??eserved: these bits always read as 0. the write value should always be 0. ? bits 5??ram space dma single address mode access wait specification (ddw1, ddw0): specifies the number of waits for dram space access during dma single address mode accesses. these bits are independent of the dww and dwr bits of the dcr. bit 5 (ddw1) bit 4 (ddw0) description 0 0 2-cycle (no wait) external wait disabled ( initial value) 1 3-cycle (1 wait) external wait disabled 1 0 4-cycle (2 wait) external wait enabled 1 5-cycle (3 wait) external wait enabled ? bits 3??s space dma single address mode access wait specification (dsw3, dsw2, dsw1, dsw0): specifies the number of waits for cs space access (0?5) during dma single address mode accesses. these bits are independent of the w bits of the wcr1. bit 3 (dsw3) bit 2 (dsw2) bit 1 (dsw1) bit 0 (dsw0) description 0000no wait (external wait input disabled) 00011 wait (external wait input enabled) 111115 wait (external wait input enabled) (initial value) 10.2.5 dram area control register (dcr) dcr is a 16-bit read/write register that selects the number of waits, operation mode, number of address multiplex shifts and the like for dram control. do not perform any dram space accesses before dcr initial settings are completed. dcr is initialized by power-on resets to h'0000, but is not initialized by manual resets or software standbys.
177 bit: 15 14 13 12 11 10 9 8 tpc rcd tras1 tras0 dww1 dww0 dwr1 dwr0 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 bit: 7 6 5 4 3 2 1 0 diw be rasd sz1 sz0 amx1 amx0 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r r/w r/w r/w r/w r/w r/w ? bit 15?as precharge cycle count (tpc): specifies the minimum number of cycles after ras is negated before next assert. bit 15 (tpc) description 0 1.5 cycles (initial value) 1 2.5 cycles ? bit 14?as-cas delay cycle count (rcd): specifies the number of row address output cycles. bit 14 (rcd) description 0 1 cycle (initial value) 1 2 cycles ? bits 13?2?as-before-ras refresh ras assert cycle count (tras1?ras0): specify the number of ras assert cycles for cas before ras refreshes. bit 13 (tras1) bit 12 (tras0) description 0 0 2.5 cycles (initial value) 1 3.5 cycles 1 0 4.5 cycles 1 5.5 cycles
178 ? bits 11?0?ram write cycle wait count (dww1?ww0): specifies the number of dram write cycle column address output cycles. bit 11 (dww1) bit 10 (dww0) description 0 0 2-cycle (no wait) external wait disabled ( initial value) 1 3-cycle (1 wait) external wait disabled 1 0 4-cycle (2 wait) external wait enabled 1 5-cycle (3 wait) external wait enabled ? bits 9??ram read cycle wait count (dwr1?wr0): specifies the number of dram read cycle column address output cycles. bit 9 (dwr1) bit 8 (dwr0) description 0 0 2-cycle (no wait) external wait disabled ( initial value) 1 3-cycle (1 wait) external wait disabled 1 0 4-cycle (2 wait) external wait enabled 1 5-cycle (3 wait) external wait enabled ? bit 7?ram idle cycle count (diw): specifies whether to insert idle cycles, either when accessing a different external space (cs space) or when doing a dram write, after dram reads. bit 7 (diw) description 0 no idle cycles (initial value) 1 1 idle cycle ? bit 6?eserved: this bit always reads as 0. the write value should always be 0. ? bit 5?urst enable (be): specifies the dram operation mode. bit 5 (be) description 0 burst disabled (initial value) 1 dram high-speed page mode enabled . ? bit 4?as down mode (rasd): specifies the dram operation mode. bit 4 (rasd) description 0 access dram by ras up mode (initial value) 1 access dram by ras down mode
179 ? bits 3??ram bus width specification (sz1, sz0): specifies the dram space bus width. bit 3 (sz1) bit 2 (sz0) description 0 0 byte (8 bits) ( initial value) 1 word (16 bits) 1 don? care longword (32 bits) ? bits 1??ram address multiplex (amx1?mx0): specifies the dram address multiplex count. bit 1 (amx1) bit 0 (amx0) description 0 0 9 bit ( initial value) 1 10 bit 1 0 11 bit 1 12 bit 10.2.6 refresh timer control/status register (rtcsr) rtcsr is a 16-bit read/write register that selects the refresh mode and the clock input to the refresh timer counter (rtcnt), and controls compare match interrupts (cmi). rtcsr is initialized by power-on resets and hardware standbys to h'0000, but is not initialized by manual resets or software standbys. bit: 15 14 13 12 11 10 9 8 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 1 0 cmf cmie cks2 cks1 cks0 rfsh rmd initial value: 0 0 0 0 0 0 0 0 r/w: r r/w r/w r/w r/w r/w r/w r/w ? bits 15??eserved: these bits always read as 0. the write value should always be 0
180 ? bit 6?ompare match flag (cmf): this status flag, which indicates that the values of rtcnt and rtcor match, is set/cleared under the following conditions: bit 6 (cmf) description 0 clear condition: after rtcsr is read when cmf is 1, 0 is written in cmf. in some cases it will clear when dtc is activated by a compare match interrupt; refer to section 8, data transfer controller (dtc), for details. (initial value) 1 set condition: rtcnt = rtcor. when both rtcnt and rtcor are in an initialized state (when values have not been rewritten since initialization, and rtcnt has not had its value changed due to a count- up), rtcnt and rtcor match, as both are h'0000, but in this case cmf is not set. ? bit 5?ompare match interrupt enable (cmie): enables or disables an interrupt request caused by the cmf bit of the rtcsr when cmf is set to 1. bit 5 (cmie) description 0 disables an interrupt request caused by cmf (initial value) 1 enables an interrupt request caused by cmf ? bits 4??lock select (cks2?ks0): select the clock to input to rtcnt from among the seven types of internal clock obtained from dividing the system clock ( f ). bit 4 (cks2) bit 3 (cks1) bit 2 (cks0) description 0 0 0 stops count-up (initial value) 1 f /2 10 f /8 1 f /32 100 f /128 1 f /512 10 f /2048 1 f /4096 ? bit 1?efresh control (rfsh): selects whether to use refresh control for dram. bit 1 (rfsh) description 0 do not refresh dram (initial value) 1 refresh dram
181 ? bit 0?efresh mode (rmd): when the rfsh bit is 1, this bit selects normal refresh or self- refresh. when the rfsh bit is 1, self-refresh mode is entered immediately after the rmd bit is set to?. when rmd is cleared to 0, a cas-before-ras refresh is performed at the interval set in the refresh time constant register (rtcnt). when set for self-refresh, the sh7040 series enters self-refresh mode immediately unless it is in the middle of a dram access. if it is, it enters self-refresh mode when the access ends. refresh requests from the interval timer are ignored in self-refresh mode. bit 0 (rmd) description 0 cas-before-ras refresh (initial value) 1 self-refresh 10.2.7 refresh timer counter (rtcnt) rtcnt is a 16-bit read/write register that is used as an 8-bit up counter for refreshes or generating interrupt requests. rtcnt counts up with the clock selected by the cks2?ks0 bits of the rtcsr. rtcnt values can always be read/written by the cpu. when rtcnt matches rtcor, rtcnt is cleared to h'0000 and the cmf flag of the rtcsr is set to 1. if the rfsh bit of rtcsr is 1 and the rmd bit is 0 at this time, a cas-before-ras refresh is performed. additionally, if the cmie bit of rtcsr is a 1, a compare match interrupt (cmi) is generated. bits 15? are reserved and play no part in counter operation. they are always read as 0. rtcnt is initialized by power-on resets h'0000, but is not initialized by manual resets or software standbys. bit: 15 14 13 12 11 10 9 8 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 1 0 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
182 10.2.8 refresh time constant register (rtcor) rtcor is a 16-bit read/write register that establishes the compare match period with rtcnt. the values of rtcor and rtcnt are constantly compared. when the values correspond, the compare match flag of rtcsr is set and rtcnt is cleared to 0. when the refresh bit (rfsh) of the rtcsr is set to 1 and the rmd bit is 0, a refresh request signal is produced by this match. the refresh request signal is held until a refresh operation is performed. if the refresh request is not processed before the next match, the previous request becomes ineffective. when the cmie bit of the rtscr is set to 1, an interrupt request is sent to the interrupt controller by this match signal. the interrupt request is output continuously until the cmf bit of the rtscr is cleared. bits 15? are reserved and cannot be used in setting the period. they always read 0. rtcor is initialized by power-on resets to h'0000, but is not initialized by manual resets or software standbys. bit: 15 14 13 12 11 10 9 8 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 1 0 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
183 10.3 accessing ordinary space a strobe signal is output by ordinary space accesses to provide primarily for sram or rom direct connections. 10.3.1 basic timing figure 10.3 shows the basic timing of ordinary space accesses. ordinary access bus cycles are performed in 2 states. t 1 ck address csn rd read write data wrx data t 2 figure 10.3 basic timing of ordinary space access during a read, irrespective of operand size, all bits in the data bus width for the access space (address) are fetched by the lsi on rd , using the required byte locations. during a write, the following signals are associated with transfer of these actual byte locations: wrhh (bits 31?4), wrhl (bits 23?6), wrh (bits 15?) and wrl (bits 7?).
184 10.3.2 wait state control the number of wait states inserted into ordinary space access states can be controlled using the wcr settings (figure 10.4). t 1 t w ck read write address csn rd data wrx data t 2 figure 10.4 wait timing of ordinary space access (software wait only)
185 when the wait is specified by software using wcr, the wait input wait signal from outside is sampled. figure 10.5 shows the wait signal sampling. the wait signal is sampled at the clock rise one cycle before the clock rise when t w state shifts to t 2 state. t 1 t w ck read write address csn wait rd data wrx data t w t w 0 t 2 figure 10.5 wait state timing of ordinary space access (wait states from software wait 2 state + wait signal)
186 10.3.3 cs assert period extension idle cycles can be inserted to prevent extension of the rd signal or wrx signal assert period beyond the length of the csn signal assert period by setting the sw3?w0 bits of bcr2. this allows for flexible interfaces with external circuitry. the timing is shown in figure 10.6. t h and t f cycles are added respectively before and after the ordinary cycle. only csn is asserted in these cycles; rd and wrx signals are not. further, data is extended up to the t f cycle, which is effective for gate arrays and the like, which have slower write operations. t h t 1 ck read write address csn rd data wrx data t 2 t f dack figure 10.6 cs assert period extension function
187 10.4 dram access 10.4.1 dram direct connection when address space a31?24 = h'01 has been accessed, the corresponding space becomes a 16- mbyte dram space, and the dram interface function can be used to directly connect the sh7040 series to dram. row address and column address are always multiplexed for dram space. the amount of row address multiplexing can be selected as from 9 to 12 bits by setting the amx1 and amx0 bits of the dcr. table 10.5 amx bits and address multiplex output row address column address amx1 amx0 shift amount output pins output address output address output pins 0 0 9 bit a21?15 a21?15 a21?0 a21?0 a14?0 a23?9 0 1 10 bit a21?14 a21?14 a21?0 a21?0 a13?0 a23?10 1 0 11 bit a21?13 a21?13 a21?0 a21?0 a12?0 a23?11 1 1 12 bit a21?12 a21?12 a21?0 a21?0 a11?0 a23?12 in addition to ordinary read and write accesses, burst mode access using high speed page mode is supported.
188 10.4.2 basic timing the sh7040 series supports 2 cas format dram access. the dram access basic timing is a minimum of 3 cycles for normal mode. figure 10.7 shows the basic dram access timing. dram space access is controlled by ras , casx and rdwr signals. the following signals are associated with transfer of these actual byte locations: cashh (bits 31?4), cashl (bits 23?6), cash (bits 15?) and casl (bits 7?). however, the signals for ordinary space, wrx and rd, are also output during the dmac single transfer column address cycle period. t p is the precharge cycle, t r is the ras assert cycle, t c is the cas assert cycle and t c2 is the read data fetch cycle. t p t r t c1 t c2 ck write read address data ras casx rdwr data rdwr casx ras row column figure 10.7 dram bus cycle (normal mode, tpc = 0, rcd = 0, no waits)
189 10.4.3 wait state control wait state insertion during dram space access is controlled by setting the tpc, rcd, dww1, dww0, dwr1, and dwr0 bits of the dcr. tpc and rcd are common to both reads and writes. the timing with waits inserted is shown in figures 10.8 through 10.11. external waits can be inserted at the time of software waits 2, 3. the sampling location is the same as that of ordinary space: at one cycle before the t c2 cycle clock rise. wait cycles are extended by external waits. t p t r t c1 t cw1 t c2 ck write read address data ras casx rdwr data rdwr casx ras row column figure 10.8 dram bus cycle (normal mode, tpc = 0, rcd = 0, one wait)
190 t p t r t rw t c1 t cw1 t cw2 t cw2 t pw ck write read address data ras casx rdwr data rdwr casx ras row column figure 10.9 dram bus cycle (normal mode, tpc = 1, rcd = 1, two waits)
191 t p t c1 t cw1 t cw2 t cw3 t c2 t r ck write read address data ras casx rdwr data rdwr casx ras row column figure 10.10 dram bus cycle (normal mode, tpc = 0, rcd = 0, three waits)
192 t p t c1 t cw1 t cw2 t cw0 t c2 t r ck write read address data ras casx rdwr data rdwr casx ras row column wait figure 10.11 dram bus cycle (normal mode, tpc = 0, rcd= 0, two waits + wait due to wait signal)
193 10.4.4 burst operation high-speed page mode: when the burst enable bit (be) of the dcr is set, burst accesses can be performed using high speed page mode. the timing is shown in figure 10.12. wait cycles can be inserted during burst accesses by using the dcr. t p t c1 t c2 t c1 t c2 t r ck write read address data ras casx rdwr data rdwr casx ras row column column figure 10.12 dram bus cycle (high-speed page mode) ras down mode: there are some instances where even if burst operation is selected, continuous accesses to dram will not occur, but another space will be accessed instead part way through the access. in such cases, if the ras signal is maintained at low level during the time the other space is accessed, it is possible to continue burst operation at the time the next dram same row address is accessed. this is called ras down mode. to use ras down mode, set both the be and rasd bits of the dcr to 1. figures 10.13 and 10.14 show operation in ras up and down modes.
194 ck ras casx dram access dram access cs space access address data cs space tp tr tc1 tc2 t1 t2 tp tr tc1 tc2 column column row row figure 10.13 dram access normal operation (ras up mode) ck ras casx dram access dram access cs space access address data row column cs space tp tr tc1 tc2 t1 t2 tc1 tc2 column figure 10.14 ras down mode
195 10.4.5 refresh timing the bus state controller is equipped with a function to control refreshes of dram. cas-before- ras (cbr) refresh or self-refresh can be selected by setting the rtcsr? rmd bit. cas-before-ras refresh: for cbr refreshes, set the rcr? rmd bit to 0 and the rfsh bit to 1. also write the values in rtcnt and rtcor necessary to fulfill the refresh interval prescribed for the dram being used. when a clock is selected with the cks2?ks0 bits of the rstcr, rtcnt starts counting up from the value at that time. the rtcnt value is constantly compared to the rtcor value and a cbr refresh is performed when the two match. rtcnt is cleared at that time and the count starts again. figure 10.15 shows the timing for the cbr refresh operation. the number of ras assert cycles in the refresh cycle is set by the tras1, tras0 bits of the dcr. ck casx ras t rp t rr1 t rr2 t rc t rc figure 10.15 cas-before-ras refresh timing (tras1, tras0 = 0, 0)
196 self-refresh: when both the rmd and rfsh bits of the rtcsr are set to 1, the cas signal and ras signal are output and the dram enters self-refresh mode, as shown in figure 10.16. do not access dram during self-refreshes, in order to preserve dram data. when performing dram accesses, first cancel the self-refresh, then access only after doing individual refreshes for all row addresses within the time prescribed for the particular dram. for external bus right requests during self-refreshes, to preserve dram data at the time of releasing the bus rights, only casx , ras , and rdwr are output and the bus rights are released to the external device with the self-refresh maintained. consequently, do not perform dram accesses from external devices at such a time. ck casx ras t rp t rr1 t rr2 t rc t rc figure 10.16 self-refresh timing
197 10.5 address/data multiplex i/o space access when the bcr1 register ioe bit is set to 1, the d15?0 pins can be used for multiplexed address/data i/o for the cs3 space. consequently, peripheral lsis requiring address/data multiplexing can be directly connected to this lsi. address/data multiplex i/o space bus width is selected by the a14 bit, and is 8 bit when a14 = 0 and 16 bit when a14 = 1. 10.5.1 basic timing when the ioe bit of the bcr1 is set to 1, cs3 space becomes address/data multiplex i/o space. when this space is accessed, addresses and data are multiplexed. when the a14 address bit is 0, the bus size becomes 8 bit and addresses and data are input and output through the d7?0 pins. when the a14 address bit is 1, the bus size becomes 16 bit and address output and data i/o occur through the d15?0 pins. access for the address/data multiplex i/o space is controlled by the ah , rd and wrx signals. address/data multiplex i/o space accesses are done after a 3-cycle (fixed) address output, as an ordinary space type access (figure 10.17). ck cs3 ah rd data wrx data address t a1 t a2 t a3 t a4 t 1 t 2 read write address output address output data output data input figure 10.17 address/data multiplex i/o space access timing (no waits)
198 10.5.2 wait state control setting the wcr controls waits during address/data multiplex i/o space accesses. software wait and external wait insertion timing is the same as during ordinary space accesses. the timing for one software wait + one external wait inserted is shown in figure 10.18. ck cs3 ah rd data wrx data wait address t a1 t a2 t a3 t a4 t 1 t w t wo t 2 read write address output address output data output data input figure 10.18 address/data multiplex i/o space access wait state timing (one software wait + one external wait)
199 10.5.3 cs assertion extension the timing diagram when setting cs assertion extension during address/data multiplex i/o space access is shown in figure 10.19. cs3 ah rd data wrxx data address t a1 t a2 t a3 t a4 t h t 1 t 2 t f read write address output address output data output data input figure 10.19 wait timing in address/data multiplex i/o space when cs assertion extension is set 10.6 waits between access cycles when a read from a slow device is completed, data buffers may not go off in time to prevent data conflicts with the next access. if there is a data conflict during memory access, the problem can be solved by inserting a wait in the access cycle. to enable detection of bus cycle starts, waits can be inserted between access cycles during continuous accesses of the same cs space by negating the csn signal once. 10.6.1 prevention of data bus conflicts for the two cases of write cycles after read cycles, and read cycles for a different area after read cycles, waits are inserted so that the number of idle cycles specified by the iw31?w00 bits of the
200 bcr2 and the diw of the dcr occur. when idle cycles already exist between access cycles, only the number of empty cycles remaining beyond the specified number of idle cycles are inserted. figure 10.20 shows an example of idles between cycles. in this example, 1 idle between csn space cycles has been specified, so when a csm space write immediately follows a csn space read cycle, 1 idle cycle is inserted. ck csn csm rd data csn space read csm space write idle cycle wrx address t 1 t 2 t 1 t 2 t idle figure 10.20 idle cycle insertion example iw31 and iw30 specify the number of idle cycles required after a cs3 space read either to read other external spaces, or for this lsi, to do write accesses. in the same manner, iw21 and iw20 specify the number of idle cycles after a cs2 space read, iw11 and iw10, the number after a cs1 space read, and iw01 and iw00, the number after a cs0 space read. diw specifies the number of idle cycles required, after a dram space read either to read other external spaces (cs space), or for this lsi, to do write accesses. 0 to 3 cycles can be specified for cs space, and 0 to 1 cycle for dram space.
201 10.6.2 simplification of bus cycle start detection for consecutive accesses of the same cs space, waits are inserted so that the number of idle cycles designated by the cw3?w0 bits of the bcr2 occur. however, for write cycles after reads, the number of idle cycles inserted will be the larger of the two values defined by the iw and cw bits. when idle cycles already exist between access cycles, waits are not inserted. figure 10.21 shows an example. a continuous access idle is specified for csn space, and csn space is consecutively write accessed. ck csn rd wrx data csn space access csn space access idle cycle address t 1 t 2 t 1 t 2 t idle figure 10.21 same space consecutive access idle cycle insertion example 10.7 bus arbitration the sh7040 series has a bus arbitration function that, when a bus release request is received from an external device, releases the bus to that device. it also has two internal bus masters, the cpu and the dmac, dtc. the priority ranking for determining bus right transfer between these bus masters is: bus right request from external device > refresh > dtc > dmac > cpu however, during a read or write in dmac dual address mode, a burst transfer, or indirect address transfer mode operation, the dmac continues operating even if a dtc request is received. through port register settings, irqout is asserted to indicate that a cas-before-ras refresh request for dram has been generated during release of bus rights to an external device. use this
202 to cause the external device to negate the breq and return the bus rights to the sh7040 series. please note that if the external device does not return the bus rights within the time prescribed for the dram refresh interval, this lsi will not be able to perform the refresh operation and the dram contents cannot be guaranteed. figure 10.22 shows the bus right release procedure. breq = low sh704x breq accepted strobe pin: high-level output address, data, strobe pin: high impedance bus right release response bus right release status external device bus right request back confirmation bus right acquisition back = low figure 10.22 bus right release procedure
203 10.8 memory connection examples figures 10.23?0.31 show examples of the memory connections. as a21?18 become input ports in power-on reset, they should be handled (e.g. pulled down) as necessary. sh704x 32k 8 bits ce oe csn rd a0?14 d0?7 a0?14 i/o0?/o7 rom figure 10.23 8-bit data bus width rom connection sh704x 256k 16 bits rom ce oe csn rd a0 a1?18 d0?15 a0?17 i/o0?/o15 figure 10.24 16-bit data bus width rom connection
204 sh704x csn rd ce ce oe oe a0 a1 a2?19 d16?31 d0?15 a0?17 a0?17 i/o0?/o15 i/o0?/o15 256k 16 bits rom figure 10.25 32-bit data bus width rom connection sh704x csn rd wrl we cs oe a0?16 a0?16 d0?7 i/o0?/o7 123k 8 bits sram figure 10.26 8-bit data bus width sram connection
205 sh704x 128k 8 bits sram csn rd cs oe a0 a1?17 a0?16 wrh we d8?15 i / o0?/o7 wrl d0?7 cs oe a0?16 we i / o0?/o7 figure 10.27 16-bit data bus width sram connection
206 sh704x cs csn rd oe a0 a1 a2?18 a0?16 wrhh we d24?31 i/o0?/o7 wrhl d16?23 d0?7 wrl wrh d8?15 cs oe a0?16 we i/o0?/o7 cs oe a0?16 we i/o0?/o7 i / o0?/o7 cs oe a0?16 we 128k 8 bits sram figure 10.28 32-bit data bus width sram connection
207 sh704x ras rdwr a0?9 casl ad0?d7 ras we a0?9 cas i/o0?/o7 oe 512k 8 bits dram figure 10.29 8-bit data bus width dram connection ras ras rdwr we a0 oe a1?9 cash ucas casl lcas ad0?d15 i/o0?/o15 sh704x 256k 16 bits dram a0?8 figure 10.30 16-bit data bus width dram connection
208 sh704x 256k 16 bits dram ras rdwr a0 a1 a2?10 cashh cashl ad16?d31 ras we oe a0?8 ucas lcas i/o0?/o15 i/o0?/o15 cash casl ad0?d15 ras we oe a0?8 ucas lcas figure 10.31 32-bit data bus width dram connection 10.9 on-chip peripheral i/o register access on-chip peripheral i/o registers are accessed from the bus state controller, as shown in table 10.6. table 10.6 on-chip peripheral i/o register access on-chip peripheral module sci mtu, poe intc pfc, port cmt a/d* ubc wdt dmac dtc cache connected bus width 8bit 16bit 16bit 16bit 16bit 16bit 16bit 16bit 16bit 16bit 16bit access cycle 2cyc 2cyc 2cyc 2cyc 2cyc 2cyc 3cyc 3cyc 3cyc 3cyc 3cyc note: a/d of a mask products are accessed in 8-bit width, 3 cyc.
209 cycles in which bus is not released (a) one bus cycle: the bus is never released during a single bus cycle. for example, in the case of a longword read (or write) in 8-bit normal space, the four memory accesses to the 8-bit normal space constitute a single bus cycle, and the bus is never released during this period. assuming that one memory access requires two states, the bus is not released during an 8-state period. 8 bit 8 bit 8 bit 8 bit cycles in which bus is not released figure 10.32 one bus cycle 10.10 cpu operation when program is in external memory in the sh7040 series, two words (equivalent to two instructions) are normally fetched in a single instruction fetch. this is also true when the program is located in external memory, irrespective of whether the external memory bus width is 8 or 16 bits. if the program counter value immediately after the program branches is an odd-word (2n + 1) address, or if the program counter value immediately before the program branches is an even-word (2n) address, the cpu will always fetch 32 bits (equivalent to two instructions) that include the respective word instruction.
211 section 11 direct memory access controller (dmac) 11.1 overview the sh7040 series includes an on-chip four-channel direct memory access controller (dmac). the dmac can be used in place of the cpu to perform high-speed data transfers among external devices equipped with dack (transfer request acknowledge signal), external memories, memory- mapped external devices, and on-chip peripheral modules (except for the dmac, dtc, bsc, and ubc). using the dmac reduces the burden on the cpu and increases operating efficiency of the lsi as a whole. 11.1.1 features the dmac has the following features: ? four channels ? four gbytes of address space in the architecture ? byte, word, or longword selectable data transfer unit ? 16 mbytes (16,777,216 transfers, maximum) ? single or dual address mode. dual address mode can be direct or indirect address transfer. ? single address mode: either the transfer source or transfer destination (peripheral device) is accessed by a dack signal while the other is accessed by address. one transfer unit of data is transferred in each bus cycle. ? dual address mode: both the transfer source and transfer destination are accessed by address. dual address mode can be direct or indirect address transfer. ? direct access: values set in a dmac internal register indicate the accessed address for both the transfer source and transfer destination. two bus cycles are required for one data transfer. ? indirect access: the value stored at the location pointed to by the address set in the dmac internal transfer source register is used as the address. operation is otherwise the same as direct access. this function can only be set for channel 3. four bus cycles are required for one data transfer. ? channel function: transfer modes that can be set are different for each channel. (dual address mode indirect access can only be set for channel 1. only direct access is possible for the other channels). ? channel 0: single or dual address mode. external requests are accepted. ? channel 1: single or dual address mode. external requests are accepted. ? channel 2: dual address mode only. source address reload function operates every fourth transfer.
212 ? channel 3: dual address mode only. direct address transfer mode and indirect address transfer mode selectable. ? reload function: enables automatic reloading of the value set in the first source address register every fourth dma transfer. this function can be executed on channel 2 only. ? transfer requests: there are three dmac transfer activation requests, as indicated below. ? external request: from two dreq pins. dreq can be detected either by falling edge or by low level. external requests can only be received on channels 0 or 1. ? requests from on-chip peripheral modules: transfer requests from on-chip modules such as sci or a/d. these can be received by all channels. ? auto-request: the transfer request is generated automatically within the dmac. ? selectable bus modes: cycle-steal mode or burst mode ? two types of dmac channel priority ranking: ? fixed priority mode: always fixed ? round robin mode: sets the lowest priority level for the channel that received the execution request last ? cpu can be interrupted when the specified number of data transfers are complete.
213 11.1.2 block diagram figure 11.1 is a block diagram of the dmac. on-chip rom peripheral bus internal bus on-chip ram dreq0 , dreq1 circuit control sarn dmac module register control activation control request priority control bus interface bus state controller on-chip peripheral module darn dmatcrn chcrn dmaor mtu sci0, sci1 a/d converter* dein external rom external ram external i/o (memory mapped) external i/o (with acknowledge) dack0, dack1 drak0, drak1 sarn: darn: dmatcrn: chcrn: dmaor: n: dmac source address register dmac destination address register dmac transfer count register dmac channel control register dmac operation register 0, 1, 2, 3 note: a/d1 for a mask and a/d for others figure 11.1 dmac block diagram
214 11.1.3 pin configuration table 11.1 shows the dmac pins. table 11.1 dmac pin configuration channel name symbol i/o function 0 dma transfer request dreq0 i dma transfer request input from external device to channel 0 dma transfer request acknowledge dack0 o dma transfer strobe output from channel 0 to external device dreq0 acceptance confirmation drak0 o sampling receive acknowledge output for dma transfer request input from external source 1 dma transfer request dreq1 i dma transfer request input from external device to channel 1 dma transfer request acknowledge dack1 o dma transfer strobe output from channel 1 to external device dreq1 acceptance confirmation drak1 o sampling receive acknowledge output for dma transfer request input from external source
215 11.1.4 register configuration table 11.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 11.2 dmac registers chan- nel name abbrevi- ation r/w initial value* 6 address register size access size 0 dma source address register 0 sar0 r/w undefined h'ffff86c0 32 bit 16, 32* 2 dma destination address register 0 dar0 r/w undefined h'ffff86c4 32 bit 16, 32* 2 dma transfer count register 0 dmatcr0 r/w undefined h'ffff86c8 32 bit 16, 32* 3 dma channel control register 0 chcr0 r/w* 1 h'00000000 h'ffff86cc 32 bit 16, 32* 2 1 dma source address register 1 sar1 r/w undefined h'ffff86d0 32 bit 16, 32* 2 dma destination address register 1 dar1 r/w undefined h'ffff86d4 32 bit 16, 32* 2 dma transfer count register 1 dmatcr1 r/w undefined h'ffff86d8 32 bit 16, 32* 3 dma channel control register 1 chcr1 r/w* 1 h'00000000 h'ffff86dc 32 bit 16, 32* 2 2 dma source address register 2 sar2 r/w undefined h'ffff86e0 32 bit 16, 32* 2 dma destination address register 2 dar2 r/w undefined h'ffff86e4 32 bit 16, 32* 2
216 table 11.2 dmac registers (cont) chan- nel name abbrevi- ation r/w initial value address register size access size 2 (cont) dma transfer count register 2 dmatcr2 r/w undefined h'ffff86e8 32 bit 16, 32* 3 dma channel control register 2 chcr2 r/w* 1 h'00000000 h'ffff86ec 32 bit 16, 32* 2 3 dma source address register 3 sar3 r/w undefined h'ffff86f0 32 bit 16, 32* 2 dma destination address register 3 dar3 r/w undefined h'ffff86f4 32 bit 16, 32* 2 dma transfer count register 3 dmatcr3 r/w undefined h'ffff86f8 32 bit 16, 32* 3 dma channel control register 3 chcr3 r/w* 1 h'00000000 h'ffff86fc 32 bit 16, 32* 2 shared dma operation register dmaor r/w* 1 h'0000 h'ffff86b0 16 bit 16, 32* 4 notes: 1. write 0 after reading 1 in bit 1 of chcr0?hcr3 and in bits 1 and 2 of the dmaor to clear flags. no other writes are allowed. 2. for 16-bit access of sar0?ar3, dar0?ar3, and chcr0?hcr3, the 16-bit value on the side not accessed is held. 3. dmatcr has a 24-bit configuration: bits 0?3. writing to the upper 8 bits (bits 24?1) is invalid, and these bits always read 0. 4. do not make 32-bit access for dmaor. 5. do not attempt to access an empty address. if an access is attemped, the system operation is not guarenteed. 6. the reserved bit value within register is undefined on 33mhz version. 11.2 register descriptions 11.2.1 dma source address registers 0? (sar0?ar3) dma source address registers 0? (sar0?ar3) are 32-bit read/write registers that specify the source address of a dma transfer. these registers have a count function, and during a dma transfer, they indicate the next source address. in single-address mode, sar values are ignored when a device with dack has been specified as the transfer source. specify a 16-bit or 32-bit boundary address when doing 16-bit or 32-bit data transfers. operation cannot be guaranteed on any other addresses. the initial value after power-on resets or in software standby mode is undefined. these registers are not initialized with manual reset.
217 bit: 31 30 29 28 27 26 25 24 initial value: r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 23 22 21 2 1 0 initial value: r/w: r/w r/w r/w r/w r/w r/w 11.2.2 dma destination address registers 0? (dar0?ar3) dma destination address registers 0? (dar0?ar3) are 32-bit read/write registers that specify the destination address of a dma transfer. these registers have a count function, and during a dma transfer, they indicate the next destination address. in single-address mode, dar values are ignored when a device with dack has been specified as the transfer destination. specify a 16-bit or 32-bit boundary address when doing 16-bit or 32-bit data transfers. operation cannot be guaranteed on any other address. the initial value after power-on resets or in software standby mode, is undefined. these registers are not initialized with manual reset. bit: 31 30 29 28 27 26 25 24 initial value: r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 23 22 21 2 1 0 initial value: r/w: r/w r/w r/w r/w r/w r/w
218 11.2.3 dma transfer count registers 0? (dmatcr0?matcr3) dma transfer count registers 0? (dmatcr0?matcr3) are 24-bit read/write registers that specify the transfer count for the channel (byte count, word count, or longword count). specifying a h'000001 gives a transfer count of 1, while h'000000 gives the maximum setting, 16,777,216 transfers. the data for the upper 8 bits of a dmatcr is 0 (33mhz version is undefined) when read. always write 0. the initial value after power-on resets or in software standby mode is undefined. these registers are not initialized with manual reset. always write 0 to the upper 8 bits of a dmatcr. bit: 31 30 29 28 27 26 25 24 initial value: r/w: r r r r r r r r bit: 23 22 21 20 19 18 17 16 initial value: r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 15 14 13 12 11 10 9 8 initial value: r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 7 6 5 4 3 2 1 0 initial value: r/w: r/w r/w r/w r/w r/w r/w r/w r/w
219 11.2.4 dma channel control registers 0? (chcr0?hcr3) dma channel control registers 0? (chcr0?hcr3) is a 32-bit read/write register where the operation and transmission of each channel is designated. they are initialized by a power-on reset and in software standby mode. there is no initializing with manual reset. bit: 31 30 29 28 27 26 25 24 initial value: r/w: r r r r r r r r bit: 23 22 21 20 19 18 17 16 di* 2 ro* 2 rl* 2 am* 2 al* 2 initial value: 0 0 0 0 0 r r r (r/w) (r/w) (r/w) (r/w) (r/w) bit: 15 14 13 12 11 10 9 8 dm1 dm0 sm1 sm0 rs3 rs2 rs1 rs0 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 bit: 7 6 5 4 3 2 1 0 ds* 2 tm ts1 ts0 ie te de initial value: 0 0 0 0 0 0 0 r/w: r (r/w) r/w r/w r/w r/w r/(w) * 1 r/w notes: 1. te bit: allows only 0 write after reading 1. 2. the di, ro, rl, am, al, or ds bit may be absent, depending on the channel. ? bits 31?1?eserved bits: data are 0 (33mhz version is undefined) when read. the write value always be 0. ? bit 20?irect/indirect (di): specifies either direct address mode operation or indirect address mode operation for channel 3 source address. this bit is valid only in chcr3. it always reads 0 for chcr0?hcr2, and cannot be modified. bit 20: di description 0 direct access mode operation for channel 3 (initial value) 1 indirect access mode operation for channel 3
220 ? bit 19?ource address reload (ro): selects whether to reload the source address initial value during channel 2 transfer. this bit is valid only for channel 2. it always reads 0 for chcr0, chcr1, and chcr3, and cannot be modified. bit 19: ro description 0 does not reload source address (initial value) 1 reloads source address ? bit 18?equest check level (rl): selects whether to output drak notifying external device of dreq received, with active high or active low. this bit is valid only for chcr0 and chcr1. it always reads 0 for chcr2 and chcr3, and cannot be modified. bit 18: rl description 0 output drak with active high (initial value) 1 output drak with active low ? bit 17?cknowledge mode (am): in dual address mode, selects whether to output dack in the data write cycle or data read cycle. in single address mode, dack is always output irrespective of the setting of this bit. this bit is valid only for chcr0 and chcr1. it always reads as 0 for chcr2 and chcr3, and cannot be modified. bit 17: am description 0 outputs dack during read cycle (initial value) 1 outputs dack during write cycle ? bit 16?cknowledge level (al): specifies whether to set dack (acknowledge) signal output to active high or active low. this bit is valid only with chcr0 and chcr1. it always reads as 0 for chcr2 and chcr3, and cannot be modified. bit 16: al description 0 active high output (initial value) 1 active low output
221 ? bits 15 and 14?estination address mode 1, 0 (dm1 and dm0): these bits specify increment/decrement of the dma transfer destination address. these bit specifications are ignored when transferring data from an external device to address space in single address mode. bit 15: dm1 bit 14: dm0 description 0 0 destination address fixed (initial value) 0 1 destination address incremented (+1 during 8-bit transfer, +2 during 16-bit transfer, +4 during 32-bit transfer) 1 0 destination address decremented (? during 8-bit transfer, ? during 16-bit transfer, ? during 32-bit transfer) 1 1 setting prohibited ? bits 13 and 12?ource address mode 1, 0 (sm1 and sm0): these bits specify increment/decrement of the dma transfer source address. these bit specifications are ignored when transferring data from an external device to address space in single address mode. bit 13: sm1 bit 12: sm0 description 0 0 source address fixed (initial value) 0 1 source address incremented (+1 during 8-bit transfer, +2 during 16-bit transfer, +4 during 32-bit transfer) 1 0 source address decremented (? during 8-bit transfer, ? during 16-bit transfer, ? during 32-bit transfer) 1 1 setting prohibited when the transfer source is specified at an indirect address, specify in source address register 3 (sar3) the actual storage address of the data you want to transfer as the data storage address (indirect address). during indirect address mode, sar3 obeys the sm1/sm0 setting for increment/decrement. in this case, sar3? increment/decrement is fixed at +4/? or 0, irrespective of the transfer data size specified by ts1 and ts0.
222 ? bits 11??esource select 3? (rs3?s0): these bits specify the transfer request source. bit 11: rs3 bit 10: rs2 bit 9: rs1 bit 8: rs0 description 0 0 0 0 external request, dual address mode (initial value) 0 0 0 1 prohibited 0 0 1 0 external request, single address mode. external address space external device. 0 0 1 1 external request, single address mode. external device external address space. 0 1 0 0 auto-request 0 1 0 1 prohibited 0 1 1 0 mtu tgi0a 0 1 1 1 mtu tgi1a 1 0 0 0 mtu tgi2a 1 0 0 1 mtu tgi3a 1 0 1 0 mtu tgi4a 1 0 1 1 a/d adi* 2 1 1 0 0 sci0 txi0 1 1 0 1 sci0 rxi0 1 1 1 0 sci1 txi1 1 1 1 1 sci1 rxi1 note: 1. external request designations are valid only for channels 0 and 1. no transfer request sources can be set for channels 2 or 3. 2. adi1 for a mask. ? bit 7?eserved bits: data is 0 (33mhz version is undefined) when read. the write value always be 0. ? bit 6 dreq select (ds): sets the sampling method for the dreq pin in external request mode to either low-level detection or falling-edge detection. this bit is valid only with chcr0 and chcr1. for chcr2 and chcr3, this bit always reads as 0 and cannot be modified. even with channels 0 and 1, when specifying an on-chip peripheral module or auto-request as the transfer request source, this bit setting is ignored. the sampling method is fixed at falling- edge detection in cases other than auto-request. bit 6: ds description 0 low-level detection (initial value) 1 falling-edge detection
223 ? bit 5?ransfer mode (tm): specifies the bus mode for data transfer. bit 5: tm description 0 cycle steal mode (initial value) 1 burst mode ? bits 4 and 3?ransfer size 1, 0 (ts1, ts0): specifies size of data for transfer. bit 4: ts1 bit 3: ts0 description 0 0 specifies byte size (8 bits) (initial value) 0 1 specifies word size (16 bits) 1 0 specifies longword size (32 bits) 1 1 prohibited ? bit 2?nterrupt enable (ie): when this bit is set to 1, interrupt requests are generated after the number of data transfers specified in the dmatcr (when te = 1). bit 2: ie description 0 interrupt request not generated after dmatcr-specified transfer count (initial value) 1 interrupt request enabled on completion of dmatcr specified number of transfers ? bit 1?ransfer end flag (te): this bit is set to 1 after the number of data transfers specified by the dmatcr. at this time, if the ie bit is set to 1, an interrupt request is generated. if data transfer ends before te is set to 1 (for example, due to an nmi or address error, or clearing of the de bit or dme bit of the dmaor) the te is not set to 1. with this bit set to 1, data transfer is disabled even if the de bit is set to 1. bit 1: te description 0 dmatcr-specified transfer count not ended (initial value) clear condition: 0 write after te = 1 read, power-on reset, standby mode 1 dmatcr specified number of transfers completed
224 ? bit 0?mac enable (de): de enables operation in the corresponding channel. bit 0: de description 0 operation of the corresponding channel disabled (initial value) 1 operation of the corresponding channel enabled transfer mode is entered if this bit is set to 1 when auto-request is specified (rs3?s0 settings). with an external request or on-chip module request, when a transfer request occurs after this bit is set to 1, transfer is enabled. if this bit is cleared during a data transfer, transfer is suspended. if the de bit has been set, but te = 1, then if the dme bit of the dmaor is 0, and the nmi or ae bit of the dmaor is 1, transfer enable mode is not entered. 11.2.5 dmac operation register (dmaor) the dmaor is a 16-bit read/write register that specifies the transfer mode of the dmac register values are initialized to 0 during power-on reset or in software standby mode. manual reset does not initialize dmaor. bit: 15 14 13 12 11 10 9 8 pr1pr0 initial value: 0 0 r/w: r r r r r r r/w r/w bit: 7 6 5 4 3 2 1 0 ae nmif dme initial value: 0 0 r/w: r r r r r r/(w)* r/(w)* r note: 0 write only is valid after 1 is read at the ae and nmif bits. ? bits 15?0?eserved bits:data are 0 (33mhz version is undefined) when read. the write value always be 0.
225 ? bits 9??riority mode 1 and 0 (pr1 and pr0): these bits determine the priority level of channels for execution when transfer requests are made for several channels simultaneously. bit 9: pr1 bit 8: pr0 description 0 0 ch0 > ch1 > ch2 > ch3 (initial value) 0 1 ch0 > ch2 > ch3 > ch1 1 0 ch2 > ch0 > ch1 > ch3 1 1 round robin mode ? bits 7??eserved bits:data are 0 (33mhz version is undefined) when read. the write value always be 0. ? bit 2?ddress error flag (ae): indicates that an address error has occurred during dma transfer. if this bit is set during a data transfer, transfers on all channels are suspended. the cpu cannot write a 1 to the ae bit. clearing is effected by 0 write after 1 read. bit 2: ae description 0 no address error, dma transfer enabled (initial value) clearing condition: write ae = 0 after reading ae = 1 1 address error, dma transfer disabled setting condition: address error due to dmac ? bit 1?mi flag (nmif): indicates input of an nmi. this bit is set irrespective of whether the dmac is operating or suspended. if this bit is set during a data transfer, transfers on all channels are suspended. the cpu is unable to write a 1 to the nmif. clearing is effected by a 0 write after 1 read. bit 1: nmif description 0 no nmi interrupt, dma transfer enabled (initial value) clearing condition: write nmif = 0 after reading nmif = 1 1 nmi has occurred, dmc transfer prohibited set condition: nmi interrupt occurrence
226 ? bit 0?mac master enable (dme): this bit enables activation of the entire dmac. when the dme bit and de bit of the chcr for the corresponding channel are set to 1, that channel is transfer-enabled. if this bit is cleared during a data transfer, transfers on all channels are suspended. even when the dme bit is set, when the te bit of the chcr is 1, or its de bit is 0, transfer is disabled in the case of an nmi of the dmaor or when ae = 1. bit 0: dme description 0 disable operation on all channels (initial value) 1 enable operation on all channels 11.3 operation when there is a dma transfer request, 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 peripheral module request. transfer can be in either the single address mode or the dual address mode, and dual address mode can be either direct or indirect address transfer mode. the bus mode can be either burst or cycle steal. 11.3.1 dma transfer flow after the dma source address registers (sar), dma destination address registers (dar), dma transfer count register (dmatcr), dma channel control registers (chcr), and dma operation register (dmaor) are set to the desired transfer conditions, the dmac transfers data according to the following procedure: 1. the dmac checks to see if transfer is enabled (de = 1, dme = 1, te = 0, nmif = 0, ae = 0). 2. when a transfer request comes and transfer has been enabled, the dmac transfers 1 transfer unit of data (determined by ts0 and ts1 setting). for an auto-request, the transfer begins automatically when the de bit and dme bit are set to 1. the dmatcr value will be decremented by 1 upon each transfer. the actual transfer flows vary by address mode and bus mode. 3. when the specified number of transfers have been completed (when dmatcr 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 0.
227 figure 11.2 is a flowchart of this procedure. normal end does nmif = 1, ae = 1, de = 0, or dme = 0? bus mode, transfer request mode, dreq detection selection system initial settings (sar, dar, tcr, chcr, dmaor) transfer (1 transfer unit); dmatcr ?1 ? dmatcr, sar and dar updated dei interrupt request (when ie = 1) no yes no yes no yes yes no yes no * 3 * 2 start transfer aborted notes: 1. 2. 3. in auto-request mode, transfer begins when nmif, ae, and te are all 0, and the de and dme bits are set to 1. dreq = level detection in burst mode (external request) or cycle-steal mode. dreq = edge detection in burst mode (external request), or auto-request mode in burst mode. dmatcr = 0? transfer request occurs?* 1 de, dme = 1 and nmif, ae, te = 0? does nmif = 1, ae = 1, de = 0, or dme = 0? transfer ends figure 11.2 dmac transfer flowchart
228 11.3.2 dma transfer requests dma transfer requests are usually 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 peripheral module request. the request mode is selected in the rs3?s0 bits of the dma channel control registers 0? (chcr0?hcr3). 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 chcr0?hcr3 and the dme bit of the dmaor are set to 1, the transfer begins (so long as the te bits of chcr0?hcr3 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 11.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 chcr0?hcr3 (ds = 0 is level detection, ds = 1 is edge detection). the source of the transfer request does not have to be the data transfer source or destination. table 11.3 selecting external request modes with the rs bits rs3 rs2 rs1 rs0 address mode source destination 0000 dual address mode any* any* 0010 single address mode external memory or memory-mapped external device external device with dack 0011 single address mode external device with dack external memory or memory-mapped external device note: external memory, memory-mapped external device, on-chip memory, on-chip peripheral module (excluding dmac, dtc, bsc, ubc). on-chip peripheral module request mode: in this mode a transfer is performed at the transfer request signal (interrupt request signal) of an on-chip peripheral module. as indicated in table 11.4, there are ten transfer request signals: five from the multifunction timer pulse unit (mtu), which are compare match or input capture interrupts; the receive data full interrupts (rxi) and transmit data empty interrupts (txi) of the two serial communication interfaces (sci); and the a/d conversion end interrupt (adi1 for a mask, adi for others) of the a/d converter. when dma
229 transfers are enabled (de = 1, dme = 1, te = 0, nmif = 0, ae = 0), a transfer is performed upon the input of a transfer request signal. the transfer request source need not be the data transfer source or transfer destination. however, when the transfer request is set by rxi (transfer request because sci? receive data is full), the transfer source must be the sci? receive data register (rdr). when the transfer request is set by txi (transfer request because sci? transmit data is empty), the transfer destination must be the sci? transmit data register (tdr). also, if the transfer request is set to the a/d converter, the data transfer destination must be the a/d converter register. table 11.4 selecting on-chip peripheral module request modes with the rs bits rs3 rs2 rs1 rs0 dmac transfer request source dma transfer request signal source destin- ation bus mode 0110 mtu* 2 tgi0a any* 1 any* 1 burst/cycle steal 0111 mtu* 2 tgi1a any* 1 any* 1 burst/cycle steal 1000 mtu* 2 tgi2a any* 1 any* 1 burst/cycle steal 1001 mtu* 2 tgi3a any* 1 any* 1 burst/cycle steal 1010 mtu* 2 tgi4a any* 1 any* 1 burst/cycle steal 1011 a/d adi* 5 addr* 4 any* 1 burst/cycle steal 1100 sci0* 3 transmit block txi0 any* 1 tdr0 burst/cycle steal 1101 sci0* 3 transmit block rxi0 rdr0 any* 1 burst/cycle steal 1110 sci1* 3 transmit block txi1 any* 1 tdr1 burst/cycle steal 1111 sci1* 3 transmit block rxi1 rdr1 any* 1 burst/cycle steal notes: 1. external memory, memory-mapped external device, on-chip memory, on-chip peripheral module (excluding dmac, dtc, bsc, ubc). 2. mtu: multifunction timer pulse unit. 3. sci0, sci1: serial communications interface. 4. addr0, addr1: a/d converter? a/d register. 5. adi1 for a mask. in order to output a transfer request from an on-chip peripheral module, set the relevant interrupt enable bit for each module, and output an interrupt signal. when an on-chip peripheral module? interrupt request signal is used as a dma transfer request signal, interrupts for the cpu are not generated. when a dma transfer is conducted corresponding with one of the transfer request signals in table 11.4, it is automatically discontinued. in cycle steal mode this occurs in the first transfer, and in burst mode with the last transfer.
230 11.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, either in a fixed mode or in round robin mode. these modes are selected by priority bits pr1 and pr0 in the dma operation register (dmaor). fixed mode: in these modes, the priority levels among the channels remain fixed. the following priority orders are available for fixed mode: ? ch0 > ch1 > ch2 > ch3 ? ch0 > ch2 > ch3 > ch1 ? ch2 > ch0 > ch1 > ch3 these are selected by settings of the pr1 and pr0 bits of the dma operation register (dmaor). round robin mode: in round robin mode, each time the transfer of one transfer unit (byte, word or long word) ends on a given channel, that channel receives the lowest priority level (figure 11.3). the priority level in round robin mode immediately after a reset is ch0 > ch1 > ch2 > ch3.
231 ch1 > ch2 > ch3 > ch0 ch0 > ch1 > ch2 > ch3 ch2 > ch3 > ch0 > ch1 ch0 > ch1 > ch2 > ch3 ch2 > ch3 > ch0 > ch1 ch0 > ch1 > ch2 > ch3 ch0 > ch1 > ch2 > ch3 ch3 > ch0 > ch1 > ch2 ch0 > ch1 > ch2 > ch3 transfer on channel 0 initial priority setting initial priority setting initial priority setting initial priority setting no change in priority. when channel 2 receives the lowest priority, the priorities of channel 0 and 1, which were above channel 2, are also shifted simultaneously. immedi- ately thereafter, if there is a transfer request for channel 1 only, channel 1 is given the lowest priority, and the priorities of channels 3 and 0 are simultaneously shifted down. when channel 1 is given the lowest priority, the priority of channel 0, which was above channel 1, is also shifted simultaneously. channel 1 is given the lowest priority. priority after transfer priority after transfer priority after transfer priority after transfer priority after transfer due to issue of a transfer request for channel 1 only. transfer on channel 1 transfer on channel 2 transfer on channel 3 figure 11.3 round robin mode
232 figure 11.4 shows the changes in priority levels when transfer requests are issued simultaneously for channels 0 and 3, and channel 1 receives a transfer request during a transfer on channel 0. the dmac operates in the following manner under these circumstances: 1. transfer requests are issued simultaneously for channels 0 and 3. 2. since channel 0 has a higher priority level than channel 3, the channel 0 transfer is conducted first (channel 3 is on transfer standby). 3. a transfer request is issued for channel 1 during a transfer on channel 0 (channels 1 and 3 are on transfer standby). 4. at the end of the channel 0 transfer, channel 0 shifts to the lowest priority level. 5. at this point, channel 1 has a higher priority level than channel 3, so the channel 1 transfer comes first (channel 3 is on transfer standby). 6. when the channel 1 transfer ends, channel 1 shifts to the lowest priority level. 7. channel 3 transfer begins. 8. when the channel 3 transfer ends, channel 3 and channel 2 priority levels are lowered, giving channel 3 the lowest priority. transfer request channel waiting dmac operation channel priority issued for channels 0 and 3 issued for channel 1 0 > 1 > 2 > 3 channel 0 transfer begins 1 > 2 > 3 > 0 channel 0 transfer ends channel 1 transfer begins channel 3 transfer begins 2 > 3 > 0 > 1 channel 1 transfer ends 0 > 1 > 2 > 3 channel 3 transfer ends change of priority change of priority change of priority none 3 3 1,3 figure 11.4 example of changes in priority in round robin mode
233 11.3.4 dma transfer types the dmac supports the transfers shown in table 11.5. it can operate in the single address mode, in which either the transfer source or destination is accessed using an acknowledge signal, or dual access mode, in which both the transfer source and destination addresses are output. the dual access mode consists of a direct address mode, in which the output address value is the object of a direct data transfer, and an indirect address mode, in which the output address value is not the object of the data transfer, but the value stored at the output address becomes the transfer object address. the actual transfer operation timing varies with the bus mode. the dmac has two bus modes: cycle-steal mode and burst mode. table 11.5 supported dma transfers destination source external device with dack external memory memory- mapped external device on-chip memory on-chip peripheral module external device with dack not available single single not available not available external memory single dual dual dual dual memory-mapped external device single dual dual dual dual on-chip memory not available dual dual dual dual on-chip peripheral module not available dual dual dual dual notes: 1. single: single address mode 2. dual: dual address mode; includes both direct address mode and indirect address mode. 11.3.5 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 1 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 11.5 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.
234 dmac dack dreq external memory external device with dack this lsi external address bus : data flow external data bus figure 11.5 data flow in single address mode two types of transfers are possible in the single address mode: (a) transfers between external devices with dack and memory-mapped external devices, and (b) transfers between external devices with dack and external memory. the only transfer requests for either of these is the external request ( dreq ). figure 11.6 shows the dma transfer timing for the single address mode.
235 ck a21?0 csn d15?0 dack wrh wrl address output to external memory space data that is output from the external device with dack dack signal to external devices with dack (active low) wr signal to external memory space a. external device with dack to external memory space ck a21?0 csn d15?0 rd address output to external memory space data that is output from external memory space rd signal to external memory space dack signal to external device with dack (active low) dack b. external memory space to external device with dack figure 11.6 example of dma transfer timing in the single address mode 11.3.6 dual address mode dual address mode is used for access of both the transfer source and destination by address. transfer source and destination can be accessed either internally or externally. dual address mode is subdivided into two other modes: direct address transfer mode and indirect address transfer mode. direct address transfer mode: data is read from the transfer source during the data read cycle, and written to the transfer destination during the write cycle, so transfer is conducted in two bus cycles. at this time, the transfer data is temporarily stored in the dmac. with the kind of external memory transfer shown in figure 11.7, data is read from one of the memories by the dmac during a read cycle, then written to the other external memory during the subsequent write cycle. figure 11.8 shows the timing for this operation.
236 data buffer address bus data bus address bus data bus memory transfer source module transfer destination module memory transfer source module transfer destination module sar dar data buffer sar dar the sar value is taken as the address, and data is read from the transfer source module and stored temporarily in the dmac. 1st bus cycle 2nd bus cycle the dar value is taken as the address, and data stored in the dmac's data buffer is written to the transfer destination module. dmac dmac figure 11.7 direct address operation during dual address mode
237 data read cycle data write cycle transfer destination address transfer source address ck (1st cycle) (2nd cycle) a21?0 csn d15?0 rd wrh , wrl dack note: transfer between external memories with dack are output during read cycle. figure 11.8 example of direct address transfer timing in dual address mode
238 indirect address transfer mode: in this mode the memory address storing the data you actually want to transfer is specified in dmac internal transfer source address register (sar3). therefore, in indirect address transfer mode, the dmac internal transfer source address register value is read first. this value is stored once in the dmac. next, the read value is output as the address, and the value stored at that address is again stored in the dmac. finally, the subsequent read value is written to the address specified by the transfer destination address register, ending one cycle of dma transfer. in indirect address mode (figure 11.9), transfer destination, transfer source, and indirect address storage destination are all 16-bit external memory locations, and transfer in this example is conducted in 16-bit or 8-bit units. timing for this transfer example is shown in figure 11.10. in indirect address mode, one nop cycle (figure 11.10) is required until the data read as the indirect address is output to the address bus. when transfer data is 32-bit, the third and fourth bus cycles each need to be doubled, giving a required total of six bus cycles and one nop cycle for the whole operation.
239 sar3 dar3 data buffer address bus data bus memory transfer source module transfer destination module temporary buffer the sar3 value is taken as the address, memory data is read, and the value is stored in the temporary buffer. since the value read at this time is used as the address, it must be 32 bits. when external connection data bus is 16 bits, two bus cycles are required. dmac sar3 dar3 data buffer address bus data bus memory transfer source module transfer destination module temporary buffer the value in the temporary buffer is taken as the address, and data is read from the transfer source module to the data buffer. sar3 dar3 data buffer address bus data bus memory transfer source module transfer destination module temporary buffer the dar3 value is taken as the address, and the value in the data buffer is written to the transfer destination module. note: memory, transfer source, and transfer destination modules are shown here. in practice, connection can be made anywhere there is address space. dmac dmac 1st, 2nd bus cycles 3rd bus cycle 4th bus cycle figure 11.9 dual address mode and indirect address operation (when external memory space is 16 bits)
240 transfer source address (h) transfer source address (l) indirect address nop transfer destination address indirect address (h) indirect address (l) transfer data transfer data transfer data transfer data transfer data transfer source address * 1 indirect address * 2 indirect address nop indirect address address read cycle (1st) (2nd) (3rd) nop cycle data read cycle (4th) data write cycle external memory space has 16-bit width. ck a21?0 csn d15?0 internal address bus internal data bus dmac indirect address buffer dmac data buffer rd wrh , wrl notes: 1. 2. 3. the internal address bus is controlled by the port and does not change. dmac does not fetch value until 32-bit data is read from the internal data bus. figure 11.10 dual address mode and indirect address transfer timing example 1 (external memory space to external memory space)
241 figure 11.11 shows an example of timing in indirect address mode when transfer source and indirect address storage locations are in internal memory, the transfer destination is an on-chip peripheral module with 2-cycle access space, and transfer data is 8-bit. since the indirect address storage destination and the transfer source are in internal memory, these can be accessed in one cycle. the transfer destination is 2-cycle access space, so two data write cycles are required. one nop cycle is required until the data read as the indirect address is output to the address bus. internal address bus internal data bus dmac indirect address buffer dmac data buffer ck transfer source address nop nop indirect address transfer destination address indirect address indirect address transfer data transfer data transfer data address read cycle nop cycle data read cycle data write cycle (4th) (1st) (2nd) (3rd) figure 11.11 dual address mode and indirect address transfer timing example 2 (on-chip memory space to on-chip memory space)
242 11.3.7 bus modes select the appropriate bus mode in the tm bits of chcr0?hcr3. there are two bus modes: cycle steal and burst. cycle-steal mode: in the cycle steal mode, the bus right is given to another bus master after each one-transfer-unit (byte, word, or longword) dmac transfer. when the next 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 11.12 shows an example of dma transfer timing in the cycle steal mode. transfer conditions are dual address mode and dreq level detection. cpu cpu cpu dmac dmac cpu dmac dmac cpu cpu dreq bus cycle bus control returned to cpu read write write read figure 11.12 dma transfer example in the cycle-steal mode 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. figure 11.13 shows an example of dma transfer timing in the burst mode. transfer conditions are single address mode and dreq level detection. cpu cpu cpu dmac dmac dmac dmac dmac dreq bus cycle dmac cpu figure 11.13 dma transfer example in the burst mode
243 11.3.8 relationship between request modes and bus modes by dma transfer category table 11.6 shows the relationship between request modes and bus modes by dma transfer category. table 11.6 relationship of request modes and bus modes by dma transfer category address mode transfer category request mode bus* 6 mode transfer size (bits) usable channels single external device with dack and external memory external b/c 8/16/32 0, 1 external device with dack and memory-mapped external device external b/c 8/16/32 0, 1 dual external memory and external memory any* 1 b/c 8/16/32 0?* 5 external memory and memory-mapped external device any* 1 b/c 8/16/32 0?* 5 memory-mapped external device and memory-mapped external device any* 1 b/c 8/16/32 0?* 5 external memory and on-chip memory any* 1 b/c 8/16/32 0?* 5 external memory and on-chip peripheral module any* 2 b/c* 3 8/16/32* 4 0?* 5 memory-mapped external device and on-chip memory any* 1 b/c 8/16/32 0?* 5 memory-mapped external device and on-chip peripheral module any* 2 b/c* 3 8/16/32* 4 0?* 5 on-chip memory and on-chip memory any* 1 b/c 8/16/32 0?* 5 on-chip memory and on-chip peripheral module any* 2 b/c* 3 8/16/32* 4 0?* 5 on-chip peripheral module and on- chip?eripheral module any* 2 b/c* 3 8/16/32* 4 0?* 5 notes: 1. external request, auto-request or on-chip peripheral module request enabled. however, in the case of on-chip peripheral module request, it is not possible to specify the sci or a/d converter for the transfer request source. 2. external request, auto-request or on-chip peripheral module request possible. however, if transfer request source is also the sci or a/d converter (a/d1 for a mask), the transfer source or transfer destination must be the sci or a/d converter (a/d1 for a mask). for a mask, setting a/d0 as the transfer request source is not permitted. 3. when the transfer request source is the sci, only cycle steal mode is possible. 4. access size permitted by register of on-chip peripheral module that is the transfer source or transfer destination. 5. when the transfer request is an external request, channels 0 and 1 only can be used. 6. b: burst, c: cycle steal
244 11.3.9 bus mode and channel priority order when a given channel is transferring in burst mode, and a transfer request is issued to channel 0, which has a higher priority ranking, transfer on channel 0 begins immediately. if the priority level setting is fixed mode (ch0 > ch1), channel 1 transfer is continued after transfer on channel 0 are completely ended, whether the channel 0 setting is cycle steal mode or burst mode. when the priority level setting is for round robin mode, transfer on channel 1 begins after transfer of one transfer unit on channel 0, whether channel 0 is set to cycle steal mode or burst mode. thereafter, bus right alternates in the order: channel 1 > channel 0 > channel 1 > channel 0. whether the priority level setting is for fixed mode or round robin mode, since channel 1 is set to burst mode, the bus right is not given to the cpu. an example of round robin mode is shown in figure 11.14. cpu dmac ch1 dmac ch1 dmac ch0 dmac ch1 dmac ch0 dmac ch1 dmac ch1 cpu ch0 ch1 ch0 dmac ch0 and ch1 round-robin mode dmac ch1 burst mode cpu cpu priority: round-robin mode ch0: cycle-steal mode ch1: burst mode dmac ch1 burst mode figure 11.14 bus handling when multiple channels are operating 11.3.10 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 (bsc) just as it is when the cpu is the bus master. for details, see section 8, data transfer controller (dtc). dreq pin sampling timing and drak signal: in external request mode, the dreq pin is sampled by either falling edge or low-level detection. when a dreq input is detected, a dmac bus cycle is issued and dma transfer effected, at the earliest, after three states. however, in burst mode when single address operation is specified, a dummy cycle is inserted for the first bus cycle. in this case, the actual data transfer starts from the second bus cycle. data is transferred continuously from the second bus cycle. the dummy cycle is not counted in the number of transfer cycles, so there is no need to recognize the dummy cycle when setting the tcr. dreq sampling from the second time begins from the start of the transfer one bus cycle prior to the dmac transfer generated by the previous sampling.
245 drak is output once for the first dreq sampling, irrespective of transfer mode or dreq detection method. in burst mode, using edge detection, dreq is sampled for the first cycle only, so drak is also output for the first cycle only. therefore, the dreq signal negate timing can be ascertained, and this facilitates handshake operations of transfer requests with the dmac. cycle steal mode operations: in cycle steal mode, dreq sampling timing is the same irrespective of dual or single address mode, or whether edge or low-level dreq detection is used. for example, dmac transfer begins (figure 11.15), at the earliest, three cycles from the first sampling timing. the second sampling begins at the start of the transfer one bus cycle prior to the start of the dmac transfer initiated by the first sampling (i.e., from the start of the cpu(3) transfer). at this point, if dreq detection has not occurred, sampling is executed every cycle thereafter. as in figure 11.16, whatever cycle the cpu transfer cycle is, the next sampling begins from the start of the transfer one bus cycle before the dmac transfer begins. figure 11.15 shows an example of output during dack read and figure 11.16 an example of output during dack write.
246 ck d req drak bus cycle dack cpu(3) cpu(4) cpu(5) cpu(2) cpu(1) 1st sampling 2nd sampling dmac(r) dmac(r) dmac(w) dmac(w) dmac(w) dmac(r) figure 11.15 cycle steal, dual address and level detection (fastest operation)
247 ck dreq drak bus cycle dack cpu cpu cpu cpu dmac(r) dmac (r) dmac(w) 1st sampling 2nd sampling note: with cycle-steal and dual address operation, sampling timing is the same whether dreq detection is by level or by edge. figure 11.16 cycle steal, dual address and level detection (normal operation)
248 figures 11.17 and 11.18 show cycle steal mode and single address mode. in this case, transfer begins at earliest three cycles after the first dreq sampling. the second sampling begins from the start of the transfer one bus cycle before the start of the first dmac transfer. in single address mode, the dack signal is output during the dmac transfer period.
249 ck dreq drak bus cycle dack cpu cpu cpu cpu cpu dmac dmac dmac figure 11.17 cycle steal, single address and level detection (fastest operation)
250 ck dreq drak bus cycle dack cpu cpu dmac cpu dmac cpu cpu figure 11.18 cycle steal, single address and level detection (normal operation)
251 burst mode, dual address, and level detection: dreq sampling timing in burst mode with dual address and level detection is virtually the same as that of cycle steal mode. for example, dmac transfer begins (figure 11.19), at the earliest, three cycles after the timing of the first sampling. the second sampling also begins from the start of the transfer one bus cycle before the start of the first dmac transfer. in burst mode, as long as transfer requests are issued, dmac transfer continues. therefore, the ?ransfer one bus cycle before the start of the dmac transfer?may be a dmac transfer. in burst mode, the dack output period is the same as that of cycle steal mode. figure 11.20 shows the normal operation of this burst mode.
252 ck dreq drak bus cycle dack cpu cpu cpu cpu dmac(r) dmac(w) dmac(r) dmac(r) dmac(w) dmac(r) dmac(w) figure 11.19 burst mode, dual address and level detection (fastest operation)
253 ck dreq drak bus cycle dack cpu cpu dmac(r) dmac(r) dmac(r) cpu dmac(w) dmac(w) figure 11.20 burst mode, dual address and level detection (normal operation)
254 burst mode, single address, and level detection: dreq sampling timing in burst mode with single address and level detection is shown in figures 11.21 and 11.22. in burst mode with single address and level detection, a dummy cycle is inserted as one bus cycle, at the earliest, three cycles after timing of the first sampling. data during this period is undefined, and the dack signal is not output. nor is the number of dmac transfers counted. the actual dmac transfer begins after one dummy bus cycle output. the dummy cycle is not counted either at the start of the second sampling (transfer one bus cycle before the start of the first dmac transfer). therefore, the second sampling is not conducted from the bus cycle starting the dummy cycle, but from the start of the cpu(3) bus cycle. thereafter, as long the dreq is continuously sampled, no dummy cycle is inserted. dreq sampling timing during this period begins from the start of the transfer one bus cycle before the start of dmac transfer, in the same way as with cycle steal mode. as with the fourth sampling in figure 11.21, once dmac transfer is interrupted, a dummy cycle is again inserted at the start as soon as dmac transfer is resumed. the dack output period in burst mode is the same as in cycle steal mode.
255 ck dreq drak bus cycle dack cpu(4) cpu(1) cpu(2) cpu(3) dummy dmac dummy 2nd sampling 1st sampling 3rd sampling 4th sampling dmac dmac figure 11.21 burst mode, single address and level detection (fastest operation)
256 ck dreq drak bus cycle dack cpu cpu dummy dmac cpu dmac dmac figure 11.22 burst mode, single address and level detection (normal operation)
257 burst mode, dual address, and edge detection: in burst mode with dual address and edge detection, dreq sampling is conducted only on the first cycle. in figure 11.23, dmac transfer begins, at the earliest, three cycles after the timing of the first sampling. thereafter, dmac transfer continues until the end of the data transfer count set in the tcr. dreq sampling is not conducted during this period. therefore, drak is output on the first cycle only. when dmac transfer is resumed after being halted by a nmi or address error, be sure to reinput an edge request. the remaining transfer restarts after the first drak output. the dack output period in burst mode is the same as in cycle steal mode.
258 ck dreq drak bus cycle dack cpu cpu cpu dmac(r) dmac(r) dmac(r) dmac(r) dmac(w) dmac(w) dmac(w) dmac(w) figure 11.23 burst mode, dual address and edge detection
259 burst mode, single address, and edge detection: in burst mode with single address and edge detection, dreq sampling is conducted only on the first cycle. in figure 11.24, a dummy cycle is inserted, at the earliest, three cycles after the timing for the first sampling. during this period, data is undefined, and dack is not output. nor is the number of dmac transfers counted. thereafter, dmac transfer continues until the data transfer count set in the dmatcr has ended. dreq sampling is not conducted during this period. therefore, drak is output on the first cycle only. when dmac transfer is resumed after being halted by a nmi or address error, be sure to reinput an edge request. drak is output once, and the remaining transfer restarts after output of one dummy cycle. the dack output period in burst mode is the same as in cycle steal mode.
260 ck dreq drak bus cycle dack cpu dmac dmac dmac dmac cpu cpu dummy figure 11.24 burst mode, single address and edge detection
261 11.3.11 source address reload function channel 2 has a source address reload function. this returns to the first value set in the source address register (sar2) every four transfers by setting the ro bit of chcr2 to 1. figure 11.25 illustrates this operation. figure 11.26 is a timing chart for reload on mode, with burst mode, autorequest, 16-bit transfer data size, sar2 increment, and dar2 fixed mode. sar2 (initial value) dmac transfer request dmac control block reload control 4th count chcr2 dmatcr2 sar2 ro bit = 1 count signal reload signal reload signal address bus figure 11.25 source address reload function ck internal address bus internal data bus sar2 dar2 dar2 dar2 dar2 sar2+2 sar2+4 sar2+6 sar2 dar2 sar2 data sar2+2 data sar2+4 data sar2+6 data sar2 data 1st channel 2 transfer 2nd channel 2 transfer 3rd channel 2 transfer 4th channel 2 transfer 5th channel 2 transfer sar2 output dar2 output sar2+2 output dar2 output sar2+4 output dar2 output sar2+6 output dar2 output sar2 output dar2 output after sar2+6 output, sar2 is reloaded bus right is returned one time in four figure 11.26 source address reload function timing chart
262 the reload function can be executed whether the transfer data size is 8, 16, or 32 bits. dmatcr2, which specifies the number of transfers, is decremented by 1 at the end of every single-transfer-unit transfer, regardless of whether the reload function is on or off. therefore, when using the reload function in the on state, a multiple of 4 must be specified in dmatcr2. operation will not be guaranteed if any other value is set. also, the counter which counts the occurrence of four transfers for address reloading is reset by clearing of the dme bit in dmaor or the de bit in chcr2, setting of the transfer end flag (the te bit in chcr2), nmi input, and setting of the ae flag (address error generation in dmac transfer), as well as by a reset and in software standby mode, but sar2, dar2, dmatcr2, and other registers are not reset. consequently, when one of these sources occurs, there is a mixture of initialized counters and uninitialized registers in the dmac, and incorrect operation may result if a restart is executed in this state. therefore, when one of the above sources, other than te setting, occurs during use of the address reload function, sar, dar2, and dmatcr2 settings must be carried out before re- execution. 11.3.12 dma transfer ending conditions the dma transfer ending conditions vary for individual channels ending and for all channels ending together. individual channel ending conditions: there are two ending conditions. a transfer ends when the value of the channel? dma transfer count register (dmatcr) is 0, or when the de bit of the channel? chcr is cleared to 0. ? when dmatcr is 0: when the dmatcr 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 of the cpu. ? when de of chcr is 0: software can halt a dma transfer by clearing the de bit in the channel? chcr. the te bit is not set when this happens. conditions for ending all channels simultaneously: transfers on all channels end when the nmif (nmi flag) bit or ae (address error flag) bit is set to 1 in the dmaor, or when the dme bit in the dmaor is cleared to 0. ? when the nmif or ae bit is set to 1 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 dmac obtains the bus rights, and if these flags are set to 1 during execution of a transfer, dmac halts operation when the transfer processing currently being executed ends, and transfers the bus right to the other bus master. consequently, even if the nmif or ae bits are set to 1 during a transfer, the dma source address register (sar), designation address register (dar), and transfer count register (tcr) are all updated. the te bit is not set. to resume the transfers after nmi interrupt or address error processing, clear the appropriate flag bit to 0. to avoid restarting a transfer on a particular channel, clear its de bit to 0.
263 when the processing of a one unit transfer is complete. in a dual address mode direct address transfer, even if an address error occurs or the nmi flag is set during read processing, the transfer will not be halted until after completion of the following write processing. in such a case, sar, dar, and tcr values are updated. in the same manner, the transfer is not halted in dual address mode indirect address transfers until after the final write processing has ended. ? when dme is cleared to 0 in dmaor: clearing the dme bit to 0 in the dmaor aborts the transfers on all channels. the te bit is not set. 11.3.13 dmac access from cpu the space addressed by the dmac is 3-cycle space. therefore, when the cpu becomes the bus master and accesses the dmac, a minimum of three basic clock (clk) cycles are required for one bus cycle. also, since the dmac is located in word space, while a word-size access to the dmac is completed in one bus cycle, a longword-size access is automatically divided into two word accesses, requiring two bus cycles (six basic clock cycles). these two bus cycles are executed consecutively; a different bus cycle is never inserted between the two word accesses. this applies to both write accesses and read accesses. 11.4 examples of use 11.4.1 example of dma transfer between on-chip sci and external memory in this example, on-chip serial communication interface channel 0 (sci0) received data is transferred to external memory using the dmac channel 3. table 11.7 indicates the transfer conditions and the setting values of each of the registers. table 11.7 transfer conditions and register set values for transfer between on-chip sci and external memory transfer conditions register value transfer source: rdr0 of on-chip sci0 sar3 h'ffff81a5 transfer destination: external memory dar3 h'00400000 transfer count: 64 times dmatcr3 h'00000040 transfer source address: fixed chcr3 h'00004d05 transfer destination address: incremented transfer request source: sci0 (rdr0) bus mode: cycle steal transfer unit: byte interrupt request generation at end of transfer channel priority ranking: 0 > 1 > 2 > 3 dmaor h'0001
264 11.4.2 example of dma transfer between external ram and external device with dack in this example, an external request, serial address mode transfer with external memory as the transfer source and an external device with dack as the transfer destination is executed using dmac channel 1. table 11.8 indicates the transfer conditions and the setting values of each of the registers. table 11.8 transfer conditions and register set values for transfer between external ram and external device with dack transfer conditions register value transfer source: external ram sar1 h'00400000 transfer destination: external device with dack dar1 (access by dack) transfer count: 32 times dmatcr1 h'00000020 transfer source address: decremented chcr1 h'00002269 transfer destination address: (setting ineffective) transfer request source: external pin ( dreq1 ) edge detection bus mode: burst transfer unit: word no interrupt request generation at end of transfer channel priority ranking: 2 > 0 > 1 > 3 dmaor h'0201 11.4.3 example of dma transfer between a/d converter and on-chip memory (address reload on) (excluding a mask) in this example, the on-chip a/d converter channel 0 is the transfer source and on-chip memory is the transfer destination, and the address reload function is on. table 11.9 indicates the transfer conditions and the setting values of each of the registers.
265 table 11.9 transfer conditions and register set values for transfer between a/d converter and on-chip memory transfer conditions register value transfer source: on-chip a/d converter ch0 sar2 h'ffff83f0 transfer destination: on-chip memory dar2 h'fffff000 transfer count: 128 times (reload count 32 times) dmatcr2 h'00000080 transfer source address: incremented chcr2 h'00085b25 transfer destination address: incremented transfer request source: a/d converter bus mode: burst transfer unit: byte interrupt request generation at end of transfer channel priority ranking: 0 > 2 > 3 > 1 dmaor h'0101 when address reload is on, the sar value returns to its initially established value every four transfers. in the above example, when a transfer request is input from the a/d converter, the byte size data is first read in from the h'ffff83f0 register of ad0 and that data is written to the on- chip memory address h'fffff001. because a byte size transfer was performed, the sar and dar values at this point are h'ffff83f1 and h'fffff001, respectively. also, because this is a burst transfer, the bus rights remain secured, so continuous data transfer is possible. when four transfers are completed, if the address reload is off, execution continues with the fifth and sixth transfers and the sar value continues to increment from h'ffff83f3 to h'ffff83f4 to h'ffff83f5 and so on. however, when the address reload is on, the dmac transfer is halted upon completion of the fourth one and the bus right request signal to the cpu is cleared. at this time, the value stored in sar is not h'ffff83f3?'ffff83f4, but h'ffff83f3?'ffff83f0, a return to the initially established address. the dar value always continues to be decremented regardless of whether the address reload is on or off. the dmac internal status, due to the above operation after completion of the fourth transfer, is indicated in table 11.10 for both address reload on and off.
266 table 11.10 dmac internal status item address reload on address reload off sar h'ffff83f0 h'ffff83f4 dar h'fffff004 h'fffff004 dmatcr h'0000007c h'0000007c bus rights released maintained dmac operation halted processing continues interrupts not issued not issued transfer request source flag clear executed not executed notes: 1. interrupts are executed until the dmatcr value becomes 0, and if the ie bit of the chcr is set to 1, are issued regardless of whether the address reload is on or off. 2. if transfer request source flag clears are executed until the dmatcr value becomes 0, they are executed regardless of whether the address reload is on or off. 3. designate burst mode when using the address reload function. there are cases where abnormal operation will result if it is executed in cycle steal mode. 4. designate a multiple of four for the tcr value when using the address reload function. there are cases where abnormal operation will result if anything else is designated. to execute transfers after the fifth one when the address reload is on, make the transfer request source issue another transfer request signal. 11.4.4 example of dma transfer between a/d converter and internal memory (address reload on) (a mask) in this example the on-chip a/d converter (a/d1) is the transfer source and the internal memory is the transfer destination, and the address reload on. table 11.11 indicates the transfer conditions and the setting values of each of the registers.
267 table 11.11 transfer conditions and register set values for transfer between a/d converter (a/d1) and internal memory transfer conditions register value transfer source: on-chip a/d converter (a/d1) sar2 h'ffff8408 transfer destination: internal memory dar2 h'fffff000 transfer count: 128 times (reload count 32 times) dmatcr2 h'00000080 transfer source address: incremented chcr2 h'00085b25 transfer target address: incremented transfer request source: a/d converter (a/d1) bus mode: burst transfer unit: byte interrupt request generated at end of transfer channel priority sequence: 0>2>3>1 dmaor h'0101 when address reload is on, the sar value returns to its initially established value every four transfers. in the above example, when a transfer request is input from the a/d converter (a/d1), the byte size data is first read in from the h'ffff8408 register and that data is written to the on- chip memory address h'fffff001. because a byte size transfer was performed, the sar and dar values at this point are h'ffff8409 and h'fffff001, respectively. also, because this is a burst transfer, the bus rights remain secured, so continuous data transfer is possible. when four transfers are completed, if the address reload is off, execution continues with the fifth and sixth transfers and the sar value continues to increment from h'ffff840b to h'ffff840c to h'ffff840d and so on. however, when the address reload is on, the dmac transfer is halted upon completion of the fourth transfer and the bus right request signal to the cpu is cleared. at this time, the values stored in sar are not h'ffff840b?'ffff840c, but h'ffff840b h'ffff8408, a return to the initially established address. the dar value always continues to be decremented regardless of whether the address reload is on or off. the dmac internal status, due to the above operation after completion of the fourth transfer, is indicated in table 11.12 for both address reload on and off.
268 table 11.12 dmac internal status item address reload on address reload off sar h'ffff8408 h'ffff840c dar h'fffff004 h'fffff004 dmatcr h'0000007c h'0000007c bus rights released maintained dmac operation halted processing continues interrupts not issued not issued transfer request source flag clear executed not executed notes: 1. interrupts are executed until the dmatcr value becomes 0, and if the ie bit of the chcr is set to 1, are issued regardless of whether the address reload is on or off. 2. if transfer request source flag clears are executed until the dmatcr value becomes 0, they are executed regardless of whether the address reload is on or off. 3. designate burst mode when using the address reload function. there are cases where abnormal operation will result if it is executed in cycle steal mode. 4. designate a multiple of four for the tcr value when using the address reload function. there are cases where abnormal operation will result if anything else is designated. to execute more than four transfers with the address reload on, make the transfer request source issue another transfer request signal. 11.4.5 example of dma transfer between external memory and sci1 send side (indirect address on) in this example, dmac channel 3 is used, an indirect address designated external memory is the transfer source and the sci1 sending side is the transfer destination. table 11.13 indicates the transfer conditions and the setting values of each of the registers.
269 table 11.13 transfer conditions and register set values for transfer between external memory and sci1 sending side transfer conditions register value transfer source: external memory sar3 h'00400000 value stored in address h'00400000 h'00450000 value stored in address h'00450000 h'55 transfer destination: on-chip sci tdr1 dar3 h'ffff81b3 transfer count: 10 times dmatcr3 h'0000000a transfer source address: incremented chcr3 h'00011e01 transfer destination address: fixed transfer request source: sci1 (tdr1) bus mode: cycle steal transfer unit: byte interrupt request not generated at end of transfer channel priority ranking: 0 > 1 > 2 > 3 dmaor h'0001 when indirect address mode is on, the data stored in the address established in sar is not used as the transfer source data. in the case of indirect addressing, the value stored in the sar address is read, then that value is used as the address and the data read from that address is used as the transfer source data, then that data is stored in the address designated by the dar. in the table 11.13 example, when a transfer request from the tdr1 of sci1 is generated, a read of the address located at h'00400000, which is the value set in sar3, is performed first. the data h'00450000 is stored at this h'00400000 address, and the dmac first reads this h'00450000 value. it then uses this read value of h'00450000 as an address and reads the value of h'55 that is stored in the h'00450000 address. it then writes the value h'55 to the address h'ffff81b3 designated by dar3 to complete one indirect address transfer. with indirect addressing, the first executed data read from the address established in sar3 always results in a longword size transfer regardless of the ts0, ts1 bit designations for transfer data size. however, the transfer source address fixed and increment or decrement designations are as according to the sm0, sm1 bits. consequently, despite the fact that the transfer data size designation is byte in this example, the sar3 value at the end of one transfer is h'00400004. the write operation is exactly the same as an ordinary dual address transfer write operation.
270 11.5 cautions on use 1. other than the dma operation register (dmaor) accessing in word (16-bit) units, access all registers in word (16-bit) or longword (32-bit) units. 2. when rewriting the rs0?s3 bits of chcr0?hcr3, first clear the de bit to 0 (set the de bit to 0 before doing rewrites with a chcr byte address). 3. when an nmi interrupt is input, the nmif bit of the dmaor is set even when the dmac is not operating. 4. set the dme bit of the dmaor to 0 and make certain that any dmac received transfer request processing has been completed before entering standby mode. 5. do not access the dmac, dtc, bsc, or ubc on-chip peripheral modules from the dmac. 6. when activating the dmac, do the chcr or dmaor setting as the final step. there are instances where abnormal operation will result if any other registers are established last. 7. after the dmatcr count becomes 0 and the dma transfer ends normally, always write a 0 to the dmatcr, even when executing the maximum number of transfers on the same channel. there are instances where abnormal operation will result if this is not done. 8. designate burst mode as the transfer mode when using the address reload function. there are instances where abnormal operation will result in cycle steal mode. 9. designate a multiple of four for the dmatcr value when using the address reload function. there are instances where abnormal operation will result if anything else is designated. 10. when detecting external requests by falling edge, maintain the external request pin at high level when performing the dmac establishment. 11. when operating in single address mode, establish an external address as the address. there are instances where abnormal operation will result if an internal address is established. 12. do not access dmac register empty addresses (h'ffff86b2?'ffff86bf). operation cannot be guaranteed when empty addresses are accessed.
271 section 12 multifunction timer pulse unit (mtu) 12.1 overview the superh microprocessor has an on-chip 16-bit multifunction timer pulse unit (mtu) with five channels of 16-bit timers. 12.1.1 features can process a maximum of sixteen different pulse outputs and inputs. has sixteen timer general registers (tgr): four each for channels 0, 3, and 4, and two each for channels 1 and 2 that can be set to function independently as output compare or input capture. the channel 0, 3, and 4 tgrc and tgrd registers can be used as buffer registers. can select eight counter input clock sources for all channels all channels can be set for the following operating modes: ? compare match waveform output: 0 output/1 output/toggle output selectable. ? input capture function: selectable rising edge, falling edge, or both rising and falling edge detection. ? 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 register input/output. ? pwm mode: pwm output can be provided with any duty cycle. when combined with the counter synchronizing function, enables up to twelve-phase pwm output. (with channels 0? set to pwm mode 2, channels 3?, and channels 0? synchronized with tgr3a of channel 3 as the sync register (channels 0? phase output: 4, 2, 2, 2, 2).) channels 0, 3, and 4 can be set for buffer operation ? input capture register double buffer configuration possible ? output compare register automatic re-write possible channels 1 and 2 can be independently set to the phase counting mode ? two-phase encoder pulse up/down count possible cascade connection operation ? can be operated as a 32-bit counter by using the channel 2 input clock for channel 1 overflow/underflow channels 3 and 4 can be set in the following modes: ? reset-synchronized pwm mode: by combining channels 3 and 4, a sawtooth wave comparator type six-phase pwm waveform can be output.
272 ? complementary pwm mode: by combining channels 3 and 4, a triangle wave comparator type six-phase pwm output is possible with non-overlapping times. high speed access via internal 16-bit bus twenty-three interrupt sources ? channels 0, 3, and 4 have four compare-match/input capture interrupts and one overflow interrupt which can be requested independently. ? channels 1 and 2 have two compare-match/input capture interrupts, one overflow interrupt, and one underflow interrupt which can be requested independently. automatic transfer of register data block transfer, 1-word data transfers and 1-byte data transfers are possible through dtc or dmac activation. a/d converter conversion start trigger can be generated ? channels 0? compare-match/input capture signals can be used as a/d converter conversion start triggers.
273 table 12.1 summarizes the mtu functions. table 12.1 mtu functions item channel 0 channel 1 channel 2 channel 3 channel 4 counter clocks internal: f/ 1, f /4, f /16, f /64, f /256, f /1024 external: eight to each channel from tclka, tclkb, tclkc, and tclkd general registers tgr0a tgr0b tgr1a tgr1b tgr2a tgr2b tgr3a tgr3b tgr4a tgr4b general registers/buffer registers tgr0c tgr0d no no tgr3c tgr3d tgr4c tgr4d input/output pins tioc0a tioc0b tioc0c tioc0d tioc1a tioc1b tioc2a tioc2b tioc3a tioc3b tioc3c tioc3d tioc4a tioc4b tioc4c tioc4d counter clear function tgr compare- match or input capture tgr compare- match or input capture tgr compare- match or input capture tgr compare- match or input capture tgr compare- match or input capture compare 0 yes yes yes yes yes match output 1 yes yes yes yes yes toggle yes yes yes yes yes input capture function yes yes yes yes yes synchronization yes yes yes yes yes buffer operation yes no no yes no pwm mode 1 yes yes yes yes yes pwm mode 2 yes yes yes no no phase counting mode no yes yes no no reset-synchronized pwm mode no no no yes yes complementary pwm mode no no no yes yes dmac activation tgr0a com- pare match or input capture tgr1a com- pare match or input capture tgr2a com- pare match or input capture tgr3a com- pare match or input capture tgr4a com- pare match or input capture
274 table 12.1 mtu functions (cont) item channel 0 channel 1 channel 2 channel 3 channel 4 hard dtc activation tgr compare- match or input capture tgr compare- match or input capture tgr compare- match or input capture tgr compare- match or input capture tgr compare- match or input capture and tcnt4 overflow/ underflow a/d conversion start trigger tgr0a com- pare match or input capture tgr1a com- pare match or input capture tgr2a com- pare match or input capture tgr3a com- pare match or input capture tgr4a com- pare match or input capture interrupt sources compare match/input capture 0a compare match/input capture 1a compare match/input capture 2a compare match/input capture 3a compare match/input capture 4a compare match/input capture 0b compare match/input capture 1b compare match/input capture 2b compare match/input capture 3b compare match/input capture 4b compare match/input capture 0c overflow overflow compare match/input capture 3c compare match/input capture 4c compare match/input capture 0d underflow underflow compare match/input capture 3d compare match/input capture 4d overflow overflow overflow/ underflow 12.1.2 block diagram figure 12.1 is the block diagram of the mtu.
275 tcr channel 0 channel 1 channel 2 channel 4 channel 3 shared control logic channels 0? control logic channels 3, 4 control logic tmdr tiorh tiorl tier tsr tcr tmdr tior tier tsr tcr tmdr tior tier tsr tstr tsyr tcr tmdr tior tiorl tier tsr tcr tmdr tiorh tiorl tier tsr toer tocr tgcr tcnt bus i/f tgra tgrd tgrb tgrc tcnts tddr tcdr tcbr tcnt tgra tgrd tgrb tgrc tcnt tgra tgrb tcnt tgra tgrb tcnt tgra tgrd tgrb tgrc (i/o pins) channel 3: tioc3a tioc3b tioc3c tioc3d channel 4: tioc4a tioc4b tioc4c tioc4d (clock input) internal clock: f /1 f /4 f /16 f /64 f /256 f /1024 (i/o pins) channel 0: tioc0a tioc0b tioc0c tioc0d external clock: tclka tclkb tclkc tclkd channel 1: tioc1a tioc1b channel 2: tioc2a tioc2b internal data bus a/d conversion start request signal (interrupt request signals) channel 3: tgi3a tgi3b tgi3c tgi3d tgi3v channel 4: tgi4a tgi4b tgi4c tgi4d tgi4v (interrupt request signal) channel 0: tgi0a tgi0b tgi0c tgi0d tgi0v channel 1: tgi1a tgi1b tgi1v tgi1u channel 2: tgi2a tgi2b tgi2v tgi2u module data bus figure 12.1 mtu block diagram
276 12.1.3 pin configuration table 12.2 summarizes the mtu pins. table 12.2 pin configuration channel name pin name i/o function shared clock input a tclka i clock a input pin (a-phase input pin in channel 1 phase counting mode) clock input b tclkb i clock b input pin (b-phase input pin in channel 1 phase counting mode) clock input c tclkc i clock c input pin (a-phase input pin in channel 2 phase counting mode) clock input d tclkd i clock d input pin (b-phase input pin in channel 2 phase counting mode) 0 input capture/output compare-match 0a tioc0a i/o tgr0a input capture input/output compare output/pwm output pin input capture/output compare-match 0b tioc0b i/o tgr0b input capture input/output compare output/pwm output pin input capture/output compare-match 0c tioc0c i/o tgr0c input capture input/output compare output/pwm output pin input capture/output compare-match 0d tioc0d i/o tgr0d input capture input/output compare output/pwm output pin 1 input capture/output compare-match 1a tioc1a i/o tgr1a input capture input/output compare output/pwm output pin input capture/output compare-match 1b tioc1b i/o tgr1b input capture input/output compare output/pwm output pin 2 input capture/output compare-match 2a tioc2a i/o tgr2a input capture input/output compare output/pwm output pin input capture/output compare-match 2b tioc2b i/o tgr2b input capture input/output compare output/pwm output pin
277 table 12.2 pin configuration (cont) channel name pin name i/o function 3 input capture/output compare-match 3a tioc3a i/o tgr3a input capture input/output compare output/pwm output pin in complementary pwm/reset synchronous pwm mode, 1/2 pwm period toggle output pin input capture/output compare-match 3b tioc3b i/o tgr3b input capture input/output compare output pin in complementary pwm/reset synchronous pwm mode, pwm output/u phase output pin input capture/output compare-match 3c tioc3c i/o tgr3c input capture input/output compare output/pwm output pin in complementary pwm/reset synchronous pwm mode input capture/output compare-match 3d tioc3d i/o tgr3d input capture input/output compare output pin in complementary pwm/reset synchronous pwm mode, pwm output/u phase output pin 4 input capture/output compare-match 4a tioc4a i/o tgr4a input capture input/output compare output/pwm output pin in complementary pwm/reset synchronous pwm mode, pwm output/v phase output pin input capture/output compare-match 4b tioc4b i/o tgr4b input capture input/output compare output pin in complementary pwm/reset synchronous pwm mode, pwm output/w phase output pin input capture/output compare-match 4c tioc4c i/o tgr4c input capture input/output compare output/pwm output pin in complementary pwm/reset synchronous pwm mode, pwm output/v phase output pin input capture/output compare-match 4d tioc4d i/o tgr4d input capture input/output compare output pin in complementary pwm/reset synchronous pwm mode, pwm output/w phase output pin note: the tioc pins output undefined values when they are set to input capture and timer output by the pin function controller (pfc).
278 12.1.4 register configuration table 12.3 summarizes the mtu register configuration. table 12.3 register configuration chan- nel name abbrevi- ation r/w initial value address access size (bits) * 1 shared timer start register tstr r/w h'00 h'ffff8240 8, 16, 32 timer synchro register tsyr r/w h'00 h'ffff8241 0 timer control register 0 tcr0 r/w h'00 h'ffff8260 timer mode register 0 tmdr0 r/w h'c0 h'ffff8261 timer i/o control register 0h tior0h r/w h'00 h'ffff8262 timer i/o control register 0l tior0l r/w h'00 h'ffff8263 timer interrupt enable register 0 tier0 r/w h'40 h'ffff8264 timer status register 0 tsr0 r/(w)* 2 h'c0 h'ffff8265 timer counter 0 tcnt0 r/w h'0000 h'ffff8266 16, 32 general register 0a tgr0a r/w h'ffff h'ffff8268 general register 0b tgr0b r/w h'ffff h'ffff826a general register 0c tgr0c r/w h'ffff h'ffff826c general register 0d tgr0d r/w h'ffff h'ffff826e 1 timer control register 1 tcr1 r/w h'00 h'ffff8280 8, 16, 32 timer mode register 1 tmdr1 r/w h'c0 h'ffff8281 timer i/o control register 1 tior1 r/w h'00 h'ffff8282 timer interrupt enable register 1 tier1 r/w h'40 h'ffff8284 timer status register 1 tsr1 r/(w)* 2 h'c0 h'ffff8285 timer counter 1 tcnt1 r/w h'0000 h'ffff8286 16, 32 general register 1a tgr1a r/w h'ffff h'ffff8288 general register 1b tgr1b r/w h'ffff h'ffff828a
279 table 12.3 register configuration (cont) chan- nel name abbrevi- ation r/w initial value address access size (bits) * 1 2 timer control register 2 tcr2 r/w h'00 h'ffff82a0 8, 16, 32 timer mode register 2 tmdr2 r/w h'c0 h'ffff82a1 timer i/o control register 2 tior2 r/w h'00 h'ffff82a2 timer interrupt enable register 2 tier2 r/w h'40 h'ffff82a4 timer status register 2 tsr2 r/(w)* 2 h'c0 h'ffff82a5 timer counter 2 tcnt2 r/w h'0000 h'ffff82a6 16, 32 general register 2a tgr2a r/w h'ffff h'ffff82a8 general register 2b tgr2b r/w h'ffff h'ffff82aa 3 timer control register 3 tcr3 r/w h'00 h'ffff8200 8, 16, 32* 3 timer mode register 3 tmdr3 r/w h'c0 h'ffff8202 timer i/o control register 3h tior3h r/w h'00 h'ffff8204 timer i/o control register 3l tior3l r/w h'00 h'ffff8205 timer interrupt enable register 3 tier3 r/w h'40 h'ffff8208 timer status register 3 tsr3 r/(w)* 2 h'c0 h'ffff822c 8, 16, 32 timer counter 3 tcnt3 r/w h'0000 h'ffff8210 16, 32* 3 general register 3a tgr3a r/w h'ffff h'ffff8218 general register 3b tgr3b r/w h'ffff h'ffff821a general register 3c tgr3c r/w h'ffff h'ffff8224 16, 32 general register 3d tgr3d r/w h'ffff h'ffff8226 4 timer control register 4 tcr4 r/w h'00 h'ffff8201 8, 16, 32* 3 timer mode register 4 tmdr4 r/w h'c0 h'ffff8203 timer i/o control register 4h tior4h r/w h'00 h'ffff8206 timer i/o control register 4l tior4l r/w h'00 h'ffff8207 timer interrupt enable register 4 tier4 r/w h'40 h'ffff8209 timer status register 4 tsr4 r/(w)* 2 h'c0 h'ffff822d 8, 16, 32
280 table 12.3 register configuration (cont) chan- nel name abbrevi- ation r/w initial value address access size (bits) * 1 4 (cont) timer counter 4 tcnt4 r/w h'0000 h'ffff8212 16, 32* 3 general register 4a tgr4a r/w h'ffff h'ffff821c general register 4b tgr4b r/w h'ffff h'ffff821e general register 4c tgr4c r/w h'ffff h'ffff8228 16, 32 general register 4d tgr4d r/w h'ffff h'ffff822a 3 and 4 timer output master enable register toer r/w h'c0 h'ffff820a 8, 16, 32* 3 timer output control register tocr r/w h'00 h'ffff820b timer gate control register tgcr r/w h'80 h'ffff820d timer cycle data register tcdr r/w h'ffff h'ffff8214 16, 32* 3 timer dead time data register tddr r/w h'ffff h'ffff8216 timer subcounter tcnts r h'0000 h'ffff8220 16, 32 timer cycle buffer register tcbr r/w h'ffff h'ffff8222 notes: 1. 16-bit registers (tcnt, tgr) cannot be read or written in 8-bit units. 2. write 0 to clear flags. 3. if the mturwe bit of bus control register 1 (bcr) in the bus state controller (bsc) is 0 cleared, access becomes impossible (undefined read/write disabled).
281 12.2 mtu register descriptions 12.2.1 timer control register (tcr) the tcr is an 8-bit read/write register for controlling the tcnt counter for each channel. the mtu has five tcr registers, one for each of the channels 0 to 4. tcr is initialized to h'00 by a power-on reset or the standby mode. manual reset does not initialize tcr. channels 0, 3, 4: tcr0, tcr3, tcr4: bit: 7 6 5 4 3 2 1 0 cclr2 cclr1 cclr0 ckeg1 ckeg0 tpsc2 tpsc1 tpsc0 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 channels 1, 2: tcr1, tcr2: bit: 7 6 5 4 3 2 1 0 cclr1 cclr0 ckeg1 ckeg0 tpsc2 tpsc1 tpsc0 initial value: 0 0 0 0 0 0 0 0 r/w: r r/w r/w r/w r/w r/w r/w r/w bits 7??ounter clear 2, 1, 0 (cclr2, cclr1, cclr0): select the counter clear source for the tcnt counter.
282 channels 0, 3, 4: bit 7: cclr2 bit 6: cclr1 bit 5: cclr0 description 0 0 0 tcnt clear disabled (initial value) 1 tcnt is cleared by tgra compare-match or input capture 1 0 tcnt is cleared by tgrb compare-match or input capture 1 synchronizing clear: tcnt is cleared in synchronization with clear of other channel counters operating in sync.* 1 1 0 0 tcnt clear disabled 1 tcnt is cleared by tgrc compare-match or input capture* 2 1 0 tcnt is cleared by tgrd compare-match or input capture* 2 1 synchronizing clear: tcnt is cleared in synchronization with clear of other channel counters operating in sync* 1 notes: 1. setting the sync bit of the tsyr to 1 sets the synchronization. 2. when tgrc or tgrd are functioning as buffer registers, tcnt is not cleared because the buffer registers have priority and compare-match/input captures do not occur. channels 1, 2: bit 7: reserved* 1 bit 6: cclr1 bit 5: cclr0 description 0 0 0 tcnt clear disabled (initial value) 1 tcnt is cleared by tgra compare-match or input capture 1 0 tcnt is cleared by tgrb compare-match or input capture 1 synchronizing clear: tcnt is cleared in synchronization with clear of other channel counters operating in sync* 2 notes: 1. the bit 7 of channels 1 and 2 is reserved. it always reads 0, and cannot be modified. 2. setting the sync bit of the tsyr to 1 sets the synchronization. bits 4??lock edge 1, 0 (ckeg1 and ckeg0): ckeg1 and ckeg0 select the input clock edges. when counting is done on both edges of the internal clock the input clock frequency becomes 1/2 (example: both edges of f/4 = rising edge of f/2 ). when phase count mode is used with channels 1, 2, these settings are ignored, as the phase count mode settings have priority.
283 bit 4: ckeg1 bit 3: ckeg0 description 0 0 count on rising edges (initial value) 1 count on falling edges 1 x count on both rising and falling edges notes: 1. x: 0 or 1, don? care. 2. internal clock edge selection is effective when the input clock is f /4 or slower. when ?1 or the overflow/underflow of another channel is selected for the input clock, although values can be written, counter operation complies with the initial value (count on rising edges). bits 2??imer prescaler 2? (tpsc2?psc0): tpsc2?psc0 select the counter clock source for the tcnt. an independent clock source can be selected for each channel. table 12.4 shows the possible settings for each channel. table 12.4 mtu clock sources internal clock other channel external clock chan- nel f /1 f /4 f / 16 f / 64 f / 256 f / 1024 overflow/ underflow tcl ka tcl kb tcl kc tcl kd 0 ooo o x x x oooo 1 ooooox o ooxx 2 ooo o x o x ooox 3 oooooo x ooxx 4 oooooo x ooxx note: symbols: o: setting possible x: setting not possible channel 0: bit 2: tpsc2 bit 1: tpsc1 bit 0: tpsc0 description 0 0 0 internal clock: count with f /1 (initial value) 1 internal clock: count with f /4 1 0 internal clock: count with f /16 1 internal clock: count with f /64 1 0 0 external clock: count with the tclka pin input 1 external clock: count with the tclkb pin input 1 0 external clock: count with the tclkc pin input 1 external clock: count with the tclkd pin input
284 channel 1: bit 2: tpsc2 bit 1: tpsc1 bit 0: tpsc0 description 0 0 0 internal clock: count with f /1 (initial value) 1 internal clock: count with f /4 1 0 internal clock: count with f /16 1 internal clock: count with f /64 1 0 0 external clock: count with the tclka pin input 1 external clock: count with the tclkb pin input 1 0 internal clock: count with f /256 1 count with the tcnt2 overflow/underflow note: these settings are ineffective when channel 1 is in phase counting mode. channel 2: bit 2: tpsc2 bit 1: tpsc1 bit 0: tpsc0 description 0 0 0 internal clock: count with f /1 (initial value) 1 internal clock: count with f /4 1 0 internal clock: count with f /16 1 internal clock: count with f /64 1 0 0 external clock: count with the tclka pin input 1 external clock: count with the tclkb pin input 1 0 external clock: count with the tclkc pin input 1 internal clock: count with f /1024 note: these settings are ineffective when channel 2 is in phase counting mode.
285 channel 3: bit 2: tpsc2 bit 1: tpsc1 bit 0: tpsc0 description 0 0 0 internal clock: count with f /1 (initial value) 1 internal clock: count with f /4 1 0 internal clock: count with f /16 1 internal clock: count with f /64 1 0 0 internal clock: count with f /256 1 internal clock: count with f /1024 1 0 external clock: count with the tclka pin input 1 external clock: count with the tclkb pin input channel 4: bit 2: tpsc2 bit 1: tpsc1 bit 0: tpsc0 description 0 0 0 internal clock: count with f /1 (initial value) 1 internal clock: count with f /4 1 0 internal clock: count with f /16 1 internal clock: count with f /64 1 0 0 internal clock: count with f /256 1 internal clock: count with f /1024 1 0 external clock: count with the tclka pin input 1 external clock: count with the tclkb pin input
286 12.2.2 timer mode register (tmdr) the tmdr is an 8-bit read/write register that sets the operating mode for each channel. the mtu has five tmdr registers, one for each channel. tmdr is initialized to h'c0 by a power-on reset or the standby mode. manual reset does not initialize tmdr. channels 0, 3, 4: tmdr0, tmdr3, tmdr4: bit: 7 6 5 4 3 2 1 0 bfb bfa md3 md2 md1 md0 initial value: 1 1 0 0 0 0 0 0 r/w: r r r/w r/w r/w r/w r/w r/w channels 1, 2: tmdr1, tmdr2: bit: 7 6 5 4 3 2 1 0 md3 md2 md1 md0 initial value: 1 1 0 0 0 0 0 0 r/w: r r r r r/w r/w r/w r/w bits 7, 6?eserved: these bits are reserved. they always read as 1, and cannot be modified. bit 5?uffer operation b (bfb): designates whether to use the tgrb register for normal operation, or buffer operation in combination with the tgrd register. when using tgrd as a buffer register, no tgrd register input capture/output compares are generated. this bit is reserved in channels 1 and 2, which have no tgrd registers. it is always read as 0, and cannot be modified. bit 5: bfb description 0 tgrb operates normally (initial value) 1 tgrb and tgrd buffer operation
287 bit 4?uffer operation a (bfa): designates whether to use the tgra register for normal operation, or buffer operation in combination with the tgrc register. when using tgrc as a buffer register, no tgrc register input capture/output compares are generated. this bit is reserved in channels 1 and 2, which have no tgrc registers. it is always read as 0, and cannot be modified. bit 4: bfa description 0 tgra operates normally (initial value) 1 tgra and tgrc buffer operation bits 3??odes 3? (md3?d0): these bits set the timer operation mode. bit 3: md3 bit 2: md2 bit 1: md1 bit 0: md0 description 0000 normal operation (initial value) 1 reserved (do not set) 1 0 pwm mode 1 1 pwm mode 2* 1 1 0 0 phase counting mode 1* 2 1 phase counting mode 2* 2 1 0 phase counting mode 3* 2 1 phase counting mode 4* 2 1000 reset synchronous pwm mode* 3 1 reserved (do not set) 1 0 reserved (do not set) 1 reserved (do not set) 1 0 0 reserved (do not set) 1 complementary pwm mode 1 (transmit at peak)* 3 1 0 complementary pwm mode 2 (transmit at valley)* 3 1 complementary pwm mode 3 (transmit at peak and valley) * 3 notes: 1. pwm mode 2 can not be set for channels 3, 4. 2. phase measurement mode can not be set for channels 0, 3, 4. 3. reset synchronous pwm mode, complementary pwm mode can only be set for channel 3. when channel 3 is set to reset synchronous pwm mode or complementary pwm mode, the channel 4 settings become ineffective and automatically conform to the channel 3 settings. however, do not set channel 4 to reset synchronous pwm mode or complementary pwm mode. reset synchronous pwm mode and complementary pwm mode can not be set for channels 0, 1, 2.
288 12.2.3 timer i/o control register (tior) the tior is a register that controls the tgr. the mtu has eight tior registers, two each for channels 0, 3, and 4, and one each for channels 1 and 2. tior is initialized to h'00 by a power-on reset or the standby mode. manual reset does not initialize tior. channels 0, 3, 4: tior0h, tior3h, tior4h channels 1, 2: tior1, tior2: bit: 7 6 5 4 3 2 1 0 iob3 iob2 iob1 iob0 ioa3 ioa2 ioa1 ioa0 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 bits 7??/o control b3?0 (iob3?ob0): these bits set the tgrb register function. bits 3??/o control a3?0 (ioa3?oa0): these bits set the tgra register function. channels 0, 3, 4: tior0l, tior3l, tior4l: bit: 7 6 5 4 3 2 1 0 iod3 iod2 iod1 iod0 ioc3 ioc2 ioc1 ioc0 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 note: when the tgrc or tgrd registers are set for buffer operation, these settings become ineffective and the operation is as a buffer register. bits 7??/o control d3?0 (iod3?od0): these bits set the tgrd register function. bits 3??/o control c3?0 (ioc3?oc0): these bits set the tgrc register function.
289 channel 0 (tior0h register): bits 7??/o control b3?0 (iob3?ob0): these bits set the tgr0b register function. bit 7: iob3 bit 6: iob2 bit 5: iob1 bit 4: iob0 description 0 0 0 0 tgr0b output disabled (initial value) 1 is an initial output 0 on compare-match 1 0 output output output 1 on compare-match 1 compare is 0 toggle output on compare-match 1 0 0 register output disabled 1 initial output 0 on compare-match 1 0 output output 1 on compare-match 1 is 1 toggle output on compare-match 1 0 0 0 tgr0b capture input capture on rising edge 1 is an input source input capture on falling edge 1 0 input is the input capture on both edges 1 capture tioc0b pin 1 0 0 register capture input capture 1 input source on tcnt1 1 0 is channel 1/ count up/count down 1 count clock
290 bits 3??/o control a3?0 (ioa3?oa0): these bits set the tgr0a register function. bit 3: ioa3 bit 2: ioa2 bit 1: ioa1 bit 0: ioa0 description 0 0 0 0 tgr0a output disabled (initial value) 1 is an initial output 0 on compare-match 1 0 output output output 1 on compare-match 1 compare is 0 toggle output on compare-match 1 0 0 register output disabled 1 initial output 0 on compare-match 1 0 output output 1 on compare-match 1 is 1 toggle output on compare-match 1 0 0 0 tgr0a capture input capture on rising edge 1 is an input source input capture on falling edge 1 0 input is the input capture on both edges 1 capture tioc0a pin 1 0 0 register capture input capture 1 input source on tcnt1 1 0 is channel 1/ count up/count down 1 count clock
291 channel 0 (tior0l register): bits 7??/o control d3?0 (iod3?od0): these bits set the tgr0d register function. bit 7: iod3 bit 6: iod2 bit 5: iod1 bit 4: iod0 description 0 0 0 0 tgr0d output disabled (initial value) 1 is an initial output 0 on compare-match 1 0 output output output 1 on compare-match 1 compare is 0 toggle output on compare-match 1 0 0 register output disabled 1 initial output 0 on compare-match 1 0 output output 1 on compare-match 1 is 1 toggle output on compare-match 1 0 0 0 tgr0d capture input capture on rising edge 1 is an input source input capture on falling edge 1 0 input is the input capture on both edges 1 capture tioc0d pin 1 0 0 register capture input capture 1 input source on tcnt1 1 0 is channel 1/ count up/count down 1 count clock note: when the bfb bit of tmdr0 is set to 1 and tgr0d is being used as a buffer register, these settings become ineffective and input capture/output compares do not occur.
292 bits 3??/o control c3?0 (ioc3?oc0): these bits set the tgr0c register function. bit 3: ioc3 bit 2: ioc2 bit 1: ioc1 bit 0: ioc0 description 0 0 0 0 tgr0c output disabled (initial value) 1 is an initial output 0 on compare-match 1 0 output output output 1 on compare-match 1 compare is 0 toggle output on compare-match 1 0 0 register output disabled 1 initial output 0 on compare-match 1 0 output output 1 on compare-match 1 is 1 toggle output on compare-match 1 0 0 0 tgr0c capture input capture on rising edge 1 is an input source input capture on falling edge 1 0 input is the input capture on both edges 1 capture tioc0c pin 1 0 0 register capture input capture 1 input source on tcnt1 1 0 is channel 1/ count up/count down 1 count clock note: when the bfa bit of tmdr0 is set to 1 and tgr0c is being used as a buffer register, these settings become ineffective and input capture/output compares do not occur.
293 channel 1 (tior1 register): bits 7??/o control b3?0 (iob3?ob0): these bits set the tgr1b register function. bit 7: iob3 bit 6: iob2 bit 5: iob1 bit 4: iob0 description 0 0 0 0 tgr1b output disabled (initial value) 1 is an initial output 0 on compare-match 1 0 output output output 1 on compare-match 1 compare is 0 toggle output on compare-match 1 0 0 register output disabled 1 initial output 0 on compare-match 1 0 output output 1 on compare-match 1 is 1 toggle output on compare-match 1 0 0 0 tgr1b capture input capture on rising edge 1 is an input source input capture on falling edge 1 0 input is the input capture on both edges 1 capture tioc1b pin 1 0 0 register capture input input capture 1 source tgr0c on channel tgr0c 1 0 compare/match compare-match/input 1 input capture capture generation
294 bits 3??/o control a3?0 (ioa3?oa0): these bits set the tgr1a register function. bit 3: ioa3 bit 2: ioa2 bit 1: ioa1 bit 0: ioa0 description 0 0 0 0 tgr1a output disabled (initial value) 1 is an initial output 0 on compare-match 1 0 output output output 1 on compare-match 1 compare is 0 toggle output on compare-match 1 0 0 register output disabled 1 initial output 0 on compare-match 1 0 output output 1 on compare-match 1 is 1 toggle output on compare-match 1 0 0 0 tgr1a capture input capture on rising edge 1 is an input source input capture on falling edge 1 0 input is the input capture on both edges 1 capture tioc1a pin 1 0 0 register capture input input capture 1 source is tgr0a on channel 0/tgr0a 1 0 compare- match/input compare-match/input capture generation 1 capture
295 channel 2 (tior2 register): bits 7??/o control b3?0 (iob3?ob0): these bits set the tgr2b register function. bit 7: iob3 bit 6: iob2 bit 5: iob1 bit 4: iob0 description 0 0 0 0 tgr2b output disabled (initial value) 1 is an initial output 0 on compare-match 1 0 output output output 1 on compare-match 1 compare is 0 toggle output on compare-match 1 0 0 register output disabled 1 initial output 0 on compare-match 1 0 output output 1 on compare-match 1 is 1 toggle output on compare-match 1 0 0 0 tgr2b capture input capture on rising edge 1 is an input source input capture on falling edge 1 0 input is the input capture on both edges 1 capture tioc2b pin 1 0 0 register input capture on rising edge 1 input capture on falling edge 1 0 input capture on both edges 1
296 bits 3??/o control a3?0 (ioa3?oa0): these bits set the tgr2a register function. bit 3: ioa3 bit 2: ioa2 bit 1: ioa1 bit 0: ioa0 description 0 0 0 0 tgr2a output disabled (initial value) 1 is an initial output 0 on compare-match 1 0 output output output 1 on compare-match 1 compare is 0 toggle output on compare-match 1 0 0 register output disabled 1 initial output 0 on compare-match 1 0 output output 1 on compare-match 1 is 1 toggle output on compare-match 1 0 0 0 tgr2a capture input capture on rising edge 1 is an input source input capture on falling edge 1 0 input is the input capture on both edges 1 capture tioc2a pin 1 0 0 register input capture on rising edge 1 input capture on falling edge 1 0 input capture on both edges 1
297 channel 3 (tior3h register): bits 7??/o control b3?0 (iob3?ob0): these bits set the tgr3b register function. bit 7: iob3 bit 6: iob2 bit 5: iob1 bit 4: iob0 description 0 0 0 0 tgr3b output disabled (initial value) 1 is an initial output 0 on compare-match 1 0 output output output 1 on compare-match 1 compare is 0 toggle output on compare-match 1 0 0 register output disabled 1 initial output 0 on compare-match 1 0 output output 1 on compare-match 1 is 1 toggle output on compare-match 1 0 0 0 tgr3b capture input capture on rising edge 1 is an input source input capture on falling edge 1 0 input is the input capture on both edges 1 capture tioc3b pin 1 0 0 register input capture on rising edge 1 input capture on falling edge 1 0 input capture on both edges 1
298 bits 3??/o control a3?0 (ioa3?oa0): these bits set the tgr3a register function. bit 3: ioa3 bit 2: ioa2 bit 1: ioa1 bit 0: ioa0 description 0 0 0 0 tgr3a output disabled (initial value) 1 is an initial output 0 on compare-match 1 0 output output output 1 on compare-match 1 compare is 0 toggle output on compare-match 1 0 0 register output disabled 1 initial output 0 on compare-match 1 0 output output 1 on compare-match 1 is 1 toggle output on compare-match 1 0 0 0 tgr3a capture input capture on rising edge 1 is an input source input capture on falling edge 1 0 input is the input capture on both edges 1 capture tioc3a pin 1 0 0 register input capture on rising edge 1 input capture on falling edge 1 0 input capture on both edges 1
299 channel 3 (tior3l register): bits 7??/o control d3?0 (iod3?od0): these bits set the tgr4d register function. bit 7: iod3 bit 6: iod2 bit 5: iod1 bit 4: iod0 description 0 0 0 0 tgr3d output disabled (initial value) 1 is an initial output 0 on compare-match 1 0 output output output 1 on compare-match 1 compare is 0 toggle output on compare-match 1 0 0 register output disabled 1 initial output 0 on compare-match 1 0 output output 1 on compare-match 1 is 1 toggle output on compare-match 1 0 0 0 tgr3d capture input capture on rising edge 1 is an input source input capture on falling edge 1 0 input is the input capture on both edges 1 capture tioc3d pin 1 0 0 register input capture on rising edge 1 input capture on falling edge 1 0 input capture on both edges 1 note: when the bfb bit of tmdr3 is set to 1 and tgr3d is being used as a buffer register, these settings become ineffective and input capture/output compares do not occur.
300 bits 3??/o control c3?0 (ioc3?oc0): these bits set the tgr4c register function. bit 3: ioc3 bit 2: ioc2 bit 1: ioc1 bit 0: ioc0 description 0 0 0 0 tgr3c output disabled (initial value) 1 is an initial output 0 on compare-match 1 0 output output output 1 on compare-match 1 compare is 0 toggle output on compare-match 1 0 0 register output disabled 1 initial output 0 on compare-match 1 0 output output 1 on compare-match 1 is 1 toggle output on compare-match 1 0 0 0 tgr3c capture input capture on rising edge 1 is an input source input capture on falling edge 1 0 input is the input capture on both edges 1 capture tioc3c pin 1 0 0 register input capture on rising edge 1 input capture on falling edge 1 0 input capture on both edges 1 note: when the bfa bit of tmdr3 is set to 1 and tgr3c is being used as a buffer register, these settings become ineffective and input capture/output compares do not occur.
301 channel 4 (tior4h register): bits 7??/o control b3?0 (iob3?ob0): these bits set the tgr4b register function. bit 7: iob3 bit 6: iob2 bit 5: iob1 bit 4: iob0 description 0 0 0 0 tgr4b output disabled (initial value) 1 is an initial output 0 on compare-match 1 0 output output output 1 on compare-match 1 compare is 0 toggle output on compare-match 1 0 0 register output disabled 1 initial output 0 on compare-match 1 0 output output 1 on compare-match 1 is 1 toggle output on compare-match 1 0 0 0 tgr4b capture input capture on rising edge 1 is an input source input capture on falling edge 1 0 input is the input capture on both edges 1 capture tioc4b pin 1 0 0 register input capture on rising edge 1 input capture on falling edge 1 0 input capture on both edges 1
302 bits 3??/o control a3?0 (ioa3?oa0): these bits set the tgr4a register function. bit 3: ioa3 bit 2: ioa2 bit 1: ioa1 bit 0: ioa0 description 0 0 0 0 tgr4a output disabled (initial value) 1 is an initial output 0 on compare-match 1 0 output output output 1 on compare-match 1 compare is 0 toggle output on compare-match 1 0 0 register output disabled 1 initial output 0 on compare-match 1 0 output output 1 on compare-match 1 is 1 toggle output on compare-match 1 0 0 0 tgr4a capture input capture on rising edge 1 is an input source input capture on falling edge 1 0 input is the input capture on both edges 1 capture tioc4a pin 1 0 0 register input capture on rising edge 1 input capture on falling edge 1 0 input capture on both edges 1
303 channel 4 (tior4l register): bits 7??/o control d3?0 (iod3?od0): these bits set the tgr4d register function. bit 7: iod3 bit 6: iod2 bit 5: iod1 bit 4: iod0 description 0 0 0 0 tgr4d output disabled (initial value) 1 is an initial output 0 on compare-match 1 0 output output output 1 on compare-match 1 compare is 0 toggle output on compare-match 1 0 0 register output disabled 1 initial output 0 on compare-match 1 0 output output 1 on compare-match 1 is 1 toggle output on compare-match 1 0 0 0 tgr4d capture input capture on rising edge 1 is an input source input capture on falling edge 1 0 input is the input capture on both edges 1 capture tioc4d pin 1 0 0 register input capture on rising edge 1 input capture on falling edge 1 0 input capture on both edges 1 note: when the bfb bit of tmdr4 is set to 1 and tgr4d is being used as a buffer register, these settings become ineffective and input capture/output compares do not occur.
304 bits 3??/o control c3?0 (ioc3?oc0): these bits set the tgr4c register function. bit 3: ioc3 bit 2: ioc2 bit 1: ioc1 bit 0: ioc0 description 0 0 0 0 tgr4c output disabled (initial value) 1 is an initial output 0 on compare-match 1 0 output output output 1 on compare-match 1 compare is 0 toggle output on compare-match 1 0 0 register output disabled 1 initial output 0 on compare-match 1 0 output output 1 on compare-match 1 is 1 toggle output on compare-match 1 0 0 0 tgr4c capture input capture on rising edge 1 is an input source input capture on falling edge 1 0 input is the input capture on both edges 1 capture tioc4c pin 1 0 0 register input capture on rising edge 1 input capture on falling edge 1 0 input capture on both edges 1 note: when the bfa bit of tmdr4 is set to 1 and tgr4c is being used as a buffer register, these settings become ineffective and input capture/output compares do not occur. 12.2.4 timer interrupt enable register (tier) the tier is an 8-bit register that controls the enable/disable of interrupt requests for each channel. the mtu has five tier registers, one each for channel. tier is initialized to h'40 by a reset or by standby mode. channel 0: tier0: bit: 7 6 5 4 3 2 1 0 ttge tciev tgied tgiec tgieb tgiea initial value: 0 1 0 0 0 0 0 0 r/w: r/w r r r/w r/w r/w r/w r/w
305 channels 1, 2: tier1, tier2: bit: 7 6 5 4 3 2 1 0 ttge tcieu tciev tgieb tgiea initial value: 0 1 0 0 0 0 0 0 r/w: r/w r r/w r/w r r r/w r/w channels 3, 4: tier3, tier4: bit: 7 6 5 4 3 2 1 0 ttge tciev tgied tgiec tgieb tgiea initial value: 0 1 0 0 0 0 0 0 r/w: r/w r r r/w r/w r/w r/w r/w bit 7?/d conversion start request enable (ttge): enables or disables generation of an a/d conversion start request by a tgra register input capture/compare-match. bit 7: ttge description 0 disable a/d conversion start requests (initial value) 1 enable a/d conversion start request generation bit 6?eserved: this bit is reserved. it always reads as 0, and cannot be modified. bit 5?nderflow interrupt enable (tcieu): enables or disables interrupt requests when the underflow flag (tcfu) of the channel 1, 2 timer status register (tsr) is set to 1. this bit is reserved for channels 0, 3, and 4. it always reads as 0. the write value should always be 1. bit 5: tcieu description 0 disable udf interrupt requests (tciu) (initial value) 1 enable udf interrupt requests (tciu) bit 4?verflow interrupt enable (tciev): enables or disables interrupt requests when the overflow flag tcfv of the timer status register (tsr) is set to 1. bit 4: tciev description 0 disable tcfv interrupt requests (tciv) (initial value) 1 enable tcfv interrupt requests (tciv)
306 bit 3?gr interrupt enable d (tgied): enables or disables interrupt tgfd requests when the tgfd bit of the channel 0, 3, 4 tsr register is set to 1. this bit is reserved for channels 1 and 2. it always reads as 1. the write value should always be 1. bit 3: tgied description 0 disable interrupt requests (tgid) due to the tgfd bit (initial value) 1 enable interrupt requests (tgid) due to the tgfd bit bit 2?gr interrupt enable c (tgiec): enables or disables tgfc interrupt requests when the tgfc bit of the channel 0, 3, 4 tsr register is set to 1. this bit is reserved for channels 1 and 2. it always reads as 1. the write value should always be 1. bit 2: tgiec description 0 disable interrupt requests (tgic) due to the tgfc bit (initial value) 1 enable interrupt requests (tgic) due to the tgfc bit bit 1?gr interrupt enable b (tgieb): enables or disables tgfb interrupt requests when the tgfb bit of the tsr register is set to 1. bit 1: tgieb description 0 disable interrupt requests (tgib) due to the tgfb bit (initial value) 1 enable interrupt requests (tgib) due to the tgfb bit bit 0?gr interrupt enable a (tgiea): enables or disables tgfa interrupt requests when the tgfa bit of the tsr register is set to 1. bit 0: tgiea description 0 disable interrupt requests (tgia) due to the tgfa bit (initial value) 1 enable interrupt requests (tgia) due to the tgfa bit
307 12.2.5 timer status register (tsr) the timer status register (tsr) is an 8-bit register that indicates the status of each channel. the mtu has five tsr registers, one each for channel. tsr is initialized to h'c0 by a power-on reset or by standby mode. this register is not initialized by a manual reset. channel 0: tsr0: bit: 7 6 5 4 3 2 1 0 tcfv tgfd tgfc tgfb tgfa initial value: 1 1 0 0 0 0 0 0 r/w: r r r r/(w)* r/(w)* r/(w)* r/(w)* r/(w)* note: only 0 writes to clear the flags are possible. channels 1, 2: tsr1, tsr2: bit: 7 6 5 4 3 2 1 0 tcfd tcfu tcfv tgfb tgfa initial value: 1 1 0 0 0 0 0 0 r/w: r r r/(w)* r/(w)* r r r/(w)* r/(w)* note: only 0 writes to clear the flags are possible. channels 3, 4: tsr3, tsr4: bit: 7 6 5 4 3 2 1 0 tcfd tcfv tgfd tgfc tgfb tgfa initial value: 1 1 0 0 0 0 0 0 r/w: r r r r/(w)* r/(w)* r/(w)* r/(w)* r/(w)* note: only 0 writes to clear the flags are possible. bit 7?ount direction flag (tcfd): this status flag indicates the count direction of the channel 1, 2, 3, 4 tcnt counters. this bit is reserved in channel 0. this bit always reads as 1. the write value should always be 1. bit 7: tcfd description 0 tcnt counts down 1 tcnt counts up (initial value) bit 6?eserved: this bit always reads as 1. the write value should always be 1.
308 bit 5?nderflow flag (tcfu): this status flag indicates the occurrence of a channel 1, 2 tcnt counter underflow. this bit is reserved in channels 0, 3, and 4. this bit always reads as 0. the write value should always be 0. bit 5: tcfu description 0 clear condition: with tcfu=1, a 0 write to tcfu after reading it (initial value) 1 set condition: when the tcnt value underflows (h'0000 ? h'ffff) bit 4?verflow flag (tcfv): this status flag indicates the occurrence of a tcnt counter overflow. bit 4: tcfv description 0 clear condition: with tcfv =1, a 0 write to tcfv after reading it* 1 (initial value) 1 set condition: when the tcnt value overflows (h'ffff ? h'0000)* 2 notes: 1. for channel 4, this flag is cleared by dtc transfer due to tcfv. 2. for channel 4, this flag is also set when the tcnt value underflows (h'0001 ? h'0000) in complementary pwm mode. bit 3?nput capture/output compare flag d (tgfd): this status flag indicates the occurrence of a channel 0, 3, or 4 tgrd register input capture or compare-match. this bit is reserved in channels 1 and 2. it always reads as 0. the write value should always be 0. bit 3: tgfd description 0 clear condition: with tgfd = 1, a 0 write to tgfd following a read (cleared by dtc transfer due to tgfd) (initial value) 1 set conditions: when tgrd is functioning as an output compare register (tcnt = tgrd) when tgrd is functioning as input capture (the tcnt value is sent to tgrd by the input capture signal)
309 bit 2?nput capture/output compare flag c (tgfc): this status flag indicates the occurrence of a channel 0, 3, or 4 tgrc register input capture or compare-match. this bit is reserved for channels 1 and 2. it always reads as 0. the write value should always be 0. bit 2: tgfc description 0 clear condition: with tgfc = 1, a 0 write to tgfc following a read (cleared by dtc transfer due to tgfc) (initial value) 1 set conditions: when tgrc is functioning as an output compare register (tcnt = tgrc) when tgrc is functioning as input capture (the tcnt value is sent to tgrc by the input capture signal) bit 1?nput capture/output compare flag b (tgfb): this status flag indicates the occurrence of a tgrb register input capture or compare-match. bit 1: tgfb description 0 clear condition: with tgfb = 1, a 0 write to tgfb following a read (cleared by dtc transfer due to tgfb) (initial value) 1 set conditions: when tgrb is functioning as an output compare register (tcnt = tgrb) when tgrb is functioning as input capture (the tcnt value is sent to tgrb by the input capture signal) bit 0?nput capture/output compare flag a (tgfa): this status flag indicates the occurrence of a tgra register input capture or compare-match. bit 0: tgfa description 0 clear condition: with tgfa = 1, a 0 write to tgfa following a read (cleared by dmac transfer due to tgfa) (initial value) 1 set conditions: when tgra is functioning as an output compare register (tcnt = tgra) when tgra is functioning as input capture (the tcnt value is sent to tgra by the input capture signal)
310 12.2.6 timer counters (tcnt) the timer counters (tcnt) are 16-bit counters, with one for each channel, for a total of five. the tcnt are initialized to h'0000 by a power-on reset and when in standby mode. manual reset does not initialize tcnt. accessing the tcnt counters in 8-bit units is prohibited. always access in 16-bit units. channel abbreviation function 0 tcnt0 increment counter 1 tcnt1 increment/decrement counter* 1 2 tcnt2 increment/decrement counter* 1 3 tcnt3 increment/decrement counter* 2 4 tcnt4 increment/decrement counter* 2 notes: 1. can only be used as an increment/decrement counter in phase counting mode, with other channel overflow/underflow counting. it becomes an increment counter in all other cases. 2. can only be used as an increment counter in complementary pwm mode. it becomes an increment counter in all other cases. bit: 15 14 13 12 11 10 9 8 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 bit: 7 6 5 4 3 2 1 0 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
311 12.2.7 timer general register (tgr) each timer general register (tgr) is a 16-bit register that can function as either an output compare register or an input capture register. there are a total of sixteen tgr, four each for channels 0, 3, and 4, and two each for channels 1 and 2. the tgrc and tgrd of channels 0, 3, and 4 can be set to operate as buffer registers. the tgr register and buffer register combinations are tgra with tgrc, and tgrb with tgrd. the tgrs are initialized to h'ffff by a power-on reset or in standby mode. manual reset does not initialize tgr. accessing of the tgrs in 8-bit units is disabled; they may only be accessed in 16-bit units. bit: 15 14 13 12 11 10 9 8 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 bit: 7 6 5 4 3 2 1 0 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 12.2.8 timer start register (tstr) the timer start register (tstr) is an 8-bit read/write register that starts and stops the timer counters (tcnt) of channels 0?. tstr is initialized to h'00 upon power-on reset or standby mode. manual reset does not initialize tstr. bit: 7 6 5 4 3 2 1 0 cst4 cst3 cst2 cst1 cst0 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r r r r/w r/w r/w bits 7, 6, 2??ounter start 4? (cst4?st0): select the start and stop of the timer counters (tcnt). the counter start to channel and bit to channel correspondence are indicated in the tables below.
312 counter start channel cst4 channel 4 (tcnt4) cst3 channel 3 (tcnt3) cst2 channel 2 (tcnt2) cst1 channel 1 (tcnt1) cst0 channel 0 (tcnt0) bit n: cstn description 0 tcntn count is halted (initial value) 1 tcntn counts note: n = 4 to 0. however, cst4 is bit 7, cst3 is bit 6. if 0 is written to the cst bit during operation with the tioc pin in output status, the counter stops, but the tioc pin output compare output level is maintained. if a write is done to the tior register while the cst bit is a 0, the pin output level is updated to the established initial output value. in complementary pwm mode or reset sync pwm mode, when a 0 is written to the cst bit of a tioc pin in output mode during operation, it returns to the initial output. bits 5??eserved: these bits always read as 0. the write value should always be 0. 12.2.9 timer synchro register (tsyr) the timer synchro register (tsyr) is an 8-bit read/write register that selects independent or synchronous tcnt counter operation for channels 0?. channels for which 1 is set in the corresponding bit will be synchronized. tsyr is initialized to h'00 upon power-on reset or standby mode. manual reset does not initialize tsyr. bit: 7 6 5 4 3 2 1 0 sync4 sync3 sync2 sync1 sync0 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r r r r/w r/w r/w bits 7, 6, 2??imer synchronization 4? (sync4?ync0): selects operation independent of, or synchronized to, other channels. synchronous operation allows synchronous clears due to multiple tcnt synchronous presets and other channel counter clears. a minimum of two channels must have sync bits set to 1 for synchronous operation. for synchronization clearing, it is necessary to set the tcnt counter clear sources (the cclr2?clr0 bits of the tcr register), in addition to the sync bit. the counter start to channel and bit-to-channel correspondence are indicated in the tables below.
313 counter start channel sync4 channel 4 (tcnt4) sync3 channel 3 (tcnt3) sync2 channel 2 (tcnt2) sync1 channel 1 (tcnt1) sync0 channel 0 (tcnt0) bit n: syncn description 0 timer counter (tcntn) independent operation (initial value) (tcntn preset/clear unrelated to other channels) 1 timer counter synchronous operation* 1 tcntn synchronous preset/ synchronous clear* 2 possible note: 1. minimum of two channel sync bits must be set to 1 for synchronous operation. 2. tcnt counter clear sources (cclr2?clr0 bits of the tcr register) must be set in addition to the sync bit in order to have clear synchronization. 3. n = 4 to 0. however, sync4 is bit 7, sync3 is bit 6. bits 5??eserved: these bits always read as 0. the write value should always be 0. 12.2.10 timer output master enable register (toer) the timer output master enable register (toer) enables/disables output settings for output pins tioc4d, tioc4c, tioc3d, tioc4b, tioc4a and tioc3b. these pins do not output correctly if the toer bits have not been set. set toer of ch3 and ch2 prior to setting tior of ch3 and ch4. the toer is an 8-bit read/write register. the register is initialized to h'c0 by a power-on reset or in standby mode. manual reset does not initialize toer. bit: 7 6 5 4 3 2 1 0 oe4d oe4c oe3d oe4b oe4a oe3b initial value: 1 1 0 0 0 0 0 0 r/w: r r r/w r/w r/w r/w r/w r/w bits 7??eserved: these bits always read as 1. the write value should always be 1.
314 bit 5?aster enable tioc4d (oe4d): enables or disables the tioc4d pin mtu output. bit 5: oe4d description 0 disable tioc4d pin mtu output (initial value) 1 enable tioc4d pin mtu output bit 4?aster enable tioc4c (oe4c): enables or disables the tioc4c pin mtu output. bit 4: oe4c description 0 disable tioc4c pin mtu output (initial value) 1 enable tioc4c pin mtu output bit 3?aster enable tioc3d (oe3d): enables or disables the tioc3d pin mtu output. bit 3: oe3d description 0 disable tioc3d pin mtu output (initial value) 1 enable tioc3d pin mtu output bit 2?aster enable tioc4b (oe4b): enables or disables the tioc4b pin mtu output. bit 2: oe4b description 0 disable tioc4b pin mtu output (initial value) 1 enable tioc4b pin mtu output bit 1?aster enable tioc4a (oe4a): enables or disables the tioc4a pin mtu output. bit 1: oe4a description 0 disable tioc4a pin mtu output (initial value) 1 enable tioc4a pin mtu output bit 0?aster enable tioc3b (oe3b): enables or disables the tioc3b pin mtu output. bit 0: oe3b description 0 disable tioc3b pin mtu output (initial value) 1 enable tioc3b pin mtu output
315 12.2.11 timer output control register (tocr) the timer output control register (tocr) enables/disables pwm synchronized toggle output in complementary pwm mode and reset sync pwm mode, and controls output level inversion of pwm output. the tocr is initialized to h'00 by a power-on reset or in the standby mode. manual reset does not initialize tocr. these register settings are ineffective for anything other than complementary pwm mode/reset-synchronized pwm mode. bit: 7 6 5 4 3 2 1 0 psye olsn olsp initial value: 0 0 0 0 0 0 0 0 r/w: r r/w r r r r r/w r/w bits 7, 5??eserved: these bits always read as 1. the write value should always be 1. bit 6?wm synchronous output enable (psye): selects the enable/disable of toggle output synchronized with the pwm period. bit 6: psye description 0 toggle output synchronous with pwm period disabled (initial value) 1 toggle output synchronous with pwm period enabled bit 1?utput level select n (olsn): selects the reverse phase output level of the complementary pwm mode or reset-synchronized pwm mode. compare match output olsn initial output active level increment count decrement count 0 high level* low level high level low level (initial value) 1 low level* high level low level high level note: the reverse phase waveform initial output value changes to active level after elapse of the dead time after count start. bit 0?utput level select p (olsp): selects the positive phase output level of the complementary pwm mode or reset-synchronized pwm mode. compare match output olsp initial output active level increment count decrement count 0 high level low level low level high level (initial value) 1 low level high level high level low level
316 figure 12.2 shows an example of complementary pwm mode output (1 phase) when olsn = 1, olsp = 1. tcnt3 and tcnt4 values tgr3a tgr4a h'0000 positive phase output reverse phase output tddr tcnt4 tcnt3 time active level initial output initial output compare match output (up count) compare match output (up count) compare match output (down count) compare match output (down count) active level active level figure 12.2 complementary pwm mode output level example 12.2.12 timer gate control register (tgcr) the timer gate control register (tgcr) is an 8-bit read/write register that controls the waveform output necessary for brushless dc motor control in complementary pwm mode/reset- synchronized pwm mode. the tgcr is initialized to h'80 by a power-on reset or in the standby mode. manual reset does not initialize tgcr. these register settings are ineffective for anything other than complementary pwm mode/reset-synchronized pwm mode. bit: 7 6 5 4 3 2 1 0 bdc n p fb wf vf uf initial value: 1 0 0 0 0 0 0 0 r/w: r r/w r/w r/w r/w r/w r/w r/w bit 7?eserved: this bit always reads as 1. the write value should always be 1.
317 bit 6?rushless dc motor (bdc): selects gate signal output/chopping output function for brushless dc motor control. bit 6: bdc description 0 ordinary output (initial value) 1 gate signal/chopping output for brushless dc motor bit 5?everse phase output (n): selects whether to output gate signals directly to the reverse phase pin (tioc3d, tioc4c, and tioc4d) output, or to output by chopping the gate signal and the complementary pwm/reset-synchronized pwm output. bit 5: n description 0 output gate signals directly to reverse phase pin output (initial value) 1 output chopped gate signal and complementary pwm /reset- synchronized pwm output to reverse phase pin output bit 4?ositive phase output (p): selects whether to output gate signals directly to the positive phase pin (tioc3b, tioc4a, and tioc4b) output, or to output by chopping the gate signal and the complementary pwm/reset-synchronized pwm output. bit 4: p description 0 output gate signals directly to positive phase pin output (initial value) 1 output chopped gate signal and complementary pwm /reset- synchronized pwm output to positive phase pin output bit 3?eedback input (fb): selects whether to use external input or register input for the feedback input to generate gate signals. bit 3: fb description 0 feedback input is external input (initial value) (input sources are channel 0 tgra, tgrb, tgrc input capture signals) 1 feedback input is register input (tgcr? uf, vf, wf settings)
318 bits 2??utput phase switch 2? (wf, vf, uf): these bits set the positive phase/negative phase output phase on or off state. the setting of these bits is valid only when the fb bit in this register is set to 1. in this case, the setting of bits 2? is a substitute for external input. function tioc3b tioc4a tioc4b tioc3d tioc4c tioc4d bit 2: wf bit 1: vf bit 0: uf u phase v phase w phase u phase v phase w phase 0 0 0 off off off off off off initial value 1 on off off off off on 1 0 off on off on off off 1 off on off off off on 1 0 0 off off on off on off 1 on off off off on off 1 0 off off on on off off 1 off off off off off off 12.2.13 timer subcounter (tcnts) the timer subcounter (tcnts) is a 16-bit read-only counter that is used only in complementary pwm mode. the tcnts counter is initialized to h'00 by a power-on reset or in standby mode. manual reset does not initialize tcnts. accessing the tcnts counter in 8-bit units is prohibited. always access in 16-bit units. bit: 15 14 13 12 11 10 9 8 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 1 0 initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r r r
319 12.2.14 timer dead time data register (tddr) the timer dead time data register (tddr) is a 16-bit register, used only in complementary pwm mode, that specifies the tcnt3 and tcnt4 counter offset values. in complementary pwm mode, when the tcnt3 and tcnt4 counters are cleared and then restarted, the tddr register value is loaded into the tcnt3 counter and the count operation starts. the tddr register is initialized to h'ffff by a power-on reset or in standby mode. manual reset does not initialize tddr. accessing the tddr in 8-bit units is prohibited. always access in 16-bit units. bit: 15 14 13 12 11 10 9 8 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 bit: 7 6 5 4 3 2 1 0 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 12.2.15 timer period data register (tcdr) the timer period data register (tcdr) is a 16-bit register used only in complementary pwm mode. set the pwm carrier sync value as the tcdr register value. this register is constantly compared with the tcnts counter in complementary pwm mode, and when a match occurs the tcnts counter switches direction (decrement to increment). the tcdr register is initialized to h'ffff by a reset or in standby mode. manual reset does not initialize tcdr. accessing the tcdr in 8-bit units is prohibited. always access in 16-bit units. bit: 15 14 13 12 11 10 9 8 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 bit: 7 6 5 4 3 2 1 0 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
320 12.2.16 timer period buffer register (tcbr) the timer period buffer register (tcbr) is a 16-bit register used only in complementary pwm mode. it functions as a buffer register for the tcdr register. the tcbr register values are transferred to the tcdr register with the transfer timing established in the tmdr register. the tcbr register is initialized to h'ffff by a power-on reset or in standby mode. manual reset does not initialize tcbr. accessing the tcbr in 8-bit units is prohibited. always access in 16-bit units. bit: 15 14 13 12 11 10 9 8 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 bit: 7 6 5 4 3 2 1 0 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 12.3 bus master interface 12.3.1 16-bit registers the timer counters (tcnt) and general registers (tgr) are 16-bit registers. a 16-bit data bus to the bus master enables 16-bit read/writes. 8-bit read/write is not possible. always access in 16-bit units. figure 12.3 shows an example of 16-bit register access operation. tcnth tcntl bus interface upper 8 bits lower 8 bits bus master internal data bus module data bus figure 12.3 16-bit register access operation (bus master ? tcnt (16 bit))
321 12.3.2 8-bit registers all registers other than the tcnt and general registers (tgr) are 8-bit registers. these are connected to the cpu by a 16-bit data bus, so 16-bit read/writes and as 8-bit read/writes are both possible (figures 12.4 ,12.5, and 12.6). tcr bus interface upper 8 bits lower 8 bits bus master internal data bus module data bus figure 12.4 8-bit register access operation (bus master ? tcr (upper 8 bits)) tmdr bus interface upper 8 bits lower 8 bits bus master internal data bus module data bus figure 12.5 8-bit register access operation (bus master ? tmdr (lower 8 bits)) tcr tmdr bus interface upper 8 bits lower 8 bits bus master internal data bus module data bus figure 12.6 8-bit register access operation (bus master ? tcr, tmdr (16 bit))
322 12.4 operation 12.4.1 overview the operation modes are described below. ordinary operation: each channel has a timer counter (tcnt) and general register (tgr). the tcnt is an upcounter and can also operate as a free-running counter, periodic counter or external event counter. general registers (tgr) 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 timer synchronization bits of the tsyr registers of multiple channels set for synchronous operation can be set to clear the tcnts simultaneously. buffer operation: when tgr is an output compare register, the buffer register value of the corresponding channel is transferred to the tgr when a compare-match occurs. when tgr is an input capture register, the tcnt counter value is transferred to the tgr when an input capture occur simultaneously the value previously stored in the tgr is transferred to the buffer register. cascade connection operation : the channel 1 and channel 2 counters (tcnt1 and tcnt2) can be connected together to operate as a 32-bit counter. pwm mode: in pwm mode, a pwm waveform is output. the output level can be set by the tior register. each tgr can be set for pwm waveform output with a duty cycle between 0% and 100%. phase counting mode: in phase counting mode, the phase differential between two clocks input from the channel 1 and channel 2 external clock input pins is detected and the tcnt counter operates as an up/down counter. in phase counting mode, the corresponding tclk pins become clock inputs and tcnt functions as an up/down counter. it can be used as a two-phase encoder pulse input. reset-synchronized pwm mode: three-phase 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, tgr3a, tgr3b, tgr4a, and tgr4b automatically become output compare registers. the tioc3a, tioc3b, tioc4a, tioc4b, tioc4c, and tioc4d pins also become pwm output pins, and tcnt3 and tcnt4 become upcounters. tcnt4, tgr4a, and tgr4b are isolated from tcnt4.
323 complementary pwm mode: three-phase 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, tgr3a, tgr3b, tgr4a, and tgr4b become output compare registers. the tioc3b, tioc3d, tioc4a, tioc4b, tioc4c, and tioc4d pins also automatically become pwm output pins while tcnt3 and tcnt4 become up/down counters. 12.4.2 basic functions always select mtu external pin set function using the pin function controller (pfc). counter operation: when a start bit (cst0?st4) 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. to select the counting operation (figure 12.7): 1. set bits tpsc2?psc0 in the tcr to select the counter clock. at the same time, set bits ckeg1 and ckeg0 in the tcr to select the desired edge of the input clock. 2. to operate as a periodic counter, set the cclr2?clr0 bits in the tcr to select tgr as a clearing source for the tcnt. 3. set the tgr selected in step 2 as an output compare register using the timer i/o control register (tior). 4. write the desired cycle value in the tgr selected in step 2. 5. set the cst bit in the tstr to 1 to start counting.
324 counting mode selection select counter clock periodic counter select counter clear source select output compare register set period start counting start counting free-running counter periodic counter free-running counter 5 5 4 3 2 1 figure 12.7 procedure for selecting the counting operation free-running counter operation example: a reset of the mtu timer counters (tcnt) leaves them all in the free-running mode. when a 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 overflows from h'ffff?'0000, the tcfv bit in the timer status register (tsr) is set to 1. if the tciev bit in the timer? corresponding timer interrupt enable register (tier) is set to 1, the mtu will make an interrupt request to the interrupt controller. after the tcnt overflows, counting continues from h'0000. figure 12.8 shows an example of free-running counter operation. cst bit tcnt value time h'ffff h'0000 tcfv figure 12.8 free-running counter operation
325 periodic counter operation example: periodic counter operation is obtained for a given channel? tcnt by selecting compare-match as a tcnt clear source. set the tgr register for period setting to output compare register and select counter clear upon compare-match using the cclr2?clr0 bits of the timer control register (tcr). after these settings, the tcnt begins incrementing as a periodic counter when the corresponding bit of tstr is set to 1. when the count matches the tgr register value, the tgf bit in the tsr is set to 1 and the counter is cleared to h'0000. if the tgie bit of the corresponding tier is set to 1 at this point, the mtu will make an interrupt request to the interrupt controller. after the compare-match, tcnt continues counting from h'0000. figure 12.9 shows an example of periodic counting. cst bit tcnt value time counter cleared by tgr compare match tgr h'0000 tgf flag cleared by software or dtc/dmac activation figure 12.9 periodic counter operation compare-match waveform output function: the mtu can output 0 level, 1 level, or toggle output from the corresponding output pins upon compare-matches. procedure for selecting the compare-match waveform output operation (figure 12.10): 1. set the tior to select 0 output or 1 output for the initial value, and 0 output, 1 output, or toggle output for compare-match output. the tioc pin will output the set initial value until the first compare-match occurs. 2. set a value in the tgr to select the compare-match timing. 3. set the cst bit in the tstr to 1 to start counting.
326 output selection select waveform output mode select output timing start counting 1 2 3 figure 12.10 procedure for selecting compare match waveform output operation waveform output operation (0 output/1 output): figure 12.11 shows 0 output/1 output. in the example, tcnt is a free-running counter, 1 is output upon compare-match a and 0 is output upon compare-match b. when the pin level matches the set level, the pin level does not change. h'ffff h'0000 tioca tcnt value time tgra tgrb tiocb does not change does not change 1 output does not change does not change 0 output figure 12.11 example of 0 output/1 output waveform output operation (toggle output): figure 12.12 shows the toggle output. in the example, the tcnt operates as a periodic counter cleared by compare-match b, with toggle output at both compare-match a and compare-match b.
327 h'ffff h'0000 tioca tcnt value counter cleared by tgrb compare match time tgrb tgra tiocb toggle output toggle output figure 12.12 example of toggle output input capture function: in the input capture mode, the tcnt value is transferred into the tgr register when the input edge is detected at the input capture/output compare pin (tioc). detection can take place on the rising edge, falling edge, or both edges. channels 0 and 1 can use other channel counter input clocks or compare-match signals as input capture sources. the procedure for selecting the input capture operation (figure 12.13) is: 1. set the tior to select the input capture function of the tgr, then select the input capture source, and rising edge, falling edge, or both edges as the input edge. 2. set the cst bit in the tstr to 1 to start the tcnt counting. input selection select input-capture input start counting input capture operation 1 2 figure 12.13 procedure for selecting input capture operation
328 input capture operation: figure 12.14 shows input capture. the falling edge of tiocb and both edges of tioca are selected as input capture input edges. in the example, tcnt is set to clear at the input capture of the tgrb register. counter cleared by tiocb input (falling edge) tcnt value h'0180 h'0160 h'0005 h'0010 h'0000 tiocb tioca tgra tgrb h'0005 h'0160 h'0010 h'0180 time figure 12.14 input capture operation 12.4.3 synchronous operation 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 number of tgr registers for a single time base. all five channels can be set for synchronous operation.
329 procedure for selecting the synchronizing mode (figure 12.15): 1. set 1 in the sync bit of the timer synchro register (tsyr) to use the corresponding channel 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 output compare/input capture using bits cclr2?clr0 in the tcr. 4. set the counter clear source to synchronized clear using the cclr2?clr0 bits of the tcr. 5. set the cst bits for the corresponding channels in the tstr to 1 to start counting in the tcnt. select counter clear source channel that generated clear source? no yes select synchronizing mode set synchronizing mode synchronized preset set tcnt start counting set counter synchronous clear start counting counter clear synchronized clear synchronized preset synchronized clear 1 2 3 5 4 5 figure 12.15 procedure for selecting synchronizing operation
330 synchronized operation: figure 12.16 shows an example of synchronized operation. channels 0, 1, and 2 are set to synchronized operation and pwm mode 1. channel 0 is set for a counter clear upon compare-match with tgr0b. channels 1 and 2 are set for synchronous counter clears by synchronous presets and tgr0b register compare-matches. accordingly, a three-phase pwm waveform with the data set in the tgr0b register as its pwm period is output from the tioc0a, tioc1a, and tioc2a pins. see section 12.4.6, pwm mode, for details on the pwm mode. tcnt0?cnt2 values time tioc0a synchronized clear on tgr0b compare match tgr0b tgr1b tgr0a tgr2b tgr1a tgr2a h'0000 tioc1a tioc2a figure 12.16 synchronized operation example
331 12.4.4 buffer operation buffer operation is a function of channels 0, 3, and 4. tgrc and tgrd can be used as buffer registers. table 12.5 shows the register combinations for buffer operation. table 12.5 register combinations channel general register buffer register 0 tgr0a tgr0c tgr0b tgr0d 3 tgr3a tgr3c tgr3b tgr3d 4 tgr4a tgr4c tgr4b tgr4d the buffer operation differs, depending on whether the tgr has been set as an input capture register or an output compare register. when tgr is an output compare register: when a compare-match occurs, the corresponding channel buffer register value is transferred to the general register. figure 12.17 shows an example. compare match signal buffer register tcnt comparator general register figure 12.17 compare match buffer operation when tgr is an input capture register: when an input capture occurs, the timer counter (tcnt) value is transferred to the general register (tgr), and the value that had been held up to that time in the tgr is transferred to the buffer register (figure 12.18). input capture signal tcnt buffer register general register figure 12.18 input capture buffer operation
332 procedure for setting buffer mode (figure 12.19): 1. use the timer i/o control register (tior) to set the tgr as either an input capture or output compare register. 2. use the timer mode register (tmdr) bfa, and bfb bits to set the tgr for buffer mode. 3. set the cst bit in the tstr to 1 to start the count operation. 1 2 3 select tgr function buffer mode select buffer mode start counting buffer mode figure 12.19 buffer operation setting procedure buffer operation examples?hen tgr is an output compare register: figure 12.20 shows an example of channel 0 set to pwm mode 1, and the tgra and tgrc registers set for buffer operation. the tcnt counter is cleared by a compare-match b, and the output is a 1 upon compare-match a and 0 output upon compare-match b. because buffer mode is selected, a compare-match a changes the output, and the buffer register tgrc value is simultaneously transferred to the general register tgra. this operation is repeated with each occurrence of a compare-match a. see section 12.4.6, pwm mode, for details on the pwm mode.
333 tgr0b tgr0a h'0000 tgr0c tgr0a tioc0a h'0450 h'0520 h'0200 h'0450 h'0520 h'0200 tcnt value time transfer h'0450 h'0200 figure 12.20 buffer operation example (output compare register) buffer operation examples?hen tgr is an input capture register: figure 12.21 shows an example of tgra set as an input capture register with the tgra and tgrb registers set for buffer operation. the tcnt counter is cleared by a tgra register input capture, and the tioca pin input capture input edge is selected as both rising and falling edge. because buffer mode is selected, an input capture a causes the tcnt counter value to be stored in the tgra register, and the value that was stored in the tgra up until that time is simultaneously transferred to the tgrc register. h'0f07 h'09fb h'0532 h'0000 tgra tgrc tioca h'0532 h'09fb h'0f07 tcnt value time h'0f07 h'0532 figure 12.21 buffer operation example (input capture register)
334 12.4.5 cascade connection mode cascade connection mode is a function that connects the 16-bit counters of two channels together to act as a 32-bit counter. this function operates by using the tpsc2?psc0 bits of the tcr register to set the channel 1 counter clock to count by tcnt2 counter overflow/underflow. note: when channel 1 is set to phase counting mode, the counter clock settings become ineffective. table 12.6 shows the cascade connection combinations. table 12.6 cascade connection combinations combination upper 16 bits lower 16 bits channel 1, channel 2 tcnt1 tcnt2 procedure for setting cascade connection mode (figure 12.22): 1. set the tpsc2?psc 0 bits of the channel 1 timer control register (tcr) to b'111 to select ?ount by tcnt2 overflow/underflow. 2. set the cst bits corresponding to the upper and lower 16 bits in the tstr to 1 to start the count operation. cascade connection operation select cascade connection start counting cascade connection operation 1 2 figure 12.22 procedure for selecting cascade connection mode
335 cascade connection operation examples?hase counting mode: figure 12.23 shows an example of operation when the tcnt1 counter is set to count on tcnt2 overflow/underflow and channel 2 is set to phase counting mode. the tcnt1 counter increments with a tcnt2 counter overflow and decrements with a tcnt2 underflow. tclka tclkb tcnt2 fffd ffff ffff fffe 0000 0001 0001 0000 0002 tcnt1 0000 0000 0001 figure 12.23 cascade connection operation example (phase counting mode) 12.4.6 pwm mode pwm mode outputs the various pwm waveforms from output pins. output levels of 0 output, 1 output, or toggle output can be selected as the output level for the compare-match of each tgr. a period can be set for a register by using the tgr compare-match as a counter clear source. all five channels can be independently set to pwm mode. synchronous operation is also possible. there are two pwm modes: pwm mode 1 generates pwm output using the tgra and tgrb registers, and tgrc and tgrd registers as pairs. the initial output values are those established in the tgra and tgrc registers. when the values set in tgr registers being used as a pair are equal, output values will not change even if a compare-match occurs. a maximum of 8-phase pwm output is possible for pwm mode 1. pwm mode 2 generates pwm output using one tgr register as a period register and another as a duty cycle register. the output value of each pin upon a counter clear is the initial value established by the tior register. when the values set in the period register and duty register are equal, output values will not change even if a compare-match occurs. pwm mode 2 can be set only for channels 0, 1, and 2.
336 table 12.7 lists the combinations of pwm output pins and registers. table 12.7 combinations of pwm output pins and registers output pin channel register pwm mode 1 pwm mode 2 0 (ab pair) tgr0a tgr0b tioc0a tioc 0a tioc 0b 0 (cd pair) tgr0c tgr0d tioc0c tioc 0c tioc 0d 1 tgr1a tgr1b tioc1a tioc 1a tioc 1b 2 tgr2a tgr2b tioc2a tioc 2a tioc 2b 3 (ab pair) tgr3a tgr3b tioc3a setting not possible 3 (cd pair) tgr3c tgr3d tioc3c 4 (ab pair) tgr4a tgr4b tioc4a 4 (cd pair) tgr4c tgr4d tioc4c note: pwm output of the period setting tgr is not possible in pwm mode 2. procedure for selecting the pwm mode (figure 12.24): 1. set bits tpsc2?psc0 in the tcr to select the counter clock source. at the same time, set bits ckeg1 and ckeg0 in the tcr to select the desired edge of the input clock. 2. set bits cclr2?clr0 in the tcr to select the tgr to be used as a counter clear source. 3. set the period in the tgr selected in step 2, and the duty cycle in another tgr. 4. using the timer i/o control register (tior), set the tgr selected in step 3 to act as an output compare register, and select the initial value and output value. 5. set the md3?d 0 bits in tmdr to select the pwm mode. 6. set the cst bit in the tstr to 1 to let the tcnt start counting.
337 1 2 3 4 5 6 pwm mode select counter clock select waveform output level set tgr select pwm mode start counting pwm mode select counter clear source figure 12.24 procedure for selecting the pwm mode pwm mode operation examples?wm mode 1 (figure 12.25): a tgra register compare- match is used as a tcnt counter clear source, the tgra register initial output value and output compare output value are both 0, and the tgrb register output compare output value is a 1. in this example, the value established in the tgra register becomes the period and the value established in the tgrb register becomes the duty cycle. counter cleared by tgra compare match tcnt value tgra tgrb h'0000 tioca time figure 12.25 pwm mode operation example (mode 1)
338 pwm mode operation examples?wm mode 2 (figure 12.26): channels 0 and 1 are set for synchronous operation, tgr1b register compare-match is used as a tcnt counter clear source, the other tgr register initial output value is 0 and output compare output value is 1, and a 5-phase pwm waveform is output. in this example, the value established in the tgr1b register becomes the period and the value established in the other tgr register becomes the duty cycle. tgr0a tgr0b tgr0c tgr0d tgr1a tgr1b tcnt value time h'0000 tioc0a tioc0b tioc0c tioc0d tioc1a counter cleared on tgr1b compare match figure 12.26 pwm mode operation example (mode 2) 0% duty cycle: figure 12.27 shows an example of a 0% duty cycle pwm waveform output in pwm mode. tgra tcnt value tgrb rewrite tgrb tioca time 0% duty cycle tgrb rewrite tgrb rewrite figure 12.27 pwm mode operation example (0% duty cycle)
339 100% duty cycle: figure 12.28 shows an example of a 100% duty cycle pwm waveform output in pwm mode. in pwm mode, when setting cycle = duty cycle the output waveform does not change, nor is there a change of waveform for the first pulse immediately after clearing the counter. tgra tcnt value tgrb rewrite tgrb tioca tioca time time 100% duty cycle output does not change if period register and duty cycle register compare matches occur simultaneously output does not change if period register and duty cycle register compare matches occur simultaneously tgrb rewrite tgrb rewrite tgra tcnt value tgrb rewrite tgrb tgrb rewrite 100% duty cycle 0% duty cycle tgrb rewrite figure 12.28 pwm mode operation example (100% duty cycle) 12.4.7 phase counting mode the phase counting mode detects the phase differential of two external clock inputs and counts the tcnt counter up or down. this mode can be set for channels 1 and 2. when set in the phase counting mode, an external clock is selected for the counter input clock, regardless of the settings of the tpsc2?psc0 bits of tcr or the ckeg1 and ckeg0 bits. tcnt also becomes an up/down counter. since the tcr cclr1/cclr0 bits, tior, tier, and tgr functions are all enabled, input capture and compare-match functions and interrupt sources can be used. when the tcnt counter is incrementing, an overflow sets the tsr register tcfv (overflow flag). when it is decrementing, an underflow sets the tcfu (underflow flag).
340 the tsr register tcfd bit is a count direction flag. read the tcfd flag to confirm whether the tcnt is incrementing or decrementing. table 12.8 shows the correspondence between channels and external clock pins. table 12.8 phase counting mode clock input pins channel a phase input pin b phase input pin 1 tclka tclkb 2 tclkc tclkd procedure for selecting the phase counting mode (figure 12.29): 1. set the md3?d0 bits of the timer mode register (tmdr) to select the phase counting mode. 2. set the cst bit of the timer start register (tstr) to 1 to start the count. phase counting mode select phase counting mode start counting phase counting mode 1 2 figure 12.29 procedure for selecting the phase counting mode phase counting operation examples: the phase counting mode uses the phase difference between two external clocks to increment/decrement the tcnt counter. there are 4 modes, depending on the count conditions. phase counting mode 1: figure 12.30 shows an example of phase counting mode 1 operation. table 12.9 lists the up counting and down counting conditions for the tcnt.
341 tclka (channel 1) tclkc (channel 2) tclkb (channel 1) tclkd (channel 2) tcnt value time increment decrement figure 12.30 phase counting mode 1 operation table 12.9 phase count mode 1 up/down counting conditions tclka (channel 1) tclkc (channel 2) tclkb (channel 1) tclkd (channel 2) operation 1 (high level) rising edge increment 0 (low level) falling edge rising edge 0 (low level) falling edge 1 (high level) 1 (high level) falling edge decrement 0 (low level) rising edge rising edge 1 (high level) falling edge 0 (low level)
342 phase count mode 2: figure 12.31 shows an example of phase counting mode 2 operation. table 12.10 lists the up counting and down counting conditions for the tcnt. tclka (channel 1) tclkc (channel 2) tclkb (channel 1) tclkd (channel 2) tcnt value increment decrement time figure 12.31 phase counting mode 2 operation table 12.10 phase count mode 2 up/down counting conditions tclka (channel 1) tclkc (channel 2) tclkb (channel 1) tclkd (channel 2) operation 1 (high level) rising edge does not count (don? care) 0 (low level) falling edge does not count (don? care) rising edge 0 (low level) does not count (don? care) falling edge 1 (high level) increment 1 (high level) falling edge does not count (don? care) 0 (low level) rising edge does not count (don? care) rising edge 1 (high level) does not count (don? care) falling edge 0 (low level) decrement
343 phase count mode 3: figure 12.32 shows an example of phase counting mode 3 operation. table 12.11 lists the up counting and down counting conditions for the tcnt. increment decrement tclka (channel 1) tclkc (channel 2) tclkb (channel 1) tclkd (channel 2) tcnt value time figure 12.32 phase counting mode 3 operation table 12.11 phase count mode 3 up/down counting conditions tclka (channel 1) tclkc (channel 2) tclkb (channel 1) tclkd (channel 2) operation 1 (high level) rising edge does not count (don? care) 0 (low level) falling edge does not count (don? care) rising edge 0 (low level) does not count (don? care) falling edge 1 (high level) increment 1 (high level) falling edge decrement 0 (low level) rising edge does not count (don? care) rising edge 1 (high level) does not count (don? care) falling edge 0 (low level) does not count (don? care)
344 phase count mode 4: figure 12.33 shows an example of phase counting mode 4 operation. table 12.12 lists the up counting and down counting conditions for the tcnt. increment decrement tclka (channel 1) tclkc (channel 2) tclkb (channel 1) tclkd (channel 2) tcnt value time figure 12.33 phase counting mode 4 operation table 12.12 phase count mode 4 up/down counting conditions tclka (channel 1) tclkc (channel 2) tclkb (channel 1) tclkd (channel 2) operation 1 (high level) rising edge increment 0 (low level) falling edge rising edge 0 (low level) does not count (don? care) falling edge 1 (high level) 1 (high level) falling edge decrement 0 (low level) rising edge rising edge 1 (high level) does not count (don? care) falling edge 0 (low level) phase counting mode application example: figure 12.34 shows an example where channel 1 is set to phase counting mode and is teamed with channel 0 to input a two-phase encoder pulse for a servo motor to accurately detect position and speed. channel 1 is set to phase counting mode 1, and the encoder pulse a phase and b phase are input to the tclka and tclkb pins. channel 0 is set so that the tcnt counter is cleared on a tgr0c register compare-match, and the tgr0a and tgr0c registers are used with the compare-match function to establish the speed control and position control periods. the tgr0b register is used with the input capture function, and the tgr0b and tgr0d registers are employed for buffer operation. the channel 1 counter
345 input clock is used as the tgr0b register input capture source, and a pulse width of four times the 2-phase encoder pulse is detected. the channel 1 tgr1a and tgr1b registers are set for the input capture function, the channel 0 tgr0a and tgr0c register compare-match is used as an input capture source, and all of the control period increment and decrement values are stored. tclka tclkb edge detection circuit tcnt1 tcnt0 tgr1a (speed period capture) tgr0a (speed control period) tgr0c (position control period) tgr0b (pulse width capture) tgr0d (buffer operation) tgr1b (position period capture) channel 0 channel 1 + + figure 12.34 phase count mode application example
346 12.4.8 reset-synchronized pwm mode in the reset-synchronized pwm mode, three-phase output of positive and negative pwm waveforms that share a common wave transition point can be obtained using channels 3 and 4. when set for reset-synchronized pwm mode, the tioc3b, tioc3d, tioc4a, tioc4c, tioc4b, and tioc4d pins become pwm output pins and tcnt3 becomes an upcounter. table 12.13 shows the pwm output pins used. table 12.14 shows the settings of the registers. table 12.13 output pins for reset-synchronized pwm mode channel output pin description 3 tioc3b pwm output 1 tioc3d pwm output 1' (negative-phase waveform of pwm output 1) 4 tioc4a pwm output 2 tioc4c pwm output 2' (negative-phase waveform of pwm output 2) tioc4b pwm output 3 tioc4d pwm output 3' (negative-phase waveform of pwm output 3) table 12.14 register settings for reset-synchronized pwm mode register description of contents tcnt3 initial setting of h'0000 tcnt4 initial setting of h'0000 tgr3a set count cycle for tcnt3 tgr3b sets the turning point for pwm waveform output by the tioc3b and tioc3d pins tgr4a sets the turning point for pwm waveform output by the tioc4a and tioc4c pins tgr4b sets the turning point for pwm waveform output by the tioc4b and tioc4d pins procedure for selecting the reset-synchronized pwm mode (figure 12.35): 1. clear the cst3 and cst4 bits in the tstr to 0 to halt tcnt3 and tcnt4. the reset- synchronized pwm mode must be set up while tcnt3 and tcnt4 are halted. 2. set bits tpsc2?psc0 and ckeg1 and ckeg0 in the tcr to select the counter clock and clock edge for channel 3. 3. set bits cclr2?clr0 in the tcr3 to select tgra compare-match as a counter clear source.
347 4. when performing brushless dc motor control, set bit bdc in the timer gate control register (tgcr) and set the feedback signal input source and output chopping or gate signal direct output. 5. reset tcnt3 and tcnt4 to h'0000. 6. tgr3a is the period register. set the waveform period value in tgr3a. set the transition times of the pwm output waveforms in tgr3b, tgr4a, and tgr4b. set times within the compare-match range of tcnt3. x tgr3a (x: set value). with x = tgra (cycle = duty cycle), the output waveform goes into toggle operation at the point where tcnt3 = tgr3a = x. 7. select enabling/disabling of toggle output synchronized with the pmw cycle using bit psye in the timer output control register (tocr), and set the pwm output level with bits olsp and olsn. 8. set bits md3?d0 in tmdr3 to b'1000 to select the reset-synchronized pwm mode. tioc3b, tioc3d, tioc4a, tioc4b, tioc4c and tioc4d become pwm output pins. 9. set the cst3 bit in the tstr to 1 to start the count operation. 10. set the str3 bit in the tstr to 1 to let the tcnt3 start counting.
348 8 1 2 3 4 5 stop counting select counter clock set tgr select counter clear source reset-synchronized pwm mode brushless dc motor control setting set tcnt 6 enable pwm output set reset-synchronized pwm mode 7 pwm cycle output enabling, pwm output level setting 9 start count operation 10 reset-synchronized pwm mode figure 12.35 procedure for selecting the reset-synchronized pwm mode
349 reset-synchronized pwm mode operation: figure 12.36 shows an example of operation in the reset-synchronized pwm mode. tcnt3 and tcnt4 operate as upcounters. the counter is cleared when a tcnt3 and tgr3a compare-match occurs, and then begins incrementing from h'0000. the pwm output pin output toggles with each occurrence of a tgr3b, tgr4a, tgr4b compare-match, and upon counter clears. tgr3a tgr3b tgr4b h'0000 tgr4a tioc3b tioc3d tioc4a tioc4c tioc4b tioc4d time tcnt3 and tcnt4 values figure 12.36 reset-synchronized pwm mode operation example (when the tocr? olsn = 1 and olsp = 1)
350 12.4.9 complementary pwm mode in the complementary pwm mode, three-phase output of non-overlapping positive and negative pwm waveforms can be obtained using channels 3 and 4. in complementary pwm mode, tioc3b, tioc3d, tioc4a, tioc4b, tioc4c, and tioc4d pins become pwm output pins, the tioc3a pin can be set for toggle output synchronized with the pwm period. tcnt3 and tcnt4 function as increment/decrement counters. table 12.15 shows the pwm output pins used. table 12.16 shows the settings of the registers. a function to directly cut off the pwm output by using an external signal is supported as a port function. table 12.15 output pins for complementary pwm mode channel output pin description 3 tioc3a toggle output synchronized with pwm period (or i/o port) tioc3b pwm output 1 tioc3c i/o port (avoid setting this pin as a timer i/o pin in the complementary pwm mode.) tioc3d pwm output 1 (non-overlapping negative-phase waveform of pwm output 1) 4 tioc4a pwm output 2 tioc4b pwm output 3 tioc4c pwm output 2 (non-overlapping negative-phase waveform of pwm output 2) tioc4d pwm output 3 (non-overlapping negative-phase waveform of pwm output 3)
351 table 12.16 register settings for complementary pwm mode channel counter/register description read/write from cpu 3 tcnt3 start of up-count from value set in dead time register maskable by bsc/bcr1 setting* tgr3a set tcnt3 upper limit value (1/2 carrier cycle + dead time) maskable by bsc/bcr1 setting* tgr3b pwm output 1 compare register maskable by bsc/bcr1 setting* tgr3c tgr3a buffer register always readable/writable tgr3d pwm output 1/tgr3b buffer register always readable/writable 4 tcnt4 up-count start, initialized to h'0000 maskable by bsc/bcr1 setting* tgr4a pwm output 2 compare register maskable by bsc/bcr1 setting* tgr4b pwm output 3 compare register maskable by bsc/bcr1 setting* tgr4c pwm output 2/tgr4a buffer register always readable/writable tgr4d pwm output 3/tgr4b buffer register always readable/writable timer dead time data register (tddr) set tcnt4 and tcnt3 offset value (dead time value) maskable by bsc/bcr1 setting* timer cycle data register (tcdr) set tcnt4 upper limit value (1/2 carrier cycle) maskable by bsc/bcr1 setting* timer cycle buffer register (tcbr) tcdr buffer register always readable/writable subcounter (tcnts) subcounter for dead time generation read-only temporary register 1 (temp1) pwm output 1/tgr3b temporary register not readable/writable temporary register 2 (temp2) pwm output 2/tgr4a temporary register not readable/writable temporary register 3 (temp3) pwm output 3/tgr4b temporary register not readable/writable note: access can be enabled or disabled according to the setting of bit 13 (mturwe) in bsc/bcr1 (bus controller/bus control register 1).
352    @ a b c ? ? ? ? a ?    @ a b c ? ? ? ? a ?    @ a b c ? ? ? ? a ?    @ a b c ? ? ? ? a ?    @ a b c ? ? ? ? a ?    @ a b c ? ? ? ? a ?    @ a b c ? ? ? ? a ?    @ a b c ? ? ? ? a ?    @ a b c ? ? ? ? a ?    @ a b c ? ? ? ? a ?    @ a b c ? ? ? ? a ?       @@ a bb c ?? ? ?? ? aa ?    @@ a bb c ?? ? ?? ? aa ?    @@ a bb c ?? ? ?? ? aa ?    @@ a bb c ?? ? ?? ? aa ?    @@ a bb c ?? ? ?? ? aa ?    @@ a bb c ?? ? ?? ? aa ?    @@ a bb c ?? ? ?? ? aa ?    @@ a bb c ?? ? ?? ? aa ?    @@ a bb c ?? ? ?? ? aa ?    @@ a bb c ?? ? ?? ? aa ?    @@ a bb c ?? ? ?? ? aa ?       @ aa b cc ? ?? ? ?? a ??    @ aa b cc ? ?? ? ?? a ??    @ aa b cc ? ?? ? ?? a ??    @ aa b cc ? ?? ? ?? a ??    @ aa b cc ? ?? ? ?? a ??    @ aa b cc ? ?? ? ?? a ??    @ aa b cc ? ?? ? ?? a ??    @ aa b cc ? ?? ? ?? a ??    @ aa b cc ? ?? ? ?? a ??    @ aa b cc ? ?? ? ?? a ??    @ aa b cc ? ?? ? ?? a ??     @@ a ?? ?  @@ a ?? ?  @@ a ?? ?  @@ a ?? ?  @@ a ?? ?  @@ a ?? ?  @@ a ?? ?  @@ a ?? ?  @@ a ?? ?  @@ a ?? ?  @@ a ?? ?   @ aa ? ??  @ aa ? ??  @ aa ? ??  @ aa ? ??  @ aa ? ??  @ aa ? ??  @ aa ? ??  @ aa ? ??  @ aa ? ??  @ aa ? ??  @ aa ? ??      @ @ a a b c ? ? ? ? ? ? a ?     @ @ a a b c ? ? ? ? ? ? a ?     @ @ a a b c ? ? ? ? ? ? a ?     @ @ a a b c ? ? ? ? ? ? a ?     @ @ a a b c ? ? ? ? ? ? a ?     @ @ a a b c ? ? ? ? ? ? a ?     @ @ a a b c ? ? ? ? ? ? a ?     @ @ a a b c ? ? ? ? ? ? a ?     @ @ a a b c ? ? ? ? ? ? a ?     @ @ a a b c ? ? ? ? ? ? a ?     @ @ a a b c ? ? ? ? ? ? a ?        a a c ? ? ? ?    a a c ? ? ? ?    a a c ? ? ? ?    a a c ? ? ? ?    a a c ? ? ? ?    a a c ? ? ? ?    a a c ? ? ? ?    a a c ? ? ? ?    a a c ? ? ? ?    a a c ? ? ? ?    a a c ? ? ? ?        @ @ a a b c ? ? ? ? ? ? a ?     @ @ a a b c ? ? ? ? ? ? a ?     @ @ a a b c ? ? ? ? ? ? a ?     @ @ a a b c ? ? ? ? ? ? a ?     @ @ a a b c ? ? ? ? ? ? a ?     @ @ a a b c ? ? ? ? ? ? a ?     @ @ a a b c ? ? ? ? ? ? a ?     @ @ a a b c ? ? ? ? ? ? a ?     @ @ a a b c ? ? ? ? ? ? a ?     @ @ a a b c ? ? ? ? ? ? a ?     @ @ a a b c ? ? ? ? ? ? a ?        @ a b c ? ? ? ? a ?    @ a b c ? ? ? ? a ?    @ a b c ? ? ? ? a ?    @ a b c ? ? ? ? a ?    @ a b c ? ? ? ? a ?    @ a b c ? ? ? ? a ?    @ a b c ? ? ? ? a ?    @ a b c ? ? ? ? a ?    @ a b c ? ? ? ? a ?    @ a b c ? ? ? ? a ?    @ a b c ? ? ? ? a ?    tgr3c tddr tcnt3 tgr3d tgr4d tgr4c tgr3b temp 1 tgr4a temp 2 tgr4b temp 3 tcnts tcnt4 tgr3a tcdr tcbr comparator comparator match signal match signal output controller output protection circuit pwm cycle output pwm output 1 pwm output 2 pwm output 3 pwm output 4 pwm output 5 pwm output 6 poe0 poe1 poe2 poe3 external cutoff input external cutoff interrupt : registers that can always be read or written from the cpu : registers that cannot be read or written from the cpu (except for tcnts, which can only be read) : registers that can be read or written from the cpu (but for which access disabling can be set by the bus controller) tgr3a compare- match interrupt tcnt4 underflow interrupt figure 12.37 block diagram of channels 3 and 4 in complementary pwm mode
353 example of complementary pwm mode setting procedure: an example of the complementary pwm mode setting procedure is shown in figure 12.38. 1. clear bits cst3 and cst4 in the timer start register (tstr) to 0, and halt timer counter (tcnt) operation. perform complementary pwm mode setting when tcnt3 and tcnt4 are stopped. 2. set the same counter clock and clock edge for channels 3 and 4 with bits tpsc2?psc0 and bits ckeg1 and ckeg0 in the timer control register (tcr). use bits cclr2?clr0 to set synchronous clearing only when restarting by a synchronous clear from another channel during complementary pwm mode operation. 3. when performing brushless dc motor control, set bit bdc in the timer gate control register (tgcr) and set the feedback signal input source and output chopping or gate signal direct output. 4. set the dead time in tcnt3. set tcnt4 to h'0000. 5. set only when restarting by a synchronous clear from another channel during complementary pwm mode operation. in this case, synchronize the channel generating the synchronous clear with channels 3 and 4 using the timer synchro register (tsyr). 6. set the output pwm duty in the duty registers (tgr3b, tgr4a, tgr4b) and buffer registers (tgr3d, tgr4c, tgr4d). set the same initial value in each corresponding tgr. 7. set the dead time in the dead time register (tddr), 1/2 the carrier cycle in the carrier cycle data register (tcdr) and carrier cycle buffer register (tcbr), and 1/2 the carrier cycle plus the dead time in tgr3a and tgr3c. 8. select enabling/disabling of toggle output synchronized with the pwm cycle using bit psye in the timer output control register (tocr), and set the pwm output level with bits olsp and olsn. 9. select complementary pwm mode in timer mode register 3 (tmdr3). pins tioc3a, tioc3b, tioc3d, tioc4a, tioc4b, tioc4c, and tioc4d function as output pins. do not set in tmdr4. 10. set enabling/disabling of pwm waveform output pin output in the timer output master enable register (toer). 11. set bits cst3 and cst4 in tstr to 1 simultaneously to start the count operation.
354 complementary pwm mode stop count operation counter clock, counter clear source selection brushless dc motor control setting tcnt setting inter-channel cycle setting tgr setting dead time, carrier cycle setting pwm cycle output enabling, pwm output level setting complementary pwm mode setting 3 enable waveform output start count operation 2 4 5 6 7 8 9 10 11 1 figure 12.38 example of complementary pwm mode setting procedure
355 outline of complementary pwm mode operation: in complementary pwm mode, 6-phase pwm output is possible. figure 12.39 illustrates counter operation in complementary pwm mode, and figure 12.40 shows an example of complementary pwm mode operation. counter operation in complementary pwm mode, three counters?cnt3, tcnt4, and tcnts?erform up/down-count operations. tcnt3 is automatically initialized to the value set in tddr when complementary pwm mode is selected and the cst bit in tstr is 0. when the cst bit is set to 1, tcnt3 counts up to the value set in tgr3a, then switches to down-counting when it matches tgr3a,. when the tcnt3 value matches tddr, the counter switches to up-counting, and the operation is repeated in this way. tcnt4 is initialized to h'0000. when the cst bit is set to 1, tcnt4 counts up in synchronization with tcnt3, and switches to down-counting when it matches tcdr . on reaching h'0000, tcnt4 switches to up- counting, and the operation is repeated in this way. tcnts is a read-only counter. it need not be initialized. when tcnt3 matches tcdr during tcnt3 and tcnt4 up/down-counting, down-counting is started, and when tcnts matches tcdr, the operation switches to up-counting. when tcnts matches tgr3a, it is cleared to h'0000. when tcnt4 matches tddr during tcnt3 and tcnt4 down-counting, up-counting is started, and when tcnts matches tddr, the operation switches to down-counting. when tcnts reaches h'0000, it is set with the value in tgr3a. tcnts is compared with the compare register and temporary register in which the pwm duty is set during the count operation only. counter value tgr3a tcdr tddr h'0000 tcnt4 tcnts tcnt3 tcnt3 tcnt4 tcnts time figure 12.39 complementary pwm mode counter operation
356 register operation in complementary pwm mode, nine registers are used, comprising compare registers, buffer registers, and temporary registers. figure 12.40 shows an example of complementary pwm mode operation. the registers which are constantly compared with the counters to perform pwm output are tgr3b, tgr4a, and tgr4b. when these registers match the counter, the value set in bits olsn and olsp in the timer output control register (tocr) is output. the buffer registers for these compare registers are tgr3d, tgr4c, and tgr4d. between a buffer register and compare register there is a temporary register. the temporary registers cannot be accessed by the cpu. data in a compare register is changed by writing the new data to the corresponding buffer register. the buffer registers can be read or written at any time. the data written to a buffer register is constantly transferred to the temporary register in the ta interval. data is not transferred to the temporary register in the tb interval. data written to a buffer register in this interval is transferred to the temporary register at the end of the tb interval. the value transferred to a temporary register is transferred to the compare register when tcnts for which the tb interval ends matches tgr3a when counting up, or h'0000 when counting down. the timing for transfer from the temporary register to the compare register can be selected with bits md3?d0 in the timer mode register (tmdr). figure 12.40 shows an example in which the mode is selected in which the change is made in the trough. in the tb interval (tb2 in figure 12.40) in which data transfer to the temporary register is not performed, the temporary register has the same function as the compare register, and is compared with the counter. in this interval, therefore, there are two compare registers for one- phase output, with the compare register containing the pre-change data, and the temporary register containing the new data. in this interval, the three counters?cnt3, tcnt4, and tcnts?nd two registers?ompare register and temporary register?re compared, and pwm output controlled accordingly.
357 tgr3a tcdr tgr4a tgr4c tddr h'0000 buffer register tgr4c temporary register temp2 compare register tgr4a output waveform output waveform tb2 ta tb1 ta tb2 ta tcnt3 tcnt4 tcnts (output waveform is active-low) h'6400 h'0080 h'6400 h'6400 h'0080 h'0080 transfer from temporary register to compare register transfer from temporary register to compare register figure 12.40 example of complementary pwm mode operation
358 initialization in complementary pwm mode, there are six registers that must be initialized. before setting complementary pwm mode with bits md3?d0 in the timer mode register (tmdr), the following initial register values must be set. tgr3c operates as the buffer register for tgr3a, and should be set with 1/2 the pwm carrier cycle + dead time td. the timer cycle buffer register (tcbr) operates as the buffer register for the timer cycle data register (tcdr), and should be set with 1/2 the pwm carrier cycle. set dead time td in the timer dead time data register (tddr). set the respective initial pwm duty values in buffer registers tgr3d, tgr4c, and tgr4d. the values set in the five buffer registers excluding tddr are transferred simultaneously to the corresponding compare registers when complementary pwm mode is set. set tcnt4 to h'0000 before setting complementary pwm mode. table 12.17 registers and counters requiring initialization register/counter set value tgr3c 1/2 pwm carrier cycle + dead time td tddr dead time td tcbr 1/2 pwm carrier cycle tgr3d, tgr4c, tgr4d initial pwm duty value for each phase tcnt4 h'0000 note: the tgr3c set value must be the sum of 1/2 the pwm carrier cycle set in tcbr and dead time td set in tddr. pwm output level setting in complementary pwm mode, the pwm pulse output level is set with bits olsn and olsp in the timer output control register (tocr). the output level can be set for each of the three positive phases and three negative phases of 6- phase output. complementary pwm mode should be cleared before setting or changing output levels. dead time setting in complementary pwm mode, pwm pulses are output with a non-overlapping relationship between the positive and negative phases. this non-overlap time is called the dead time. the non-overlap time is set in the timer dead time data register (tddr). the value set in tddr is used as the tcnt3 counter start value, and creates non-overlap between tcnt3 and tcnt4. complementary pwm mode should be cleared before changing the contents of tddr.
359 pwm cycle setting in complementary pwm mode, the pwm pulse cycle is set in two registers?gr3a, in which the tcnt3 upper limit value is set, and tcdr, in which the tcnt4 upper limit value is set. the settings should be made so as to achieve the following relationship between these two registers: tgr3a set value = tcdr set value + tddr set value the tgr3a and tcdr settings are made by setting the values in buffer registers tgr3c and tcbr. the values set in tgr3c and tcbr are transferred simultaneously to tgr3a and tcdr in accordance with the transfer timing selected with bits md3?d0 in the timer mode register (tmdr). the updated pwm cycle is reflected from the next cycle when the data update is performed at the crest, and from the current cycle when performed in the trough. figure 12.41 illustrates the operation when the pwm cycle is updated at the crest. see the following section, register data updating, for the method of updating the data in each buffer register. counter value tgr3c update tgr3a update tgr3a tcnt3 tcnt4 time figure 12.41 example of pwm cycle updating
360 register data updating in complementary pwm mode, the buffer register is used to update the data in a compare register. the update data can be written to the buffer register at any time. there are five pwm duty and carrier cycle registers that have buffer registers and can be updated during operation. there is a temporary register between each of these registers and its buffer register. when subcounter tcnts is not counting, if buffer register data is updated, the temporary register value is also rewritten. transfer is not performed from buffer registers to temporary registers when tcnts is counting; in this case, the value written to a buffer register is transferred after tcnts halts. the temporary register value is transferred to the compare register at the data update timing set with bits md3?d0 in the timer mode register (tmdr). figure 12.42 shows an example of data updating in complementary pwm mode. this example shows the mode in which data updating is performed at both the counter crest and trough. when rewriting buffer register data, a write to tgr4d must be performed at the end of the update. data transfer from the buffer registers to the temporary registers is performed simultaneously for all five registers after the write to tgr4d. a write to tgr4d must be performed after writing data to the registers to be updated, even when not updating all five registers, or when updating the tgr4d data. in this case, the data written to tgr4d should be the same as the data prior to the write operation.
361 data update timing: counter crest and trough transfer from temporary register to compare register transfer from temporary register to compare register transfer from temporary register to compare register transfer from temporary register to compare register transfer from temporary register to compare register transfer from temporary register to compare register counter value tgr3a tgr4c tgr4a h'0000 br data1 data2 data3 data4 data5 data6 data1 data1 data2 data3 data4 data6 data2 data3 data4 data5 data6 temp_r gr time : compare register : buffer register figure 12.42 example of data update in complementary pwm mode initial output in complementary pwm mode
362 in complementary pwm mode, the initial output is determined by the setting of bits olsn and olsp in the timer output control register (tocr). this initial output is the pwm pulse non-active level, and is output from when complementary pwm mode is set with the timer mode register (tmdr) until tcnt4 exceeds the value set in the dead time register (tddr). figure 12.43 shows an example of the initial output in complementary pwm mode. an example of the waveform when the initial pwm duty value is smaller than the tddr value is shown in figure 12.44. timer output control register settings olsn bit: 0 (initial output: high; active level: low) olsp bit: 0 (initial output: high; active level: low) tcnt3, 4 value tgr4a tddr tcnt3 tcnt4 initial output dead time time active level active level tcnt3, 4 count start (tstr setting) complementary pwm mode (tmdr setting) positive phase output negative phase output figure 12.43 example of initial output in complementary pwm mode (1)
363 timer output control register settings olsn bit: 0 (initial output: high; active level: low) olsp bit: 0 (initial output: high; active level: low) tcnt3, 4 value tgr4a tddr tcnt3 tcnt4 initial output time active level tcnt3, 4 count start (tstr setting) complementary pwm mode (tmdr setting) positive phase output negative phase output figure 12.44 example of initial output in complementary pwm mode (2)
364 complementary pwm mode pwm output generation method in complementary pwm mode, 3-phase output is performed of pwm waveforms with a non- overlap time between the positive and negative phases. this non-overlap time is called the dead time. a pwm waveform is generated by output of the output level selected in the timer output control register in the event of a compare-match between a counter and data register. while tcnts is counting, data register and temporary register values are simultaneously compared to create consecutive pwm pulses from 0 to 100%. the relative timing of on and off compare- match occurrence may vary, but the compare-match that turns off each phase takes precedence to secure the dead time and ensure that the positive phase and negative phase on times do not overlap. figures 12.45 to 12.47 show examples of waveform generation in complementary pwm mode. the positive phase/negative phase off timing is generated by a compare-match with the solid- line counter, and the on timing by a compare-match with the dotted-line counter operating with a delay of the dead time behind the solid-line counter. in the t1 period, compare-match a that turns off the negative phase has the highest priority, and compare-matches occurring prior to a are ignored. in the t2 period, compare-match c that turns off the positive phase has the highest priority, and compare-matches occurring prior to c are ignored. in normal cases, compare-matches occur in the order a ? b ? c ? d (or c ? d ? a' ? b' ), as shown in figure 12.45. if compare-matches deviate from the a ? b ? c ? d order, since the time for which the negative phase is off is less than twice the dead time, the figure shows the positive phase as not being turned on. if compare-matches deviate from the c ? d ? a' ? b' order, since the time for which the positive phase is off is less than twice the dead time, the figure shows the negative phase as not being turned on. if compare-match c occurs first following compare-match a , as shown in figure 12.46, compare-match b is ignored, and the negative phase is turned off by compare-match d . this is because turning off of the positive phase has priority due to the occurrence of compare-match c (positive phase off timing) before compare-match b (positive phase on timing) (consequently, the waveform does not change since the positive phase goes from off to off). similarly, in the example in figure 12.47, compare-match a' with the new data in the temporary register occurs before compare-match c , but other compare-matches occurring up to c , which turns of the positive phase, are ignored. as a result, the positive phase is not turned on. thus, in complementary pwm mode, compare-matches at turn-off timings take precedence, and turn-on timing compare-matches that occur before a turn-off timing compare-match are ignored.
365 t2 period t1 period t1 period ab c a' b' d tgr3a tcdr tddr h'0000 positive phase negative phase figure 12.45 example of complementary pwm mode waveform output (1) t2 period t1 period t1 period tgr3a tcdr tddr h'0000 positive phase negative phase c d a a b b figure 12.46 example of complementary pwm mode waveform output (2)
366 ab c a' b' d t1 period t2 period t1 period tgr3a tcdr tddr h'0000 positive phase negative phase figure 12.47 example of complementary pwm mode waveform output (3) a b c d a' b' t2 period t1 period t1 period tgr3a tcdr tddr h'0000 positive phase negative phase figure 12.48 example of complementary pwm mode 0% and 100%?aveform?utput?1)
367 t2 period t1 period t1 period tgr3a tcdr tddr h'0000 positive phase negative phase a c d a b b figure 12.49 example of complementary pwm mode 0% and 100%?aveform?utput?2) t2 period t1 period t1 period a b c d tgr3a tcdr tddr h'0000 positive phase negative phase figure 12.50 example of complementary pwm mode 0% and 100%?aveform?utput?3)
368 tgr3a tcdr tddr h'0000 positive phase negative phase t2 period t1 period t1 period a b c b' d a' figure 12.51 example of complementary pwm mode 0% and 100%?aveform?utput?4) cadb t2 period t1 period t1 period tgr3a tcdr tddr h'0000 positive phase negative phase figure 12.52 example of complementary pwm mode 0% and 100%?aveform?utput?5)
369 complementary pwm mode 0% and 100% duty output in complementary pwm mode, 0% and 100% duty cycles can be output as required. figures 12.48 to 12.52 show output examples. 100% duty output is performed when the data register value is set to h'0000. the waveform in this case has a positive phase with a 100% on-state. 0% duty output is performed when the data register value is set to the same value as tgr3a. the waveform in this case has a positive phase with a 100% off-state. on and off compare-matches occur simultaneously, but if a turn-on compare-match and turn- off compare-match for the same phase occur simultaneously, both compare-matches are ignored and the waveform does not change. toggle output synchronized with pwm cycle in complementary pwm mode, toggle output can be performed in synchronization with the pwm carrier cycle by setting the psye bit to 1 in the timer output control register (tocr). an example of a toggle output waveform is shown in figure 12.53. this output is toggled by a compare-match between tcnt3 and tgr3a and a compare-match between tcnt4 and h'0000. the output pin for this toggle output is the tioc3a pin. the initial output is 1. tgr3a h'0000 toggle output tioc3a pin tcnt4 tcnt3 figure 12.53 example of toggle output waveform synchronized with pwm output
370 counter clearing by another channel in complementary pwm mode, by setting a mode for synchronization with another channel by means of the timer synchro register (tsyr), and selecting synchronous clearing with bits cclr2?clr0 in the timer control register (tcr), it is possible to have tcnt3, tcnt4, and tcnts cleared by another channel. figure 12.54 illustrates the operation. use of this function enables counter clearing and restarting to be performed by means of an external signal. tgr3a tcdr tddr h'0000 channel 1 input capture a tcnt1 tcnt3 tcnt4 tcnts synchronous counter clearing by channel 1 input capture a figure 12.54 counter clearing synchronized with another channel
371 example of ac synchronous motor (brushless dc motor) drive waveform output in complementary pwm mode, a brushless dc motor can easily be controlled using the timer gate control register (tgcr). figures 12.55 to 12.58 show examples of brushless dc motor drive waveforms created using tgcr. when output phase switching for a 3-phase brushless dc motor is performed by means of external signals detected with a hall element, etc., clear the fb bit in tgcr to 0. in this case, the external signals indicating the polarity position are input to channel 0 timer input pins tioc0a, tioc0b, and tioc0c (set with pfc). when an edge is detected at pin tioc0a, tioc0b, or tioc0c, the output on/off state is switched automatically. when the fb bit is 1, the output on/off state is switched when the uf, vf, or wf bit in tgcr is cleared to 0 or set to 1. the drive waveforms are output from the complementary pwm mode 6-phase output pins. with this 6-phase output, in the case of on output, it is possible to use complementary pwm mode output and perform chopping output by setting the n bit or p bit to 1. when the n bit or p bit is 0, level output is selected. the 6-phase output active level (on output level) can be set with the olsn and olsp bits in the timer output control register (tocr) regardless of the setting of the n and p bits. when using this mode, set the 6-phase output waveform to high active (low active is also permitted for a masks). external input tioc0a pin tioc0b pin tioc0c pin tioc3b pin tioc3d pin tioc4a pin tioc4c pin tioc4b pin tioc4d pin 6-phase output when bcd = 1, n = 0, p = 0, fb = 0, output active level = high figure 12.55 example of output phase switching by external input (1)
372 external input tioc0a pin tioc0b pin tioc0c pin tioc3b pin tioc3d pin tioc4a pin tioc4c pin tioc4b pin tioc4d pin 6-phase output when bcd = 1, n = 1, p = 1, fb = 0, output active level = high figure 12.56 example of output phase switching by external input (2) tgcr uf bit vf bit wf bit tioc3b pin tioc3d pin tioc4a pin tioc4c pin tioc4b pin tioc4d pin 6-phase output when bcd = 1, n = 0, p = 0, fb = 0, output active level = high figure 12.57 example of output phase switching by means of uf, vf, wf bit settings (1)
373 tgcr uf bit vf bit wf bit tioc3b pin tioc3d pin tioc4a pin tioc4c pin tioc4b pin tioc4d pin 6-phase output when bcd = 1, n = 1, p = 1, fb = 0, out p ut active level = hi g h figure 12.58 example of output phase switching by means of uf, vf, wf bit settings (2) a/d conversion start request setting in complementary pwm mode, an a/d conversion start request can be issued using a tgr3a compare-match or a compare-match on a channel other than channels 3 and 4. when start requests using a tgr3a compare-match are set, a/d conversion can be started at the center of the pwm pulse. a/d conversion start requests can be set by setting the ttge bit to 1 in the timer interrupt enable register (tier).
374 complementary pwm mode output protection function: complementary pwm mode output has the following protection functions. register and counter miswrite prevention function with the exception of the buffer registers, which can be rewritten at any time, access by the cpu can be enabled or disabled for the mode registers, control registers, compare registers, and counters used in complementary pwm mode by means of bit 13 in the bus controller? bus control register 1 (bcr1). the registers and counters concerned are listed in table 12.3. this function enables miswriting due to cpu runaway to be prevented by disabling cpu access to the mode registers, control registers, and counters. halting of pwm output by external signal the 6-phase pwm output pins can be set automatically to the high-impedance state by inputting specified external signals. there are four external signal input pins. see section 12.9, port output enable (poe), for details. halting of pwm output when oscillator is stopped if it is detected that the clock input to the sh7040 chip has stopped, the 6-phase pwm output pins automatically go to the high-impedance state. the pin states are not guaranteed when the clock is restarted. see section 4.4, oscillator halt function, for details.
375 12.5 interrupts 12.5.1 interrupt sources and priority ranking the mtu has three interrupt sources: tgr register compare-match/input captures, tcnt counter overflows and tcnt counter underflows. because each of these three types of interrupts are allocated its own dedicated status flag and enable/disable bit, the issuing of interrupt request signals to the interrupt controller can be independently enabled or disabled. when an interrupt source is generated, the corresponding status flag in the timer status register (tsr) is set to 1. if the corresponding enable/disable bit in the timer input enable register (tier) is set to 1 at this time, the mtu makes an interrupt request of the interrupt controller. the interrupt request is canceled by clearing the status flag to 0. the channel priority order can be changed with the interrupt controller. the priority ranking within a channel is fixed. for more information, see section 6, interrupt controller. table 12.17 lists the mtu interrupt sources. input capture/compare match interrupts: if the tgie bit of the timer input enable register (tier) is already set to 1 when the tgf flag in the timer status register (tsr) is set to 1 by a tgr register input capture/compare-match of any channel, an interrupt request is sent to the interrupt controller. the interrupt request is canceled by clearing the tgf flag to 0. the mtu has 16 input capture/compare-match interrupts; four each for channels 0, 3, and 4, and two each for channels 1 and 2. overflow interrupts: if the tciev bit of the tier is already set to 1 when the tcfv flag in the tsr is set to 1 by a tcnt counter overflow of any channel, an interrupt request is sent to the interrupt controller. the interrupt request is canceled by clearing the tcfv flag to 0. the mtu has five overflow interrupts, one for each channel. underflow interrupts: if the tcieu bit of the tier is already set to 1 when the tcfu flag in the tsr is set to 1 by a tcnt counter underflow of any channel, an interrupt request is sent to the interrupt controller. the interrupt request is canceled by clearing the tcfu flag to 0. the mtu has two underflow interrupts, one each for channels 1 and 2.
376 table 12.17 mtu interrupt sources channel interrupt source description dmac activation dtc activation priority* 0 tgi0a tgr0a input capture/compare-match yes yes high tgi0b tgr0b input capture/compare-match no yes tgi0c tgr0c input capture/compare-match no yes tgi0d tgr0d input capture/compare-match no yes tci0v tcnt0 overflow no no 1 tgi1a tgr1a input capture/compare-match yes yes tgi1b tgr1b input capture/compare-match no yes tci1v tcnt1 overflow no no tci1u tcnt1 underflow no no 2 tgi2a tgr2a input capture/compare-match yes yes tgi2b tgr2b input capture/compare-match no yes tci2v tcnt2 overflow no no tci2u tcnt2 underflow no no 3 tgi3a tgr3a input capture/compare-match yes yes tgi3b tgr3b input capture/compare-match no yes tgi3c tgr3c input capture/compare-match no yes tgi3d tgr3d input capture/compare-match no yes tci3v tcnt3 overflow no no 4 tgi4a tgr4a input capture/compare-match yes yes tgi4b tgr4b input capture/compare-match no yes tgi4c tgr4c input capture/compare-match no yes tgi4d tgr4d input capture/compare-match no yes tci4v tcnt overflow/underflow no yes low note: indicates the initial status following reset. the ranking of channels can be altered using the interrupt controller.
377 12.5.2 dtc/dmac activation dtc activation: the tgr register input capture/compare-match interrupt of any channel can be used as a source to activate the on-chip data transfer controller (dtc). for details, refer to section 8, data transfer controller. the mtu has 17 input capture/compare-match interrupts that can be used as dtc activation sources, four each for channels 0 and 3, two each for channels 1 and 2, and five for channel 4. dmac activation: the tgra register input capture/compare-match interrupt of any channel can be used as a source to activate the on-chip dmac. for details, refer to section 11, direct memory access controller. the mtu has 5 tgra register input capture/compare-match interrupts, one for any channel, that can be used as dmac activation sources. 12.5.3 a/d converter activation the tgra register input capture/compare-match of any channel can be used to activate the on- chip a/d converter. if the ttge bit of the tier is already set to 1 when the tgfa flag in the tsr is set to 1 by a tgra register input capture/compare-match of any of the channels, an a/d conversion start request is sent to the a/d converter. if the mtu conversion start trigger is selected at such a time on the a/d converter side when this happens, the a/d conversion starts. the mtu has 5 tgra register input capture/compare-match interrupts, one for each channel, that can be used as a/d converter activation sources.
378 12.6 operation timing 12.6.1 input/output timing tcnt count timing: count timing for the tcnt counter with internal clock operation is shown in figure 12.59. count timing with external clock operation (normal mode) is shown in figure 12.60, and figure 12.61 shows count timing with external clock operation (phase counting mode). tcnt input clock internal clock tcnt f falling edge falling edge rising edge n e 1 n n + 1 n + 2 figure 12.59 tcnt count timing during internal clock operation tcnt input clock external clock tcnt f falling edge falling edge rising edge n ?1 n n + 1 n + 2 figure 12.60 tcnt count timing during external clock operation (normal mode)
379 tcnt input clock external clock tcnt f falling edge falling edge rising edge n ?1 n n + 1 figure 12.61 tcnt count timing during external clock operation (phase counting mode) output compare output timing: the compare-match signal is generated at the final state of tcnt and tgr matching. when a compare-match signal is issued, the output value set in tior or tocr is output to the output compare output pin (tioc pin). after tcnt and tgr matching, a compare-match signal is not issued until immediately before the tcnt input clock. output compare output timing (normal mode and pwm mode) is shown in figure 12.62. see figure 12.63 for output compare output timing in complementary pwm mode and reset sync pwm mode. tcnt input clock tioc pin compare- match signal tcnt tgr f n n n + 1 figure 12.62 output compare output timing (normal mode/pwm mode)
380 tcnt input clock tioc pin compare- match signal tcnt tgr f n n n + 1 figure 12.63 output compare output timing (complementary pwm mode/reset sync pwm mode) input capture signal timing: figure 12.64 illustrates input capture timing. input capture input input capture signal tcnt tgr f n n + 2 n n + 2 n + 1 rising edge falling edge figure 12.64 input capture input signal timing
381 counter clearing timing due to compare-match/input capture: timing for counter clearing due to compare-match is shown in figure 12.65. figure 12.66 shows the timing for counter clearing due to input capture. compare- match signal f counter clear signal tcnt tgr n n h'0000 figure 12.65 counter clearing timing (compare-match) input capture signal f counter clear signal tcnt tgr n n h'0000 figure 12.66 counter clearing timing (input capture)
382 buffer operation timing: compare-match buffer operation timing is shown in figure 12.67. figure 12.68 shows input capture buffer operation timing. tcnt f compare- match buffer signal tgra, tgrb tgrc, tgrd n n + 1 nn n compare- match signal figure 12.67 buffer operation timing (compare-match) tcnt f input capture signal buffer tgra, tgrb tgrc, tgrd n n + 1 nn n n + 1 n input capture signal figure 12.68 buffer operation timing (input capture)
383 12.6.2 interrupt signal timing setting tgf flag timing during compare-match: figure 12.69 shows timing for the tgf flag of the timer status register (tsr) due to compare-match, as well as tgi interrupt request signal timing. compare- match signal tcnt tcnt input clock f tgr tgf flag tgi interrupt n n + 1 n figure 12.69 tgi interrupt timing (compare match) setting tgf flag timing during input capture: figure 12.70 shows timing for the tgf flag of the timer status register (tsr) due to input capture, as well as tgi interrupt request signal timing.
384 input capture signal tcnt f tgr tgf flag tgi interrupt n n figure 12.70 tgi interrupt timing (input capture) setting timing for overflow flag (tcfv)/underflow flag (tcfu): figure 12.71 shows timing for the tcfv flag of the timer status register (tsr) due to overflow, as well as tciv interrupt request signal timing. figure 12.72 shows timing for the tcfu flag of the timer status register (tsr) due to underflow, as well as tciu interrupt request signal timing. figure 12.73 shows timing for the tcfv flag of tsr4 due to underflow in complementary pwm mode, as well as tciv interrupt request signal timing. overflow signal tcnt (underflow) tcnt input clock f tcfv flag tciv interrupt h'ffff h'0000 figure 12.71 tciv interrupt setting timing
385 underflow signal tcnt (underflow) tcnt input clock f tcfu flag tciu interrupt h'0000 h'ffff figure 12.72 tciu interrupt setting timing underflow signal tcnt (underflow) tcnt input clock f tcfv flag tciv interrupt h'0000 h'0001 h'0001 figure 12.73 tciv interrupt setting timing (tsr4, complementary pwm mode)
386 status flag clearing timing: the status flag is cleared when the cpu reads a 1 status followed by a 0 write. for dtc/dma controller activation, clearing can also be done automatically. figure 12.74 shows the timing for status flag clearing by the cpu. figure 12.75 shows timing for clearing due to the dtc/dma controller. status flag interrupt request signal address write signal f t 1 t 2 tsr write cycle tsr address figure 12.74 timing of status flag clearing by the cpu status flag interrupt request signal address f t 1 t 2 dtc/dmac read cycle dtc/dmac write cycle source address destination address t 1 t 2 figure 12.75 timing of status flag clearing by dtc/dmac activation
387 12.7 notes and precautions this section describes contention and other matters requiring special attention during mtu operations. 12.7.1 input clock limitations the input clock pulse width, in the case of single edge, must be 1.5 states or greater, and 2.5 states or greater for both edges. normal operation cannot be guaranteed with lesser pulse widths. in phase counting mode, the phase difference between the two input clocks and the overlap must be 1.5 states or greater for each, and the pulse width must be 2.5 states or greater. input clock conditions for phase counting mode are shown in figure 12.76. overlap phase difference overlap phase difference pulse width pulse width pulse width pulse width tclkb (tclkd) tclka (tclkc) note: phase difference and overlap: 1.5 states or greater pulse width: 2.5 states or greater figure 12.76 phase difference, overlap, and pulse width in phase count mode 12.7.2 note on cycle setting when setting a counter clearing by compare-match, clearing is done in the final state when tcnt matches the tgr value (update timing for count value on tcnt match). the actual number of states set in the counter is given by the following equation: f n = + () f 1 (f: counter frequency, f : operating frequency, n: value set in the tgr)
388 12.7.3 contention between tcnt write and clear if a counter clear signal is issued in the t 2 state during the tcnt write cycle, tcnt clearing has priority, and tcnt write is not conducted (figure 12.77). counter clear signal tcnt address write signal f t 1 t 2 tcnt write cycle tcnt address n h'0000 figure 12.77 tcnt write and clear contention
389 12.7.4 contention between tcnt write and increment if a count-up signal is issued in the t 2 state during the tcnt write cycle, tcnt write has priority, and the counter is not incremented (figure 12.78). tcnt input clock tcnt address write signal f t 1 t 2 tcnt write cycle tcnt write data tcnt address m n figure 12.78 tcnt write and increment contention
390 12.7.5 contention between buffer register write and compare match if a compare-match occurs in the t 2 state of the tgr write cycle, data is transferred by the buffer operation from the buffer register to the tgr. data to be transferred differs depending on channels 0 and 3 and 4: data on channel 0 is that after write, and on channels 3 and 4, before write (figures 12.79 and 12.80). buffer register compare match signal compare match buffer signal address write signal tgr f t 1 t 2 tgr write cycle buffer register address nm buffer register write data m figure 12.79 tgr write and compare-match contention (channel 0)
391 buffer register compare match buffer signal tgr address write signal f t 1 t 2 tgr write cycle buffer register address n nm compare match signal buffer register write data figure 12.80 tgr write and compare-match contention (channels 3 and 4)
392 12.7.6 contention between tgr read and input capture if an input capture signal is issued in the t 1 state of the tgr read cycle, the read data is that after input capture transfer (figure 12.81). tgr input capture signal internal data bus address read signal f t 1 t 2 tgr read cycle tgr address m xm figure 12.81 tgr read and input capture contention
393 12.7.7 contention between tgr write and input capture if an input capture signal is issued in the t 2 state of the tgr read cycle, input capture has priority, and tgr write does not occur (figure 12.82). tgr input capture signal tcnt address write signal f t 1 t 2 tgr write cycle tgr address m m figure 12.82 tgr write and input capture contention
394 12.7.8 contention between buffer register write and input capture if an input capture signal is issued in the t 2 state of the buffer write cycle, write to the buffer register does not occur, and buffer operation takes priority (figure 12.83). tgr input capture signal tcnt address write signal buffer re g ister f t 1 t 2 buffer register write cycle buffer register address n mn m figure 12.83 buffer register write and input capture contention
395 12.7.9 contention between tgr write and compare match if a compare-match occurs in the t 2 state of the tgr write cycle, data is written to the tgr and a compare-match signal is issued (figure 12.84). tgr compare match signal tcnt address write signal f t 1 t 2 tgr write cycle tgr address n n + 1 m n tgr write data figure 12.84 tgr write and compare match contention 12.7.10 tcnt2 write and overflow/underflow contention in cascade connection with timer counters tcnt1 and tcnt2 in a cascade connection, when a contention occurs during tcnt1 count (during a tcnt2 overflow/underflow) in the t 2 state of the tcnt2 write cycle, the write to tcnt2 is conducted, and the tcnt1 count signal is prohibited. at this point, if there is match with tgr1a or tgr1b and the tcnt1 value, a compare signal is issued. the timing is shown in figure 12.85. for cascade connections, be sure to synchronize settings for channels 1 and 2 when setting tcnt clearing.
396 t1 t1 h'fffe h'ffff n n + 1 h'ffff m m n p qp m disabled tcnt2 write data tcnt2 address tcnt write cycle f address write signal tcnt2 tgr2a? ch2 compare- match signal a/b tcnt1 input clock tcnt1 tgr1a ch1 compare- match signal a tgr1b ch1 inputcapture signal b tcnt0 tgr0a? ch0 input capture signal a? figure 12.85 tcnt2 write and overflow/underflow contention with cascade connection
397 12.7.11 counter value during complementary pwm mode stop when counting operation is suspended with tcnt3 and tcnt4 in complementary pwm mode, tcnt3 has the timer dead time register (tddr) value, and tcnt4 is held at h'0000. when restarting complementary pwm mode, counting begins automatically from the initialized state (figure 12.86). when counting begins in another operating mode, be sure that tcnt3 and tcnt4 are set to the initial values. tgr3a tcdr tddr h'0000 tcnt3 tcnt4 complementary pwm mode operation complementary pwm mode operation counter operation stop complementary pmw restart figure 12.86 counter value during complementary pwm mode stop 12.7.12 buffer operation setting in complementary pwm mode in complementary pwm mode, conduct rewrites by buffer operation for the pwm cycle setting register (tgr3a), pwm carrier cycle setting register (tcdr) and duty setting registers (tgr3b, trg4a, and tgr4b). in complementary pwm mode, channel 3 and channel 4 buffers operate in accordance with bit settings bfa and bfb of tmdr3. when tmdr3? bfa bit is set to 1, tgr3c functions as a buffer register for tgr3a. at the same time, tgr4c functions as the buffer register for trg4a, while the tcbr functions as the tcdr? buffer register.
398 12.7.13 reset sync pwm mode buffer operation and compare match flag when setting buffer operation for reset sync pwm mode, set the bfa and bfb bits of tmdr4 to 0. the tioc4c pin will be unable to produce its waveform output if the bfa bit of tmdr4 is set to 1. in reset sync pwm mode, the channel 3 and channel 4 buffers operate in accordance with the bfa and bfb bit settings of tmdr3. for example, if the bfa bit of tmdr3 is set to 1, tgr3c functions as the buffer register for tgr3a. at the same time, tgr4c functions as the buffer register for trg4a. when setting buffer operation for reset sync pwm mode, take particular care, since compare- match flag tgfc bit and tgfd bit operations differ with tsr3 and tsr4. the tgfc bit and tgfd bit of tsr3 are not set when tgr3c and tgr3d are operating as buffer registers. on the other hand, tsr4? tgfc and tgfd bits are set even when tgr4c and tgr4d are operating as buffer registers. when buffer operation has been set for reset sync pwm mode, set the timer interrupt enable register? (tier4) tgiec and tgied bits to 0, to prohibit interrupt output. figure 12.87 shows an example of operations for tgr3, tgr4, tioc3, and tioc4, with tmdr3? bfa and bfb bits set to 1, and tmdr4? bfa and bfb bits set to 0.
399 tgr3a tgr3c tgr3b, tgr4a, tgr4b tgr3d, tgr4c, tgr4d h'0000 tioc3a tioc3b tioc3d tioc4a tioc4c tioc4b tioc4d tgf3c tgf3d tgf4c tgf4d tgr3a, tgr3c tgr3b, tgr3d, tgr4a, tgr4c, tgr4b, tgr4d buffer transfer with compare match a3 tcnt3 not set not set set set point a point b figure 12.87 buffer operation and compare-match flags in reset sync pwm mode a mask operation for a mask, the above operation is modified as follows: when setting buffer operation for reset sync pwm mode, set the bfa and bfb bits of tmdr4 to 0. the tioc4c pin will be unable to produce its waveform output if the bfa bit of tmdr4 is set to 1. in reset sync pwm mode, the channel 3 and channel 4 buffers operate in accordance with the bfa and bfb bit settings of tmdr3. for example, if the bfa bit of tmdr3 is set to 1, tgr3c functions as the buffer register for tgr3a. at the same time, tgr4c functions as the buffer register for trg4a. when setting buffer operation for reset sync pwm mode, the compare-match flag tgfc bit and tgfd bit operations will be the same for tsr3 and tsr4. the tgfc bit and tgfd bit of tsr3 are not set when tgr3c and tgr3d are operating as buffer registers. the tgfc bit and tgfd bit of tsr4 are not set when tgr4c and tgr4d are operating as buffer registers.
400 when setting the buffer operation in the reset synchronous pwm mode , it is not necessary to set the timer interrupt enable register? (tier4) tgiec and tgied bits to 0, to prohibit interrupt output. figure 12.88 shows an example of operations for tgr3, tgr4, tioc3, and tioc4, with tmdr3? bfa and bfb bits set to 1, and tmdr4? bfa and bfb bits set to 0. tgr3a tgr3c tgr3b,tgr4a tgr4b tgr3d,tgr4c tgr4d h'0000 tioc3a tioc3b tioc3d tioc4a tioc4c tioc4b tioc4d tgf3c tgf3d tgf4c tgf4d tcnt3 tgr3a, tgr3c tgr3b,tgr3d tgr4a,tgr4c tgr4b,tgr4d not set not set not set buffer transfer with compare match a3 point a point b not set figure 12.88 buffer operation and compare-match flags in reset sync pwm mode (for a mask) 12.7.14 overflow flags in reset sync pwm mode when set to reset sync pwm mode, tcnt3 and tcnt4 start counting when the cst3 bit of tstr is set to 1. at this point, tcnt4? count clock source and count edge obey the tcr3 setting. in reset sync pwm mode, with cycle register tgr3a? set value at h'ffff, take care when specifying tgr3a compare-match for the counter clear source, since the operation of the overflow flag (tcfv bit) differs with tsr3 and tsr4.
401 when tcnt3 and tcnt4 count up to h'ffff, a compare-match occurs with tgr3a, and tcnt3 and tcnt4 are both cleared. at this point, tsr3? tcfv bit is not set, but the tcfv bit of tsr4 is set. this can be avoided by sync setting for channel 3 and channel 4. set the sync3 and sync4 bits of the timer sync register (tsyr) to 1, compare-match with tgr3a by tcr3 for the counter clear source, and sync clear with tcr4. this gives the sync setting for channels 3 and 4. figure 12.89 shows a tcfv bit operation example in reset sync pwm mode with a set value for cycle register tgr3a of h'ffff, when a tgr3a compare-match has been specified without synchronous setting for the counter clear source. tgr3a (h'ffff) h'0000 tcf3v tcf4v tcnt3 = tcnt4 counter cleared by compare match a3 not set set figure 12.89 reset sync pwm mode overflow flag a mask operation for a mask, the above operation is modified as follows: when set to reset sync pwm mode, tcnt3 and tcnt4 start counting when the cst3 bit of tstr is set to 1. at this point, tcnt4? count clock source and count edge obey the tcr3 setting. in reset sync pwm mode, with cycle register tgr3a? set value at h'ffff and specifying tgr3a compare-match for the counter clear source, the operation of the overflow flag tcfv bit for both tsr3 and tsr4 will be the same. when tcnt3 and tcnt4 count up to h'ffff, a compare-match occurs with tgr3a, and tcnt3 and tcnt4 are both cleared. at this point, tcfv bits for tsr3 and tsr4 are not set. figure 12.90 shows a tcfv bit operation example in reset sync pwm mode with a set value for cycle register tgr3a of h'ffff, when a tgr3a compare-match has been specified without synchronous setting for the counter clear source.
402 tgr3a (h'ffff) h'0000 tcf3v tcf4v tcnt3=tcnt4 not set not set counter clear by compare match 3a figure. 12.90 reset sync pwm mode overflow flag (for a mask)
403 12.7.15 notes on compare match flags in complementary pwm mode in complementary pwm mode, buffer register compare-match flags can be set only for compare with three counters (tcnt3, tcnt4, and tcnts). note that when the buffer register set value is dead time (td), 2td, tgr3a ?td, or tgr3a ?2td, the buffer register compare-match flag may not be set. figure 12.91 gives a description when tgr3b is the specified duty setting register, tgr3d the buffer register with tgr3a ?td as the buffer register set value. tgr3a tcdr (tgr3a td) tgr3b tddr h'0000 tioc3a tioc3b tioc3d tgf3b setting signal tgf3d setting signal tcnt3 tgr3d tcnt4 tgr3b, tgr3d point a point b point c point d point a: tgr3d setting td point b: tgr3d setting tgr3a ?td or tgr3a ?2td point c: tgr3d setting td or 2td point d: tgr3d setting tgr3a ?td or tgr3a ?2td, and the setting signal is not output figure 12.91 special properties of compare match flag in complementary pwm mode
404 a mask operation for a mask, the above operation is modified as follows: in complementary pwm mode, buffer register compare-match flags can be set only for compare with three counters (tcnt3, tcnt4, and tcnts). special properties of compare match flag disappear and compare match flags of buffer registers are set to all set values of buffer registers. figure. 12.92 shows an example when setting the duty setting register to tgr3b, buffer register to tgr3d and buffer register to tgr3a-td. tgr3a tcdr (tgr3a -td) tgr3b tddr h'0000 tioc3a tioc3b tioc3d point a point b point c point d tgf3b setting signal tgf3d setting signal tcnt3 tgr3d tcnt4 tgr3b, tgr3d set signals are output when: point a: tgr3d setting is td point b: tgr3d settings are tgr3a-td, tgr3a-2td point c: tgr3d settings are td, 2td point d: tgr3d settings are tgr3a-td, tgr3a-2td figure. 12.92 special properties of compare match flag in complementary pwm mode (for a mask)
405 12.7.16 contention between overflow/underflow and counter clearing if overflow/underflow and counter clearing occur simultaneously, the tcfv/tcfu flag in tsr is not set and tcnt clearing takes precedence. figure 12.93 shows the operation timing when a tgr compare-match is specified as the clearing source, and h'ffff is set in tgr. tcnt input clock tcnt counter clear signal tgf flag tcfv flag h'ffff h'0000 disabled figure 12.93 contention between overflow and counter clearing
406 12.7.17 contention between tcnt write and overflow/underflow if there is an up-count or down-count in the t2 state of a tcnt write cycle, and overflow/underflow occurs, the tcnt write takes precedence and the tcfv/tcfu flag in tsr is not set . figure 12.94 shows the operation timing in this case. address write signal tcnt input clock tcnt tcfv flag h'ffff n tcnt write data disabled tcnt write cycle t1 t2 tcnt address figure 12.94 contention between tcnt write and overflow
407 12.7.18 cautions on transition from normal operation or pwm mode 1 to reset- synchronous pwm mode when making a transition from channel 3 or 4 normal operation or pwm mode 1 to reset- synchronous pwm mode, if the counter is halted with the output pins (tioc3b, tioc3d, tioc4a, tioc4c, tioc4b, tioc4d) in the high-impedance state, followed by the transition to reset-synchronous pwm mode and operation in that mode, the initial pin output will not be correct. when making a transition from normal operation to reset-synchronous pwm mode, write h'11 to registers tior3h, tior3l, tior4h, and tior4l to initialize the output pins to low level output, then set an initial register value of h'00 before making the mode transition. when making a transition from pwm mode 1 to reset-synchronous pwm mode, first switch to normal operation, then initialize the output pins to low level output and set an initial register value of h'00 before making the transition to reset-synchronous pwm mode. 12.7.19 output level in complementary pwm mode and reset-synchronous pwm mode when channels 3 and 4 are in complementary pwm mode or reset-synchronous pwm mode, the pwm waveform output level is set with the olsp and olsn bits in the timer output control register (tocr). in the case of complementary pwm mode or reset-synchronous pwm mode, tior should be set to h'00. 12.7.20 cautions on using the chopping function in complementary pwm mode or reset synchronous pwm mode (a mask excluded) when channels 3 and 4 are in complementary pwm mode or reset-synchronous pwm mode and using the chopping output function, setting the pwm waveform output level to low active with the olsp and olsn bits in the timer output control register (tocr) will output an incorrect gate signal or chopping output. when channels 3 and 4 are in complementary pwm mode or reset-synchronous pwm mode and using the chopping output function, the pwm output level should be set to high active. 12.7.21 cautions on carrying out buffer operation of channel 0 in pwm mode (a mask excluded) in pwm mode 1, the tgra and tgrb registers are used in pairs and pwm waveform is output to the tioca pin. in the same manner, the tgrc and tgrd registers are used in pairs and pwm waveform is output to the tiocc pin. if either the tgrc or tgrd register is operating as a buffer register, the tiocc pin cannot execute default output setting or pwm waveform output with the i/o control register (tior).
408 note that for channel 0, the tiocc pin allows both default output setting by tior and pwm output when setting buffer operation only for the tgrd register in pwm mode. when using channel 0 in pwm mode 1 and setting buffer operation, use both the tgrc and tgrd registers as buffer registers. 12.7.22 cautions on restarting with sync clear of another channel in complementary pwm mode (a mask excluded) the complementation pwm mode operates while waiting for the current, next and the following set values as values of the pwm duty. if clearing sync from another channel during operation, the pwm output will return to the default output and restart. when restarting with sync clear, the following operations may occur: 1. when restarting with sync clear, the next set value is used for the pwm duty, however, the following set value may be used by mistake. 2. if sync clear and the setting of the value following the next value of pwm duty (write to tgr4d) occurs at the same time, the next set value may be overwritten. how to avoid 1 when selecting the mode to transfer using the crest/trough in the complementary pwm transfer mode, set the value following the next value of the pwm duty (write to tgr4d) while the temporary register is not executing comparisons. furthermore, set the occurrence timing of sync clear while the temporary register is not executing comparisons. when selecting the mode to transfer using the crest in the transfer mode, set the value following the next value of the pwm duty (write to tgr4d) while the temporary register is not executing comparisons and while tcnt3 and tcnt4 are counting up. furthermore, set the occurrence timing of sync clear while the temporary register is not executing comparisons and while tcnt3 and tcnt4 are counting up. when selecting the mode to transfer using the trough in the transfer mode, set the value following the next value of the pwm duty (write to tgr4d) while the temporary register is not executing comparisons and while tcnt3 and tcnt4 are counting down. furthermore, set the occurrence timing of sync clear while the temporary register is not executing comparisons and while tcnt3 and tcnt4 are counting down. how to avoid 2 regardless of the transfer mode, set so that the sync clear and the setting of the value following the next value (write to tgr4d) does not occur at the same time.
409 figure 12.95 shows an example of the duration while the temporary register is executing comparisons. initial tb, ta and tb indicate the duration of the temporary register comparison. initial tb ta tb ta tb tgr3a tcdr tddr h'0000 tcnt3 tcnt4 figure. 12.95 temporary register comparison execution time 12.8 mtu output pin initialization 12.8.1 operating modes the mtu has the following six operating modes. waveform output is possible in all of these modes. normal mode (channels 0 and 4) pwm mode 1 (channels 0 and 4) pwm mode 2 (channels 0 and 2) phase counting modes 1? (channels 1 and 2) complementary pwm mode (channels 3 and 4) reset-synchronous pwm mode (channels 3 and 4) the mtu output pin initialization method for each of these modes is described in this section. 12.8.2 reset start operation the mtu output pins (tioc*) are initialized low by a reset and in standby mode. since mtu pin function selection is performed by the pin function controller (pfc), when the pfc is set, the mtu pin states at that point are output to the ports. when mtu output is selected by the pfc immediately after a reset, the mtu output initial level, low, is output directly at the port. when the active level is low, the system will operate at this point, and therefore the pfc setting should be made after initialization of the mtu output pins is completed. note: channel number and port notation are substituted for *.
410 12.8.3 operation in case of re-setting due to error during operation, etc. if an error occurs during mtu operation, mtu output should be cut by the system. cutoff is performed by switching the pin output to port output with the pfc and outputting the inverse of the active level. for large-current pins, output can also be cut by hardware, using port output enable (poe). the pin initialization procedures for re-setting due to an error during operation, etc., and the procedures for restarting in a different mode after re-setting, are shown below. the mtu has six operating modes, as stated above. there are thus 36 mode transition combinations, but some transitions are not available with certain channel and mode combinations. possible mode transition combinations are shown in table 12.18. table 12.18 mode transition combinations after before normal pwm1 pwm2 pcm cpwm rpwm normal (1) (2) (3) (4) (5) (6) pwm1 (7) (8) (9) (10) (11) (12) pwm2 (13) (14) (15) (16) none none pcm (17) (18) (19) (20) none none cpwm (21) (22) none none (23) (24) rpwm (25) (26) none none (27) (28) legend: normal: normal mode pwm1: pwm mode 1 pwm2: pwm mode 2 pcm: phase counting modes 1? cpwm: complementary pwm mode rpwm: reset-synchronous pwm mode the above abbreviations are used in some places in following descriptions. 12.8.4 overview of initialization procedures and mode transitions in case of error during operation, etc. when making a transition to a mode (normal, pwm1, pwm2, pcm) in which the pin output level is selected by the timer i/o control register (tior) setting, initialize the pins by means of a tior setting. in pwm mode 1, since a waveform is not output to the tioc*b (tioc *d) pin, setting tior will not initialize the pins. if initialization is required, carry it out in normal mode, then switch to pwm mode 1.
411 in pwm mode 2, since a waveform is not output to the cycle register pin, setting tior will not initialize the pins. if initialization is required, carry it out in normal mode, then switch to pwm mode 2. in normal mode or pwm mode 2, if tgrc and tgrd operate as buffer registers, setting tior will not initialize the buffer register pins. if initialization is required, clear buffer mode, carry out initialization, then set buffer mode again. in pwm mode 1, if either tgrc or tgrd operates as a buffer register, setting tior will not initialize the tgrc pin. to initialize the tgrc pin, clear buffer mode, carry out initialization, then set buffer mode again. when making a transition to a mode (cpwm, rpwm) in which the pin output level is selected by the timer output control register (tocr) setting, switch to normal mode and perform initialization with tior, then restore tior to its initial value, and temporarily disable channel 3 and 4 output with the timer output master enable register (toer). then operate the unit in accordance with the mode setting procedure (tocr setting, tmdr setting, toer setting). pin initialization procedures are described below for the numbered combinations in table 12.19. the active level is assumed to be low. note: channel number is substituted for * indicated in this article.
412 (1) operation when error occurs during normal mode operation, and operation is restarted in normal mode: figure 12.96 shows an explanatory diagram of the case where an error occurs in normal mode and operation is restarted in normal mode after re-setting. 1 reset 2 tmdr (normal) 3 toer (1) 5 pfc (mtu) 4 tior (1 init 0 out) 6 tstr (1) 7 match 8 error occurs 9 pfc (port) 10 tstr (0) 11 tmdr (normal) 12 tior (1 init 0 out) 13 pfc (mtu) 14 tstr (1) mtu output tioc*a tioc*b port output pen pen n=0 to 15 high-z high-z figure 12.96 error occurrence in normal mode, recovery in normal mode 1. after a reset, mtu output is low and ports are in the high-impedance state. 2. after a reset, the tmdr setting is for normal mode. 3. for channels 3 and 4, enable output with toer before initializing the pins with tior. 4. initialize the pins with tior. (the example shows initial high output, with low output on compare-match occurrence.) 5. set mtu output with the pfc. 6. the count operation is started by tstr. 7. output goes low on compare-match occurrence. 8. an error occurs. 9. set port output with the pfc and output the inverse of the active level. 10. the count operation is stopped by tstr. 11. not necessary when restarting in normal mode. 12. initialize the pins with tior. 13. set mtu output with the pfc. 14. operation is restarted by tstr.
413 (2) operation when error occurs during normal mode operation, and operation is restarted in pwm mode 1: figure 12.97 shows an explanatory diagram of the case where an error occurs in normal mode and operation is restarted in pwm mode 1 after re-setting. 1 reset 2 tmdr (normal) 3 toer (1) 5 pfc (mtu) 4 tior (1 init 0 out) 6 tstr (1) 7 match 8 error occurs 9 pfc (port) 10 tstr (0) 11 tmdr (pwm1) 12 tior (1 init 0 out) 13 pfc (mtu) 14 tstr (1) mtu output tioc*a tioc*b port output pen pen ?not initialized (tioc*b) n=0 to 15 high-z high-z figure 12.97 error occurrence in normal mode, recovery in pwm mode 1 1 to 10 are the same as in figure 12.96. 11. set pwm mode 1. 12. initialize the pins with tior. (in pwm mode 1, the tioc*b side is not initialized. if initialization is required, initialize in normal mode, then switch to pwm mode 1.) 13. set mtu output with the pfc. 14. operation is restarted by tstr.
414 (3) operation when error occurs during normal mode operation, and operation is restarted in pwm mode 2: figure 12.98 shows an explanatory diagram of the case where an error occurs in normal mode and operation is restarted in pwm mode 2 after re-setting. 1 reset 2 tmdr (normal) 3 toer (1) 5 pfc (mtu) 4 tior (1 init 0 out) 6 tstr (1) 7 match 8 error occurs 9 pfc (port) 10 tstr (0) 11 tmdr (pwm2) 12 tior (1 init 0 out) 13 pfc (mtu) 14 tstr (1) mtu output tioc*a tioc*b port output pen pen ?not initialized (cycle register) n=0 to 15 high-z high-z figure 12.98 error occurrence in normal mode, recovery in pwm mode 2 1 to 10 are the same as in figure 12.96. 11. set pwm mode 2. 12. initialize the pins with tior. (in pwm mode 2, the cycle register pins are not initialized. if initialization is required, initialize in normal mode, then switch to pwm mode 2.) 13. set mtu output with the pfc. 14. operation is restarted by tstr. note: pwm mode 2 can only be set for channels 0?, and therefore toer setting is not necessary.
415 (4) operation when error occurs during normal mode operation, and operation is restarted in phase counting mode: figure 12.99 shows an explanatory diagram of the case where an error occurs in normal mode and operation is restarted in phase counting mode after re- setting. 1 reset 2 tmdr (normal) 3 toer (1) 5 pfc (mtu) 4 tior (1 init 0 out) 6 tstr (1) 7 match 8 error occurs 9 pfc (port) 10 tstr (0) 11 tmdr (pcm) 12 tior (1 init 0 out) 13 pfc (mtu) 14 tstr (1) mtu output tioc*a tioc*b port output pen pen n=0 to 15 high-z high-z figure 12.99 error occurrence in normal mode, recovery in phase counting mode 1 to 10 are the same as in figure 12.96. 11. set phase counting mode. 12. initialize the pins with tior. 13. set mtu output with the pfc. 14. operation is restarted by tstr. note: phase counting mode can only be set for channels 1 and 2, and therefore toer setting is not necessary.
416 (5) operation when error occurs during normal mode operation, and operation is restarted in complementary pwm mode: figure 12.100 shows an explanatory diagram of the case where an error occurs in normal mode and operation is restarted in complementary pwm mode after re-setting. 1 reset 2 tmdr (normal) 3 toer (1) 5 pfc (mtu) 4 tior (1 init 0 out) 6 tstr (1) 7 match 8 error occurs 9 pfc (port) 10 tstr (0) 11 tior (0 init 0 out) 12 tior ( disabled ) 13 toer (0) 14 tocr 15 tmdr (cpwm) (16) toer (1) (17) pfc (mtu) (18) tstr (1) mtu output tioc3a tioc3b tioc3d port output pe9 pe8 pe11 high-z high-z high-z figure 12.100 error occurrence in normal mode, recovery in complementary pwm mode 1 to 10 are the same as in figure 12.96. 11. initialize the normal mode waveform generation section with tior. 12. disable operation of the normal mode waveform generation section with tior. 13. disable channel 3 and 4 output with toer. 14. select the complementary pwm output level and cyclic output enabling/disabling with tocr. 15. set complementary pwm. 16. enable channel 3 and 4 output with toer. 17. set mtu output with the pfc. 18. operation is restarted by tstr.
417 (6) operation when error occurs during normal mode operation, and operation is restarted in reset-synchronous pwm mode: figure 12.101 shows an explanatory diagram of the case where an error occurs in normal mode and operation is restarted in reset-synchronous pwm mode after re-setting. 1 reset 2 tmdr (normal) 3 toer (1) 5 pfc (mtu) 4 tior (1 init 0 out) 6 tstr (1) 7 match 8 error occurs 9 pfc (port) 10 tstr (0) 11 tior (0 init 0 out) 12 tior ( disabled ) 13 toer (0) 14 tocr 15 tmdr (cpwm) 16 toer (1) 17 pfc (mtu) 18 tstr (1) mtu output tioc3a tioc3b tioc3d port output pe9 pe8 pe11 high-z high-z high-z figure 12.101 error occurrence in normal mode, recovery in reset-synchronous pwm?ode 1 to 13 are the same as in figure 12.100. 14. select the reset-synchronous pwm output level and cyclic output enabling/disabling with tocr. 15. set reset-synchronous pwm. 16. enable channel 3 and 4 output with toer. 17. set mtu output with the pfc. 18. operation is restarted by tstr.
418 (7) operation when error occurs during pwm mode 1 operation, and operation is restarted in normal mode: figure 12.102 shows an explanatory diagram of the case where an error occurs in pwm mode 1 and operation is restarted in normal mode after re-setting. 1 reset 2 tmdr (pwm1) 3 toer (1) 5 pfc (mtu) 4 tior (1 init 0 out) 6 tstr (1) 7 match 8 error occurs 9 pfc (port) 10 tstr (0) 11 tmdr (normal) 12 tior (1 init 0 out) 13 pfc (mtu) 14 tstr (1) mtu output tioc*a tioc*b port output pen pen ?not initialized (tioc*b) n=0 to 15 high-z high-z figure 12.102 error occurrence in pwm mode 1, recovery in normal mode 1. after a reset, mtu output is low and ports are in the high-impedance state. 2. set pwm mode 1. 3. for channels 3 and 4, enable output with toer before initializing the pins with tior. 4. initialize the pins with tior. (the example shows initial high output, with low output on compare-match occurrence. in pwm mode 1, the tioc*b side is not initialized.) 5. set mtu output with the pfc. 6. the count operation is started by tstr. 7. output goes low on compare-match occurrence. 8. an error occurs. 9. set port output with the pfc and output the inverse of the active level. 10. the count operation is stopped by tstr. 11. set normal mode. 12. initialize the pins with tior. 13. set mtu output with the pfc. 14. operation is restarted by tstr.
419 (8) operation when error occurs during pwm mode 1 operation, and operation is restarted in pwm mode 1: figure 12.103 shows an explanatory diagram of the case where an error occurs in pwm mode 1 and operation is restarted in pwm mode 1 after re-setting. 1 reset 2 tmdr (pwm1) 3 toer (1) 5 pfc (mtu) 4 tior (1 init 0 out) 6 tstr (1) 7 match 8 error occurs 9 pfc (port) 10 tstr (0) 11 tmdr (pwm1) 12 tior (1 init 0 out) 13 pfc (mtu) 14 tstr (1) mtu output tioc*a tioc*b port output pen pen ?not initialized (tioc*b) ?not initialized (tioc*b) n=0 to 15 high-z high-z figure 12.103 error occurrence in pwm mode 1, recovery in pwm mode 1 1 to 10 are the same as in figure 12.102. 11. not necessary when restarting in pwm mode 1. 12. initialize the pins with tior. (in pwm mode 1, the tioc*b side is not initialized.) 13. set mtu output with the pfc. 14. operation is restarted by tstr.
420 (9) operation when rrror occurs during pwm mode 1 operation, and operation is restarted in pwm mode 2: figure 12.104 shows an explanatory diagram of the case where an error occurs in pwm mode 1 and operation is restarted in pwm mode 2 after re-setting. 1 reset 2 tmdr (pwm1) 3 toer (1) 5 pfc (mtu) 4 tior (1 init 0 out) 6 tstr (1) 7 match 8 error occurs 9 pfc (port) 10 tstr (0) 11 tmdr (pwm2) 12 tior (1 init 0 out) 13 pfc (mtu) 14 tstr (1) mtu output tioc*a tioc*b port output pen pen ?not initialized (tioc*b) ?not initialized (cycle register) n=0 to 15 high-z high-z figure 12.104 error occurrence in pwm mode 1, recovery in pwm mode 2 1 to 10 are the same as in figure 12.102. 11. set pwm mode 2. 12. initialize the pins with tior. (in pwm mode 2, the cycle register pins are not initialized.) 13. set mtu output with the pfc. 14. operation is restarted by tstr. note: pwm mode 2 can only be set for channels 0?, and therefore toer setting is not necessary.
421 (10) operation when error occurs during pwm mode 1 operation, and operation is restarted in phase counting mode: figure 12.105 shows an explanatory diagram of the case where an error occurs in pwm mode 1 and operation is restarted in phase counting mode after re- setting. 1 reset 2 tmdr (pwm1) 3 toer (1) 5 pfc (mtu) 4 tior (1 init 0 out) 6 tstr (1) 7 match 8 error occurs 9 pfc (port) 10 tstr (0) 11 tmdr (pcm) 12 tior (1 init 0 out) 13 pfc (mtu) 14 tstr (1) mtu output tioc*a tioc*b port output pen pen ?not initialized (tioc*b) n=0 to 15 high-z high-z figure 12.105 error occurrence in pwm mode 1, recovery in phase counting mode 1 to 10 are the same as in figure 12.102. 11. set phase counting mode. 12. initialize the pins with tior. 13. set mtu output with the pfc. 14. operation is restarted by tstr. note: phase counting mode can only be set for channels 1 and 2, and therefore toer setting is not necessary.
422 (11) operation when error occurs during pwm mode 1 operation, and operation is restarted in complementary pwm mode: figure 12.106 shows an explanatory diagram of the case where an error occurs in pwm mode 1 and operation is restarted in complementary pwm mode after re-setting. 1 reset 2 tmdr (pwm1) 3 toer (1) 5 pfc (mtu) 4 tior (1 init 0 out) 6 tstr (1) 7 match 8 error occurs 9 pfc (port) 10 tstr (0) 11 tmdr (normal) 12 tior (0 init 0 out) 13 tior ( disabled ) 14 toer (0) 15 tocr 16 tmdr (cpwm) 17 toer (1) 18 pfc (mtu) 19 tstr (1) mtu output tioc3a tioc3b tioc3d port output pe9 pe8 pe11 ?not initialized (tioc3b) ?not initialized (tioc3d) high-z high-z high-z figure 12.106 error occurrence in pwm mode 1, recovery in complementary pwm?ode 1 to 10 are the same as in figure 12.102. 11. set normal mode for initialization of the normal mode waveform generation section. 12. initialize the pwm mode 1 waveform generation section with tior. 13. disable operation of the pwm mode 1 waveform generation section with tior. 14. disable channel 3 and 4 output with toer. 15. select the complementary pwm output level and cyclic output enabling/disabling with tocr. 16. set complementary pwm. 17. enable channel 3 and 4 output with toer. 18. set mtu output with the pfc. 19. operation is restarted by tstr.
423 (12) operation when error occurs during pwm mode 1 operation, and operation is restarted in reset-synchronous pwm mode: figure 12.107 shows an explanatory diagram of the case where an error occurs in pwm mode 1 and operation is restarted in reset-synchronous pwm mode after re-setting. 1 reset 2 tmdr (pwm1) 3 toer (1) 5 pfc (mtu) 4 tior (1 init 0 out) 6 tstr (1) 7 match 8 error occurs 9 pfc (port) 10 tstr (0) 11 tmdr (normal) 12 tior (0 init 0 out) 13 tior ( disabled ) 14 toer (0) 15 tocr 16 tmdr (rpwm) 17 toer (1) 18 pfc (mtu) 19 tstr (1) mtu output tioc3a tioc3b tioc3d port output pe9 pe8 pe11 ?not initialized (tioc3b) ?not initialized (tioc3d) high-z high-z high-z figure 12.107 error occurrence in pwm mode 1, recovery in reset-synchronous pwm?ode 1 to 14 are the same as in figure 12.106. 15. select the reset-synchronous pwm output level and cyclic output enabling/disabling with tocr. 16. set reset-synchronous pwm. 17. enable channel 3 and 4 output with toer. 18. set mtu output with the pfc. 19. operation is restarted by tstr.
424 (13) operation when error occurs during pwm mode 2 operation, and operation is restarted in normal mode: figure 12.108 shows an explanatory diagram of the case where an error occurs in pwm mode 2 and operation is restarted in normal mode after re-setting. 1 reset 2 tmdr (pwm2) 3 tior (1 init 0 out) 5 tstr (1) 4 pfc (mtu) 6 match 7 error occurs 8 pfc (port) 9 tstr (0) 10 tmdr (normal) 11 tior (1 init 0 out) 12 pfc (mtu) 13 tstr (1) mtu output tioc*a tioc*b port output pen pen ?not initialized (cycle register) n=0 to 15 high-z high-z figure 12.108 error occurrence in pwm mode 2, recovery in normal mode 1. after a reset, mtu output is low and ports are in the high-impedance state. 2. set pwm mode 2. 3. initialize the pins with tior. (the example shows initial high output, with low output on compare-match occurrence. in pwm mode 2, the cycle register pins are not initialized. in the example, tioc *a is the cycle register.) 4. set mtu output with the pfc. 5. the count operation is started by tstr. 6. output goes low on compare-match occurrence. 7. an error occurs. 8. set port output with the pfc and output the inverse of the active level. 9. the count operation is stopped by tstr. 10. set normal mode. 11. initialize the pins with tior. 12. set mtu output with the pfc. 13. operation is restarted by tstr.
425 (14) operation when error occurs during pwm mode 2 operation, and operation is restarted in pwm mode 1: figure 12.109 shows an explanatory diagram of the case where an error occurs in pwm mode 2 and operation is restarted in pwm mode 1 after re-setting. 1 reset 2 tmdr (pwm2) 3 tior (1 init 0 out) 5 tstr (1) 4 pfc (mtu) 6 match 7 error occurs 8 pfc (port) 9 tstr (0) 10 tmdr (pwm1) 11 tior (1 init 0 out) 12 pfc (mtu) 13 tstr (1) mtu output tioc*a tioc*b port output pen pen ?not initialized (tioc*b) ?not initialized (cycle register) n=0 to 15 high-z high-z figure 12.109 error occurrence in pwm mode 2, recovery in pwm mode 1 1 to 9 are the same as in figure 12.108. 10. set pwm mode 1. 11. initialize the pins with tior. (in pwm mode 1, the tioc*b side is not initialized.) 12. set mtu output with the pfc. 13. operation is restarted by tstr.
426 (15) operation when error occurs during pwm mode 2 operation, and operation is restarted in pwm mode 2: figure 12.110 shows an explanatory diagram of the case where an error occurs in pwm mode 2 and operation is restarted in pwm mode 2 after re-setting. 1 reset 2 tmdr (pwm2) 3 tior (1 init 0 out) 5 tstr (1) 4 pfc (mtu) 6 match 7 error occurs 8 pfc (port) 9 tstr (0) 10 tmdr (pwm2) 11 tior (1 init 0 out) 12 pfc (mtu) 13 tstr (1) mtu output tioc*a tioc*b port output pen pen ?not initialized (cycle register) ?not initialized (cycle register) n=0 to 15 high-z high-z figure 12.110 error occurrence in pwm mode 2, recovery in pwm mode 2 1 to 9 are the same as in figure 12.108. 10. not necessary when restarting in pwm mode 2. 11. initialize the pins with tior. (in pwm mode 2, the cycle register pins are not initialized.) 12. set mtu output with the pfc. 13. operation is restarted by tstr.
427 (16) operation when error occurs during pwm mode 2 operation, and operation is restarted in phase counting mode: figure 12.111 shows an explanatory diagram of the case where an error occurs in pwm mode 2 and operation is restarted in phase counting mode after re- setting. 1 reset 2 tmdr (pwm2) 3 tior (1 init 0 out) 5 tstr (1) 4 pfc (mtu) 6 match 7 error occurs 8 pfc (port) 9 tstr (0) 10 tmdr (pcm) 11 tior (1 init 0 out) 12 pfc (mtu) 13 tstr (1) mtu output tioc*a tioc*b port output pen pen ?not initialized (cycle register) n=0 to 15 high-z high-z figure 12.111 error occurrence in pwm mode 2, recovery in phase counting mode 1 to 9 are the same as in figure 12.108. 10. set phase counting mode. 11. initialize the pins with tior. 12. set mtu output with the pfc. 13. operation is restarted by tstr.
428 (17) operation when error occurs during phase counting mode operation, and operation is restarted in normal mode: figure 12.112 shows an explanatory diagram of the case where an error occurs in phase counting mode and operation is restarted in normal mode after re-setting. 1 reset 2 tmdr (pcm) 3 tior (1 init 0 out) 5 tstr (1) 4 pfc (mtu) 6 match 7 error occurs 8 pfc (port) 9 tstr (0) 10 tmdr (normal) 11 tior (1 init 0 out) 12 pfc (mtu) 13 tstr (1) mtu output tioc*a tioc*b port output pen pen n=0 to 15 high-z high-z figure 12.112 error occurrence in phase counting mode, recovery in normal mode 1. after a reset, mtu output is low and ports are in the high-impedance state. 2. set phase counting mode. 3. initialize the pins with tior. (the example shows initial high output, with low output on compare-match occurrence.) 4. set mtu output with the pfc. 5. the count operation is started by tstr. 6. output goes low on compare-match occurrence. 7. an error occurs. 8. set port output with the pfc and output the inverse of the active level. 9. the count operation is stopped by tstr. 10. set in normal mode. 11. initialize the pins with tior. 12. set mtu output with the pfc. 13. operation is restarted by tstr.
429 (18) operation when error occurs during phase counting mode operation, and operation is restarted in pwm mode 1: figure 12.113 shows an explanatory diagram of the case where an error occurs in phase counting mode and operation is restarted in pwm mode 1 after re-setting. 1 reset 2 tmdr (pcm) 3 tior (1 init 0 out) 5 tstr (1) 4 pfc (mtu) 6 match 7 error occurs 8 pfc (port) 9 tstr (0) 10 tmdr (pwm1) 11 tior (1 init 0 out) 12 pfc (mtu) 13 tstr (1) mtu output tioc*a tioc*b port output pen pen ?not initialized (tioc*b) n=0 to 15 high-z high-z figure 12.113 error occurrence in phase counting mode, recovery in pwm mode 1 1 to 9 are the same as in figure 12.112. 10. set pwm mode 1. 11. initialize the pins with tior. (in pwm mode 1, the tioc *b side is not initialized.) 12. set mtu output with the pfc. 13. operation is restarted by tstr.
430 (19) operation when error occurs during phase counting mode operation, and operation is restarted in pwm mode 2: figure 12.114 shows an explanatory diagram of the case where an error occurs in phase counting mode and operation is restarted in pwm mode 2 after re-setting. 1 reset 2 tmdr (pcm) 3 tior (1 init 0 out) 5 tstr (1) 4 pfc (mtu) 6 match 7 error occurs 8 pfc (port) 9 tstr (0) 10 tmdr (pwm2) 11 tior (1 init 0 out) 12 pfc (mtu) 13 tstr (1) mtu output tioc*a tioc*b port output pen pen n=0 to 15 high-z high-z ?not initialized (cycle register) figure 12.114 error occurrence in phase counting mode, recovery in pwm mode 2 1 to 9 are the same as in figure 12.112. 10. set pwm mode 2. 11. initialize the pins with tior. (in pwm mode 2, the cycle register pins are not initialized.) 12. set mtu output with the pfc. 13. operation is restarted by tstr.
431 (20) operation when error occurs during phase counting mode operation, and operation is restarted in phase counting mode: figure 12.115 shows an explanatory diagram of the case where an error occurs in phase counting mode and operation is restarted in phase counting mode after re-setting. 1 reset 2 tmdr (pcm) 3 tior (1 init 0 out) 5 tstr (1) 4 pfc (mtu) 6 match 7 error occurs 8 pfc (port) 9 tstr (0) 10 tmdr (pcm) 11 tior (1 init 0 out) 12 pfc (mtu) 13 tstr (1) mtu output tioc*a tioc*b port output pen pen n=0 to 15 high-z high-z figure 12.115 error occurrence in phase counting mode, recovery in phase counting?ode 1 to 9 are the same as in figure 12.112. 10. not necessary when restarting in phase counting mode. 11. initialize the pins with tior. 12. set mtu output with the pfc. 13. operation is restarted by tstr.
432 (21) operation when error occurs during complementary pwm mode operation, and operation is restarted in normal mode: figure 12.116 shows an explanatory diagram of the case where an error occurs in complementary pwm mode and operation is restarted in normal mode after re-setting. 1 reset 2 tocr 3 tmdr (cpwm) 5 pfc (mtu) 4 toer (1) 6 tstr (1) 7 match 8 error occurs 9 pfc (port) 10 tstr (0) 11 tmdr (normal) 12 tior (1 init 0 out) 13 pfc (mtu) 14 tstr (1) mtu output tioc3a tioc3b tioc3d port output pe9 pe8 pe11 high-z high-z high-z figure 12.116 error occurrence in complementary pwm mode, recovery in normal?ode 1. after a reset, mtu output is low and ports are in the high-impedance state. 2. select the complementary pwm output level and cyclic output enabling/disabling with tocr. 3. set complementary pwm. 4. enable channel 3 and 4 output with toer. 5. set mtu output with the pfc. 6. the count operation is started by tstr. 7. the complementary pwm waveform is output on compare-match occurrence. 8. an error occurs. 9. set port output with the pfc and output the inverse of the active level. 10. the count operation is stopped by tstr. (mtu output becomes the complementary pwm output initial value.) 11. set normal mode. (mtu output goes low.) 12. initialize the pins with tior. 13. set mtu output with the pfc. 14. operation is restarted by tstr.
433 (22) operation when error occurs during complementary pwm mode operation, and operation is restarted in pwm mode 1: figure 12.117 shows an explanatory diagram of the case where an error occurs in complementary pwm mode and operation is restarted in pwm mode 1 after re-setting. 1 reset 2 tocr 3 tmdr (cpwm) 5 pfc (mtu) 4 toer (1) 6 tstr (1) 7 match 8 error occurs 9 pfc (port) 10 tstr (0) 11 tmdr (pwm1) 12 tior (1 init 0 out) 13 pfc (mtu) 14 tstr (1) mtu output tioc3a tioc3b tioc3d port output pe9 pe8 pe11 ?not initialized (tioc3b) ?not initialized (tioc3d) high-z high-z high-z figure 12.117 error occurrence in complementary pwm mode, recovery in pwm mode? 1 to 10 are the same as in figure 12.116. 11. set pwm mode 1. (mtu output goes low.) 12. initialize the pins with tior. (in pwm mode 1, the tioc *b side is not initialized.) 13. set mtu output with the pfc. 14. operation is restarted by tstr.
434 (23a) operation when error occurs during complementary pwm mode operation, and operation is restarted in complementary pwm mode: figure 12.118 shows an explanatory diagram of the case where an error occurs in complementary pwm mode and operation is restarted in complementary pwm mode after re-setting (when operation is restarted using the cycle and duty settings at the time the counter was stopped). 1 reset 2 tocr 3 tmdr (cpwm) 5 pfc (mtu) 4 toer (1) 6 tstr (1) 7 match 8 error occurs 9 pfc (port) 10 tstr (0) 11 pfc (mtu) 12 tstr (1) 13 match mtu output tioc3a tioc3b tioc3d port output pe9 pe8 pe11 high-z high-z high-z figure 12.118 error occurrence in complementary pwm mode, recovery in complementary pwm mode 1 to 10 are the same as in figure 12.116. 11. set mtu output with the pfc. 12. operation is restarted by tstr. 13. the complementary pwm waveform is output on compare-match occurrence.
435 (23b) operation when error occurs during complementary pwm mode operation, and operation is restarted in complementary pwm mode: figure 12.119 shows an explanatory diagram of the case where an error occurs in complementary pwm mode and operation is restarted in complementary pwm mode after re-setting (when operation is restarted using completely new cycle and duty settings). 1 reset 2 tocr 3 tmdr (cpwm) 5 pfc (mtu) 4 toer (1) 6 tstr (1) 7 match 8 error occurs 9 pfc (port) 10 tstr (0) 11 tmdr (normal) 12 toer (0) 13 tocr 14 tmdr (cpwm) 15 toer (1) 16 pfc (mtu) 17 tstr (1) mtu output tioc3a tioc3b tioc3d port output pe9 pe8 pe11 high-z high-z high-z figure 12.119 error occurrence in complementary pwm mode, recovery in complementary pwm mode 1 to 10 are the same as in figure 12.116. 11. set normal mode and make new settings. (mtu output goes low.) 12. disable channel 3 and 4 output with toer. 13. select the complementary pwm mode output level and cyclic output enabling/disabling with tocr. 14. set complementary pwm. 15. enable channel 3 and 4 output with toer. 16. set mtu output with the pfc. 17. operation is restarted by tstr.
436 (24) operation when error occurs during complementary pwm mode operation, and operation is restarted in reset-synchronous pwm mode: figure 12.120 shows an explanatory diagram of the case where an error occurs in complementary pwm mode and operation is restarted in reset-synchronous pwm mode. 1 reset 2 tocr 3 tmdr (cpwm) 5 pfc (mtu) 4 toer (1) 6 tstr (1) 7 match 8 error occurs 9 pfc (port) 10 tstr (0) 11 tmdr (normal) 12 toer (0) 13 tocr 14 tmdr (rpwm) 15 toer (1) 16 pfc (mtu) 17 tstr (1) mtu output tioc3a tioc3b tioc3d port output pe9 pe8 pe11 high-z high-z high-z figure 12.120 error occurrence in complementary pwm mode, recovery?n?eset-synchronous pwm mode 1 to 10 are the same as in figure 12.116. 11. set normal mode. (mtu output goes low.) 12. disable channel 3 and 4 output with toer. 13. select the reset-synchronous pwm mode output level and cyclic output enabling/disabling with tocr. 14. set reset-synchronous pwm. 15. enable channel 3 and 4 output with toer. 16. set mtu output with the pfc. 17. operation is restarted by tstr.
437 (25) operation when error occurs during reset-synchronous pwm mode operation, and operation is restarted in normal mode: figure 12.121 shows an explanatory diagram of the case where an error occurs in reset-synchronous pwm mode and operation is restarted in normal mode after re-setting. 1 reset 2 tocr 3 tmdr (cpwm) 5 pfc (mtu) 4 toer (1) 6 tstr (1) 7 match 8 error occurs 9 pfc (port) 10 tstr (0) 11 tmdr (normal) 12 tior (1 init 0 out) 13 pfc (mtu) 14 tstr (1) mtu output tioc3a tioc3b tioc3d port output pe9 pe8 pe11 high-z high-z high-z figure 12.121 error occurrence in reset-synchronous pwm mode, recovery?n?ormal?ode 1. after a reset, mtu output is low and ports are in the high-impedance state. 2. select the reset-synchronous pwm output level and cyclic output enabling/disabling with tocr. 3. set reset-synchronous pwm. 4. enable channel 3 and 4 output with toer. 5. set mtu output with the pfc. 6. the count operation is started by tstr. 7. the reset-synchronous pwm waveform is output on compare-match occurrence. 8. an error occurs. 9. set port output with the pfc and output the inverse of the active level. 10. the count operation is stopped by tstr. (mtu output becomes the reset-synchronous pwm output initial value.) 11. set normal operating mode. (mtu positive phase output is low, and negative phase output is high.) 12. initialize the pins with tior. 13. set mtu output with the pfc. 14. operation is restarted by tstr.
438 (26) operation when error occurs during reset-synchronous pwm mode operation, and operation is restarted in pwm mode 1: figure 12.122 shows an explanatory diagram of the case where an error occurs in reset-synchronous pwm mode and operation is restarted in pwm mode 1 after re-setting. 1 reset 2 tocr 3 tmdr (rpwm) 5 pfc (mtu) 4 toer (1) 6 tstr (1) 7 match 8 error occurs 9 pfc (port) 10 tstr (0) 11 tmdr (pwm1) 12 tior (1 init 0 out) 13 pfc (mtu) 14 tstr (1) mtu output tioc3a tioc3b tioc3d port output pe9 pe8 pe11 ?not initialized (tioc3b) ?not initialized (tioc3d) high-z high-z high-z figure 12.122 error occurrence in reset-synchronous pwm mode, recovery?n?wm?ode 1 1 to 10 are the same as in figure 12.121. 11. set pwm mode 1. (mtu positive phase output is low, and negative phase output is high.) 12. initialize the pins with tior. (in pwm mode 1, the tioc *b side is not initialized.) 13. set mtu output with the pfc. 14. operation is restarted by tstr.
439 (27) operation when error occurs during reset-synchronous pwm mode operation, and operation is restarted in complementary pwm mode: figure 12.123 shows an explanatory diagram of the case where an error occurs in reset-synchronous pwm mode and operation is restarted in complementary pwm mode after re-setting. 1 reset 2 tocr 3 tmdr (rpwm) 5 pfc (mtu) 4 toer (1) 6 tstr (1) 7 match 8 error occurs 9 pfc (port) 10 tstr (0) 11 toer (0) 12 tocr 13 tmdr (cpwm) 14 toer (1) 15 pfc (mtu) 16 tstr (1) mtu output tioc3a tioc3b tioc3d port output pe9 pe8 pe11 high-z high-z high-z figure 12.123 error occurrence in reset-synchronous pwm mode, recovery?n?omplementary pwm mode 1 to 10 are the same as in figure 12.121. 11. disable channel 3 and 4 output with toer. 12. select the complementary pwm output level and cyclic output enabling/disabling with tocr. 13. set complementary pwm. (the mtu cyclic output pin goes low.) 14. enable channel 3 and 4 output with toer. 15. set mtu output with the pfc. 16. operation is restarted by tstr.
440 (28) operation when error occurs during reset-synchronous pwm mode operation, and operation is restarted in reset-synchronous pwm mode: figure 12.124 shows an explanatory diagram of the case where an error occurs in reset-synchronous pwm mode and operation is restarted in reset-synchronous pwm mode after re-setting. 1 reset 2 tocr 3 tmdr (rpwm) 5 pfc (mtu) 4 toer (1) 6 tstr (1) 7 match 8 error occurs 9 pfc (port) 10 tstr (0) 11 pfc (mtu) 12 tstr (1) 13 match mtu output tioc3a tioc3b tioc3d port output pe9 pe8 pe11 high-z high-z high-z high-z high-z high-z figure 12.124 error occurrence in reset-synchronous pwm mode, recovery?n?eset-synchronous pwm mode 1 to 10 are the same as in figure 12.121. 11. set mtu output with the pfc. 12. operation is restarted by tstr. 13. the reset-synchronous pwm waveform is output on compare-match occurrence.
441 12.9 port output enable (poe) the port output enable (poe) can be used to establish a high-impedance state for high-current pins, by changing the poe0 poe3 pin input, depending on the output status of the high-current pins (pe09/tioc3b, pe11/tioc3d, pe12/tioc4a, pe13/tioc4b/ mres , pe14/tioc4c/dack0/ ah , pe15/tioc4d/dack1/ irqout ). it can also simultaneously generate interrupt requests. the high-current pins also become high-impedance regardless of whether these pin functions are selected in cases such as when the oscillator stops or in standby mode. refer to section 4, clock pulse generator, for details. 12.9.1 features each of the poe0 poe3 input pins can be set for falling edge, f /8 16, f /16 16, or f /128 16 low-level sampling. high-current pins can be set to high-impedance state by poe0 poe3 pin falling-edge or low- level sampling. high-current pins can be set to high-impedance state when the high-current pin output levels are compared and simultaneous low-level output continues for one cycle or more (except in the 33.3 mhz version). interrupts can be generated by input-level sampling or output-level comparison results.
442 12.9.2 block diagram the poe has input-level detection circuitry and output-level detection circuitry, as shown in the block diagram of figure 12.125. tioc3b tioc3d tioc4a tioc4c tioc4b tioc4d poe3 poe2 poe1 poe0 output level detection circuit output level detection circuit output level detection circuit input level detection circuit falling-edge detection circuit low-level detection circuit ocsr icsr f /8 f /16 f /128 high- impedance request control signal interrupt request figure 12.125 poe block diagram
443 12.9.3 pin configuration table 12.18 shows the poe pins. table 12.18 pin configuration name abbreviation i/o description port output enable input pins poe0 poe3 input input request signals to make high- current pins high-impedance state table 12.19 shows output-level comparisons with pin combinations. table 12.19 output level comparisons pin combination i/o description pe09/tioc3b and pe11/tioc3d output all high-current pins are made high-impedance state when the pins simultaneously output low-level for longer than 1 cycle. pe12/tioc4a and pe14/tioc4c/dack0/ ah output all high-current pins are made high-impedance state when the pins simultaneously output low-level for longer than 1 cycle. pe13/tioc4b/ mres and pe15/tioc4d/dack1/ irqout output all high-current pins are made high-impedance state when the pins simultaneously output low-level for longer than 1 cycle. 12.9.4 register configuration the poe has the two registers shown in table 12.20. the input level control/status register (icsr) controls both poe0 poe3 pin input signal detection and interrupts. the output level control/status register (ocsr) controls both the enable/disable of output comparison and interrupts. table 12.20 input level control/status register configuration name abbreviation r/w initial value address access size input level control/status register icsr r/(w)* 1 h'0000 h'ffff83c0 h'ffff83c1 8, 16, 32 output level control/status register ocsr r/(w)* 2 h'0000 h'ffff83c2 h'ffff83c3 8, 16, 32 notes: 1. only 0 writes to bits 15?2 are possible to clear the flags. 2. only 0 writes to bits 15 are possible to clear the flags.
444 12.10 poe register descriptions 12.10.1 input level control/status register (icsr) the input level control/status register (icsr) is a 16-bit read/write register that selects the poe0 poe3 pin input modes, controls the enable/prohibit of interrupts, and indicates status. if any of the poe3f?oe0f bits are set to 1, the high current pins become high impedance state. icsr is initialized to h'0000 by power-on resets; however, it is not initialized for manual resets, standby mode, or sleep mode, so the previous data is maintained. bit: 15 14 13 12 11 10 9 8 poe3f poe2f poe1f poe0f pie initial value: 0 0 0 0 0 0 0 0 r/w: r/(w)* r/(w)* r/(w)* r/(w)* r r r r/w bit: 7 6 5 4 3 2 1 0 poe3m1 poe3m0 poe2m1 poe2m0 poe1m1 poe1m0 poe0m1 poe0m0 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 note: only 0 writes are possible to clear the flags. bit 15?oe3 flag (poe3f): this flag indicates that a high impedance request has been input to the poe3 pin. bit 15: poe3f description 0 clear condition: by writing 0 to poe3f after reading a poe3f = 1 (initial value) 1 set condition: when the input set by icsr bits 7 and 6 occurs at the poe3 pin bit 14?oe2 flag (poe2f): this flag indicates that a high impedance request has been input to the poe2 pin. bit 14: poe2f description 0 clear condition: by writing 0 to poe2f after reading a poe2f = 1 (initial value) 1 set condition: when the input set by icsr bits 5 and 4 occurs at the poe2 pin
445 bit 13?oe1 flag (poe1f): this flag indicates that a high impedance request has been input to the poe1 pin. bit 13: poe1f description 0 clear condition: by writing 0 to poe1f after reading a poe1f = 1 (initial value) 1 set condition: when the input set by icsr bits 3 and 2 occurs at the poe1 pin bit 12?oe0 flag (poe0f): this flag indicates that a high impedance request has been input to the poe0 pin. bit 12: poe0f description 0 clear condition: by writing 0 to poe0f after reading a poe0f = 1 (initial value) 1 set condition: when the input set by icsr bits 1 and 0 occurs at the poe0 pin bits 11??eserved: these bits always read as 0. the write value should always be 0. bit 8?ort interrupt enable (pie): enables or disables interrupt requests when any of the poe0f?oe3f bits of the icsr are set to 1. bit 8: pie description 0 interrupt requests disabled (initial value) 1 interrupt requests enabled bits 7 and 6?oe3 mode 1, 0 (poe3m1 and poe3m0): these bits select the input mode of the poe3 pin. bit 7: poe3m1 bit 6: poe3m0 description 0 0 accept request on falling edge of poe3 input. (initial value) 1 accept request when poe3 input has been sampled for 16 f /8 clock pulses, and all are low level. 1 0 accept request when poe3 input has been sampled for 16 f /16 clock pulses, and all are low level. 1 accept request when poe3 input has been sampled for 16 f /128 clock pulses, and all are low level.
446 bits 5 and 4?oe2 mode 1, 0 (poe2m1 and poe2m0): these bits select the input mode of the poe2 pin. bit 5: poe2m1 bit 4: poe2m0 description 0 0 accept request on falling edge of poe2 input. (initial value) 1 accept request when poe2 input has been sampled for 16 f /8 clock pulses, and all are low level. 1 0 accept request when poe2 input has been sampled for 16 f /16 clock pulses, and all are low level. 1 accept request when poe2 input has been sampled for 16 f /128 clock pulses, and all are low level. bits 3 and 2?oe1 mode 1, 0 (poe1m1 and poe1m0): these bits select the input mode of the poe1 pin. bit 3: poe1m1 bit 2: poe1m0 description 0 0 accept request on falling edge of poe1 input. (initial value) 1 accept request when poe1 input has been sampled for 16 f /8 clock pulses, and all are low level. 1 0 accept request when poe1 input has been sampled for 16 f /16 clock pulses, and all are low level. 1 accept request when poe1 input has been sampled for 16 f /128 clock pulses, and all are low level. bits 1 and 0?oe0 mode 1, 0 (poe0m1 and poe0m0): these bits select the input mode of the poe0 pin. bit 1: poe0m1 bit 0: poe0m0 description 0 0 accept request on falling edge of poe0 input. (initial value) 1 accept request when poe0 input has been sampled for 16 f /8 clock pulses, and all are low level. 1 0 accept request when poe0 input has been sampled for 16 f /16 clock pulses, and all are low level. 1 accept request when poe0 input has been sampled for 16 f /128 clock pulses, and all are low level.
447 12.10.2 output level control/status register (ocsr) the output level control/status register (ocsr) is a 16-bit read/write register that controls the enable/disable of both output level comparison and interrupts, and indicates status. if the osf bit is set to 1, the high current pins become high impedance. ocsr is initialized to h'0000 by an external power-on reset; however, it is not initialized for manual resets, reset by wdt standby mode, or sleep mode, so the previous data is maintained. bit: 15 14 13 12 11 10 9 8 osf oce oie initial value: 0 0 0 0 0 0 0 0 r/w: r/(w)* r r r r r r/w r/w bit: 7 6 5 4 3 2 1 0 initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r r r note: only 0 writes are possible to clear the flag. bit 15?utput short flag (osf): this flag indicates that among the three pairs of 2 phase outputs compared, the outputs of at least one pair have simultaneously become low level output. bit 15: osf description 0 clear condition: by writing 0 to osf after reading an osf = 1 (initial value) 1 set condition: when any one pair of the 2-phase outputs simultaneously become low level bits 14?0?eserved: these bits always read as 0. the write value should always be 0.
448 bit 9?utput level compare enable (oce): this bit enables the start of output level comparisons. when setting this bit, pay special attention to the output pin combinations shown in table 12.19. when 0 is output, the osf bit is set to 1 at the same time this bit is set, and output goes to high impedance. accordingly, bits 15?1 and bit 9 of the port e data register (pedr) are set to 1. for the mtu output comparison, set the bit to 1 after setting the mtu? output pins with the pfc. set this bit only when using pins as outputs. when the oce bit is set to 1, if oie = 0 a high-impedance request will not be issued even if osf is set to 1. therefore, in order to have a high-impedance request issued according to the result of the output comparison, the oie bit must be set to 1. when oce = 1 and oie = 1, an interrupt request will be generated at the same time as the high-impedance request; however, this interrupt can be masked by means of an interrupt controller (intc) setting. bit 9: oce description 0 output level compare disabled (initial value) 1 output level compare enabled; makes an output high impedance request when osf = 1. bit 8?utput short interrupt enable (oie): makes interrupt requests when the osf bit of the ocsr is set. bit 8: oie description 0 interrupt requests disabled (initial value) 1 interrupt requests enabled bits 7??eserved: always read as 0, and cannot be modified.
449 12.11 operation 12.11.1 input level detection operation if the input conditions set by the icsr occur on any of the poe pins, all high-current pins become high-impedance state. falling edge detection: when a change from high to low level is input to the poe pins. low-level detection: figure 12.126 shows the low-level detection operation. sixteen continuous low levels are sampled with the sampling clock established by the icsr. if even one high level is detected during this interval, the low level is not accepted. ck sampling clock 3 poe input pe9/tioc3b when low level is sampled at all points when high level is sampled at least once flag set (poe received) flag not set high-impedance state* note: other large-current pins (pe11/tioc3d, pe12/tioc4a, pe13/tioc4b/ mres , pe14/tioc4c/dack0/ah, pe15/tioc4d/dack1/ iroout ) also go to the high-impedance state at the same time. 2 1 2 1 16 13 8/16/128 clock cycles figure 12.126 low-level detection operation
450 12.11.2 output-level compare operation figure 12.127 shows an example of the output-level compare operation for the combination of pe09/tioc3b and pe11/tioc3d. the operation is the same for the other pin combinations. ck pe11/ tioc3d pe09/ tioc3b 0 level overlapping detected high impedance state figure 12.127 output-level detection operation 12.11.3 release from high-impedance state high-current pins that have entered high-impedance state due to input-level detection can be released either by returning them to their initial state with a power-on reset, or by clearing all of the bit 12?5 (poe0f?oe3f) flags of the icsr. high-current pins that have become high- impedance due to output-level detection can be released either by returning them to their initial state with a power-on reset, or by first clearing bit 9 (oce) of the ocsr to disable output-level compares, then clearing the bit 15 (osf) flag. however, when returning from high-impedance state by clearing the osf flag, always do so only after outputting a high level from the high- current pins (tioc3b, tioc3d, tioc4a, tioc4b, tioc4c, and tioc4d). high-level outputs can be achieved by setting the mtu internal registers. see section 12.2, mtu register descriptions, for details.
451 12.11.4 poe timing figure 12.128 shows an example of timing from poe input to high impedance of pin. poe input ck last transition ck pe9/tioc3b last transition edge detected high impedance state note: other high current pins (pe11/tico3d, pe12/tioc4a, pe13/tioc4b/ mres , pe14/tioc4c/dack0/ ah , pe15/tioc4d/dack1/ irqout ) will enter the high impedance state with the same timing figure 12.128 last transition edge detection operation
453 section 13 watchdog timer (wdt) 13.1 overview the watchdog timer (wdt) is a 1-channel timer for monitoring system operations. if a system encounters a problem (crashes, for example) 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 the 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. 13.1.1 features ? works in watchdog timer mode or interval timer mode. ? 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 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. ? clears standby mode. ? works with eight counter input clocks.
454 13.1.2 block diagram figure 13.1 is the block diagram of the wdt. f /2 f /64 f /128 f /256 f /512 f /1024 f /4096 f /8192 internal clock sources clock overflow clock select interrupt control reset control rstcsr tcsr: tcnt: rstcsr: note: timer control/status register timer counter reset control/status register the internal reset signal can be generated by setting the register. the type of reset can be selected (power-on or manual). tcnt tcsr module bus bus interface internal data bus iti (interrupt signal) wdtovf internal reset signal* wdt figure 13.1 wdt block diagram 13.1.3 pin configuration table 13.1 shows the pin configuration. table 13.1 pin configuration pin abbreviation i/o function watchdog timer overflow wdtovf o outputs the counter overflow signal in the watchdog timer mode
455 13.1.4 register configuration table 13.2 summarizes the three wdt registers. they are used to select the clock, switch the wdt mode, and control the reset signal. table 13.2 wdt registers address name abbreviation r/w initial value write* 1 read* 2 timer control/status register tcsr r/(w)* 3 h'18 h'ffff8610 h'ffff8610 timer counter tcnt r/w h'00 h'ffff8611 reset control/status register rstcsr r/(w)* 3 h'1f h'ffff8612 h'ffff8613 notes: 1. write by word transfer. it cannot be written in byte or longword. 2. read by byte transfer. it cannot be read in word or longword. 3. only 0 can be written in bit 7 to clear the flag. 13.2 register descriptions 13.2.1 timer counter (tcnt) the tcnt is an 8-bit read/write upcounter. (the tcnt differs from other registers in that it is more difficult to write to. see section 13.2.4, register access, for details.) when the timer enable bit (tme) in the timer control/status register (tcsr) is set to 1, the watchdog timer counter starts counting pulses of an internal clock selected by clock select bits 2? (cks2?ks0) in the tcsr. when the value of the tcnt overflows (changes from h'ff to h'00), a watchdog timer overflow signal ( wdtovf ) or interval timer interrupt (iti) is generated, depending on the mode selected in the wt/ it bit of the tcsr. the tcnt is initialized to h'00 by a power-on reset and when the tme bit is cleared to 0. it is not initialized in the standby mode. the tcnt is not initialized by a manual reset from an external source ( mres ), but is initialized by a manual reset from the wdt. bit: 7 6 5 4 3 2 1 0 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
456 13.2.2 timer control/status register (tcsr) the timer control/status register (tcsr) is an 8-bit read/write register. (the tcsr differs from other registers in that it is more difficult to write to. see section 13.2.4, register access, for details.) its functions include selecting the timer mode and clock source. bits 7? are initialized to 000 by a power-on reset or in standby mode. bits 2? are initialized to 000 by a power-on reset, but retain their values in the standby mode. these bits are not initialized by a manual reset from an external source ( mres ), but are initialized by a manual reset from the wdt. bit: 7 6 5 4 3 2 1 0 ovf wt/ it tme cks2 cks1 cks0 initial value: 0 0 0 1 1 0 0 0 r/w: r/(w) r/w r/w r r r/w r/w r/w ? bit 7?verflow flag (ovf): indicates that the tcnt has overflowed from h'ff to h'00 in the interval timer mode. it is not set in the watchdog timer mode. bit 7: ovf description 0 no overflow of tcnt in interval timer mode (initial value) cleared by reading ovf, then writing 0 in ovf 1 tcnt overflow in the interval timer mode ? bit 6?imer mode select (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 (iti) or generates a wdtovf signal, depending on the mode selected. bit 6: wt/ it description 0 interval timer mode: interval timer interrupt request to the cpu when tcnt overflows (initial value) 1 watchdog timer mode: wdtovf signal output externally when tcnt overflows. (section 13.2.3, reset control/status register (rstcsr), describes in detail what happens when tcnt overflows in the watchdog timer mode.)
457 ? bit 5?imer enable (tme): enables or disables the timer. bit 5: tme description 0 timer disabled: tcnt is initialized to h'00 and count-up stops (initial value) 1 timer enabled: tcnt starts counting. a wdtovf signal or interrupt is generated when tcnt overflows. ? bits 4 and 3?eserved: these bits always read as 1. the write value should always be 1. ? bits 2?: clock select 2? (cks2?ks0): these bits 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 ( f ). description bit 2: cks2 bit 1: cks1 bit 0: cks0 clock source overflow interval* ( f = 28.7 mhz) 00 0 f /2 (initial value) 17.9 ? 00 1 f /64 573.4 ? 01 0 f /128 1.1 ms 01 1 f /256 2.3 ms 10 0 f /512 4.6 ms 10 1 f /1024 9.2 ms 11 0 f /4096 36.7 ms 11 1 f /8192 73.4 ms note: the overflow interval listed is the time from when the tcnt begins counting at h'00 until an overflow occurs.
458 13.2.3 reset control/status register (rstcsr) the rstcsr is an 8-bit readable and writable register. (the rstcsr differs from other registers in that it is more difficult to write. see section 13.2.4, register access, for details.) it controls output of the internal reset signal generated by timer counter (tcnt) overflow and selects the internal reset signal type. rstcr is initialized to h'1f 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'1f in standby mode. bit: 7 6 5 4 3 2 1 0 wovf rste rsts initial value: 0 0 0 1 1 1 1 1 r/w: r/(w)* r/w r/w r r r r r note: only 0 can be written in bit 7 to clear the flag. ? bit 7?atchdog timer overflow flag (wovf): indicates that the tcnt has overflowed (h'ff?'00) in the watchdog timer mode. it is not set in the interval timer mode. bit 7: wovf description 0 no tcnt overflow in watchdog timer mode (initial value) cleared when software reads wovf, then writes 0 in wovf 1 set by tcnt overflow in watchdog timer mode ? bit 6?eset enable (rste): selects whether to reset the chip internally if the tcnt overflows in the watchdog timer mode. bit 6: rste description 0 not reset when tcnt overflows (initial value). lsi not reset internally, but tcnt and tcsr reset within wdt. 1 reset when tcnt overflows ? bit 5?eset select (rsts): selects the type of internal reset generated if the tcnt overflows in the watchdog timer mode. bit 5: rsts description 0 power-on reset (initial value) 1 manual reset ? bits 4??eserved: these bits always read as 1. the write value should always be 1.
459 13.2.4 register access the watchdog timer? tcnt, tcsr, and rstcsr registers differ from other registers in that they are more difficult to write to. 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'5a (for the tcnt) or h'a5 (for the tcsr) (figure 13.2). this transfers the write data from the lower byte to the tcnt or tcsr. h'5a h'ffff8610 address: writing to the tcnt 15 8 7 0 write data h'a5 h'ffff8610 address: writing to the tcsr 15 8 7 0 write data figure 13.2 writing to the tcnt and tcsr writing to the rstcsr: the rstcsr must be written by a word access to address h'ffff8612. 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 5) are different, as shown in figure 13.3. to write 0 in the wovf bit, the write data must be h'a5 in the upper byte and h'00 in the lower byte. this clears the wovf bit to 0. the rste and rsts bits are not affected. to write to the rste and rsts bits, the upper byte must be h'5a 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.
460 h'a5 h'ffff8612 address: writing 0 to the wovf bit 15 8 7 0 h'00 h'5a h'ffff8612 address: writing to the rste and rsts bits 15 8 7 0 write data figure 13.3 writing to the rstcsr 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'ffff8610 for the tcsr, h'ffff8611 for the tcnt, and h'ffff8613 for the rstcsr. 13.3 operation 13.3.1 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'00) before overflow occurs. no tcnt overflows will occur while the system is operating normally, but if the tcnt fails to be rewritten and overflows occur due to a system crash or the like, a wdtovf signal is output externally (figure 13.4). the wdtovf signal can be used to reset the system. the wdtovf signal is output for 128 f 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 f clock cycles. when a watchdog overflow reset is generated simultaneously with a reset input at the res pin, the res reset takes priority, and the wovf bit is cleared to 0. the following are not initialized a wdt reset signal: ? the mtu? poe (port output enable) function register ? pfc (pin function controller) function register ? i/o port register initializing is only possible by external power-on reset.
461 h'ff h'00 overflow wt/ it = 1 tme = 1 h'00 written in tcnt internal reset signal* wdtovf signal tcnt value wdtovf and internal reset generated wovf = 1 wt/ it = 1 tme = 1 wt/ it : tme: timer mode select bit timer enable bit h'00 written in tcnt time 512 f clocks 128 f clocks note: internal reset si g nal occurs onl y when the rste bit is set to 1. figure 13.4 operation in the watchdog timer mode
462 13.3.2 interval timer mode to use the wdt as an interval timer, clear wt/ it 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 13.5). h'ff tcnt value iti: interval timer interrupt request generation h'00 wt/ it = 0 tme = 1 iti iti iti iti time overflow overflow overflow overflow figure 13.5 operation in the interval timer mode 13.3.3 clearing 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. before 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?ks0 so that the counter overflow interval is equal to or longer than the oscillation settling time. see section 25.3, ac characteristics, 26.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 incrementing at the rate selected by bits cks2?ks0 before the standby mode was entered. when the tcnt overflows (changes from h'ff to h'00), the clock 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 24, power down state.
463 13.3.4 timing of setting the overflow flag (ovf) in the interval timer mode, when the tcnt overflows, the ovf flag of the tcsr is set to 1 and an interval timer interrupt is simultaneously requested (figure 13.6). h'ff h'00 ck tcnt overflow signal (internal signal) ovf figure 13.6 timing of setting the ovf 13.3.5 timing of setting the watchdog timer overflow flag (wovf) when the tcnt overflows in the watchdog timer mode, the wovf bit of the rstcsr is set to 1 and a wdtovf signal is output. when the rste bit is set to 1, tcnt overflow enables an internal reset signal to be generated for the entire chip (figure 13.7). h'ff h'00 ck tcnt overflow signal (internal signal) wovf figure 13.7 timing of setting the wovf bit
464 13.4 notes on use 13.4.1 tcnt write and increment contention if a timer counter (tcnt) increment clock pulse is generated during the t 3 state of a write cycle to the tcnt, the write takes priority and the timer counter is not incremented (figure 13.8). ck address internal write signal tcnt input clock tcnt nm tcnt address counter write data t 1 t 2 t 3 tcnt write cycle figure 13.8 contention between tcnt write and increment 13.4.2 changing cks2?ks0 bit values if the values of bits cks2?ks0 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?ks0. 13.4.3 changing between watchdog timer/interval 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.
465 13.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 13.9. reset input reset signal to entire system sh7040 series res wdtovf figure 13.9 example of a system reset circuit with a wdtovf signal 13.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 the wdt will reset.
467 section 14 serial communication interface (sci) 14.1 overview the sh7040 series has a serial communication interface (sci) with two independent channels, both of which possess the same functions. the sci supports both asynchronous and clock synchronous serial communication. it also has a multiprocessor communication function for serial communication among two or more processors. 14.1.1 features select asynchronous or clock synchronous as the serial communications mode. ? 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 clock 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 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)/data transfer controller (dtc) to transfer data.
468 14.1.2 block diagram figure 14.1 shows a block diagram of the sci. parity generation parity check transmit/ receive control baud rate generator clock external clock bus interface internal data bus rxd rdr tdr rsr tsr ssr scr smr brr f f /4 f /16 f /64 tei txi rxi eri sck : : : : rsr rdr tsr tdr receive shift register receive data register transmit shift register transmit data register : : : : smr scr ssr brr serial mode register serial control register serial status register bit rate register txd sci module data bus figure 14.1 sci block diagram
469 14.1.3 pin configuration table 14.1 summarizes the sci pins by channel. table 14.1 sci pins channel pin name abbreviation input/output function 0 serial clock pin sck0 input/output sci0 clock input/output receive data pin rxd0 input sci0 receive data input transmit data pin txd0 output sci0 transmit data output 1 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 14.1.4 register configuration table 14.2 summarizes the sci internal registers. these registers select the communication mode (asynchronous or clock synchronous), specify the data format and bit rate, and control the transmitter and receiver sections. table 14.2 registers channel name abbreviation r/w initial value address* 2 access size 0 serial mode register smr0 r/w h'00 h'ffff81a0 8, 16 bit rate register brr0 r/w h'ff h'ffff81a1 8, 16 serial control register scr0 r/w h'00 h'ffff81a2 8, 16 transmit data register tdr0 r/w h'ff h'ffff81a3 8, 16 serial status register ssr0 r/(w) * 1 h'84 h'ffff81a4 8, 16 receive data register rdr0 r h'00 h'ffff81a5 8, 16 1 serial mode register smr1 r/w h'00 h'ffff81b0 8, 16 bit rate register brr1 r/w h'ff h'ffff81b1 8, 16 serial control register scr1 r/w h'00 h'ffff81b2 8, 16 transmit data register tdr1 r/w h'ff h'ffff81b3 8, 16 serial status register ssr1 r/(w) * 1 h'84 h'ffff81b4 8, 16 receive data register rdr1 r h'00 h'ffff81b5 8, 16 notes: 1. the only value that can be written is a 0 to clear the flags. 2. do not access empty addresses.
470 14.2 register descriptions 14.2.1 receive shift register (rsr) the receive shift register (rsr) receives serial data. data input at the rxd pin is loaded into the rsr in the order received, lsb (bit 0) first, converting the data to parallel form. when one byte has been received, it is automatically transferred to the rdr. the cpu cannot read or write the rsr directly. bit: 7 6 5 4 3 2 1 0 r/w: 14.2.2 receive data register (rdr) 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 cpu can read but not write the rdr. the rdr is initialized to h'00 by a power-on reset or in standby mode. manual reset does not initialize rdr. bit: 7 6 5 4 3 2 1 0 initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r r r 14.2.3 transmit shift register (tsr) the transmit shift register (tsr) transmits serial data. the sci loads transmit data from the transmit data register (tdr) 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 tdr into the tsr and starts transmitting again. if the tdre bit of the ssr is 1, however, the sci does not load the tdr contents into the tsr.
471 the cpu cannot read or write the tsr directly. bit: 7 6 5 4 3 2 1 0 r/w: 14.2.4 transmit data register (tdr) the transmit data register (tdr) is an 8-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 tdr into the tsr and starts serial transmission. continuous serial transmission is possible by writing the next transmit data in the tdr during serial transmission from the tsr. the cpu can always read and write the tdr. the tdr is initialized to h'ff by a power-on reset or in standby mode. manual reset does not initialize tdr. bit: 7 6 5 4 3 2 1 0 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 14.2.5 serial mode register (smr) the serial mode register (smr) is an 8-bit register that specifies the sci serial communication format and selects the clock source for the baud rate generator. the cpu can always read and write the smr. the smr is initialized to h'00 by a power-on reset or in standby mode. manual reset does not initialize smr. bit: 7 6 5 4 3 2 1 0 c/ a chr pe o/ e stop mp cks1 cks0 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
472 bit 7?ommunication mode (c/ a ): selects whether the sci operates in the asynchronous or clock synchronous mode. bit 7: c/ a description 0 asynchronous mode (initial value) 1 clocked synchronous mode bit 6?haracter length (chr): selects 7-bit or 8-bit data in the asynchronous mode. in the clock synchronous mode, the data length is always eight bits, regardless of the chr setting. bit 6: chr description 0 eight-bit data (initial value) 1 seven-bit data. (when 7-bit data is selected, the msb (bit 7) of the transmit data register is not transmitted.) bit 5?arity enable (pe): selects whether to add a parity bit to transmit data and to check the parity of receive data, in the asynchronous mode. in the clock synchronous mode, a parity bit is neither added nor checked, regardless of the pe setting. bit 5: pe description 0 parity bit not added or checked (initial value) 1 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 (o/ e ) setting. receive data parity is checked according to the even/odd (o/ e ) mode setting. bit 4?arity mode (o/ e ): selects even or odd parity when parity bits are added and checked. the o/ e 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 o/ e setting is ignored in the clock synchronous mode, or in the asynchronous mode when parity addition and check is disabled. bit 4: o/ e description 0 even parity (initial value). if even parity is selected, the parity bit is added to transmit data to make an even number of 1s in the transmitted character and parity bit combined. receive data is checked to see if it has an even number of 1s in the received character and parity bit combined. 1 odd parity. if odd parity is selected, the parity bit is added to transmit data to make an odd number of 1s in the transmitted character and parity bit combined. receive data is checked to see if it has an odd number of 1s in the received character and parity bit combined.
473 bit 3?top bit length (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 clock 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, but if the second stop bit is 0, it is treated as the start bit of the next incoming character. bit 3: stop description 0 one stop bit (initial value). in transmitting, a single bit of 1 is added at the end of each transmitted character. 1 two stop bits. in transmitting, two bits of 1 are added at the end of each transmitted character. bit 2?ultiprocessor mode (mp): selects multiprocessor format. when multiprocessor format is selected, settings of the parity enable (pe) and parity mode (o/ e ) bits are ignored. the mp bit setting is used only in the asynchronous mode; it is ignored in the clock synchronous mode. for the multiprocessor communication function, see section 14.3.3, multiprocessor communication. bit 2: mp description 0 multiprocessor function disabled (initial value) 1 multiprocessor format selected bits 1 and 0?lock select 1 and 0 (cks1 and cks0): these bits select the internal clock source of the on-chip baud rate generator. four clock sources are available; f , f /4, f /16, or f /64. for further information on the clock source, bit rate register settings, and baud rate, see section 14.2.8, bit rate register. bit 1: cks1 bit 0: cks0 description 00 f (initial value) 1 f /4 10 f /16 1 f /64
474 14.2.6 serial control register (scr) the serial control register (scr) operates the sci transmitter/receiver, selects the serial clock output in the asynchronous mode, enables/disables interrupt requests, and selects the transmit/receive clock source. the cpu can always read and write the scr. the scr is initialized to h'00 by a power-on reset or in standby mode. manual reset does not initialize scr. bit: 7 6 5 4 3 2 1 0 tie rie te re mpie teie cke1 cke0 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 bit 7?ransmit interrupt enable (tie): enables or disables the transmit-data-empty interrupt (txi) requested when the transmit data register empty bit (tdre) in the serial status register (ssr) is set to 1 by transfer of serial transmit data from the tdr to the tsr. bit 7: tie description 0 transmit-data-empty interrupt request (txi) is disabled (initial value). the txi interrupt request can be cleared by reading tdre after it has been set to 1, then clearing tdre to 0, or by clearing tie to 0. 1 transmit-data-empty interrupt request (txi) is enabled bit 6?eceive interrupt enable (rie): enables or disables the receive-data-full interrupt (rxi) requested when the receive data register full bit (rdrf) in the serial status register (ssr) is set to 1 by transfer of serial receive data from the rsr to the rdr. it also enables or disables receive-error interrupt (eri) requests. bit 6: rie description 0 receive-data-full interrupt (rxi) and receive-error interrupt (eri) requests are disabled (initial value). rxi and eri interrupt requests can be cleared by reading the rdrf flag or error flag (fer, per, or orer) after it has been set to 1, then clearing the flag to 0, or by clearing rie to 0. 1 receive-data-full interrupt (rxi) and receive-error interrupt (eri) requests are enabled.
475 bit 5?ransmit enable (te): enables or disables the sci serial transmitter. bit 5: te description 0 transmitter disabled (initial value). the transmit data register empty bit (tdre) in the serial status register (ssr) is locked at 1. 1 transmitter enabled. serial transmission starts when the transmit data register empty (tdre) bit in the serial status register (ssr) is cleared to 0 after writing of transmit data into the tdr. select the transmit format in the smr before setting te to 1. bit 4?eceive enable (re): enables or disables the sci serial receiver. bit 4: re description 0 receiver disabled (initial value). clearing re to 0 does not affect the receive flags (rdrf, fer, per, orer). these flags retain their previous values. 1 receiver enabled. serial reception starts when a start bit is detected in the asynchronous mode, or synchronous clock input is detected in the clock synchronous mode. select the receive format in the smr before setting re to 1. bit 3?ultiprocessor interrupt enable (mpie): enables or disables multiprocessor interrupts. the mpie setting is used only in the asynchronous mode, and only if the multiprocessor mode bit (mp) in the serial mode register (smr) is set to 1 during reception. the mpie setting is ignored in the clock synchronous mode or when the mp bit is cleared to?. bit 3: mpie description 0 multiprocessor interrupts are disabled (normal receive operation) (initial value). mpie is cleared when the mpie bit is cleared to 0, or the multiprocessor bit (mpb) is set to 1 in receive data. 1 multiprocessor interrupts are enabled. receive-data-full interrupt requests (rxi), receive-error interrupt requests (eri), and setting of the rdrf, fer, and orer status flags in the serial status register (ssr) are disabled until data with the multiprocessor bit set to 1 is received. the sci does not transfer receive data from the rsr to the rdr, does not detect receive errors, and does not set the rdrf, fer, and orer flags in the serial status register (ssr). when it receives data that includes mpb = 1, mpb is set to 1, and the sci automatically clears mpie to 0, generates rxi and eri interrupts (if the tie and rie bits in the scr are set to 1), and allows the fer and orer bits to be set.
476 bit 2?ransmit-end interrupt enable (teie): enables or disables the transmit-end interrupt (tei) requested if tdr does not contain valid transmit data when the msb is transmitted. bit 2: teie description 0 transmit-end interrupt (tei) requests are disabled* (initial value) 1 transmit-end interrupt (tei) requests are enabled.* note: the tei request can be cleared by reading the tdre bit in the serial status register (ssr) after it has been set to 1, then clearing tdre to 0 and clearing the transmit end (tend) bit to 0; or by clearing the teie bit to 0. bits 1 and 0?lock enable 1 and 0 (cke1 and cke0): these bits select the sci clock source and enable or disable clock output from the sck pin. depending on the combination of cke1 and cke0, the sck pin can be used for serial clock output, or serial clock input. select the sck pin function by using the pin function controller (pfc). the cke0 setting is valid only in the asynchronous mode, and only when the sci is internally clocked (cke1 = 0). the cke0 setting is ignored in the clock synchronous mode, or when an external clock source is selected (cke1 = 1). select the sci operating mode in the serial mode register (smr) before setting cke1 and cke0. for further details on selection of the sci clock source, see table 14.9 in section 14.3, operation. bit 1: cke1 bit 0: cke0 description *1 0 0 asynchronous mode internal clock, sck pin used for input pin (input signal is ignored) or output pin (output level is undefined) *2 clock synchronous mode internal clock, sck pin used for synchronous clock output *2 0 1 asynchronous mode internal clock, sck pin used for clock output *3 clock synchronous mode internal clock, sck pin used for synchronous clock output 1 0 asynchronous mode external clock, sck pin used for clock input *4 clock synchronous mode external clock, sck pin used for synchronous clock input 1 1 asynchronous mode external clock, sck pin used for clock input *4 clock synchronous mode external clock, sck pin used for synchronous clock input notes: 1. the sck pin is multiplexed with other functions. use the pin function controller (pfc) to select the sck function for this pin, as well as the i/o direction. 2. initial value. 3. the output clock frequency is the same as the bit rate. 4. the input clock frequency is 16 times the bit rate.
477 14.2.7 serial status register (ssr) the serial status register (ssr) is an 8-bit register containing multiprocessor bit values, and status flags that indicate sci operating status. the cpu can always read and write the ssr, but cannot write 1 in the status flags (tdre, rdrf, orer, per, and fer). these flags can be cleared to 0 only if they have first been read (after being set to 1). bits 2 (tend) and 1 (mpb) are read-only bits that cannot be written. the ssr is initialized to h'84 by a power-on reset or in standby mode. manual reset does not initialize ssr. bit: 7 6 5 4 3 2 1 0 tdre rdrf orer fer per tend mpb mpbt initial value: 1 0 0 0 0 1 0 0 r/w: r/(w)* r/(w)* r/(w)* r/(w)* r/(w)* r r r/w note: the only value that can be written is a 0 to clear the flag. bit 7?ransmit data register empty (tdre): indicates that the sci has loaded transmit data from the tdr into the tsr and new serial transmit data can be written in the tdr. bit 7: tdre description 0 tdr contains valid transmit data tdre is cleared to 0 when software reads tdre after it has been set to 1, then writes 0 in tdre or the dmac or dtc writes data in tdr 1 tdr does not contain valid transmit data (initial value) tdre is set to 1 when the chip is power-on reset or enters standby mode, the te bit in the serial control register (scr) is cleared to 0, or tdr contents are loaded into tsr, so new data can be written in tdr
478 bit 6?eceive data register full (rdrf): indicates that rdr contains received data. bit 6: rdrf description 0 rdr does not contain valid received data (initial value) rdrf is cleared to 0 when the chip is power-on reset or enters standby mode, software reads rdrf after it has been set to 1, then writes 0 in rdrf, or the dmac or dtc reads data from rdr 1 rdr contains valid received data rdrf is set to 1 when serial data is received normally and transferred from rsr to rdr note: the rdr and rdrf are not affected by detection of receive errors or by clearing of the re bit to 0 in the serial control register. they retain their previous contents. if rdrf is still set to 1 when reception of the next data ends, an overrun error (orer) occurs and the received data is lost. bit 5?verrun error (orer): indicates that data reception ended abnormally due to an overrun error. bit 5: orer description 0 receiving is in progress or has ended normally (initial value). clearing the re bit to 0 in the serial control register does not affect the orer bit, which retains its previous value. orer is cleared to 0 when the chip is power-on reset or enters standby mode or software reads orer after it has been set to 1, then writes 0 in orer 1 a receive overrun error occurred. rdr continues to hold the data received before the overrun error, so subsequent receive data is lost. serial receiving cannot continue while orer is set to 1. in the clock synchronous mode, serial transmitting is disabled. orer is set to 1 if reception of the next serial data ends when rdrf is set to 1
479 bit 4?raming error (fer): indicates that data reception ended abnormally due to a framing error in the asynchronous mode. bit 4: fer description 0 receiving is in progress or has ended normally (initial value). clearing the re bit to 0 in the serial control register does not affect the fer bit, which retains its previous value. fer is cleared to 0 when the chip is power-on reset or enters standby mode or software reads fer after it has been set to 1, then writes 0 in fer 1 a receive framing error occurred. when the stop bit length is two bits, only the first bit is checked to see if it is a 1. the second stop bit is not checked. when a framing error occurs, the sci transfers the receive data into the rdr but does not set rdrf. serial receiving cannot continue while fer is set to 1. in the clock synchronous mode, serial transmitting is also disabled. fer is set to 1 if the stop bit at the end of receive data is checked and found to be 0 bit 3?arity error (per): indicates that data reception (with parity) ended abnormally due to a parity error in the asynchronous mode. bit 3: per description 0 receiving is in progress or has ended normally (initial value). clearing the re bit to 0 in the serial control register does not affect the per bit, which retains its previous value. per is cleared to 0 when the chip is power-on reset or enters standby mode or software reads per after it has been set to 1, then writes 0 in per 1 a receive parity error occurred. when a parity error occurs, the sci transfers the receive data into the rdr but does not set rdrf. serial receiving cannot continue while per is set to 1. in the clock synchronous mode, serial transmitting is also disabled. per is set to 1 if the number of 1s in receive data, including the parity bit, does not match the even or odd parity setting of the parity mode bit (o/ e ) in the serial mode register (smr)
480 bit 2?ransmit end (tend): indicates that when the last bit of a serial character was transmitted, the tdr did not contain valid data, so transmission has ended. tend is a read- only bit and cannot be written. bit 2: tend description 0 transmission is in progress tend is cleared to 0 when software reads tdre after it has been set to 1, then writes 0 in tdre, or the dmac or dtc writes data in tdr 1 end of transmission (initial value) tend is set to 1 when the chip is power-on reset or enters standby mode, te is cleared to 0 in the serial control register (scr), or tdre is 1 when the last bit of a one-byte serial character is transmitted. bit 1?ultiprocessor bit (mpb): stores the value of the multiprocessor bit in receive data when a multiprocessor format is selected for receiving in the asynchronous mode. the mpb is a read-only bit and cannot be written. bit 1: mpb description 0 multiprocessor bit value in receive data is 0 (initial value). if re is cleared to 0 when a multiprocessor format is selected, the mpb retains its previous?alue. 1 multiprocessor bit value in receive data is 1 bit 0?ultiprocessor bit transfer (mpbt): stores the value of the multiprocessor bit added to transmit data when a multiprocessor format is selected for transmitting in the asynchronous mode. the mpbt setting is ignored in the clock synchronous mode, when a multiprocessor format is not selected, or when the sci is not transmitting. bit 0: mpbt description 0 multiprocessor bit value in transmit data is 0 (initial value) 1 multiprocessor bit value in transmit data is 1
481 14.2.8 bit rate register (brr) the bit rate register (brr) is an 8-bit register that, together with the baud rate generator clock source selected by the cks1 and cks0 bits in the serial mode register (smr), determines the serial transmit/receive bit rate. the cpu can always read and write the brr. the brr is initialized to h'ff by a power-on reset or in standby mode. each channel has independent baud rate generator control, so different values can be set in the two channels. manual reset does not initialize brr. bit: 7 6 5 4 3 2 1 0 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 table 14.3 lists examples of brr settings in the asynchronous mode; table 14.4 lists examples of bbr settings in the clock synchronous mode. table 14.3 bit rates and brr settings in asynchronous mode f (mhz) bit rate 4 4.9152 6 (bits/s) n n error (%) n n error (%) n n error (%) 110 2 70 0.03 2 86 0.31 2 106 ?.44 150 1 207 0.16 1 255 0.00 2 77 0.16 300 1 103 0.16 1 127 0.00 1 155 0.16 600 0 207 0.16 0 255 0.00 1 77 0.16 1200 0 103 0.16 0 127 0.00 0 155 0.16 2400 0 51 0.16 0 63 0.00 0 77 0.16 4800 0 25 0.16 0 31 0.00 0 38 0.16 9600 0 12 0.16 0 15 0.00 0 19 ?.34 14400 0 8 ?.55 0 10 ?.03 0 12 0.16 19200 0 6 ?.99 0 7 0.00 0 9 ?.34 28800 0 3 8.51 0 4 6.67 0 6 ?.99 31250 0 3 0.00 0 4 ?.70 0 5 0.00 38400 0 2 8.51 0 3 0.00 0 4 ?.34
482 table 14.3 bit rates and brr settings in asynchronous mode (cont) f (mhz) bit rate 7.3728 8 9.8304 (bits/s) n n error (%) n n error (%) n n error (%) 110 2 130 ?.07 2 141 0.03 2 174 ?.26 150 2 95 0.00 2 103 0.16 2 127 0.00 300 1 191 0.00 1 207 0.16 1 255 0.00 600 1 95 0.00 1 103 0.16 1 127 0.00 1200 0 191 0.00 0 207 0.16 0 255 0.00 2400 0 95 0.00 0 103 0.16 0 127 0.00 4800 0 47 0.00 0 51 0.16 0 63 0.00 9600 0 23 0.00 0 25 0.16 0 31 0.00 14400 0 15 0.00 0 16 2.12 0 20 1.59 19200 0 11 0.00 0 12 0.16 0 15 0.00 28800 0 7 0.00 0 8 ?.55 0 10 ?.03 31250 0 6 5.33 0 7 0.00 0 9 ?.70 38400 0 5 0.00 0 6 ?.99 0 7 0.00
483 table 14.3 bit rates and brr settings in asynchronous mode (cont) f (mhz) bit rate 10 11.0592 12 (bits/s) n n error (%) n n error (%) n n error (%) 110 2 177 ?.25 2 195 0.19 2 212 0.03 150 2 129 0.16 2 143 0.00 2 155 0.16 300 2 64 0.16 2 71 0.00 2 77 0.16 600 1 129 0.16 1 143 0.00 1 155 0.16 1200 1 64 0.16 1 71 0.00 1 77 0.16 2400 0 129 0.16 0 143 0.00 0 155 0.16 4800 0 64 0.16 0 71 0.00 0 77 0.16 9600 0 32 ?.36 0 35 0.00 0 38 0.16 14400 0 21 ?.36 0 23 0.00 0 25 0.16 19200 0 15 1.73 0 17 0.00 0 19 ?.34 28800 0 10 ?.36 0 11 0.00 0 12 0.16 31250 0 9 0.00 0 10 0.54 0 11 0.00 38400 0 7 1.73 0 8 0.00 0 9 ?.34
484 table 14.3 bit rates and brr settings in asynchronous mode (cont) f (mhz) bit rate 12.288 14 14.7456 (bits/s) n n error (%) n n error (%) n n error (%) 110 2 217 0.08 2 248 ?.17 3 64 0.70 150 2 159 0.00 2 181 0.16 2 191 0.00 300 2 79 0.00 2 90 0.16 2 95 0.00 600 1 159 0.00 1 181 0.16 1 191 0.00 1200 1 79 0.00 1 90 0.16 1 95 0.00 2400 0 159 0.00 0 181 0.16 0 191 0.00 4800 0 79 0.00 0 90 0.16 0 95 0.00 9600 0 39 0.00 0 45 ?.93 0 47 0.00 14400 0 26 ?.23 0 29 1.27 0 31 0.00 19200 0 19 0.00 0 22 ?.93 0 23 0.00 28800 0 12 2.56 0 14 1.27 0 15 0.00 31250 0 11 2.40 0 13 0.00 0 14 ?.70 38400 0 9 0.00 0 10 3.57 0 11 0.00
485 table 14.3 bit rates and brr settings in asynchronous mode (cont) f (mhz) bit rate 16 17.2032 18 (bits/s) n n error (%) n n error (%) n n error (%) 110 3 70 0.03 3 75 0.48 3 79 ?.12 150 2 207 0.16 2 223 0.00 2 233 0.16 300 2 103 0.16 2 111 0.00 2 116 0.16 600 1 207 0.16 1 223 0.00 1 233 0.16 1200 1 103 0.16 1 111 0.00 1 116 0.16 2400 0 207 0.16 0 223 0.00 0 233 0.16 4800 0 103 0.16 0 111 0.00 0 116 0.16 9600 0 51 0.16 0 55 0.00 0 58 ?.69 14400 0 34 ?.79 0 36 0.90 0 38 0.16 19200 0 25 0.16 0 27 0.00 0 28 1.02 28800 0 16 2.12 0 18 ?.75 0 19 ?.34 31250 0 15 0.00 0 16 1.20 0 17 0.00 38400 0 12 0.16 0 13 0.00 0 14 ?.34
486 table 14.3 bit rates and brr settings in asynchronous mode (cont) f (mhz) bit rate 18.432 19.6608 20 (bits/s) n n error (%) n n error (%) n n error (%) 110 3 81 ?.22 3 86 0.31 3 88 ?.25 150 2 239 0.00 2 255 0.00 3 64 0.16 300 2 119 0.00 2 127 0.00 2 129 0.16 600 1 239 0.00 1 255 0.00 2 64 0.16 1200 1 119 0.00 1 127 0.00 1 129 0.16 2400 0 239 0.00 0 255 0.00 1 64 0.16 4800 0 119 0.00 0 127 0.00 0 129 0.16 9600 0 59 0.00 0 63 0.00 0 64 0.16 14400 0 39 0.00 0 42 ?.78 0 42 0.94 19200 0 29 0.00 0 31 0.00 0 32 ?.36 28800 0 19 0.00 0 20 1.59 0 21 ?.36 31250 0 17 2.40 0 19 ?.70 0 19 0.00 38400 0 14 0.00 0 15 0.00 0 15 1.73
487 table 14.3 bit rates and brr settings in asynchronous mode (cont) f (mhz) bit rate 22 22.1184 24 (bits/s) n n error (%) n n error (%) n n error (%) 110 3 97 ?.35 3 97 0.19 3 106 ?.44 150 3 71 ?.54 3 71 0.00 3 77 0.16 300 2 142 0.16 2 143 0.00 2 155 0.16 600 2 71 ?.54 2 71 0.00 2 77 0.16 1200 1 142 0.16 1 143 0.00 1 155 0.16 2400 1 71 ?.54 1 71 0.00 1 77 0.16 4800 0 142 0.16 0 143 0.00 0 155 0.16 9600 0 71 ?.54 0 71 0.00 0 77 0.16 14400 0 47 ?.54 0 47 0.00 0 51 0.16 19200 0 35 ?.54 0 35 0.00 0 38 0.16 28800 0 23 ?.54 0 23 0.00 0 25 0.16 31250 0 21 0.00 0 21 0.54 0 23 0.00 38400 0 17 ?.54 0 17 0.00 0 19 ?.34
488 table 14.3 bit rates and brr settings in asynchronous mode (cont) f (mhz) bit rate 24.576 25.8048 26 (bits/s) n n error (%) n n error (%) n n error (%) 110 3 108 0.08 3 114 ?.40 3 114 0.36 150 3 79 0.00 3 83 0.00 3 84 ?.43 300 2 159 0.00 2 167 0.00 2 168 0.16 600 2 79 0.00 2 83 0.00 2 84 ?.43 1200 1 159 0.00 1 167 0.00 1 168 0.16 2400 1 79 0.00 1 83 0.00 1 84 ?.43 4800 0 159 0.00 0 167 0.00 0 168 0.16 9600 0 79 0.00 0 83 0.00 0 84 ?.43 14400 0 52 0.63 0 55 0.00 0 55 0.76 19200 0 39 0.00 0 41 0.00 0 41 0.76 28800 0 26 ?.23 0 27 0.00 0 27 0.76 31250 0 24 ?.70 0 25 ?.75 0 25 0.00 38400 0 19 0.00 0 20 0.00 0 20 0.76
489 table 14.3 bit rates and brr settings in asynchronous mode (cont) f (mhz) bit rate 27.0336 28 29.4912 (bits/s) n n error (%) n n error (%) n n error (%) 110 3 119 0.00 3 123 0.23 3 130 -0.07 150 3 87 0.00 3 90 0.16 3 95 0.00 300 2 175 0.00 2 181 0.16 2 191 0.00 600 2 87 0.00 2 90 0.16 2 95 0.00 1200 1 175 0.00 1 181 0.16 1 191 0.00 2400 0 87 0.00 1 90 0.16 1 95 0.00 4800 0 175 0.00 0 181 0.16 0 191 0.00 9600 0 87 0.00 0 90 0.16 0 95 0.00 14400 0 58 ?.56 0 60 ?.39 0 63 0.00 19200 0 43 0.00 0 45 0.93 0 47 0.00 28800 0 28 1.15 0 29 1.27 0 31 0.00 31250 0 26 0.12 0 27 0.00 0 28 1.69 38400 0 21 0.00 0 22 ?.93 0 23 0.00
490 table 14.3 bit rates and brr settings in asynchronous mode (cont) f (mhz) bit rate 30 31.9488 32 (bits/s) n n error (%) n n error (%) n n error (%) 110 3 132 0.13 3 141 -0.13 3 141 0.03 150 3 97 -0.35 3 103 0.00 3 103 0.16 300 2 194 0.16 2 207 0.00 2 207 0.16 600 2 97 -0.35 2 103 0.00 2 103 0.16 1200 1 194 0.16 1 207 0.00 1 207 0.16 2400 1 97 -0.35 1 103 0.00 1 103 0.16 4800 0 194 0.16 0 207 0.00 0 207 0.16 9600 0 97 -0.35 0 103 0.00 0 103 0.16 14400 0 64 0.16 0 68 0.48 0 68 0.64 19200 0 48 -0.35 0 51 0.00 0 51 0.16 28800 0 32 -1.36 0 34 -0.95 0 34 -0.79 31250 0 29 0.00 0 31 -0.16 0 31 0.00 38400 0 23 1.73 0 25 0.00 0 25 0.16
491 table 14.3 bit rates and brr settings in asynchronous mode (cont) f (mhz) bit rate 33 33.1776 33.3333 (bits/s) n n error (%) n n error (%) n n error (%) 110 3 145 0.33 3 146 0.19 3 147 -0.02 150 3 106 0.39 3 107 0.00 3 108 -0.45 300 2 214 -0.07 2 215 0.00 2 216 0.01 600 2 106 0.39 2 107 0.00 2 108 -0.45 1200 1 214 -0.07 1 215 0.00 1 216 0.01 2400 1 106 0.39 1 107 0.00 1 108 -0.45 4800 0 214 -0.07 0 215 0.00 0 216 0.01 9600 0 106 0.39 0 107 0.00 0 108 -0.45 14400 0 71 ?.54 0 91 0.00 0 91 0.47 19200 0 53 ?.54 0 53 0.00 0 53 0.47 28800 0 35 ?.54 0 35 0.00 0 35 0.47 31250 0 32 0.00 0 32 0.54 0 32 1.01 38400 0 26 ?.54 0 26 0.00 0 26 0.47
492 table 14.4 bit rates and brr settings in clocked synchronous mode f (mhz) bit rate 4 8 10 12 (bits/s) n n n n n n n n 110 3 141 250 2 249 3 124 3 155 3 187 500 2 124 2 249 3 77 3 93 1k 1 249 2 124 2 155 2 187 2.5k 1 99 1 199 1 249 2 74 5k 0 199 1 99 1 124 1 149 10k 0 99 0 199 0 249 1 74 25k 0 39 0 79 0 99 0 119 50k 0 19 0 39 0 49 0 59 100k 0 9 0 19 0 24 0 29 250k 0 3 0 7 0 9 0 11 500k 0 1 0 3 0 4 0 5 1m 0 0* 0 1 0 2 2.5m 0 0* 0 0* 5m
493 table 14.4 bit rates and brr settings in clocked synchronous mode (cont) f (mhz) bit rate 16 20 24 28 (bits/s) n n n n n n n n 110 250 3 249 500 3 124 3 155 3 187 3 218 1k 2 249 3 77 3 93 3 108 2.5k 2 99 2 124 2 149 2 174 5k 1 199 1 249 2 74 2 87 10k 1 99 1 124 1 149 1 174 25k 0 159 0 199 0 239 1 69 50k 0 79 0 99 0 119 0 139 100k 0 39 0 49 0 59 0 69 250k 0 15 0 19 0 23 0 27 500k 0 7 0 9 0 11 0 13 1m 0 3 0 4 0 5 0 6 2.5m 0 1 0 2 5m 0 0* 0 1 7m 0 0*
494 table 14.4 bit rates and brr settings in clocked synchronous mode (cont) f (mhz) bit rate 30 32 33 33.3333 (bits/s) n n n n n n n n 110 250 500 3 233 3 249 1k 3 116 3 124 3 128 3 129 2.5k 2 187 2 199 2 205 2 207 5k 2 93 2 99 2 102 2 103 10k 1 187 1 199 1 205 1 207 25k 1 74 1 79 1 82 1 82 50k 0 149 0 159 0 164 0 166 100k 0 74 0 79 0 82 0 82 250k 0 29 0 31 0 32 0 32 500k 0 14 0 15 0 16 0 16 1m 0 7 0 7 0 7 0 7 2.5m 0 2 0 2 0 2 5m 7m note: settings with an error of 1% or less are recommended. legend blank: no setting available ? setting possible, but error occurs *: continuous transmission/reception is not possible. the brr setting is calculated as follows: asynchronous mode: n= 64 2 b 10 1 2n1 6 f synchronous mode: n= 64 2 b 10 1 2n1 6 f
495 b: bit rate (bit/s) n: baud rate generator brr setting (0 n 255) f : operating frequency (mhz) n: baud rate generator input clock (n = 0 to 3) (see the following table for the clock sources and value of n.) smr settings n clock source cks1 cks2 0 f 00 1 f /4 0 1 2 f /16 1 0 3 f /64 1 1 the bit rate error in asynchronous mode is calculated as follows: error (%) (n 1) b 64 2 1 2n1 = + ? y t f 10 100 6 table 14.5 indicates the maximum bit rates in the asynchronous mode when the baud rate generator is being used for various frequencies. tables 14.6 and 14.7 show the maximum rates for external clock input.
496 table 14.5 maximum bit rates for various frequencies with baud rate generator (asynchronous mode) settings f (mhz) maximum bit rate (bits/s) n n 4 125000 0 0 4.9152 153600 0 0 6 187500 0 0 7.3728 230400 0 0 8 250000 0 0 9.8304 307200 0 0 10 312500 0 0 11.0592 345600 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 18.432 576000 0 0 19.6608 614400 0 0 20 625000 0 0 22 687500 0 0 22.1184 691200 0 0 24 750000 0 0 24.576 768000 0 0 25.8048 806400 0 0 26 812500 0 0 27.0336 844800 0 0 28 875000 0 0 29.4912 921600 0 0 30 937500 0 0 31.9488 998400 0 0 32 1000000 0 0 33 1031250 0 0 33.1776 1036800 0 0 33.3333 1041666 0 0
497 table 14.6 maximum bit rates during external clock input (asynchronous mode) f (mhz) external input clock (mhz) maximum bit rate (bits/s) 4 1.0000 62500 4.9152 1.2288 76800 6 1.5000 93750 7.3728 1.8432 115200 8 2.0000 125000 9.8304 2.4576 153600 10 2.5000 156250 11.0592 2.7648 172800 12 3.0000 187500 12.288 3.0720 192000 14 3.5000 218750 14.7456 3.6864 230400 16 4.0000 250000 17.2032 4.3008 268800 18 4.5000 281250 18.432 4.6080 288000 19.6608 4.9152 307200 20 5.0000 312500 22 5.5000 343750 22.1184 5.5296 345600 24 6.0000 375000 24.576 6.1440 384000 25.8048 6.4512 403200 26 6.5000 406250 27.0336 6.7584 422400 28 7.0000 437500 29.4912 7.3728 460800 30 7.5000 468750 31.9488 7.9872 499200 32 8.0000 500000 33 8.2500 515625 33.1776 8.2944 518400 33.3333 8.3333 520832.8125
498 table 14.7 maximum bit rates during external clock input (clock synchronous mode) f (mhz) external input clock (mhz) maximum bit rate (bits/s) 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 22 3.6667 3666666.7 24 4.0000 4000000.0 26 4.3333 4333333.3 28 4.6667 4666666.7 30 5.0000 5000000.0 32 5.3333 5333333.3 33.3333 5.5556 5555550.0
499 14.3 operation 14.3.1 overview for serial communication, the sci has an asynchronous mode in which characters are synchronized individually, and a clock synchronous mode in which communication is synchronized with clock pulses. asynchronous/clock synchronous mode and the transmission format are selected in the serial mode register (smr), as shown in table 14.8. the sci clock source is selected by the c/ a bit in the serial mode register (smr) and the cke1 and cke0 bits in the serial control register (scr), as shown in table 14.9. asynchronous mode: data length is selectable: seven or eight bits. parity and multiprocessor bits are selectable, as well as the stop bit length (one or two bits). these selections determine the transmit/receive format and character length. in receiving, it is possible to detect framing errors (fer), parity errors (per), overrun errors (orer), 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 clock, and can output a clock 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.) clock synchronous mode: the communication format has a fixed 8-bit data length. 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 clock, and outputs a synchronous clock signal to external devices. ? when an external clock is selected, the sci operates on the input synchronous clock. the on-chip baud rate generator is not used.
500 table 14.8 serial mode register settings and sci communication formats smr settings sci communication format mode bit 7 c/ a bit 6 chr bit 5 pe bit 2 mp bit 3 stop data length parity bit multipro- cessor bit stop bit length asynchronous 0 0000 8-bit not set not set 1 bit 1 2 bits 1 0 set 1 bit 1 2 bits 1 0 0 7-bit not set 1 bit 1 2 bits 1 0 set 1 bit 1 2 bits asynchronous 0 * 1 0 8-bit not set set 1 bit (multiprocessor * 1 2 bits format) 1 * 0 7-bit 1 bit * 1 2 bits clock synchronous 1**** 8-bit not set none note: asterisks (*) in the table indicate don?-care bits. table 14.9 smr and scr settings and sci clock source selection smr scr settings sci transmit/receive clock mode bit 7 c/ a bit 1 cke1 bit 0 cke0 clock source sck pin function* asynchronous 0 0 0 internal sci does not use the sck pin 1 outputs a clock with frequency matching the bit rate 1 0 external inputs a clock with frequency 16 times the bit rate 1 clock synch- 1 0 0 internal outputs the synchronous clock ronous 1 1 0 external inputs the synchronous clock 1 note: * select the function in combination with the pin function controller (pfc).
501 14.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 14.2 shows the general format of asynchronous serial communication. in asynchronous serial communication, the communication line is normally held in the marking (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 first), 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. 0 d0d1d2d3d4d5d6d7 1 1 0/1 1 1 (lsb) (msb) serial data start bit 1 bit transmit/receive data 7 or 8 bits one unit of communication data (characters or frames) idling (marking state) parity bit stop bit 1 or no bit 1 or 2 bits figure 14.2 data format in asynchronous communication (example: 8-bit data with parity and two stop bits)
502 transmit/receive formats: table 14.10 shows the 11 communication formats that can be selected in the asynchronous mode. the format is selected by settings in the serial mode register (smr). table 14.10 serial communication formats (asynchronous mode) smr bits serial transmit/receive format and frame length chr pe mp stop 1 2345678 9 10 11 12 0 0 0 0 start 8-bit data stop 0 0 0 1 start 8-bit data stop stop 0 1 0 0 start 8-bit data p stop 0 1 0 1 start 8-bit data p stop stop 1 0 0 0 start 7-bit data stop 1 0 0 1 start 7-bit data stop stop 1 1 0 0 start 7-bit data p stop 1 1 0 1 start 7-bit data p stop stop 0 1 0 start 8-bit data mpb stop 0 1 1 start 8-bit data mpb stop stop 1 1 0 start 7-bit data mpb stop 1 1 1 start 7-bit data mpb stop stop ? don? 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 c/ a bit in the serial mode register (smr) and bits cke1 and cke0 in the serial control register (scr) (table 14.9).
503 when an external clock is input at the sck pin, it must have a frequency equal to 16 times the desired bit rate. when the sci operates on an internal clock, it can output a clock signal at the sck pin. the frequency of this output clock is equal to the bit rate. the phase is aligned as in figure 14.3 so that the rising edge of the clock occurs at the center of each transmit data bit. 0 d0d1d2d3d4d5d6d70/1 1 1 1 frame figure 14.3 output clock and communication data phase relationship (asynchronous mode) sci initialization (asynchronous mode): before transmitting or receiving, clear the te and re bits to 0 in the serial control register (scr), then initialize the sci as follows. when changing the operation mode or communication format, always clear the te and re bits to 0 before following the procedure given below. clearing te to 0 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. 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 14.4 is a sample flowchart for initializing the sci. the procedure is as follows (the steps correspond to the numbers in the flowchart): 1. select the clock source in the serial control register (scr). leave rie, tie, teie, mpie, te and re cleared to 0. if clock output is selected in asynchronous mode, clock output starts immediately after the setting is made to scr. 2. select the communication format in the serial mode register (smr). 3. write the value corresponding to the bit rate in the bit rate register (brr) unless an external clock is used. 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 1. also set rie, tie, teie and mpie as necessary. setting te or re enables the sci to use the txd or rxd pin. the initial states are the marking transmit state, and the idle receive state (waiting for a start bit).
504 initialize clear te and re bits to 0 in scr set cke1 and cke0 bits in scr (te and re bits are 0) select transmit/receive format in smr set value to brr wait set te or re to 1 in scr; set rie, tie, teie, and mpie as necessary 1-bit interval elapsed? end 1 2 3 4 no yes figure 14.4 sample flowchart for sci initialization transmitting serial data (asynchronous mode): figure 14.5 shows a sample flowchart for transmitting serial data. the procedure is as follows (the steps correspond to the numbers in the flowchart): 1. sci initialization: set the txd pin using 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?. 3. continue transmitting serial data: read the tdre bit to check whether it is safe to write (if it reads 1); if so, write data in tdr, then clear tdre to 0. when the dmac or the dtc is started by a transmit-data-empty interrupt request (txi) in order to write data in tdr, the tdre bit is checked and cleared automatically. 4. to output a break at the end of serial transmission, first clear the port data register (dr) to 0, then clear the te to 0 in scr and use the pfc to establish the txd pin as an output port.
505 start transmitting initialize read tdre bit in ssr read tend bit in ssr clear te bit in scr to 0; select thetxd pin as an output port with the pfc tend = 1? end transmission 1 2 3 no yes tdre = 1? write transmission data to tdr and clear tdre bit in ssr to 0 all data transmitted? no yes output break signal? no yes set dr = 0 4 yes no figure 14.5 sample flowchart for transmitting serial data
506 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: a. start bit: one 0 bit is output. b. transmit data: seven or eight bits of data are output, lsb first. c. 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. d. stop bit: one or two 1 bits (stop bits) are output. e. marking: output of 1 bits continues until the start bit of the next transmit data. 3. 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 1, the sci sets the tend bit to 1 in the ssr, outputs the stop bit, then continues output of 1 bits (marking). if the transmit-end interrupt enable bit (teie) in the scr is set to 1, a transmit-end interrupt (tei) is requested. figure 14.6 shows an example of sci transmit operation in the asynchronous mode.
507 01 1 1 0/1 0 1 tdre tend parity bit parity bit serial data start bit data stop bit start bit data stop bit idle (marking state) txi interrupt request txi interrupt handler writes data in tdr and clears tdre to 0 txi request tei interrupt request 1 frame d0 d1 d7 d0 d1 d7 0/1 example: 8-bit data with parity and one stop bit figure 14.6 sci transmit operation in asynchronous mode receiving serial data (asynchronous mode): figures 14.7 and 14.8 show a sample flowchart for receiving serial data. the procedure is as follows (the steps correspond to the numbers in the flowchart). 1. sci initialization: set the rxd pin using 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 0. receiving cannot resume if orer, per or fer remain 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 (ssr), check that rdrf is set to 1, then read receive data from the receive data register (rdr) and clear rdrf to 0. the rxi interrupt can also be used to determine if the rdrf bit has changed from 0 to 1. 4. continue receiving serial data: read the rdr and rdrf bit and clear rdrf to 0 before the stop bit of the current frame is received. if the dmac or the dtc is started by a receive-data- full interrupt (rxi) to read rdr, the rdrf bit is cleared automatically so this step is unnecessary.
508 start reception initialization read orer, per, and fer bits in ssr read reception data of rdr and clear rdrf bit in ssr to 0 end reception 1 4 no no yes yes read the rdrf bit in ssr rdrf = 1? per, fer, orer = 1? clear the re bit of scr to 0 yes no 3 error handling 2 all data received? figure 14.7 sample flowchart for receiving serial data (1)
509 start of error handling orer = 1? overrun error handling fer = 1? yes break? no framing error handling per = 1? yes parity error handling clear orer, per, and fer to 0 in ssr end clear re bit in scr to 0 no no no yes yes figure 14.8 sample flowchart for receiving serial data (2)
510 in receiving, the sci operates as follows: 1. the sci monitors the communication 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 1s in the receive data must match the even or odd parity setting of the o/e 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 the data passes these checks, the sci sets rdrf to 1 and stores the received data in the rdr. if one of the checks fails (receive error), the sci operates as indicated in table 14.11. note: when a receive error occurs, further receiving is disabled. while receiving, the rdrf bit is not set to 1, so be sure to clear the error flags. 4. after setting rdrf to 1, 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 1, the sci requests a receive-error interrupt (eri). figure 14.9 shows an example of sci receive operation in the asynchronous mode. table 14.11 receive error conditions and sci operation receive error abbreviation condition data transfer overrun error orer receiving of next data ends while rdrf is still set to 1 in ssr receive data not loaded 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 even/odd parity setting in smr receive data loaded from rsr into rdr
511 tdrf fer framing error generates eri interrupt request. 1 frame rxi interrupt handler reads data in rdr and clears rdrf to 0. 01 1 1 0/1 0 1 parity bit parity bit serial data start bit data stop bit start bit data stop bit idle (marking state) d0 d1 d7 d0 d1 d7 0/1 rxi interrupt request example: 8-bit data with parity and one stop bit. figure 14.9 sci receive operation 14.3.3 multiprocessor communication the multiprocessor communication function enables several processors to share a single serial communication line for sending and receiving data. 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 1. next the transmitting processor sends transmit data with the multiprocessor bit cleared to 0. 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 1, 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 1. multiple processors can send and receive data in this way. figure 14.10 shows the example of communication among processors using the multiprocessor format.
512 communication formats: four formats are available. parity-bit settings are ignored when the multiprocessor format is selected. for details see table 14.8. clock: see the description in the asynchronous mode section. receiving processor a (id = 01) (id = 02) (id = 03) (id = 04) receiving processor b receiving processor c serial communication line h'01 h'aa (mpb = 0) (mpb = 1) id-transmit cycle: receiving processor address serial data mpb: example: multiprocessor bit sending data h'aa to receiving processor a transmitting processor receiving processor d data-transmit cycle: data sent to receiving processor specified by id figure 14.10 communication among processors using multiprocessor format transmitting multiprocessor serial data: figure 14.11 shows a sample flowchart for transmitting multiprocessor serial data. the procedure is as follows (the steps correspond to the numbers in the flowchart): 1. sci initialization: set the txd pin using 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 0. 3. continue transmitting serial data: read the tdre bit to check whether it is safe to write (if it reads 1); if so, write data in tdr, then clear tdre to 0. when the dmac or the dtc is started by a transmit-data-empty interrupt request (txi) to write data in tdr, the tdre bit is checked and cleared automatically. 4. output a break at the end of serial transmission: set the data register (dr) of the port to 0, then clear te to 0 in scr and set the txd pin function as output port with the pfc.
513 tdre = 1? write transmit data in tdr and set mpbt in ssr all data transmitted? yes tend = 1? read tend bit in ssr output break signal? yes set dr = 0 clear te bit in scr to 0; select thetxd pin function as an output port with the pfc end transmission yes read tdre bit in ssr clear tdre bit to 0 initialization no no yes no no 1 2 3 4 start transmission figure 14.11 sample flowchart for transmitting multiprocessor serial data
514 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) 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 txd pin: a. start bit: one 0 bit is output. b. transmit data: seven or eight bits are output, lsb first. c. multiprocessor bit: one multiprocessor bit (mpbt value) is output. d. stop bit: one or two 1 bits (stop bits) are output. e. marking: output of 1 bits continues until the start bit of the next transmit data. 3. the sci checks the tdre bit when it outputs the stop bit. if tdre is 0, the sci loads data from the tdr into the tsr, outputs the stop bit, then begins serial transmission of the next frame. if tdre is 1, the sci sets the tend bit in the ssr to 1, outputs the stop bit, then continues output of 1 bits in the marking state. if the transmit-end interrupt enable bit (teie) in the scr is set to 1, a transmit-end interrupt (tei) is requested at this time. figure 14.12 shows an example of sci receive operation in the multiprocessor format.
515 tdre tend txi interrupt handler writes data in tdr and clears tdre to 0 txi interrupt request tei interrupt request 1 frame 01 1 1 0/1 0 1 multiprocessor bit multiprocessor bit serial data start bit data stop bit start bit data stop bit idle (marking state) d0 d1 d7 d0 d1 d7 0/1 example: 8-bit data with multiprocessor bit and one stop bit txi interrupt request figure 14.12 sci multiprocessor transmit operation receiving multiprocessor serial data: figure 14.13 shows a sample flowchart for receiving multiprocessor serial data. the procedure for receiving multiprocessor serial data is listed below. 1. sci initialization: set the rxd pin using the pfc. 2. id receive cycle: set the mpie bit in the serial control register (scr) to 1. 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? own id. if the id does not match the receive data, set mpie to 1 again and clear rdrf to 0. if the id matches the receive data, clear rdrf to 0. 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 processing, clear both orer and fer to 0. 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).
516 rdrf = 1? fer = 1? or orer =1? rdrf = 1? all data received? no end reception yes set mpie bit in scr to 1 read rdrf bit of ssr initialization clear re bit in scr to 0 yes no 1 2 3 read orer and fer bits of ssr fer = 1? or orer =1? read rdrf bit in ssr read receive data from rdr is id the station? id no read orer and fer bits in ssr read receive data from rdr no error processing no yes 5 4 yes yes no yes start reception figure 14.13 sample flowchart for receiving multiprocessor serial data
517 orer = 1? break? yes framing error handling yes start error handling overrun error handling yes fer = 1? clear orer and fer bits in ssr to 0 end no no no clear re bit in scr to 0 figure 14.13 sample flowchart for receiving multiprocessor serial data (cont)
518 figures 14.14 and 14.15 show examples of sci receive operation using a multiprocessor format. rdrf mpie rdr value id1 rxi interrupt request (multiprocessor interrupt ) , mpie = 0 rxi interrupt handler reads data in rdr and clears rdrf to 0 not station? id, so mpie is set to 1 a g ain no rxi interrupt, rdr maintains state 01 1 1 10 1 serial data start bit stop bit start bit stop bit idling (marking) d0 d1 d7 d0 d1 d7 0 mpb mpb mpb data (id1) data (data 1) figure 14.14 sci receive operation (id does not match)
519 rdrf mpie rdr value id1 id2 01 1 1 10 1 mpb mpb serial data start bit data (id2) data (data 2) stop bit start bit stop bit idling (marking) d0 d1 d7 d0 d1 d7 0 rxi interrupt request (multiprocessor interrupt), mpie = 0 rxi interrupt handler reads data in rdr and clears rdrf to 0 station? id, so receiving continues, with data received by the rxi interrupt processing routine mpie bit is again set to 1 mpb data2 example: own id matches data, 8-bit data with multiprocessor bit and one stop bit figure 14.15 example of sci receive operation (id matches) 14.3.4 clock synchronous operation in the clock 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 are independent, so full duplex communication is possible while sharing the same clock. 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 14.16 shows the general format in clock synchronous serial communication.
520 bit 0 bit 1 bit 2 bit 3 bit 4 bit 5 bit 6 bit 7 lsb msb synchroni- zation clock serial data * * transfer direction one unit (character or frame) of communication data note: high except in continuous transmitting or receiving. figure 14.16 data format in clock synchronous communication in clock 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 clock synchronous mode, the sci transmits or receives data by synchronizing with the falling edge of the synchronization 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 c/ a bit in the serial mode register (smr) and bits cke1 and cke0 in the serial control register (scr). see table 14.9. 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. note: an overrun error occurs only during the receive operation, and the sync clock is output until the re bit is cleared to 0. when you want to perform a receive operation in one- character units, select external clock for the clock source. sci initialization (clock synchronous 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 mode or communication format, always clear the te and re bits to 0 before following the procedure given below. clearing te to 0 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.
521 figure 14.17 is a sample flowchart for initializing the sci. 1. select the clock source in the serial control register (scr). leave rie, tie, teie, mpie, te, and re cleared to 0. 2. select the communication format in the serial mode register (smr). 3. write the value corresponding to the bit rate in the bit rate register (brr) unless an external clock is used. 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 1. also set rie, tie, teie, and mpie. the txd, rxd pins becomes usable in response to the pfc corresponding bits and the te, re bit settings. start of initialization clear te and re bits to 0 in scr 1-bit interval elapsed? set te and re to 1 in scr; set rie, tie, teie, and mpie bits yes no 1 set rie, tie, teie, mpie, cke1, and cke0 bits in scr (te and re are 0) end wait select transmit/receive format in smr set value in brr 2 3 4 figure 14.17 sample flowchart for sci initialization
522 transmitting serial data (synchronous mode): figure 14.18 shows a sample flowchart for transmitting serial data and indicates the procedure to follow. 1. sci initialization: set the txd pin function with the pfc. 2. sci status check and transmit data write: read ssr, check that the tdre flag is 1, then write transmit data in tdr and clear the tdre flag to 0. 3. to continue transmitting serial data: after checking that the tdre flag is 1, indicating that data can be written, write data in tdr, then clear the tdre flag to 0. when the dmac or dtc is activated by a transmit-data-empty interrupt request (txi) to write data in tdr, the tdre flag is checked and cleared automatically.
523 start transmitting read tdre flag in ssr tdre = 1? write transmit data in tdr and clear tdre flag to 0 in ssr all data transmitted? read tend flag in ssr yes no no no yes tend = 1? yes end clear te bit to 0 in scr initialize 2 3 1 figure 14.18 sample flowchart for serial transmitting
524 figure 14.19 shows an example of sci transmit operation. bit 0 bit 1 bit 7 bit 0 bit 1 bit 6 synchroni- zation clock serial data transmit direction bit 7 txi interrupt handler writes data in tdr and clears tdre to 0 1 frame txi request txi request tdre tend lsb msb tei request figure 14.19 example of sci transmit operation sci serial transmission 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) in the scr is set to 1, the sci requests a transmit-data-empty interrupt (txi) at this time. if clock output mode is selected, the sci outputs eight synchronous 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, then begins serial transmission of the next frame. if tdre is 1, 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 (tei) is requested at this time. 4. after the end of serial transmission, the sck pin is held in the high state.
525 receiving serial data (clock synchronous mode): figures 14.20 and 14.21 shows a sample flowchart for receiving serial data. when switching from the asynchronous mode to the clock synchronous mode, make sure that orer, per, and fer are cleared to 0. if per or fer is set to 1, the rdrf bit will not be set and both transmitting and receiving will be disabled. the procedure for receiving serial data is listed below: 1. sci initialization: set the rxd pin using 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 0. transmitting/receiving cannot resume if orer remains set to 1. 3. 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 0. the rxi interrupt can also be used to determine if the rdrf bit has changed from 0 to 1. 4. 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 or the dtc is started by a receive-data-full interrupt (rxi) to read rdr, the rdrf bit is cleared automatically so this step is unnecessary.
526 start reception initialization read the orer bit of ssr all data received? end reception 1 no yes orer = 1? read receive data from rdr and clear rdrf bit of ssr to 0 rdrf = 1? yes yes no clear re bit of scr to 0 no read rdrf bit of ssr error processing 3 4 2 figure 14.20 sample flowchart for serial receiving (1)
527 error handling end clear orer bit of ssr to 0 overrun error processing figure 14.21 sample flowchart for serial receiving (2) figure 14.22 shows an example of the sci receive operation. bit 7 bit 0 bit 7 bit 0 bit 1 bit 6 synchroni- zation clock serial data transfer direction bit 7 read data with rxi interrupt processing routine and clear rdrf bit to 0 1 frame rxi request rxi request eri interrupt request generated by overrun error rdrf orer figure 14.22 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 the check does not pass (receive error), the sci operates as indicated in table 14.11 and no further transmission or reception is possible. if the error flag is set to 1, the rdrf bit is not set
528 to 1 during reception, even if the rdrf bit is 0 cleared. when restarting reception, be sure to clear the error flag. 3. after setting rdrf to 1, 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 the 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 (clock synchronous mode): figure 14.23 shows a sample flowchart for transmitting and receiving serial data simultaneously. the procedure is as follows (the steps correspond to the numbers in the flowchart): 1. sci initialization: set the txd and rxd pins using 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 0. the txi interrupt can also be used to determine if the tdre bit has changed from 0 to 1. 3. receive error handling: if a receive error occurs, read the orer bit in ssr to identify the error. after executing the necessary error processing, clear orer to 0. transmitting/receiving cannot resume if orer remains set to 1. 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 0. the rxi interrupt can also be used to determine if the rdrf bit has changed from 0 to 1. 5. 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 (if it reads 1); 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 or the dtc 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 or the dtc is started by a receive-data- full interrupt (rxi) to read rdr, the rdrf bit is cleared automatically. note: in switching from transmitting or receiving to simultaneous transmitting and receiving, simultaneously clear both te and re to 0, then simultaneously set both te and re to 1.
529 start transmitting/receive initialization read tdre bit in ssr all data transmitted/and received end transmission/reception 1 2 no yes tdre = 1? write transmission data in tdr and clear tdre bit of ssr to 0 rdrf = 1? yes no clear te and re bits of scr to 0 yes no read orer bit of ssr error handling 3 orer = 1? yes read receive data of rdr, and clear rdrf bit of ssr to 0 read rdrf bit of ssr 4 5 no figure 14.23 sample flowchart for serial transmission
530 14.4 sci interrupt sources and the dmac/dtc the sci has four interrupt sources: transmit-end (tei), receive-error (eri), receive-data-full (rxi), and transmit-data-empty (txi). table 14.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) or the data transfer controller (dtc) to transfer data. tdre is automatically cleared to 0 when the dmac or the dtc writes data in the transmit data register (tdr). rxi is requested when the rdrf bit in the ssr is set to 1. rxi can start the dmac or the dtc to transfer data. rdrf is automatically cleared to 0 when the dmac or the dtc reads 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 or the dtc. tei is requested when the tend bit in the ssr is set to 1. tei cannot start the dmac or the dtc. where the txi interrupt indicates that transmit data writing is enabled, the tei interrupt indicates that the transmit operation is complete. table 14.12 sci interrupt sources interrupt source description dmac/dtc activation priority eri receive error (orer, per, or fer) no high rxi receive data full (rdrf) yes txi transmit data empty (tdre) yes tei transmit end (tend) no low
531 14.5 notes on use sections 14.5.1 through 14.5.9 provide information for using the sci. 14.5.1 tdr write and tdre flags the tdre bit in the serial status register (ssr) is a status flag indicating loading of transmit data from tdr into tsr. the sci sets tdre to 1 when it transfers data from tdr to tsr. data can be written to tdr regardless of the tdre bit status. if new data is written in tdr when tdre is 0, however, the old data stored in tdr will be lost because the data has not yet been transferred to the tsr. before writing transmit data to the tdr, be sure to check that tdre is set to 1. 14.5.2 simultaneous multiple receive errors table 14.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. table 14.13 ssr status flags and transfer of receive data ssr status flags receive data transfer receive error status rdrf orer fer per rsr ? rdr overrun error 1 1 0 0 x framing error 0 0 1 0 o parity error 0 0 0 1 o overrun error + framing error 1 1 1 0 x overrun error + parity error 1 1 0 1 x framing error + parity error 0 0 1 1 o overrun error + framing error + parity error 1111x note: o = receive data is transferred from rsr to rdr. x = receive data is not transferred from rsr to rdr.
532 14.5.3 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 0s, 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. 14.5.4 sending a break signal the txd pin becomes a general i/o pin with the i/o direction and level determined by the i/o port data register (dr) and pin function controller (pfc) control register (cr). these conditions allow break signals to be sent. the dr value is substituted for the marking status until the pfc is set. consequently, the output port is set to initially output a 1. to send a break in serial transmission, first clear the dr to 0, then establish the txd pin as an output port using the pfc. when te is cleared to 0, the transmission section is initialized regardless of the present transmission status. 14.5.5 receive error flags and transmitter operation (clock 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. 14.5.6 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 (figure 14.24).
533 078150781505 internal base clock receive data (rxd) synchronization sampling timing data sampling timing 8 clocks 16 clocks start bit ?.5 clocks +7.5 clocks d0 d1 figure 14.24 receive data sampling timing in asynchronous mode the receive margin in the asynchronous mode can therefore be expressed as: m = 0.5 1 2n l 0.5 f d 0.5 n 1 + f 100% ? ? ? ? () () m : receive margin (%) n : ratio of clock frequency to bit rate (n = 16) d : clock duty cycle (d = 0?.0) l : frame length (l = 9?2) f : absolute deviation of clock frequency from the equation above, if f = 0 and d = 0.5 the receive margin is 46.875%: d = 0.5, f = 0 m = (0.5 ?1/(2 16)) 100% = 46.875% this is a theoretical value. a reasonable margin to allow in system designs is 20?0%.
534 14.5.7 constraints on dmac/dtc use when using an external clock source for the synchronization clock, update the tdr with the dmac or the dtc, 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 14.25). before reading the receive data register (rdr) with the dmac/dtc, select the receive-data- full interrupt of the sci as a start-up source. d0 d1 d2 d3 d4 d5 d6 d7 sck tdre t note: during external clock operation, an error may occur if t is 4 f or less. figure 14.25 example of clock synchronous transmission with dmac 14.5.8 cautions for clock synchronous external clock mode set te = re = 1 only when the external clock sck is 1. do not set te = re = 1 until at least four clocks after the external clock sck has changed from 0 to 1. when receiving, rdrf is 1 when re is set to zero 2.5?.5 clocks after the rising edge of the rxd d7 bit sck input, but it cannot be copied to rdr. 14.5.9 caution for clock synchronous internal clock mode when receiving, rdrf is 1 when re is set to zero 1.5 clocks after the rising edge of the rxd d7 bit sck output, but it cannot be copied to rdr.
535 section 15 high speed a/d converter (excluding a mask) 15.1 overview the high speed a/d converter has 10-bit resolution, and can select from a maximum of eight channels of analog inputs. 15.1.1 features the high speed a/d converter has the following features: 10-bit resolution eight input channels analog conversion voltage range setting is selectable ? using the reference voltage pin (avref) as an analog standard voltage (vref), conversion of analog input from 0 to vref (only with sh7043). high-speed conversion ? minimum conversion time: 2.9 ? per channel (for 28-mhz operation) ? 1.4 ? per channel during continuous conversion multiple conversion modes ? select mode/group mode ? single mode/scan mode ? buffered operation possible ? 2 channel simultaneous sampling possible three types of conversion start ? software, timer conversion start trigger (mtu), or adtrg pin can be selected. eight data registers ? conversion results stored in 16-bit data registers corresponding to each channel. sample and hold function a/d conversion end interrupt generation ? an a/d conversion end interrupt (adi) request can be generated on completion of a/d conversions
536 15.1.2 block diagram figure 15.1 is the block diagram of the high speed a/d converter. + - av cc av ref * av ss an0 an1 an2 an3 an4 an5 an6 adtrg an7 d/a conversion circuit s&h a s&h b addra addrb addrc addrd addre addrf addrg addrh adcr adcsr internal data bus bus i/f interrupt signal adi 8-bit timer or mtu conversion start trigger cmp module internal data bus control logic multiplexer adcr: adscr: addra: addrb: addrc: addrd: a/d control register a/d control status register a/d data register a a/d data register b a/d data register c a/d data register d cmp: s&h: addre: addrf: addrg: addrh: comparator array sample and hold circuit a/d data register e a/d data register f a/d data register g a/d data register h note: sh7043 only figure 15.1 high speed a/d converter block diagram 15.1.3 pin configuration table 15.1 shows the input pins used by the high speed a/d converter. the av cc and av ss pins are for the a/d converter internal analog section power supply. the av ref pin is for the a/d conversion standard voltage.
537 table 15.1 pin configuration pin abbreviation i/o function analog supply av cc i analog section power supply analog ground av ss i analog section ground and a/d conversion reference voltage reference voltage av ref i a/d conversion standard voltage (sh7043 only) analog input 0 an0 i analog input channel 0 analog input 1 an1 i analog input channel 1 analog input 2 an2 i analog input channel 2 analog input 3 an3 i analog input channel 3 analog input 4 an4 i analog input channel 4 analog input 5 an5 i analog input channel 5 analog input 6 an6 i analog input channel 6 analog input 7 an7 i analog input channel 7 a/d external trigger input adtrg i external trigger for a/d conversion start 15.1.4 register configuration table 15.2 shows the configuration of the high speed a/d converter registers. table 15.2 register configuration name abbreviation r/w initial value address access size a/d data register a addra r h?000 h'ffff83f0 8,16 a/d data register b addrb r h?000 h'ffff83f2 a/d data register c addrc r h?000 h'ffff83f4 a/d data register d addrd r h?000 h'ffff83f6 a/d data register e addre r h?000 h'ffff83f8 a/d data register f addrf r h?000 h'ffff83fa a/d data register g addrg r h?000 h'ffff83fc a/d data register h addrh r h?000 h'ffff83fe a/d control/status register adcsr r/(w)* h'00 h'ffff83e0 a/d control register adcr r/w h'00 h'ffff83e1 note: only 0 can be written to bit 7 to clear the flag.
538 15.2 register descriptions 15.2.1 a/d data registers a? (addra?ddrh) the addr are 16-bit read only registers for storing a/d conversion results. there are eight of these registers, addra through addrh. the a/d converted data is 10-bit data which is sent to the addr for the corresponding converted channel for storage. the lower 8 bits of the a/d converted data are transferred to and stored in the lower byte (bits 7?) of the addr, and the upper 2 bits are stored into the upper byte (bits 9, 8). bits 15?0 always read as 0. data reads can be either byte or word. the upper 8 bits of the converted data are transferred upon byte data reads. additionally, buffered operation is possible by combining addra?ddrd. table 15.3 shows the correspondence between the analog input channels and the addr. the addr are initialized to h'0000 by power-on reset or in standby mode. manual reset does not initialize addr. bit: 15 14 13 12 11 10 9 8 ad9ad8 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 1 0 ad7 ad6 ad5 ad4 ad3 ad2 ad1 ad0 initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r r r
539 table 15.3 analog input channel and addr correspondence analog input channel a/d data register an0 addra* an1 addrb* an2 addrc* an3 addrd* an4 addre an5 addrf an6 addrg an7 addrh note: * except during buffer operation 15.2.2 a/d control/status register (adcsr) the adcsr is an 8-bit read/write register used for a/d conversion operation control and to indicate status. the adcsr is initialized to h'00 by power-on reset or in standby mode. manual reset does not initialize adcsr. bit: 7 6 5 4 3 2 1 0 adf adie adst cks grp ch2 ch1 ch0 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 note: * the only value that can be written is a 0 to clear the flag.
540 bit 7?/d end flag (adf): this status flag indicates that a/d conversion has ended. bit 7: adf description 0 clear conditions (initial value) with adf = 1, by reading the adf flag then writing 0 in adf when the dtc or dmac are activated by an adi interrupt 1 set conditions single mode: when a/d conversion ends after conversion for all designated channels (during buffer operation, this is not set until operation of the specified buffer has ended) scan mode: after one round of a/d conversion for all specified channels bit 6?/d interrupt enable (adie): enables or disables interrupt requests (adi) after a/d conversion ends. set the adie bit while conversion is suspended. bit 6: adie description 0 disables interrupt requests (adi) after a/d conversion ends (initial value) 1 enables interrupt requests (adi) after a/d conversion ends bit 5?/d start (adst): selects start or stop for a/d conversion. a 1 is maintained during a/d conversions. the adst bit can be set to 1 by software, timer conversion start triggers, or an a/d external trigger input pin ( adtrg ). bit 5: adst description 0 a/d conversion halted (initial value) 1 single mode: start a/d conversion. automatically cleared to 0 after conversion for the designated channel ends. scan mode: start a/d conversion. continuous conversion until 0 cleared by software.
541 bit 4?lock select (cks): sets the a/d conversion time. set, according to the operating frequency, to give a conversion time of at least 2 ? (5 v version) or 4 ? (3.3 v version). make conversion time changes only while conversion is halted. bit 4: cks description 0 conversion time = 40 states (a/d converter standard clock = f /2) (initial value) 1 conversion time = 80 states (when f /4 is selected) bit 3?roup mode (grp): designates either select mode or group mode for the a/d conversion channel selection. set the grp bit only while conversion is halted. bit 3: grp description 0 select mode (initial value) 1 group mode bits 2??hannel select 2? (ch2?h0): these bits, along with the grp bit, select the analog input channel. set the input channel only while conversion is halted. description bit 2: ch2 bit 1: ch1 bit 0: ch0 select mode (grp = 0) group mode (grp = 1) 0 0 0 an0 (initial value) an0 0 0 1 an1 an0?n1 0 1 0 an2 an0?n2 0 1 1 an3 an0?n3 1 0 0 an4 an0?n4 1 0 1 an5 an0?n5 1 1 0 an6 an0?n6 1 1 1 an7 an0?n7
542 15.2.3 a/d control register (adcr) the adcr is an 8-bit read/write register used for a/d conversion operation control. the adcr is initialized to h'00 by power-on reset or in standby mode. manual reset does not initialize. bit: 7 6 5 4 3 2 1 0 pwr trgs1 trgs0 scan dsmp bufe1 bufe0 initial value: 0 0 0 0 0 0 0 0 r/w: r r/w r/w r/w r/w r/w r/w r/w bit 7?eserved: this bit always reads as 0. the write value should always be 0. bit 6?ower (pwr): designates the conversion start mode for the high speed a/d converter. setting the pwr bit to 1 sets high speed start mode, and a 0 sets to low power conversion mode. see section 15.4.7, conversion start modes for details on the conversion start operation. set the pwr bit only while conversion is halted. bit 6: pwr description 0 low power conversion mode (initial value) 1 high speed start mode bits 5 and 4?imer trigger select 1, 0 (trgs1, trgs0): these bits enable or prohibit a/d conversion starts by trigger signals. set the trgs1, trgs0 bits only while conversion is halted. bit 5: trgs1 bit 4: trgs0 description 0 0 enable a/d conversion start by software (initial value) 0 1 enables a/d conversion start by mtu conversion start trigger 1 0 reserved 1 1 enables a/d conversion start by external trigger pin ( adtrg ) bit 3?can mode (scan): selects either single mode or scan mode for the a/d conversion operation mode. see section 15.4, operation, for details on single mode and scan mode operation. set the scan bit only while conversion is halted. bit 3: scan description 0 single mode (initial value) 1 scan mode
543 bit 2?imultaneous sampling (dsmp): enables or disables the simultaneous sampling of two channels. see section 15.4.6, simultaneous sampling operation, for details on simultaneous sampling. set the dsmp bit only while conversion is halted. bit 2: dsmp description 0 normal sampling operation (initial value) 1 simultaneous sampling operation bits 1??uffer enable 1, 0 (bufe1, bufe0): these bits select whether to use the addrb?ddrd as buffer registers. set the bufe1 and bufe0 bits only while conversion is halted. bit 1: bufe1 bit 0: bufe0 description 0 0 normal operation (initial value) 0 1 addra and addrb buffer operation: conversion result ? addra ? addrb (addrb is the buffer register) 1 0 addra and addrc, also addrb and addrd buffer operation: conversion result 1 ? addra ? addrc, conversion result 2 ? addrb ? addrd (addrc and addrd are buffer registers) 1 1 addra?ddrd buffer operation: conversion result ? addra ? addrb ? addrc ? addrd (addrb?ddrd are buffer registers) 15.3 bus master interface the addra?ddrh are 16-bit registers with a 16-bit width data bus to the bus master. the bus master can read from addra?ddrh in either word or byte units. when an addr is read in word units, the addr contents are transferred to the bus master 16 bits at a time. in byte unit reads, the contents of the most significant eight bits (ad9?d2) of the converted data (ad9?d0) are transferred to the bus master. figures 15.2 and 15.3 shows an example of the addr read operation.
544 0 0 0 0 0 0 ad 9 ad 8 ad 7 ad 6 ad 5 ad 4 ad 3 ad 2 ad 1 ad 0 upper 8 bits internal data bus bus i/f data register word data read lower 8 bits figure 15.2 addr read operation (1)
545 0 0 0 0 0 0 ad 9 ad 8 ad 7 ad 6 ad 5 ad 4 ad 3 ad 2 ad 1 ad 0 upper 8 bits internal data bus bus i/f byte data read data register figure 15.3 addr read operation (2)
546 15.4 operation the high speed a/d converter has 10-bit resolution. in addition to the four operating modes of select or group, and single or scan can be set in combination with buffer operation and simultaneous sampling operation. select mode uses one channel and group mode selects multiple channels. one start in the single mode performs conversions on all selected channels, and one start in the scan mode performs repeated conversions until stopped by software. in buffer operation, the previous conversion result is saved in a buffer register at the end of a conversion for the relevant channel. in simultaneous sampling operation, the analog input voltages of two channels are sampled simultaneously then converted in order. software, a timer conversion start trigger (mtu), or an adtrg input can be selected as the conversion start condition. high speed start mode or low power conversion mode can be selected for a/d conversion using the pwr bit setting. when changing the operation mode or input channel, rewrite the adcsr, adcr while the adst bit is cleared to 0. after rewriting the adcsr, adcr, a/d conversion will be restarted when the adst bit is set to 1. operation mode or input channel changes can be made simultaneously with adst bit setting. when stopping an a/d conversion before completion, 0 clear the adst bit. 15.4.1 select-single mode choose select-single mode when doing a/d conversions for one channel only. when the adst bit is set to 1, a/d conversion is started according to the designated conversion start conditions. the adst bit is held to 1 during the a/d conversion and is automatically cleared to 0 upon completion. the adf flag is also set to 1 at the end of conversion. if the adie bit is set to 1 at this time, an adi interrupt request is generated. the adf flag is cleared by reading the adcsr, then writing a 0. figure 15.4 shows an example of operation in the select-single mode when an1 is selected.
547 addrb addra channel 3 channel 2 channel 1 channel 0 adst adf addrc addrd automatic clear sampling 1 conversion standby conversion standby conversion standby conversion standby conversion standby a/d conversion 1 conversion result 1 set to 1 by software figure 15.4 a/d converter operation example (select-single mode) 15.4.2 select-scan mode choose select-scan mode when doing repeated a/d conversions for one channel. this is useful when doing continuous monitoring of the analog input of one channel. when the adst bit is set to 1, a/d conversion is started according to the designated conversion start conditions. the adst bit is held to 1 until 0 cleared by software. a/d conversion for the selected input channel is repeated during that interval. the adf flag is set to 1 at the end of the first conversion. at this point, if the adie bit is set, an adi interrupt request is issued, and the a/d converter is halted. with the a/d converter in stop mode due to an adi interrupt request, conversion is restarted when the adf flag is cleared to 0. the adf flag is cleared by reading the adcsr then writing a 0. figure 15.5 shows an example of operation in the select-scan mode when an1 is selected.
548 addrb addra channel 3 channel 2 channel 1 channel 0 adst adf addrc addrd sampling 3 sampling 6 a/d conversion 5 sampling 1 a/d conver- sion 1 a/d conver- sion 3 conver- sion standby a/d conver- sion 2 sampling 2 sampling 4 sampling 5 a/d conver- sion 4 conversion standby conversion standby set to 1 by software cleared to 0 by software conversion standby conversion standby conversion stopped conver- sion result 1 conver- sion result 2 conver- sion result 3 conver- sion result 4 figure 15.5 a/d converter operation example (select-scan mode) 15.4.3 group-single mode choose group-single mode when doing a/d conversions for multiple channels. when the adst bit is set to 1, a/d conversion is started according to the designated conversion start conditions. the adst bit is held to 1 during a/d conversion and is automatically cleared to 0 when all conversions for the designated input channels are completed. the adf flag is set to 1 when all conversions for the designated input channels are completed. if the adie bit is set to 1 at this time, an adi interrupt request is generated. the adf flag is cleared by reading the adcsr then writing a 0. figure 15.6 shows an example of operation in the group-single mode when an0?n2 are selected.
549 addrb addra channel 3 channel 2 channel 1 channel 0 adst adf addrc addrd sampling 1 sampling 2 sampling 3 a/d conversion 1 a/d conversion 2 a/d conversion 3 conversion standby conversion standby conversion standby conversion standby conversion standby conversion standby conversion standby automatic clear set to 1 by software conversion result 1 conversion result 2 conversion result 3 figure 15.6 a/d converter operation example (group-single mode) 15.4.4 group-scan mode choose group-scan mode when doing repeated a/d conversions for multiple channels. this is useful when doing continuous monitoring of the analog inputs of multiple channels. when the adst bit is set to 1, a/d conversion is started according to the designated conversion start conditions. the adst bit is held to 1 until 0 cleared by software. a/d conversion for the selected input channels is repeated during that interval. the adf flag is set to 1 at the completion of the first conversions of all the designated input channels. at this point, if the adie bit is set to 1, an adi interrupt request is issued, and the a/d converter is temporarily halted. with the a/d converter in stop mode due to an adi interrupt request, conversion is restarted when the adf flag is cleared to 0. the adf flag is cleared by reading the adcsr, then writing a 0.
550 figure 15.7 shows an example of operation in the group-scan mode when an0?n2 are selected. addrb addra channel 3 channel 2 channel 1 channel 0 adst adf addrc addrd sam- pling 1 sam- pling 4 sam- pling 2 conver- sion standby conversion standby sam- pling 5 sam- pling 3 sam- pling 6 a/d conver- sion 1 a/d conver- sion 4 a/d conver- sion 2 a/d conver- sion 5 a/d conver- sion 3 conversion standby conversion standby conversion standby conver- sion standby conver- sion standby cleared to 0 by software set to 1 by software conversion result 1 conversion result 4 conversion result 5 conversion result 2 conversion result 3 conver- sion stopped figure 15.7 a/d converter operation example (group-scan mode) 15.4.5 buffer operation when conversion ends on the relevant channel, the conversion result is stored in the addr, and simultaneously, the previously stored result is transferred to another addr. buffer operation can be selected from the following: an0 ? addra ? addrb (two-stage, one-group operation) an0 ? addra ? addrc, an1 ? addrb ? addrd (two-stage, two-group operation) an0 ? addra ? addrb ? addrc ? addrd (four-stage, one-group operation)
551 to use in combination with simultaneous sampling, set grp = 1, bufe1, bufe0 = b'10 and ch2 = 0. buffer operation timing is shown in figure 15.8. addrb addra channel 1 channel 0 adst adf addrd addrc channel 2 channel 3 sampling 1 sampling 3 sampling 2 sampling 4 sampling 5 a/d conver- sion 1 a/d conver- sion 3 a/d conver- sion 2 a/d conver- sion 4 conversion standby conversion standby conversion standby conversion standby conver- sion standby cleared to 0 by software set to 1 by software conver- sion result 1 conver- sion result 2 conver- sion result 3 conver- sion result 4 conver- sion result 1 conver- sion result 2 conver- sion result 3 figure 15.8 buffer operation example (select scan mode: two-stage one-group operation, when ch2?h0 = b'001) buffer-only operation: when performing conversion only on the analog input channels specified by the bufe1 and bufe0 bits, select group mode, and you can select the adf flag setting conditions with the ch2?h0 bits. table 15.4 shows conversion during buffer operation and adf flag setting conditions. the adf flag is set at the point in the table when the final conversion has ended. in single mode, conversion is halted after the adf flag is set to 1. in scan mode, conversion continues, and the converted data is stored in sequence in the buffer registers specified by the bufe1 and bufe0 bits.
552 when the adf flag is set to 1, if the adie bit is also set to 1, an adi interrupt is issued. after the adcsr is read, the adf flag is cleared by a 0 write. with select single mode, the a/d converter goes into standby mode at the end of every conversion cycle. the a/d converter is restarted by software, a timer trigger, or external trigger. when the number of conversion cycles shown in table 15.4 have ended, the adf flag is set to 1. table 15.4 conversion channel and adf flag setting/clearing conditions during buffer operation 1 channel setting sampling channel ch2 ch1 ch0 bufe1, bufe0 = b'01 bufe1, bufe0 = b'10 bufe1, bufe0 = b'11 0 0 0 an0 1 time (addra) an0, an1 1 time (addrb) an0 1 time (addra) 1 an0 2 times (addrb) an0 2 times (addrb) 1 0 * an0, an1 2 times (addrd) an0 3 times (addrc) 1 * an0 4 times (addrd) 1 * * * note: * see table 15.5. combined group mode and buffer operation: continuous conversion is possible on analog input channels (an0 and an1) specified by bits bufe1 and bufe0 as well as an4?n7 due to setting of bits ch2?h0. table 15.5 shows conversion during buffer operation and adf flag setting conditions. the adf flag is set at the point in the table when the final conversion has ended. in this case, conversion is performed on the analog input corresponding with the addr specified in the buffer register. for example, when bufe1 and bufe0 = b'11 and ch2?h0 = b'110, conversion results are stored in addra and addre?ddrg. also, contents of addra?ddrc before the start of conversion are transferred to addrb?ddrd. in single mode, conversion is halted after the adf flag has been set to 1. conversion continues in scan mode.
553 table 15.5 conversion channel and adf flag setting/clearing conditions during buffer operation 2 channel setting sampling channel ch2 ch1 ch0 bufe1, bufe0 = b'01 bufe1, bufe0 = b'10 bufe1, bufe0 = b'11 00 * * * 1 0 an0, an2 (addrc) 1 an0, an2, an3 (addrd) 1 0 0 an0, an2?n4 (addre) an0, an1, an4 (addre) an0, an4 (addre) 1 an0, an2?n5 (addrf) an0, an1, an4, an5 (addrf) an0, an4, an5 (addrf) 1 0 an0, an2?n6 (addrg) an0, an1, an4?n6 (addrg) an0, an4?n6 (addrg) 1 an0, an2?n7 (addrh) an0, an1, an4?n7 (addrh) an0, an4?n7 (addrh) note: * see table 15.4. adf flag clearing: when the dtc and dmac are started up due to an a/d conversion end interrupt, the adf flag is cleared when the addr specified in tables 15.4 or 15.5 has been read. resetting the number of buffer operations: clear the bufe1 and bufe0 bits to b'00 in conversion standby mode or when the converter has been halted. the number of buffer operations is cleared to 0. updating buffer operations: clear the bufe1 and bufe0 bits to b'00 in conversion standby mode or when the converter has been halted. thereafter, set bufe1 and bufe0, and the buffer operations shown in tables 15.4 and 15.5 are performed when conversion is resumed. 15.4.6 simultaneous sampling operation with simultaneous sampling, continuous conversion is conducted with sampling of the input voltages on two channels at the same time. simultaneous sampling is valid in group mode. channels for sampling are determined by the ch2 and ch1 bits of the rdscr. the combinations are shown in table 15.6. for example, if grp = 1 when ch2 and ch1 = b'11, sampling occurs in order in the following pairs: an0, an1 ? an2, an3 ? an4, an5 ? an6, an7. sampling timing is shown in figure 15.9.
554 table 15.6 simultaneous sampling channels channel setting ch2 ch1 sampling channels, grp 1 0 0 an0, an1 1 an0, an1 ? an2, an3 1 0 an0, an1 ? an2, an3 ? an4, an5 1 an0, an1 ? an2, an3 ? an4, an5 ? an6, an7 addrb addra adst adf addrd addrc automatically cleared channel 0 channel 1 channel 2 channel 3 sampling 1 a/d conver- sion 1 a/d conver- sion 2 conver- sion standby conversion standby conversion standby conversion standby conver- sion standby sampling 2 conver- sion standby conver- sion standby set to 1 by software conversion result 1 conversion result 2 figure 15.9 simultaneous sampling operation (group single mode)
555 15.4.7 conversion start modes the conversion start mode of the high speed a/d converter is set by the pwr bit of the adcsr. when the pwr bit is cleared to 0, low-power conversion mode is set and the internal analog circuit becomes inactive. high-speed start mode is set by setting the pwr bit to 1, and the analog circuit becomes active. in the low-power conversion mode, power is applied to the analog circuitry simultaneous to the conversion start (adst set). when 200 cycles of the reference clock have elapsed, conversion becomes possible for the analog circuit and the first a/d conversion begins. when performing consecutive conversions, the second and later conversions are executed in 10 cycles. select the basic clock with the cks bit of the adcsr. when the a/d conversion ends, adst is cleared to 0 and the analog circuit power supply is automatically cut off. because the analog circuit is only active during the a/d conversion operation period in this mode, current consumption can be reduced. in high-speed start mode, adst is cleared to 0 when a/d conversion ends. power continues to be supplied to the analog circuitry, and conversion-ready status is maintained. conversion is restarted immediately by resetting adst to 1. however, the first conversion after power-on begins 200 cycles after setting adst. clear the pwr bit to 0 to switch off the analog power supply. when performing consecutive conversions, the second and later conversions are executed in 20 cycles. because the analog circuit is always active in this mode, a/d conversion can be executed at high speed.
556 figures 15.10 and 15.11 show examples of conversion start operation timing. addrb addra channel 0 channel 1 channel 2 channel 3 adst adf addrd addrc set to 1 by software analog circuit power supply 200 cycles set clear sam- pling 1 sam- pling 2 sam- pling 3 a/d conver- sion 1 a/d conver- sion 2 a/d conver- sion 3 conver- sion standby conver- sion standby conver- sion standby conver- sion standby cleared to 0 by software conversion result 1 conversion result 2 conversion result 3 figure 15.10 conversion start operation (low-power conversion mode)
557 addrb addra channel 1 channel 0 adst adf addrd addrc set to 1 by software analog circuit power supply switched off by software channel 2 channel 3 set to 1 by software sam- pling 1 sam- pling 2 a/d conver- sion 1 a/d conver- sion 2 conversion result 1 conversion result 2 conversion standby conversion standby conversion standby conversion standby 200 cycles switched on by software (pwr set to 1) (pwr cleared to 0) figure 15.11 conversion start operation (high-speed start mode)
558 15.4.8 conversion start by external input a/d conversions can be started by trigger signals generated by timer conversion start triggers or adtrg inputs. when a trigger signal designated by the trgs1 and trgs0 bits of the adcr occurs, the adst bit of the adcsr is set to 1 and a/d conversion is started. the other operations are the same as when the adst bit is set to 1 by software. figure 15.12 shows an example of the timing when the adst bit is set by an external input. addrb addra adst addrd addrc adf set adtrg (external trigger) channel 0 channel 1 channel 2 channel 3 sam- pling 1 a/d conver- sion 1 conver- sion standby conversion standby conversion standby conversion standby conversion standby conversion result 1 figure 15.12 conversion start by adtrg conversion start trigger
559 15.4.9 a/d conversion time the high speed a/d converter has an on-chip sample and hold circuit. the high speed a/d converter samples the input at time t d after the adst bit is set to 1, and then starts the conversion. the a/d conversion time t conv is the sum of the conversion start delay time t d , the input sampling time t spl , and the operating time t cp . this conversion time is not a set value, but is decided by the t d adcsr write timing, or the timer conversion start trigger generation timing. figure 15.13 shows an example of a/d conversion timing. table 15.7 lists a/d conversion times. address write signal adst sampling timing f adf t d t conv t spl t cp t d : t spl : t conv : t cp : a/d conversion start delay time input sampling time a/d conversion time operation time figure 15.13 a/d conversion timing
560 table 15.7 a/d conversion times cks = 0 cks = 1 time symbol min typ max min typ max a/d conversion start delay time t d 1.5 1.5 1.5 1.5 1.5 1.5 input sampling time t spl 20 20 20 40 40 40 a/d conversion time t conv 42.5 42.5 42.5 82.5 82.5 82.5 notes: 1. unit: states 2. table entries are for when adst = 1. if 200 states have not elapsed since the pwr bit has been set, no conversions are done until after those 200 states have occurred. when pwr = 0, add 200 states to the first a/d conversion start delay time. when continuously executing conversion, tcp for the second time and following is 20 cycle when cks=0 and 40 cycle when cks=1. the cks bit of the adcsr is the operation time t conv , but set so that this is 2 ? or greater. table 15.8 shows the operating frequency and cks bit settings. table 15.8 operating frequency and cks bit settings conversion time minimum conversion time (?) cks (states) 33 mhz 28 mhz 20 mhz 16 mhz 10 mhz 8 mhz 0 42.5 2.1 2.6 4.3 5.3 1 82.5 2.5 2.9 4.2 5.0 8.3 10.3 15.5 interrupts the high speed a/d converter generates an a/d conversion end interrupt (adi) upon completion of a/d conversions. the adi interrupt request can be enabled or disabled by the adie bit of the adcsr. the dtc or dmac can be activated by adi interrupts. when converted data is read by the dtc or dmac upon an adi interrupt, consecutive conversions can be done without software responsibility. table 15.9 lists the high speed a/d converter interrupt sources. during scan mode, if the adie bit is set to 1, a/d conversion is temporarily suspended immediately when the adf flag is set to 1. a/d conversion is restarted when the adf flag is cleared to 0. when the dtc or dmac are activated by an adi interrupt, the adf flag is cleared to 0 when the final specified data register is read.
561 table 15.9 high speed a/d converter interrupt sources interrupt source description dtc, dmac activation adi interrupt caused by conversion end possible 15.6 notes on use take note of the following for the a/d converter. 1. analog input voltage range during a/d conversions, see that the voltage applied to the analog input pins an0?n7 is within the range avss an0?n7 avcc. 2. avcc and avss input voltages the avcc and avss input voltage must be avcc = vcc ?10%, avss = vss. when not using the a/d converter, use avcc = vcc, avss = vss. during the standby mode, use v ram avcc 5.5v, avss = vss. v ram is the ram standby voltage. 3. avref input voltage the analog standard voltage avref (av ref ) must be avref avcc. when not using the a/d converter, use av ref = vcc. during the standby mode, use v ram avref avcc. v ram is the ram standby voltage. 4. input ports the time constant for the circuit connecting to the input port must be shorter than the sampling time of the a/d converter. input voltage may not be sampled sufficiently when the time constant of the circuit is long. 5. conversion start modes depending on the pwr bit setting, the demand for a/d conversion will differ for the high- speed start mode and low-demand conversion mode. 6. analog input pins handling connect a protection circuit as shown in figure 15.14 to prevent analog input pins (an0?n7) from being destroyed due to abnormal voltage from surge, etc. this circuit is also equipped with a cr filter to control errors due to noise. the circuit shown in the diagram is only an example and the number of circuits is to be determined by considering the actual condition of use. figure 15.15 shows an equivalent circuit of analog input pins and table 15.10 shows the specification of the analog input pins.
562 note: * avss avcc avref an0 to an7 this lsi 10 f 0.01 f 100 0.1 f ** figure 15.14 example of a protection circuit for the analog input pins an0 to an7 1.0k 20pf 1m high-speed a/d converter analog multiplexer note: numbers are only to be noted as reference value figure 15.15 equivalent circuit of analog input pins
563 table 15.10 analog input pin specification item min max unit analog input capacity 20 pf permitted source impedance 1 k
565 section 16 mid-speed a/d converter (a mask) 16.1 overview the mid-speed a/d converter has 10 bit resolution, and can select from a maximum of eight channels of analog input. the mid-speed a/d converter is structured by two independent modules (a/d0 and a/d1) 16.1.1 features the mid-speed a/d converter has the following features: 10-bit resolution eight input channels (four channels times two) analog conversion voltage range setting is selectable ? using the standard voltage pin (avref) as an analog standard voltage (vref), conversion of analog input from 0v to vref (only with sh7041a, sh7043a and sh7045). (connected to av cc internally in the sh7040a, sh7042a, and sh7044.) high speed conversion ? minimum conversion time: per channel ? operation frequency: f 20mhz, cks=0, 1 6.7? (20mhz, cks=1) ? operation frequency: f>20mhz, cks=0 9.3? (28.7mhz, cks=0) multiple conversion modes ? single mode/scan mode ? 2 channel simultaneous conversion three types of conversion start ? software, timer conversion start trigger (mtu), or adtrg pin can be selected. eight data registers ? conversion results stored in 16-bit data registers corresponding to each channel. sample and hold function a/d conversion end interrupt generation ? an a/d conversion end interrupt (adi) can be generated on completion of a/d conversion. furthermore, adi0 (a/d0 interrupt request) can activate dtc and adi1 (a/d1 interrupt request) can activate dmac.
566 16.1.2 block diagram figure 16.1 is the block diagram of the mid-speed a/d converter. av cc , avref and av ss pins of both a/d are common in lsi. a/d0 adcr0 adcsr0 addrd0 addrc0 addrb0 addra0 + - + - avcc av ref av ss an0 an1 an2 an3 a/d1 adcr1 adcsr1 addrd1 addrc1 addrb1 addra1 av cc av ref av ss an4 an5 an6 an7 interrupt signal adi0 (dtc) interrupt signal adi1 (dmac) module data bus module data bus (only with 144 pin) (only with 144 pin) 10-bit d/a continuous comparison register continuous comparison register bus interface bus interface analog multiplexer 10-bit d/a analog multiplexer sample & hold circuit conparator control circuit sample & hold circuit conparator control circuit port trigger mtu trigger logical sum figure 16.1 mid-speed a/d converter block diagram
567 16.1.3 pin configuration table 16.1 shows the input pins used with the mid-speed a/d converter. the av cc and av ss pins are for the mid-speed a/d converter internal analog section power supply. avref pin is the a/d conversion standard voltage. table 16.1 pin configuration pin abbreviation i/o function analog supply av cc i analog section power supply analog ground av ss i analog section ground and a/d conversion standard voltage standard voltage avref* i a/d conversion standard voltage (sh7041a, sh7043a and sh7045 only) a/d0 analog input 0 and i analog input channel 0 analog input 1 an1 i analog input channel 1 analog input 2 an2 i analog input channel 2 analog input 3 an3 i analog input channel 3 a/d1 analog input 4 an4 i analog input channel 4 analog input 5 an5 i analog input channel 5 analog input 6 an6 i analog input channel 6 analog input 7 an7 i analog input channel 7 a/d external trigger input adtrg i external trigger for a/d conversion start note: in the sh7040a, sh7042a, and sh7044, av ref is connected to av cc internally.
568 16.1.4 register configuration table 16.2 shows the register configuration of the mid-speed a/d converter. table 16.2 register configuration name abbreviation r/w initial value address access size a/d0 data register ah addra0h r h'00 h'ffff8400 8, 16 a/d0 data register al addra0l r h'00 h'ffff8401 8 a/d0 data register bh addrb0h r h'00 h'ffff8402 8, 16 a/d0 data register bl addrb0l r h'00 h'ffff8403 8 a/d0 data register ch addrc0h r h'00 h'ffff8404 8, 16 a/d0 data register cl addrc0l r h'00 h'ffff8405 8 a/d0 data register dh addrd0h r h'00 h'ffff8406 8, 16 a/d0 data register dl addrd0l r h'00 h'ffff8407 8 a/d0 control/status register adcsr0 r/(w)* h'00 h'ffff8410 8, 16 a/d0 control register adcr0 r/w h'7f h'ffff8412 8, 16 a/d1 data register ah addra1h r h'00 h'ffff8408 8, 16 a/d1 data register al addra1l r h'00 h'ffff8409 8 a/d1 data register bh addrb1h r h'00 h'ffff840a 8, 16 a/d1 data register bl addrb1l r h'00 h'ffff840b 8 a/d1 data register ch addrc1h r h'00 h'ffff840c 8, 16 a/d1 data register cl addrc1l r h'00 h'ffff840d 8 a/d1 data register dh addrd1h r h'00 h'ffff840e 8, 16 a/d1 data register dl addrd1l r h'00 h'ffff840f 8 a/d1 control/status register adcsr1 r/(w)* h'00 h'ffff8411 8 a/d1 control register adcr1 r/w h'7f h'ffff8413 8 note: only 0 can be written to bit 7 to clear the flag.
569 16.2 register descriptions 16.2.1 a/d data register a? (addra0?ddrd0, addra1?ddrd1) a/d registers are special registers that read stored results of a/d conversion in 16 bits. there are eight registers: addra0?ddrd0 (a/d0) and addra1?ddrd1 (a/d1). the a/d converted data is 10 bit data which is to the addr of the corresponding converted channel for storage. the upper 8 bits of the a/d converted data correspond to the upper byte of the addr and the lower 2 bits correspond to the lower byte. bits 5? of the lower byte of addr are reserved and always read 0. analog input channels and correspondence to addr are shown in table 16.3. addr can always be read from the cpu. the upper byte may be read directly. the lower byte is transferred through the temporary register (temp). for details, see 16.3, interface with cpu. addr is initialized to h'0000during power-on reset or standby mode.addr will not be initialized by manual reset. 1514131211109876543210 ad9ad8ad7ad6ad5ad4ad3ad2ad1ad0 0000000000000000 r addrn : r/w : rrrrrrrrrrrrrrr ( n=a to d ) initial value : bit : table 16.3 analog input channel and addra?ddrd correspondence analog input channel a/d data register module an0 addra0 a/d0 an1 addrb0 an2 addrc0 an3 addrd0 an4 addra1 a/d1 an5 addrb1 an6 addrc1 an7 addrd1
570 16.2.2 a/d control/status register (adcsr0, adcsr1) the a/d control/status registers (adcsr0, 1) are registers that can read/write in 8 bits and control a/d converter operations such as mode selection. there are the adcsr0 (a/d0) and adcsr1 (a/d1). the adcsr is initialized to h'00 during power-on reset or standby mode. manual reset does not initialize adcsr. adie adf adst scan cks ch1 ch0 76543210 00000010 r/w : r/(w)* r/w r/w r/w r/w r r/w r/w bit : initial value : note: only 0 can be written to clear the flag. bit 7?/d end flag (adf): status flag that indicates end of a/d conversion. bit 7: adf description 0 [clear conditions] (initial value) 1. writing 0 to adf after reading adf with adf=1 2. when registers of the mid-speed converter are accessed after the dmac and dtc are activated by adi interrupt. 1 [set conditions] 1. single mode: when a/d conversion is complete 2. scan mode: when a/d conversion of all designated channels are complete bit 6?/d interrupt enable (adie): enables or disables interrupt request (adi) due to completion of a/d conversion. bit 6: adie description 0 disables interrupt request (adi) due to completion of a/d conversion (initial value) 1 enables interrupt request (adi) due to completion of a/d conversion
571 bit 5?/d start (adst): selects start/end of a/d conversion. a1 is maintained during a/d conversion start. it is also possible to set a 1 by the a/d conversion trigger input pin (adtrg). bit 5: adst description 0 a/d conversion halted (initial value) 1 1. single mode: starts a/d conversion. automatically clears to 0 when conversion of the designated channel is complete 2. scan mode: starts a/d conversion. continuous conversion until cleared to 0 by the software bit 4?can mode (scan): selects the a/d conversion mode from single mode and scan mode. for operations during single/scan mode, see 16.4 operation. when switching modes, proceed while adst=0. bit 4: scan description 0 single mode (initial value) 1 scan mode bit 3?lock select (cks): sets the a/d conversion time. proceed conversion time switch while adst=0. always set cks=0 when operating frequency exceeds 20mhz. bit 3: cks description 0 conversion time = 266 states (max) (initial value) 1 conversion time = 134 states (max) bit 2?eserved bit: bit 2 always reads 0. furthermore, always write 0. bits 1, 0?hannel select 1, 0 (ch1, ch0): selects the analog input channel along with the scan bit. switch channels while adst=0.
572 channel selection description single mode scan mode ch1 ch0 a/d0 a/d1 a/d0 a/d1 0 0 an0 (initial value) an4 (initial value) an0 an4 1 an1 an5 an0, an1 an4, an5 1 0 an2 an6 an0, an1 an4?n6 1 an3 an7 an0?n3 an4?n7 16.2.3 a/d control register (adcr0, adcr1) a/d control registers (adcr0, 1) are registers that can read/write in 8 bits and enables or disables a/d conversion start of the external trigger input. there are the adcr0 (a/d0) and adcr1 (a/d1). adcr is initialized to h'7f during power-on reset and standby mode. manual reset does not initialize adcr. trge 76543210 01111111 r/w : r/w r r r r r r r initial value : bit : bit 7?rigger enable (trge): enables or disables a/d conversion start of input from external or mtu trigger. bit 7: trge description 0 disables a/d conversion start of external or mtu trigger (initial value) 1 starts a/d conversion on last transition edge of a/d conversion trigger input pin ( adtrg ) or mtu trigger. a/d0 and a/d1 are common for external trigger pin and mtu trigger. a/d0 and a/d1 settings are of logical sum. bits 6??eserved bits: these bits always read as 1. the write value should always be 1.
573 16.3 interface with cpu although a/d data register addr (addra0?ddrd0, addra1?ddrd1) are 16-bit registers, the bus width within the chip that integrates with the cpu is 8-bits. so, upper and lower data of the addr must be read separately. to avoid change in data while reading the upper/lower 2 bytes of addr, the lower byte data is read through the temporary register (temp). the upper byte data can be read directly. the procedure for reading data from addr is as follows: first, read the upper byte data from addr. at this time, the upper byte data is read directly into the cpu and the lower byte data is transferred to temp of the mid-speed a/d converter. next, read the lower byte to read the temp contents into the cpu. when reading the addr in byte size, read the upper byte before the lower byte. furthermore, it is possible to read only the upper byte, however, please note that contents are not guaranteed when reading only the lower byte. in addition, when reading addr in word size, upper byte is automatically read before the lower byte. figure 16.2 shows the data flow when reading from addr. cpu (h'aa) addrnh (h'aa) addrnl (h'40) temp (h'40) cpu (h'40) addrnh (h'aa) addrnl (h'40) temp (h'40) bus interface module data bus bus interface module data bus figure 16.2 addr access operation (during reading of (h'aa40))
574 16.4 operation the mid-speed converter operates using the continuous comparison method and is equipped with 10-bit resolution. operations for the single and scan modes are explained below. 16.4.1 single mode (scan=0) the single mode is selected when executing a/d conversion for one channel only. a/d conversion is initiated when the adst bit of the a/d control/status register is set to 1 by the software or external trigger input. the adst bit is held to 1 during the a/d conversion and is automatically cleared to 0 upon completion. when conversion is complete, the adf bit of adcsr is set to 1. at this time, if the adie bit of adcsr is 1, adi interrupt request occurs. the adf bit can be cleared by writing 0 after reading adf=1. to switch modes or analog input channels during a/d conversion, clear the adst bit to 0 and stop a/d conversion to avoid malfunction. after switching (mode/channel change and adst bit setting can be made at the same time), set the adst bit to 1 to restart a/d conversion. an example of operation when channel 1 (an1) is selected in the single mode is shown in figure 16.3 (the bit specification in the example is the adcsr0 register). 1. set operation mode to single mode (scan=0), input channel to an1 (ch1=0, ch0=1) and a/d interrupt request to enable (adie) then start a/d conversion (adst=1). 2. when a/d conversion is complete, a/d conversion result is transferred to addrb0. at the same time, adf=1 will become adf=0 and the mid-speed converter will standby for conversion. 3. since adf=1 and adie=1, adi interrupt request will occur. 4. the a/d interrupt process routine will start. 5. after reading adf=1, write 0 to adf. 6. read the a/d conversion result (addrb0) and process. 7. end a/d interrupt process routine execution. when adst bit is set to 1, a/d conversion starts, following steps (2) to (7) above.
575 adie adst adf addra addrb addrc addrd note: indicates command execution by the software set * set * set * clear * a/d conversion start clear * channel 3 (an3) operation state channel 0 (an0) operation state channel 1 (an1) operation state channel 2 (an2) operation state conversion standby conversion standby conversion standby conversion standby conversion standby conversion standby a/d conversion (1) a/d conversion (2) reading conversion result reading conversion result a/d conversion result (1) a/d conversion result (2) figure 16.3 operation example of mid-speed a/d converter (single mode, channel 1 selected)
576 16.4.2 scan mode (scan=1) the scan mode is optimal for monitoring analog input of multiple channels (including channel 1). a/d conversion is started from channel 1 (an0 for a/d0 and an4 for a/d1) of the group when the adst bit of the a/d control/status register (adcsr) is set to 1 by the software or external trigger input. when multiple channels are selected, a/d conversion of channel 2 (an1 or an5) is initiated immediately after completion of the channel 1 conversion. to switch modes or analog input channels during a/d conversion, clear the adst bit to 0 and stop a/d conversion to avoid malfunction. after switching (mode/channel change and adst bit setting can be made at the same time), set adst bit to 1 to restart a/d conversion from channel 1. an example of operation when three channels of a/d0 (an0?) are selected for a/d conversion is shown in figure 16.4 (the bit specification in the example is the adcsr0 register). 1. set operation mode to scan mode (scan=1), set analog channels to an0? (ch1=1, ch0=0) then start a/d conversion (adst=1). 2. when a/d conversion for channel 1 is complete, a/d conversion result is transferred to addra0. next, channel 2 (an1) will automatically be selected and conversion will begin. 3. in the same manner, channel 3 will be converted (an2). 4. when conversion of all of the selected channels (an0?n2) are complete, adf will become 1 and channel 1 (an0) will again be selected and conversion will begin. at this time, if the adie bit is set to 1, adi interrupt request will occur after completing a/d conversion. 5. steps (2) to (4) will be repeated while adst bit is set to 1. a/d conversion will stop when setting the adst bit to 0. when setting the adst bit to 1, a/d conversion will start again from channel 1 (an0).
577 adst adf addra addrb addrc addrd * 2 a/d continuous conversion set * 1 clear * 1 clear * 1 channel 0 (an0) operation condition channel 1 (an1) operation condition channel 2 (an2) operation condition channel 3 (an3) operation condition conversion standby conversion standby conversion standby conversion standby conversion standby conversion standby conversion standby conversion standby a/d conversion(1) a/d conversion(2) a/d conversion(3) a/d conversion(4) a/d conversion(5) a/d conversion time transfer a/d conversion result(1) a/d conversion result(4) a/d conversion result(2) a/d conversion result(3) note: 1. indicates command execution by the software 2. data is ignored during conversion figure 16.4 operation example of mid-speed a/d converter (scan mode, three channels selected) (an0?n2)
578 16.4.3 input sampling and a/d conversion time the mid-speed a/d converter is equipped with a sample and hold circuit. the mid-speed a/d converter samples input after t d hours has elapsed since setting the adst bit of the a/d control/status register (adcsr) to 1, then begins conversion. the a/d conversion timing is shown in table 16.4. the a/d conversion time, as shown in figure 16.5, includes both t d and input sampling time. here, t d is determined by the write timing to adcsr and is not constant. thus the conversion time changes in the range shown in table 16.4. the conversion time shown in table 16.4 is the time for the first conversion. for the second conversion and after, the time will be 256 state (fixed) for cks=0 and 128 state (fixed) for cks=1. (1) (2) ck adf t d t spl t conv < key> (1): write cycle of adcsr (2): address of adcsr address write signal input sampling timing t d : a/d conversion start delay time t spl : input sampling time t conv : a/d conversion time figure 16.5 a/d conversion timing
579 table 16.4 a/d conversion time (single mode) cks=0 cks=1 notation min typ max min typ max a/d conversion start delay time t d 10?76 ? input sampling time t spl 64 32 a/d conversion time t ccnv 259 266 131 134 note: numbers in the table are in states (t cyc ). 16.4.4 external trigger input timing it is possible to start a/d conversion from an external trigger input. external trigger input is input from the adtrg pin or mtu when the trge bit of the a/d control register (adcr) is set to 1. a/d conversion is started when the adst bit of the a/d control/status register (adcsr) is set to 1 by the adtrg input pin last transition edge or mtu trigger. other operations, regardless of whether in the single or scan mode, are the same as when setting the adst bit to 1 with the software. figure 16.6 shows an example of external trigger input timing. adtrg external trigger signal a/d conversion ck adst figure 16.6 external trigger input timing
580 16.5 interrupt and dma, dtc transfer requests the mid-speed a/d converter generates a/d conversion complete interrupt when completing a/d conversion. the adi interrupt request can be enabled or disabled by the adie bit of adcsr. it is also possible to activate dma or dtc transfer by the adi interrupt request. it is possible to activate dtc with adi0 interrupt of a/d0 and activate dmac with adi1 interrupt of a/d1. table 16.5 shows the interrupt factors of the mid-speed a/d converter. table 16.5 mid-speed a/d converter interrupt factors mid-speed a/d converter interrupt factor content dtc dmac a/d0 adi0 interrupt by conversion complete o a/d1 adi1 o o: activation enabled : activation disabled when accessing the a/d0 register with dtc activated by adi0 interrupt, the adf bit of the a/d0 control/status register (adcsr0) will automatically be cleared to 0. furthermore, it is possible to automatically clear the adf bit of adcsr1 by register access of a/d1 with activated dmac of adi1 interrupt. for details on the automatic clearing operation of this interrupt factor, see section 8 data transfer controller.
581 16.6 a/d conversion precision definitions the medium-speed a/d converter converts analog values input from analog input channels to 10- bit digital values by comparing them with an analog reference voltage. in this operation, the absolute precision of the a/d conversion (i.e. the deviation between the input analog value and the output digital value) includes the following kinds of error. (1) offset error (2) full-scale error (3) quantization error (4) nonlinearity error the above four kinds of error are described below with reference to figure 16.7. for the sake of clarity, this figure shows 3-bit medium-speed a/d conversion rather than 10-bit medium-speed a/d conversion. offset error (see figure 16.7 (1)) is the deviation between the actual a/d conversion characteristic and the ideal a/d conversion characteristic when the digital output value changes from the minimum value (zero voltage) of 0000000000 (000 in the figure) to 0000000001 (001 in the figure ). full-scale error (see figure 16.7 (2)) is the deviation between the actual a/d conversion characteristic and the ideal a/d conversion characteristic when the digital output value changes from 1111111110 (110 in the figure) to the maximum value (full-scale voltage) of 111111111 (111 in the figure). quantization error is the deviation inherent in the medium-speed a/d converter, given by 1/2 lsb (see figure 16.7 (3)). nonlinearity error is the deviation between the actual a/d conversion characteristic and the ideal a/d conversion characteristic from zero voltage to full-scale voltage (see figure 16.7 (4)). this does not include offset error, full-scale error, and quantization error. 0 1/8 2/8 3/8 4/8 5/8 6/8 7/8 fs 111 110 101 100 011 010 001 000 analog input voltage (3) quantization error (4) nonlinearity error (2) full-scale error ideal a/d conversion characteristic ideal a/d conversion characteristic digital output digital output fs : full-scale voltage fs analog input voltage actual a/d conversion characteristic (1) offset error figure 16.7 a/d conversion precision definitions
582 16.7 usage notes the following points should be noted when using the mid-speed a/d converter. 16.7.1 analog voltage settings (1) analog input voltage range the voltage applied to analog input pins during a/d conversion should be in the range av ss ann av ref (n = 0 to 7). (2) av cc and av ss input voltages for the av cc and av ss input voltages, set av cc = v cc ?0% and av ss = v ss . when the medium-speed a/d converter is not used, set av cc = v cc and av ss = v ss . (3) av ref input voltage for the av ref pin input voltage analog reference, set av ref av cc . when the medium- speed a/d converter is not used, set av ref = av cc . (4) av cc and av ref must be connected to the power supply (v cc ) even if the medium-speed a/d converter is not used or is in standby mode. 16.7.2 handling of analog input pins to prevent damage from surges and other abnormal voltages at the analog input pins (an0-an7), connect a protection circuit such as that shown in figure 16.8. this circuit also includes a cr filter function that suppresses error due to noise. the circuit shown here is only a design example; circuit constants must be decided on the basis of the actual operating conditions. figure 16.9 shows an equivalent circuit for the analog input pins, and table 16.6 summarizes the analog input pin specifications.
583 av cc av ref an0?n15 av ss this lsi notes: 10 m f 0.01 m f r in * 2 * 1 * 1 0.1 m f 100 w 1. 2. r in : input impedance figure 16.8 example of analog input pin protection circuit
584 an0 to an7 1.0k 20pf 1m w analog multiplexer mid-speed a/d converter note : numbers are only to be noted as reference value figure 16.9 equivalent circuit for the analog input pins table 16.6 analog pin specifications item min max unit analog input capacitance 20 pf permissible signal source impedance 1 k
585 section 17 compare match timer (cmt) 17.1 overview the sh7040 series has an on-chip compare match timer (cmt) configured of 16-bit timers for two channels. the cmt has 16-bit counters and can generate interrupts at set intervals. 17.1.1 features the cmt has the following features: four types of counter input clock can be selected ? one of four internal clocks ( f /8, f /32, f /128, f /512) can be selected independently for each channel. interrupt sources ? a compare match interrupt can be requested independently for each channel. 17.1.2 block diagram figure 17.1 shows a block diagram of the cmt.
586 cm10 control circuit internal bus clock selection control circuit clock selection cmi1 f /8 f /32 f /128 f /512 f /8 f /32 f /128 f /512 cmcsr1 cmcor1 cmcnt1 cmcnt0 cmcor0 comparator cmstr cmcsr0 comparator bus interface module bus cmt cmstr: cmcsr: cmcor: cmcnt: cmi: compare match timer start register compare match timer control/status register compare match timer constant register compare match timer counter compare match interrupt figure 17.1 cmt block diagram
587 17.1.3 register configuration table 17.1 summarizes the cmt register configuration. table 17.1 register configuration channel name abbreviation r/w initial value address access size (bits) shared compare match timer start register cmstr r/w h'0000 h'ffff83d0 8, 16, 32 0 compare match timer control/status register 0 cmcsr0 r/(w)* h'0000 h'ffff83d2 8, 16, 32 compare match timer counter 0 cmcnt0 r/w h'0000 h'ffff83d4 8, 16, 32 compare match timer constant register 0 cmcor0 r/w h'ffff h'ffff83d6 8, 16, 32 1 compare match timer control/status register 1 cmcsr1 r/(w)* h'0000 h'ffff83d8 8, 16, 32 compare match timer counter 1 cmcnt1 r/w h'0000 h'ffff83da 8, 16, 32 compare match timer constant register 1 cmcor1 r/w h'ffff h'ffff83dc 8, 16, 32 note: the only value that can be written to the cmcsr0 and cmcsr1 cmf bits is a 0 to clear the flags.
588 17.2 register descriptions 17.2.1 compare match timer start register (cmstr) the compare match timer start register (cmstr) is a 16-bit register that selects whether to operate or halt the channel 0 and channel 1 counters (cmcnt). it is initialized to h'0000 by power-on resets and by standby mode. manual reset does not initialize cmstr. bit: 15 14 13 12 11 10 9 8 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 1 0 str1 str0 initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r r/w r/w bits 15??eserved: these bits always read as 0. the write value should always be 0. bit 1?ount start 1 (str1): selects whether to operate or halt compare match timer counter 1. bit 1: str1 description 0 cmcnt1 count operation halted (initial value) 1 cmcnt1 count operation bit 0?ount start 0 (str0): selects whether to operate or halt compare match timer counter 0. bit 0: str0 description 0 cmcnt0 count operation halted (initial value) 1 cmcnt0 count operation
589 17.2.2 compare match timer control/status register (cmcsr) the compare match timer control/status register (cmcsr) is a 16-bit register that indicates the occurrence of compare matches, sets the enable/disable of interrupts, and establishes the clock used for incrementation. it is initialized to h'0000 by power-on resets and by standby mode. manual reset does not initialize cmcsr. bit: 15 14 13 12 11 10 9 8 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 1 0 cmf cmie cks1 cks0 initial value: 0 0 0 0 0 0 0 0 r/w: r/(w)* r/w r r r r r/w r/w note: the only value that can be written is a 0 to clear the flag. bits 15? and 5??eserved: these bits always read as 0. the write value should always be 0. bit 7?ompare match flag (cmf): this flag indicates whether or not the cmcnt and cmcor values have matched. bit 7: cmf description 0 cmcnt and cmcor values have not matched (initial status) clear condition: write a 0 to cmf after reading a 1 from it 1 cmcnt and cmcor values have matched bit 6?ompare match interrupt enable (cmie): selects whether to enable or disable a compare match interrupt (cmi) when the cmcnt and cmcor values have matched (cmf = 1). bit 6: cmie description 0 compare match interrupts (cmi) disabled (initial status) 1 compare match interrupts (cmi) enabled
590 bits 1, 0?lock select 1, 0 (cks1, cks0): these bits select the clock input to the cmcnt from among the four internal clocks obtained by dividing the system clock ( f ). when the str bit of the cmstr is set to 1, the cmcnt begins incrementing with the clock selected by cks1 and cks0. bit 1: cks1 bit 0: cks0 description 00 f /8 (initial status) 1 f /32 10 f /128 1 f /512 17.2.3 compare match timer counter (cmcnt) the compare match timer counter (cmcnt) is a 16-bit register used as an upcounter for generating interrupt requests. when an internal clock is selected with the cks1, cks0 bits of the cmcsr register and the str bit of the cmstr is set to 1, the cmcnt begins incrementing with that clock. when the cmcnt value matches that of the compare match timer constant register (cmcor), the cmcnt is cleared to h'0000 and the cmf flag of the cmcsr is set to 1. if the cmie bit of the cmcsr is set to 1 at this time, a compare match interrupt (cmi) is requested. the cmcnt is initialized to h'0000 by power-on resets and by standby mode. manual reset does not initialize cmcnt. bit: 15 14 13 12 11 10 9 8 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 bit: 7 6 5 4 3 2 1 0 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
591 17.2.4 compare match timer constant register (cmcor) the compare match timer constant register (cmcor) is a 16-bit register that sets the compare match period with the cmcnt. the cmcor is initialized to h'ffff by power-on resets and by standby mode. there is no initializing with manual reset. bit: 15 14 13 12 11 10 9 8 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 bit: 7 6 5 4 3 2 1 0 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 17.3 operation 17.3.1 period count operation when an internal clock is selected with the cks1, cks0 bits of the cmcsr register and the str bit of the cmstr is set to 1, the cmcnt begins incrementing with the selected clock. when the cmcnt counter value matches that of the compare match constant register (cmcor), the cmcnt counter is cleared to h'0000 and the cmf flag of the cmcsr register is set to 1. if the cmie bit of the cmcsr register is set to 1 at this time, a compare match interrupt (cmi) is requested. the cmcnt counter begins counting up again from h'0000. figure 17.2 shows the compare match counter operation. cmcor h'0000 cmcnt value time counter cleared by cmcor compare match figure 17.2 counter operation
592 17.3.2 cmcnt count timing one of four clocks ( f /8, f /32, f /128, f /512) obtained by dividing the system clock (ck) can be selected by the cks1, cks0 bits of the cmcsr. figure 17.3 shows the timing. ck n ?1 n n + 1 internal clock cmcnt input clock cmcnt figure 17.3 count timing 17.4 interrupts 17.4.1 interrupt sources and dtc activation the cmt has a compare match interrupt for each channel, with independent vector addresses allocated to each of them. the corresponding interrupt request is output when the interrupt request flag cmf is set to 1 and the interrupt enable bit cmie has also been set to 1. when activating cpu interrupts by interrupt request, the priority between the channels can be changed by using the interrupt controller settings. see section 6, interrupt controller, for details. interrupt requests can also be used as data transfer controller (dtc) activating sources. in this case, channel priorities are fixed. see section 8, data transfer controller, for details. 17.4.2 compare match flag set timing the cmf bit of the cmcsr register is set to 1 by the compare match signal generated when the cmcor register and the cmcnt counter match. the compare match signal is generated upon the final state of the match (timing at which the cmcnt counter matching count value is updated). consequently, after the cmcor register and the cmcnt counter match, a compare match signal will not be generated until a cmcnt counter input clock occurs. figure 17.4 shows the cmf bit set timing.
593 ck cmcnt input clock cmcnt cmcor compare match signal cmf cmi n n 0 figure 17.4 cmf set timing 17.4.3 compare match flag clear timing the cmf bit of the cmcsr register is cleared either by writing a 0 to it after reading a 1, or by a clear signal after a dtc transfer. figure 17.5 shows the timing when the cmf bit is cleared by the cpu. t 2 t 1 ck cmf cmcsr write cycle figure 17.5 timing of cmf clear by the cpu
594 17.5 notes on use take care that the contentions described in sections 17.5.1?7.5.3 do not arise during cmt operation. 17.5.1 contention between cmcnt write and compare match if a compare match signal is generated during the t 2 state of the cmcnt counter write cycle, the cmcnt counter clear has priority, so the write to the cmcnt counter is not performed. figure 17.6 shows the timing. t 1 t 2 ck address internal write signal compare match signal cmcnt cmcnt write cycle cmcnt n h'0000 figure 17.6 cmcnt write and compare match contention
595 17.5.2 contention between cmcnt word write and incrementation if an increment occurs during the t 2 state of the cmcnt counter word write cycle, the counter write has priority, so no increment occurs. figure 17.7 shows the timing. cmcnt write data t 1 t 2 ck address internal write signal compare match signal cmcnt cmcnt write cycle cmcnt nm figure 17.7 cmcnt word write and increment contention
596 17.5.3 contention between cmcnt byte write and incrementation if an increment occurs during the t 2 state of the cmcnt byte write cycle, the counter write has priority, so no increment of the write data results on the writing side. the byte data on the side not performing the writing is also not incremented, so the contents are those before the write. figure 17.8 shows the timing when an increment occurs during the t 2 state of the cmcnth write cycle. t 1 t 2 ck address internal write signal cmcnt input clock cmcnth cmcnt write cycle cmcnth n m cmcnth write data x x cmcntl figure 17.8 cmcnt byte write and increment contention
597 section 18 pin function controller 18.1 overview the pin function controller (pfc) is composed of registers for selecting the function of multiplexed pins and the direction of input/output. table 18.1 lists the sh7040 series? multiplexed pins. the multiplex pin functions have restrictions dependent on the operating mode. table 18.2 lists the pin functions and initial values for each operating mode. table 18.1 multiplexed pins port function 1 (related module) function 2 (related module) function 3 (related module) function 4 (related module) fp- 112 fp- 144 tfp- 120 a pa23 i/o (port) wrhh output (bsc) 1 pa22 i/o (port) wrhl output (bsc) 3 pa21 i/o (port) cashh output (bsc) 4 pa20 i/o (port) cashl output (bsc) 29 pa19 i/o (port) back output (bsc) drak1 output (dmac) 30 pa18 i/o (port) breq input (bsc) drak0 output (dmac) 33 pa17 /o (port) wait input (bsc) 101 pa16 i/o (port) ah output (bsc) 100 pa15 i/o (port) ck output (cpg) 83 107 88 pa14 i/o (port) rd output (bsc) 34 43 37 pa13 i/o (port) wrh output (bsc) 36 47 39 pa12 i/o (port) wrl output (bsc) 38 48 41 pa11 i/o (port) cs1 output (bsc) 40 49 43 pa10 i/o (port) cs0 output (bsc) 41 50 44 pa9 i/o (port) tclkd input (mtu) irq3 (intc) 42 51 45 pa8 i/o (port) tclkc input (mtu) irq2 (intc) 43 52 46 pa7 i/o (port) tclkb input (mtu) cs3 output (bsc) 44 53 47 pa6 i/o (port) tclka input (mtu) cs2 output (bsc) 45 54 48 pa5 i/o (port) sck1 i/o (sci) dreq1 input (dmac) irq1 input (intc) 46 136 49
598 table 18.1 multiplexed pins (cont) port function 1 (re-lated module) function 2 (related module) function 3 (related module) function 4 (related module) fp- 112 fp- 144 tfp- 120 a pa4 i/o (port) txd1 output (sci) 47 134 50 pa3 i/o (port) rxd1 input (sci) 48 133 51 pa2 i/o (port) sck0 i/o (sci) dreq0 input (dmac) irq0 input (intc) 49 132 52 pa1 i/o (port) txd0 output (sci) 50 131 53 pa0 i/o (port) rxd0 input (sci) 51 130 54 b pb9 i/o (port) irq7 input (intc) a21 output (bsc) adtrg input (a/d) 32 41 35 pb8 i/o (port) irq6 input (intc) a20 output (bsc) wait input (bsc) 31 39 34 pb7 i/o (port) irq5 input (intc) a19 output (bsc) breq input (bsc) 30 38 33 pb6 i/o (port) irq4 input (intc) a18 output (bsc) back output (bsc) 29 37 32 pb5 i/o (port) irq3 input (intc) poe3 input (port) rdwr output (bsc)28 36 29 pb4 i/o (port) irq2 input (intc) poe2 input (port) cash output (bsc) 26 34 27 pb3 i/o (port) irq1 input (intc) poe1 input (port) casl output (bsc) 25 32 26 pb2 i/o (port) irq0 input (intc) poe0 input (port) ras output (bsc) 24 31 25 pb1 i/o (port) a17 input (bsc) 22 27 23 pb0 i/o (port) a16 output (bsc) 20 25 21 c pc15 i/o (port) a15 output (bsc) 19 24 20 pc14 i/o (port) a14 output (bsc) 18 23 19 pc13 i/o (port) a13 output (bsc) 17 22 18 pc12 i/o (port) a12 output (bsc) 16 21 17 pc11 i/o (port) a11 output (bsc) 15 20 16 pc10 i/o (port) a10 output (bsc) 14 19 15 pc9 i/o (port) a9 output (bsc) 13 18 14 pc8 i/o (port) a8 output (bsc) 12 17 13 pc7 i/o (port) a7 output (bsc) 11 16 12
599 table 18.1 multiplexed pins (cont) port function 1 (related module) function 2 (related module) function 3 (related module) function 4 (related module) fp- 112 fp- 144 tfp- 120 c pc6 i/o (port) a6 output (bsc) 10 15 11 pc5 i/o (port) a5 output (bsc) 9 13 10 pc4 i/o (port) a4 output (bsc) 8 11 9 pc3 i/o (port) a3 output (bsc) 7 10 8 pc2 i/o (port) a2 output (bsc) 6 9 7 pc1 i/o (port) a1 output (bsc) 5 8 6 pc0 i/o (port) a0 output (bsc) 4 7 5 d pd31 i/o (port) d31 i/o (bsc) adtrg input (a/d) 45 pd30 i/o (port) d30 i/o (bsc) irqout output (intc) 46 pd29 i/o (port) d29 i/o (bsc) cs3 output (bsc) 56 pd28 i/o (port) d28 i/o (bsc) cs2 output (bsc) 57 pd27 i/o (port) d27 i/o (bsc) dack1 output (dmac) 58 pd26 i/o (port) d26 i/o (bsc) dack0 output (dmac) 59 pd25 i/o (port) d25 i/o (bsc) dreq1 input (dmac) 60 pd24 i/o (port) d24 i/o (bsc) dreq0 input (dmac) 62 pd23 i/o (port) d23 i/o (bsc) irq7 input (intc) 64 pd22 i/o (port) d22 i/o (bsc) irq6 input (intc) 65 pd21 i/o (port) d21 i/o (bsc) irq5 input (intc) 66 pd20 i/o (port) d20 i/o (bsc) irq4 input (intc) 67 pd19 i/o (port) d19 i/o (bsc) irq3 input (intc) 68 pd18 i/o (port) d18 i/o (bsc) irq2 input (intc) 69 pd17 i/o (port) d17 i/o (bsc) irq1 input (intc) 70 pd16 i/o (port) d16 i/o (bsc) irq0 input (intc) 72 pd15 i/o (port) d15 i/o (bsc) 52 73 55 pd14 i/o (port) d14 i/o (bsc) 53 74 56
600 table 18.1 multiplexed pins (cont) port function 1 (related module) function 2 (related module) function 3 (related module) function 4 (related module) fp- 112 fp- 144 tfp- 120 d pd13 i/o (port) d13 i/o (bsc) 54 75 57 pd12 i/o (port) d12 i/o (bsc) 56 76 59 pd11 i/o (port) d11 i/o (bsc) 57 78 62 pd10 i/o (port) d10 i/o (bsc) 58 80 63 pd9 i/o (port) d9 i/o (bsc) 59 81 64 pd8 i/o (port) d8 i/o (bsc) 60 82 65 pd7 i/o (port) d7 i/o (bsc) 62 83 67 pd6 i/o (port) d6 i/o (bsc) 63 84 68 pd5 i/o (port) d5 i/o (bsc) 64 86 69 pd4 i/o (port) d4 i/o (bsc) 66 88 71 pd3 i/o (port) d3 i/o (bsc) 67 89 72 pd2 i/o (port) d2 i/o (bsc) 68 90 73 pd1 i/o (port) d1 i/o (bsc) 69 91 74 pd0 i/o (port) d0 i/o (bsc) 70 92 75 e pe15 i/o (port) tioc4d i/o (mtu) dack1 output (dmac) irqout output (intc) 253 pe14 i/o (port) tioc4c i/o (mtu) dack0 output (dmac) ah output (bsc) 1 2 2 pe13 i/o (port) tioc4b i/o (mtu) mres input (intc) 112 144 120 pe12 i/o (port) tioc4a i/o (mtu) 111 143 119 pe11 i/o (port) tioc3d i/o (mtu) 110 142 118 pe10 i/o (port) tioc3c i/o (mtu) 108 140 116 pe9 i/o (port) tioc3b i/o (mtu) 107 139 115 pe8 i/o (port) tioc3a i/o (mtu) 106 138 114 pe7 i/o (port) tioc2b i/o (mtu) 105 137 113 pe6 i/o (port) tioc2a i/o (mtu) 104 116 112 pe5 i/o (port) tioc1b i/o (mtu) 102 115 109 pe4 i/o (port) tioc1a i/o (mtu) 89 114 96
601 table 18.1 multiplexed pins (cont) port function 1 (related module) function 2 (related module) function 3 (related module) function 4 (related module) fp- 112 fp- 144 tfp- 120 e pe3 i/o (port) tioc0d i/o (mtu) drak1 output (dmac) 88 113 95 pe2 i/o (port) tioc0c i/o (mtu) dreq1 input (dmac) 87 111 94 pe1 i/o (port) tioc0b i/o (mtu) drak0 output (dmac) 86 110 93 pe0 i/o (port) tioc0a i/o (mtu) dreq0 input (dmac) 85 109 92 f pf7 input (port) an7 input (a/d) 99 126 106 pf6 input (port) an6 input (a/d) 98 125 105 pf5 input (port) an5 input (a/d) 96 123 103 pf4 input (port) an4 input (a/d) 95 122 102 pf3 input (port) an3 input (a/d) 94 121 101 pf2 input (port) an2 input (a/d) 93 120 100 pf1 input (port) an1 input (a/d) 92 119 99 pf0 input (port) an0 input (a/d) 91 118 98
602 pin name fp144 12,26,40,63 77,85,112 135 6,14,28,35 42,55,61,71 79,87,93 117,129,141 92 91 90 89 88 86 84 83 82 81 80 78 76 75 74 73 72 70 69 68 67 66 65 64 62 60 59 58 57 56 46 45 7 8 9 10 11 13 15 16 17 18 19 20 21 pin no. tfp120 22, 40, 70, 82, 111 4, 24, 28, 36, 42, 58, 66, 76, 97, 108, 117 75 74 73 72 71 69 68 67 65 64 63 62 59 57 56 55 5 6 7 8 9 10 11 12 13 14 15 16 17 fp112 21,37,65 103 3,23,27,33 39,55,61,71 90,101,109 70 69 68 67 66 64 63 62 60 59 58 57 56 54 53 52 4 5 6 7 8 9 10 11 12 13 14 15 16 single chip mode mpu mode0 mpu mode 1 mpu mode2 on-chip rom enabled prom mode v cc initial function v cc v cc on-chip rom disabled v cc v cc v cc v cc v cc v cc v ss v ss d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 d10 d11 d12 d13 d14 d15 pd16 pd17 pd18 pd19 pd20 pd21 pd22 pd23 pd24 pd25 pd26 pd27 pd28 pd29 pd30 pd31 a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 v ss d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 d10 d11 d12 d13 d14 d15 pd16/d16/ irq0 pd17/d17/ irq1 pd18/d18/ irq2 pd19/d19/ irq3 pd20/d20/ irq4 pd21/d21/ irq5 pd22/d22/ irq6 pd23/d23/ irq7 pd24/d24/ dreq0 pd25/d25/ dreq1 pd26/d26/dack0 pd27/d27/dack1 pd28/d28/ cs2 pd29/d29/ cs3 pd30/d30/ irqout pd31/d31/ adtrg a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 v ss d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 d10 d11 d12 d13 d14 d15 d16 d17 d18 d19 d20 d21 d22 d23 d24 d25 d26 d27 d28 d29 d30 d31 a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 v ss d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 d10 d11 d12 d13 d14 d15 d16 d17 d18 d19 d20 d21 d22 d23 d24 d25 d26 d27 d28 d29 d30 d31 a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 v ss pd0 pd1 pd2 pd3 pd4 pd5 pd6 pd7 pd8 pd9 pd10 pd11 pd12 pd13 pd14 pd15 pd16 pd17 pd18 pd19 pd20 pd21 pd22 pd23 pd24 pd25 pd26 pd27 pd28 pd29 pd30 pd31 pc0 pc1 pc2 pc3 pc4 pc5 pc6 pc7 pc8 pc9 pc10 pc11 pc12 v ss v ss v ss pd0/d0 pd1/d1 pd2/d2 pd3/d3 pd4/d4 pd5/d5 pd6/d6 pd7/d7 pd8/d8 pd9/d9 pd10/d10 pd11/d11 pd12/d12 pd13/d13 pd14/d14 pd15/d15 pd16/d16/ irq0 pd17/d17/ irq1 pd18/d18/ irq2 pd19/d19/ irq3 pd20/d20/ irq4 pd21/d21/ irq5 pd22/d22/ irq6 pd23/d23/ irq7 pd24/d24/ dreq0 pd25/d25/ dreq1 pd26/d26/dack0 pd27/d27/dack1 pd28/d28/ cs2 pd29/d29/ cs3 pd30/d30/ irqout pd31/d31/ adtrg pc0/a0 pc1/a1 pc2/a2 pc3/a3 pc4/a4 pc5/a5 pc6/a6 pc7/a7 pc8/a8 pc9/a9 pc10/a10 pc11/a11 pc12/a12 pd0 pd1 pd2 pd3 pd4 pd5 pd6 pd7 pd8 pd9 pd10 pd11 pd12 pd13 pd14 pd15 pd16 pd17 pd18 pd19 pd20 pd21 pd22 pd23 pd24 pd25 pd26 pd27 pd28 pd29 pd30 pd31 pc0 pc1 pc2 pc3 pc4 pc5 pc6 pc7 pc8 pc9 pc10 pc11 pc12 pd0 pd1 pd2 pd3 pd4 pd5 pd6 pd7 pd8 pd9 pd10 pd11 pd12 pd13 pd14 pd15 pd16/ irq0 pd17/ irq1 pd18/ irq2 pd19/ irq3 pd20/ irq4 pd21/ irq5 pd22/ irq6 pd23/ irq7 pd24 pd25 pd26 pd27 pd28 pd29 pd30 pd31/ adtrg pc0 pc1 pc2 pc3 pc4 pc5 pc6 pc7 pc8 pc9 pc10 pc11 pc12 d0 d1 d2 d3 d4 d5 d6 d7 nc nc nc nc nc nc nc nc nc nc nc nc nc nc nc nc nc nc nc nc nc nc nc nc a0 a1 a2 a3 a4 a5 a6 a7 a8 nc a10 a11 a12 table 18.2 pin arrangement by mode pfc selected function possiblilities initial function pfc selected function possiblilities initial function pfc selected function possiblilities initial function pfc selected function possiblilities
603 22 23 24 25 27 31 32 34 36 37 38 39 41 130 131 132 133 134 136 54 53 52 51 50 49 48 47 43 107 100 101 33 30 29 4 3 1 104 106 96 94 105 98 108 44 103 102 97 95 99 128 124 17 18 19 20 22 24 25 26 28 29 30 31 32 51 50 49 48 47 46 45 44 43 42 41 40 38 36 34 83 80 82 74 72 81 76 84 35 79 78 75 73 77 100 97 a13 a14 a15 a16 a17 pb2/ irq0 / poe0 / ras pb3/ irq1 / poe1 / casl pb4/ irq2 / poe2 / cash pb5/ irq3 / poe3 /rdwr pb6/ irq4 /a18/ back pb7/ irq5 /a19/ breq pb8/ irq6 /a20/ wait pb9/ irq7 /a21/ adtrg pa0/rxd0 pa1/txd0 pa2/sck0/ dreq0 / irq0 pa3/rxd1 pa4/txd1 pa5/sck1/ dreq1 / irq1 pa6/tclka/ cs2 pa7/tclkb/ cs3 pa8/tclkc/ irq2 pa9/tclkd/ irq3 cs0 cs1 wrl wrh rd pa15/ck pa16/ ah pa17/ wait pa18/ breq /drak0 pa19/ back /drak1 pa20/ cashl pa21/ cashh wrhl wrhh pllvcc pllvss extal xtal pllcap nmi res wdtovf md0 md1 md2 md3 vcc avcc avss a13 a14 a15 a16 a17 pb2/ irq0 / poe0 / ras pb3/ irq1 / poe1 / casl pb4/ irq2 / poe2 / cash pb5/ irq3 / poe3 /rdwr pb6/ irq4 /a18/ back pb7/ irq5 /a19/ breq pb8/ irq6 /a20/ wait pb9/ irq7 /a21/ adtrg pa0/rxd0 pa1/txd0 pa2/sck0/ dreq0 / irq0 pa3/rxd1 pa4/txd1 pa5/sck1/ dreq1 / irq1 pa6/tclka/ cs2 pa7/tclkb/ cs3 pa8/tclkc/ irq2 pa9/tclkd/ irq3 cs0 cs1 wrl wrh rd pa15/ck pa16/ ah pa17/ wait pa18/ breq /drak0 pa19/ back /drak1 pa20/ cashl pa21/ cashh wrhl wrhh pllvcc pllvss extal xtal pllcap nmi res wdtovf md0 md1 md2 md3 vcc avcc avss pc13 pc14 pc15 pb0 pb1 pb2 pb3 pb4 pb5 pb6 pb7 pb8 pb9 pa0 pa1 pa2 pa3 pa4 pa5 pa6 pa7 pa8 pa9 pa10 pa11 pa12 pa13 pa14 ck pa16 pa17 pa18 pa19 pa20 pa21 pa22 pa23 pllvcc pllvss extal xtal pllcap nmi res wdtovf md0 md1 md2 md3 vcc avcc avss pc13/a13 pc14/a14 pc15/a15 pb0/a16 pb1/a17 pb2/ irq0 / poe0 / ras pb3/ irq1 / poe1 / casl pb4/ irq2 / poe2 / cash pb5/ irq3 / poe3 /rdwr pb6/ irq4 /a18/ back pb7/ irq5 /a19/ breq pb8/ irq6 /a20/ wait pb9/ irq7 /a21/ adtrg pa0/rxd0 pa1/txd0 pa2/sck0/ dreq0 / irq0 pa3/rxd1 pa4/txd1 pa5/sck1/ dreq1 / irq1 pa6/tclka/ cs2 pa7/tclkb/ cs3 pa8/tclkc/ irq2 pa9/tclkd/ irq3 pa10/ cs0 pa11/ cs1 pa12/ wrl pa13/ wrh pa14/ rd pa15/ck pa16/ ah pa17/ wait pa18/ breq /drak0 pa19/ back /drak1 pa20/ cashl pa21/ cashh pa22/ wrhl pa23/ wrhh pllvcc pllvss extal xtal pllcap nmi res wdtovf md0 md1 md2 md3 vcc avcc avss pc13 pc14 pc15 pb0 pb1 pb2 pb3 pb4 pb5 pb6 pb7 pb8 pb9 pa0 pa1 pa2 pa3 pa4 pa5 pa6 pa7 pa8 pa9 pa10 pa11 pa12 pa13 pa14 pa15 pa16 pa17 pa18 pa19 pa20 pa21 pa22 pa23 pllvcc pllvss extal xtal pllcap nmi res wdtovf md0 md1 md2 md3 vcc avcc avss pc13 pc14 pc15 pb0 pb1 pb2/ irq0 / poe0 pb3/ irq1 / poe1 pb4/ irq2 / poe2 pb5/ irq3 / poe3 pb6/ irq4 pb7/ irq5 pb8/ irq6 pb9/ irq7 / adtrg pa0/rxd0 pa1/txd0 pa2/sck0/ irq0 pa3/rxd1 pa4/txd1 pa5/sck1/ irq1 pa6/tclka pa7/tclkb pa8/tclkc/ irq2 pa9/tclkd/ irq3 pa10 pa11 pa12 pa13 pa14 pa15/ck pa16 pa17 pa18 pa19 pa20 pa21 pa22 pa23 pllvcc pllvss extal xtal pllcap nmi res wdtovf md0 md1 md2 md3 vcc avcc avss a13 a14 a15 a16 nc nc oe pgm nc nc nc nc nc nc nc nc nc nc nc nc nc nc nc nc nc nc nc nc nc nc nc nc nc nc nc nc nc vcc vss nc nc nc a9 vpp nc vcc vcc vcc vcc vcc vcc vss a13 a14 a15 a16 a17 pb2 pb3 pb4 pb5 pb6 pb7 pb8 pb9 pa0 pa1 pa2 pa3 pa4 pa5 pa6 pa7 pa8 pa9 cs0 cs1 wrl wrh rd ck pa16 pa17 pa18 pa19 pa20 pa21 wrhl wrhh pllvcc pllvss extal xtal pllcap nmi res wdtovf md0 md1 md2 md3 vcc avcc avss a13 a14 a15 a16 a17 pb2 pb3 pb4 pb5 pb6 pb7 pb8 pb9 pa0 pa1 pa2 pa3 pa4 pa5 pa6 pa7 pa8 pa9 cs0 cs1 wrl wrh rd ck pa16 pa17 pa18 pa19 pa20 pa21 wrhl wrhh pllvcc pllvss extal xtal pllcap nmi res wdtovf md0 md1 md2 md3 vcc avcc avss pin name fp144 18 19 20 21 23 25 26 27 29 32 33 34 35 54 53 52 51 50 49 48 47 46 45 44 43 41 39 37 88 ? ? ? ? ? ? ? ? 85 87 79 77 86 81 89 88 84 83 80 78 82 107 104 pin no. tfp120 fp112 single chip mode mpu mode0 mpu mode 1 mpu mode2 on-chip rom enabled prom mode initial function on-chip rom disabled pfc selected function possiblilities initial function pfc selected function possiblilities initial function pfc selected function possiblilities initial function pfc selected function possiblilities table 18.2 pin arrangement by mode (cont)
604 127 118 119 120 121 122 123 125 126 109 110 111 113 114 115 116 137 138 139 140 142 143 144 2 5 91 92 93 94 95 96 98 99 85 86 87 88 89 102 104 105 106 107 108 110 111 112 1 2 avref pf0/an0 pf1/an1 pf2/an2 pf3/an3 pf4/an4 pf5/an5 pf6/an6 pf7/an7 pe0/tioc0a/ dreq0 pe1/tioc0b/drak0 pe2/tioc0c/ dreq1 pe3/tioc0d/drak1 pe4/tioc1a pe5/tioc1b pe6/tioc2a pe7/tioc2b pe8/tioc3a pe9/tioc3b pe10/tioc3c pe11/tioc3d pe12/tioc4a pe13/tioc4b/ mres pe14/tioc4c/dack0/ ah pe15/tioc4d/dack1/ irqout avref pf0/an0 pf1/an1 pf2/an2 pf3/an3 pf4/an4 pf5/an5 pf6/an6 pf7/an7 pe0/tioc0a/ dreq0 pe1/tioc0b/drak0 pe2/tioc0c/ dreq1 pe3/tioc0d/drak1 pe4/tioc1a pe5/tioc1b pe6/tioc2a pe7/tioc2b pe8/tioc3a pe9/tioc3b pe10/tioc3c pe11/tioc3d pe12/tioc4a pe13/tioc4b/ mres pe14/tioc4c/dack0/ ah pe15/tioc4d/dack1/ irqout avref pf0/an0 pf1/an1 pf2/an2 pf3/an3 pf4/an4 pf5/an5 pf6/an6 pf7/an7 pe0 pe1 pe2 pe3 pe4 pe5 pe6 pe7 pe8 pe9 pe10 pe11 pe12 pe13 pe14 pe15 avref pf0/an0 pf1/an1 pf2/an2 pf3/an3 pf4/an4 pf5/an5 pf6/an6 pf7/an7 pe0/tioc0a/ dreq0 pe1/tioc0b/drak0 pe2/tioc0c/ dreq1 pe3/tioc0d/drak1 pe4/tioc1a pe5/tioc1b pe6/tioc2a pe7/tioc2b pe8/tioc3a pe9/tioc3b pe10/tioc3c pe11/tioc3d pe12/tioc4a pe13/tioc4b/ mres pe14/tioc4c/dack0/ ah pe15/tioc4d/dack1/ irqout avref pf0/an0 pf1/an1 pf2/an2 pf3/an3 pf4/an4 pf5/an5 pf6/an6 pf7/an7 pe0 pe1 pe2 pe3 pe4 pe5 pe6 pe7 pe8 pe9 pe10 pe11 pe12 pe13 pe14 pe15 avref pf0/an0 pf1/an1 pf2/an2 pf3/an3 pf4/an4 pf5/an5 pf6/an6 pf7/an7 pe0/tioc0a pe1/tioc0b pe2/tioc0c pe3/tioc0d pe4/tioc1a pe5/tioc1b pe6/tioc2a pe7/tioc2b pe8/tioc3a pe9/tioc3b pe10/tioc3c pe11/tioc3d pe12/tioc4a pe13/tioc4b/ mres pe14/tioc4c pe15/tioc4d vss vss vss vss vss vss vss vss nc nc nc nc nc nc nc nc nc nc nc nc nc nc nc ce avref pf0/an0 pf1/an1 pf2/an2 pf3/an3 pf4/an4 pf5/an5 pf6/an6 pf7/an7 pe0 pe1 pe2 pe3 pe4 pe5 pe6 pe7 pe8 pe9 pe10 pe11 pe12 pe13 pe14 pe15 avref pf0/an0 pf1/an1 pf2/an2 pf3/an3 pf4/an4 pf5/an5 pf6/an6 pf7/an7 pe0 pe1 pe2 pe3 pe4 pe5 pe6 pe7 pe8 pe9 pe10 pe11 pe12 pe13 pe14 pe15 pin name fp144 ? 98 99 100 101 102 103 105 106 92 93 94 95 96 109 112 113 114 115 116 118 119 120 2 3 pin no. tfp120 fp112 single chip mode mpu mode0 mpu mode 1 mpu mode2 on-chip rom enabled prom mode initial function on-chip rom disabled table 18.2 pin arrangement by mode (cont) pfc selected function possiblilities initial function pfc selected function possiblilities initial function pfc selected function possiblilities initial function pfc selected function possiblilities
605 18.2 register configuration table 18.3 summarizes the registers of the pin function controller. table 18.3 pin function controller registers name abbreviation r/w initial value address access size port a i/o register h paiorh r/w h'0000 h'ffff8384 h'ffff8385 8, 16, 32 port a i/o register l paiorl r/w h'0000 h'ffff8386 h'ffff8387 8, 16, 32 port a control register h pacrh r/w h'0000 h'ffff8388 h'ffff8389 8, 16, 32 port a control register l1 pacrl1 r/w h'0000* h'4000 h'ffff838c h'ffff838d 8, 16, 32 port a control register l2 pacrl2 r/w h'0000 h'ffff838e h'ffff838f 8, 16, 32 port b i/o register pbior r/w h'0000 h'ffff8394 h'ffff8395 8, 16, 32 port b control register 1 pbcr1 r/w h'0000 h'ffff8398 h'ffff8399 8, 16, 32 port b control register 2 pbcr2 r/w h'0000 h'ffff839a h'ffff839b 8, 16, 32 port c i/o register pcior r/w h'0000 h'ffff8396 h'ffff8397 8, 16, 32 port c control register pccr r/w h'0000 h'ffff839c h'ffff839d 8, 16, 32 port d i/o register h pdiorh r/w h'0000 h'ffff83a4 h'ffff83a5 8, 16, 32 port d i/o register l pdiorl r/w h'0000 h'ffff83a6 h'ffff83a7 8, 16, 32 port d control register h1 pdcrh1 r/w h'0000 h'ffff83a8 h'ffff83a9 8, 16, 32 port d control register h2 pdcrh2 r/w h'0000 h'ffff83aa h'ffff83ab 8, 16, 32 port d control register l pdcrl r/w h'0000 h'ffff83ac h'ffff83ad 8, 16, 32 port e i/o register peior r/w h'0000 h'ffff83b4 h'ffff83b5 8, 16, 32 port e control register 1 pecr1 r/w h'0000 h'ffff83b8 h'ffff83b9 8, 16, 32 port e control register 2 pecr2 r/w h'0000 h'ffff83ba h'ffff83bb 8, 16, 32 irqout function control register ifcr r/w h'0000 h'ffff83c8 h'ffff83c9 8, 16, 32 note: the port a control register l1 initial value varies depending on the operating mode.
606 18.3 register descriptions 18.3.1 port a i/o register h (paiorh) the port a i/o register h (paiorh) is a 16-bit read/write register that selects input or output for the most significant 8 pins of port a. bits pa23ior?a16ior correspond to pins pa23/ wrhh pa16/ ah . paiorh is enabled when the port a pins function as general input/outputs (pa23 pa16). for other functions, it is disabled. for port a pin functions pa23?a16, a given pin in port a is an output pin if its corresponding paiorh bit is set to 1, and an input pin if the bit is cleared to 0. paiorh is initialized to h'0000 by external power-on reset; however, it is not initialized for manual resets, reset by wdt, standby mode, or sleep mode, so the previous data is maintained. the settings for this register are effective only for the 144-pin version. there are no corresponding pins for this register in the 112-pin and 120-pin versions. however, read/writes are possible. bit: 15 14 13 12 11 10 9 8 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 1 0 pa23 ior pa22 ior pa21 ior pa20 ior pa19 ior pa18 ior pa17 ior pa16 ior 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
607 18.3.2 port a i/o register l (paiorl) the port a i/o register l (paiorl) is a 16-bit read/write register that selects input or output for the least significant 16 pins of port a. bits pa15ior?a0ior correspond to pins pa15/ck pa0/rxd0. paiorl is enabled when the port a pins function as general input/outputs (pa15 pa0), or with the serial clock (sck1, sck0). for other functions, it is disabled. when the port a pin functions pa15?a0 are sck1, sck0, a given pin in port a is an output pin if its corresponding paiorl bit is set to 1, and an input pin if the bit is cleared to 0. paiorl is initialized to h'0000 by external power-on reset; however, it is not initialized for manual resets, reset by wdt, standby mode, or sleep mode, so the previous data is maintained. bit: 15 14 13 12 11 10 9 8 pa15 ior pa14 ior pa13 ior pa12 ior pa11 ior pa10 ior pa9 ior pa8 ior 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 bit: 7 6 5 4 3 2 1 0 pa7 ior pa6 ior pa5 ior pa4 ior pa3 ior pa2 ior pa1 ior pa0 ior 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 18.3.3 port a control register h (pacrh) pacrh is a 16-bit read/write register that selects the multiplex pin function for the eight most significant pins of port a. pacrh selects the pa23/ wrhh ?a16/ ah pin functions. the eight most significant pins of port a have bus control signals ( wrhh , wrhl , cashh , cashl , back , breq , wait , ah ) and dmac control signals (drak1, drak0), but there are instances when the register settings that select these pin functions will be ignored. refer to table 18.2, pin arrangement by mode. pacrh is initialized to h'0000 by external power-on reset but is not initialized for manual resets, reset by wdt, standby mode, or sleep mode, so the previous data is maintained.
608 the settings for this register are effective only for the 144-pin version. there are no corresponding pins for this register in the 112-pin and 120-pin versions. however, read/writes are possible. bit: 15 14 13 12 11 10 9 8 pa23 md pa22 md pa21 md pa20 md initial value: 0 0 0 0 0 0 0 0 r/w: r r/w r r/w r r/w r r/w bit: 7 6 5 4 3 2 1 0 pa19 md1 pa19 md0 pa18 md1 pa18 md0 pa17 md pa16 md initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r r/w r r/w bit 15?eserved: this bit always reads as 0. the write value should always be 0. bit 14?a23 mode (pa23md): selects the function of the pa23/ wrhh pin. bit 14: pa23md description 0 general input/output (pa23) (initial value) ( wrhh in on-chip rom invalid mode) 1 most significant byte write output ( wrhh ) (pa23 in single chip mode) bit 13?eserved: this bit always reads as 0. the write value should always be 0. bit 12?a22 mode (pa22md): selects the function of the pa22/ wrhl pin. bit 12: pa22md description 0 general input/output (pa22) (initial value) ( wrhl in on-chip rom invalid mode) 1 write output ( wrhl ) (pa22 in single chip mode) bit 11?eserved: this bit always reads as 0. the write value should always be 0. bit 10?a21 mode (pa21md): selects the function of the pa21/ cashh pin. bit 10: pa21md description 0 general input/output (pa21) (initial value) 1 column address output ( cashh ) (pa21 in single chip mode) bit 9?eserved: always reads as 0. the write values should always be 0.
609 bit 8?a20 mode (pa20md): selects the function of the pa20/ cashl pin. bit 8: pa20md description 0 general input/output (pa20) (initial value) 1 column address output ( cashl ) (pa20 in single chip mode) bits 7 and 6?a19 mode 1, 0 (pa19md1 and pa19md0): these bits select the function of the pa19/ back /drak1 pin. bit 7: pa19md1 bit 6: pa19md0 description 0 0 general input/output (pa19) (initial value) 1 bus right request acknowledge ( back ) (pa19 in single chip mode) 1 0 dreq1 request received output (drak1) (pa19 in single chip mode) 1 reserved bits 5 and 4?a18 mode 1, 0 (pa18md1 and pa18md0): these bits select the function of the pa18/ breq /drak0 pin. bit 5: pa18md1 bit 4: pa18md0 description 0 0 general input/output (pa18) (initial value) 1 bus right request input ( breq ) (pa18 in single chip mode) 1 0 dreq0 request received output (drak0) (pa18 in single chip mode) 1 reserved bit 3?eserved: this bit always reads as 0. the write value should always be 0. bit 2?a17 mode (pa17md): selects the function of the pa17/ wait pin. bit 2: pa17md description 0 general input/output (pa17) (initial value) 1 wait state request input ( wait ) (pa17 in single chip mode) bit 1?eserved: this bit always reads as 0. the write value should always be 0.
610 bit 0?a16 mode (pa16md): selects the function of the pa16/ ah pin. bit 0: pa16md description 0 general input/output (pa16) (initial value) 1 address hold output ( ah ) (pa16 in single chip mode) 18.3.4 port a control registers l1, l2 (pacrl1 and pacrl2) pacrl1 and pacrl2 are 16-bit read/write registers that select the functions of the least significant sixteen multiplexed pins of port a. pacrl1 selects the function of the pa15/ck pa8/tclkc/ irq2 pins of port a; pacrl2 selects the function of the pa7/tclkb/ cs3 pa0/rxd0 pins of port a. port a has bus control signals ( rd , wrh , wrl , cs0 cs3 , ah ) and dmac control signals (dreq0?req1), but there are instances when the register settings that select these pin functions will be ignored, depending on the operation mode. refer to table 18.2, pin arrangement by mode, for details. pacrl1 is initialized by external power-on reset to h'4000 in extended mode, and to h'0000 in single chip mode. pacrl2 is initialized by external power-on reset to h'0000. neither register is initialized by manual resets, reset by wdt, standby mode, or sleep mode, so the previous data is maintained. port a control register l1 (pacrl1): bit: 15 14 13 12 11 10 9 8 pa15md pa14md pa13md pa12md initial value: 0 0(1)* 0 0 0 0 0 0 r/w: r r/w r r/w r r/w r r/w bit: 7 6 5 4 3 2 1 0 pa11md pa10md pa9md1 pa9md0 pa8md1 pa8md0 initial value: 0 0 0 0 0 0 0 0 r/w: r r/w r r/w r/w r/w r/w r/w note: bit 14 is initialized to 1 in extended mode. bit 15?eserved: this bit always reads as 0. the write value should always be 0.
611 bit 14?a15 mode (pa15md): selects the function of the pa15/ck pin. bit 14: pa15md description 0 general input/output (pa15) (single chip mode initial value) 1 clock output (ck) (extended mode initial value) bit 13?eserved: this bit always reads as 0. the write value should always be 0. bit 12?a14 mode (pa14md): selects the function of the pa14/ rd pin. bit 12: pa14md description 0 general input/output (pa14) (initial value) ( rd in on-chip rom invalid mode) 1 read output ( rd ) (pa14 in single chip mode) bit 11?eserved: this bit always reads as 0. the write value should always be 0. bit 10?a13 mode (pa13md): selects the function of the pa13/ wrh pin. bit 10: pa13md description 0 general input/output (pa13) (initial value) ( wrh in on-chip rom invalid mode) 1 most significant side write output ( wrh ) (pa13 in single chip mode) bit 9?eserved: this bit always reads as 0. the write value should always be 0. bit 8?a12 mode (pa12md): selects the function of the pa12/ wrl pin. bit 8: pa12md description 0 general input/output (pa12) (initial value) ( wrl in on-chip rom invalid mode) 1 least significant side write output ( wrl ) (pa12 in single chip mode) bit 7?eserved: this bit always reads as 0. the write value should always be 0. bit 6?a11 mode (pa11md): selects the function of the pa11/ cs1 pin. bit 6: pa11md description 0 general input/output (pa11) (initial value) ( cs1 in on-chip rom invalid mode) 1 chip select output ( cs1 ) (pa11 in single chip mode) bit 5?eserved: this bit always reads as 0. the write value should always be 0.
612 bit 4?a10 mode (pa10md): selects the function of the pa10/ cs0 pin. bit 4: pa10md description 0 general input/output (pa10) (initial value) ( cs0 in on-chip rom invalid mode) 1 chip select output ( cs0 ) (pa10 in single chip mode) bits 3 and 2?a9 mode 1, 0 (pa9md1 and pa9md0): these bits select the function of the pa9/tclkd/ irq3 pin. bit 3: pa9md1 bit 2: pa9md0 description 0 0 general input/output (pa9) (initial value) 1 mtu timer clock input (tclkd) 1 0 interrupt request input ( irq3 ) 1 reserved bits 1 and 0?a8 mode 1, 0 (pa8md1 and pa8md0): these bits select the function of the pa8/tclkc/ irq2 pin. bit 1: pa8md1 bit 0: pa8md0 description 0 0 general input/output (pa8) (initial value) 1 mtu timer clock input (tclkc) 1 0 interrupt request input ( irq2 ) 1 reserved
613 port a control register l2 (pacrl2): bit: 15 14 13 12 11 10 9 8 pa7 md1 pa7 md0 pa6 md1 pa6 md0 pa5 md1 pa5 md0 pa4md 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 r/w bit: 7 6 5 4 3 2 1 0 pa3md pa2 md1 pa2 md0 pa1md pa0md initial value: 0 0 0 0 0 0 0 0 r/w: r r/w r/w r/w r r/w r r/w bits 15 and 14?a7 mode 1, 0 (pa7md1 and pa7md0): these bits select the function of the pa7/tclkb/ cs3 pin. bit 15: pa7md1 bit 14: pa7md0 description 0 0 general input/output (pa7) (initial value) 1 mtu timer clock input (tclkb) 1 0 chip select output ( cs3 ) (pa7 in single chip mode) 1 reserved bits 13 and 12?a6 mode 1, 0 (pa6md1 and pa6md0): these bits select the function of the pa6/tclka/ cs2 pin. bit 13: pa6md1 bit 12: pa6md0 description 0 0 general input/output (pa6) (initial value) 1 mtu timer clock input (tclka) 1 0 chip select output ( cs2 ) (pa6 in single chip mode) 1 reserved
614 bits 11 and 10?a5 mode 1, 0 (pa5md1 and pa5md0): these bits select the function of the pa5/sck1/ dreq1 / irq1 pin. bit 11: pa5md1 bit 10: pa5md0 description 0 0 general input/output (pa5) (initial value) 1 serial clock input/output (sck1) 1 0 dma transfer request received input ( dreq1 ) (pa5 in single chip mode) 1 interrupt request input ( irq1 ) bit 9?eserved: this bit always reads as 0. the write value should always be 0. bit 8?a4 mode (pa4md): selects the function of the pa4/txd1 pin. bit 8: pa4md description 0 general input/output (pa4) (initial value) 1 transmit data output (txd1) bit 7?eserved: this bit always reads as 0. the write value should always be 0. bit 6?a3 mode (pa3md): selects the function of the pa3/rxd1 pin. bit 6: pa3md description 0 general input/output (pa3) (initial value) 1 receive data input (rxd1) bits 5 and 4?a2 mode 1, 0 (pa2md1 and pa2md0): these bits select the function of the pa2/sck0/ dreq0 / irq0 pin. bit 5: pa2md1 bit 4: pa2md0 description 0 0 general input/output (pa2) (initial value) 1 serial clock input/output (sck0) 1 0 dma transfer request received input ( dreq0 ) (pa2 in single chip mode) 1 interrupt request input ( irq0 ) bit 3?eserved: this bit always reads as 0. the write value should always be 0.
615 bit 2?a1 mode (pa1md): selects the function of the pa1/txd0 pin. bit 2: pa1md description 0 general input/output (pa1) (initial value) 1 transmit data output (txd0) bit 1?eserved: this bit always reads as 0. the write value should always be 0. bit 0?a0 mode (pa0md): selects the function of the pa0/rxd0 pin. bit 0: pa0md description 0 general input/output (pa0) (initial value) 1 receive data input (rxd0) 18.3.5 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 the ten port b pins. bits pb9ior?b0ior correspond to the pb9/ irq7 /a21/ adtrg pin to pb0/a16 pin. pbior is enabled when the port b pins function as input/outputs (pb9?b0). for other functions, it is disabled. for port b pin functions pb9?b0, a given pin in port b is an output pin if its corresponding pbior bit is set to 1, and an input pin if the bit is cleared to 0. pbior is initialized to h'0000 by external power-on reset; however, it is not initialized for manual resets, reset by wdt, standby mode, or sleep mode, so the previous data is maintained. bit: 15 14 13 12 11 10 9 8 pb9 ior pb8 ior initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r r/w r/w bit: 7 6 5 4 3 2 1 0 pb7 ior pb6 ior pb5 ior pb4 ior pb3 ior pb2 ior pb1 ior pb0 ior 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
616 18.3.6 port b control registers (pbcr1 and pbcr2) pbcr1 and pbcr2 are 16-bit read/write registers that select the functions of the ten multiplexed pins of port b. pbcr1 selects the functions of the top two bits of port b; pbcr2 selects the functions of the bottom eight bits of port b. port b has bus control signals (rdwr, ras , cash , casl , wait , breq , back ) and address outputs (a21, a20, a19, a18, a17, a16), but there are instances when the register settings that select these pin functions will be ignored, depending on the operation mode. refer to table 18.2, pin arrangement by mode, for details. pbcr1 and pbcr2 are both initialized to h'0000 by external power-on reset but are not initialized for manual resets, reset by wdt, standby mode, or sleep mode, so the previous data is maintained. port b control register 1 (pbcr1): bit: 15 14 13 12 11 10 9 8 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 1 0 pb9 md1 pb9 md0 pb8 md1 pb8 md0 initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r/w r/w r/w r/w bits 15-4?eserved: these bits always read as 0. the write value should always be 0. bits 3 and 2?b9 mode (pb9md1 and pb9md0): pb9md1 and pb9md0 select the function of the pb9/ irq7 /a21/ adtrg pin. bit 3: pb9md1 bit 2: pb9md0 description 0 0 general input/output (pb9) (initial value) 1 interrupt request input ( irq7 ) 1 0 address output (a21) (pb9 in single chip mode) 1 a/d conversion trigger input ( adtrg )
617 bits 1 and 0?b8 mode (pb8md1 and pb8md0): pb8md1 and pb8md0 select the function of the pb8/ irq6 /a20/ wait pin. bit 1: pb8md1 bit 0: pb8md0 description 0 0 general input/output (pb8) (initial value) 1 interrupt request input ( irq6 ) 1 0 address output (a20) (pb8 in single chip mode) 1 wait state request input ( wait ) (pb8 in single chip mode) port b control register 2 (pbcr2): bit: 15 14 13 12 11 10 9 8 pb7md1 pb7md0 pb6md1 pb6md0 pb5md1 pb5md0 pb4md1 pb4md0 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 bit: 7 6 5 4 3 2 1 0 pb3md1 pb3md0 pb2md1 pb2md0 pb1md pb0md initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r r/w r r/w bits 15 and 14?b7 mode (pb7md1 and pb7md0): pb7md1 and pb7md0 select the function of the pb7/ irq5 /a19/ breq pin. bit 15: pb7md1 bit 14: pb7md0 description 0 0 general input/output (pb7) (initial value) 1 interrupt request input ( irq5 ) 1 0 address output (a19) (pb7 in single chip mode) 1 bus right request input ( breq ) (pb7 in single chip mode)
618 bits 13 and 12?b6 mode (pb6md1 and pb6md0): pb6md1 and pb6md0 select the function of the pb6/ irq4 /a18/ back pin. bit 13: pb6md1 bit 12: pb6md0 description 0 0 general input/output (pb6) (initial value) 1 interrupt request input ( irq4 ) 1 0 address output (a18) (pb6 in single chip mode) 1 bus right request output ( back ) (pb6 in single chip mode) bits 11 and 10?b5 mode (pb5md1 and pb5md0): pb5md1 and pb5md0 select the function of the pb5/ irq3 / poe3 /rdwr pin. bit 11: pb5md1 bit 10: pb5md0 description 0 0 general input/output (pb5) (initial value) 1 interrupt request input ( irq3 ) 1 0 port output enable ( poe3 ) 1 read/write output (rdwr) bits 9 and 8?b4 mode (pb4md1 and pb4md0): pb4md1 and pb4md0 select the function of the pb4/ irq2 / poe2 / cash pin. bit 9: pb4md1 bit 8: pb4md0 description 0 0 general input/output (pb4) (initial value) 1 interrupt request input ( irq2 ) 1 0 port output enable ( poe2 ) 1 column address strobe ( cash ) (pb4 in single chip mode) bits 7 and 6?b3 mode (pb3md1 and pb3md0): pb3md1 and pb3md0 select the function of the pb3/ irq1 / poe1 / casl pin. bit 7: pb3md1 bit 6: pb3md0 description 0 0 general input/output (pb3) (initial value) 1 interrupt request input ( irq1 ) 1 0 port output enable ( poe1 ) 1 column address strobe ( casl ) (pb3 in single chip mode)
619 bits 5 and 4?b2 mode (pb2md1 and pb2md0): pb2md1 and pb2md0 select the function of the pb2/ irq0 / poe0 / ras pin. bit 5: pb2md1 bit 4: pb2md0 description 0 0 general input/output (pb2) (initial value) 1 interrupt request input ( irq0 ) 1 0 port output enable ( poe0 ) 1 row address strobe ( ras ) (pb2 in single chip mode) bit 3?eserved: this bit always reads as 0. the write value should always be 0. bit 2?b1 mode (pb1md): selects the function of the pb1/a17 pin. bit 2: pb1md description 0 general input/output (pb1) (initial value) (a17 in on-chip rom invalid mode) 1 address output (a17) (pb1 in single chip mode) bit 1?eserved: this bit always reads as 0. the write value should always be 0. bit 0?b0 mode (pb0md): selects the function of the pb0/a16 pin. bit 0: pa0md description 0 general input/output (pb0) (initial value) (a16 in on-chip rom invalid mode) 1 address output (a16) (pb0 in single chip mode)
620 18.3.7 port c i/o register (pcior) the port c i/o register (pcior) is a 16-bit read/write register that selects input or output for the 16 port c pins. bits pc15ior?c0ior correspond to pins pc15/a15 to pc0/a0. pcior is enabled when the port c pins function as general input/outputs (pc15?c0). for other functions, it is disabled. when the port c pin functions are as pc15?c0, a given pin in port c is an output pin if its corresponding pcior bit is set to 1, and an input pin if the bit is cleared to 0. pcior is initialized to h'0000 by external power-on reset; however, it is not initialized for manual resets, reset by wdt, standby mode, or sleep mode, so the previous values are maintained. bit: 15 14 13 12 11 10 9 8 pc15 ior pc14 ior pc13 ior pc12 ior pc11 ior pc10 ior pc9 ior pc8 ior 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 bit: 7 6 5 4 3 2 1 0 pc7 ior pc6 ior pc5 ior pc4 ior pc3 ior pc2 ior pc1 ior pc0 ior 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
621 18.3.8 port c control register (pccr) pccr is a 16-bit read/write register that selects the functions for the sixteen port c multiplexed pins. there are instances when these register settings will be ignored, depending on the operation mode. refer to table 18.2, pin arrangement by mode, for details. pccr is initialized to h'0000 by power-on resets but is not initialized for manual resets, reset by wdt, standby mode, or sleep mode, so the previous data is maintained. bit: 15 14 13 12 11 10 9 8 pc15 md pc14 md pc13 md pc12 md pc11 md pc10 md pc9 md pc8 md 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 bit: 7 6 5 4 3 2 1 0 pc7 md pc6 md pc5 md pc4 md pc3 md pc2 md pc1 md pc0 md 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 bit 15?c15 mode (pc15md): selects the function of the pc15/a15 pin. bit 15: pc15md description 0 general input/output (pc15) (initial value) (a15 in on-chip rom invalid mode) 1 address output (a15) (pc15 in single chip mode) bit 14?c14 mode (pc14md): selects the function of the pc14/a14 pin. bit 14: pc14md description 0 general input/output (pc14) (initial value) (a14 in on-chip rom invalid mode) 1 address output (a14) (pc14 in single chip mode) bit 13?c13 mode (pc13md): selects the function of the pc13/a13 pin. bit 13: pc13md description 0 general input/output (pc13) (initial value) (a13 in on-chip rom invalid mode) 1 address output (a13) (pc13 in single chip mode)
622 bit 12?c12 mode (pc12md): selects the function of the pc12/a12 pin. bit 12: pc12md description 0 general input/output (pc12) (initial value) (a12 in on-chip rom invalid mode) 1 address output (a12) (pc12 in single chip mode) bit 11?c11 mode (pc11md): selects the function of the pc11/a11 pin. bit 11: pc11md description 0 general input/output (pc11) (initial value) (a11 in on-chip rom invalid mode) 1 address output (a11) (pc11 in single chip mode) bit 10?c10 mode (pc10md): selects the function of the pc10/a10 pin. bit 10: pc10md description 0 general input/output (pc10) (initial value) (a10 in on-chip rom invalid mode) 1 address output (a10) (pc10 in single chip mode) bit 9?c9 mode (pc9md): selects the function of the pc9/a9 pin. bit 9: pc9md description 0 general input/output (pc9) (initial value) (a9 in on-chip rom invalid mode) 1 address output (a9) (pc9 in single chip mode) bit 8?c8 mode (pc8md): selects the function of the pc8/a8 pin. bit 8: pc8md description 0 general input/output (pc8) (initial value) (a8 in on-chip rom invalid mode) 1 address output (a8) (pc8 in single chip mode) bit 7?c7 mode (pc7md): selects the function of the pc7/a7 pin. bit 7: pc7md description 0 general input/output (pc7) (initial value) (a7 in on-chip rom invalid mode) 1 address output (a7) (pc7 in single chip mode)
623 bit 6?c6 mode (pc6md): selects the function of the pc6/a6 pin. bit 6: pc6md description 0 general input/output (pc6) (initial value) (a6 in on-chip rom invalid mode) 1 address output (a6) (pc6 in single chip mode) bit 5?c5 mode (pc5md): selects the function of the pc5/a5 pin. bit 5: pc5md description 0 general input/output (pc5) (initial value) (a5 in on-chip rom invalid mode) 1 address output (a5) (pc5 in single chip mode) bit 4?c4 mode (pc4md): selects the function of the pc4/a4 pin. bit 4: pc4md description 0 general input/output (pc4) (initial value) (a4 in on-chip rom invalid mode) 1 address output (a4) (pc4 in single chip mode) bit 3?c3 mode (pc3md): selects the function of the pc3/a3 pin. bit 3: pc3md description 0 general input/output (pc3) (initial value) (a3 in on-chip rom invalid mode) 1 address output (a3) (pc3 in single chip mode) bit 2?c2 mode (pc2md): selects the function of the pc2/a2 pin. bit 2: pc2md description 0 general input/output (pc2) (initial value) (a2 in on-chip rom invalid mode) 1 address output (a2) (pc2 in single chip mode) bit 1?c1 mode (pc1md): selects the function of the pc1/a1 pin. bit 1: pc1md description 0 general input/output (pc1) (initial value) (a1 in on-chip rom invalid mode) 1 address output (a1) (pc1 in single chip mode)
624 bit 0?c0 mode (pc0md): selects the function of the pc0/a0 pin. bit 0: pc0md description 0 general input/output (pc0) (initial value) (a0 in on-chip rom invalid mode) 1 address output (a0) (pc0 in single chip mode) 18.3.9 port d i/o register h (pdiorh) the port d i/o register h (pdiorh) is a 16-bit read/write register that selects input or output for the most significant sixteen port d pins. bits pd31ior?d16ior correspond to the pd31/d31/ adtrg pin to pd16/d16/ irq0 pin. pdiorh is enabled when the port d pins function as general input/outputs (pd31?d16). for other functions, it is disabled. for port d pin functions pd31?d16, a given pin in port d is an output pin if its corresponding pdiorh bit is set to 1, and an input pin if the bit is cleared to 0. pdiorh is initialized to h'0000 by external power-on reset; however, it is not initialized for manual resets, reset by wdt, standby mode, or sleep mode, so the previous data is maintained. the settings for this register are effective only for the 144-pin version. there are no corresponding pins for this register in the 112-pin and 120-pin versions. however, read/writes are possible. bit: 15 14 13 12 11 10 9 8 pd31 ior pd30 ior pd29 ior pd28 ior pd27 ior pd26 ior pd25 ior pd24 ior 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 bit: 7 6 5 4 3 2 1 0 pd23 ior pd22 ior pd21 ior pd20 ior pd19 ior pd18 ior pd17 ior pd16 ior 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
625 18.3.10 port d i/o register l (pdiorl) the port d i/o register l (pdiorl) is a 16-bit read/write register that selects input or output for the least significant sixteen port d pins. bits pd15ior?d0ior correspond to the pd15/d15 pin to pd0/d0 pin. pdiorl is enabled when the port d pins function as general input/outputs (pd15?d0). for other functions, it is disabled. for port d pin functions pd15?d0, a given pin in port d is an output pin if its corresponding pdiorl bit is set to 1, and an input pin if the bit is cleared to 0. pdiorl is initialized to h'0000 by external power-on reset; however, it is not initialized for manual resets, reset by wdt, standby mode, or sleep mode, so the previous data is maintained. bit: 15 14 13 12 11 10 9 8 pd15 ior pd14 ior pd13 ior pd12 ior pd11 ior pd10 ior pd9 ior pd8 ior 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 bit: 7 6 5 4 3 2 1 0 pd7 ior pd6 ior pd5 ior pd4 ior pd3 ior pd2 ior pd1 ior pd0 ior 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 18.3.11 port d control registers h1, h2 (pdcrh1 and pdcrh2) pdcrh1 and pdcrh2 are 16-bit read/write registers that select the functions of the most significant sixteen multiplexed pins of port d. pdcrh1 selects the functions of the pd31/d31/ adtrg ?d24/d24/ dreq0 pins of port d; pdcrh2 selects the functions of the pd23/d23/ irq7 ?d16/d16/ irq0 pins of port d. there are instances when these register settings will be ignored, depending on the operation mode. refer to table 18.2, pin arrangement by mode, for details. the settings for this register are effective only for the 144-pin version. there are no corresponding pins for this register in the 112-pin and 120-pin versions. however, read/writes are possible. pdcrh1 and pdcrh2 are both initialized to h'0000 by external power-on reset but are not initialized for manual resets, reset by wdt, standby mode, or sleep mode, so the previous data is maintained.
626 port d control register h1 (pdcrh1): bit: 15 14 13 12 11 10 9 8 pd31 md1 pd31 md0 pd30 md1 pd30 md0 pd29 md1 pd29 md0 pd28 md1 pd28 md0 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 bit: 7 6 5 4 3 2 1 0 pd27 md1 pd27 md0 pd26 md1 pd26 md0 pd25 md1 pd25 md0 pd24 md1 pd24 md0 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 bits 15 and 14?d31 mode 1, 0 (pd31md1 and pd31md0): these bits select the function of the pd31/d31/ adtrg pin. bit 15: pd31md1 bit 14: pd31md0 description 0 0 general input/output (pd31) (initial value) (no rom, d31 with cs0 = 32 bit width) 1 data input/output (d31) (pd31 in single chip mode) 1 0 a/d conversion trigger input ( adtrg ) (no rom, d31 with cs0 = 32 bit width) 1 reserved bits 13 and 12?d30 mode 1, 0 (pd30md1 and pd30md0): these bits select the function of the pd30/d30/ irqout pin. bit 13: pd30md1 bit 12: pd30md0 description 0 0 general input/output (pd30) (initial value) (no rom, d30 with cs0 = 32 bit width) 1 data input/output (d30) (pd30 in single chip mode) 1 0 interrupt request received output ( irqout ) (no rom, d30 with cs0 = 32 bit width. reserved in single chip mode) 1 reserved
627 bits 11 and 10?d29 mode 1, 0 (pd29md1 and pd29md0): these bits select the function of the pd29/d29/ cs3 pin. bit 11: pd29md1 bit 10: pd29md0 description 0 0 general input/output (pd29) (initial value) (d29 with no rom and cs0 = 32 bit width) 1 data input/output (d29) (pd29 in single chip mode) 1 0 chip select output ( cs3 ) (pd29 in single chip mode, d29 with no rom and cs0 = 32 bit width) 1 reserved bits 9 and 8?d28 mode 1, 0 (pd28md1 and pd28md0): these bits select the function of the pd28/d28/ cs2 pin. bit 9: pd28md1 bit 8: pd28md0 description 0 0 general input/output (pd28) (initial value) (d28 with no rom and cs0 = 32 bit width) 1 data input/output (d28) (pd28 in single chip mode) 1 0 chip select output ( cs2 ) (pd28 in single chip mode, and d28 with no rom and cs0 = 32 bit width) 1 reserved bits 7 and 6?d27 mode 1, 0 (pd27md1 and pd27md0): these bits select the function of the pd27/d27/dack1 pin. bit 7: pd27md1 bit 6: pd27md0 description 0 0 general input/output (pd27) (initial value) (d27 with no rom and cs0 = 32 bit width) 1 data input/output (d27) (pd27 in single chip mode) 1 0 dma transfer request received output (dack1) (pd27 in single chip mode, and d27 with no rom and cs0 = 32 bit width) 1 reserved
628 bits 5 and 4?d26 mode 1, 0 (pd26md1 and pd26md0): these bits select the function of the pd26/d26/dack0 pin. bit 5: pd26md1 bit 4: pd26md0 description 0 0 general input/output (pd26) (initial value) (d26 with no rom and cs0 = 32 bit width) 1 data input/output (d26) (pd26 in single chip mode) 1 0 dma transfer request received output (dack0) (pd26 in single chip mode, and d26 with no rom and cs0 = 32 bit width) 1 reserved bits 3 and 2?d25 mode 1, 0 (pd25md1 and pd25md0): these bits select the function of the pd25/d25/ dreq1 pin. bit 3: pd25md1 bit 2: pd25md0 description 0 0 general input/output (pd25) (initial value) (d25 with no rom and cs0 = 32 bit width) 1 data input/output (d25) (pd25 in single chip mode) 1 0 dma transfer request input ( dreq1 ) (pd25 in single chip mode, and d25 with no rom and cs0 = 32 bit width) 1 reserved bits 1 and 0?d24 mode 1, 0 (pd24md1 and pd24md0): these bits select the function of the pd24/d24/ dreq0 pin. bit 1: pd24md1 bit 0: pd24md0 description 0 0 general input/output (pd24) (initial value) (d24 with no rom and cs0 = 32 bit width) 1 data input/output (d24) (pd24 in single chip mode) 1 0 dma transfer request input ( dreq0 ) (pd24 in single chip mode, and d24 with no rom and cs0 = 32 bit width) 1 reserved
629 port d control register h2 (pdcrh2): bit: 15 14 13 12 11 10 9 8 pd23 md1 pd23 md0 pd22 md1 pd22 md0 pd21 md1 pd21 md0 pd20 md1 pd20 md0 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 bit: 7 6 5 4 3 2 1 0 pd19 md1 pd19 md0 pd18 md1 pd18 md0 pd17 md1 pd17 md0 pd16 md1 pd16 md0 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 bits 15 and 14?d23 mode 1, 0 (pd23md1 and pd23md0): these bits select the function of the pd23/d23/ irq7 pin. bit 15: pd23md1 bit 14: pd23md0 description 0 0 general input/output (pd23) (initial value) (d23 with no rom and cs0 = 32 bit width) 1 data input/output (d23) (pd23 in single chip mode) 1 0 interrupt request input ( irq7 ) 1 reserved bits 13 and 12?d22 mode 1, 0 (pd22md1 and pd22md0): these bits select the function of the pd22/d22/ irq6 pin. bit 13: pd22md1 bit 12: pd22md0 description 0 0 general input/output (pd22) (initial value) (d22 with no rom and cs0 = 32 bit width) 1 data input/output (d22) (pd22 in single chip mode) 1 0 interrupt request input ( irq6 ) 1 reserved
630 bits 11 and 10?d21 mode 1, 0 (pd21md1 and pd21md0): these bits select the function of the pd21/d21/ irq5 pin. bit 11: pd21md1 bit 10: pd21md0 description 0 0 general input/output (pd21) (initial value) (d21 with no rom and cs0 = 32 bit width) 1 data input/output (d21) (pd21 in single chip mode) 1 0 interrupt request input ( irq5 ) 1 reserved bits 9 and 8?d20 mode 1, 0 (pd20md1 and pd20md0): these bits select the function of the pd20/d20/ irq4 pin. bit 9: pd20md1 bit 8: pd20md0 description 0 0 general input/output (pd20) (initial value) (d20 with no rom and cs0 = 32 bit width) 1 data input/output (d20) (pd20 in single chip mode) 1 0 interrupt request input ( irq4 ) 1 reserved bits 7 and 6?d19 mode 1, 0 (pd19md1 and pd19md0): these bits select the function of the pd19/d19/ irq3 pin. bit 7: pd19md1 bit 6: pd19md0 description 0 0 general input/output (pd19) (initial value) (d19 with no rom and cs0 = 32 bit width) 1 data input/output (d19) (pd19 in single chip mode) 1 0 interrupt request input ( irq3 ) 1 reserved
631 bits 5 and 4?d18 mode 1, 0 (pd18md1 and pd18md0): these bits select the function of the pd18/d18/ irq2 pin. bit 5: pd18md1 bit 4: pd18md0 description 0 0 general input/output (pd18) (initial value) (d18 with no rom and cs0 = 32 bit width 1 data input/output (d18) (pd18 in single chip mode) 1 0 interrupt request input ( irq2 ) 1 reserved bits 3 and 2?d17 mode 1, 0 (pd17md1 and pd17md0): these bits select the function of the pd17/d17/ irq1 pin. bit 3: pd17md1 bit 2: pd17md0 description 0 0 general input/output (pd17) (initial value) (d17 with no rom and cs0 = 32 bit width) 1 data input/output (d17) (pd17 in single chip mode) 1 0 interrupt request input ( irq1 ) 1 reserved bits 1 and 0?d16 mode 1, 0 (pd16md1 and pd16md0): these bits select the function of the pd16/d16/ irq0 pin. bit 1: pd16md1 bit 0: pd16md0 description 0 0 general input/output (pd16) (initial value) (d16 with no rom and cs0 = 32 bit width) 1 data input/output (d16) (pd16 in single chip mode) 1 0 interrupt request input ( irq0 ) 1 reserved
632 18.3.12 port d control register l (pdcrl) pdcrl is a 16-bit read/write register that selects the multiplexed pin functions for the least significant sixteen port d pins. there are instances when these register settings will be ignored, depending on the operation mode. on-chip rom-disabled extended mode: 144-pin version: ? mode 0 (16-bit bus): port d pins are data i/o pins; pdcrl settings are disabled. ? mode 1 (32-bit bus): port d pins are data i/o pins; pdcrl settings are disabled. 112-pin and 120-pin versions: ? mode 0 (8-bit bus): port d pins are data i/o pins; pdcrl settings are disabled. ? mode 1 (16-bit bus): port d pins are data i/o pins; pdcrl settings are disabled. on-chip rom-enabled extended mode: the port d pins are shared as data i/o pins and general i/o pins; pdcrl settings are enabled. single chip mode: the port d pins are general i/o pins; pdcrl settings are disabled. pdcrl is initialized to h'0000 by external power-on reset but is not initialized for manual resets, reset by wdt, standby mode, or sleep mode, so the previous data is maintained. port d control register l (pdcrl) bit: 15 14 13 12 11 10 9 8 pd15 md pd14 md pd13 md pd12 md pd11 md pd10 md pd9 md pd8 md 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 bit: 7 6 5 4 3 2 1 0 pd7 md pd6 md pd5 md pd4 md pd3 md pd2 md pd1 md pd0 md 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
633 bit 15?d15 mode (pd15md): selects the function of the pd15/d15 pin. bit 15: pd15md description 0 general input/output (pd15) (initial value) (d15 in on-chip rom invalid mode) 1 data input/output (d15) (pd15 in single chip mode) bit 14?d14 mode (pd14md): selects the function of the pd14/d14 pin. bit 14: pd14md description 0 general input/output (pd14) (initial value) (d14 in on-chip rom invalid mode) 1 data input/output (d14) (pd14 in single chip mode) bit 13?d13 mode (pd13md): selects the function of the pd13/d13 pin. bit 13: pd13md description 0 general input/output (pd13) (initial value) (d13 in on-chip rom invalid mode) 1 data input/output (d13) (pd13 in single chip mode) bit 12?d12 mode (pd12md): selects the function of the pd12/d12 pin. bit 12: pd12md description 0 general input/output (pd12) (initial value) (d12 in on-chip rom invalid mode) 1 data input/output (d12) (pd12 in single chip mode) bit 11?d11 mode (pd11md): selects the function of the pd11/d11 pin. bit 11: pd11md description 0 general input/output (pd11) (initial value) (d11 in on-chip rom invalid mode) 1 data input/output (d11) (pd11 in single chip mode) bit 10?d10 mode (pd10md): selects the function of the pd10/d10 pin. bit 10: pd10md description 0 general input/output (pd10) (initial value) (d10 in on-chip rom invalid mode) 1 data input/output (d10) (pd10 in single chip mode)
634 bit 9?d9 mode (pd9md): selects the function of the pd9/d9 pin. bit 9: pd9md description 0 general input/output (pd9) (initial value) (d9 in on-chip rom invalid mode) 1 data input/output (d9) (pd9 in single chip mode) bit 8?d8 mode (pd8md): selects the function of the pd8/d8 pin. bit 8: pd8md description 0 general input/output (pd8) (initial value) (d8 in on-chip rom invalid mode) 1 data input/output (d8) (pd8 in single chip mode) bit 7?d7 mode (pd7md): selects the function of the pd7/d7 pin. bit 7: pd7md description 0 general input/output (pd7) (initial value) (d7 in on-chip rom invalid mode) 1 data input/output (d7) (pd7 in single chip mode) bit 6?d6 mode (pd6md): selects the function of the pd6/d6 pin. bit 6: pd6md description 0 general input/output (pd6) (initial value) (d6 in on-chip rom invalid mode) 1 data input/output (d6) (pd6 in single chip mode) bit 5?d5 mode (pd5md): selects the function of the pd5/d5 pin. bit 5: pd5md description 0 general input/output (pd5) (initial value) (d5 in on-chip rom invalid mode) 1 data input/output (d5) (pd5 in single chip mode) bit 4?d4 mode (pd4md): selects the function of the pd4/d4 pin. bit 4: pd4md description 0 general input/output (pd4) (initial value) (d4 in on-chip rom invalid mode) 1 data input/output (d4) (pd4 in single chip mode)
635 bit 3?d3 mode (pd3md): selects the function of the pd3/d3 pin. bit 3: pd3md description 0 general input/output (pd3) (initial value) (d3 in on-chip rom invalid mode) 1 data input/output (d3) (pd3 in single chip mode) bit 2?d2 mode (pd2md): selects the function of the pd2/d2 pin. bit 2: pd2md description 0 general input/output (pd2) (initial value) (d2 in on-chip rom invalid mode) 1 data input/output (d2) (pd2 in single chip mode) bit 1?d1 mode (pd1md): selects the function of the pd1/d1 pin. bit 1: pd1md description 0 general input/output (pd1) (initial value) (d1 in on-chip rom invalid mode) 1 data input/output (d1) (pd1 in single chip mode) bit 0?d0 mode (pd0md): selects the function of the pd0/d0 pin. bit 0: pd0md description 0 general input/output (pd0) (initial value) (d0 in on-chip rom invalid mode) 1 data input/output (d0) (pd0 in single chip mode)
636 18.3.13 port e i/o register (peior) the port e i/o register (peior) is a 16-bit read/write register that selects input or output for the 16 port e pins. bits pe15ior?e0ior correspond to pins pe15/tioc4d/dack1/ irqout pe0/tioc0a/ dreq0 . peior is enabled when the port e pins function as general input/outputs (pe15?e0) or tioc pin of the mtu. for other functions, it is disabled. when the port e pin functions are as pe15?e0, or tioc pin of the mtu, a given pin in port e is an output pin if its corresponding peior bit is set to 1, and an input pin if the bit is cleared to 0. peior is initialized to h'0000 by external power-on reset; however, it is not initialized for manual resets, reset by wdt, standby mode, or sleep mode, so the previous data is maintained. bit: 15 14 13 12 11 10 9 8 pe15 ior pe14 ior pe13 ior pe12 ior pe11 ior pe10 ior pe9 ior pe8 ior 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 bit: 7 6 5 4 3 2 1 0 pe7 ior pe6 ior pe5 ior pe4 ior pe3 ior pe2 ior pe1 ior pe0 ior 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 18.3.14 port e control registers 1, 2 (pecr1 and pecr2) pecr1 and pecr2 are 16-bit read/write registers that select the functions of the sixteen multiplexed pins of port e. pecr1 selects the functions of the upper eight bit pins of port e; pecr2 selects the function of the lower eight bit pins of port e. port e has a bus control signal ( ah ) and dmac control signals (dack1, dack0, drak1, drak0), but there are instances when the register settings that select these pin functions will be ignored, depending on the operation mode. refer to table 18.2, pin arrangement by mode, for details. pecr1 and pecr2 are both initialized to h'0000 by external power-on reset but are not initialized for manual resets, reset by wdt, standby mode, or sleep mode, so the previous data is maintained.
637 port e control register 1 (pecr1): bit: 15 14 13 12 11 10 9 8 pe15 md1 pe15 md0 pe14 md1 pe14 md0 pe13 md1 pe13 md0 pe12md 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 r/w bit: 7 6 5 4 3 2 1 0 pe11md pe10md pe9md pe8md initial value: 0 0 0 0 0 0 0 0 r/w: r r/w r r/w r r/w r r/w bits 15 and 14?e15 mode 1, 0 (pe15md1 and pe15md0): these bits select the function of the pe15/tioc4d/dack1/ irqout pin. bit 15: pe15md1 bit 14: pe15md0 description 0 0 input/output (pe15) (initial value) 1 mtu input capture input/output compare output (tioc4d) 1 0 dmac request received output (dack1) (pe15 in single chip mode) 1 interrupt request output ( irqout ) (reserved in single chip mode) bits 13 and 12?e14 mode 1, 0 (pe14md1 and pe14md0): these bits select the function of the pe14/tioc4c/dack0/ ah pin. bit 13: pe14md1 bit 12: pe14md0 description 0 0 input/output (pe14) (initial value) 1 mtu input capture input/output compare output (tioc4c) 1 0 dmac request received output (dack0) (pe14 in single chip mode) 1 address hold output ( ah ) (pe14 in single chip mode)
638 bits 11 and 10?e13 mode 1, 0 (pe13md1 and pe13md0): these bits select the function of the pe13/tioc4b/ mres pin. bit 11: pe13md1 bit 10: pe13md0 description 0 0 general input/output (pe13) (initial value) 1 mtu input capture input/output compare output (tioc4b) 1 0 manual reset input ( mres ) 1 reserved bit 9?eserved: this bit always reads as 0. the write values should always be 0. bit 8?e12 mode (pe12md): selects the function of the pe12/tioc4a pin. bit 8: pe12md description 0 general input/output (pe12) (initial value) 1 mtu input capture input/output compare output (tioc4a) bit 7?eserved: this bit always reads as 0. the write values should always be 0. bit 6?e11 mode (pe11md): selects the function of the pe11/tioc3d pin. bit 6: pe11md description 0 general input/output (pe11) (initial value) 1 mtu input capture input/output compare output (tioc3d) bit 5?eserved: this bit always reads as 0. the write values should always be 0. bit 4?e10 mode (pe10md): selects the function of the pe10/tioc3c pin. bit 4: pe10md description 0 general input/output (pe10) (initial value) 1 mtu input capture input/output compare output (tioc3c) bit 3?eserved: this bit always reads as 0. the write values should always be 0.
639 bit 2?e9 mode (pe9md): selects the function of the pe9/tioc3b pin. bit 2: pe9md description 0 general input/output (pe9) (initial value) 1 mtu input capture input/output compare output (tioc3b) bit 1?eserved: this bit always reads as 0. the write values should always be 0. bit 0?e8 mode (pe8md): selects the function of the pe8/tioc3a pin. bit 0: pe8md description 0 general input/output (pe8) (initial value) 1 mtu input capture input/output compare output (tioc3a) port e control register 2 (pecr2): bit: 15 14 13 12 11 10 9 8 pe7md pe6md pe5md pe4md initial value: 0 0 0 0 0 0 0 0 r/w: r r/w r r/w r r/w r r/w bit: 7 6 5 4 3 2 1 0 pe3 md1 pe3 md0 pe2 md1 pe2 md0 pe1 md1 pe1 md0 pe0 md1 pe0 md0 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 bit 15?eserved: this bit always reads as 0. the write value should always be 0. bit 14?e7 mode (pe7md): selects the function of the pe7/tioc2b pin. bit 14: pe7md description 0 general input/output (pe7) (initial value) 1 mtu input capture input/output compare output (tioc2b) bit 13 ?eserved: this bit always reads as 0. the write value should always be 0.
640 bit 12?e6 mode (pe6md): selects the function of the pe6/tioc2a pin. bit 12: pe6md description 0 general input/output (pe6) (initial value) 1 mtu input capture input/output compare output (tioc2a) bit 11?eserved: this bit always reads as 0. the write value should always be 0. bit 10?e5 mode (pe5md): selects the function of the pe5/tioc1b pin. bit 10: pe5md description 0 general input/output (pe5) (initial value) 1 mtu input capture input/output compare output (tioc1b) bit 9?eserved: this bit always reads as 0. the write value should always be 0. bit 8?e4 mode (pe4md): selects the function of the pe4/tioc1a pin. bit 8: pe4md description 0 general input/output (pe4) (initial value) 1 mtu input capture input/output compare output (tioc1a) bits 7 and 6?e3 mode 1, 0 (pe3md1 and pe3md0): these bits select the function of the pe3/tioc0d/drak1 pin. bit 7: pe3md1 bit 6: pe3md0 description 0 0 general input/output (pe3) (initial value) 1 mtu input capture input/output compare output (tioc0d) 10 dreq1 request received output (drak1) (pe3 in single chip mode) 1 reserved
641 bits 5 and 4?e2 mode 1, 0 (pe2md1 and pe2md0): these bits select the function of the pe2/tioc0c/ dreq1 pin. bit 5: pe2md1 bit 4: pe2md0 description 0 0 general input/output (pe2) (initial value) 1 mtu input capture input/output compare output (tioc0c) 10 dreq1 request receive input (pe2 in single chip mode) 1 reserved bits 3 and 2?e1 mode 1, 0 (pe1md1 and pe1md0): these bits select the function of the pe1/tioc0b/drak0 pin. bit 3: pe1md1 bit 2: pe1md0 description 0 0 general input/output (pe1) (initial value) 1 mtu input capture input/output compare output (tioc0b) 10 dreq0 request received output (drak0) (pe1 in single chip mode) 1 reserved bits 1 and 0?e0 mode 1, 0 (pe0md1 and pe0md0): these bits select the function of the pe0/tioc0a/ dreq0 pin. bit 1: pe0md1 bit 0: pe0md0 description 0 0 general input/output (pe0) (initial value) 1 mtu input capture input/output compare output (tioc0a) 10 dreq0 request receive input (pe0 in single chip mode) 1 reserved 18.3.15 irqout function control register (ifcr) the ifcr is a 16-bit read/write register used to control output when the multiplexed pins are established as irqout outputs by the port d control register (pdcrh1) or port e control register (pecr1). when pdcrh1 or pecr1 are set for any other function, the settings of this register have no effect on the pin functions.
642 the ifcr is initialized to h'0000 by external power-on reset but is not initialized for manual resets, reset by wdt, standby mode, or sleep mode, so the previous data is maintained. bit: 15 14 13 12 11 10 9 8 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 1 0 irq md3 irq md2 irq md1 irq md0 initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r/w r/w r/w r/w bits 3 and 2?rqout mode 3, 2 (irqmd3 and irqmd2): these bits select the irqout pin function when the pdcrh1 bits 13 and 12 (pd30md1, pd30md0) are set to (1, 0). these bit settings are effective only for the 144 pin version. reads and writes are also possible in the 112-pin and 120-pin versions, but they have no effect on the pin functions. bit 3: irqmd3 bit 2: irqmd2 description 0 0 interrupt request received output (initial value) 1 refresh signal output 1 0 interrupt request received, or refresh signal output (which of the two is output depends on the operation status at the time) 1 always high level output bits 1 and 0?rqout mode 1, 0 (irqmd1 and irqmd0): these bits select the irqout pin function when the pecr1 bits 1 and 0 (pe15md1, pe15md0) are set to (1, 1). bit 1: irqmd1 bit 0: irqmd0 description 0 0 interrupt request received output (initial value) 1 refresh signal output 1 0 interrupt request received, or refresh signal output (which of the two is output depends on the operation status at the time) 1 always high level output
643 18.4 cautions on use for the i/o ports and pins with multiplexing of dreq or irq, switching from the port input low level condition to irq or dreq edge detection will detect the concerned edge.
645 section 19 i/o ports (i/o) 19.1 overview there are six ports, a, b, c, d, e and f. the pins of the ports are multiplexed for use as general- purpose i/os (the port f pins are general input) or for other functions. use the pin function controller (pfc) to select the function of multiplexed pins. the ports each have one data register for storing pin data. the initialize function after power-on reset differs depending on the operating mode of each pin. see table 18.2, pin arrangement by mode, for details. 19.2 port a there are two versions of port a: fp-112/tfp-120 fp-144 in the fp-112 and tfp-120 versions, port a is a 16-pin input/output port, as listed in table 19.1.
646 table 19.1 port a, fp-112/tfp-120 version rom disabled extended mode (modes 0, 1) rom enabled extended mode (mode 2) single chip mode pa15 (i/o)/ck (output) pa15 (i/o)/ck (output) pa15 (i/o)/ck (output) rd (output) pa14 (i/o)/ rd (output) pa14 (i/o) wrh (output) pa13 (i/o)/ wrh (output) pa13 (i/o) wrl (output) pa12 (i/o)/ wrl (output) pa12 (i/o) cs1 (output) pa11 (i/o)/ cs1 (output) pa11 (i/o) cs0 (output) pa10 (i/o)/ cs0 (output) pa10 (i/o) pa9 (i/o)/tclkd (input)/ irq3 (input) pa9 (i/o)/tclkd (input)/ irq3 (input) pa9 (i/o)/tclkd (input)/ irq3 (input) pa8 (i/o)/tclkc (input)/ irq2 (input) pa8 (i/o)/tclkc (input)/ irq2 (input) pa8 (i/o)/tclkc (input)/ irq2 (input) pa7 (i/o)/tclkb (input)/ cs3 (output) pa7 (i/o)/tclkb (input)/ cs3 (output) pa7 (i/o)/tclkb (input) pa6 (i/o)/tclka (input)/ cs2 (output) pa6 (i/o)/tclka (input)/ cs2 (output) pa6 (i/o)/tclka (input) pa5 (i/o)/sck1 (i/o)/ dreq1 (input)/ irq1 (input) pa5 (i/o)/sck1 (i/o)/ dreq1 (input)/ irq1 (input) pa5 (i/o)/sck1 (i/o)/ irq1 (input) pa4 (i/o)/txd1 (output) pa4 (i/o)/txd1 (output) pa4 (i/o)/txd1 (output) pa3 (i/o)/rxd1 (input) pa3 (i/o)/rxd1 (input) pa3 (i/o)/rxd1 (input) pa2 (i/o)/sck0 (i/o)/ dreq0 (input)/ irq0 (input) pa2 (i/o)/sck0 (i/o)/ dreq0 (input)/ irq0 (input) pa2 (i/o)/sck0 (i/o)/ irq0 (input) pa1 (i/o)/txd0 (output) pa1 (i/o)/txd0 (output) pa1 (i/o)/txd0 (output) pa0 (i/o)/rxd0 (input) pa0 (i/o)/rxd0 (input) pa0 (i/o)/rxd0 (input) in the fp-144 version, port a is a 24-pin input/output port, as listed in table 19.2.
647 table 19.2 port a, fp-144 version rom disabled extended mode (modes 0, 1) rom enabled extended mode (mode 2) single chip mode wrhh (output) pa23 (i/o)/ wrhh (output) pa23 (i/o) wrhl (output) pa22 (i/o) /wrhl (output) pa22 (i/o) pa21 (i/o)/ cashh (output) pa21 (i/o)/ cashh (output) pa21 (i/o) pa20 (i/o)/ cashl (output) pa20 (i/o)/ cashl (output) pa20 (i/o) pa19 (i/o)/ back (output)/ drak1 (output) pa19 (i/o)/ back (output)/ drak1 (output) pa19 (i/o) pa18 (i/o)/ breq (input)/ drak0 (output) pa18 (i/o)/ breq (input)/ drak0 (output) pa18 (i/o) pa17 (i/o)/ wait (input) pa17 (i/o)/ wait (input) pa17 (i/o) pa16 (i/o) /ah (output) pa16 (i/o) /ah (output) pa16 (i/o) ck (output) pa15 (i/o)/ck (output) pa15 (i/o)/ck (output) rd (output) pa14 (i/o)/ rd (output) pa14 (i/o) wrh (output) pa13 (i/o)/ wrh (output) pa13 (i/o) wrl (output) pa12 (i/o)/ wrl (output) pa12 (i/o) cs1 (output) pa11 (i/o)/ cs1 (output) pa11 (i/o) cs0 (output) pa10 (i/o)/ cs0 (output) pa10 (i/o) pa9 (i/o)/tclkd (input)/ irq3 (input) pa9 (i/o)/tclkd (input)/ irq3 (input) pa9 (i/o)/tclkd (input)/ irq3 (input) pa8 (i/o)/tclkc (input)/ irq2 (input) pa8 (i/o)/tclkc (input)/ irq2 (input) pa8 (i/o)/tclkc (input)/ irq2 (input) pa7 (i/o)/tclkb (input)/ cs3 (output) pa7 (i/o)/tclkb (input)/ cs3 (output) pa7 (i/o)/tclkb (input) pa6 (i/o)/tclka (input)/ cs2 (output) pa6 (i/o)/tclka (input)/ cs2 (output) pa6 (i/o)/tclka (input) pa5 (i/o)/sck1 (i/o)/ dreq1 (input)/ irq1 (input) pa5 (i/o)/sck1 (i/o)/ dreq1 (input)/ irq1 (input) pa5 (i/o)/sck1 (i/o)/ irq1 (input) pa4 (i/o)/txd1 (output) pa4 (i/o)/txd1 (output) pa4 (i/o)/txd1 (output) pa3 (i/o)/rxd1 (input) pa3 (i/o)/rxd1 (input) pa3 (i/o)/rxd1 (input) pa2 (i/o)/sck0 (i/o)/ dreq0 (input)/ irq0 (input) pa2 (i/o)/sck0 (i/o)/ dreq0 (input)/ irq0 (input) pa2 (i/o)/sck0 (i/o)/ irq0 (input) pa1 (i/o)/txd0 (output) pa1 (i/o)/txd0 (output) pa1 (i/o)/txd0 (output) pa0 (i/o)/rxd0 (input) pa0 (i/o)/rxd0 (input) pa0 (i/o)/rxd0 (input)
648 19.2.1 register configuration table 19.3 summarizes the port a register. table 19.3 port a register name abbreviation r/w initial value address access size port a data register h padrh r/w h'0000 h'ffff8380 h'ffff8381 8, 16, 32 port a data register l padrl r/w h'0000 h'ffff8382 h'ffff8383 8, 16, 32 19.2.2 port a data register h (padrh) padrh is a 16-bit read/write register that stores data for port a. the bits pa23dr?a16dr correspond to the pa23/ wrhh ?a16/ ah pins. when the pins are used as ordinary outputs, they will output whatever value is written in the padrh; when padrh 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 padrh is read. when a value is written to padrh, that value can be written into padrh, but it will not affect the pin status. table 19.4 shows the read/write operations of the port a data register. padrh is initialized by an external power-on reset. however, padrh is not initialized for manual reset, reset by wdt, standby mode, or sleep mode. these register settings function only for the 144-pin version. there are no pins corresponding to this register in the 112-pin version. however, read/writes are possible. bit: 15 14 13 12 11 10 9 8 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 1 0 pa23dr pa22dr pa21dr pa20dr pa19dr pa18dr pa17dr pa16dr 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
649 19.2.3 port a data register l (padrl) padrl is a 16-bit read/write register that stores data for port a. the bits pa15dr?a0dr correspond to the pa15/ck?a0/rxd0 pins. when the pins are used as ordinary outputs, they will output whatever value is written in the padrl; when padrl 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 padrl is read. when a value is written to padrl, that value can be written into padrl, but it will not affect the pin status. table 19.4 shows the read/write operations of the port a data register. padrl is initialized by an external power-on reset. however, padrl is not initialized for manual reset, reset by wdt, standby mode, or sleep mode. bit: 15 14 13 12 11 10 9 8 pa15dr pa14dr pa13dr pa12dr pa11dr pa10dr pa9dr pa8dr 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 bit: 7 6 5 4 3 2 1 0 pa7dr pa6dr pa5dr pa4dr pa3dr pa2dr pa1dr pa0dr 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 19.4 read/write operation of the port a data register (padr) paior pin status read write 0 ordinary 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 1 ordinary 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
650 19.3 port b port b is a 10-pin input/output port as listed in table 19.5. table 19.5 port b rom disabled extended mode (modes 0, 1) rom enabled extended mode (mode 2) single chip mode pb9 (i/o)/ irq7 (input)/a21 (output)/ adtrg (input) pb9 (i/o)/ irq7 (input)/a21 (output)/ adtrg (input) pb9 (i/o)/ irq7 (input)/ adtrg (input) pb8 (i/o)/ irq6 (input)/a20 (output)/ wait (input) pb8 (i/o)/ irq6 (input)/a20 (output)/ wait (input) pb8 (i/o)/ irq6 (input) pb7 (i/o)/ irq5 (input)/a19 (output)/ breq (input) pb7 (i/o)/ irq5 (input)/a19 (output)/ breq (input) pb7 (i/o)/ irq5 (input) pb6 (i/o)/ irq4 (input)/a18 (output)/ back (output) pb6 (i/o)/ irq4 (input)/a18 (output)/ back (input) pb6 (i/o)/ irq4 (input) pb5 (i/o)/ irq3 (input)/ poe3 (input)/rdwr (output) pb5 (i/o)/ irq3 (input)/ poe3 (input)/rdwr (output) pb5 (i/o)/ irq3 (input)/ poe3 (input) pb4 (i/o)/ irq2 (input)/ poe2 (input)/ cash (output) pb4 (i/o)/ irq2 (input)/ poe2 (input)/ cash (output) pb4 (i/o)/ irq2 (input)/ poe2 (input) pb3 (i/o)/ irq1 (input)/ poe1 (input)/ casl (output) pb3 (i/o)/ irq1 (input)/ poe1 (input)/ casl (output) pb3 (i/o)/ irq1 (input)/ poe1 (input) pb2 (i/o)/ irq0 (input)/ poe0 (input)/ ras (output) pb2 (i/o)/ irq0 (input)/ poe0 (input)/ ras (output) pb2 (i/o)/ irq0 (input)/ poe0 (input) a17 (output) pb1 (i/o)/a17 (output) pb1 (i/o) a16 (output) pb0 (i/o)/a16 (output) pb0 (i/o) 19.3.1 register configuration table 19.6 summarizes the port b register. table 19.6 port b register name abbreviation r/w initial value address access size port b data register pbdr r/w h'0000 h'ffff8390 h'ffff8391 8, 16, 32
651 19.3.2 port b data register (pbdr) pbdr is a 16-bit read/write register that stores data for port b. the bits pb9dr?b0dr correspond to the pb9/ irq7 /a21/ adtrg ?b0/a16 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 read 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. table 19.7 shows the read/write operations of the port b data register. pbdr is initialized by an external power-on reset. however, pbdr is not initialized for a manual reset, reset by wdt, standby mode, or sleep mode. bit: 15 14 13 12 11 10 9 8 pb9dr pb8dr initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r r/w r/w bit: 7 6 5 4 3 2 1 0 pb7dr pb6dr pb5dr pb4dr pb3dr pb2dr pb1dr pb0dr 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 19.7 read/write operation of the port b data register (pbdr) pbior pin status read write 0 ordinary input pin status can write to pbdr, but it has no effect on pin status other function pin status can write to pbdr, but it has no effect on pin status 1 ordinary output pbdr value value written is output by pin other function pbdr value can write to pbdr, but it has no effect on pin status
652 19.4 port c port c is a 16 pin input/output port as listed in table 19.8. table 19.8 port c rom disabled extended mode (modes 0, 1) rom enabled extended mode (mode 2) single chip mode a15 (output) pc15 (i/o)/a15 (output) pc15 (i/o) a14 (output) pc14 (i/o)/a14 (output) pc14 (i/o) a13 (output) pc13 (i/o)/a13 (output) pc13 (i/o) a12 (output) pc12 (i/o)/a12 (output) pc12 (i/o) a11 (output) pc11 (i/o)/a11 (output) pc11 (i/o) a10 (output) pc10 (i/o)/a10 (output) pc10 (i/o) a9 (output) pc9 (i/o)/a9 (output) pc9 (i/o) a8 (output) pc8 (i/o)/a8 (output) pc8 (i/o) a7 (output) pc7 (i/o)/a7 (output) pc7 (i/o) a6 (output) pc6 (i/o)/a6 (output) pc6 (i/o) a5 (output) pc5 (i/o)/a5 (output) pc5 (i/o) a4 (output) pc4 (i/o)/a4 (output) pc4 (i/o) a3 (output) pc3 (i/o)/a3 (output) pc3 (i/o) a2 (output) pc2 (i/o)/a2 (output) pc2 (i/o) a1 (output) pc1 (i/o)/a1 (output) pc1 (i/o) a0 (output) pc0 (i/o)/a0 (output) pc0 (i/o) 19.4.1 register configuration table 19.9 summarizes the port c register. table 19.9 port c register name abbreviation r/w initial value address access size port c data register pcdr r/w h'0000 h'ffff8392 h'ffff8393 8, 16, 32
653 19.4.2 port c data register (pcdr) pcdr is a 16-bit read/write register that stores data for port c. the bits pc15dr?c0dr correspond to the pc15/a15?c0/a0 pins. when the pins are used as ordinary outputs, they will output whatever value is written in the pcdr; when pcdr is read, the register value will be read 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 pcdr is read. when a value is written to pcdr, that value can be written into pcdr, but it will not affect the pin status. table 19.10 shows the read/write operations of the port c data register. pcdr is initialized by an external power-on reset. however, pcdr is not initialized for a manual reset, reset by wdt, standby mode, or sleep mode. bit: 15 14 13 12 11 10 9 8 pc15dr pc14dr pc13dr pc12dr pc11dr pc10dr pc9dr pc8dr 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 bit: 7 6 5 4 3 2 1 0 pc7dr pc6dr pc5dr pc4dr pc3dr pc2dr pc1dr pc0dr 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 19.10 read/write operation of the port c data register (pcdr) pcior pin status read write 0 ordinary input pin status can write to pcdr, but it has no effect on pin status other function pin status can write to pcdr, but it has no effect on pin status 1 ordinary output pcdr value value written is output by pin other function pcdr value can write to pcdr, but it has no effect on pin status
654 19.5 port d there are two versions of port d: fp-112 fp-144 in the fp-112 version, port d is a 16-pin input/output port, as shown in table 19.11. table 19.11 port d, fp-112 version extended mode without rom (mode 0) extended mode without rom (mode 1) extended mode with rom (mode 2) single chip mode d15 (i/o) d15 (i/o) pd15 (i/o)/d15 (i/o) pd15 (i/o) d14 (i/o) d14 (i/o) pd14 (i/o)/d14 (i/o) pd14 (i/o) d13 (i/o) d13 (i/o) pd13 (i/o)/d13 (i/o) pd13 (i/o) d12 (i/o) d12 (i/o) pd12 (i/o)/d12 (i/o) pd12 (i/o) d11 (i/o) d11 (i/o) pd11 (i/o)/d11 (i/o) pd11 (i/o) d10 (i/o) d10 (i/o) pd10 (i/o)/d10 (i/o) pd10 (i/o) d9 (i/o) d9 (i/o) pd9 (i/o)/d9 (i/o) pd9 (i/o) d8 (i/o) d8 (i/o) pd8 (i/o)/d8 (i/o) pd8 (i/o) d7 (i/o) d7 (i/o) pd7 (i/o)/d7 (i/o) pd7 (i/o) d6 (i/o) d6 (i/o) pd6 (i/o)/d6 (i/o) pd6 (i/o) d5 (i/o) d5 (i/o) pd5 (i/o)/d5 (i/o) pd5 (i/o) d4 (i/o) d4 (i/o) pd4 (i/o)/d4 (i/o) pd4 (i/o) d3 (i/o) d3 (i/o) pd3 (i/o)/d3 (i/o) pd3 (i/o) d2 (i/o) d2 (i/o) pd2 (i/o)/d2 (i/o) pd2 (i/o) d1 (i/o) d1 (i/o) pd1 (i/o)/d1 (i/o) pd1 (i/o) d0 (i/o) d0 (i/o) pd0 (i/o)/d0 (i/o) pd0 (i/o) in the fp-144 version, port d is a 32-pin input/output port, as listed in table 19.12.
655 table 19.12 port d, fp-144 version extended mode without rom (mode 0) extended mode without rom (mode 1) extended mode with rom (mode 2) single chip mode pd31 (i/o)/d31 (i/o)/ adtrg (input) d31 (i/o) pd31 (i/o)/d31 (i/o)/ adtrg (input) pd31 (i/o)/ adtrg (input) pd30 (i/o)/d30 (i/o)/ irqout (output) d30 (i/o) pd30 (i/o)/d30 (i/o)/ irqout (output) pd30 (i/o)/ irqout (output) pd29 (i/o)/d29 (i/o)/ cs3 (output) d29 (i/o) pd29 (i/o)/d29 (i/o)/ cs3 (output) pd29 (i/o) pd28 (i/o)/d28 (i/o)/ cs2 (output) d28 (i/o) pd28 (i/o)/d28 (i/o)/ cs2 (output) pd28 (i/o) pd27 (i/o)/d27 (i/o)/ dack1 (output) d27 (i/o) pd27 (i/o)/d27 (i/o)/ dack1 (output) pd27 (i/o) pd26 (i/o)/d26 (i/o)/ dack0 (output) d26 (i/o) pd26 (i/o)/d26 (i/o)/ dack0 (output) pd26 (i/o) pd25 (i/o)/d25 (i/o)/ dreq1 (input) d25 (i/o) pd25 (i/o)/d25 (i/o)/ dreq1 (input) pd25 (i/o) pd24 (i/o)/d24 (i/o)/ dreq0 (input) d24 (i/o) pd24 (i/o)/d24 (i/o)/ dreq0 (input) pd24 (i/o) pd23 (i/o)/d23 (i/o)/ irq7 (input) d23 (i/o) pd23 (i/o)/d23 (i/o)/ irq7 (input) pd23 (i/o)/ irq7 (input) pd22 (i/o)/d22 (i/o)/ irq6 (input) d22 (i/o) pd22 (i/o)/d22 (i/o)/ irq6 (input) pd22 (i/o)/ irq6 (input) pd21 (i/o)/d21 (i/o)/ irq5 (input) d21 (i/o) pd21 (i/o)/d21 (i/o)/ irq5 (input) pd21 (i/o)/ irq5 (input) pd20 (i/o)/d20 (i/o)/ irq4 (input) d20 (i/o) pd20 (i/o)/d20 (i/o)/ irq4 (input) pd20 (i/o)/ irq4 (input) pd19 (i/o)/d19 (i/o)/ irq3 (input) d19 (i/o) pd19 (i/o)/d19 (i/o)/ irq3 (input) pd19 (i/o)/ irq3 (input) pd18 (i/o)/d18 (i/o)/ irq2 (input) d18 (i/o) pd18 (i/o)/d18 (i/o)/ irq2 (input) pd18 (i/o)/ irq2 (input) pd17 (i/o)/d17 (i/o)/ irq1 (input) d17 (i/o) pd17 (i/o)/d17 (i/o)/ irq1 (input) pd17 (i/o)/ irq1 (input) pd16 (i/o)/d16 (i/o)/ irq0 (input) d16 (i/o) pd16 (i/o)/d16 (i/o)/ irq0 (input) pd16 (i/o)/ irq0 (input)
656 table 19.12 port d, fp-144 version (cont) extended mode without rom (mode 0) extended mode without rom (mode 1) extended mode with rom (mode 2) single chip mode d15 (i/o) d15 (i/o) pd15 (i/o)/d15 (i/o) pd15 (i/o) d14 (i/o) d14 (i/o) pd14 (i/o)/d14 (i/o) pd14 (i/o) d13 (i/o) d13 (i/o) pd13 (i/o)/d13 (i/o) pd13 (i/o) d12 (i/o) d12 (i/o) pd12 (i/o)/d12 (i/o) pd12 (i/o) d11 (i/o) d11 (i/o) pd11 (i/o)/d11 (i/o) pd11 (i/o) d10 (i/o) d10 (i/o) pd10 (i/o)/d10 (i/o) pd10 (i/o) d9 (i/o) d9 (i/o) pd9 (i/o)/d9 (i/o) pd9 (i/o) d8 (i/o) d8 (i/o) pd8 (i/o)/d8 (i/o) pd8 (i/o) d7 (i/o) d7 (i/o) pd7 (i/o)/d7 (i/o) pd7 (i/o) d6 (i/o) d6 (i/o) pd6 (i/o)/d6 (i/o) pd6 (i/o) d5 (i/o) d5 (i/o) pd5 (i/o)/d5 (i/o) pd5 (i/o) d4 (i/o) d4 (i/o) pd4 (i/o)/d4 (i/o) pd4 (i/o) d3 (i/o) d3 (i/o) pd3 (i/o)/d3 (i/o) pd3 (i/o) d2 (i/o) d2 (i/o) pd2 (i/o)/d2 (i/o) pd2 (i/o) d1 (i/o) d1 (i/o) pd1 (i/o)/d1 (i/o) pd1 (i/o) d0 (i/o) d0 (i/o) pd0 (i/o)/d0 (i/o) pd0 (i/o) 19.5.1 register configuration table 19.13 summarizes the port d register. table 19.13 port d register name abbreviation r/w initial value address access size port d data register h pddrh r/w h'0000 h'ffff83a0 h'ffff83a1 8, 16, 32 port d data register l pddrl r/w h'0000 h'ffff83a2 h'ffff83a3 8, 16, 32
657 19.5.2 port d data register h (pddrh) pddrh is a 16-bit read/write register that stores data for port d. the bits pd31dr?d16dr correspond to the pd31/d31/ adtrg ?d16/d16/ irq0 pins. when the pins are used as ordinary outputs, they will output whatever value is written in the pddrh; when pddrh is read, the register value will be read 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 pddrh is read. when a value is written to pddrh, that value can be written into pddrh, but it will not affect the pin status. table 19.14 shows the read/write operations of the port d data register. pddrh is initialized by an external power-on reset. however, pddrh is not initialized for a manual reset, reset by wdt, standby mode, or sleep mode. these register settings function only for the 144-pin version. there are no pins corresponding to this register in the 112-pin version. however, read/writes are possible. bit: 15 14 13 12 11 10 9 8 pd31dr pd30dr pd29dr pd28dr pd27dr pd26dr pd25dr pd24dr 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 bit: 7 6 5 4 3 2 1 0 pd23dr pd22dr pd21dr pd20dr pd19dr pd18dr pd17dr pd16dr 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
658 19.5.3 port d data register l (pddrl) pddrl is a 16-bit read/write register that stores data for port d. the bits pd15dr?d0dr correspond to the pd15/d15?d0/d0 pins. when the pins are used as ordinary outputs, they will output whatever value is written in the pddrl; when pddrl is read, the register value will be read 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 pddrl is read. when a value is written to pddrl, that value can be written into pddrl, but it will not affect the pin status. table 19.14 shows the read/write operations of the port d data register. pddrl is initialized by an external power-on reset. however, pddrl is not initialized for a manual reset, reset by wdt, standby mode, or sleep mode. bit: 15 14 13 12 11 10 9 8 pd15dr pd14dr pd13dr pd12dr pd11dr pd10dr pd9dr pd8dr 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 bit: 7 6 5 4 3 2 1 0 pd7dr pd6dr pd5dr pd4dr pd3dr pd2dr pd1dr pd0dr 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 19.14 read/write operation of the port d data register (pddr) pdior pin status read write 0 ordinary input pin status can write to pddr, but it has no effect on pin status other function pin status can write to pddr, but it has no effect on pin status 1 ordinary output pddr value value written is output by pin other function pddr value can write to pddr, but it has no effect on pin status
659 19.6 port e port e is a 16-pin input/output port, as listed in table 19.15. table 19.15 port e extended modes (modes 0, 1, 2) single chip mode pe15 (i/o)/tioc4d (i/o)/dack1 (output)/ irqout (output) pe15 (i/o)/tioc4d (i/o)/ irqout (output) pe14 (i/o)/tioc4c (i/o)/dack0 (output)/ ah (output) pe14 (i/o)/tioc4c (i/o) pe13 (i/o)/tioc4b (i/o)/ mres (input) pe13 (i/o)/tioc4b (i/o)/ mres (input) pe12 (i/o)/tioc4a (i/o) pe12 (i/o)/tioc4a (i/o) pe11 (i/o)/tioc3d (i/o) pe11 (i/o)/tioc3d (i/o) pe10 (i/o)/tioc3c (i/o) pe10 (i/o)/tioc3c (i/o) pe9 (i/o)/tioc3b (i/o) pe9 (i/o)/tioc3b (i/o) pe8 (i/o)/tioc3a (i/o) pe8 (i/o)/tioc3a (i/o) pe7 (i/o)/tioc2b (i/o) pe7 (i/o)/tioc2b (i/o) pe6 (i/o)/tioc2a (i/o) pe6 (i/o)/tioc2a (i/o) pe5 (i/o)/tioc1b (i/o) pe5 (i/o)/tioc1b (i/o) pe4 (i/o)/tioc1a (i/o) pe4 (i/o)/tioc1a (i/o) pe3 (i/o)/tioc0d (i/o)/drak1 (output) pe3 (i/o)/tioc0d (i/o) pe2 (i/o)/tioc0c (i/o)/ dreq1 (input) pe2 (i/o)/tioc0c (i/o) pe1 (i/o)/tioc0b (i/o)/drak0 (output) pe1 (i/o)/tioc0b (i/o) pe0 (i/o)/tioc0a (i/o)/ dreq0 (input) pe0 (i/o)/tioc0a (i/o) 19.6.1 register configuration table 19.16 summarizes the port e register. table 19.16 port e register name abbreviation r/w initial value address access size port e data register pedr r/w h'0000 h'ffff83b0 h'ffff83b1 8, 16, 32
660 19.6.2 port e data register (pedr) pedr is a 16-bit read/write register that stores data for port e. the bits pe15dr?e0dr correspond to the pe15/tioc4d/dack1/ irqout ?e0/tioc0a/ dreq0 pins. when the pins are used as ordinary outputs, they will output whatever value is written in the pedr; when pedr is read, the register value will be read 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 pedr is read. when a value is written to pedr, that value can be written into pedr, but it will not affect the pin status. table 19.17 shows the read/write operations of the port e data register. pedr is initialized by a external power-on reset. however, pedr is not initialized for a manual reset, reset by wdt, standby mode, or sleep mode, so the previous data is retained. bit: 15 14 13 12 11 10 9 8 pe15dr pe14dr pe13dr pe12dr pe11dr pe10dr pe9dr pe8dr 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 bit: 7 6 5 4 3 2 1 0 pe7dr pe6dr pe5dr pe4dr pe3dr pe2dr pe1dr pe0dr 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 19.17 read/write operation of the port e data register (pedr) peior pin status read write 0 ordinary input pin status can write to pedr, but it has no effect on pin status other function pin status can write to pedr, but it has no effect on pin status 1 ordinary output pedr value value written is output by pin other function pedr value can write to pedr, but it has no effect on pin status
661 19.7 port f port f is an 8-pin input port. all modes are configured in the following way: pf7 (input)/an7 (input) pf6 (input)/an6 (input) pf5 (input)/an5 (input) pf4 (input)/an4 (input) pf3 (input)/an3 (input) pf2 (input)/an2 (input) pf1 (input)/an1 (input) pf0 (input)/an0 (input) 19.7.1 register configuration table 19.18 summarizes the port f register. table 19.18 port f register name abbreviation r/w initial value address access size port f data register pfdr r external pin dependent h'ffff83b3 8 19.7.2 port f data register (pfdr) pfdr is an 8-bit read-only register that stores data for port f. the bits pf7dr?f0dr correspond to the pf7/an7?f0/an0 pins. there are no bits 15?, so always access as eight bits. any value written into these bits is ignored, and there is no effect on the status of the pins. when any of the bits are read, the pin status rather than the bit value is read directly. however, when an a/d converter analog input is being sampled, values of 1 are read out. table 19.19 shows the read/write operations of the port f data register. pfdr is not initialized by power-on resets, manual resets, standby mode, or sleep mode (the bits always reflect the pin status). bit: 7 6 5 4 3 2 1 0 pf7dr pf6dr pf5dr pf4dr pf3dr pf2dr pf1dr pf0dr initial value: * * * * * * * * r/w: r r r r r r r r note: * initial values are dependent on the status of the pins at the time of the reads.
662 table 19.19 read/write operation of the port f data register (pfdr) pin i/o pin function read write input ordinary pin status is read ignored (no effect on pin status) ann: analog input 1 is read ignored (no effect on pin status) n=7-0
663 section 20 64/128/256kb mask rom 20.1 overview this lsi is available with 64 kbytes, 128 kbytes, or 256 kbytes of on-chip rom. the on-chip rom is connected to the cpu, direct memory access controller (dmac) and data transfer controller (dtc) through a 32-bit data bus (figures 20.1, 20.2 and 20.3). the cpu, dmac and dtc can access the on-chip rom in 8, 16 and 32-bit widths. data in the on-chip rom can always be accessed in one cycle. h'00000000 h'00000004 h'00000001 h'00000005 h'00000002 h'00000006 h'00000003 h'00000007 h'0000fffc h'0000fffd h'0000fffe h'0000ffff on-chip rom internal data bus (32 bits) figure 20.1 mask rom block diagram (64-kbyte version)
664 h'00000000 h'00000004 h'00000001 h'00000005 h'00000002 h'00000006 h'00000003 h'00000007 h'0001fffc h'0001fffd h'0001fffe h'0001ffff on-chip rom internal data bus (32 bits) figure 20.2 mask rom block diagram (128-kbyte version) h'00000000 h'00000004 h'00000001 h'00000005 h'00000002 h'00000006 h'00000003 h'00000007 h'0003fffc h'0003fffd h'0003fffe h'0003ffff on-chip rom internal data bus (32 bits) figure 20.3 mask rom block diagram (256-kbyte version)
665 the operating mode determines whether the on-chip rom is valid or not. the operating mode is selected using mode-setting pins md3?d0 as shown in table 20.1. if you are using the on-chip rom, select mode 2 or mode 3; if you are not, select mode 0 or 1. the on-chip rom is allocated to addresses h'00000000?'0000ffff of memory area 0 for the 64 kbyte version, h'00000000 h'0001ffff of memory area 0 for the 128 kbyte version and h'00000000?'0003ffff of memory area 0 for the 256 kbyte version. table 20.1 operation modes and rom mode setting pin operation mode md3 md2 md1 md0 area 0 mode 0 (mcu mode 0) * * 0 0 on-chip rom invalid, external 8-bit space (112 pin and 120 pin), external 16-bit space (144 pin) mode 1 (mcu mode 1) * * 0 1 on-chip rom invalid, external 16-bit space (112 pin and 120 pin), external 32-bit space (144 pin) mode 2 (mcu mode 2) * * 1 0 on-chip rom valid, external space (bus width set with bus state controller) mode 3 (mcu mode 3) * * 1 1 on-chip rom valid, single-chip mode 0: low 1: high *: refer to section 3, operating modes.
667 section 21 128kb prom 21.1 overview this lsi has 128 kbytes of on-chip prom.the on-chip rom is connected to the cpu, the direct memory access controller (dmac) and the data transfer controller (dtc) through a 32-bit data bus (figures 21.1). the cpu, dmac and dtc can access the on-chip rom in 8, 16, and 32-bit widths. data in the on-chip rom can always be accessed in one cycle. h'00000000 h'00000004 h'00000001 h'00000005 h'00000002 h'00000006 h'00000003 h'00000007 h'0001fffc h'0001fffd h'0001fffe h'0001ffff on-chip rom internal data bus (32 bits) figure 21.1 prom block diagram the operating mode determines whether the on-chip rom is valid or not. the operating mode is selected using mode-setting pins md3?d0 as shown in table 21.1. if you are using the on-chip rom, select mode 2 or mode 3; if you are not, select mode 0 or 1. the on-chip rom is allocated to addresses h'00000000?'0001ffff of memory area 0.
668 table 21.1 operating modes and rom mode setting pin operating mode md3 md2 md1 md0 area 0 mode 0 (mcu mode 0) * * 0 0 on-chip rom invalid, external 8-bit space (112 pin and 120 pin), external 16-bit space (144 pin) mode 1 (mcu mode 1) * * 0 1 on-chip rom invalid, external 16-bit space (112 pin and 120 pin), external 32-bit space (144 pin) mode 2 (mcu mode 2) * * 1 0 on-chip rom valid, with an external space (bus width setting is performed by the bus state controller) mode 3 (mcu mode 3) * * 1 1 on-chip rom valid, single chip mode mode 7 (prom mode) 1 1 1 1 0: low 1: high *: refer to section 3, operating modes. with the prom version, programs can be written in the same manner as with an ordinary eprom by setting the lsi to prom mode and using a standard eprom writer. 21.2 prom mode 21.2.1 prom mode settings when programming the on-chip prom, set the pins as shown in figure 21.2, 21.3, or 21.4, and perform the programming in prom mode. 21.2.2 socket adapter pin correspondence and memory map connect the socket adapter to the sh7040 series chip as shown in figure 21.2 or 21.3. this will allow the on-chip prom to be programmed in the same manner as an ordinary 32-pin eprom (hn27c101). figures 21.2, 21.3, and 21.4 show the correspondence between the sh7040 series pins and hn27c101 pins. figure 21.5 is a memory map of the on-chip rom.
669 hn27c101 eprom socket adapter 0.1 m f (112-pin version) sh7042 pin name pin number res /v pp 84 nmi 76 pd0/d0 70 pd1/d1 69 pd2/d2 68 pd3/d3 67 pd4/d4 66 pd5/d5 64 pd6/d6 63 pd7/d7 62 pc0/a0 4 pc1/a1 5 pc2/a2 6 pc3/a3 7 pc4/a4 8 pc5/a5 9 pc6/a6 10 pc7/a7 pc8/a8 11 pb3/ rd1 / poe1 / casl 12 pc10/a10 25 pc11/a11 14 pc12/a12 15 16 pc13/a13 pc14/a14 17 pc15/a15 18 19 pb0/a16 pb4/ irq2 / poe2 / cash 20 v cc md0 21, 37,65,77,103 pllv cc /av cc 80, 100 pllcap, pllv ss , extal 81, 82, 74 v ss av ss 3, 23, 27, 33, 39, 55, 61, 71, 90, 101, 109 md1 79 78 md2 75 md3 73 97 pf0/an0epf7/an7 91e96, 98, 99 26 pe15/tioc4d/dack1/ irqout pe14/tioc4c/dack0/ ah 2 pb5/ irq3 / poe3 /rdwr 1 28 pin number pin name 1 v pp 26 a9 13 i/o0 14 i/o1 15 i/o2 17 i/o3 18 i/o4 19 i/o5 20 i/o6 21 i/o7 12 a0 11 a1 10 a2 9 a3 8 a4 7 a5 6 a6 5 27 a7 24 a8 23 oe 25 a10 4 a11 a12 28 29 a13 3 a14 a15 2 31 a16 pgm 22 32 ce 16 v cc v pp : a16ea0: i/o7ei/o0: oe : pgm : ce : v ss prom program power supply (12.5 v) address input data input/ output output enable program enable chip enable figure 21.2 sh7042 pin and hn27c101 pin correspondence (112-pin version)
670 pin number pin name 89 81 75 74 73 72 71 69 68 67 5 6 7 8 9 10 11 12 13 26 15 16 17 18 19 20 21 27 3 2 29 22, 40, 70, 82, 111 84 83 80 85, 107 86, 87, 79 4, 24, 28, 36, 42 58, 66, 76, 97, 108, 117 98 to 103 105 to 106 104 78 res/vpp nmi pd0/d0 pd1/d1 pd2/d2 pd3/d3 pd4/d4 pd5/d5 pd6/d6 pd7/d7 pc0/a0 pc1/a1 pc2/a2 pc3/a3 pc4/a4 pc5/a5 pc6/a6 pc7/a7 pc8/a8 pb3/irq1/poe1/casl pc10/a10 pc11/a11 pc12/a12 pc13/a13 pc14/a14 pc15/a15 pb0/a16 pb4/irq2/poe2/cash pe15/tioc4d/dack1/irqout pe14/tioc4c/dack0/ah pb5/irq3/poe3/rdwr vcc md0 md1 md2 pllvcc, avcc pllcap, pllvss, extal vss pf0/an0 to pf5/an5 pf6/an6 to pf7/an7 avss md3 pin name pin number vpp 1 a9 26 i/o0 i/o1 i/o2 i/o3 i/o4 i/o5 i/o6 i/o7 a0 a1 a2 a3 a4 a5 a6 a7 a8 oe a10 a11 a12 a13 a14 a15 a16 pgm ce vcc vss 13 14 15 17 18 19 20 21 12 11 10 9 8 7 6 5 27 24 23 25 4 28 29 3 2 31 22 32 16 sh7042 (120-pin version) hn27c101 eprom socket adapter vpp: a16 to a0: i/o7 to i/o0: oe: pgm: ce: prom program power supply (12.5 v) address input data input/ output output enable program enable chip enable 0.1 s figure 21.3 sh7042 pin and hn27c101 pin correspondence (120-pin version)
671 hn27c101 (144-pin version) sh7043 pin name pin number res /v pp 108 nmi 98 pd0/d0 92 pd1/d1 91 pd2/d2 90 pd3/d3 89 pd4/d4 88 pd5/d5 86 pd6/d6 84 pd7/d7 83 pc0/a0 7 pc1/a1 8 pc2/a2 9 pc3/a3 10 pc4/a4 11 pc5/a5 13 pc6/a6 15 pc7/a7 pc8/a8 16 pb3/ irq1 / poe1 / casl 17 pc10/a10 32 pc11/a11 19 pc12/a12 20 21 pc13/a13 pc14/a14 22 pc15/a15 23 24 pb0/a16 pb4/ irq2 / poe2 / cash 25 v cc md0 12, 26, 40, 63, 77, 85, 99, 112, 135 pllv cc , av cc , av ref 104, 128, 127 pllcap, pllv ss , extal 105, 106, 96 v ss av ss 6, 14, 28, 35, 42, 55, 61, 71, 79, 87, 93, 117, 129, 141 md1 103 102 md2 97 md3 95 124 pf0/an0?f7/an7 118?23, 125, 126 34 pe15/tioc4d/dack1/ irqout pe14/tioc4d/dack0/ ah 5 pb5/ irq3 / poe3 /rdwr 2 36 pin number pin name 1 v pp 26 a9 13 i/o0 14 i/o1 15 i/o2 17 i/o3 18 i/o4 19 i/o5 20 i/o6 21 i/o7 12 a0 11 a1 10 a2 9 a3 8 a4 7 a5 6 a6 5 27 a7 24 a8 23 oe 25 a10 4 a11 a12 28 29 a13 3 a14 a15 2 31 a16 pgm 22 32 ce 16 v cc v ss eprom socket adapter v pp : a16?0: i/o7?/o0: oe : pgm : ce : prom program power supply (12.5 v) address input data input/ output output enable program enable chip enable 100 w 0.1 m f 0.1 m f figure 21.4 sh7043 pin and hn27c101 pin correspondence (144-pin version)
672 on-chip rom space (area 0) h'0000 h'1ffff (128-kbyte version) h'00000000 h'0001ffff (128-kbyte version) address for mcu modes 0, 1, 2, 3 address for prom mode figure 21.5 on-chip rom memory map 21.3 prom programming the prom mode write/verify specifications are the same as those of the standard eprom hn27c101. however, because the page program format is not supported, do not set the prom writer to the page programming mode. prom writers that only support page programming mode cannot be used. when selecting a prom writer, confirm that it supports the byte-by-byte high- speed, high-reliability programming format. 21.3.1 programming mode selection there are two on-chip prom programming modes: write and verify (reads and confirms written data). the mode is selected by using the pins (table 21.2). table 21.2 prom programming mode selection pin mode ce oe pgm v pp v cc i/o7?/o0 a16?0 write 010v pp v cc data input address verify 0 0 1 data output input programming 0 0 0 high prohibited 011 impedance 100 111 note: 0: low level, 1: high level, v pp : v pp level, v cc : v cc level.
673 21.3.2 write/verify and electrical characteristics write/verify: writing and verification can be done using an efficient high speed, high reliability programming format. this format allows data writing that is both fast and reliable without applying voltage stress to the device. figure 21.6 shows the basic flow of the high speed, high reliability programming format.
674 start set eprom writer to write/verify mode (v cc = 6.0 v 0.25 v, v pp = 12.5 v 0.3 v) address = 0 n = 0 n + 1 ? n data write (t pw = 0.2 ms 5%) data write (t opw = 0.2n ms) is verify result ok? no yes final address? no yes set eprom writer to read mode (v cc = 5.0 v 0.25 v, v pp = v cc ) all address read results ok? no yes end no good no v cc : power supply v pp : prom program power supply t pw : initial programming pulse width t opw : over-programming pulse width n = 25? yes address + 1 ? address < preliminary > figure 21.6 high-speed, high-reliability programming basic flow
675 electrical characteristics: tables 21.3 and 21.4 show the electrical characteristics for programming. figure 21.7 shows the timing. table 21.3 dc characteristics (v cc = 6.0 v 0.25 v, v pp = 12.5 v 0.3 v, v ss = 0 v, ta = 25? 5?) item pin symbol min typ max unit measurement conditions input high-level voltage i/o7?/o0, a16?0, oe , ce , pgm v ih 2.4 v cc + 0.3 v input low-level voltage i/o7?/o0, a16?0, oe , ce , pgm v il ?.3 0.8 v output high-level voltage i/o7?/o0 v oh 2.4 v i oh = ?00 ? output low-level voltage i/o7?/o0 v ol 0.45 v i ol = 1.6 ma input leak current i/o7?/o0, a16?0, oe , ce , pgm | i li | 2 av in = 5.25 v/0.5 v v cc current i cc 80 ma v pp current i pp 80 ma
676 table 21.4 ac characteristics (v cc = 6.0 v 0.25 v, v pp = 12.5 v 0.3 v, v ss = 0 v, ta = 25? 5?) item symbol min typ max unit measurement conditions address setup time t as 2 ? figure 21.6 *1 oe setup time t oes 2s data setup time t ds 2s address hold time t ah 0s data hold time t dh 2s data output disable time t df *2 130 ns vpp setup time t vps 2s pgm pulse width during initial programming t pw 0.19 0.20 0.21 ms pgm pulse width during over-programming t opw *3 0.19 5.25 ms vcc setup time t vcs 2s ce setup time t ces 2s data output delay time t oe 0 150 ns notes 1. input pulse level: 0.45 v to 2.4 v; input rise, fall times 20 ns; input timing reference levels: 0.8 v, 2.0 v; output timing reference levels: 0.8 v, 2.0 v. 2: t df is defined as when the output becomes open state and referencing the output level is no longer possible. 3: t opw is defined by the values noted in the flowchart (figure 21.6).
677 address data v pp v cc ce pgm oe write verify t ah read data t df t dh t ds t as t vps write data t vcs t ces t pw (t opw )* t oes t oe v pp v cc v cc + 1 v cc note: t opw is defined by the values noted in the flowchart (figure 19.6) figure 21.7 write/verify timing 21.3.3 cautions on writing 1. writes must always be done with the established voltage and timing. the write voltage (programming voltage) v pp is 12.5 v (when the eprom writer is set for the hn27c101 hitachi specifications, v pp becomes 12.5 v). devices will sometimes be destroyed if a voltage higher than the rated one is applied. pay particular attention to such phenomena as eprom writer overshoot. 2. always confirm that the indices of the eprom writer socket, socket adapter, and device are in agreement before programming. devices will sometimes be destroyed due to excessive current flow if these are not connected in the proper locations. 3. do not touch the socket adapter or device during writing. contact faults can sometimes cause devices to be improperly written. 4. page programming mode writes are not possible. always set to byte programming mode.
678 5. terminate the writing if a write malfunction occurs in consecutive addresses. in such cases, check for problems in the eprom writer and/or socket adapter. there are some cases where write/verify will not be possible if using an eprom writer with a high impedance power supply system. 6. use a eprom writer that conforms to the socket adapter supported by this lsi. 21.3.4 post-write reliability high temperature biasing (or burn-in) of devices is recommended after writing in order to improve the data retention characteristics. high temperature biasing is a method of screening that eliminates parts with faulty initial data retention by on-chip prom memory cells within a short period of time. figure 21.8 shows the flow from the on-chip prom programming including screening to the installation of the device on a board. program write/verify installation on board figure 21.5 (flowchart) unpowered high- temperature bias (125?50 c, 24e48 hours) data read out and verify (v cc = 5.0 v) figure 21.8 screening flow if there are any abnormalities in program write/verify or program read-out verification after high temperature biasing, please contact a hitachi technical representative.
679 section 22 256kb flash memory (f-ztat) 22.1 features this lsi has 256 kbytes of on-chip flash memory. the features of the flash memory are summarized below. ? four flash memory operating modes ? program mode ? erase mode ? program-verify mode ? erase-verify mode ? programming/erase methods the flash memory is programmed 32 bytes at a time. block erase (in single-block units) can be performed. block erasing can be performed as required on 1 kbyte, 28 kbyte, and 32 kbyte blocks. ? programming/erase times the flash memory programming time is 10 ms (typ.) for simultaneous 32-byte programming, equivalent to 300 ? (typ.) per byte, and the erase time is 100 ms (typ.) per block. ? reprogramming capability the flash memory can be reprogrammed up to 100 times. ? on-board programming modes there are two modes in which flash memory can be programmed/erased/verified on-board: ? boot mode ? user program mode ? automatic bit rate adjustment with data transfer in boot mode, this lsi? bit rate can be automatically adjusted to match the transfer bit rate of the host. ? flash memory emulation in ram flash memory programming can be emulated in real time by overlapping a part of ram onto flash memory. ? protect modes there are two protect modes, hardware and software, which allow protected status to be designated for flash memory program/erase/verify operations ? programmer mode flash memory can be programmed/erased in programmer mode, using a prom programmer, as well as in on-board programming mode.
680 22.2 overview 22.2.1 block diagram flmcr2 ebr1 ebr2 ramer flmcr1 internal address bus internal data bus (32-bit) module bus bus interface/controller operation mode fwp pin mode pins flash memory (256kb) legend flmcr1: flash memory control register 1 flmcr2: flash memory control register 2 ebr1 : block specification register 1 ebr2 : block specification register 2 ramer : ram emulation register figure 22.1 flash memory block diagram
681 22.2.2 mode transition diagram when the mode pins and the fwp pin are set in the reset state and a reset start is executed, the microcomputer enters one of the operating modes shown in figure 22.2. in user mode, flash memory can be read but not programmed or erased. flash memory can be programmed and erased in boot mode, user program mode, and programmer mode. md1=0, fwp=0 res=0 res=0 fwp=0 fwp=1 * 1 * 1 * 2 md1=1, fwp=0 res=0 md1=1, fwp=1 res=0 notes : execute transition between the user mode and user program mode while the cpu is not accessing the flash memory. 1. ram emulation permitted 2. md0=1, md1=0, md2=1, md3=1 reset state user mode user program mode boot mode programmer mode on-board programming mode figure 22.2 flash memory mode transitions
682 22.2.3 onboard program mode boot mode new application program new application program new application program program program program program lsi lsi boot program boot program lsi lsi boot program flash memory application version (old version) boot program flash memory flash memory application version (old version) ram flash memory ram ram ram sci1 sci1 sci1 sci1 host host host host boot program area boot program area boot program area 3. initializing the flash memory to initialize (to h'ff) the flash memory, execute the erase program located in the boot program area (within ram). during the boot mode, the entire flash memory is erased, regardless of blocks. 4. writing the new application program execute the program transferred to ram from the host and write the new application program located at the transfer destination to the flash memory. erasing the flash memory new application program program execution state 1. initial state the old program version or data remains written in the flash memory. the user should prepare the programming control program and new application program beforehand in the host. 2. programming control program transfer when boot mode is entered, the boot program in the lsi (originally incorporated in the chip) is started and the programming control program in the host is transferred to ram via sci communication. the boot program required for flash memory erasing is automatically transferred to the ram boot program area. figure 22.3 boot mode
683 user program mode 3. initializing the flash memory execute the programming/erase program in ram to initialize (to h'ff) the flash memory. erase is executed in block units, but cannot be executed in byte units. host host host host programming/erase control program new application program new application program new application program lsi lsi lsi boot program flash memory fwp verify program transfer program application program (old version) ram boot program flash memory fwp verify program transfer program ram sci boot program flash memory fwp verify program transfer program application program (old version) ram lsi boot program fwp verify program transfer program ram sci sci sci programming control program programming control program programming control program program execution state new application program flash memory erase 4. writing new application program next, the new application program in the host is written into the erased flash memory blocks. do not write to unerased blocks. 1. initial state the fwp assessment program that confirms that user program mode has been entered, and the program that will transfer the programming/erase control program from flash memory to on-chip ram should be written into the flash memory by the user beforehand. the programming/erase control program should be prepared in the host or in the flash memory. 2. programming/erase control program transfer when user program mode is entered, user software confirms this fact, executes transfer program in the flash memory, and transfers the programming/erase control program to ram. figure 22.4 user program mode
684 22.2.4 flash memory emulation in ram emulation should be performed in user mode or user program mode. when the emulation block set in ramer is accessed while the emulation function is being executed, data written in the overlap ram is read. ? user mode ? user program mode ram flash memory application program emulation block overlap ram (emulation is executed using data written to ram) sci figure 22.5 emulation when overlap ram data is confirmed, the rams bit is cleared, ram overlap is released, and writes should actually be performed to the flash memory. when the programming control program is transferred to ram, ensure that the transfer destination and the overlap ram do not overlap, as this will cause data in the overlap ram to be rewritten.
685 ? user program mode sci ram flash memory application program programming data programming control program execution state overlap ram (programming data) figure 22.6 programming to the flash memory 22.2.5 differences between boot mode and user program mode table 22.1 differences between boot mode and user program mode boot mode user program mode total erase yes yes block erase no yes programming control program* (2) (1) (2) (3) (1) erase/erase-verify (2) program/program-verify (3) emulation note: to be prepared by the user according to the recommended algorithm.
686 22.2.6 block configuration the flash memory is divided into seven 32 kbyte blocks, one 28 kbyte blocks, and four 1 kbyte blocks. address h'00000 address h'3ffff 32kbyte 32kbyte 256kbyte 32kbyte 28kbyte 1kbyte 1kbyte 1kbyte 1kbyte 32kbyte 32kbyte 32kbyte 32kbyte figure 22.7 block configuration
687 22.3 pin configuration the flash memory is controlled by the pins shown in table 22.2. table 22.2 pin configuration pin name abbreviation i/o function power-on reset res input power-on reset flash write protect fwp input flash program/erase protection by hardware mode 3 md3 input set operation mode of lsi mode 2 md2 input set operation mode of lsi mode 1 md1 input set operation mode of lsi mode 0 md0 input set operation mode of lsi transmit data txd1 output serial send data output receive data rxd1 input serial receive data input 22.4 register configuration registers that control the flash memory when the on-chip flash memory is valid are shown in table 22.3. table 22.3 register configuration name abbre- viation r/w initial value address access size flash memory control register 1 flmcr1 r/w* 1 h?0* 2 h?fff8580 8 flash memory control register 2 flmcr2 r/w* 1 h?0* 3 h?fff8581 8 erase block register 1 ebr1 r/w* 1 h?0* 3 h?fff8582 8 erase block register 2 ebr2 r/w* 1 h?0* 3 h?fff8583 8 ram emulation register ramer r/w h?000 h?fff8628 8, 16, 32 notes: 1. in modes in which the on-chip flash memory is disabled, a read will return h'00, and writes are invalid. writes are also disabled when the fwe bit is set to 1 in flmcr1. 2. when a low level is input to the fwp pin, the initial value is h'80. 3. when a high level is input to the fwp pin, or if a low level is input and the swe bit in flmcr1 is not set, these registers are initialized to h'00. 4. flmcr1, flmcr2, ebr1, and ebr2 are 8-bit registers, and ramer is a 16-bit register. 5. only byte accesses are valid for flmcr1, flmcr2, ebr1, and ebr2, the access requiring 3 cycles. three cycles are required for a byte or word access to ramer, and 6 cycles for a longword access. 6. when a longword write is performed on ramer, 0 must always be written to the lower word (address h'ffff8630). operation is not guaranteed if any other value is written.
688 22.5 description of registers 22.5.1 flash memory control register 1 (flmcr1) flmcr1 is an 8-bit register used for flash memory operating mode control. program-verify mode or erase-verify mode for addresses h'00000?'1ffff is entered by setting swe to 1 when fwe = 1, then setting the ev1 or pv1 bit. program mode for addresses h'00000?'1ffff is entered by setting swe to 1 when fwe = 1, then setting the psu1 bit, and finally setting the p1 bit. erase mode for addresses h'00000?'1ffff is entered by setting swe to 1 when fwe = 1, then setting the esu1 bit, and finally setting the e1 bit. flmcr1 is initialized in the standby mode or with power-on reset. its initial value is h'80 when a low level is input to the fwp pin, and h'00 when a high level is input. when on-chip flash memory is disabled, a read will return h'80, and writes are invalid. writes to bits swe, esu1, psu1, ev1, and pv1 are enabled only when fwe = 1 and swe = 1; writes to the e1 bit only when fwe = 1, swe = 1, and esu1 = 1; and writes to the p1 bit only when fwe = 1, swe = 1, and psu1 = 1. bit: 7 6 5 4 3 2 1 0 fwe swe esu1 psu1 ev1 pv1 e1 p1 initial value: 0 0 0 0 0 0 0 0 r/w: r r/w r/w r/w r/w r/w r/w r/w ? bit 7?lash write enable bit (fwe): displays the state of the fwp pin which sets hardware protection against flash memory programming/erasing. bit 7: fwe description 0 when high level is input to the fwp pin (hardware-protect state) 1 when low level is input to the fwp pin ? bit 6?oftware write enable bit (swe): enables or disables the flash memory. this bit should be set when setting bits 5?, flmcr2 bits 5?, ebr1 bits 3?, and ebr2 bits 7?. bit 6: swe description 0 writes disabled (initial value) 1 writes enabled [setting condition] when fwe=1 ? bit 5?rase setup bit 1 (esu1): prepares for a transition to erase mode (applicable addresses: h'00000?'1ffff). do not set the swe, psu1, ev1, pv1, e1, or p1 bit at the same time.
689 bit 5: esu1 description 0 erase setup release (initial value) 1 erase setup [setting condition] when fwe=1 and swe=1 ? bit 4?rogram setup bit 1 (psu1): prepares for a transition to program mode (applicable addresses: h'00000?'1fffff). do not set the swe, esu1, ev1, pv1, e1, or p1 bit at the same time. bit 4: psu1 description 0 program setup release (initial value) 1 program setup [setting condition] when fwe=1 and swe=1 ? bit 3?rase-verify 1 (ev1): selects erase-verify mode transition or release (applicable addresses: h'00000?'1ffff). do not set the swe, esu1, psu1, pv1, e1, or p1 bit at the same time. bit 3: ev1 description 0 erase verify mode release (initial value) 1 transition to erase verify mode [setting condition] when fwe=1 and swe=1 ? bit 2?rogram-verify 1 (pv1): selects program-verify mode transition or release (applicable addresses: h'00000?'1ffff). do not set the swe, esu1, psu1, ev1, e1, or p1 bit at the same time. bit 2: pv1 description 0 program verify mode release (initial value) 1 transition to program verify mode [setting condition] when fwe=1 and swe=1
690 ? bit 1?rase 1 (e1): selects erase mode transition or release (applicable addresses: h'00000 h'1ffff). do not set the swe, esu1, psu1, ev1, pv1, or p1 bit at the same time. bit 1: e1 description 0 erase mode release (initial value) 1 transition to erase mode [setting condition] when fwe=1, swe=1 and esu1=1 ? bit 0?rogram 1 (p1): selects program mode transition or release (applicable addresses: h'00000?'1ffff). do not set the swe, psu1, esu1, ev1, pv1, or e1 bit at the same time. bit 0: p1 description 0 program setup mode release (initial value) 1 program setup [setting condition] when fwe=1, swe=1 and psu1=1 22.5.2 flash memory control register 2 (flmcr2) flmcr2 is an 8-bit register used for flash memory operating mode control. program-verify mode or erase-verify mode for addresses h'20000?'3ffff is entered by setting swe (flmcr1) to 1 when fwe (flmcr1) = 1, then setting the ev2 or pv2 bit. program mode for addresses h'20000?'3ffff is entered by setting swe (flmcr1) to 1 when fwe (flmcr1) = 1, then setting the psu2 bit, and finally setting the p2 bit. erase mode for addresses h'20000?'3ffff is entered by setting swe (flmcr1) to 1 when fwe (flmcr1) = 1, then setting the esu2 bit, and finally setting the e2 bit. flmcr2 is initialized to h'00 by a power-on reset, in standby mode, when a high level is input to the fwp pin, and when a low level is input to the fwp pin and the swe bit in flmcr1 is not set (the exception is the fler bit, which is initialized only by a power-on reset). when on-chip flash memory is disabled, a read will return h'00, and writes are invalid. writes to bits esu2, psu2, ev2, and pv2 in flmcr2 are enabled only when fwe (flmcr1) = 1 and swe (flmcr1) = 1; writes to the e2 bit only when fwe (flmcr1) = 1, swe (flmcr1) = 1, and esu2 = 1; and writes to the p2 bit only when fwe (flmcr1) = 1, swe (flmcr1) = 1, and psu2 = 1.
691 bit: 7 6 5 4 3 2 1 0 fler esu2 psu2 ev2 pv2 e2 p2 initial value: 0 0 0 0 0 0 0 0 r/w: r r r/w r/w r/w r/w r/w r/w ? bit 7?lash memory error (fler): indicates that an error has occurred during an operation on flash memory (programming or erasing). when fler is set to 1, flash memory goes to the error-protection state. bit 7: fler description 0 flash memory is operating normally. (initial value) flash memory program/erase protect (error protect) disabled 1 indicates error during flash memory program/erase. flash memory program/erase protect (error protect) enabled [setting condition] see section 22.8.3 error protection ? bit 6?eserved bit: this bit is always read as 0. ? bit 5?rase setup bit 2 (esu2): prepares for a transition to erase mode (applicable addresses: h'20000?'3ffff). do not set the psu2, ev2, pv2, e2, or p2 bit at the same time. bit 5: esu2 description 0 erase setup release (initial value) 1 erase setup [setting condition] when fwe=1 and swe=1 ? bit 4?rogram setup bit 2 (psu2): prepares for a transition to program mode (applicable addresses: h'20000?'3ffff). do not set the esu2, ev2, pv2, e2, or p2 bit at the same time. bit 4: psu2 description 0 program setup release (initial value) 1 program setup [setting condition] when fwe=1 and swe=1
692 ? bit 3?rase-verify 2 (ev2): selects erase-verify mode transition or release (applicable addresses: h'20000?'3ffff). do not set the esu2, psu2, pv2, e2, or p2 bit at the same time. bit 3: ev2 description 0 erase verify mode release (initial value) 1 transition to the erase verify mode [setting condition] when fwe=1 and swe=1 ? bit 2?rogram-verify 2 (pv2): selects program-verify mode transition or release (applicable addresses: h'20000?'3ffff). do not set the esu2, psu2, ev2, e2, or p2 bit at the same time. bit 2: pv2 description 0 program verify mode release (initial value) 1 transition to the program verify mode [setting condition] when fwe=1 and swe=1 ? bit 1?rase 2 (e2): selects erase mode transition or release (applicable addresses: h'20000 h'3ffff). do not set the esu2, psu2, ev2, pv2, or p2 bit at the same time. bit 1: e2 description 0 erase mode release (initial value) 1 transition to the erase mode [setting condition] when fwe=1, swe=1 and esu2=1 ? bit 0?rogram 2 (p2): selects program mode transition or release (applicable addresses: h'20000?'3ffff). do not set the esu2, psu2, ev2, pv2, or e2 bit at the same time. bit 0: p2 description 0 program mode release(initial value) 1 transition to the program mode [setting condition] when fwe=1, swe=1 and psu2=1
693 22.5.3 erase block register 1 (ebr1) ebr1 is an 8-bit register that specifies the flash memory erase area block by block. ebr1 is initialized to h'00 by a power-on reset and standby mode, when a high level is input to the fwp pin, and when a low level is input to the fwp pin and the swe bit in flmcr1 is not set. when a bit in ebr1 is set to 1, the corresponding block can be erased. other blocks are erase-protected. only one of the bits of ebr1 and ebr2 combined can be set. do not set more than one bit. if more than one bit is set, writes to bits esu1, esu2, e1, and e2 will be invalid. when on-chip flash memory is disabled, a read will return h'00, and writes are invalid. the flash memory block configuration is shown in table 22.4. bit: 7 6 5 4 3 2 1 0 eb3 eb2 eb1 eb0 initial value: 1/0 0 0 0 0 0 0 0 r/w: r r r r r/w r/w r/w r/w 22.5.4 erase block register 2 (ebr2) ebr2 is an 8-bit register that specifies the flash memory erase area block by block. ebr2 is initialized to h'00 by a power-on reset and standby mode, when a high level is input to the fwp pin, and when a low level is input to the fwp pin and the swe bit in flmcr1 is not set. when a bit in ebr2 is set to 1, the corresponding block can be erased. other blocks are erase-protected. when on-chip flash memory is disabled, a read will return h'00, and writes are invalid. the flash memory block configuration is shown in table 22.4. bit: 7 6 5 4 3 2 1 0 eb11 eb10 eb9 eb8 eb7 eb6 eb5 eb4 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
694 table 22.4 flash memory erase blocks block (size) addresses eb0 (32kb) h?00000??07fff eb1 (32kb) h?08000??0ffff eb2 (32kb) h?10000??17fff eb3 (32kb) h?18000??1ffff eb4 (32kb) h?20000??27fff eb5 (32kb) h?28000??2ffff eb6 (32kb) h?30000??37fff eb7 (28kb) h?38000??3efff eb8 (1kb) h?3f000??3f3ff eb9 (1kb) h?3f400??3f7ff eb10 (1kb) h?3f800??3fbff eb11 (1kb) h?3fc00??3ffff 22.5.5 ram emulation register (ramer) ramer specifies the area of flash memory to be overlapped with part of ram when emulating real-time flash memory programming. ramer is initialized to h'0000 by a power-on reset. it is not initialized in software standby mode. ramer settings should be made in user mode or user program mode. (for details, see the description of the bsc.) flash memory area divisions are shown in table 22.5. to ensure correct operation of the emulation function, the rom for which ram emulation is performed should not be accessed immediately after this register has been modified. normal execution of an access immediately after register modification is not guaranteed. bit: 15 14 13 12 11 10 9 8 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 1 0 rams ram1 ram0 initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r/w r/w r/w ? bits 15??eserved bits: these bits are always read as 0.
695 ? bit 2?am select (rams): specifies selection or non-selection of flash memory emulation in ram. when rams = 1, all flash memory block are program/erase-protected. this bit is ignored when the on-chip rom is disabled. bit 2: rams description 0 emulation not selected program/erase protect of all flash memory blocks is disabled (initial value) 1 emulation selected program/erase protect of all flash memory blocks is enabled ? bits 1 and 0?lash memory area selection (ram1, ram0): these bits are used together with bit 2 to select the flash memory area to be overlapped with ram. (see table 22.5). table 22.5 separation of the flash memory area addresses block name rams ram1 ram0 h?ff800??ffbff ram area 1kb 0 * * h?3f000??3f3ff eb8 (1kb) 1 0 0 h?3f400??3f7ff eb9 (1kb) 1 0 1 h?3f800??3fbff eb10(1kb) 1 1 0 h?3fc00??3ffff eb11(1kb) 1 1 1
696 22.6 on-board programming mode when pins are set to on-board programming mode and a power-on reset is executed, a transition is made to the on-board programming state in which program/erase/verify operations can be performed on the on-chip flash memory. there are two on-board programming modes: boot mode and user program mode. the pin settings for transition to each of these modes are shown in table 22.6. for a diagram of the transitions to the various flash memory modes, see figure 22.2. table 22.6 setting on-board programming modes mode pll multiple fwp md3 md2 md1 md0 boot mode expanded mode 1 00000 single-chip mode 0 0 0 1 expanded mode 2 0100 single-chip mode 0 1 0 1 expanded mode 4 1000 single-chip mode 1 0 0 1 user program mode expanded mode 1 00010 single-chip mode 0 0 1 1 expanded mode 2 0110 single-chip mode 0 1 1 1 expanded mode 4 1010 single-chip mode 1 0 1 1
697 22.6.1 boot mode when boot mode is used, the flash memory programming control program must be prepared in the host beforehand. the sci to be used is set to channel asynchronous mode. when a reset start is executed after the lsi pins have been set to boot mode in the power-on reset state, the boot program built into the lsi is started and the programming control program prepared in the host is serially transmitted to the lsi via sci channel 1. in the lsi, the programming control program received via sci channel 1 is written into the programming control program area in on-chip ram. after the transfer is completed, control branches to the start address of the programming control program area and the programming control program execution state is entered (flash memory programming is performed). the transferred programming control program must therefore include coding that follows the programming algorithm given later. the system configuration in boot mode is shown in figure 22.8, and the boot mode execution procedure in figure 22.9. rxd1 txd1 sci1 host write data reception verify data transmission lsi flash memory on-chip ram figure 22.8 system configuration in boot mode
698 n=1 n=n? n+1 ? n ye s no note: if a memory cell does not operate normally and cannot be erased, one h'ff byte is transmitted as an erase error, and the erase operation and subsequent operations are halted. start set pin to the boot program mode then reset start the host continuously sends data (h'00) using a fixed bit rate this lsi measures the low period of data h'00 sent by the host this lsi calculates the bit rate and sets value to the bit rate register after adjustment of the bit rate, this lsi sends 1 byte of data h'00 to the host as a sign of completion of adjustment the host checks whether the sign (h'00) indicating completion of bit rate adjustment is received, then transmits 1 byte of data h'55 after receiving h'55, this lsi sends 1 byte of h'aa the host sends the byte number (n) of the user program in sequence of upper byte then lower byte this lsi sends the received byte number to the host as verify data (echo back) the host transmits the user program in sequence using byte units this lsi sends the received program to the host as verify data (echo back) the received user program is transferred to the on-chip ram transmission complete data of the flash memory is checked. all data are erased if data already exists after confirming that all data of the flash memory have been erased, this lsi sends 1 byte of h'aa to the host the write control program transferred to the on-chip ram is executed figure 22.9 boot mode execution procedure
699 automatic sci bit rate adjustment start bit stop bit d0 d1 d2 d3 d4 d5 d6 d7 high period of more than 1 bit low period (9 bits) measured (h'00 data) figure 22.10 automatic sci bit rate adjustment when boot mode is initiated, the lsi measures the low period of the asynchronous sci communication data (h'00) transmitted continuously from the host. the sci transmit/receive format should be set as follows: 8-bit data, 1 stop bit, no parity. the lsi calculates the bit rate of the transmission from the host from the measured low period, and transmits one h'00 byte to the host to indicate the end of bit rate adjustment. the host should confirm that this adjustment end indication (h'00) has been received normally, and transmit one h'55 byte to the lsi. if reception cannot be performed normally, initiate boot mode again (reset), and repeat the above operations. depending on the host? transmission bit rate and the lsi? system clock frequency, there will be a discrepancy between the bit rates of the host and the lsi. to ensure correct sci operation, the host's transfer bit rate should be set to 9,600 or 4,800 bps. table 22.7 shows host transfer bit rates and system clock frequencies for which automatic adjustment of the lsi bit rate is possible. the boot program should be executed within this system clock range. table 22.7 system clock frequencies for which automatic adjustment of lsi bit rate is possible host bit rate system clock frequency for which automatic adjustment of lsi bit rate is possible 9,600 bps 8 to 28.7 mhz 4,800 bps 4 to 20 mhz
700 on-chip ram area divisions in boot mode: in boot mode, the ram area is divided into an area used by the boot program and an area to which the programming control program is transferred via the sci, as shown in figure 22.11. the boot program area cannot be used until the execution state in boot mode switches to the programming control program transferred from the host. boot program area (2k bytes) programming control program area (2k bytes) h'fffff000 h'fffff800 h'ffffffff figure 22.11 ram areas in boot mode note: the boot program area cannot be used until a transition is made to the execution state for the programming control program transferred to ram. note also that the boot program remains in this area of the on-chip ram even after control branches to the programming control program.
701 22.6.2 user program mode after setting fwp, the user should branch to, and execute, the previously prepared programming/erase control program. as the flash memory itself cannot be read while flash memory programming/erasing is being executed, the control program that performs programming and erasing should be run in on-chip ram or external memory. use the following procedure (figure 22.12) to execute the programming control program that writes to flash memory (when transferred to ram). execute user application program execute programming/ erase control program in ram (flash memory rewriting) transfer programming/erase control program to ram fwp = 1 (user program mode) write fwp assessment program and transfer program 1 2 3 4 5 figure 22.12 user program mode execution procedure notes: 1. when programming and erasing, start the watchdog timer so that measures can be taken to prevent program runaway, etc. memory cells may not operate normally if overprogrammed or overerased due to program runaway. 2. if an address at which a flash memory register resides is read in the mask rom or ztat version, the value will be undefined. when a flash memory version program is used in the mask rom or ztat version, the state of the fwp pin cannot be determined. a modification must therefore be made to prevent operation of the flash memory rewrite program.
702 22.7 programming/erasing flash memory a software method, using the cpu, is employed to program and erase flash memory in the on- board programming modes. there are four flash memory operating modes: program mode, erase mode, program-verify mode, and erase-verify mode. transitions to these modes are made by setting the psu1, esu1, p1, e1, pv1, and ev1 bits in flmcr1 for addresses h'00000?'1ffff, or the psu2, esu2, p2, e2, pv2, and ev2 bits in flmcr2 for addresses h'20000?'3ffff. the flash memory cannot be read while being programmed or erased. therefore, the program (programming control program) that controls flash memory programming/erasing should be located and executed in on-chip ram or external memory. notes: 1. operation is not guaranteed if setting/resetting of the swe, esu1, psu1, ev1, pv1, e1, and p1 bits in flmcr1, or the esu2, psu2, ev2, pv2, e2, and p2 bits in flmcr2, is executed by a program in flash memory. 2. when programming or erasing, set fwp to low level (programming/erasing will not be executed if fwp is set to high level). 3. programming should be performed in the erased state. do not perform additional programming on previously programmed addresses. 4. do not program addresses h'00000?'1ffff and h'20000?'3ffff simultaneously. operation is not guaranteed if this is done. 22.7.1 program mode (n = 1 for addresses h'0000?'1ffff, n = 2 for addresses h'20000?'3ffff) when writing data or programs to flash memory, the program/program-verify flowchart shown in figure 22.13 should be followed. performing program operations according to this flowchart will enable data or programs to be written to flash memory without subjecting the device to voltage stress or sacrificing program data reliability. programming should be carried out 32 bytes at a time. following the elapse of 10 ? or more after the swe bit is set to 1 in flash memory control register 1 (flmcr1), 32-byte program data is stored in the program data area and reprogram data area, and the 32-byte data in the program data area in ram is written consecutively to the program address (the lower 8 bits of the first address written to must be h'00, h'20, h'40, h'60, h'80, h'a0, h'c0, or h'e0). thirty-two consecutive byte data transfers are performed. the program address and program data are latched in the flash memory. a 32-byte data transfer must be performed even if writing fewer than 32 bytes; in this case, h'ff data must be written to the extra addresses. next, the watchdog timer is set to prevent overprogramming in the event of program runaway, etc. set a minimum value of 300 ? or more as the wdt overflow period. after this, preparation for program mode (program setup) is carried out by setting the psun bit in flmcrn, and after the elapse of 50 ? or more, the operating mode is switched to program mode by setting the pn bit in
703 flmcrn. the time during which the pn bit is set is the flash memory programming time. set 200 ? as the time for one programming operation. 22.7.2 program-verify mode (n = 1 for addresses h'0000?'1ffff, n = 2 for addresses h'20000?'3ffff) in program-verify mode, the data written in program mode is read to check whether it has been correctly written in the flash memory. after the elapse of a given programming time, the programming mode is exited (the pn bit in flmcrn is released, then the psun bit is released at least 10 ? later). the watchdog timer is released after the elapse of 10 ? or more, and the operating mode is switched to program-verify mode by setting the pvn bit in flmcrn. before reading in program-verify mode, a dummy write of h'ff data should be made to the addresses to be read. the dummy write should be executed after the elapse of 4 ? or more. when the flash memory is read in this state (verify data is read in 32-bit units), the data at the latched address is read. wait at least 2 ? after the dummy write before performing this read operation. next, the written data is compared with the verify data, and reprogram data is computed (see figure 22.13) and transferred to the reprogram data area. after 32 bytes of data have been verified, exit program-verify mode, wait for at least 4 ?, then release the swe bit in flmcr1. if reprogramming is necessary, set program mode again, and repeat the program/program-verify sequence as before. however, ensure that the program/program-verify sequence is not repeated more than 1,000 times on the same bits.
704 set swe bit in flmcr1 n = 1 m = 0 write 32-byte data in reprogram data area in ram to flash memory consecutively start of programming ng ng ng ng ok ok ok * 2 * 5 store 32-byte program data in reprogram data area * 4 * 1 * 5 read verify data clear swe bit in flmcr1 m = 1 end of programming program data = verify data? end of 32-byte data verification? flag = 0? verify increment address programming failure ok clear swe bit in flmcr1 n 3 1000 n ? n + 1 notes: 1. data transfer is performed by byte transfer. the lower 8 bits of the first address written to must be h'00, h'20, h'40, h'60, h'80, h'a0, h'c0, or h'e0. a 32-byte data transfer must be performed even if writing fewer than 32 bytes; in this case, h'ff data must be written to the extra addresses. 2. verify data is read in 32-bit (longword) units. 3. even bits for which programming has been completed in a 32-byte programming loop will be subjected to additional programming if they fail the subsequent verify operation. 4. a 32-byte area for storing program data and a 32-byte area for storing reprogram data are required in ram. the contents of the latter are rewritten according to the progress of the programming operation. start ram program data storage area (32 bytes) reprogram data storage area (32 bytes) * 3 * 3 * 4 end of programming perform programming in the erased state. do not perform additional programming on previously programmed addresses. write data (d) note: the memory erased state is 1. programming is performed on 0 data. verify data (v) rewrite data (x) comment programming completed programming incomplete; reprogram still in erased state; no action 0 0 1 1 0 1 0 1 1 0 1 1 enable wdt disable wdt reprogram data computation transfer reprogram data to reprogram data area wait 10 m sec clear pv1(2) bit in flmcr1(2) wait 4 m sec dummy write of h'ff to verify address wait 2 m sec set pv1(2) bit in flmcr1(2) wait 4 m sec clear psu1(2) bit in flmcr1(2) wait 10 m sec clear p1(2) bit in flmcr1(2) wait 10 m sec set p1(2) bit in flmcr1(2) wait 200 m sec set psu1(2) bit in flmcr1(2) wait 50 m sec figure 22.13 program/program verify flow
705 ? sample 32-byte programming program the wait time set values (number of loops) are for the case where f = 28.7 mhz. for other frequencies, the set value is given by the following expression: wait time (?) f (mhz) ?4 registers used r4 (input): program data storage address r5 (input): programming destination address r7 (output): ok (normal) or ng (error) r0-3, 8-13: work registers flmcr1 .equ h?0 flmcr2 .equ h?1 ok .equ h? ng .equ h? wait10u .equ 72 wait50u .equ 359 wait4u .equ 29 wait2u .equ 14 wait200u .equ 1435 wdt_tcsr .equ h?fff8610 wdt_573u .equ h?579 sweset .equ b?1000000 psu1set .equ b?0010000 p1set .equ b?0000001 p1clear .equ b?1111110 psu1clear .equ b?1101111 pvset .equ b?0000100 pvclear .equ b?1111011 sweclear .equ b?0111111 maxverify .equ 1000 ; flashprogram .equ $ mov #h?1,r2 ; r2 work register (1) mov.l #pdatabuff,r0 ; save program data to work area mov r4,r12 mov #8,r13 copy_loop .equ $
706 mov.l @r12+,r1 mov.l r1,@r0 add.l #4,r0 add.l #-1,r13 cmp/pl r13 bt copy_loop mov.l #h?fff8500,r0 ; initialize gbr ldc r0,gbr ; mov.l #wait10u,r3 mov.l #flmcr1,r0 ; initialize r0 to flcmr1 address or.b #sweset,@(r0,gbr) ; set swe wait_1 subc r2,r3 ; wait 10 ? bf wait_1 ; mov.l #h?0000,r9 cmp/gt r5,r9 bt program_start mov.l #flmcr2,r0 program_start .equ $ mov.l #0,r9 ; initialize n (r9) to 0 ; program_loop .equ $ mov.l #0,r10 ; initialize m (r10) to 0 mov.l #32,r3 ; write 32-byte data consecutively mov.l #pdatabuff,r12 mov.l r5,r13 write_loop .equ $ mov.b @r12+,r1 mov.b r1,@r13 add.l #1,r13 add.l #-1,r3 cmp/pl r3 bt write_loop ; mov.l #wdt_tcsr,r1 ; enable wdt mov.w #wdt_573u,r3 ; 573.4 ? cycle
707 mov.w r3,@r1 ; mov.l #wait50u,r3 or.b #psu1set,@(r0,gbr) ; set psu wait_2 subc r2,r3 ; wait 50 ? bf ; mov.l #wait200u,r3 or.b #p1set,@(r0,gbr) ; set p wait_3 subc r2,r3 ; wait 200 ? bf wait_3 ; mov.l #wait10u,r3 and.b #p1clear,@(r0,gbr) ; clear p wait_4 subc r2,r3 ; wait 10 ? bf wait_4 ; mov.l #wait10u,r3 and.b #psu1clear,@(r0,gbr) ; clear psu wait_5 subc r2,r3 ; wait 10 ? bf wait_5 ; mov.l #wdt_tcsr,r1 ; disable wdt mov.w #h?55f,r3 mov.w r3,@r1 ; mov.l #wait4u,r3 or.b #pvset,@(r0,gbr) ; set pv wait_6 subc r2,r3 ; wait 4 ? bf wait_6 ; mov.l pdatabuff,r3 mov.l r4,r1 mov.l r5,r12 mov.l #8,r13 mov.l #h?fffffff,r11 ;
708 verifyloop .equ $ mov.l r11,@r12 ; write h'ff to verify address mov.l r11,@r3 ; reprogram data ram (pdatabuff) initialization mov.l #wait2u,r7 wait_7 subc r2,r7 ; wait 2 ? bf wait_7 ; mov.l @r12+,r7 mov.l @r1+,r8 cmp/eq r7,r8 ; verify bt verify_ok mov.l #1,r10 ; verify ng, m <- 1 xor r8,r7 ; program data computation not r7,r7 or r7,r8 mov.l r8,@r3 ; store in reprogram data ram (pdatabuff) verify_ok .equ $ add.l #4,r3 add.l #-1,r13 cmp/pl r13 bt verifyloop ; mov.l #wait4u,r7 and.b #pvclear,@(r0,gbr) ; clear pv wait_8 subc r2,r7 ; wait 4 ? bf wait_8 ; cmp/pl r10 ; if m=0 then goto program_ok bf program_ok add #1,r9 mov.l #ng,r7 ; r7 <- ng (return value) mov.l #maxverify,r12 ; if n>=maxverify then program ng cmp/eq r9,r12 bt program_end bra program_loop nop program_ok .equ $
709 mov.l #ok,r7 ; r7 <- ok (return value) program_end .equ $ mov.b #h?0,r0 mov.b r0,@(flmcr1,gbr) ; clear swe ; rts nop ; .align 4 pdatabuff .res.b 32 22.7.3 erase mode (n = 1 for addresses h'0000?'1ffff, n = 2 for addresses h'20000 h'3ffff) when erasing flash memory, the erase/erase-verify flowchart shown in figure 22.14 should be followed. to perform data or program erasure, set the flash memory area to be erased in erase block register n (ebrn) at least 10 ? after setting the swe bit to 1 in flash memory control register 1 (flmcr1). next, the watchdog timer is set to prevent overerasing in the event of program runaway, etc. set 5.3 ? as the wdt overflow period. after this, preparation for erase mode (erase setup) is carried out by setting the esun bit in flmcrn, and after the elapse of 200 ? or more, the operating mode is switched to erase mode by setting the en bit in flmcrn. the time during which the en bit is set is the flash memory erase time. set an erase time of 5 ms. note: with flash memory erasing, preprogramming (setting all memory data in the memory to be erased to all ?? is not necessary before starting the erase procedure.
710 22.7.4 erase-verify mode (n = 1 for addresses h'00000?'1ffff, n = 2 for addresses h'20000?'3ffff) in erase-verify mode, data is read after memory has been erased to check whether it has been correctly erased. after the elapse of the erase time, erase mode is exited (the en bit in flmcrn is released, then the esun bit is released at least 10 ? later), the watchdog timer is released after the elapse of 10 ? or more, and the operating mode is switched to erase-verify mode by setting the evn bit in flmcrn. before reading in erase-verify mode, a dummy write of h'ff data should be made to the addresses to be read. the dummy write should be executed after the elapse of 20 ? or more. when the flash memory is read in this state (verify data is read in 32-bit units), the data at the latched address is read. wait at least 2 ? after the dummy write before performing this read operation. if the read data has been erased (all ??, a dummy write is performed to the next address, and erase-verify is performed. if the read data is unerased, set erase mode again and repeat the erase/erase-verify sequence in the same way. however, ensure that the erase/erase- verify sequence is not repeated more than 60 times. when verification is completed, exit erase- verify mode, and wait for at least 5 ?. if erasure has been completed on all the erase blocks after completing erase-verify operations on all these blocks, release the swe bit in flmcr1. if there are any unerased blocks, set erase mode again, and repeat the erase/erase-verify sequence as before. however, ensure that the erase/erase-verify sequence is not repeated more than 60 times.
711 end of erasing start set swe bit in flmcr1 set esu1(2) bit in flmcr1(2) set e1(2) bit in flmcr1(2) wait 10 m s wait 200 m s n = 1 set ebr1(2) enable wdt * 3 wait 5 ms wait 10 m s wait 10 m s wait 20 m s set block start address to verify address wait 2 m s wait 5 m s *2 *4 start erase clear e1(2) bit in flmcr1(2) clear esu1(2) bit in flmcr1(2) set ev1(2) bit in flmcr1(2) h'ff dummy write to verify address read verify data clear ev1(2) bit in flmcr1(2) wait 5 m s clear ev1(2) bit in flmcr1(2) clear swe bit in flmcr1 disable wdt halt erase * 1 verify data = all "1"? last address of block? end of erasing of all erase blocks? erase failure clear swe bit in flmcr1 n 3 60? ng ng ng ng ok ok ok ok n ? n + 1 increment address notes: 1. preprogramming (setting erase block data to all ?? is not necessary. 2. verify data is read in 32-bit (longword) units. 3. set only one bit in ebr1(2). more than one bit cannot be set. 4. erasing is performed in block units. to erase a number of blocks, each block must be erased in turn. figure 22.14 erase/erase-verify flowchart (single block erase)
712 ? sample one-block erase program the wait time set values (number of loops) are for the case where f = 28.7 mhz. for other frequencies, the set value is given by the following expression: wait time (?) f (mhz) ?4 the wdt overflow cycle set value is for the case where f = 28.7 mhz. for other frequencies, ensure that the overflow cycle is a minimum of 5.3 ms. registers used r5 (input): memory block table pointer r7 (output): ok (normal) or ng (error) r0-3, 6, 8-9: work registers flmcr1 .equ h?0 flmcr2 .equ h?1 ebr1 .equ h?2 ebr2 .equ h?3 wait10u .equ 72 wait2u .equ 14 wait200u .equ 1435 wait5m .equ 35875 wait20u .equ 144 wait5u .equ 36 wdt_tcsr .equ h?fff8610 wdt_9m .equ h?57d sweset .equ b?1000000 esuset .equ b?0100000 eset .equ b?0000010 eclear .equ b?1111101 esuclear .equ b?1011111 evset .equ b?0001000 evclear .equ b?1110111 sweclear .equ b?0111111 maxerase .equ 60 ; flasherase .equ $ mov.l #h?fff8500,r0 ldc r0,gbr ; initialize gbr mov.l #1,r2
713 ; mov.l #wait10u,r3 mov.l #flmcr1,r0 or.b #sweset,@(r0,gbr) ; set swe ewait_1 subc r2,r3 ; wait 10 ? bf ewait_1 ; mov.l #0,r9 ; initialize n (r9) to 0 ; mov.b @(6,r5),r0 mov.b r0,@(ebr1,gbr) ; erase memory block (ebr1) setting mov.b @(7,r5),r0 mov.b r0,@(ebr2,gbr) ; erase memory block (ebr2) setting ; mov.l #flmcr1,r0 mov.l @r5,r6 ; erase memory block start address -> r6 mov.l #h?20000,r7 cmp/gt r6,r7 bt eraseloop mov.l #flmcr2,r0 ; eraseloop .equ $ mov.l #wdt_tcsr,r1 ; enable wdt mov.w #wdt_9m,r3 ; 9.2 ms cycle mov.w r3,@r1 ; mov.l #wait200u,r3 or.b #esuset,@(r0,gbr) ; set esu ewait_2 subc r2,r3 ; wait 200 ? bf ewait_2 ; mov.l #wait5m,r3 or.b #eset,@(r0,gbr) ; set e ewait_3 subc r2,r3 ; wait 5 ms bf ewait_3 ; mov.l #wait10u,r3
714 and.b #eclear,@(r0,gbr) ; clear e ewait_4 subc r2,r3 ; wait 10 ? bf ewait_4 ; mov.l #wait10u,r3 and.b #esuclear,@(r0,gbr) ; clear esu ewait_5 subc r2,r3 ; wait 10 ? bf ewait_5 ; mov.l #wdt_tcsr,r1 ; disable wdt mov.w #h?55f,r3 mov.w r3,@r1 ; mov.l #wait20u,r3 or.b #evset,@(r0,gbr) ; set ev ewait_6 subc r2,r3 ; wait 20 ? bf ewait_6 ; mov.l @r5,r6 ; erase memory block start address -> r6 blockverify_1 .equ $ ; erase-verify mov.l #h?fffffff,r8 mov.l r8,@r6 ; h'ff dummy write mov.l #wait2u,r3 ewait_7 subc r2,r3 bf ewait_7 ; mov.l @r6+,r1 ; read verify data cmp/eq r8,r1 bf blockverify_ng mov.l @(8,r5),r7 cmp/eq r6,r7 ; check for last address of memory block bf blockverify_1 mov.l #wait5u,r3 and.b #evclear,@(r0,gbr) ; clear ev ewait_8 subc r2,r3 ; wait 5 ? bf ewait_8 ;
715 mov.l #ok,r7 ; r7 <- ok (return value) bra flasherase_end ; verify ok nop ; blockverify_ng .equ $ add.l #1,r9 ; verify ng, n <- n + 1 mov.l #wait5u,r3 and.b #evclear,@(r0,gbr) ; clear ev ewait_9 subc r2,r3 ; wait 5 ? bf ewait_9 mov.l #maxerase,r7 ; if n > maxerase then erase ng cmp/eq r7,r9 bf eraseloop mov.l #ng,r7 ; r7 <- ng (return value) flasherase_end .equ $ mov.l #flmcr1,r0 and.b #sweclear,@(r0,gbr) ; clear swe ; rts nop ; ; memory block table memory block start address: ebr value .align 4 flash_blockdata .equ $ eb0 .data.l h?0000000,h?0000100 eb1 .data.l h?0008000,h?0000200 eb2 .data.l h?0010000,h?0000400 eb3 .data.l h?0018000,h?0000800 eb4 .data.l h?0020000,h?0000001 eb5 .data.l h?0028000,h?0000002 eb6 .data.l h?0030000,h?0000004 eb7 .data.l h?0038000,h?0000008 eb8 .data.l h?003f000,h?0000010 eb9 .data.l h?003f400,h?0000020 eb10 .data.l h?003f800,h?0000040 eb11 .data.l h?003fc00,h?0000080 dummy .data.l h?0040000
716 22.8 protection there are two kinds of flash memory program/erase protection, hardware protection and software protection. 22.8.1 hardware protection hardware protection refers to a state in which programming/erasing of flash memory is forcibly disabled or aborted. hardware protection is reset by settings in flash memory control register 1 (flmcr1), flash memory control register 2 (flmcr2), erase block register 1 (ebr1), and erase block register 2 (ebr2). the flmcr1, flmcr2, ebr1, and ebr2 settings are retained in the error-protected state. (see table 22.8). table 22.8 hardware protection function item description program erase fwp pin protection ? when a high level is input to the fwp pin, flmcr1, flmcr2, ebr1, and ebr2 are initialized, and the program/erase-protected state is entered. yes yes reset/standby protection ? in a reset (including a wdt overflow reset) and in standby mode, flmcr1, flmcr2, ebr1, and ebr2 are initialized, and the program/erase-protected state is entered. ? in a reset via the res pin, the reset state is not entered unless the res pin is held low until oscillation stabilizes after powering on. in the case of a reset during operation, hold the res pin low for the res pulse width specified in the ac characteristics section. yes yes
717 22.8.2 software protection software protection can be implemented by setting the swe bit in flmcr1, erase block register 1 (ebr1), erase block register 2 (ebr2), and the rams bit in the ram emulation register (ramer). when software protection is in effect, setting the p1 or e1 bit in flash memory control register 1 (flmcr1), or the p2 or e2 bit in flash memory control register 2 (flmcr2), does not cause a transition to program mode or erase mode. (see table 22.9.) software protect can be enabled by setting the swe bit of flmcr1, block specification register 1 (ebr1), block specification register 2 (ebr2) and the rams bit of the ram emulation register. during software protect, transition cannot be made to the program mode or the erase mode even when setting p1 or e1 bits of the flash memory control register 1 (flmcr1), or p2 or e2 bits of flash memory control register 2 (flmcr2). see table 22.9. table 22.9 software protection function item description program erase swe bit protection ? clearing the swe bit to 0 in flmcr1 sets the program/erase-protected state for all blocks. (execute in on-chip ram or external memory.) yes yes block specification protection ? erase protection can be set for individual blocks by settings in erase block register 1 (ebr1) and erase block register 2 (ebr2). ? setting ebr1 and ebr2 to h'00 places all blocks in the erase-protected state. yes emulation protection ? setting the rams bit to 1 in the ram emulation register (ramer) places all blocks in the program/erase-protected state. yes yes
718 22.8.3 error protection in error protection, an error is detected when microcomputer runaway occurs during flash memory programming/erasing, or operation is not performed in accordance with the program/erase algorithm, and the program/erase operation is aborted. aborting the program/erase operation prevents damage to the flash memory due to overprogramming or overerasing. if the sh7051 malfunctions during flash memory programming/erasing, the fler bit is set to 1 in flmcr2 and the error protection state is entered. the flmcr1, flmcr2, ebr1, and ebr2 settings are retained, but program mode or erase mode is aborted at the point at which the error occurred. program mode or erase mode cannot be re-entered by re-setting the p1, p2, e1, or e2 bit. however, pv1, pv2, ev1, and ev2 bit setting is enabled, and a transition can be made to verify mode. fler bit setting conditions are as follows: 1. when flash memory is read during programming/erasing (including a vector read or instruction fetch) 2. immediately after exception handling (excluding a reset) during programming/erasing 3. when a sleep instruction (including software standby) is executed during programming/erasing 4. when the bus is released during programming/erasing error protection is released only by a reset and in hardware standby mode. figure 22.15 shows the flash memory state transition diagram.
719 program mode erase mode error (standby) error standby mode rd vf pr er fler = 0 rd vf pr er fler = 1 rd vf pr er fler = 0 rd vf pr er fler = 0 res = 0 res = 0 res = 0 reset or standby (hardware protection) flmcr1, flmcr2, ebr1, ebr2 initialization state error protection mode (software standby) software standby mode release rd: memory read possible vf: verify-read possible pr: programming possible ed: erase enable rd : memory read not possible vf : verify-read not possible pr : programming not possible er : erasing not possible legend error protection mode flmcr1, flmcr2, ebr1, ebr2 initialization state figure 22.15 flash memory state transitions
720 22.9 flash memory emulation in ram making a setting in the ram emulation register (ramer) enables part of ram to be overlapped onto the flash memory area so that data to be written to flash memory can be emulated in ram in real time. after the ramer setting has been made, accesses can be made from the flash memory area or the ram area overlapping flash memory. emulation can be performed in user mode and user program mode. figure 22.16 shows an example of emulation of real-time flash memory programming. start emulation program end of emulation program tuning ok? yes no set ramer write tuning data to overlap ram execute application program write to flash memory emulation block release ramer figure 22.16 flowchart for flash memory emulation in ram
721 h'000000 h'03f000 h'03f400 h'03f800 h'03fc00 h'03ffff eb0 to 7 eb11 eb10 eb9 eb8 h'fffff800 h'fffffbff on-chip ram flash memory this area can be accessed from both ram and flash memory figure 22.17 example of ram overlap operation example in which flash memory block area (eb8) is overlapped 1. set bits rams, ram1, and ram0 in ramer to 1, 0, 1, to overlap part of ram onto the area (eb8) for which real-time programming is required. 2. real-time programming is performed using the overlapping ram. 3. after the program data has been confirmed, the rams bit is cleared, releasing ram overlap. 4. the data written in the overlapping ram is written into the flash memory space (eb8). notes: 1. when the rams bit is set to 1, program/erase protection is enabled for all blocks regardless of the value of ram1 and ram0 (emulation protection). in this state, setting the p1 or e1 bit in flash memory control register 1 (flmcr1), or the p2 or e2 bit in flash memory control register 2 (flmcr2), will not cause a transition to program mode or erase mode. when actually programming or erasing a flash memory area, the rams bit should be cleared to 0. 2. a ram area cannot be erased by execution of software in accordance with the erase algorithm while flash memory emulation in ram is being used.
722 22.10 note on flash memory programming/erasing in the on-board programming modes (user mode and user program mode), nmi input should be disabled to give top priority to the program/erase operations (including ram emulation). 22.11 flash memory programmer mode programs and data can be written and erased in programmer mode as well as in the on-board programming modes. in programmer mode, flash memory read mode, auto-program mode, auto- erase mode, and status read mode are supported. in auto-program mode, auto-erase mode, and status read mode, a status polling procedure is used, and in status read mode, detailed internal signals are output after execution of an auto-program or auto-erase operation. in programmer mode, set the mode pins to pll x2 mode (see table 22.10) and use a 6 mhz input clock. the lsi will then operate at 12 mhz. table 22.10 shows the pin settings for programmer mode. for the pin names in programmer mode, see section 1.3.2, pin arrangement by mode). table 22.10 programming mode pin settings pin names settings mode pin: md3, md2, md1, md0 1101 (pll 2) fwe pin high level input (in auto-program and auto- erase modes) res pin power-on reset circuit xtal, extal, pllvcc, pllcap and pllvss pins oscillator circuit note: during the programming mode, polarity of the fwp pin is inverted and becomes the fwe (flash write enable) pin.
723 22.11.1 socket adapter pin correspondence diagrams connect the socket adapter to the chip as shown in figures 22.19 and 22.20. this will enable conversion to a 32-pin arrangement. the on-chip rom memory map is shown in figure 22.18, and socket adapter pin correspondence diagrams in figures 22.19 and 22.20. h'00000000 addresses in mcu mode addresses in writer mode h'0003ffff h'00000 h'3ffff on-chip rom space 256 kb figure 22.18 on-chip rom memory map
724 pin no. 77 13 20 19 44 70 69 68 67 66 64 63 62 4 5 6 7 8 9 10 11 12 43 14 15 16 17 18 42 21, 37, 46, 49, 50, 65, 73, 75, 76, 79, 100, 103 3, 23, 27, 33, 39, 55, 61, 71 78, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 101, 109 26 84 72 74 80 81 82 other than the above pin no. 1 26 2 3 31 13 14 15 17 18 19 20 21 12 11 10 9 8 7 6 5 27 24 23 25 4 28 29 22 32 16 30 hn28f101p (32 pins) pin name fwe a9 a16 a15 we i/o0 i/o1 i/o2 i/o3 i/o4 i/o5 i/o6 i/o7 a0 a1 a2 a3 a4 a5 a6 a7 a8 oe a10 a11 a12 a13 a14 ce v cc v ss a17 pin name fwe a9 a16 a15 we d0 d1 d2 d3 d4 d5 d6 d7 a0 a1 a2 a3 a4 a5 a6 a7 a8 oe a10 a11 a12 a13 a14 ce v ss a17 res xtal extal pllv cc pllcap pllv ss n.c.(open) hd64f7044 (112-pin) socket adapter (conversion to 32-pin arrangement) power-on reset circuit oscillator circuit pll circuit legend fwe: flash write enable i/o7?/o0: data input/output a17?0: address input oe: output enable ce: chip enable we: write enable v cc figure 22.19 socket adapter pin correspondence diagram (sh7044)
725 pin no. 99 18 25 24 53 92 91 90 89 88 86 84 83 7 8 9 10 11 13 15 16 17 52 19 20 21 22 23 51 12, 26, 40, 63, 77, 85, 95, 97, 98, 103, 112, 127, 128, 131, 132, 135, 136 6, 14, 28, 35, 42, 55, 61, 71, 79, 87, 93, 102, 117 to 126, 129, 141 34 108 94 96 104 105 106 other than the above pin no. 1 26 2 3 31 13 14 15 17 18 19 20 21 12 11 10 9 8 7 6 5 27 24 23 25 4 28 29 22 32 16 30 hn28f101p (32 pins) pin name fwe a9 a16 a15 we i/o0 i/o1 i/o2 i/o3 i/o4 i/o5 i/o6 i/o7 a0 a1 a2 a3 a4 a5 a6 a7 a8 oe a10 a11 a12 a13 a14 ce v cc v ss a17 pin name fwe a9 a16 a15 we d0 d1 d2 d3 d4 d5 d6 d7 a0 a1 a2 a3 a4 a5 a6 a7 a8 oe a10 a11 a12 a13 a14 ce v ss a17 res xtal extal pllv cc pllcap pllv ss n.c.(open) hd64f7045 (144-pin) socket adapter (conversion to 32-pin arrangement) power-on reset circuit oscillator circuit pll circuit legend fwe: flash write enable i/o7?/o0: data input/output a17?0: address input oe: output enable ce: chip enable we: write enable v cc figure 22.20 socket adapter pin correspondence diagram (sh7045)
726 22.11.2 programmer mode operation table 22.11 shows how the different operating modes are set when using programmer mode, and table 22.12 lists the commands used in programmer mode. details of each mode are given below. ? memory read mode memory read mode supports byte reads. ? auto-program mode auto-program mode supports programming of 128 bytes at a time. status polling is used to confirm the end of auto-programming. ? auto-erase mode auto-erase mode supports automatic erasing of the entire flash memory. status polling is used to confirm the end of auto-programming. ? status read mode status polling is used for auto-programming and auto-erasing, and normal termination can be confirmed by reading the i/o6 signal. in status read mode, error information is output if an error occurs. table 22.11 settings for various operating modes in programmer mode pin names mode fwe ce oe we i/o7? a17? read h or l l l h data output ain output disable h or l l h h hi-z ain command write h or l l h l data input * ain chip disable h or l h x x hi-z ain notes: 1. chip disable is not a standby state; internally, it is an operation state. 2. * ain indicates that there is also address input in auto-program mode. 3. for command writes in auto-program and auto-erase modes, input a high level to the fwe pin.
727 table 22.12 commands of the programmer mode number first cycle second cycle command name of cycles mode address data mode address data memory read mode 1+n write x h?0 read ra dout auto-program mode 129 write x h?0 write wa din auto-erase mode 2 write x h?0 write x h?0 status read mode 2 write x h?1 write x h?1 notes: 1. in auto-program mode, 129 cycles are required for command writing by a simultaneous 128-byte write. 2. in memory read mode, the number of cycles depends on the number of address write cycles (n). 22.11.3 memory read mode table 22.13 ac characteristics in transition to memory read mode (conditions:? cc ??.0? ?0%, v ss ? 0 v, t a = 25? ??) item symbol min max unit notes command write cycle t nxtc 20 ? ce hold time t ceh 0ns ce setup time t ces 0ns data hold time t dh 50 ns data setup time t ds 50 ns write pulse width t wep 70 ns we rise time t r 30 ns we fall time t f 30 ns
728 ce oe ce a16-0 oe we i/o7-0 note: data is latched on the rising edge of we . t ceh t wep t f t r t ces t nxtc address stable t ds t dh command write memory read mode figure 22.21 timing waveforms for memory read after memory write table 22.14 ac characteristics in transition from memory read mode to another mode (conditions: v cc = 5.0 v ?0%, v ss ? 0 v, t a = 25? ??) item symbol min max unit notes command write cycle t nxtc 20 ? ce hold time t ceh 0ns ce setup time t ces 0ns data hold time t dh 50 ns data setup time t ds 50 ns write pulse width t wep 70 ns we rise time t r 30 ns we fall time t f 30 ns
729 ce oe ce a16-0 oe we i/o7-0 note: do not enable we and oe at the same time. t ceh t wep t f t r t ces t nxtc address stable t ds t dh other mode command write memory read mode figure 22.22 timing waveforms in transition from memory read mode to another mode table 22.15 ac characteristics in memory read mode (conditions: v cc = 5.0 v ?0%, v ss ? 0 v, t a = 25? ??) item symbol min max unit notes access time t acc 20 ? ce output delay time t ce 150 ns oe output delay time t oe 150 ns output disable delay time t df 100 ns data output hold time t oh 5ns
730 ce a16-0 oe we i/o7-0 v il v il v ih t acc t acc t oh t oh address stable address stable figure 22.23 ce and oe enable state read timing waveforms ce a16-0 oe we i/o7-0 v ih t acc t ce t oe t oe t ce t acc t oh t df t df t oh address stable address stable figure 22.24 ce and oe clock system read timing waveforms
731 22.11.4 auto-program mode 1. in auto-program mode, 128 bytes are programmed simultaneously. this should be carried out by executing 128 consecutive byte transfers. 2. a 128-byte data transfer is necessary even when programming fewer than 128 bytes. in this case, h'ff data must be written to the extra addresses. 3. the lower 8 bits of the transfer address must be h'00 or h'80. if a value other than an effective address is input, processing will switch to a memory write operation but a write error will be flagged. 4. memory address transfer is performed in the second cycle (figure 22.24). do not perform transfer after the second cycle. 5. do not perform a command write during a programming operation. 6. perform one auto-program operation for a 128-byte block for each address. characteristics are not guaranteed for two or more additional programming operations. 7. confirm normal end of auto-programming by checking i/o6. alternatively, status read mode can also be used for this purpose (i/o7 status output uses the auto-program operation end identification pin). 8. status polling i/o6 and i/o7 pin information is retained until the next command write. as long as the next command write has not been performed, reading is possible by enabling ce and oe .
732 table 22.16 ac characteristics in auto-program mode (conditions: v cc = 5.0 v ?0%, v ss ? 0 v, t a = 25? ??) item symbol min max unit notes command write cycle t nxtc 20 ? ce hold time t ceh 0ns ce setup time t ces 0ns data hold time t dh 50 ns data setup time t ds 50 ns write pulse width t wep 70 ns status polling start time t wsts 1ms status polling access time t spa 150 ns address setup time t as 0ns address hold time t ah 60 ns memory write time t write 1 3000 ms write setup time t pns 100 ns write end setup time t pnh 100 ns we rise time t r 30 ns we fall time t f 30 ns ce a16-0 fwe oe we i/o7 i/o6 i/o5-0 t pns t wep t ds t dh t f t r t as t ah t wsts t write t spa t ces t ceh t nxtc t nxtc t pnh address stable h'40 h'00 data transfer 1 to 128byte write operation complete verify signal write normal complete verify signal figure 22.25 auto-program mode timing waveforms
733 22.11.5 auto-erase mode 1. auto-erase mode supports only entire memory erasing. 2. do not perform a command write during auto-erasing.. 3. confirm normal end of auto-erasing by checking i/o6. alternatively, status read mode can also be used for this purpose (i/o7 status output uses the auto-erase operation end identification pin). 4. status polling i/o6 and i/o7 pin information is retained until the next command write. as long as the next command write has not been performed, reading is possible by enabling ce and oe . table 22.17 ac characteristics in auto-erase mode (conditions: v cc = 5.0 v ?0%, v ss ???, t a = 25? ??) item symbol min max unit notes command write cycle t nxtc 20 ? ce hold time t ceh 0ns ce setup time t ces 0ns data hold time t dh 50 ns data setup time t ds 50 ns write pulse width t wep 70 ns status polling start time t ests 1ms status polling access time t spa 150 ns memory erase time t erase 100 40000 ms erase setup time t ens 100 ns erase end setup time t enh 100 ns we rise time t r 30 ns we fall time t f 30 ns
734 ce a16-0 fwe oe we i/o7 i/o6 i/o5-0 t ens t wep t ds t dh t f t r t ests t erase t spa t ces t ceh t nxtc t nxtc t enh h'20 h'20 h'00   erase complete verify signal erase normal complete verify signal figure 22.26 auto-erase mode timing waveforms 22.11.6 status read mode table 22.18 ac characteristics in status read mode (conditions: v cc = 5.0 v ?0%, v ss ?? v, t a = 25? ??) item symbol min max unit notes read time after command write t std 20 ? ce hold time t ceh 0ns ce setup time t ces 0ns data hold time t dh 50 ns data setup time t ds 50 ns write pulse width t wep 70 ns oe output delay time t oe 150 ns disable delay time t df 100 ns ce output delay time t ce 150 ns we rise time t r 30 ns we fall time t f 30 ns
735 ce a16-0 oe we i/o7-0 t wep t f t r t oe t df t ds t ds t dh t dh t ces t ceh t ce t ceh t nxtc t nxtc t nxtc t ces h'71    t wep t f t r h'71 note : i/o2 and i/o3 are undefined. figure 22.27 status read mode timing waveforms table 22.19 return commands for the status read mode pin name i/o7 i/o6 i/o5 i/o4 i/o3 i/o2 i/o1 i/o0 attribute normal end identification command error program- ming error erase error program- ming or erase count exceeded effective address error initial value 00000000 indications normal end: 0 abnormal end: 1 command error: 1 otherwise: 0 program- ming error: 1 otherwise: 0 erasing error: 1 otherwise: 0 count exceeded: 1 otherwise: 0 effective address error: 1 otherwise: 0 note: d2 and d3 are undefined at present. 22.11.7 status polling 1. i/o7 status polling is a flag that indicates the operating status in auto-program/auto-erase mode. 2. i/o6 status polling is a flag that indicates a normal or abnormal end in auto-program/auto-erase mode.
736 table 22.20 status polling output truth table pin name during internal operation abnormal end normal end i/o7 0101 i/o6 0011 i/o5? 0000 22.11.8 programmer mode transition time commands cannot be accepted during the oscillation stabilization period or the programmer mode setup period. after the programmer mode setup time, a transition is made to memory read mode. table 22.21 stipulated transition times to command wait state item symbol min max unit notes standby release (oscillation stabilization time) t osc1 10 ms programmer mode setup time t bmv 10 ms v cc hold time t dwn 0ms t osc1 t bmv t dwn v cc res fwe memory read mode command wait state automatic write mode automatic erase mode command wait state normal/abnormal complete verify note : for the level of fwe input pin, set v il when using other than the automatic write mode and automatic erase mode. figure 22.28 oscillation stabilization time and boot program transfer time
737 22.11.9 cautions concerning memory programming 1. when programming addresses which have previously been programmed, carry out auto- erasing before auto-programming. 2. when performing programming using prom mode on a chip that has been programmed/erased in an on-board programming mode, auto-erasing is recommended before carrying out auto-programming. notes: 1. the flash memory is initially in the erased state when the device is shipped by hitachi. for other chips for which the erasure history is unknown, it is recommended that auto- erasing be executed to check and supplement the initialization (erase) level. 2. auto-programming should be performed once only on the same address block. additional programming cannot be performed on previously programmed address blocks.
739 section 23 ram 23.1 overview the sh7040 series has 4 kbytes of on-chip ram. the on-chip ram is linked to the cpu and direct memory access controller (dmac)/data transfer controller (dtc) with a 32-bit data bus (figure 23.1). the cpu can access data in the on-chip ram in 8, 16, or 32 bit widths. the dmac can access 8 or 16 bit widths. 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 0 addresses h'fffff000?'ffffffff are allocated to the on-chip ram. h'fffff000 h'fffff004 h'fffff001 h'fffff005 h'fffff002 h'fffff006 h'fffff003 h'fffff007 h'fffffffc h'fffffffd h'fffffffe h'ffffffff on-chip ram internal data bus (32 bits) figure 23.1 block diagram of ram 23.2 operation the on-chip ram is accessed by accessing addresses h'fffff000?'ffffffff. on-chip ram is also used as cache memory. there are 2 kbytes of on-chip ram space during cache use. see section 9, cache memory, for details.
741 section 24 power-down state 24.1 overview in the power-down state, the cpu functions are halted. this enables a great reduction in power consumption. 24.1.1 power-down states the power-down state is effected by the following two modes: sleep mode standby mode table 24.1 describes the transition conditions for entering the modes from the program execution state as well as the cpu and peripheral function status in each mode and the procedures for canceling each mode. table 24.1 power-down state conditions state mode entering procedure clock cpu on-chip peripheral modules cpu registers ram i/o ports canceling procedure sleep execute sleep instruction with sby bit set to 0 in sbycr run halt run held held held interrupt dmac/dtc address error power-on reset manual reset stand- by execute sleep instruction with sby bit set to 1 in sbycr halt halt halt* 2 held held held or high impe- dance* 3 nmi interrupt power-on reset manual reset notes: 1. sbycr: standby control register. sby: standby bit 2. some bits within on-chip peripheral module registers are initialized by the standby mode; some are not. refer to table 24.3, register states in the standby mode, in section 24.4.1, transition to standby mode. also refer to the register descriptions for each peripheral module. 3. the status of the i/o port in standby mode is set by the port high impedance bit (hiz) of the sbycr. refer to section 24.2, standby control register (sbycr). for pin status other than for the i/o port, refer to appendix b, pin status.
742 24.1.2 related register table 24.2 shows the register used for power-down state control. table 24.2 related register name abbreviation r/w initial value address access size standby control register sbycr r/w h'1f h'ffff8614 8, 16, 32 24.2 standby control register (sbycr) the standby control register (sbycr) is a read/write 8-bit register that sets the transition to standby mode, and the port status in standby mode. the sbycr is initialized to h'1f when reset. bit: 7 6 5 4 3 2 1 0 sby hiz initial value: 0 0 0 1 1 1 1 1 r/w: r/w r/w r r r r r r bit 7?tandby (sby): specifies transition to the standby mode. the sby bit cannot be set to 1 while the watchdog timer is running (when the timer enable bit (tme) of the wdt timer control/status register (tcsr) is set to 1). to enter the standby mode, always halt the wdt by 0 clearing the tme bit, then set the sby bit. bit 7: sby description 0 executing sleep instruction puts the lsi into sleep mode (initial value) 1 executing sleep instruction puts the lsi into standby mode bit 6?ort high impedance (hiz): in the standby mode, this bit selects whether to set the i/o port pin to high impedance or hold the pin status. the hiz bit cannot be set to 1 when the tme bit of the wdt timer control/status register (tcsr) is set to 1. when making the i/o port pin status high impedance, always clear the tme bit to 0 before setting the hiz bit. bit 6: hiz description 0 holds pin status while in standby mode (initial value) 1 keeps pin at high impedance while in standby mode bits 5??eserved: bit 5 always reads as 0. always write 0 to bit 5. bits 4? always read as 1. always write 1 to these bits.
743 24.3 sleep mode 24.3.1 transition to sleep mode executing the sleep instruction when the sby bit of sbycr is 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 continue to run during the sleep mode. 24.3.2 canceling sleep mode sleep mode is canceled by an interrupt, dmac/dtc 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? status register (sr) or if an interrupt by an on-chip peripheral module is disabled at the peripheral module. cancellation by a dmac/dtc address error: if a dmac/dtc address error occurs, the sleep mode is canceled and dmac/dtc address error exception processing is executed. cancellation by a power-on reset: a power-on reset resulting from setting the res pin to low level cancels the sleep mode. cancellation by a manual reset: when the mres pin is set to low level while the res pin is at high level, a manual reset occurs and the sleep mode is canceled. 24.4 standby mode 24.4.1 transition to standby mode to enter the standby mode, set the sby bit to 1 in sbycr, then execute the sleep instruction. the lsi moves from the program execution state to the standby mode. in the standby mode, power consumption is greatly reduced by halting not only the cpu, but the clock and on-chip peripheral modules as well. cpu register contents and on-chip ram data are held as long as the prescribed voltages are applied. the register contents of some on-chip peripheral modules are initialized, but some are not (table 24.3). the i/o port status can be selected as held or high impedance by the port high impedance bit (hiz) of the sbycr. for pin status other than for the i/o port, refer to appendix c, pin states.
744 table 24.3 register states in the standby mode module registers initialized registers that retain data registers with undefined contents interrupt controller (intc) all registers user break controller (ubc) all registers data transfer controller (dtc) all registers (excluding transfer data in memory and dtdr) cache memory (cac) all registers bus state controller (bsc) all registers direct memory access controller (dmac) dma channel control registers 0? (chcr0 chcr3) dma operation register (dmaor) dma source address registers 0? (sar0 sar3) dma destination address registers 0? (dar0 dar3) dma transfer count registers 0? (dmatcr0 dmatcr3) multifunction timer pulse unit (mtu) mtu associated registers poe associated registers watchdog timer (wdt) bits 7? (ovf, wt/ it , tme) of the timer control status register (tcsr) reset control/status register (rstcsr) bits 2? (cks2?ks0) of the tcsr timer counter (tcnt) serial communication interface (sci) receive data register (rdr) transmit data register (tdr) serial mode register (smr) serial control register (scr) serial status register (ssr) bit rate register (bbr) a/d converter (a/d) all registers compare match timer (cmt) all registers
745 table 24.3 register states in the standby mode (cont) module registers initialized registers that retain data registers with undefined contents pin function controller (pfc) all registers i/o port (i/o) all registers power-down state related standby control register (sbycr) 24.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: clock oscillation starts when a rising edge or falling edge (selected by the nmi edge select bit (nmie) of the interrupt control register (icr) of the intc) is detected in the nmi signal. this clock is supplied only to the watchdog timer (wdt). a wdt overflow occurs if the time established by the clock select bits (cks2?ks0) in the tcsr of the wdt elapses before transition to the standby mode. the occurrence of this overflow is used to indicate that the clock has stabilized, so the clock is supplied to the entire chip, the standby mode is canceled, and nmi exception processing begins. when canceling standby mode with nmi interrupts, set the cks2?ks0 bits so that the wdt overflow period is longer than the oscillation stabilization time. when canceling standby mode with an nmi pin set for falling edge, be sure that the nmi pin level upon entering standby (when the clock is halted) is high level, and that the nmi pin level upon returning from standby (when the clock starts after oscillation stabilization) is low level. when canceling standby mode with an nmi pin set for rising edge, be sure that the nmi pin level upon entering standby (when the clock is halted) is low level, and that the nmi pin level upon returning from standby (when the clock starts after oscillation stabilization) is high level. cancellation by a power-on reset: a power-on reset caused by setting the res pin to low level cancels the standby mode. cancellation by a manual reset: when the mres pin is set to low level while the res pin is at high level, a manual reset occurs and the standby mode is canceled. in this case, be sure that the mres pin is low level for longer than the oscillation stabilization time established by the wdt.
746 24.4.3 standby mode application example this example describes a transition to standby mode on the falling edge of an nmi signal, and a cancellation on the rising edge of the nmi signal. the timing is shown in figure 24.1. when the nmi pin is changed from high to low level while the nmi edge select bit (nmie) of the icr is set to 0 (falling edge detection), the nmi interrupt is accepted. when the nmie bit is set to 1 (rising edge detection) by an nmi exception service routine, the standby bit (sby) of the sbycr is set to 1, and a sleep instruction is executed, standby mode is entered. thereafter, standby mode is canceled when the nmi pin is changed from low to high level. oscillator ck nmi nmie sby nmi exception processing exception service routine sby = 1 sleep instruction standby mode oscillation start time wdt time set nmi exception processing oscillation settling time figure 24.1 standby mode nmi timing (application example)
747 section 25 electrical characteristics (5v, 33.3 mhz version) the sh7044f and sh7045f are not available in a 5 v, 33.3 mhz version. therefore note that 5 v, 33.3 mhz operation is not guaranteed for these models. 25.1 absolute maximum ratings table 25.1 shows the absolute maximum ratings. table 25.1 absolute maximum ratings item symbol rating unit power supply voltage v cc ?.3 to +7.0 v programmable voltage (ztat version only) v pp ?.3 to +13.5 v input voltage (other than a/d ports) v in ?.3 to v cc + 0.3 v input voltage (a/d ports) v in ?.3 to av cc + 0.3 v analog supply voltage av cc ?.3 to +7.0 v analog reference voltage (qfp-144 only) av ref ?.3 to av cc + 0.3 v analog input voltage v an ?.3 to av cc + 0.3 v operating temperature t opr ?0 to +75 ? programming temperature (ztat version only) t we ?0 to +75 ? storage temperature t stg ?5 to +125 ? note: operating the lsi in excess of the absolute maximum ratings may result in permanent damage.
748 25.2 dc characteristics table 25.2 dc characteristics (conditions: v cc = 4.75 ?5.25 v, av cc = 4.75 ?5.25 v, av cc ? v cc 5%, av ref = 4.75 v to av cc , v ss = av ss = 0 v, ta = ?0 to +75?c) item pin symbol min typ max unit measurement conditions input high- level res , nmi, md3 md0, pa2, pa5, pa6?a9, pe0 pe15 v ih v cc ?0.7 v cc + 0.3 v voltage extal v cc 0.7 v cc + 0.3 v a/d port 2.2 av cc + 0.3 v other input pins 2.2 v cc + 0.3 v input low- level res , nmi, md3 md0, pa2, pa5, pa6?a9, pe0 pe15 v il ?.3 0.5 v voltage other input pins ?.3 0.8 v schmitt trigger input voltage pa2, pa5, pa6 pa9, pe0?e15 vt + ?vt 0.4 v vt + v cc ?0.7 v (min) vt 0.5 v (max) input leak current res , nmi, md3 md0, pa2, pa5, pa6?a9, pe0 pe15,fwp | iin | 1.0 ? vin = 0.5 to v cc ?0.5 v a/d port 1.0 ? vin = 0.5 to av cc ?0.5 v other input pins (except extal pin) 1.0 ? vin = 0.5 to v cc ?0.5 v three-state leak current (while off) a21?0, d31 d0, cs3 cs0 , rdwr, ras , casxx , wrxx , rd , ports a, b, c, d, e | i tsi | 1.0 ? vin = 0.5 to v cc ?0.5 v
749 table 25.2 dc characteristics (conditions: v cc = 4.75 ?5.25 v, av cc = 4.75 ?5.25 v, av cc ? v cc 5%, av ref = 4.75 v to av cc , v ss = av ss = 0 v, ta = ?0 to +75?) (cont) item pin symbol min typ max unit measurement conditions output all output pins v oh v cc ?0.5 v i oh = ?00 ? high-level voltage 3.5 v i oh = ? ma output low- all output pins v ol 0.4 v i ol = 1.6 ma level voltage pe9, pe11?e15 1.5 v i ol = 15 ma input res cin 110 pf vin = 0 v, f = 1 mhz, capaci- nmi 50 pf ta = 25? tance all other input pins 20 pf current consump- ordinary operation i cc 180 250 ma f = 33.3 mhz tion sleep 160 220 ma f = 33.3 mhz standby 0.01 5 a ta 50? 20 ? ta > 50? analog ai cc 7 13 ma supply current ai ref 0.7 1.3* 5 ma qfp144 version only ram standby voltage v ram 2.0 v notes: 1. when the a/d converter is not used (including during standby), do not release the av cc , av ss , and av ref (sh7041, sh7043) pins. connect the av cc and av ref (sh7041, sh7043) pins to v cc and the av ss pin to v ss . 2. the current consumption is measured when v ih min = v cc ?0.5 v, v il max = 0.5 v, with all output pins unloaded. 3. the ztat and mask versions have the same functions, and the electrical characteristics of both are within specification, but characteristic-related performance values, operating margins, noise margins, noise emission, etc., are different. caution is therefore required in carrying out system design, and when switching between ztat and mask versions. 4. when the sh7040 chip is used for high-speed operation, the package surface temperature rises. appropriate measures (such as heat dissipation) to ensure overall system reliability and safety should therefore be investigated. 5. 5.3 ma in the mask version
750 table 25.3 permitted output current values (conditions: v cc = 4.75 ?5.25 v, av cc = 4.75 ?5.25 v, av cc = v cc 5%, av ref = 4.75 v to av cc , v ss = av ss = 0 v, ta = ?0 to +75?c) item symbol min typ max unit output low-level permissible current (per pin) i ol 2.0* 1 ma output low-level permissible current (total) i ol 80ma output high-level permissible current (per pin) ? oh 2.0 ma output high-level permissible current (total) (? oh )25ma notes: 1. pe9, pe11?e15 are i ol = 15 ma (max). make sure that no more than three of these pins exceed an i ol of 2.0 ma simultaneously. 2. to assure lsi reliability, do not exceed the output values listed in this table. 25.3 ac characteristics 25.3.1 clock timing table 25.4 clock timing (conditions: v cc = 4.75 ?5.25 v, av cc = 4.75 ?5.25 v, av cc = v cc 5%, av ref = 4.75 v to av cc , v ss = av ss = 0 v, ta = ?0 to +75?c) item symbol min max unit figures operating frequency f op 4 33.3 mhz 25.1 clock cycle time t cyc 30.0 250 ns clock low-level pulse width t cl 6ns clock high-level pulse width t ch 6ns clock rise time t cr ? ns clock fall time t cf ? ns extal clock input frequency f ex 4 10 mhz 25.2 extal clock input cycle time t excyc 100 250 ns extal clock low-level input pulse width t exl 40 ns extal clock high-level input pulse width t exh 40 ns extal clock input rise time t exr ? ns extal clock input fall time t exf ? ns reset oscillation settling time t osc1 10 ms 25.3 standby return clock settling time t osc2 10 ms
751 t cyc t cl t ch 1/2v cc 1/2v cc t cf t cr ck figure 25.1 system clock timing t excyc t exl t exh v ih v ih 1/2v cc v il v il 1/2v cc t exf t exr extal v ih figure 25.2 extal clock input timing t osc1 v cc min t osc2 ck v cc res figure 25.3 oscillation settling time
752 25.3.2 control signal timing table 25.5 control signal timing (conditions: v cc = 4.75 ?5.25 v, av cc = 4.75 ?5.25 v, av cc = v cc 5%, av ref = 4.75 v to av cc , v ss = av ss = 0 v, ta = ?0 to +75?c) item symbol min max unit figure res rise/fall t resr , t resf 200 ns 25.4 res pulse width t resw 20 t cyc mres pulse width t mresw 20 t cyc nmi rise/fall t nmir , t nmif 200 ns 25.5 res setup time* t ress 35 ns 25.4, mres setup time* t mress 35 ns 25.5 nmi setup time* t nmis 35 ns irq7 irq0 setup time (edge detection) t irqes 35 ns irq7 irq0 setup time (level detection) t irqls 35 ns nmi hold time t nmih 35 ns 25.5 irq7 irq0 hold time t irqeh 35 ns irqout output delay time t irqod 35 ns 25.6 bus request setup time t brqs 35 ns 25.7 bus acknowledge delay time 1 t backd1 ?5ns bus acknowledge delay time 2 t backd2 ?5ns bus three-state delay time t bzd ?5ns note: * the res , mres , nmi, and irq7 irq0 signals are asynchronous inputs, but when the setup times shown here are provided, the signals are considered to have produced changes at clock rise (for res and mres ) or clock fall (for nmi and irq7 irq0 ). if the setup times are not provided, recognition is delayed until the next clock rise or fall.
753 ck res mres t resf t resw t mresw t resr t ress t mress t mress t ress v ih v ih v ih v il v il v il v il figure 25.4 reset input timing t nmih t nmis t nmir, t nmif v ih v il t irqeh t irqes v ih v il t irqls ck nmi irq edge irq level figure 25.5 interrupt signal input timing
754 t irqod t irqod ck irqout figure 25.6 interrupt signal output timing ck rd , rdwr, ras , casxx , csn , wrxx a21?0, d31?0 t brqs t brqs t backd1 t backd2 t bzd t bzd breq (input) note: during the bus-release period of a self-refresh, ras , casx , and rdwr are output. back (output) figure 25.7 bus right release timing
755 25.3.3 bus timing table 25.6 bus timing (conditions: v cc = 4.75 ?5.25 v, av cc = 4.75 ?5.25 v, av cc = v cc ?5%, av ref = 4.75? av cc , v ss = av ss = 0 v, ta = ?20 to +75 c) item symbol min max unit figure address delay time t ad 2* 3 19 ns 25.8, 25.9, 25.11?5.16, 25.19 cs delay time 1 t csd1 2* 3 21 ns 25.8, 25.9, 25.19 cs delay time 2 t csd2 2* 3 21 ns read strobe delay time 1 t rsd1 2* 3 18 ns 25.8, 25.9, read strobe delay time 2 t rsd2 2* 3 18 ns 25.11?5.16, read data setup time t rds * 4 19 ns 25.19 read data hold time t rdh 0ns write strobe delay time 1 t wsd1 2* 3 18 ns write strobe delay time 2 t wsd2 2* 3 18 ns write data delay time t wdd ?5ns write data hold time t wdh 0 10* 2 ns wait setup time t wts 15 ns 25.10, 25.15, wait hold time t wth 0ns 25.19 ras delay time 1 t rasd1 2* 3 18 ns 25.11?5.18 ras delay time 2 t rasd2 2* 3 18 ns cas delay time 1 t casd1 2* 3 18 ns cas delay time 2 t casd2 2* 3 18 ns read data access time t acc * 1 t cyc (n + 2) ?40 ns 25.8, 25.9 access time from read strobe t oe * 1 t cyc (n + 1.5) ?40 ns access time from column address t aa * 1 t cyc (n + 2) ?40 ns 25.11?5.16 access time from ras t rac * 1 t cyc (n + rcd + 2.5) ?40 ns access time from cas t cac * 1 t cyc (n + 1) ?40 ns row address hold time t rah t cyc (rcd + 0.5) ?15 ns row address setup time t asr t cyc 0.5?5 ns data input setup time t ds t cyc (m + 0.5) ?25 ns data input hold time t dh 20 ns
756 table 25.7 bus timing (conditions: v cc = 4.75 ?5.25 v, av cc = 4.75 ?5.25 v, av cc = v cc ?5%, av ref = 4.75 v to av cc , v ss = av ss = 0 v, ta = ?20 to +75 c) item symbol min max unit figure write address setup time t as 0 ns 25.8?5.9 write address hold time t wr 5 ns 25.8, 25.9, 25.19 write data hold time t wrh 0ns read/write strobe delay time 1 t rwd1 2* 3 18 ns 25.11?5.16 read/write strobe delay time 2 t rwd2 2* 3 18 ns high-speed page mode cas precharge time t cp t cyc ?25 ns 25.16 ras precharge time t rp t cyc (tpc + 1.5) ?15 ns 25.11?5.16 cas setup time t csr 10 ns 25.17, 25.18 ah delay time 1 t ahd1 2* 3 20 ns 25.19 ah delay time 2 t ahd2 2* 3 20 ns multiplex address delay time t mad 2* 3 18 ns multiplex address hold time t mah 0ns dack delay time t dackd1 2* 3 25 ns 25.8, 25.9, 25.11 25.16, 25.19 notes: n is the number of waits. m is 0 when the number of dram write cycle waits is 0, and 1 otherwise. rcd is the set value of the rcd bit in dcr. tpc is the set value of the tpc bit in dcr. 1. if the access time is satisfied, t rds need not be satisfied. 2. t wdh (max) is a reference value. 3. the delay time min values are reference values (typ). 4. t rds is a reference value.
757 t1 t2 ck a21?0 dackn t dackd1 t dackd1 t wdh t wdd t wsd1 t wsd2 t acc t rds t rdh t rsd1 t oe t rsd2 t csd2 t csd1 t ad t as t wr t wrh csn note: t rdh is specified from fastest negate timing of a21?0, csn and rd . (during read) (during read) rd d31?0 d31?0 wrxx (during write) (during write) figure 25.8 basic cycle (no waits)
758 ck a21?0 dackn t1 tw t2 t ad t csd1 t rsd1 t wsd1 t wdd t dackd1 t rsd2 t csd2 t rds t rdh t wsd2 t wdh t dackd1 t oe t acc t as t wrh t wr note : t rdh is specified from fastest negate timing of a21?0, csn and rd . csn rd d31?0 d31?0 (during read) (during read) (during write) (during write) wrxx figure 25.9 basic cycle (software waits)
759 ck a21?0 t1 tw two tw t2 t wts t wth t wts t wth csn rd wrxx wait dackn (during read) (during read) (during write) (during write) d31?0 d31?0 figure 25.10 basic cycle (2 software waits + wait due to wait signal)
760 tp tr tc1 tc2 t ad t ad t asr t rp t rasd1 t rah t casd1 t cac t aa t rac t rds t rasd2 t casd2 t rdh t rwd1 t casd2 t casd1 t rwd2 t wdh t dh t ds t wdd t dackd1 t dackd1 t rsd1 t rsd2 t wsd1 t wsd2 ck a21?0 ras casxx rdwr d31?d0 d31?0 casxx rdwr dackn rd wrxx note : t rdh is specified from fastest negate timing of a21?0, ras and cas . (during read) (during read) (during read) (during read) (during write) (during write) (during write) (during write) row address column address figure 25.11 dram cycle (normal mode, no waits, tpc = 0, rcd = 0)
761 tp ck a21?0 tr tc1 tcw1 tc2 t ad t ad t rp t rasd1 t asr t casd1 t rah t rasd2 t casd2 t cac t rac t aa t rds t rdh t casd2 t rwd2 t wdh t dh t ds t wdd t dackd1 t dackd1 t rsd1 t wsd1 t wsd2 t rsd2 t casd1 t rwd1 row address column address ras casxx rdwr d31?0 casxx rdwr d31?0 dackn rd wrxx note : t rdh is specified from fastest negate timing of a21?0, ras and cas . (during read) (during read) (during read) (during read) (during write) (during write) (during write) (during write) figure 25.12 dram cycle (normal mode, 1 wait, tpc = 0, rcd = 0)
762 ck a21?0 tp tpw tr trw tc1 tcw1 tcw2 tc2 t ad t ad t asr t rasd1 t rah t rp t casd1 t cac t aa t rac t rds t rdh t casd2 t casd1 t rwd2 t rwd1 t dh t ds t wdh t dackd1 t dackd1 t wdd t rsd1 t rsd2 t wsd1 t wsd2 t rasd2 t casd2 ras casxx rdwr d31?0 casxx rdwr d31?0 dackn rd wrxx (during read) (during read) (during read) (during read) (during write) (during write) (during write) (during write) row address column address note : t rdh is specified from fastest negate timing of a21?0, ras and cas . figure 25.13 dram cycle (normal mode, 2 waits, tpc = 1, rcd = 1) ck a21?0 tp tpw tr trw tc1 tcw1 tcw2 tcw3 tc2 t ad t ad t rah t asr t rp t casd1 t cac t aa t casd1 t rds t casd2 trwd2 t rwd1 t ds t dh t wdh t dackd1 t rsd1 t wsd1 t wsd2 t rsd2 t dackd1 t rasd2 t casd2 t wdd ras casxx rdwr d31?0 casxx rdwr d31?0 dackn rd wrxx (during read) (during read) (during read) (during read) (during write) (during write) (during write) (during write) row address column address t rasd1 t rdh t rac note : t rdh is specified from fastest negate timing of a21?0, ras and cas . figure 25.14 dram cycle (normal mode, 3 waits, tpc = 1, rcd = 1)
763 ck a21?0 tp tr tc1 tcw1 tcw2 tcwo tc2 t ad t ad t asr t rah t rasd1 t rp t casd1 t cac t aa t rac t rdh t casd2 t rwd2 t casd1 t wdh t dh t ds t rwd1 t wdd t wts t wth t wts t wth t dackd1 t rsd2 t wsd2 t wsd1 t rsd1 t rasd2 t dackd1 t casd2 t rds ras casxx rdwr d31?0 casxx rdwr d31?0 dackn rd wrxx wait (during read) (during read) (during read) (during read) (during write) (during write) (during write) (during write) row address column address note : t rdh is specified from fastest negate timing of a21?0, ras and cas. figure 25.15 dram cycle (normal mode, 2 waits + wait due to wait signal)
764 ck a21?0 tp tr tc1 tc2 tc1 tc2 t ad t ad t asr t rasd1 t rah t rp t casd1 t casd2 t casd1 t casd2 t rasd2 t cp t aa t cac t aa t rac t rds t rdh t rds t rdh t cac t casd1 t casd2 t casd1 t casd2 t rwd2 t rwd1 t rwd2 t rwd1 t dh t ds t wdd t wdh t wdd t wdh t dh t ds t cp t dackd1 t dackd1 t rsd1 t wsd1 t wsd2 t wsd1 t wsd2 t rsd2 t rsd1 t rsd2 t dackd1 ras casxx rdwr d31?0 casxx rdwr d31?0 dackn rd wrxx (during read) (during read) (during read) (during read) (during write) (during write) (during write) (during write) note : t rdh is specified from fastest negate timing of a21?0, ras and cas . row address column address column address figure 25.16 dram cycle (high-speed page mode) ck rdwr trp trr1 trr2 trc trc t rasd1 t rasd2 t casd2 t csr t casd1 ras casxx figure 25.17 cas before ras refresh (tras1 = 0, tras0 = 0)
765 ck ras casxx rdwr trcc t rasd2 t casd2 t csr t casd1 trp trr1 trr2 t rasd1 trc figure 25.18 self refresh ck a21?0 dackn ta1 ta2 ta3 ta4 t1 tw two t2 t ad t csd1 t csd2 t ahd1 t ahd2 t rsd2 t mah t mad t rds t rdh t mah t wdd t mad t wdh t dackd1 t dackd1 t wts t wth t wts t wth t wsd2 t wr t wrh t rsd1 cs3 ah d15?0 wait d15?0 rd wrxx (during read) address address (during read) (during write) (during write) t wsd1 note : t rdh is specified from fastest negate timing of a21?0, cs3 and rd . figure 25.19 address data multiplex i/o space cycle (1 software wait + external wait)
766 25.3.4 direct memory access controller timing table 25.8 direct memory access controller timing (conditions: v cc = 4.75 ?5.25 v, av cc = 4.75 ?5.25 v, av cc = v cc ?5%, av ref = 4.75 v to av cc , v ss = av ss = 0 v, ta = ?20 to +75 c) item symbol min max unit figure dreq0 and dreq1 setup time t drqs 25 ns 25.20 dreq0 and dreq1 hold time t drqh 25 ns dreq0 and dreq1 pulse width t drqw 1.5 t cyc 25.21 drak output delay time t drakd 25 ns 25.22 ck t drqs t drqs t drqs t drqh dreq0 dreq1 level clear dreq0 dreq1 level dreq0 dreq1 edge figure 25.20 dreq0 and dreq1 input timing (1)
767 ck t drqw dreq0 dreq1 edge figure 25.21 dreq0 and dreq1 input timing (2) ck t drakd t drakd drakn figure 25.22 drak output delay time
768 25.3.5 multifunction timer pulse unit timing table 25.9 multifunction timer pulse unit timing (conditions: v cc = 4.75 ?5.25 v, av cc = 4.75 ?5.25 v, av cc = v cc ?5%, av ref = 4.75 v to av cc , v ss = av ss = 0 v, ta = ?20 to + 75 c) item symbol min max unit figure output compare output delay time t tocd 100 ns 25.23 input capture input setup time t tics 30 ns timer input setup time t tcks 35 ns timer clock pulse width (single edge specification) t tckwh/l 1.5 t cyc 25.24 timer clock pulse width (both edges specified) t tckwh/l 2.5 t cyc timer clock pulse width (phase measurement mode) t tckwh/l 2.5 t cyc ck t tocd t tics input capture input output compare output figure 25.23 mtu i/o timing ck tclka to tclkd t tcks t tcks t tckwh t tckwl figure 25.24 mtu clock input timing
769 25.3.6 i/o port timing table 25.10 i/o port timing (conditions: v cc = 4.75 ?5.25 v, av cc = 4.75 ?5.25 v, av cc = v cc ?5%, av ref = 4.75 v to av cc , v ss = av ss = 0 v, ta = ?20 to +75 c) item symbol min max unit figure port output data delay time t pwd 100 ns 25.25 port input hold time t prh 35 ns port input setup time t prs 35 ns t prs t prh t pwd t1 t2 ck port (read) port (write) figure 25.25 i/o port i/o timing
770 25.3.7 watchdog timer timing table 25.11 watchdog timer timing (conditions: v cc = 4.75 ?5.25 v, av cc = 4.75 ?5.25 v, av cc = v cc ?5%, av ref = 4.75 v to av cc , v ss = av ss = 0 v, ta = ?20 to + 75 c) item symbol min max unit figure wdtovf delay time t wovd 100 ns 25.26 ck t wovd wdtovf t wovd figure 25.26 watchdog timer timing
771 25.3.8 serial communication interface timing table 25.12 serial communication interface timing (conditions: v cc = 4.75 ?5.25 v, av cc = 4.75 ?5.25 v, av cc = v cc ?5%, av ref = 4.75 v to av cc , v ss = av ss = 0?, ta = ?20 to +75 c) item symbol min max unit figure input clock cycle t scyc 4t cyc 25.27 input clock cycle (clock sync) t scyc 6t cyc input clock pulse width t sckw 0.4 0.6 t scyc input clock rise time t sckr 1.5 t cyc input clock fall time t sckf 1.5 t cyc transmit data delay time (clock sync) t txd 100 ns 25.28 receive data setup time (clock sync) t rxs 100 ns receive data hold time (clock sync) t rxh 100 ns t sckw t sckr t sckf t scyc sck0, sck1 figure 25.27 input clock timing t scyc t txd t rxs t rxh sck0, sck1 txd0, txd1 (transmit data) rxd0, rxd1 (receive data) figure 25.28 sci i/o timing (clock sync mode)
772 25.3.9 mid-speed converter timing (a mask) table 25.13 shows mid-speed converter timing table 25.13 mid-speed converter timing (conditions:vcc = 4.75 ?5.25 v, av cc = 4.75 5.25 v, av cc = v cc ?5%, av ref = 4.75 v to av cc , v ss = av ss = 0v, ta = ?0 to ?75 c) item symbol min typ max unit figure external trigger input pulse width t trgw 2t cyc 25.29 external trigger input start delay time t trgs 50 ns a/d conversion start dalay time cks = 0 t d 10 ?7t cyc 25.30 cks = 1 6 9 input sampling time cks = 0 t spl ?4 cks = 1 32 a/d conversion time cks = 0 t conv 259 266 cks = 1 131 134 t trgs ck adcr t trgw t trgw adtrg input 1 state figure 25.29 external trigger input timing
773 adf t d t spl t conv t d t spl t conv : adcsr write cycle : adcsr address : a/d conversion start delay time : input sampling time : a/d conversion time address write signal input sampling timing ck (1) (2) legend: (1) (2) figure 25.30 analog conversion timing
774 25.3.10 measuring conditions for ac characteristics input reference levels: ? high level: 2.2 v ? low level: 0.8 v output reference levels: ? high level: 2.0 v ? low level: 0.8 v i ol v ref c l i oh v lsi output pin dut output c l is set with the following pins, including the total capacitance of the measurement equipment etc: note: 30 pf: 50 pf: 70 pf: i ol , i oh : ck, ras , casxx , rdwr, cs0 cs3 , ah , breq , back , dack0, dack1, and irqout a21?0, d31?0, rd , wrxx port output and peripheral module output pins other than the above. see table 25.3, permitted output current values. figure 25.31 output test circuit
775 25.4 a/d converter characteristics table 25.14 a/d converter timing (a mask) (condition: vcc = 4.75 ?5.25 v, av cc = 4.75 ?5.25 v, av cc = v cc ?5%, av ref = 4.75 v to av cc , v ss = av ss = 0 v, ta = - 20 to + 75 c) 33.3 mhz 20 mhz item min typ max min typ max unit resolution 10 10 10 10 10 10 bits conversion time (when cks=0) 8.1 13.4 ? analog input capacity 20 20 pf permission signal source impedance 1 1 k w non-linearity error* ? ? lsb offset error* ? ? lsb full scale error* ? ? lsb quantize error* ?.5 ?.5 lsb absolute error ? ? lsb note: * reference value
777 section 26 electrical characteristics (5v, 28.7 mhz version) 26.1 absolute maximum ratings table 26.1 shows the absolute maximum ratings. table 26.1 absolute maximum ratings item symbol rating unit power supply voltage v cc ?.3 to +7.0 v programmable voltage (ztat version only) v pp ?.3 to +13.5 v input voltage (other than a/d ports) v in ?.3 to v cc + 0.3 v input voltage (a/d ports) v in ?.3 to av cc + 0.3 v analog supply voltage av cc ?.3 to +7.0 v analog reference voltage (qfp-144 only) av ref ?.3 to av cc + 0.3 v analog input voltage v an ?.3 to av cc + 0.3 v operating temperature t opr ?0 to +75* 1 ? programming temperature (ztat version only) t we ?0 to +75* 2 ? storage temperature t stg ?5 to +125 ? notes: operating the lsi in excess of the absolute maximum ratings may result in permanent damage. 1. normal products : t opr = ?0 to + 85? for wide-temperature range products. 2. normal products: t we = ?0 to +85? for wide-temperature range products.
778 26.2 dc characteristics table 26.2 dc characteristics (conditions: v cc = 5.0 v 10%, av cc = 5.0 v 10%, av cc ? v cc 10%, av ref = 4.5 v to av cc , v ss = av ss = 0 v, ta = ?0 to +75?c) item pin symbol min typ max unit measurement conditions input high- level voltage res , nmi, md3 md0, pa2, pa5, pa6?a9, pe0 pe15, fwp v ih v cc ?0.7 v cc + 0.3 v extal v cc 0.7 v cc + 0.3 v a/d port 2.2 av cc + 0.3 v other input pins 2.2 v cc + 0.3 v input low- level voltage res , nmi, md3 md0, pa2, pa5, pa6?a9, pe0 pe15, fwp v il ?.3 0.5 v other input pins ?.3 0.8 v schmitt trigger input voltage pa2, pa5, pa6 pa9, pe0?e15 vt + ?vt 0.4 v vt + v cc ?0.7 v (min) vt 0.5 v (max) input leak current res , nmi, md3 md0, pa2, pa5, pa6?a9, pe0 pe15,fwp | iin | 1.0 ? vin = 0.5 to v cc ?0.5 v a/d port 1.0 ? vin = 0.5 to av cc ?0.5 v other input pins (except extal pin) 1.0 ? vin = 0.5 to v cc ?0.5 v three-state leak current (while off) a21?0, d31 d0, cs3 cs0 , rdwr, ras , casxx , wrxx , rd , ports a, b, c, d, e | i tsi | 1.0 ? vin = 0.5 to v cc ?0.5 v
779 table 26.2 dc characteristics (conditions: v cc = 5.0 v 10%, av cc = 5.0 v 10%, av cc ? v cc 10%, av ref = 4.5 v to av cc , v ss = av ss = 0 v, ta = ?0 to +75?) (cont) item pin symbol min typ max unit measurement conditions output all output pins v oh v cc ?0.5 v i oh = ?00 ? high-level voltage 3.5 v i oh = ? ma output low- all output pins v ol 0.4 v i ol = 1.6 ma level voltage pe9, pe11?e15 1.5 v i ol = 15 ma input res cin 80* 5 pf vin = 0 v, f = 1 mhz, capaci- nmi 50 pf ta = 25? tance all other input pins 20 pf current consump- ordinary operation i cc 160 230 ma f = 28 mhz tion sleep 140 200 ma f = 28 mhz standby 0.01 5 a ta 50? 20 ? ta > 50? analog ai cc 5 10 ma supply current ai ref 0.5 1* 6 ma qfp144 version only ram standby voltage v ram 2.0 v notes: 1. when the a/d converter is not used (including during standby), do not release the av cc , av ss , and av ref (sh7041,sh7043,sh7045 only) pins. connect the av cc and av ref (sh7041,sh7043,sh7045 only) pins to v cc and the av ss pin to v ss . 2. the current consumption is measured when v ih min = v cc ?0.5 v, v il max = 0.5 v, with all output pins unloaded. 3. the ztat and mask versions as well as f-ztat and mask versions have the same functions, and the electrical characteristics of both are within specification, but characteristic-related performance values, operating margins, noise margins, noise emission, etc., are different. caution is therefore required in carrying out system design, when switching between ztat and mask versions, and when switching between f- ztat and mask versions. 4. when the sh7040 chip is used for high-speed operation, the package surface temperature rises. appropriate measures (such as heat dissipation) to ensure overall system reliability and safety should therefore be investigated. 5. 110pf for a mask 6. 5 ma in the mask version
780 table 26.3 permitted output current values (conditions: v cc = 5.0 v 10%, av cc = 5.0? 10%, av cc = v cc 10%, av ref = 4.5 v to av cc , v ss = av ss = 0 v, ta = ?0 to +75?c) item symbol min typ max unit output low-level permissible current (per pin) i ol 2.0* 1 ma output low-level permissible current (total) i ol 80ma output high-level permissible current (per pin) ? oh 2.0 ma output high-level permissible current (total) (? oh )25ma notes: 1. pe9, pe11?e15 are i ol = 15 ma (max). make sure that no more than three of these pins exceed an i ol of 2.0 ma simultaneously. 2. to assure lsi reliability, do not exceed the output values listed in this table. 26.3 ac characteristics 26.3.1 clock timing table 26.4 clock timing (conditions: v cc = 5.0 v 10%, av cc = 5.0 v 10%, av cc = v cc 10%, av ref = 4.5 v to av cc , v ss = av ss = 0 v, ta = ?0 to +75?c) item symbol min max unit figures operating frequency f op 4 28.7 mhz 26.1 clock cycle time t cyc 34.8 250 ns clock low-level pulse width t cl 10 ns clock high-level pulse width t ch 10 ns clock rise time t cr ? ns clock fall time t cf ? ns extal clock input frequency f ex 4 10 mhz 26.2 extal clock input cycle time t excyc 100 250 ns extal clock low-level input pulse width t exl 40 ns extal clock high-level input pulse width t exh 40 ns extal clock input rise time t exr ? ns extal clock input fall time t exf ? ns reset oscillation settling time t osc1 10 ms 26.3 standby return clock settling time t osc2 10 ms
781 t cyc t cl t ch 1/2v cc 1/2v cc t cf t cr ck figure 26.1 system clock timing t excyc t exl t exh v ih v ih 1/2v cc v il v il 1/2v cc t exf t exr extal v ih figure 26.2 extal clock input timing t osc1 v cc min t osc2 ck v cc res figure 26.3 oscillation settling time
782 26.3.2 control signal timing table 26.5 control signal timing (conditions: v cc = 5.0 v 10%, av cc = 5.0 v 10%, av cc = v cc 10%, av ref = 4.5 v to av cc , v ss = av ss = 0 v, ta = ?0 to +75?c) item symbol min max unit figure res rise/fall t resr , t resf 200 ns 26.4 res pulse width t resw 20 t cyc mres pulse width t mresw 20 t cyc nmi rise/fall t nmir , t nmif 200 ns 26.5 res setup time* t ress 35 ns 26.4, mres setup time* t mress 35 ns 26.5 nmi setup time* t nmis 35 ns irq7 irq0 setup time (edge detection) t irqes 35 ns irq7 irq0 setup time (level detection) t irqls 35 ns nmi hold time t nmih 35 ns 26.5 irq7 irq0 hold time t irqeh 35 ns irqout output delay time t irqod 35 ns 26.6 bus request setup time t brqs 35 ns 26.7 bus acknowledge delay time 1 t backd1 ?5ns bus acknowledge delay time 2 t backd2 ?5ns bus three-state delay time t bzd ?5ns note: the res , mres , nmi, and irq7 irq0 signals are asynchronous inputs, but when thesetup times shown here are provided, the signals are considered to have produced changes at clock rise (for res and mres ) or clock fall (for nmi and irq7 irq0 ). if the setup times are not provided, recognition is delayed until the next clock rise or fall.
783 ck res mres t resf t resw t mresw t resr t ress t mress t mress t ress v ih v ih v ih v il v il v il v il figure 26.4 reset input timing t nmih t nmis t nmir, t nmif v ih v il t irqeh t irqes v ih v il t irqls ck nmi irq edge irq level figure 26.5 interrupt signal input timing
784 t irqod t irqod ck irqout figure 26.6 interrupt signal output timing ck rd , rdwr, ras , casxx , csn , wrxx a21ea0, d31ed0 t brqs t brqs t backd1 t backd2 t bzd t bzd breq (input) note: during the bus-release period of a self-refresh, ras , casx , and rdwr are output. back (output) figure 26.7 bus right release timing
785 26.3.3 bus timing table 26.6 bus timing (conditions: v cc = 5.0 v ?10%, av cc = 5.0 v ?10%, av cc = v cc 10%, av ref = 4.5 v ?av cc , v ss = av ss = 0 v, ta = ?20 to +75 c) item symbol min max unit figure address delay time t ad 2* 3 18 ns 26.8, 26.9, 26.11?6.16, 26.19 cs delay time 1 t csd1 2* 3 21 ns 26.8, 26.9, 26.19 cs delay time 2 t csd2 2* 3 21 ns read strobe delay time 1 t rsd1 2* 3 18 ns 26.8, 26.9, read strobe delay time 2 t rsd2 2* 3 18 ns 26.11?6.16, read data setup time t rds * 4 15 ns 26.19 read data hold time t rdh 0ns write strobe delay time 1 t wsd1 2* 3 18 ns write strobe delay time 2 t wsd2 2* 3 18 ns write data delay time t wdd ?5ns write data hold time t wdh 0 10* 2 ns wait setup time t wts 15 ns 26.10, 26.15, wait hold time t wth 0ns 26.19 ras delay time 1 t rasd1 2* 3 18 ns 26.11?6.18 ras delay time 2 t rasd2 2* 3 18 ns cas delay time 1 t casd1 2* 3 18 ns cas delay time 2 t casd2 2* 3 18 ns read data access time t acc * 1 t cyc (n + 2) ?40 ns 26.8, 26.9 access time from read strobe t oe * 1 t cyc (n + 1.5) ?40 ns access time from column address t aa * 1 t cyc (n + 2) ?40 ns 26.11?6.16 access time from ras t rac * 1 t cyc (n + rcd + 2.5) ?40 ns access time from cas t cac * 1 t cyc (n + 1) ?40 ns row address hold time t rah t cyc (rcd + 0.5) ?15 ns row address setup time t asr * 5 t cyc 0.5?7.5 ns data input setup time t ds t cyc (m + 0.5) ?25 ns data input hold time t dh 20 ns
786 table 26.7 bus timing (conditions: v cc = 5.0 v ?10%, av cc = 5.0 v ?10%, av cc = v cc 10%, av ref = 4.5? to av cc , v ss = av ss = 0 v, ta = ?20 to +75 c) item symbol min max unit figure write address setup time t as 0 ns 26.8?6.9 write address hold time t wr 5 ns 26.8, 26.9, 26.19 write data hold time t wrh 0ns read/write strobe delay time 1 t rwd1 2* 3 18 ns 26.11?6.16 read/write strobe delay time 2 t rwd2 2* 3 18 ns high-speed page mode cas precharge time t cp t cyc ?25 ns 26.16 ras precharge time t rp t cyc (tpc + 1.5) ?15 ns 26.11?6.16 cas setup time t csr 10 ns 26.17, 26.18 ah delay time 1 t ahd1 2* 3 18 ns 26.19 ah delay time 2 t ahd2 2* 3 18 ns multiplex address delay time t mad 2* 3 18 ns multiplex address hold time t mah 0ns dack delay time t dackd1 2* 3 21 ns 26.8, 26.9, 26.11 26.16, 26.19 notes: n is the number of waits. m is 0 when the number of dram write cycle waits is 0, and 1 otherwise. rcd is the set value of the rcd bit in dcr. tpc is the set value of the tpc bit in dcr. 1. if the access time is satisfied, t rds need not be satisfied. 2. t wdh (max) is a reference value. 3. the delay time min values are reference values (typ). 4. t rds is a reference value. 5. when 28.7mhz, tasr=0ns (min)
787 t1 t2 ck a21?0 dackn t dackd1 t dackd1 t wdh t wdd t wsd1 t wsd2 t acc t rds t rdh t rsd1 t oe t rsd2 t csd2 t csd1 t ad t as t wr t wrh csn note: t rdh is specified from fastest negate timing of a21ea0, csn and rd . (during read) (during read) rd d31ed0 d31ed0 wrxx (during write) (during write) figure 26.8 basic cycle (no waits)
788 ck a21?0 dackn t1 tw t2 t ad t csd1 t rsd1 t wsd1 t wdd t dackd1 t rsd2 t csd2 t rds t rdh t wsd2 t wdh t dackd1 t oe t acc t as t wrh t wr note : t rdh is specified from fastest negate timing of a21?0, csn and rd . csn rd d31ed0 d31ed0 (during read) (during read) (during write) (during write) wrxx figure 26.9 basic cycle (software waits)
789 ck a21?0 t1 tw two tw t2 t wts t wth t wts t wth csn rd wrxx wait dackn (during read) (during read) (during write) (during write) d31ed0 d31ed0 figure 26.10 basic cycle (2 software waits + wait due to wait signal)
790 tp tr tc1 tc2 t ad t ad t asr t rp t rasd1 t rah t casd1 t cac t aa t rac t rds t rasd2 t casd2 t rdh t rwd1 t casd2 t casd1 t rwd2 t wdh t dh t ds t wdd t dackd1 t dackd1 t rsd1 t rsd2 t wsd1 t wsd2 ck a21?0 ras casxx rdwr d31e d0 d31ed0 casxx rdwr dackn rd wrxx note : t rdh is specified from fastest negate timing of a21ea0, ras and cas . (during read) (during read) (during read) (during read) (during write) (during write) (during write) (during write) row address column address figure 26.11 dram cycle (normal mode, no waits, tpc = 0, rcd = 0)
791 tp ck a21?0 tr tc1 tcw1 tc2 t ad t ad t rp t rasd1 t asr t casd1 t rah t rasd2 t casd2 t cac t rac t aa t rds t rdh t casd2 t rwd2 t wdh t dh t ds t wdd t dackd1 t dackd1 t rsd1 t wsd1 t wsd2 t rsd2 t casd1 t rwd1 row address column address ras casxx rdwr d31ed0 casxx rdwr d31ed0 dackn rd wrxx note : t rdh is specified from fastest negate timing of a21ea0, ras and cas . (during read) (during read) (during read) (during read) (during write) (during write) (during write) (during write) figure 26.12 dram cycle (normal mode, 1 wait, tpc = 0, rcd = 0)
792 ck a21?0 tp tpw tr trw tc1 tcw1 tcw2 tc2 t ad t ad t asr t rasd1 t rah t rp t casd1 t cac t aa t rac t rds t rdh t casd2 t casd1 t rwd2 t rwd1 t dh t ds t wdh t dackd1 t dackd1 t wdd t rsd1 t rsd2 t wsd1 t wsd2 t rasd2 t casd2 ras casxx rdwr d31ed0 casxx rdwr d31ed0 dackn rd wrxx (during read) (during read) (during read) (during read) (during write) (during write) (during write) (during write) row address column address note : t rdh is specified from fastest negate timing of a21ea0, ras and cas . figure 26.13 dram cycle (normal mode, 2 waits, tpc = 1, rcd = 1) ck a21?0 tp tpw tr trw tc1 tcw1 tcw2 tcw3 tc2 t ad t ad t rah t asr t rp t casd1 t cac t aa t casd1 t rds t casd2 trwd2 t rwd1 t ds t dh t wdh t dackd1 t rsd1 t wsd1 t wsd2 t rsd2 t dackd1 t rasd2 t casd2 t wdd ras casxx rdwr d31ed0 casxx rdwr d31ed0 dackn rd wrxx (during read) (during read) (during read) (during read) (during write) (during write) (during write) (during write) row address column address t rasd1 t rdh t rac note : t rdh is specified from fastest negate timing of a21ea0, ras and cas . figure 26.14 dram cycle (normal mode, 3 waits, tpc = 1, rcd = 1)
793 ck a21?0 tp tr tc1 tcw1 tcw2 tcwo tc2 t ad t ad t asr t rah t rasd1 t rp t casd1 t cac t aa t rac t rdh t casd2 t rwd2 t casd1 t wdh t dh t ds t rwd1 t wdd t wts t wth t wts t wth t dackd1 t rsd2 t wsd2 t wsd1 t rsd1 t rasd2 t dackd1 t casd2 t rds ras casxx rdwr d31?0 casxx rdwr d31?0 dackn rd wrxx wait (during read) (during read) (during read) (during read) (during write) (during write) (during write) (during write) row address column address note : t rdh is specified from fastest negate timing of a21?0, ras and cas. figure 26.15 dram cycle (normal mode, 2 waits + wait due to wait signal)
794 ck a21?0 tp tr tc1 tc2 tc1 tc2 t ad t ad t asr t rasd1 t rah t rp t casd1 t casd2 t casd1 t casd2 t rasd2 t cp t aa t cac t aa t rac t rds t rdh t rds t rdh t cac t casd1 t casd2 t casd1 t casd2 t rwd2 t rwd1 t rwd2 t rwd1 t dh t ds t wdd t wdh t wdd t wdh t dh t ds t cp t dackd1 t dackd1 t rsd1 t wsd1 t wsd2 t wsd1 t wsd2 t rsd2 t rsd1 t rsd2 t dackd1 ras casxx rdwr d31ed0 casxx rdwr d31ed0 dackn rd wrxx (during read) (during read) (during read) (during read) (during write) (during write) (during write) (during write) note : t rdh is specified from fastest negate timing of a21ea0, ras and cas . row address column address column address figure 26.16 dram cycle (high-speed page mode) ck rdwr trp trr1 trr2 trc trc t rasd1 t rasd2 t casd2 t csr t casd1 ras casxx figure 26.17 cas before ras refresh (tras1 = 0, tras0 = 0)
795 ck ras casxx rdwr trcc t rasd2 t casd2 t csr t casd1 trp trr1 trr2 t rasd1 trc figure 26.18 self refresh ck a21?0 dackn ta1 ta2 ta3 ta4 t1 tw two t2 t ad t csd1 t csd2 t ahd1 t ahd2 t rsd2 t mah t mad t rds t rdh t mah t wdd t mad t wdh t dackd1 t dackd1 t wts t wth t wts t wth t wsd2 t wr t wrh t rsd1 cs3 ah d15ed0 wait d15ed0 rd wrxx (during read) address address (during read) (during write) (during write) t wsd1 note : t rdh is specified from fastest negate timing of a21ea0, cs3 and rd . figure 26.19 address data multiplex i/o space cycle (1 software wait + external wait)
796 26.3.4 direct memory access controller timing table 26.8 direct memory access controller timing (conditions: v cc = 5.0 v ?10%, av cc = 5.0 v ?10%, av cc = v cc ?10%, av ref = 4.5 v to av cc , v ss = av ss = 0 v, ta = ?20 to +75 c) item symbol min max unit figure dreq0 and dreq1 setup time t drqs 18 ns 26.20 dreq0 and dreq1 hold time t drqh 18 ns dreq0 and dreq1 pulse width t drqw 1.5 t cyc 26.21 drak output delay time t drakd 18 ns 26.22 ck t drqs t drqs t drqs t drqh dreq0 dreq1 level clear dreq0 dreq1 level dreq0 dreq1 edge figure 26.20 dreq0 and dreq1 input timing (1)
797 ck t drqw dreq0 dreq1 edge figure 26.21 dreq0 and dreq1 input timing (2) ck t drakd t drakd drakn figure 26.22 drak output delay time
798 26.3.5 multifunction timer pulse unit timing table 26.9 multifunction timer pulse unit timing (conditions: v cc = 5.0 v ?10%, av cc = 5.0 v ?10%, av cc ? v cc ?10%, av ref = 4.5 v to av cc , v ss = av ss = 0?, ta = ?20 to +75 c) item symbol min max unit figure output compare output delay time t tocd 100 ns 26.23 input capture input setup time t tics 30 ns timer input setup time t tcks 35 ns timer clock pulse width (single edge specification) t tckwh/l 1.5 t cyc 26.24 timer clock pulse width (both edges specified) t tckwh/l 2.5 t cyc timer clock pulse width (phase measurement mode) t tckwh/l 2.5 t cyc ck t tocd t tics input capture input output compare output figure 26.23 mtu i/o timing ck tclka to tclkd t tcks t tcks t tckwh t tckwl figure 26.24 mtu clock input timing
799 26.3.6 i/o port timing table 26.10 i/o port timing (conditions: v cc = 5.0 v ?10%, av cc = 5.0 v ?10%, av cc = v cc ?10%, av ref = 4.5 v to av cc , v ss = av ss = 0 v, ta = ?20 to +75 c) item symbol min max unit figure port output data delay time t pwd 100 ns 26.25 port input hold time t prh 35 ns port input setup time t prs 35 ns t prs t prh t pwd t1 t2 ck port (read) port (write) figure 26.25 i/o port i/o timing
800 26.3.7 watchdog timer timing table 26.11 watchdog timer timing (conditions: v cc = 5.0 v ?10%, av cc = 5.0 v ?10%, av cc = v cc ?10%, av ref = 4.5 v to av cc , v ss = av ss = 0 v, ta = ?20 to +75 c) item symbol min max unit figure wdtovf delay time t wovd 100 ns 26.26 ck t wovd wdtovf t wovd figure 26.26 watchdog timer timing
801 26.3.8 serial communication interface timing table 26.12 serial communication interface timing (conditions: v cc = 5.0 v ?10%, av cc = 5.0 v ?10%, av cc = v cc ?10%, av ref = 4.5 v to av cc , v ss = av ss = 0?, ta = ?20 to +75 c) item symbol min max unit figure input clock cycle t scyc 4t cyc 26.27 input clock cycle (clock sync) t scyc 6t cyc input clock pulse width t sckw 0.4 0.6 t scyc input clock rise time t sckr 1.5 t cyc input clock fall time t sckf 1.5 t cyc transmit data delay time (clock sync) t txd 100 ns 26.28 receive data setup time (clock sync) t rxs 100 ns receive data hold time (clock sync) t rxh 100 ns t sckw t sckr t sckf t scyc sck0, sck1 figure 26.27 input clock timing t scyc t txd t rxs t rxh sck0, sck1 txd0, txd1 (transmit data) rxd0, rxd1 (receive data) figure 26.28 sci i/o timing (clock sync mode)
802 26.3.9 high-speed a/d converter timing (excluding a mask) table 26.13 high-speed a/d converter timing (conditions: v cc = 5.0 v ?10%, av cc = 5.0 v ?10%, av cc = v cc ?10%, av ref = 4.5 v to av cc , v ss = av ss = 0 v, ta = ?20 to +75 c) item symbol min typ max unit figure external trigger input pulse width t trgw 2t cyc 26.29 external trigger input start delay time t trgs 50 ns a/d conversion start delay time cks = 0 t d 1.5 1.5 1.5 t cyc 26.30 cks = 1 1.5 1.5 1.5 input sampling time cks = 0 t spl 20 20 20 cks = 1 40 40 40 a/d conversion time cks = 0 t conv 42.5 42.5 42.5 cks = 1 82.5 82.5 82.5 t trgs ck adcr t trgw t trgw adtrg input 1 state figure 26.29 external trigger input timing
803 adf t d t d t spl t conv t cp t spl t cp t conv adst : a/d conversion start delay time : input sampling time : a/d conversion time : operation time address write signal sampling timing figure 26.30 analog conversion timing
804 26.3.10 mid-speed converter timing (a mask) table 26.14 shows mid-speed converter timing table 26.14 mid-speed converter timing (conditions:vcc=5.0v ?10%, avcc=5.0v ?10%, avcc=vcc ?10%, avref=4.5v to avcc, vss=avss=0v, ta=-20 to ?75 c) item symbol min typ max unit figure external trigger input pulse width t trgw 2t cyc 26.31 external trigger input start delay time t trgs 50 ns a/d conversion start delay time cks = 0 t d 10 ?7t cyc 26.32 cks = 1 6 9 input sampling time cks = 0 t spl ?4 cks = 1 32 a/d conversion time cks = 0 t conv 259 266 cks = 1 131 134 t trgs ck adcr adtrg input t trgw t trgw 1 state figure 26.31 external trigger input timing
805 adf t d t spl t conv t d t spl t conv : adcsr write cycle : adcsr address : a/d conversion start delay time : input sampling time : a/d conversion time address write signal input sampling timing ck (1) (2) legend: (1) (2) figure 26.32 analog conversion timing
806 26.3.11 measuring conditions for ac characteristics input reference levels: ? high level: 2.2 v ? low level: 0.8 v output reference levels: ? high level: 2.0 v ? low level: 0.8 v i ol v ref c l i oh v lsi output pin dut output c l is set with the following pins, including the total capacitance of the measurement equipment etc: note: 30 pf: 50 pf: 70 pf: i ol , i oh : ck, ras , casxx , rdwr, cs0 e cs3 , ah , breq , back , dack0, dack1, and irqout a21ea0, d31ed0, rd , wrxx port output and peripheral module output pins other than the above. see table 26.3, permitted output current values. figure 26.33 output test circuit
807 26.4 a/d converter characteristics table 26.15 a/d converter timing (excluding a mask) (conditions: v cc = 5.0 v ?10%, av cc = 5.0 v ?10%, av cc = v cc ?10%, av ref = 4.5 v to av cc , v ss = av ss = 0 v, ta = ?20 to +75 c) 28.7 mhz item min typ max unit resolution 10 10 10 bits conversion time (when cks = 1) 2.9 ? analog input capacitance 20 pf permitted signal source impedance 1 k w non-linear error* ? lsb offset error* ? lsb full-scale error* ? lsb quantization error* ?.5 lsb absolute error (when cks = 1) ?5 lsb note: reference values table 26.16 a/d converter timing (a mask) (condition: vcc=5.0 ?10%, avcc=5.0 ?10%, avcc=vcc ?10%, avref=4.5v to avcc, vss=avss=0v, ta=-20 to +75 c) 28.7 mhz 20 mhz item min typ max min typ max unit resolution 10 10 10 10 10 10 bits conversion time (when cks=0) 9.3 13.4 ? analog input capacity 20 20 pf permission signal source impedance 1 1 k w non-linearity error ? ? lsb offset error ? ? lsb full scale error ? ? lsb quantize error ?.5 ?.5 lsb absolute error ? ? lsb note: reference value
809 section 27 electrical characteristics (3.3v, 16.7 mhz version) 27.1 absolute maximum ratings table 27.1 absolute maximum ratings item symbol rating unit power supply voltage v cc ?.3 to +7.0 v programmable voltage (ztat version only) v pp ?.3 to +13.5 v input voltage (other than a/d ports) v in ?.3 to v cc + 0.3 v input voltage (a/d ports) v in ?.3 to av cc + 0.3 v analog supply voltage av cc ?.3 to +7.0 v analog reference voltage (qfp-144 only) av ref ?.3 to av cc + 0.3 v analog input voltage v an ?.3 to av cc + 0.3 v operating temperature t opr ?0 to +75 ? programming temperature (ztat version only) t we ?0 to +75 ? storage temperature t stg ?5 to +125 ? note: operating the lsi in excess of the absolute maximum ratings may result in permanent damage.
810 27.2 dc characteristics table 27.2 dc characteristics (conditions: v cc = 3.0* 4 to 3.6v, av cc = 3.0* 4 to 3.6v, av cc = v cc ?10%, av ref = 3.0* 4 to av cc , v ss = av ss = 0v, t a = ?0 to +75 c) item pin symbol min typ max unit measurement conditions input high- level voltage res , nmi, md3?, pa2, pa5, pa6?a9, pa0?e15, fwp v ih v cc 0.9 v cc + 0.3 v extal v cc 0.9 v cc + 0.3 v a/d port v cc 0.7 av cc + 0.3 v other input pins v cc 0.7 v cc + 0.3 v input low- level voltage res , nmi, md3?, pa2, pa5, pa6?a9, pa0?e15, fwp v il ?.3 v cc 0.1 v other input pins ?.3 v cc 0.2 v schmitt trigger input voltage pa2, pa5, pa6 pa9, pe0?e15 v t + v t v cc 0.7 v vt + v cc 0.9v (min) vt v cc 0.2v (max) input leak current res , nmi, md3 0, pa2, pa5, pa6?a9, pe0 pe15,fwp | l in | 1.0 m av in = 0.5 to v cc ?0.5v a/d port 1.0 m av in = 0.5 to av cc ?0.5v other input pins (except extal pin) 1.0 m av in = 0.5 to v cc ?0.5v three?tate leak current (while off) a21?0, d31 d0, cs3 cs0 , rdwr, ras , casxx , wrxx , rd , ports a, b, c, d, e | l ts l | 1.0 m av in = 0.5 to v cc ?0.5v
811 table 27.2 dc characteristics (conditions: v cc = 3.0* 1 to 3.6v, av cc = 3.0* 1 to 3.6v, av cc = v cc ?10%, av ref = 3.0* 1 to av cc , v ss = av ss = 0v, t a = ?0 to +75 c) (cont) item pin symbol min typ max unit measurement conditions output all output pins v oh v cc ?0.5 vi oh = ?00 ? high-level voltage v cc ?1.0 v i oh = ?ma output low- level voltage all output pins v ol 0.4 v i ol = 1.6ma input res c in 80* 5 pf vin= 0v capaci- nmi 50 pf f = 1 mhz tance all other input pins 20 pf ta = 25 c current consump- during normal operations i cc 80 130 ma f = 16.7mhz tion during sleep mode 70 110 ma f = 16.7mhz during standby mode 0.01 5 m a t a 50 c 20 m a 50 c < ta analog supply ai cc ?8 ma f = 16.7mhz current ai ref 0.5 1 ma qfp144 version only ram standby voltage v ram 2.0 v notes: 1. do not release av cc , av ss and av ref (sh7041, sh7043 and sh7045 only) pins when not using the a/d converter (including standby). connect av cc (sh7041,sh7043,sh7045 only) and av ref (sh7041, sh7043 and sh7045 only) pins to v cc and av ss pin to v ss . 2. the value for consumed current is with conditions of v ih min = v cc ?0.5v and v il max = 0.5v, with no burden on any of the output pins. 3. the ztat and mask versions have the same functions, and the electrical characteristics of both are within specification, but characteristic-related performance values, operating margins, noise margins, noise emission, etc., are different. caution is therefore required in carrying out system design, and when switching between ztat and mask versions. 4. sh7042/43 ztat (excluding a mask) are 3.2 v. 5. 110pf for a mask
812 table 27.3 permitted output current values (conditions: v cc = 3.0* 2 to 3.6v, av cc = 3.0* 1 to 3.6v, av cc = v cc ?10%, av ref = 3.0* 2 to av cc , v ss = av ss = 0v, t a = ?0 to +75 c) item symbol min typ max unit output low-level permissible current (per pin) i ol 2.0 ma output low-level permissible current (total) i ol 80ma output high-level permissible current (per pin) ? oh 2.0 ma output high-level permissible current (total) (? oh )25ma notes: 1. to assure lsi reliability, do not exceed the output values listed in this table. 2. sh7042/43 ztat (excluding a mask) are 3.2v. 27.3 ac characteristics 27.3.1 clock timing table 27.4 clock timing (conditions: v cc = 3.0* 1 to 3.6v, av cc = 3.0* to 3.6v, av cc = v cc ?10%, av ref = 3.0* 1 to av cc , v ss = av ss = 0v, t a = ?0 to +75 c) item symbol min max unit figures operating frequency f op 4 16.7 mhz 27.1 clock cycle time t cyc 60 250 ns clock low-level pulse width t cl 10 ns clock high-level pulse width t ch 10 ns clock rise time t cr ? ns clock fall time t cf ? ns extal clock input frequency f ex 4 10 mhz 27.2 extal clock input cycle time t excyc 100 250 ns extal clock low-level input pulse width t exl 40 ns extal clock high-level input pulse width t exh 40 ns extal clock input rise time t exr ? ns extal clock input fall time t exf ? ns reset oscillation settling time t osc1 10 ms 27.3 standby return clock settling time t osc2 10 ms note: sh7042/43 ztat (excluding a mask) are 3.2v.
813 t cyc t cl t ch 1/2v cc 1/2v cc t cf t cr ck figure 27.1 system clock timing t excyc t exl t exh v ih v ih 1/2v cc v il v il 1/2v cc t exf t exr extal v ih figure 27.2 extal clock input timing t osc1 v cc min t osc2 ck v cc res figure 27.3 oscillation settling time
814 27.3.2 control signal timing table 27.5 control signal timing (conditions: v cc = 3.0* 1 to 3.6v, av cc = 3.0* 1 to 3.6v, av cc = v cc ?10%, av ref = 3.0* 1 to av cc , v ss = av ss = 0v, t a = ?0 to +75 c) item symbol min max unit figure res rise/fall t resr , t resf 200 ns 27.4 res pulse width t resw 20 t cyc mres pulse width t mresw 20 t cyc nmi rise/fall t nmir , t nmif 200 ns 27.5 res setup time * 2 t ress 100 ns 27.4 mres setup time * 2 t mress 100 ns 27.5 nmi setup time (during edge detection) t nmis 100 ns irq7 irq0 setup time (edge detection) t irqes 100 ns irq7 irq0 setup time (level detection) t irqls 100 ns nmi hold time t nmih 50 ns 27.5 irq7 irq0 hold time t irqeh 50 ns irqout output delay time t irqod 50 ns 27.6 bus request setup time t brqs 35 ns 27.7 bus acknowledge delay time 1 t backd1 ?5ns bus acknowledge delay time 2 t backd2 ?5ns bus three state delay time t bzd ?5ns notes: 1. sh7042/43 ztat (excluding a mask) are 3.2v. 2. the res , mres , nmi, and irq7 irq0 signals are asynchronous inputs, but when the setup times shown here are provided, the signals are considered to have produced changes at clock rise (for res and mres ) or clock fall (for nmi and irq7 irq0 ). if the setup times are not provided, recognition is delayed until the next clock rise or fall.
815 ck res mres t resf t resw t mresw t resr t ress t mress t mress t ress v ih v ih v ih v il v il v il v il figure 27.4 reset input timing t nmih t nmis t nmir, t nmif v ih v il t irqeh t irqes v ih v il t irqls ck nmi irq edge irq level figure 27.5 interrupt signal input timing
816 t irqod t irqod ck irqout figure 27.6 interrupt signal output timing ck rd , rdwr, ras , casxx , csn , wrxx a21ea0, d31ed0 t brqs t brqs t backd1 t backd2 t bzd t bzd breq (input) note: during the bus-release period of a self-refresh, ras , casx , and rdwr are output. back (output) figure 27.7 bus right release timing
817 27.3.3 bus timing table 27.6 bus timing (conditions: v cc = 3.0* 1 to 3.6v, av cc = 3.0* 1 to 3.6v, av cc = v cc ?10%, av ref = 3.0* 1 to av cc , v ss = av ss = 0v, t a = ?0 to +75 c) item symbol min max unit figure address delay time t ad 3* 4 35 ns 27.8, 9, 11?6, 19 cs delay time 1 t csd1 3* 4 35 ns 27.8, 9, 19 cs delay time 2 t csd2 3* 4 35 ns read strobe delay time 1 t rsd1 3* 4 35 ns 27.8, 9, 11?6, 19 read strobe delay time 2 t rsd2 3* 4 35 ns read data setup time t rds * 5 25 ns read data hold time t rdh 0ns write strobe delay time 1 t wsd1 3* 4 35 ns write strobe delay time 2 t wsd2 3* 5 35 ns write data delay time t wdd ?5ns write data hold time t wdh 0 25* 3 ns wait setup time t wts 15 ns 27.10,15, 19 wait hold time t wth 0ns ras delay time 1 t rasd1 3* 4 35 ns 27.11?8 ras delay time 2 t rasd2 3* 4 35 ns cas delay time 1 t casd1 3* 4 35 ns cas delay time 2 t casd2 3* 4 35 ns read data access time t acc * 2 t cyc (n+2) ?45 ns 27.8, 9 access time from read strobe t oe * 2 t cyc (n+1.5) ?40 ns access time from column address t aa * 2 t cyc (n+2) ?45 ns 27.11?6 access time from ras t rac * 2 t cyc (n+rcd+2.5) ?40 ns access time from cas t cac * 2 t cyc (n+1) ?40 ns row address hold time t rah t cyc (rcd+0.5) ?15 ns row address setup time t asr 0ns data input setup time t ds t cyc (m+0.5) ?27 ns data input hold time t dh 20 ns notes: n is the wait number. m is 1 unless the dram write cycle wait number is 0, then m is 0. rcd is the set value of the rcd bit of dcr. 1. sh7042/43 ztat (excluding a mask) are 3.2v. 2. if the access time is satisfied, then the t rds need not be satisfied. 3. t wdh (max) is a reference value. 4. the delay time min values are reference values (typ). 5. t rds is a reference value.
818 table 27.7 bus timing (conditions: v cc = 3.0* 1 to 3.6v, av cc = 3.0* 1 to 3.6v, av cc = v cc ?10%, av ref = 3.0* 1 to av cc , v ss = av ss = 0v, t a = ?0 to +75 c) item symbol min max unit figure write address setup time t as 0 ns 27.8, 9 write address hold time t wr 5 ns 27.8, 9, 19 write data hold time t wrh 0ns read/write strobe delay time 1 t rwd1 3* 2 27 ns 27.11?6 read/write strobe delay time 2 t rwd2 3* 2 27 ns high-speed page mode cas t cp t cyc ?5 ns 27.16 ras precharge time t rp t cyc (tpc+1.5) ?0 ns 27.11?6 cas setup time t csr 10 ns 27.17, 18 ah delay time 1 t ahd1 3* 3 40 ns 27.19 ah delay time 2 t ahd2 3* 3 40 ns multiplex address delay time t mad 3* 3 35 ns multiplex address hold time t mah 0ns dack delay time 1 t dackd1 3* 3 45 ns 27.8, 9, 11?6,19 notes: tpc is the set value of the tpc bit in dcr. 1. sh7042/43 ztat (excluding a mask) are 3.2v 2. min values for delay time are reference values (typ)
819 t1 t2 ck a21?0 dackn t dackd1 t dackd1 t wdh t wdd t wsd1 t wsd2 t acc t rds t rdh t rsd1 t oe t rsd2 t csd2 t csd1 t ad t as t wr t wrh csn note: t rdh is specified from fastest negate timing of a21ea0, csn and rd . (during read) (during read) rd d31ed0 d31ed0 wrxx (during write) (during write) figure 27.8 basic cycle (no waits)
820 ck a21?0 dackn t1 tw t2 t ad t csd1 t rsd1 t wsd1 t wdd t dackd1 t rsd2 t csd2 t rds t rdh t wsd2 t wdh t dackd1 t oe t acc t as t wrh t wr note : t rdh is specified from fastest negate timing of a21?0, csn and rd . csn rd d31ed0 d31ed0 (during read) (during read) (during write) (during write) wrxx figure 27.9 basic cycle (software waits)
821 ck a21?0 t1 tw two tw t2 t wts t wth t wts t wth csn rd wrxx wait dackn (during read) (during read) (during write) (during write) d31ed0 d31ed0 figure 27.10 basic cycle (2 software waits + wait due to wait signal)
822 tp tr tc1 tc2 t ad t ad t asr t rp t rasd1 t rah t casd1 t cac t aa t rac t rds t rasd2 t casd2 t rdh t rwd1 t casd2 t casd1 t rwd2 t wdh t dh t ds t wdd t dackd1 t dackd1 t rsd1 t rsd2 t wsd1 t wsd2 ck a21?0 ras casxx rdwr d31e d0 d31ed0 casxx rdwr dackn rd wrxx note : t rdh is specified from fastest negate timing of a21ea0, ras and cas . (during read) (during read) (during read) (during read) (during write) (during write) (during write) (during write) row address column address figure 27.11 dram cycle (normal mode, no wait, tpc = 0, rcd = 0)
823 tp ck a21?0 tr tc1 tcw1 tc2 t ad t ad t rp t rasd1 t asr t casd1 t rah t rasd2 t casd2 t cac t rac t aa t rds t rdh t casd2 t rwd2 t wdh t dh t ds t wdd t dackd1 t dackd1 t rsd1 t wsd1 t wsd2 t rsd2 t casd1 t rwd1 row address column address ras casxx rdwr d31ed0 casxx rdwr d31ed0 dackn rd wrxx note : t rdh is specified from fastest negate timing of a21ea0, ras and cas . (during read) (during read) (during read) (during read) (during write) (during write) (during write) (during write) figure 27.12 dram cycle (normal mode, 1 wait, tpc = 0, rcd = 0)
824 ck a21?0 tp tpw tr trw tc1 tcw1 tcw2 tc2 t ad t ad t asr t rasd1 t rah t rp t casd1 t cac t aa t rac t rds t rdh t casd2 t casd1 t rwd2 t rwd1 t dh t ds t wdh t dackd1 t dackd1 t wdd t rsd1 t rsd2 t wsd1 t wsd2 t rasd2 t casd2 ras casxx rdwr d31ed0 casxx rdwr d31ed0 dackn rd wrxx (during read) (during read) (during read) (during read) (during write) (during write) (during write) (during write) row address column address note : t rdh is specified from fastest negate timing of a21ea0, ras and cas . figure 27.13 dram cycle (normal mode, 2 waits, tpc = 1, rcd = 1) ck a21?0 tp tpw tr trw tc1 tcw1 tcw2 tcw3 tc2 t ad t ad t rah t asr t rp t casd1 t cac t aa t casd1 t rds t casd2 trwd2 t rwd1 t ds t dh t wdh t dackd1 t rsd1 t wsd1 t wsd2 t rsd2 t dackd1 t rasd2 t casd2 t wdd ras casxx rdwr d31ed0 casxx rdwr d31ed0 dackn rd wrxx (during read) (during read) (during read) (during read) (during write) (during write) (during write) (during write) row address column address t rasd1 t rdh t rac note : t rdh is specified from fastest negate timing of a21ea0, ras and cas . figure 27.14 dram cycle (normal mode, 3 waits, tpc = 1, rcd = 1)
825 ck a21?0 tp tr tc1 tcw1 tcw2 tcwo tc2 t ad t ad t asr t rah t rasd1 t rp t casd1 t cac t aa t rac t rdh t casd2 t rwd2 t casd1 t wdh t dh t ds t rwd1 t wdd t wts t wth t wts t wth t dackd1 t rsd2 t wsd2 t wsd1 t rsd1 t rasd2 t dackd1 t casd2 t rds ras casxx rdwr d31ed0 casxx rdwr d31ed0 dackn rd wrxx wait (during read) (during read) (during read) (during read) (during write) (during write) (during write) (during write) row address column address note : t rdh is specified from fastest negate timing of a21ea0, ras and cas . figure 27.15 dram cycle (normal mode, 2 waits + wait due to wait signal)
826 ck a21?0 tp tr tc1 tc2 tc1 tc2 t ad t ad t asr t rasd1 t rah t rp t casd1 t casd2 t casd1 t casd2 t rasd2 t cp t aa t cac t aa t rac t rds t rdh t rds t rdh t cac t casd1 t casd2 t casd1 t casd2 t rwd2 t rwd1 t rwd2 t rwd1 t dh t ds t wdd t wdh t wdd t wdh t dh t ds t cp t dackd1 t dackd1 t rsd1 t wsd1 t wsd2 t wsd1 t wsd2 t rsd2 t rsd1 t rsd2 t dackd1 ras casxx rdwr d31ed0 casxx rdwr d31ed0 dackn rd wrxx (during read) (during read) (during read) (during read) (during write) (during write) (during write) (during write) note : t rdh is specified from fastest negate timing of a21ea0, ras and cas . row address column address column address figure 27.16 dram cycle (high-speed page mode) ck rdwr trp trr1 trr2 trc trc t rasd1 t rasd2 t casd2 t csr t casd1 ras casxx figure 27.17 cas before ras refresh (tras1 = 0, tras0 = 0)
827 ck ras casxx rdwr trcc t rasd2 t casd2 t csr t casd1 trp trr1 trr2 t rasd1 trc figure 27.18 self refresh ck a21?0 dackn ta1 ta2 ta3 ta4 t1 tw two t2 t ad t csd1 t csd2 t ahd1 t ahd2 t rsd2 t mah t mad t rds t rdh t mah t wdd t mad t wdh t dackd1 t dackd1 t wts t wth t wts t wth t wsd2 t rsd1 cs3 ah d15ed0 wait d15ed0 rd wrxx (during read) address address (during read) (during write) (during write) t wsd1 note : t rdh is specified from fastest negate timing of a21ea0, cs3 and rd . t wr t wrh figure 27.19 address data multiplex i/o space cycle (1 software wait + external wait)
828 27.3.4 direct memory access controller timing table 27.8 direct memory access controller timing (conditions: v cc = 3.0* to 3.6v, av cc = 3.0* to 3.6v, av cc = v cc ?10%, av ref = 3.0* to av cc , v ss = av ss = 0v, t a = 20 to +75 c) item symbol min max unit figure dreq0 , dreq1 setup time t drqs 35 ns 27.20 dreq0 , dreq1 hold time t drqh 35 ns dreq0 , dreq1 pulse width t drqw 1.5 t cyc 27.21 drak output delay time t drakd 35 ns 27.22 note: sh7042/43 ztat (excluding a mask) are 3.2v. ck t drqs t drqs t drqs t drqh dreq0 dreq1 level clear dreq0 dreq1 level dreq0 dreq1 edge figure 27.20 dreq0 and dreq1 input timing (1)
829 ck t drqw dreq0 dreq1 edge figure 27.21 dreq0 and dreq1 input timing (2) ck t drakd t drakd drakn figure 27.22 drak output delay time
830 27.3.5 multifunction timer pulse unit timing table 27.9 multifunction timer pulse unit timing (conditions:v cc = 3.0* to 3.6v, av cc = 3.0* to 3.6v, av cc = v cc ?10%, av ref = 3.0* to av cc , v ss = av ss = 0v, t a = ?0 to +75 c) item symbol min max unit figure output compare output delay time t tocd 100 ns 27.23 input capture input setup time t tics 100 ns timer input setup time t tcks 100 ns 27.24 timer clock pulse width (single edge specification) t tckwh/l 1.5 t cyc timer clock pulse width (both edges specified) t tckwh/l 2.5 t cyc timer clock pulse width (phase measurement mode) t tckwh/l 2.5 t cyc note: sh7042/43 ztat (excluding a mask) are 3.2v. ck t tocd t tics input capture input output compare output figure 27.23 mtu i/o timing ck tclka to tclkd t tcks t tcks t tckwh t tckwl figure 27.24 mtu clock input timing
831 27.3.6 i/o port timing table 27.10 i/o port timing (conditions:v cc = 3.0* to 3.6v, av cc = 3.0* to 3.6v, av cc = v cc ?10%, av ref = 3.0* to av cc , v ss = av ss = 0v, t a = ?0 to +75 c) item symbol min max unit figure port output data delay time t pwd 100 ns 27.25 port input hold time t prh 100 ns port input setup time t prs 100 ns note: sh7042/43 ztat (excluding a mask) are 3.2v. t prs t prh t pwd t1 t2 ck port (read) port (write) figure 27.25 i/o port i/o timing
832 27.3.7 watchdog timer timing table 27.11 watchdog timer timing (conditions:v cc = 3.0* to 3.6v, av cc = 3.0* to 3.6v, av cc = v cc ?10%, av ref = 3.0* to av cc , v ss = av ss = 0v, t a = ?0 to +75 c) item symbol min max unit figure wdtovf delay time t wovd 100 ns 27.26 note: sh7042/43 ztat (excluding a mask) are 3.2v. ck t wovd wdtovf t wovd figure 27.26 watchdog timer timing
833 27.3.8 serial communication interface timing table 27.12 serial communication interface timing (conditions:v cc = 3.0* to 3.6v, av cc = 3.0* to 3.6v, av cc = v cc ?10%, av ref = 3.0* to av cc , v ss = av ss = 0v, t a = ?0 to +75 c) item symbol min max unit figure input clock cycle t scyc 4t cyc 27.27 input clock cycle (clock sync) t scyc 6t cyc input clock pulse width t sckw 0.5 0.6 t scyc input clock rise time t sckr 1.5 t cyc input clock fall time t sckf 1.5 t cyc transmit data delay time (clock sync) t txd 100 ns 27.28 receive data setup time (clock sync) t rxs 100 ns receive data hold time (clock sync) t rxh 100 ns note: sh7042/43 ztat (excluding a mask) are 3.2v. t sckw t sckr t sckf t scyc sck0, sck1 figure 27.27 input clock timing t scyc t txd t rxs t rxh sck0, sck1 txd0, txd1 (transmit data) rxd0, rxd1 (receive data) figure 27.28 sci i/o timing (clock sync mode)
834 27.3.9 high-speed a/d converter timing (excluding a mask) table 27.13 high-speed a/d converter timing (conditions:v cc = 3.0* to 3.6v, av cc = 3.0* to 3.6v, av cc = v cc ?10%, av ref = 3.0* to av cc , v ss = av ss = 0v, t a = ?0 to +75 c) item symbol min typ max unit figure external trigger input pulse width t trgw 2t cyc 27.29 external trigger input start delay time t trgs 50 ns a/d conversion start delay time cks = 0 t d 1.5 1.5 1.5 t cyc 27.30 cks = 1 1.5 1.5 1.5 input sampling time cks = 0 t spl 20 20 20 cks = 1 40 40 40 a/d conversion time cks = 0 t conv 42.5 42.5 42.5 cks = 1 82.5 82.5 82.5 note: sh7042/43 ztat (excluding a mask) are 3.2v. t trgs ck adst adtrg input t trgw t trgw 1 state figure 27.29 external trigger input timing
835 adf t d t d t spl t conv t cp t spl t cp t conv adst : a/d conversion start delay time : input sampling time : a/d conversion time : operation time address write signal sampling timing figure 27.30 analog conversion timing
836 27.3.10 mid-speed converter timing (a mask) table 27.14 mid-speed a/d converter timing (conditions:v cc = 3.0* to 3.6v, av cc = 3.0* to 3.6v, av cc = v cc ?10%, av ref = 3.0* to av cc , v ss = av ss = 0v, t a = ?0 to +75 c) item symbol min typ max unit figure external trigger input pulse width t trgw 2t cyc 27.31 external trigger input start delay time t trgs 50 ns a/d conversion start delay time cks = 0 t d 10?7t cyc 27.32 cks = 1 6 9 input sampling time cks = 0 t spl ?4 cks = 1 32 a/d conversion time cks = 0 t conv 259 266 cks = 1 131 134 note: sh7042/43 ztat (excluding a mask) are 3.2v. t trgs ck adst t trgw t trgw adtrg input 1 state figure 27.31 external trigger input timing
837 adf t d t spl t conv t d t spl t conv : adcsr write cycle : adcsr address : a/d conversion start delay time : input sampling time : a/d conversion time address write signal input sampling timing ck (1) (2) legend: (1) (2) figure 27.32 analog conversion timing
838 27.3.11 measurement conditions for ac characteristic input reference levels: ? high level: 2.2 v ? low level: 0.8 v output reference levels: ? high level: 2.0 v ? low level: 0.8 v i ol v ref c l i oh v lsi output pin dut output c l is set with the following pins, including the total capacitance of the measurement equipment etc: note: 30 pf: 50 pf: 70 pf: i ol , i oh : ck, ras , casxx , rdwr, cs0 e cs3 , ah , breq , back , dack0, dack1, and irqout a21ea0, d31ed0, rd , wrxx port output and peripheral module output pins other than the above. see table 27.3, permitted output current values. figure 27.33 output added circuit
839 27.4 a/d converter characteristics table 27.15 a/d converter characteristics (excluding a mask) (conditions:v cc = 3.0* 1 to 3.6v, av cc = 3.0* 1 to 3.6v, av cc = v cc ?10%, av ref = 3.0* 1 to av cc , v ss = av ss = 0v, t a = ?0 to +75 c) 16.7mhz item min typ max unit resolution 10 10 10 bit conversion time (when cks = 1) 5 m s analog input capacity 20 pf permission signal source impedance 1 k w non-linearity error* 2 15 lsb offset error* 2 15 lsb full scale error* 2 15 lsb quantize error* 2 0.5 lsb absolute error 31 lsb notes: 1. sh7042/43 ztat (excluding a mask) are 3.2v. 2. reference values table 27.16 a/d converter characteristics (a mask) (conditions:v cc = 3.0* 1 to 3.6v, av cc = 3.0* 1 to 3.6v, av cc = v cc ?10%, av ref = 3.0* 1 to av cc , v ss = av ss = 0v, t a = ?0 to +75 c) 16.7mhz item min typ max unit resolution 10 10 10 bit conversion time (when cks = 0) 16.0 m s analog input capacity 20 pf permission signal source impedance 1 k w non-linearity error* 2 4 lsb offset error* 2 4 lsb full scale error* 2 4 lsb quantize error* 2 0.5 lsb absolute error 6 lsb notes: 1. sh7042/43 ztat (excluding a mask) are 3.2v. 2. reference values
841 appendix a on-chip supporting module registers a.1 addresses table a.1 on-chip i/o register addresses register bit names address abbr. bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module dtmr sm1 sm0 dm1 dm0 md1 md0 sz1 sz0 dtc dts chne disel nmim dtsar dtdar dtiar dtcra dtcrb h'ffff81a0 smr0 c/ a chr pe o/ e stop mp cks1 cks0 sci h'ffff81a1 brr0 h'ffff81a2 scr0 tie rie te re mpie teie cke1 cke0 h'ffff81a3 tdr0 h'ffff81a4 ssr0 tdre rdrf orer fer per tend mpb mpbt h'ffff81a5 rdr0 h'ffff81a6 to h'ffff81af
842 table a.1 on-chip i/o register addresses (cont) register bit names address abbr. bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module h'ffff81b0 smr1 c/ a chr pe o/ e stop mp cks1 cks0 sci h'ffff81b1 brr1 h'ffff81b2 scr1 tie rie te re mpie teie cke1 cke0 h'ffff81b3 tdr1 h'ffff81b4 ssr1 tdre rdrf orer fer per tend mpb mpbt h'ffff81b5 rdr1 h'ffff81b6 to h'ffff81ff h'ffff8200 tcr3 cclr2 cclr1 cclr0 ckeg1 ckeg0 tpsc2 tpsc1 tpsc0 mtu h'ffff8201 tcr4 cclr2 cclr1 cclr0 ckeg1 ckeg0 tpsc2 tpsc1 tpsc0 h'ffff8202 tmdr3 bfb bfa md3 md2 md1 md0 h'ffff8203 tmdr4 bfb bfa md3 md2 md1 md0 h'ffff8204 tior3h iob3 iob2 iob1 iob0 ioa3 ioa2 ioa1 ioa0 h'ffff8205 tior3l iod3 iod2 iod1 iod0 ioc3 ioc2 ioc1 ioc0 h'ffff8206 tior4h iob3 iob2 iob1 iob0 ioa3 ioa2 ioa1 ioa0 h'ffff8207 tior4l iod3 iod2 iod1 iod0 ioc3 ioc2 ioc1 ioc0 h'ffff8208 tier3 ttge tciev tgied tgiec tgieb tgiea h'ffff8209 tier4 ttge tciev tgied tgiec tgieb tgiea h'ffff820a toer oe4d oe4c oe3d oe4b oe4a oe3b h'ffff820b tocr psye olsn olsp h'ffff820c h'ffff820d tgcr bdc n p fb wf vf uf h'ffff820e h'ffff820f h'ffff8210 tcnt3 h'ffff8211 h'ffff8212 tcnt4 h'ffff8213 h'ffff8214 tcdr h'ffff8215 h'ffff8216 tddr h'ffff8217 h'ffff8218 tgr3a h'ffff8219
843 table a.1 on-chip i/o register addresses (cont) register bit names address abbr. bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module h'ffff821a tgr3b mtu h'ffff821b h'ffff821c tgr4a h'ffff821d h'ffff821e tgr4b h'ffff821f h'ffff8220 tcnts h'ffff8221 h'ffff8222 tcbr h'ffff8223 h'ffff8224 tgr3c h'ffff8225 h'ffff8226 tgr3d h'ffff8227 h'ffff8228 tgr4c h'ffff8229 h'ffff822a tgr4d h'ffff822b h'ffff822c tsr3 tcfd tcfv tgfd tgfc tgfb tgfa h'ffff822d tsr4 tcfd tcfv tgfd tgfc tgfb tgfa h'ffff822e h'ffff822f h'ffff8230 to h'ffff823f h'ffff8240 tstr cst4 cst3 cst2 cst1 cst0 h'ffff8241 tsyr sync4 sync3 sync2 sync1 sync0 h'ffff8242 to h'ffff825f h'ffff8260 tcr0 cclr2 cclr1 cclr0 ckeg1 ckeg0 tpsc2 tpsc1 tpsc0 h'ffff8261 tmdr0 bfb bfa md3 md2 md1 md0 h'ffff8262 tior0h iob3 iob2 iob1 iob0 ioa3 ioa2 ioa1 ioa0 h'ffff8263 tior0l iod3 iod2 iod1 iod0 ioc3 ioc2 ioc1 ioc0 h'ffff8264 tier0 ttge tciev tgied tgiec tgieb tgiea h'ffff8265 tsr0 tcfv tgfd tgfc tgfb tgfa h'ffff8266 tcnt0 h'ffff8267
844 table a.1 on-chip i/o register addresses (cont) register bit names address abbr. bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module h'ffff8268 tgr0a mtu h'ffff8269 h'ffff826a tgr0b h'ffff826b h'ffff826c tgr0c h'ffff826d h'ffff826e tgr0d h'ffff826f h'ffff8270 to h'ffff827f h'ffff8280 tcr1 cclr1 cclr0 ckeg1 ckeg0 tpsc2 tpsc1 tpsc0 h'ffff8281 tmdr1 md3md2md1md0 h'ffff8282 tior1 iob3 iob2 iob1 iob0 ioa3 ioa2 ioa1 ioa0 h'ffff8283 h'ffff8284 tier1 ttge tcieu tciev tgieb tgiea h'ffff8285 tsr1 tcfd tcfu tcfv tgfb tgfa h'ffff8286 tcnt1 h'ffff8287 h'ffff8288 tgr1a h'ffff8289 h'ffff828a tgr1b h'ffff828b h'ffff828c to h'ffff829f h'ffff82a0 tcr2 cclr1 cclr0 ckeg1 ckeg0 tpsc2 tpsc1 tpsc0 h'ffff82a1 tmdr2 md3md2md1md0 h'ffff82a2 tior2 iob3 iob2 iob1 iob0 ioa3 ioa2 ioa1 ioa0 h'ffff82a3 h'ffff82a4 tier2 ttge tcieu tciev tgieb tgiea h'ffff82a5 tsr2 tcfd tcfu tcfv tgfb tgfa h'ffff82a6 tcnt2 h'ffff82a7 h'ffff82a8 tgr2a h'ffff82a9 h'ffff82aa tgr2b h'ffff82ab
845 table a.1 on-chip i/o register addresses (cont) register bit names address abbr. bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module h'ffff82ac to h'ffff8347 mtu h'ffff8348 ipra intc h'ffff8349 h'ffff834a iprb h'ffff834b h'ffff834c iprc h'ffff834d h'ffff834e iprd h'ffff834f h'ffff8350 ipre h'ffff8351 h'ffff8352 iprf h'ffff8353 h'ffff8354 iprg h'ffff8355 h'ffff8356 iprh h'ffff8357 h'ffff8358 icr nmil nmie h'ffff8359 irq0s irq1s irq2s irq3s irq4s irq5s irq6s irq7s h'ffff835a isr h'ffff835b irq0f irq1f irq2f irq3f irq4f irq5f irq6f irq7f h'ffff835c to h'ffff837f h'ffff8380 padrh i/o h'ffff8381 pa23dr pa22dr pa21dr pa20dr pa19dr pa18dr pa17dr pa16dr h'ffff8382 padrl pa15dr pa14dr pa13dr pa12dr pa11dr pa10dr pa9dr pa8dr h'ffff8383 pa7dr pa6dr pa5dr pa4dr pa3dr pa2dr pa1dr pa0dr h'ffff8384 paiorh pfc h'ffff8385 pa23ior pa22ior pa21ior pa20ior pa19ior pa18ior pa17ior pa16ior h'ffff8386 paiorl pa15ior pa14ior pa13ior pa12ior pa11ior pa10ior pa9ior pa8ior h'ffff8387 pa7ior pa6ior pa5ior pa4ior pa3ior pa2ior pa1ior pa0ior h'ffff8388 pacrh pa23md pa22md pa21md pa20md h'ffff8389 pa19md1 pa19md0 pa18md1 pa18md0 pa17md pa16md
846 table a.1 on-chip i/o register addresses (cont) register bit names address abbr. bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module h'ffff838a pfc h'ffff838b h'ffff838c pacrl1 pa15md pa14md pa13md pa12md h'ffff838d pa11md pa10md pa9md1 pa9md0 pa8md1 pa8md0 h'ffff838e pacrl2 pa7md1 pa7md0 pa6md1 pa6md0 pa5md1 pa5md0 pa4md h'ffff838f pa3md pa2md1 pa2md0 pa1md pa0md h'ffff8390 pbdr pb9dr pb8dr i/o h'ffff8391 pb7dr pb6dr pb5dr pb4dr pb3dr pb2dr pb1dr pb0dr h'ffff8392 pcdr pc15dr pc14dr pc13dr pc12dr pc11dr pc10dr pc9dr pc8dr h'ffff8393 pc7dr pc6dr pc5dr pc4dr pc3dr pc2dr pc1dr pc0dr h'ffff8394 pbior pb9ior pb8ior pfc h'ffff8395 pb7ior pb6ior pb5ior pb4ior pb3ior pb2ior pb1ior pb0ior h'ffff8396 pcior pc15ior pc14ior pc13ior pc12ior pc11ior pc10ior pc9ior pc8ior h'ffff8397 pc7ior pc6ior pc5ior pc4ior pc3ior pc2ior pc1ior pc0ior h'ffff8398 pbcr1 h'ffff8399 pb9md1 pb9md0 pb8md1 pb8md0 h'ffff839a pbcr2 pb7md1 pb7md0 pb6md1 pb6md0 pb5md1 pb5md0 pb4md1 pb4md0 h'ffff839b pb3md1 pb3md0 pb2md1 pb2md0 pb1md pb0md h'ffff839c pccr pc15md pc14md pc13md pc12md pc11md pc10md pc9md pc8md h'ffff839d pc7md pc6md pc5md pc4md pc3md pc2md pc1md pc0md h'ffff839e h'ffff839f h'ffff83a0 pddrh pd31dr pd30dr pd29dr pd28dr pd27dr pd26dr pd25dr pd24dr i/o h'ffff83a1 pd23dr pd22dr pd21dr pd20dr pd19dr pd18dr pd17dr pd16dr h'ffff83a2 pddrl pd15dr pd14dr pd13dr pd12dr pd11dr pd10dr pd9dr pd8dr h'ffff83a3 pd7dr pd6dr pd5dr pd4dr pd3dr pd2dr pd1dr pd0dr h'ffff83a4 pdiorh pd31ior pd30ior pd29ior pd28ior pd27ior pd26ior pd25ior pd24ior pfc h'ffff83a5 pd23ior pd22ior pd21ior pd20ior pd19ior pd18ior pd17ior pd16ior h'ffff83a6 pdiorl pd15ior pd14ior pd13ior pd12ior pd11ior pd10ior pd9ior pd8ior h'ffff83a7 pd7ior pd6ior pd5ior pd4ior pd3ior pd2ior pd1ior pd0ior h'ffff83a8 pdcrh1 pd31md1 pd31md0 pd30md1 pd30md0 pd29md1 pd29md0 pd28md1 pd28md0 h'ffff83a9 pd27md1 pd27md0 pd26md1 pd26md0 pd25md1 pd25md0 pd24md1 pd24md0 h'ffff83aa pdcrh2 pd23md1 pd23md0 pd22md1 pd22md0 pd21md1 pd21md0 pd20md1 pd20md0 h'ffff83ab pd19md1 pd19md0 pd18md1 pd18md0 pd17md1 pd17md0 pd16md1 pd16md0
847 table a.1 on-chip i/o register addresses (cont) register bit names address abbr. bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module h'ffff83ac pdcrl pd15md pd14md pd13md pd12md pd11md pd10md pd9md pd8md pfc h'ffff83ad pd7md pd6md pd5md pd4md pd3md pd2md pd1md pd0md h'ffff83ae h'ffff83af h'ffff83b0 pedr pe15dr pe14dr pe13dr pe12dr pe11dr pe10dr pe9dr pe8dr i/o h'ffff83b1 pe7dr pe6dr pe5dr pe4dr pe3dr pe2dr pe1dr pe0dr h'ffff83b2 pfdr h'ffff83b3 pf7dr pf6dr pf5dr pf4dr pf3dr pf2dr pf1dr pf0dr h'ffff83b4 peior pe15ior pe14ior pe13ior pe12ior pe11ior pe10ior pe9ior pe8ior pfc h'ffff83b5 pe7ior pe6ior pe5ior pe4ior pe3ior pe2ior pe1ior pe0ior h'ffff83b6 h'ffff83b7 h'ffff83b8 pecr1 pe15md1 pe15md0 pe14md1 pe14md0 pe13md1 pe13md0 pe12md h'ffff83b9 pe11md pe10md pe9md pe8md h'ffff83ba pecr2 pe7md pe6md pe5md pe4md h'ffff83bb pe3md1 pe3md0 pe2md1 pe2md0 pe1md1 pe1md0 pe0md1 pe0md0 h'ffff83bc to h'ffff83bf h'ffff83c0 icsr poe3f poe2f poe1f poe0f pie mtu h'ffff83c1 poe3m1 poe3m0 poe2m1 poe2m0 poe1m1 poe1m0 poe0m1 poe0m0 h'ffff83c2 ocsr osf ?ceoie h'ffff83c3 h'ffff83c4 to h'ffff83c7 h'ffff83c8 ifcr pfc h'ffff83c9 irqmd3 irqmd2 irqmd1 irqmd0 h'ffff83ca to h'ffff83cf h'ffff83d0 cmstr cmt h'ffff83d1 str1 str0 h'ffff83d2 cmcsr0 h'ffff83d3 cmf cmie cks1 cks0 h'ffff83d4 cmcnt0 h'ffff83d5
848 table a.1 on-chip i/o register addresses (cont) register bit names address abbr. bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module h'ffff83d6 cmcor0 cmt h'ffff83d7 h'ffff83d8 cmcsr1 h'ffff83d9 cmf cmie cks1 cks0 h'ffff83da cmcnt1 h'ffff83db h'ffff83dc cmcor1 h'ffff83dd h'ffff83de h'ffff83df h'ffff83e0 adcsr adf adie adst cks grp ch2 ch1 ch0 a/d h'ffff83e1 adcr pwr trgs1 trgs0 scan dsmp bufe1 bufe0 (high h'ffff83e2 to h'ffff83ef speed) (excl. a mask) h'ffff83f0 addra ad9ad8 h'ffff83f1 ad7 ad6 ad5 ad4 ad3 ad2 ad1 ad0 h'ffff83f2 addrb ad9ad8 h'ffff83f3 ad7 ad6 ad5 ad4 ad3 ad2 ad1 ad0 h'ffff83f4 addrc ad9ad8 h'ffff83f5 ad7 ad6 ad5 ad4 ad3 ad2 ad1 ad0 h'ffff83f6 addrd ad9ad8 h'ffff83f7 ad7 ad6 ad5 ad4 ad3 ad2 ad1 ad0 h'ffff83f8 addre ad9ad8 h'ffff83f9 ad7 ad6 ad5 ad4 ad3 ad2 ad1 ad0 h'ffff83fa addrf ad9ad8 h'ffff83fb ad7 ad6 ad5 ad4 ad3 ad2 ad1 ad0 h'ffff83fc addrg ad9ad8 h'ffff83fd ad7 ad6 ad5 ad4 ad3 ad2 ad1 ad0 h'ffff83fe addrh ad9ad8 h'ffff83ff ad7 ad6 ad5 ad4 ad3 ad2 ad1 ad0 h'ffff8400 addra0 ad9 ad8 ad7 ad6 ad5 ad4 ad3 ad2 a/d(mid- h'ffff8401 ad1 ad0 speed) h'ffff8402 addrb0 ad9 ad8 ad7 ad6 ad5 ad4 ad3 ad2 (a mask h'ffff8403 ad1 ad0 only) h'ffff8404 addrc0 ad9 ad8 ad7 ad6 ad5 ad4 ad3 ad2 h'ffff8405 ad1 ad0
849 table a.1 on-chip i/o register addresses (cont) register bit names address abbr. bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module h'ffff8406 addrd0 ad9 ad8 ad7 ad6 ad5 ad4 ad3 ad2 a/d(mid- h'ffff8407 ad1 ad0 speed) h'ffff8408 addra1 ad9 ad8 ad7 ad6 ad5 ad4 ad3 ad2 (a mask h'ffff8409 ad1 ad0 only) h'ffff840a addrb1 ad9 ad8 ad7 ad6 ad5 ad4 ad3 ad2 h'ffff840b ad1 ad0 h'ffff840c addrc1 ad9 ad8 ad7 ad6 ad5 ad4 ad3 ad2 h'ffff840d ad1 ad0 h'ffff840e addrd1 ad9 ad8 ad7 ad6 ad5 ad4 ad3 ad2 h'ffff840f ad1 ad0 h'ffff8410 adcsr0 adf adie adst scan cks ch2 ch1 ch0 h'ffff8411 adcsr1 adf adie adst scan cks ch2 ch1 ch0 h'ffff8412 aadcr0 trge h'ffff8413 aadcr1 trge h'ffff8414 to h'ffff857f h'ffff8580 flmcr1 fwe swe esu1 psu1 ev1 pv1 e1 p1 flash h'ffff8581 flmcr2 fler esu2 psu2 ev2 pv2 e2 p2 (f-ztat h'ffff8582 ebr1 eb3eb2eb1eb0 version- h'ffff8583 ebr2 eb11 eb10 eb9 eb8 eb7 eb6 eb5 eb4 only) h'ffff8584 to h'ffff859f h'ffff8600 ubarh uba31 uba30 uba29 uba28 uba27 uba26 uba25 uba24 ubc h'ffff8601 uba23 uba22 uba21 uba20 uba19 uba18 uba17 uba16 h'ffff8602 ubarl uba15 uba14 uba13 uba12 uba11 uba10 uba9 uba8 h'ffff8603 uba7 uba6 uba5 uba4 uba3 uba2 uba1 uba0 h'ffff8604 ubamrh ubm31 ubm30 ubm29 ubm28 ubm27 ubm26 ubm25 ubm24 h'ffff8605 ubm23 ubm22 ubm21 ubm20 ubm19 ubm18 ubm17 ubm16 h'ffff8606 ubamrl ubm15 ubm14 ubm13 ubm12 ubm11 ubm10 ubm9 ubm8 h'ffff8607 ubm7 ubm6 ubm5 ubm4 ubm3 ubm2 ubm1 ubm0 h'ffff8608 ubbr h'ffff8609 cp1 cp0 id1 id0 rw1 rw0 sz1 sz0 h'ffff860a to h'ffff860f h'ffff8610 tcsr ovf wt/it tme cks2 cks1 cks0 wdt
850 table a.1 on-chip i/o register addresses (cont) register bit names address abbr. bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module h'ffff8610 tcnt* 1 wdt h'ffff8611 tcnt* 2 h'ffff8612 rstcsr* 1 wovf rste rsts h'ffff8613 rstcsr* 2 wovf rste rsts h'ffff8614 sbycr sby hiz power- down state h'ffff8615 to h'ffff861f bsc h'ffff8620 bcr1 mturwe ioe h'ffff8621 a3lg a2lg a1lg a0lg a3sz a2sz a1sz a0sz h'ffff8622 bcr2 iw31 iw30 iw21 iw20 iw11 iw10 iw01 iw00 h'ffff8623 cw3 cw2 cw1 cw0 sw3 sw2 sw1 sw0 h'ffff8624 wcr1 w33 w32 w31 w30 w23 w22 w21 w20 h'ffff8625 w13 w12 w11 w10 w03 w02 w01 w00 h'ffff8626 wcr2 h'ffff8627 ddw1 ddw0 dsw3 dsw2 dsw1 dsw0 h'ffff8628 ramer flash (f-ztat h'ffff8629 rams ram1 ram0 version only) h'ffff862a dcr tpc rcd tras1 tras0 dww1 dww0 dwr1 dwr0 bsc h'ffff862b diw be rasd sz1 sz0 amx1 amx0 h'ffff862c rtcsr h'ffff862d cmf cmie cks2 cks1 cks0 rfsh rmd h'ffff862e rtcnt h'ffff862f h'ffff8630 rtcor h'ffff8631 notes: 1. write address. 2. read address. for details, see 13.2.4, notes on register access, in section 13, watchdog timer.
851 table a.1 on-chip i/o register addresses (cont) register bit names address abbr. bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module h'ffff8632 to h'ffff86af bsc h'ffff86b0 dmaor pr1pr0 dmac h'ffff86b1 ?e nmif dme h'ffff86b2 to h'ffff86bf h'ffff86c0 sar0 h'ffff86c1 h'ffff86c2 h'ffff86c3 h'ffff86c4 dar0 h'ffff86c5 h'ffff86c6 h'ffff86c7 h'ffff86c8 dmatcr0 h'ffff86c9 h'ffff86ca h'ffff86cb h'ffff86cc chcr0 h'ffff86cd ?irorlamal h'ffff86ce dm1 dm0 sm1 sm0 rs3 rs2 rs1 rs0 h'ffff86cf ds tm ts1 ts0 ie te de h'ffff86d0 sar1 h'ffff86d1 h'ffff86d2 h'ffff86d3 h'ffff86d4 dar1 h'ffff86d5 h'ffff86d6 h'ffff86d7 h'ffff86d8 dmatcr1 h'ffff86d9 h'ffff86da h'ffff86db
852 table a.1 on-chip i/o register addresses (cont) register bit names address abbr. bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module h'ffff86dc chcr1 dmac h'ffff86dd ?irorlamal h'ffff86de dm1 dm0 sm1 sm0 rs3 rs2 rs1 rs0 h'ffff86df ds tm ts1 ts0 ie te de h'ffff86e0 sar2 h'ffff86e1 h'ffff86e2 h'ffff86e3 h'ffff86e4 dar2 h'ffff86e5 h'ffff86e6 h'ffff86e7 h'ffff86e8 dmatcr2 h'ffff86e9 h'ffff86ea h'ffff86eb h'ffff86ec chcr2 h'ffff86ed ?irorlamal h'ffff86ee dm1 dm0 sm1 sm0 rs3 rs2 rs1 rs0 h'ffff86ef ds tm ts1 ts0 ie te de h'ffff86f0 sar3 h'ffff86f1 h'ffff86f2 h'ffff86f3 h'ffff86f4 dar3 h'ffff86f5 h'ffff86f6 h'ffff86f7 h'ffff86f8 dmatcr3 h'ffff86f9 h'ffff86fa h'ffff86fb h'ffff86fc chcr3 h'ffff86fd ?irorlamal h'ffff86fe dm1 dm0 sm1 sm0 rs3 rs2 rs1 rs0 h'ffff86ff ds tm ts1 ts0 ie te de
853 table a.1 on-chip i/o register addresses (cont) register bit names address abbr. bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module h'ffff8700 dtea dte7 dte6 dte5 dte4 dte3 dte2 dte1 dte0 dtc h'ffff8701 dteb dte7 dte6 dte5 dte4 dte3 dte2 dte1 dte0 h'ffff8702 dtec dte7 dte6 dte5 dte4 dte3 dte2 dte1 dte0 h'ffff8703 dted dte7 dte6 dte5 dte4 dte3 dte2 dte1 dte0 h'ffff8704 dtee dte7 dte6 dte5 dte4 dte3 dte2 dte1 dte0 h'ffff8705 h'ffff8706 dtcsr nmif ae swdte h'ffff8707 dtvec7 dtvec6 dtvec5 dtvec4 dtvec3 dtvec2 dtvec1 dtvec0 h'ffff8708 dtbr h'ffff8709 h'ffff870a to h'ffff873f h'ffff8740 ccr cac h'ffff8741 cedram cecs3 cecs2 cecs1 cecs0 h'ffff8742 to h'ffff87ff
854 appendix b block diagrams pa r internal data bus res pfc standby paw pandr q r c d q panmd q panior sbycr rxdm q hiz sci n = 0, 3 m = 0, 1 par: port a read signal paw: port a write signal res: reset signal pan/ rxdm figure b.1 pan/rxdm block diagram
855 pa r internal data bus res sckmout pfc standby paw pandr q c d sbycr intc irqm n = 2, 5 m = 0, 1 par: port a read signal paw: port a write signal res: reset signal dmac dreqm sci sckmin q panmd0 q panior q hiz q panmd1 pan/ sckm/ dreqm / irqm figure b.2 pan/sckm/ dreqm / irqm block diagram
856 pa r internal data bus res pfc cs2 , cs3 standby paw pandr q c d q panmd0 q panmd1 q panior q hiz tclka, tclkb sbycr mtu n = 6, 7 par: port a read signal paw: port a write signal res: reset si g nal r pa6/ tclka/ cs2 , pa7/ tclkb/ cs3 figure b.3 pa6/tclka/ cs2 , pa7/tclkb/ cs3 (ztat, mask) block diagram
857 q pa7md0 q pa7md1 par res paw c d q pa7dr pfc sbycr we q hiz mtu tclkb cs3 q pa7ior pa7/tclkb/ cs3 par: port a read signal paw: port a write signal res: reset signal on-chip flash memory writer mode internal data bus standby figure b.4 pa7/tclkb/ cs3 block diagram (f-ztat version)
858 pa r internal data bus res pfc standby paw pandr q c d tclkc, tlckd sbycr mtu n = 8, 9 par: port a read signal paw: port a write signal res: reset signal irq2 , irq3 intc r q panmd0 q panmd1 q panior q hiz pa8/ tclkc/ irq2 , pa9/ tclkd/ irq3 figure b.5 pan/tclkm/ irqx block diagram (ztat, mask)
859 q panmd0 q panmd1 par res paw c d q pandr pfc sbycr oe , ce q hiz mtu tclkc,d intc irq2 , irq3 q panior pa8/tclkc/ irq2 pa9/tclkd/ irq3 n=8, 9 par: port a read signal paw: port a write signal res: reset signal on-chip flash memory writer mode internal data bus standby figure b.6 pan/tclkm/ irqx block diagram (f-ztat version)
860 pa r internal data bus res txdm pfc standby paw q panmd q panior q hiz stbcr n = 1, 4 m = 0, 1 par: port a read signal paw: port a write signal res: reset signal pandr q c d r pan/ txdm figure b.7 pan/txdm block diagram
861 pa r internal data bus res ck single mode mcu mode 2 mcu mode 1 mcu mode 0 pfc standby paw stbcr par: port a read signal paw: port a write signal res: reset signal pa15dr q c d r pa15/ck q pa15ior q pa15md q hiz figure b.8 pa15/ck block diagram
862 pa r internal data bus res drak0 pfc standby paw sbycr par: port a read signal paw: port a write signal res: reset signal pa18dr q c d r bsc breq pa18/ drak0/ breq q pa18imd1 q pa18ior q pa18md0 q hiz figure b.9 pa18/drak0/ breq block diagram
863 pa r internal data bus res drak1 back pfc standby bus right release paw sbycr par: port a read signal paw: port a write signal res: reset signal pa19dr q c d r q hiz pa19/ drak1/ back q pa19md0 q pa19md1 q pa19ior figure b.10 pa19/draq1/ back block diagram
864 pa r internal data bus res cs0 , cs1 , wrl , wrh , rd single mode mcu mode 0 mcu mode 1 mcu mode 2 pfc sbycr standby bus right release paw n = 10-14 par: port a read signal paw: port a write signal res: reset signal pandr q c d r q panmd q panior q hiz pan/ xxx figure b.11 pan/xxx block diagram
865 pa r internal data bus res ah , cashl , cashh , wrhl , wrhh single mode pfc sbycr standby bus right release paw n = 16,20-23 par: port a read signal paw: port a write signal res: reset signal pandr q c d r q panmd q hiz q panior pan/ xxxx figure b.12 pan/xxxx block diagram
866 pa r internal data bus res single mode pfc sbycr standby bus right release paw par: port a read signal paw: port a write signal res: reset signal pandr q c d r q pa17md q hiz wait request q pa17ior pa17/ wait figure b.13 pa17/ wait block diagram
867 pbr prom mode internal data bus res single mode mcu mode 0 mcu mode 1 mcu mode 2 a16 pfc sbycr standby bus right release pbw pbr: port b read signal pbw: port b write signal res: reset signal pb0dr q c d r on-chip* eprom a16 pb0/ a16 q pb0md q pb0ior q hiz note : not available with the mask versions. figure b.14 pb0/a16 block diagram
868 q pb0md0 q pb0ior pbr a16 res pbw c d q c pb0dr pfc sbycr q hiz a16 pbr: port b read signal pbw: port b write signal res: reset signal on-chip flash memory writer mode internal data bus single mode mcu mode 0 mcu mode 1 mcu mode 2 bus right release standby pb0/a16 figure b.15 pb0/a16 block diagram (f-ztat version)
869 pbr internal data bus res single mode mcu mode 0 mcu mode 1 mcu mode 2 a17 pfc sbycr standby bus right release pbw pbr: port b read signal pbw: port b write signal res: reset signal pb1dr q c d r pb1/ a17 q pb1md q pb1ior q hiz figure b.16 pb1/a17 block diagram
870 pbr internal data bus res a18 back pfc sbycr intc irq4 standby bus right release pbw pbr: port b read signal pbw: port b write signal res: reset signal pb6dr q c d q pb6md0 q pb6md1 q pb6ior q hiz pb6/ irq4 / a18/ back figure b.17 pb6/ irq4 /a18/ back block diagram
871 pbr prom mode internal data bus res casl , cash pfc sbycr poe poem standby bus right release pbw n = 3, 4 m = 1, 2 pbr: port b read signal pbw: port b write signal res: reset signal pbndr q c d on-chip* eprom oe , pgm q pbnmd0 q pbnmd1 q hiz q pbnior intc irqm pbn/ irqm / poem / casx note : not available with the ztat version. figure b.18 pbn/ irqm / poem / casx block diagram
872 q pb4md0 q pb4md1 q pb4ior pbr a17 res pbw c d q c pb4dr pfc sbycr q hiz casl , cash poe poem intc irqm pb4/ irq2 / poe2 / cash , pb3/ irq1 / poe1 / casl n=3, 4 m=1, 2 pbr: port b read signal pbw: port b write signal res: reset signal on-chip flash memory internal data bus writer mode standby bus right release figure b.19 pb4/ irq2 / poe2 / cash , pb3 / irq1 / poe1 / casl block diagram (f-ztat version)
873 pbr internal data bus res a19?21 pfc sbycr bsc/ad breq , wait, adtrg standby bus right release pbw n = 7-9 m = 5-7 pbr: port b read signal pbw: port b write signal res: reset signal pbndr q c d q pbnmd0 q pbnmd1 q hiz q pbnior intc irqm pbn/ irqm / xxx/ yyy figure b.20 pbn/ irqm /xxx/yyy block diagram
874 pbr internal data bus res ras, rdwr pfc sbycr poe poe0 , poe3 standby bus right release pbw n = 2, 5 m = 0, 3 pbr: port b read signal pbw: port b write signal res: reset signal pbndr q c d q pbnmd0 q pbnmd1 q hiz q pbnior intc irqm pbn/ irqm / xxx/ yyy figure b.21 pbn/ irqm /xxxx/yyyy block diagram
875 pcr prom mode internal data bus res single mode mcu mode 0 mcu mode 1 mcu mode 2 an pfc sbycr standby bus right release pcw n = 0?5 pcr: port c read signal pcw: port c write signal res: reset signal pcndr q c d r on-chip* eprom an q pbnmd q pbnior q hiz pcn/ an note : not available with the mask versions figure b.22 pcn/an block diagram
876 q pcnmd q pcnior pcr an res pcw c d q c pcndr pfc sbycr q hiz an pcn/an n=0?5 pcr: port c read signal pcw: port c write signal res: reset signal on-chip flash memory writer mode internal data bus single mode bus right release standby mcu mode 2 mcu mode 0 mcu mode 1 figure b.23 pcn/an block diagram (f-ztat version)
877 pdr prom mode internal data bus res single mode mcu mode 0 mcu mode 1 mcu mode 2 dn dout pfc sbycr din standby bus right release sleep pdw n = 0? pdr: port d read signal pdw: port d write signal res: reset signal dout: data output timing signal din: data bus input timing signal pdndr q c d r on-chip* eprom dn q pdnmd q pdnior q hiz pdn/ dn note : not available with the mask version. figure b.24 pdn/dn block diagram
878 q pdnmd0 q pdnior q hiz pdr dn res pdw c d q c pdndr dout pfc sbycr dn din on-chip flash memory internal data bus pdn/dn writer mode single mode mcu mode 0 mcu mode 1 mcu mode 2 bus right release sleep standby n=0?5 pdr: port d read signal pdw: port d write signal res: reset signal dout: data bus output timing signal din: data bus input timing signal figure b.25 pdn/dn block diagram (f-ztat version)
879 din standby sleep bus right release pdn/ dn/ irqm pdw res r qd c pdndr pdr dn dout single mode mcu mode 1 mcu mode 0 mcu mode 2 pfc sbycr q hiz qpdnmd0 qpdnmd1 qpdnior intc irqm internal data bus n = 16e23 m = 0e7 pdr: port d read signal pdw: port d write signal res: reset signal dout: data output timing signal din: data bus input timing signal figure b.26 pdn/dn/ irqm block diagram (n = 16?3)
880 din standby sleep bus right release pdn/ dn/ dreqm pdw res r qd c pdndr pdr dn dout single mode mcu mode 1 mcu mode 0 mcu mode 2 pfc sbycr q hiz qpdnmd0 qpdnmd1 qpdnior dmac dreq m internal data bus n = 24,25 m = 0,1 pdr: port d read signal pdw: port d write signal res: reset signal dout: data output timing signal din: data bus input timing signal figure b.27 pdn/dn/ dreqm block diagram (n = 24, 25)
881 din standby sleep bus right release pdn/ dn/ dackm pdw res r qd c pdndr pdr dn dout single mode mcu mode 1 mcu mode 0 mcu mode 2 pfc sbycr q hiz qpdnmd0 qpdnmd1 qpdnior internal data bus n = 26,27 m = 0,1 pdr: port d read signal pdw: port d write signal res: reset signal dout: data output timing signal din: data bus input timing signal dackm figure b.28 pdn/dn/ dackm block diagram (n = 26, 27)
882 din standby sleep bus right release pdn/ dn/ csm pdw res r qd c pdndr pdr dn dout single mode mcu mode 1 mcu mode 0 mcu mode 2 pfc sbycr q hiz qpdnmd0 qpdnmd1 qpdnior internal data bus n = 28e29 m = 2e3 pdr: port d read signal pdw: port d write signal res: reset signal dout: data output timing signal din: data bus input timing signal csm figure b.29 pdn/dn/ csm block diagram (n = 28, 29)
883 din standby sleep bus right release pdn/ dn/ irqout pdw res r qd c pdndr pdr dn dout single mode mcu mode 1 mcu mode 0 mcu mode 2 pfc sbycr q hiz qpdnmd0 qpdnmd1 qpdnior internal data bus n = 30 pdr: port d read signal pdw: port d write signal res: reset signal dout: data output timing signal din: data bus input timing signal irqout figure b.30 pdn/dn/ irqout block diagram (n = 30)
884 din standby sleep bus right release pd31/ d31/ adtrg pdw res r qd c pd31dr pdr dn dout single mode mcu mode 1 mcu mode 0 mcu mode 2 pfc sbycr q hiz qpd31md0 qpd31md1 qpd31ior a/d adtrg internal data bus pdr: port d read signal pdw: port d write signal res: reset signal dout: data output timing signal din: data bus input timing signal figure b.31 pd31/d31/ adtrg block diagram
885 din standby sleep bus right release pdn/ dn pdw res r qd c pdndr pdr dn dout single mode mcu mode 1 mcu mode 0 mcu mode 2 pfc q hiz qpdnmd qpdnior internal data bus n = 8?5 pdr: port d read signal pdw: port d write signal res: reset signal dout: data output timing signal din: data bus input timing signal sbycr figure b.32 pdn/dn block diagram
886 standby pe13/ tioc4b/ mres pew res qd c pe13dr per pfc sbycr q hiz qpe13md0 qpe13md1 qpe13ior sysc mres internal data bus per: port e read signal pew: port e write signal res: reset si g nal mtu tioc4b tioc4b figure b.33 pe13/tioc4b/ mres block diagram
887 standby pe14/ tioc4c/ dack0/ ah pew res qd c pe14dr per pfc sbycr q hiz qpe14md0 qpe14md1 qpe14ior internal data bus per: port e read signal pew: port e write signal res: reset signal mtu tioc4c tioc4c drak0 ah figure b.34 pe14/tioc4c/dack0/ ah block diagram
888 standby pe15/ tioc4d/ dack1/ irqout pew res qd c pe15dr per pfc sbycr q hiz qpe15md0 qpe15md1 qpe15ior internal data bus per: port e read signal pew: port e write signal res: reset signal mtu tioc4d tioc4d drak1 irqout figure b.35 pen/tioc4d/dack1/ irqout block diagram
889 standby pen/ tiocxx pew res qd c pendr per pfc sbycr q hiz qpenmd qpenior internal data bus per: port e read signal pew: port e write signal res: reset signal mtu tioc1a, tioc1b, tioc2a, tioc2b, tioc3a, tioc3b, tioc3c, tioc3d, tioc4a n = 4-12 tioc1a, tioc1b, tioc2a, tioc2b, tioc3a, tioc3b, tioc3c, tioc3d, tioc4a figure b.36 pen/tiocxx block diagram
890 standby pen/ tiocxx/ dracm pew res qd c pendr per pfc sbycr q hiz qpenmd0 qpenmd1 qpenior internal data bus per: port e read signal pew: port e write signal res: reset si g nal mtu tioc0b tioc0d tioc0b tioc0d drakm n = 1, 3 m = 0, 1 figure b.37 pen/tiocxx/drakm block diagram
891 standby pen/ tiocxx/ dreqm pew res qd c pendr per pfc sbycr q hiz qpenmd0 qpenmd1 qpenior dma dreqm internal data bus per: port e read signal pew: port e write signal res: reset si g nal mtu tioc0a tioc0c tioc0a tioc0c n = 0, 2 m = 0, 1 figure b.38 pen/tiocxx/ dreqm block diagram
892 internal data bus standby sbycr q hiz ad ann pfr pfn/ ann n = 0? pfr: port f read si g nal figure b.39 pfn/ann block diagram
893 appendix c pin states table c.1 pin modes during reset, power-down, and bus right release modes (144 pin) pin modes pin function reset power-down bus right standby in bus class pin name power-onmanual standby sleep release right release clock ck o o h* 1 oo o system res iiiii i control mres zizii z wdtovf o* 4 o* 4 ooo o breq zizii i back zozol l interrupt nmi i i i i i i irq0 irq7 zizii z irqout (pd30) z o h* 1 ho h* 1 irqout (pe15) z o z h o z address bus a0?21 o o z o z z data bus d0?31 z i/o z i/o z z bus wait ziziz z control rd/wr, ras zoooz z cash , casl , caslh , casll zoooz z rd hozoz z cs0 , cs1 hozoz z cs2 , cs3 zozoz z wrhh , wrhl , wrh , wrl hozoz z ah zozoz z dmac dack0, dack1 (pd26, pd27) zoo* 1 oo o* 1 dack0, dack1 (pe14, pe15) zozoo z drak0, drak1 z o o* 1 oo o* 1 dreq0 , dreq1 zizii z
894 table c.1 pin modes during reset, power-down, and bus right release modes (144 pin) (cont) pin modes pin function reset power-down bus right standby in bus class pin name power-onmanual standby sleep release right release mtu tioc0a?ioc0d, tioc1a?ioc1d, tioc2a?ioc2d, tioc3a, tioc3c z i/o k* 1 i/o i/o k* 1 tioc3b,tioc3d, tioc4a?ioc4d z i/o z i/o i/o z tclka?clkd z i z i i z port control poe0 poe3 zizii z sci sck0?ck1 z i/o z i/o i/o z txd0?cd1 z o o* 1 oo o* 1 rxd0?xd1 z i z i i z a/d adtrg zizii z converter an0?n7 z i z i i z i/o port pa0?a23 z i/o k* 1 k i/o k* 1 pb0?b9 pc0?c15 pd0?d31 pe0?e8,pe10 pe9,pe11?e15 z i/o z k i/o z pf0?f17 z i z i i z notes: 1. if the standby control register port high-impedance bits are set to 1, output pins become high impedance. 2. there are instances where bus right release and transition to software standby mode occur simultaneously due to the timing between breq and internal operations. in such cases, standby mode results, but the standby state may be different. the initial pin states depend on the mode. see section 18, pin function controller (pfc), for details. 3. i: input, o: output, h: high-level output, l: low-level output, z: high impedance, k: input pin with high impedance, output pin mode maintained. 4. input in the sh7044/sh7045 f-ztat version.
895 table c.2 pin modes during reset, power-down, and bus right release modes (112 pin, 120 pin) pin modes pin function reset power-down bus right standby in bus class pin name power-on manual standby sleep release right release clock ck o o h* 1 oo o system res iiiii i control mres zizii z wdtovf o* 5 o* 5 ooo o breq zizii i back zozol l interrupt nmi i i i i i i irq0 irq7 zizii z irqout zozho z address bus a0?21 o* 4 ozoz z data bus d0?31 z i/o z i/o z z bus wait ziziz z control rdwr, ras zoooz z cash , casl zoooz z rd hozoz z cs0 , cs1 hozoz z cs2 , cs3 zozoz z wrh , wrl hozoz z ah zozoz z dmac dack0?ack1 z o z o o z drak0?rak1 z o z o o z dreq0 dreq1 zizii z mtu tioc0a?ioc0d, tioc1a?ioc1d, tioc2a?ioc2d, tioc3a, tioc3c z i/o k* 1 i/o i/o k* 1 tioc3b,tioc3d, tioc4a?ioc4d z i/o z i/o i/o z tclka?clkd z i z i i z
896 table c.2 pin modes during reset, power-down, and bus right release modes (112 pin, 120 pin) (cont) pin modes pin function reset power-down bus right standby in bus class pin name power-on manual standby sleep release right release port control poe0 poe3 zizii z sci sck0?ck1 z i/o z i/o i/o z txd0?cd1 z o o* 1 oo o* 1 rxd0?xd1 z i z i i z a/d converter adtrg zizii z control an0?n7 z i z i i z i/o port pa0?a15 z i/o k* 1 k i/o k* 1 pb0?b9 pc0?c15 pd0?d15 pe0?e8?e10 pe9,pe11?e15 z i/o z k i/o z pf0?f7 z i z i i z notes: 1. if the standby control register port high-impedance bits are set to 1, output pins become high impedance. 2. there are instances where bus right release and transition to software standby mode occur simultaneously due to the timing between breq and internal operations. in such cases, standby mode results, but the standby state may be different. the initial pin states depend on the mode. see section 18, pin function controller (pfc), for details. 3. i: input, o: output, h: high-level output, l: low-level output, z: high impedance, k: input pin with high impedance, output pin mode maintained. 4. a21?18 will become input ports after power-on reset. 5. input in the sh7044/sh7045 f-ztat version.
897 table c.3 pin settings for on-chip peripheral modules on-chip peripheral module 16-bit space pin name on-chip rom on-chip ram 8-bit space upper byte lower byte word/ longword cs0 cs3 hhh hhh ras * 1 hhh hhh cashh * 2 hhh hhh cashl * 2 hhh hhh caslh * 2 hhh hhh casll * 2 hhh hhh rd/wr h h h h h h ah lll lll rd rh hh hhh w hh hhh wrhh rh hh hhh w hh hhh wrhl rh hh hhh w hh hhh wrlh rh hh hhh w hh hhh wrll rh hh hhh w hh hhh a21?0 address address address address address address d31?24 high-z high-z high-z high-z high-z high-z d23?16 high-z high-z high-z high-z high-z high-z d15?8 high-z high-z high-z high-z high-z high-z d7?0 high-z high-z high-z high-z high-z high-z notes: 1. l asserted in ras down state or refresh state. 2. l asserted in refresh state. 3. r: read w: write.
898 table c.4 pin settings for normal external space 16-bit space pin name 8-bit space upper word lower word word/longword cs0 cs3 valid valid valid valid ras * 1 hh h h cashh * 2 hh h h cashl * 2 hh h h caslh * 2 hh h h casll * 2 hh h h rd/wr h h h h ah ll l l rd rl l l l wh h h h wrhh rh h h h wh h h h wrhl rh h h h wh h h h wrlh rh h h h wh l h l wrll rh h h h wl h l l a21?0 address address address address d31?24 high-z high-z high-z high-z d23?16 high-z high-z high-z high-z d15?8 high-z data high-z data d7?0 data high-z data data
899 table c.4 pin settings for normal external space (cont) 32-bit space pin name msb 2nd byte 3rd byte lsb upper word lower word longword cs0 cs3 valid valid valid valid valid valid valid ras * 1 hhhhhhh cashh * 2 hhhhhhh cashl * 2 hhhhhhh caslh * 2 hhhhhhh casll * 2 hhhhhhh rd/wr h h h h h h h ah lllllll rd rlllllll whhhhhhh wrhh rhhhhhhh wl h h h l h l wrhl rhhhhhhh wh l h h l h l wrh rhhhhhhh wh h l h h l l wrl rhhhhhhh wh h h l h l l a21?0 address address address address address address address d31?24 data high-z high-z high-z data high-z data d23?16 high-z data high-z high-z data high-z data d15?8 high-z high-z data high-z high-z data data d7?0 high-z high-z high-z data high-z data data notes: 1. l asserted in ras down mode or refresh mode. 2. l asserted in refresh mode. 3. r: read w: write 4. valid: chip select signal corresponding with accessed area is low; chip select signal in other cases is high.
900 table c.5 pin settings for multiplex i/o space 16-bit space pin name 8-bit space upper byte lower byte word/longword cs0 cs2 hh h h cs3 ll l l ras * 1 hh h h cashh * 2 hh h h cashl * 2 hh h h caslh * 2 hh h h casll * 2 hh h h rd/wr h h h h ah valid valid valid valid rd rl l l l wh h h h wrhh rh h h h wh h h h wrhl rh h h h wh h h h wrh rh h h h wh l h l wrl rh h h h wl h l l a21?0 address address address address d31?24 high-z high-z high-z high-z d23?16 high-z high-z high-z high-z d15?8 high-z address/data address address/data d7?0 address/data address address/data address/data notes: 1. l asserted in ras down mode or refresh mode. 2. l asserted in refresh mode. 3. r: read w: write 4. valid: high output in accordance with ah timing.
901 table c.6 pin settings for dram space 16-bit space pin name 8-bit space upper word lower word word/longword cs0 cs3 hh h h ras * 1 valid valid valid valid cashh * 2 hh h h cashl * 2 hh h h caslh * 2 h valid h valid casll * 2 valid h valid valid rd/wr r h h h h wl l l l ah ll l l rd rl l l l wh h h h wrhh rh h h h wh h h h wrhl rh h h h wh h h h wrh rh h h h wh l h l wrl rh h h h wl h l l a21?0 address address address address d31?24 high-z high-z high-z high-z d23?16 high-z high-z high-z high-z d15?8 high-z data high-z data d7?0 data high-z data data
902 table c.6 pin settings for dram space (cont) 32-bit space pin name msb 2nd byte 3rd byte lsb upper word lower word longword cs0 cs3 hhhhhhh ras * 1 valid valid valid valid valid valid valid cashh * 2 valid h h h valid h valid cashl * 2 h valid h h valid h valid caslh * 2 h h valid h h valid valid casll * 2 h h h valid h valid valid rd/wr r h h h h h h h wlllllll ah lllllll rd rlllllll whhhhhhh wrhh rhhhhhhh wl h h h l h l wrhl rhhhhhhh wh l h h l h l wrh rhhhhhhh wh h l h h l l wrl rhhhhhhh wh h h l h l l a21?0 address address address address address address address d31?24 data high-z high-z high-z data high-z data d23?16 high-z data high-z high-z data high-z data d15?8 high-z high-z data high-z high-z data data d7?0 high-z high-z high-z data high-z data data notes: 1. asserted in ras down mode or refresh mode. 2. asserted in refresh mode. 3. r: read w: write 4. valid: chip select signal corresponding with accessed area is low; chip select signal in other cases is high.
903 appendix d notes when converting the f?tat application software to the mask-rom versions please note the following when converting the f-ztat application software to the mask-rom versions. the values read from the internal registers for the flash rom of the mask-rom version and f ztat version differ as follows. status register bit f?tat version mask-rom version flmcr1 fwe 0: application software running 1: programming 0: is not read out 1: application software running note: this difference applies to all the f-ztat versions and all the mask-rom versions that have different rom size.
904 appendix e product code lineup table e.1 sh7040, sh7041, sh7042, sh7043, sh7044, and sh7045 product lineup product type mask version product code mark code package order model no.* 2 sh7040a mask rom a mask hd6437040af28 hd6437040a (***)f28 qfp2020-112 hd6437040a***f verion hd6437040avf16 hd6437040a(***)vf16 qfp2020-112 hd6437040a***f hd6437040avx16 hd6437040a(***)vx16 tqfp1414-120 hd6437040a***x hd6437040af33 hd6437040a(***)f33 qfp2020-112cu* 1 hd6437040a***f hd6437040acf28 hd6437040a(***)cf28 qfp2020-112cu* 1 hd6437040a***cf hd6437040avcf16 hd6437040a(***)vcf16 qfp2020-112cu* 1 hd6437040a***cf rom less a mask hd6417040af28 hd6417040af28 qfp2020-112 hd6417040af28 version hd6417040avf16 hd6417040avf16 qfp2020-112 hd6417040avf16 hd6417040af33 hd6417040af33 qfp2020-112cu* 1 hd6417040af33 hd6417040acf28 hd6417040acf28 qfp2020-112cu* 1 hd6417040acf28 hd6417040avcf16 hd6417040avcf16 qfp2020-112cu* 1 hd6417040avcf16 sh7041a mask rom a mask hd6437041af28 hd6437041a(***)f28 qfp2020-144 hd6437041a***f version hd6437041avf16 hd6437041a(***)vf16 qfp2020-144 hd6437041a***f hd6437041af33 hd6437041a(***)f33 qfp2020-144cu* 1 hd6437041a***f hd6437041acf28 hd6437041a(***)cf28 qfp2020-144cu* 1 hd6437041a***cf hd6437041avcf16 hd6437041a(***)vcf16 qfp2020-144cu* 1 hd6437041a***cf rom less a mask hd6417041af28 hd6417041af28 qfp2020-144 hd6417041af28 verion hd6417041avf16 hd6417041avf16 qfp2020-144 hd6417041avf16 hd6417041af33 hd6417041af33 qfp2020-144cu* 1 hd6417041af33 hd6417041acf28 hd6417041acf28 qfp2020-144cu* 1 hd6417041acf28 hd6417041avcf16 hd6417041avcf16 qfp2020-144cu* 1 hd6417041avcf16 sh7042 mask rom hd6437042f28 hd6437042 (***)f28 qfp2020-112 hd6437042***f version hd6437042vf16 hd6437042 (***)vf16 qfp2020-112 hd6437042***f z-tat hd6477042f28 hd6477042f28 qfp2020-112 hd6477042f28 version hd6477042vf16 hd6477042vf16 qfp2020-112 hd6477042vf16 sh7042a mask rom a mask hd6437042af28 hd6437042a(***)f28 qfp2020-112 hd6437042a***f version hd6437042avf16 hd6437042a(***)vf16 qfp2020-112 hd6437042a***f hd6437042avx16 hd6437042a(***)vx16 tqfp1414-120 hd6437042a***x hd6437042af33 hd6437042a(***)f33 qfp2020-112cu* 1 hd6437042a***f hd6437042acf28 hd6437042a(***)cf28 qfp2020-112cu* 1 hd6437042a***cf hd6437042avcf16 hd6437042a(***)vcf16 qfp2020-112cu* 1 hd6437042a***cf
905 table e.1 sh7040, sh7041, sh7042, sh7043, sh7044, and sh7045 product lineup (cont) product type mask version product code mark code package order model no.* 2 sh7042a z-tat a mask hd6477042af28 hd6477042af28 qfp2020-112 hd6477042af28 version HD6477042AVF16 HD6477042AVF16 qfp2020-112 HD6477042AVF16 hd6477042avx16 hd6477042avx16 tqfp1414-120 hd6477042avx16 hd6477042af33 hd6477042af33 qfp2020-112cu* 1 hd6477042af33 hd6477042acf28 hd6477042acf28 qfp2020-112cu* 1 hd6477042acf28 hd6477042avcf16 hd6477042avcf16 qfp2020-112cu* 1 hd6477042avcf16 sh7043 mask rom hd6437043f28 hd6437043(***)f28 qfp2020-144 hd6437043***f version hd6437043vf16 hd6437043(***)vf16 qfp2020-144 hd6437043***f z-tat hd6477043f28 hd6477043f28 qfp2020-144 hd6477043f28 version hd6477043vf16 hd6477043vf16 qfp2020-144 hd6477043vf16 sh7043a mask rom a mask hd6437043af28 hd6437043a(***)f28 qfp2020-144 hd6437043a***f version hd6437043avf16 hd6437043a(***)vf16 qfp2020-144 hd6437043a***f hd6437043af33 hd6437043a(***)f33 qfp2020-144cu* 1 hd6437043a***f hd6437043acf28 hd6437043a(***)cf28 qfp2020-144cu* 1 hd6437043a***cf hd6437043avcf16 hd6437043a(***)vcf16 qfp2020-144cu* 1 hd6437043a***cf z-tat a mask hd6477043af28 hd6477043af28 qfp2020-144 hd6477043af28 version hd6477043avf16 hd6477043avf16 qfp2020-144 hd6477043avf16 hd6477043af33 hd6477043af33 qfp2020-144cu* 1 hd6477043af33 hd6477043acf28 hd6477043acf28 qfp2020-144cu* 1 hd6477043acf28 hd6477043avcf16 hd6477043avcf16 qfp2020-144cu* 1 hd6477043avcf16 sh7044 mask rom version a mask hd6437044f28 hd6437044(***)f28 qfp2020-112 hd6437044***f f-ztat version hd64f7044f28 hd64f7044f28 qfp2020-112 hd64f7044f28 sh7045 mask rom version a mask hd6437045f28 hd6437045(***)f28 qfp2020-144 hd6437045***f f-ztat version hd64f7045f28 hd64f7045f28 qfp2020-144 hd64f7045f28 ( *** ) is the rom code. notes: 1. package with copper used as the lead material. 2. *** in the order model no. is the rom code, consisting of a letter and a two-digit number (ex. e00). the letter indicates the voltage and frequency, as shown below. a, b, c, d: 5.0 v, 33mhz e, f, g, h: 5.0 v, 28 mhz p, q, r: 3.3 v, 16 mhz
906 appendix f package dimensions package dimensions of the sh7040, sh7042, sh7044 (fp-112) are shown in figures f.1 and f.2. package dimensions of the sh7040, sh7042 (tfp-120) are shown in figures f.3. package dimensions of the sh7041, sh7043, sh7045 (fp-144) are shown in figures f.4 and f.5. hitachi code jedec eiaj weight (reference value) fp-112 conforms 2.4 g unit: mm *dimension including the plating thickness base material dimension 0.10 23.2 0.3 *0.32 0.08 0.65 1.6 0.8 0.3 *0.17 0.05 3.05 max 23.2 0.3 84 57 56 29 112 1 28 20 85 2.70 0 e 8 0.13 m 0.10 +0.15 e0.10 1.23 0.30 0.06 0.15 0.04 figure f.1 package dimensions (fp-112)
907 this package (fp-112b) uses copper leads. 0.10 23.2 0.2 0.32 0.08 0.65 1.6 0.8 0.2 0.17 0.05 3.05 max 23.2 0.2 84 57 56 29 112 1 28 20 85 2.70 0 e 8 0.13 m 0.10 +0.15 e0.10 1.23 0.30 0.06 0.15 0.04 * * hitachi code jedec eiaj weight (reference value) fp-112b ? conforms 2.4 g unit: mm *dimension including the plating thickness base material dimension figure f.2 package dimensions (fp-112b)
908 hitachi code jedec eiaj weight (reference value) tfp-120 conforms 0.5 g unit: mm *dimension including the plating thickness base material dimension 16.0 0.2 14 0.07 0.10 0.5 0.1 16.0 0.2 0.4 0.10 0.10 1.20 max *0.17 0.05 0 e 8 90 61 130 91 120 31 60 m *0.17 0.05 1.0 1.00 1.2 0.15 0.04 0.15 0.04 figure f.3 package dimensions (tfp-120)
909 hitachi code jedec eiaj weight (reference value) fp-144j conforms 2.4 g unit: mm *dimension including the plating thickness base material dimension 0.10 m 20 22.0 0.2 73 36 144 0.5 0.10 3.05 max 0 e 8 22.0 0.2 108 72 37 109 1 0.17 0.05 2.70 0.22 0.05 0.5 0.1 1.0 0.10 +0.15 e0.10 1.25 0.20 0.04 0.15 0.04 * * figure f.4 package dimensions (fp-144j)
910 this package (fp-144g) uses copper leads. hitachi code jedec eiaj weight (reference value) fp-144g conforms 2.4 g unit: mm *dimension including the plating thickness base material dimension 0.10 m 20 22.0 0.2 73 36 144 0.5 0.10 3.05 max 0 e 8 22.0 0.2 108 72 37 109 1 0.17 0.05 2.70 0.22 0.05 0.5 0.1 1.0 0.10 +0.15 e0.10 1.25 0.20 0.04 0.15 0.04 * * figure f.5 package dimensions (fp-144g)
sh7040 series hardware manual publication date: 1st edition, february 1997 5th edition, march 2000 published by: electronic devices sales & marketing group semiconductor & integrated circuits hitachi, ltd. edited by: technical documentation group hitachi kodaira semiconductor co., ltd. copyright ?hitachi, ltd., 1997. all rights reserved. printed in japan.


▲Up To Search▲   

 
Price & Availability of HD6477042AVF16

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X