![]() |
|
If you can't view the Datasheet, Please click here to try to view without PDF Reader . |
|
Datasheet File OCR Text: |
regarding the change of names mentioned in the document, such as mitsubishi electric and mitsubishi xx, to renesas technology corp. the semiconductor operations of hitachi and mitsubishi electric were transferred to renesas technology corporation on april 1st 2003. these operations include microcomputer, logic, analog and discrete devices, and memory chips other than drams (flash memory, srams etc.) accordingly, although mitsubishi electric, mitsubishi electric corporation, mitsubishi semiconductors, and other mitsubishi brand names are mentioned in the document, these names have in fact all been changed to renesas technology corp. thank you for your understanding. except for our corporate trademark, logo and corporate statement, no changes whatsoever have been made to the contents of the document, and these changes do not constitute any alteration to the contents of the document itself. note : mitsubishi electric will continue the business operations of high frequency & optical devices and power devices. renesas technology corp. customer support dept. april 1, 2003 to all our customers
before using this material, please visit the above website to confirm that this is the most current document available. http://www.infomicom.maec.co.jp/indexe.htm rev. 2.1 revision date: jan. 16, 2003 mitsubishi 32-bit risc single-chip microcomputers m32r family m32r/ecu series user's manual 32170 32174 group keep safety first in your circuit designs! notes regarding these materials mitsubishi electric corporation puts the maximum effort into making semiconductor prod- ucts better and more reliable, but there is always the possibility that trouble may occur with them. trouble with semiconductors may lead to personal injury, fire or property damage. remember to give due consideration to safety when making your circuit designs, with ap- propriate measures such as (i) placement of substitutive, auxiliary circuits, (ii) use of non- flammable material or (iii) prevention against any malfunction or mishap. these materials are intended as a reference to assist our customers in the selection of the mitsubishi semiconductor product best suited to the customer's application; they do not convey any license under any intellectual property rights, or any other rights, belonging to mitsubishi electric corporation or a third party. mitsubishi electric corporation assumes no responsibility for any damage, or infringement of any third-party's rights, originating in the use of any product data, diagrams, charts, programs, algorithms, or circuit application examples contained in these materials. all information contained in these materials, including product data, diagrams, charts, pro- grams and algorithms represents information on products at the time of publication of these materials, and are subject to change by mitsubishi electric corporation without notice due to product improvements or other reasons. it is therefore recommended that customers contact mitsubishi electric corporation or an authorized mitsubishi semiconductor product distributor for the latest product information before purchasing a product listed herein. the information described here may contain technical inaccuracies or typographical errors. mitsubishi electric corporation assumes no responsibility for any damage, liability, or other loss rising from these inaccuracies or errors. please also pay attention to information published by mitsubishi electric corporation by various means, including the mitsubishi semiconductor home page (http:// www.mitsubishichips.com). when using any or all of the information contained in these materials, including product data, diagrams, charts, programs, and algorithms, please be sure to evaluate all informa- tion as a total system before making a final decision on the applicability of the information and products. mitsubishi electric corporation assumes no responsibility for any damage, liability or other loss resulting from the information contained herein. mitsubishi electric corporation semiconductors are not designed or manufactured for use in a device or system that is used under circumstances in which human life is potentially at stake. please contact mitsubishi electric corporation or an authorized mitsubishi semicon- ductor product distributor when considering the use of a product contained herein for any specific purposes, such as apparatus or systems for transportation, vehicular, medical, aerospace, nuclear, or undersea repeater use. the prior written approval of mitsubishi electric corporation is necessary to reprint or repro- duce in whole or in part these materials. if these products or technologies are subject to the japanese export control restrictions, they must be exported under a license from the japanese government and cannot be im- ported into a country other than the approved destination. any diversion or reexport contrary to the export control laws and regulations of japan and/ or the country of destination is prohibited. please contact mitsubishi electric corporation or an authorized mitsubishi semiconductor product distributor for further details on these materials or the products contained therein. how to read internal i/o register tables ? bit numbers: each register is connected with an internal bus of 16-bit wide, so the bit numbers of the registers located at even addresses are d0-d7, and those at odd addresses are d8-d15. ? state of register at reset: represents the initial state of each register immediately after reset with hexadecimal numbers (undefined bits after reset are indicated each in column ? .) ? at read: ... read enabled ? ... read disabled (read value invalid) 0 ... read always as 0 1 ... read always as 1 at write: : write enabled ? : write enable conditionally (include some conditions at write) - : write disabled (written value invalid) abit 12 34 d0 d bit name function w r rev. date of contents of revision issue pages points revision history 32170/32174 group user's manual overall description of the 32174 group added p1-7 m32174f4 and m32174f3 added to the internal flash memory and internal ram in figure 1.2.1 p1-10 table 1.2.4 added p1-11 note 1 in figure 1.3.1 corrected incorrect) operates with a 5 v power supply. correct) operates with 3.3 v and 5 v power supplies. p1-12 m32174f4vwg and m32174f3vwg added to figure 1.3.2 note 1 corrected incorrect) operates with a 5 v power supply. correct) operates with 3.3 v and 5 v power supplies. p1-13 table 1.3.1, "description of the 32170 pin function," corrected p1-19 m32174f4vfp and m32174f3vfp added to figure 1.4.1 p1-22 m32174f4vwg and m32174f3vwg added to figure 1.4.2 p2-14 section 2.7, "precautions on cpu," newly added p3-6 address space of the m32174f4 added to figure 3.1.4 p3-7 address space of the m32174f3 added to figure 3.1.5 p3-10 m32174f4 and m32174f3 added to table 3.3.1 p3-11 m32174f4 and m32174f3 added to table 3.4.1 p3-12 internal ram area/sfr (special function register) area of the m32174f4 and m32174f3 added to figure 3.4.3 p5-7 caution corrected p5-8 caution corrected p5-20- section 5.5.2, "processing by internal peripheral i/o interrupt by handlers," aftered p5-21 figure 5.5.2 altered p6-2 m32174f4 and m32174f3 added to table 6.2.1 p6-3 m32174f4 and m32174f3 added to table 6.3.1 p6-40 figure 6.5.15 corrected p6-45 bank configuration of the m32174f4 and m32174f3? internal ram added to figure 6.7.3 p6-46 precautions in notes 3 through 5 added p6-50 m32174f4? virtual-flash emulation area divided in units of 8 kbytes added to figure 6.7.10 0.1 mar.17,00 first edition issued 2.1 jan.16,03 ( 1 ?4 ) rev. date of contents of revision issue pages points revision history 32170/32174 group user's manual 2.1 jan.16,03 ( 2 ?4 ) p6-50 m32174f4? virtual-flash emulation area divided in units of 4 kbytes added to figure 6.7.11 p6-51 m32174f3? virtual-flash emulation area divided in units of 8 kbytes added to figure 6.7.12 m32174f3? virtual-flash emulation area divided in units of 8 kbytes added to figure 6.7.13 p6-60 precautions added p7-4 table 7.3.2 added p8-31 figures 8.4.1 through 8.4.4 corrected p8-34 p8-35 section 8.5, ?recautions on input/output ports,?newly added p10-1 chapter 10 overall. prescalers uniformly referred to as prs p10-232 p10-83 figure 10.3.8 corrected p10-184 (1) tod timer counter write enable/disable conditions newly added p10-185 p10-213 (1) tom timer counter write enable/disable conditions newly added p10-214 p11-3 table 11.1.1 corrected p11-48 contents of description in section 11.3.5, ?efinition of a-d conversion accuracy,?altered p11-49 figure 11.3.5 altered figures 11.3.6 and 11.3.7 deleted p11-51 figure 11.4.1, ?nternal equivalent circuit of the analog input unit,?newly added p12-27 description of the last line in section 12.2.8, ?io baud rate register, corrected incorrect) 7 or less correct) 7 or more p12-61 figure 12.7.5, ?iming at which to latch data during uart reception, newly added p13-2 description in section 13.1, ?utline of the can module,?corrected incorrect) compliant with can (controller area network) specification 2.0b correct) compliant with can (controller area network) specification 2.0b active rev. date of contents of revision issue pages points revision history 32170/32174 group user's manual 2.1 jan.16,03 ( 3 ?4 ) p13-2 contents of protocol description in table 13.1.1 corrected incorrect) can specification 2.0b correct) can specification 2.0b active precautions added to table 13.1.1 p13-9 precautions added to (4) frst (forcible reset) bit (d11) p13-14 precautions added to (11) msn (message slot number) bits (d12?15) p13-17 precautions added p13-21 precautions added to note 2 p13-35 precautions added p13-37 precautions in note 2 deleted p13-44 precautions added to description of can message slot data 0 (comslndt) p13-59 section 13.4.2, ?an timing,?newly added p13-81 figure 13.8.2 corrected p13-82 section 13.9, "precautions about can module," newly added p18-2 precautions added to figure 18.1.1 p19-14 description of bsdl for the 32170 (figures 19.5.1 through 19.5.19) deleted p19-15 precautions added to figures 19.6.1 and 19.7.2 p19-16 p19-17 figure 19.7.1, ?rocessing pins when not using jtag (for 240qfp), p19-18 and figure 19.7.2, ?rocessing pins when not using jtag (for 255qfp), newly added p20-1 power turn-on/turn-off sequences during vcce = 3.3 v added to diagrams p20-16 in chapter 20 p21-2 absolute maximum ratings (-40 to 125 o c) corrected p21-3 recommended operating conditions corrected p21-5 electrical characteristics in (1) f = (xin) = 10 mhz corrected p21-7 electrical characteristics in (3) f = (xin) = 8 mhz corrected p21-9 standard sample? icci-3v temperature characteristics (when operating: f = 8 mhz, 10 mhz) and standard sample? icci-3v temperature characteristics (when reset: f = 8 mhz, 10 mhz) newly added p21-11 a-d conversion characteristics (referenced to avcc = vref = vcce = 5.12 v, ta = -40 to 85 o c, f(xin) = 10.0 mhz unless otherwise noted) and a-d conversion characteristics (referenced to avcc = vref = vcce = 5.12 v, ta = -40 to 125 o c, f(xin) = 8.0 mhz unless otherwise noted) corrected rev. date of contents of revision issue pages points revision history 32170/32174 group user's manual p21-12 section 21.2, ?lectrical characteristics (when vcce = 3.3 v),?newly p21-19 added p21-23 table of ratings in (9) rtd timing newly added p21-33 rtd timing added to figure 21.3.12 appendix 1 appendix 1.1 "dimensional outline drawing" altered -2 appendix 3 appendix 3 altered or newly added overall appendix 4 ?rocessing of unused pins,?newly added 2.1 jan.16,03 ( 4 ?4 ) (1) table of contents chapter 1 overview 1.1 outline ................................................................................................................ 1-2 1.1.1 m32r family cpu core ............................................................................. 1-2 1.1.2 built-in multiply-accumulate operation function ........................................ 1-3 1.1.3 built-in flash memory and ram ................................................................. 1-3 1.1.4 built-in clock frequency multiplier ............................................................. 1-4 1.1.5 built-in powerful peripheral functions ........................................................ 1-4 1.1.6 built-in full-can function .......................................................................... 1-6 1.1.7 built-in debug function .............................................................................. 1-6 1.2 block diagram ................................................................................................... 1-7 1.3 pin function .................................................................................................... 1-11 1.4 pin layout ........................................................................................................ 1-19 chapter 2 cpu 2.1 cpu registers ................................................................................................... 2-2 2.2 general-purpose registers .............................................................................. 2-2 2.3 control registers .............................................................................................. 2-3 2.3.1 processor status word register: psw (cr0) ............................................ 2-4 2.3.2 condition bit register: cbr (cr1) ............................................................. 2-5 2.3.3 interrupt stack pointer: spi (cr2) .............................................................. 2-5 user stack pointer: spu (cr3) 2.3.4 backup pc: bpc (cr6) .............................................................................. 2-5 2.4 accumulator ...................................................................................................... 2-6 2.5 program counter .............................................................................................. 2-6 2.6 data formats ..................................................................................................... 2-7 2.6.1 data types ................................................................................................. 2-7 2.6.2 data formats .............................................................................................. 2-8 (2) 2.7 precautions on cpu ....................................................................................... 2-14 chapter 3 address space 3.1 outline of address space ................................................................................ 3-2 3.2 operation modes ............................................................................................... 3-8 3.3 internal rom area and extended external area .......................................... 3-10 3.3.1 internal rom area .................................................................................... 3-10 3.3.2 extended external area ............................................................................ 3-10 3.4 internal ram area and sfr area .................................................................. 3-11 3.4.1 internal ram area .................................................................................... 3-11 3.4.2 special function register (sfr) area ...................................................... 3-11 3.5 eit vector entry .............................................................................................. 3-30 3.6 icu vector table ............................................................................................. 3-31 3.7 notes on address space ................................................................................ 3-33 chapter 4 eit 4.1 outline of eit ..................................................................................................... 4-2 4.2 eit event ............................................................................................................ 4-3 4.2.1 exception .................................................................................................... 4-3 4.2.2 interrupt ...................................................................................................... 4-3 4.2.3 trap ............................................................................................................ 4-3 4.3 eit processing procedure ............................................................................... 4-4 4.4 eit processing mechanism ............................................................................. 4-6 4.5 acceptance of eit event .................................................................................. 4-7 4.6 saving and restoring the pc and psw .......................................................... 4-8 4.7 eit vector entry .............................................................................................. 4-10 4.8 exception processing .................................................................................... 4-11 4.8.1 reserved instruction exception (rie) ....................................................... 4-11 4.8.2 address exception (ae) ............................................................................ 4-13 4.9 interrupt processing ....................................................................................... 4-15 (3) 4.9.1 reset interrupt (ri) ................................................................................... 4-15 4.9.2 system break interrupt (sbi) .................................................................... 4-16 4.9.3 external interrupt (ei) ............................................................................... 4-18 4.10 trap processing ............................................................................................ 4-20 4.10.1 trap (trap) ........................................................................................... 4-20 4.11 eit priority levels ......................................................................................... 4-22 4.12 example of eit processing .......................................................................... 4-23 4.13 precautions on eit ....................................................................................... 4-25 chapter 5 interrupt controller (icu) 5.1 outline of interrupt controller (icu) ................................................................ 5-2 5.2 interrupt sources of internal peripheral i/os ................................................. 5-4 5.3 icu-related registers ...................................................................................... 5-6 5.3.1 interrupt vector register ............................................................................. 5-7 5.3.2 interrupt mask register .............................................................................. 5-8 5.3.3 sbi (system break interrupt) control register ........................................... 5-9 5.3.4 interrupt control registers ........................................................................ 5-10 5.4 icu vector table ............................................................................................. 5-14 5.5 description of interrupt operation ................................................................ 5-17 5.5.1 acceptance of internal peripheral i/o interrupts ....................................... 5-17 5.5.2 processing by internal peripheral i/o interrupt by handlers .................... 5-20 5.6 description of system break interrupt (sbi) operation .............................. 5-23 5.6.1 acceptance of sbi .................................................................................... 5-23 5.6.2 sbi processing by handler ....................................................................... 5-23 chapter 6 internal memory 6.1 outline of the internal memory ........................................................................ 6-2 6.2 internal ram ...................................................................................................... 6-2 6.3 internal flash memory ...................................................................................... 6-3 6.4 registers associated with the internal flash memory .................................. 6-4 (4) 6.4.1 flash mode register ................................................................................... 6-5 6.4.2 flash status registers ................................................................................ 6-6 6.4.3 flash control registers .............................................................................. 6-9 6.4.4 virtual flash l bank registers ................................................................. 6-15 6.4.5 virtual flash s bank registers ................................................................. 6-16 6.5 programming of the internal flash memory ................................................. 6-17 6.5.1 outline of programming flash memory .................................................... 6-17 6.5.2 controlling operation mode during programming flash .......................... 6-23 6.5.3 programming procedure to the internal flash memory ............................ 6-26 6.5.4 flash write time (for reference) ............................................................. 6-41 6.6 boot rom ........................................................................................................ 6-43 6.7 virtual flash emulation function .................................................................. 6-44 6.7.1 virtual flash emulation area .................................................................... 6-46 6.7.2 entering virtual flash emulation mode .................................................... 6-55 6.7.3 application example of virtual flash emulation mode ............................. 6-56 6.8 connecting to a serial programmer ............................................................. 6-58 6.9 precautions to be taken when rewriting flash memory ........................... 6-60 chapter 7 reset 7.1 outline of reset ................................................................................................ 7-2 7.2 reset operation ................................................................................................ 7-2 7.2.1 reset at power-on ...................................................................................... 7-2 7.2.2 reset during operation ............................................................................... 7-2 7.2.3 reset vector relocation during flash rewrite ........................................... 7-2 7.3 internal state immediately after reset release ............................................. 7-3 7.4 things to be considered after reset release .............................................. 7-5 chapter 8 input/output ports and pin functions 8.1 outline of input/output ports .......................................................................... 8-2 8.2 selecting pin functions ................................................................................... 8-4 8.3 input/output port related registers ............................................................... 8-6 (5) chapter 10 multijunction timers 10.1 outline of multijunction timers ................................................................... 10-2 8.3.1 port data registers .................................................................................... 8-8 8.3.2 port direction registers ............................................................................ 8-10 8.3.3 port operation mode registers ................................................................ 8-12 8.4 port peripheral circuits .................................................................................. 8-31 8.5 precautions on input/output ports ................................................................ 8-35 chapter 9 dmac 9.1 outline of the dmac ......................................................................................... 9-2 9.2 dmac related registers .................................................................................. 9-4 9.2.1 dma channel control register .................................................................. 9-6 9.2.2 dma software request generation registers ......................................... 9-17 9.2.3 dma source address registers ............................................................... 9-18 9.2.4 dma destination address registers ........................................................ 9-19 9.2.5 dma transfer count registers ................................................................. 9-20 9.2.6 dma interrupt request status registers .................................................. 9-21 9.2.7 dma interrupt mask registers .................................................................. 9-23 9.3 functional description of the dmac ............................................................ 9-27 9.3.1 cause of dma request ............................................................................ 9-27 9.3.2 dma transfer processing procedure ....................................................... 9-31 9.3.3 starting dma ............................................................................................ 9-32 9.3.4 channel priority ........................................................................................ 9-32 9.3.5 gaining and releasing control of the internal bus ................................... 9-33 9.3.6 transfer units ........................................................................................... 9-33 9.3.7 transfer counts ........................................................................................ 9-33 9.3.8 address space ......................................................................................... 9-34 9.3.9 transfer operation .................................................................................... 9-34 9.3.10 end of dma and interrupt ....................................................................... 9-37 9.3.11 status of each register after completion of dma transfer ................... 9-37 9.4 precautions about the dmac ........................................................................ 9-38 (6) 10.2 common units of multijunction timer ........................................................ 10-9 10.2.1 timer common register map ................................................................. 10-9 10.2.2 prescaler unit ....................................................................................... 10-12 10.2.3 clock bus/input-output event bus control unit ................................... 10-13 10.2.4 input processing control unit ............................................................... 10-18 10.2.5 output flip-flop control unit ................................................................ 10-26 10.2.6 interrupt control unit ............................................................................ 10-37 10.3 top (output-related 16-bit timer) ............................................................. 10-63 10.3.1 outline of top ...................................................................................... 10-63 10.3.2 outline of each mode of top ............................................................... 10-65 10.3.3 top related register map ................................................................... 10-67 10.3.4 top control registers .......................................................................... 10-70 10.3.5 top counters (top0ct-top10ct) .................................................... 10-77 10.3.6 top reload registers (top0rl-top10rl) ....................................... 10-78 10.3.7 top correction registers (top0cc-top10cc) ................................ 10-79 10.3.8 top enable control register ............................................................... 10-80 10.3.9 operation in top single-shot output mode (with correction function) .. 10-84 10.3.10 operation in top delayed single-shot output mode (with correction function) 10-91 10.3.11 operation in top continuous output mode (without correction function) . 10-96 10.4 tio (input/output-related 16-bit timer) ................................................... 10-100 10.4.1 outline of tio ..................................................................................... 10-100 10.4.2 outline of each mode of tio .............................................................. 10-102 10.4.3 tio related register map .................................................................. 10-105 10.4.4 tio control registers ......................................................................... 10-108 10.4.5 tio counter (tio0ct-tio9ct) .......................................................... 10-119 10.4.6 tio reload 0/ measure register (tio0rl0-tio9rl0) ...................... 10-120 10.4.7 tio reload 1 registers (tio0rl1-tio9rl1) .................................... 10-121 10.4.8 tio enable control registers ............................................................. 10-122 10.4.9 operation in tio measure free-run/clear input modes ..................... 10-125 10.4.10 operation in tio noise processing input mode ................................ 10-129 10.4.11 operation in tio pwm output mode ................................................. 10-130 10.4.12 operation in tio single-shot output mode (without correction function) .. 10-134 10.4.13 operation in tio delayed single-shot output mode (without correction function) .. 10-136 (7) 10.4.14 operation in tio continuous output mode (without correction function) . 10-138 10.5 tms (input-related 16-bit timer) .............................................................. 10-140 10.5.1 outline of tms .................................................................................... 10-140 10.5.2 outline of tms operation ................................................................... 10-140 10.5.3 tms related register map ................................................................ 10-142 10.5.4 tms control registers ....................................................................... 10-143 10.5.5 tms counters (tms0ct, tms1ct) .................................................. 10-145 10.5.6 tms measure registers (tms0mr3-0, tms1mr3-0) ....................... 10-146 10.5.7 operation of tms measure input ....................................................... 10-147 10.6 tml (input-related 32-bit timer) .............................................................. 10-149 10.6.1 outline of tml .................................................................................... 10-149 10.6.2 outline of tml operation ................................................................... 10-150 10.6.3 tml related register map ................................................................. 10-151 10.6.4 tml control registers ........................................................................ 10-152 10.6.5 tml counters ..................................................................................... 10-154 10.6.6 tml measure registers ..................................................................... 10-156 10.6.7 operation of tml measure input ........................................................ 10-158 10.7 tid (input-related 16-bit timer) ................................................................ 10-160 10.7.1 outline of tid ...................................................................................... 10-160 10.7.2 tid related register map .................................................................. 10-162 10.7.3 tid control &prescaler enable registers .......................................... 10-163 10.7.4 tid counters (tid0ct, tid1ct, tid2ct) ......................................... 10-166 10.7.5 tid reload registers (tid0rl, tid1rl, tid2rl) ............................. 10-167 10.7.6 outline of each mode of tid .............................................................. 10-168 10.8 tod (output-related 16-bit timer) ........................................................... 10-173 10.8.1 outline of tod .................................................................................... 10-173 10.8.2 outline of each mode of tod ............................................................. 10-175 10.8.3 tod related register map ................................................................ 10-177 10.8.4 tod control registers (tod0cr) ..................................................... 10-180 10.8.5 tod counters ..................................................................................... 10-182 10.8.6 tod reload 0 registers ..................................................................... 10-186 10.8.7 tod reload 1 registers ..................................................................... 10-188 10.8.8 tod enable protect registers ........................................................... 10-190 (8) chapter 11 a-d converters 11.1 outline of a-d converter .............................................................................. 11-2 11.1.1 conversion modes .................................................................................. 11-6 11.1.2 operation modes .................................................................................... 11-7 11.1.3 special operation modes ..................................................................... 11-11 11.1.4 a-d converter interrupt and dma transfer requests .......................... 11-14 11.2 a-d converter related registers .............................................................. 11-15 11.2.1 a-d single mode register 0 ................................................................. 11-19 11.2.2 a-d single mode register 1 ................................................................. 11-23 11.2.3 a-d scan mode register 0 ................................................................... 11-26 11.2.4 a-d scan mode register 1 ................................................................... 11-30 10.8.9 tod cout enable registers ............................................................... 10-192 10.8.10 operation in tod pwm output mode .............................................. 10-195 10.8.11 operation in tod single-shot output mode (without correction function) 10-199 10.8.12 operation in tod delayed single-shot output mode (without correction function) 10-201 10.8.13 operation in tod continuous output mode (without correction function) . 10-203 10.9 tom (output-related 16-bit timer) .......................................................... 10-205 10.9.1 outline of tom ................................................................................... 10-205 10.9.2 outline of each mode of tom ............................................................ 10-207 10.9.3 tom related register map ................................................................ 10-209 10.9.4 tom control registers ....................................................................... 10-211 10.9.5 tom counters .................................................................................... 10-212 10.9.6 tom reload 0 registers .................................................................... 10-215 10.9.7 tom reload 1 registers .................................................................... 10-216 10.9.8 tom enable protect registers ........................................................... 10-217 10.9.9 tom count enable registers ............................................................. 10-218 10.9.10 operation in tom pwm output mode ............................................... 10-220 10.9.11 operation in tom single-shot output mode (without correction function) 10-224 10.9.12 operation in tom single-shot pwm output mode (without correction function) .... 10-226 10.9.13 operation in tom continuous output mode (without correction function) ... 10-228 10.9.14 example application for using the 32170 in motor control ............... 10-230 (9) 11.2.5 a-d successive approximation register .............................................. 11-33 11.2.6 a-d0 comparate data register ............................................................. 11-35 11.2.7 10-bit a-d data registers ..................................................................... 11-37 11.2.8 8-bit a-d data registers ....................................................................... 11-39 11.3 functional description of a-d converters ............................................... 11-41 11.3.1 how to find along input voltages ........................................................ 11-41 11.3.2 a-d conversion by successive approximation method ....................... 11-42 11.3.3 comparator operation .......................................................................... 11-44 11.3.4 calculation of the a-d conversion time ............................................... 11-45 11.3.5 definition of the a-d conversion accuracy ........................................... 11-48 11.4 precautions on using a-d converters ...................................................... 11-50 chapter 12 serial i/o 12.1 outline of serial i/o ....................................................................................... 12-2 12.2 serial i/o related registers ......................................................................... 12-6 12.2.1 sio interrupt related registers .............................................................. 12-7 12.2.2 sio interrupt control registers .............................................................. 12-9 12.2.3 sio transmit control registers ............................................................ 12-16 12.2.4 sio transmit/receive mode registers ................................................ 12-18 12.2.5 sio transmit buffer registers .............................................................. 12-21 12.2.6 sio receive buffer registers ............................................................... 12-22 12.2.7 sio receive control registers ............................................................. 12-23 12.2.8 sio baud rate registers ..................................................................... 12-26 12.3 transmit operation in csio mode ............................................................ 12-28 12.3.1 setting the csio baud rate ................................................................. 12-28 12.3.2 initial settings for csio transmission .................................................. 12-29 12.3.3 starting csio transmission ................................................................. 12-31 12.3.4 successive csio transmission ........................................................... 12-31 12.3.5 processing at end of csio transmission ............................................ 12-32 12.3.6 transmit interrupt ................................................................................. 12-32 12.3.7 transmit dma transfer request .......................................................... 12-32 12.3.8 typical csio transmit operation ......................................................... 12-34 (10) 12.4 receive operation in csio mode .............................................................. 12-36 12.4.1 initial settings for csio reception ....................................................... 12-36 12.4.2 starting csio reception ...................................................................... 12-38 12.4.3 processing at end of csio reception .................................................. 12-38 12.4.4 about successive reception ................................................................ 12-39 12.4.5 flags indicating the status of csio receive operation ....................... 12-40 12.4.6 typical csio receive operation .......................................................... 12-41 12.5 precautions on using csio mode ............................................................. 12-43 12.6 transmit operation in uart mode ........................................................... 12-45 12.6.1 setting the uart baud rate ................................................................ 12-45 12.6.2 uart transmit/receive data formats ................................................ 12-46 12.6.3 initial settings for uart transmission ................................................. 12-48 12.6.4 starting uart transmission ................................................................ 12-50 12.6.5 successive uart transmission .......................................................... 12-50 12.6.6 processing at end of uart transmission ........................................... 12-51 12.6.7 transmit interrupt ................................................................................. 12-51 12.6.8 transmit dma transfer request .......................................................... 12-51 12.6.9 typical uart transmit operation ........................................................ 12-53 12.7 receive operation in uart mode ............................................................. 12-55 12.7.1 initial settings for uart reception ...................................................... 12-55 12.7.2 starting uart reception ..................................................................... 12-57 12.7.3 processing at end of uart reception ................................................. 12-57 12.7.4 typical uart receive operation ......................................................... 12-59 12.8 fixed period clock output function ......................................................... 12-62 12.9 precautions on using uart mode ............................................................ 12-63 chapter 13 can module 13.1 outline of the can module .......................................................................... 13-2 13.2 can module related registers ................................................................... 13-4 13.2.1 can control register ............................................................................. 13-8 13.2.2 can status register ............................................................................. 13-11 13.2.3 can extended id register ................................................................... 13-15 (11) 13.2.4 can configuration register ................................................................. 13-16 13.2.5 can time stamp count register ......................................................... 13-19 13.2.6 can error count registers .................................................................. 13-20 13.2.7 can baud rate prescaler .................................................................... 13-21 13.2.8 can interrupt related registers .......................................................... 13-22 13.2.9 can mask registers ............................................................................ 13-30 13.2.10 can message slot control registers ................................................. 13-34 13.2.11 can message slots ............................................................................ 13-38 13.3 can protocol ............................................................................................... 13-53 13.3.1 can protocol frame ............................................................................. 13-53 13.4 initializing the can module ........................................................................ 13-56 13.4.1 initialization of the can module ............................................................ 13-56 13.4.2 can timing .......................................................................................... 13-59 13.5 transmitting data frames .......................................................................... 13-60 13.5.1 data frame transmit procedure .......................................................... 13-60 13.5.2 data frame transmit operation ........................................................... 13-62 13.5.3 transmit abort function ....................................................................... 13-63 13.6 receiving data frames .............................................................................. 13-64 13.6.1 data frame receive procedure ........................................................... 13-64 13.6.2 data frame receive operation ............................................................ 13-66 13.6.3 reading out received data frames .................................................... 13-68 13.7 transmitting remote frames .................................................................... 13-70 13.7.1 remote frame transmit procedure ..................................................... 13-70 13.7.2 remote frame transmit operation ...................................................... 13-72 13.7.3 reading out received data frames when set for remote frame transmission .. 13-75 13.8 receiving remote frames ......................................................................... 13-77 13.8.1 remote frame receive procedure ...................................................... 13-77 13.8.2 remote frame receive operation ....................................................... 13-79 13.9 precautions about can module ................................................................ 13-82 chapter 14 real-time debugger (rtd) (12) 14.1 outline of the real-time debugger (rtd) .................................................. 14-2 14.2 pin function of the rtd ............................................................................... 14-3 14.3 functional description of the rtd .............................................................. 14-4 14.3.1 outline of rtd operation ....................................................................... 14-4 14.3.2 operation of rdr (real-time ram content output) .............................. 14-5 14.3.3 operation of wrr (ram content forcible rewrite) .............................. 14-7 14.3.4 operation of ver (continuous monitor) ................................................. 14-9 14.3.5 operation of vei (interrupt request) .................................................... 14-10 14.3.6 operation of rcv (recover from runaway) ........................................ 14-11 14.3.7 method to set a specified address when using the rtd .................... 14-12 14.3.8 resetting the rtd ................................................................................ 14-13 14.4 typical connection with the host ............................................................. 14-14 chapter 15 external bus interface 15.1 external bus interface related signals ...................................................... 15-2 15.2 read/write operations ................................................................................. 15-6 15.3 bus arbitration ............................................................................................ 15-12 15.4 typical connection of external extension memory ................................ 15-14 chapter 16 wait controller 16.1 outline of the wait controller ...................................................................... 16-2 16.2 wait controller related registers ............................................................... 16-4 16.2.1 wait cycles control register .................................................................. 16-5 16.3 typical operation of the wait controller .................................................... 16-6 chapter 17 ram backup mode 17.1 outline ............................................................................................................ 17-2 17.2 example of ram backup when power is down ......................................... 17-2 17.2.1 normal operating state .......................................................................... 17-3 17.2.2 ram backup state ................................................................................. 17-4 (13) 17.3 example of ram backup for saving power consumption ....................... 17-5 17.3.1 normal operating state .......................................................................... 17-6 17.3.2 ram backup state ................................................................................. 17-7 17.3.3 precautions to be observed at power-on .............................................. 17-8 17.4 exiting ram backup mode (wakeup) ......................................................... 17-9 chapter 18 oscillation circuit 18.1 oscillator circuit ........................................................................................... 18-2 18.1.1 example of an oscillator circuit .............................................................. 18-2 18.1.2 system clock output function ............................................................... 18-3 18.1.3 oscillation stabilization time at power-on ............................................. 18-4 18.2 clock generator circuit ................................................................................ 18-5 chapter 19 jtag 19.1 outline of jtag ............................................................................................. 19-2 19.2 configuration of the jtag circuit ............................................................... 19-3 19.3 jtag registers ............................................................................................. 19-4 19.3.1 instruction register (jtagir) ................................................................. 19-4 19.3.2 data registers ........................................................................................ 19-5 19.4 basic operation of jtag ............................................................................. 19-6 19.4.1 outline of jtag operation ..................................................................... 19-6 19.4.2 ir path sequence ................................................................................... 19-8 19.4.3 dr path sequence ............................................................................... 19-10 19.4.4 examining and setting data registers ................................................. 19-12 19.5 boundary scan description language ..................................................... 19-14 19.6 precautions on board design when using jtag .................................... 19-15 19.7 processing pins when not using jtag ................................................... 19-17 chapter 20 power-on/power-shutdown sequence (14) 20.1 configuration of the power supply circuit ................................................ 20-2 20.2 power-on sequence ..................................................................................... 20-4 20.2.1 power-on sequence when not using ram backup ............................. 20-4 20.2.2 power-on sequence when using ram backup .................................... 20-6 20.3 power-shutdown sequence ......................................................................... 20-8 20.3.1 power-shutdown sequence when not using ram backup .................. 20-8 20.3.2 power-shutdown sequence when using ram backup ....................... 20-10 chapter 21 electrical characteristics 21.1 electrical characteristics (vcce=5v) ................................................... 21-2 21.1.1 absolute maximum ratings .................................................................... 21-2 21.1.2 recommended operating conditions ..................................................... 21-3 21.1.3 dc characteristics .................................................................................. 21-5 21.1.3.1 electrical characteristics ................................................................ 21-5 21.1.3.2 flash related electrical characteristics ....................................... 21-10 21.1.4 a-d conversion characteristics ............................................................ 21-11 21.2 electrical characteristics (vcce=3.3v) .............................................. 21-12 21.2.1 absolute maximum ratings .................................................................. 21-12 21.2.2 recommended operating conditions ................................................... 21-13 21.2.3 dc characteristics ................................................................................ 21-15 21.2.3.1 electrical characteristics .............................................................. 21-15 21.2.3.2 flash related electrical characteristics ....................................... 21-18 21.2.4 a-d conversion characteristics ............................................................ 21-19 21.3 ac characteristics ...................................................................................... 21-20 21.3.1 timing requirements ............................................................................ 21-20 21.3.2 switching characteristics ...................................................................... 21-24 21.3.3 ac characteristics ................................................................................ 21-27 chapter 22 typical characteristics 22.1 a-d conversion characteristics .................................................................. 22-2 (15) appendix 1 mechanical specifications appendix 1.1 dimensional outline drawing ....................................... appendix 1-2 appendix 2 instruction processing time appendix 2.1 32170/32174 instruction processing time .................. appendix 2-2 appendix 3 precautions about noise appendix 3.1 precautions about noise .............................................. appendix 3-2 appendix 3.1.1 reduction of wiring length ........................................ appendix 3-2 appendix 3.1.2 inserting a bypass capacitor between vss and vcc lines ...... appendix 3-5 appendix 3.1.3 processing analog input pin wiring ........................... appendix 3-6 appendix 3.1.4 consideration about the oscillator and vcn pin ........ appendix 3-7 appendix 3.1.5 processing input/output ports .................................. appendix 3-11 appendix 4 processing of unused pins appendix 4.1 example for processing unused pins .......................... appendix 4-2 chapter 1 chapter 1 overview 1.1 outline 1.2 block diagram 1.3 pin function 1.4 pin layout 1 1-2 32170/32174 group user's manual (rev. 2.1) 1.1 outline 1.1.1 m32r family cpu core (1) based on risc architecture the 32170 and 32174 are 32-bit risc single-chip microcomputers; each of them is built around the m32r family cpu core (hereafter referred to as the m32r) and incorporates flash memory, ram, and various other peripheral functions-all integrated into a single chip. the m32r is based on risc architecture. memory access is performed using load and store instructions, and various arithmetic operations are executed using register-to-register operation instructions. the m32r internally contains sixteen 32-bit general-purpose registers and has 83 distinct instructions. the m32r supports compound instructions such as load & address update and store & address update, in addition to ordinary load and store instructions. these compound instructions help to speed up data transfers. (2) 5-stage pipelined processing the m32r uses 5-stage pipelined instruction processing consisting of instruction fetch, decode, execute, memory access, and write back. not just load and store instructions or register-to-register operation instructions, compound instructions such as load & address update and store & address update also are executed in one cycle. instructions are entered into the execution stage in the order they are fetched, but this does not always mean that the first instruction entered is executed first. if the execution of a load or store instruction entered earlier is delayed by one or more wait cycles inserted in memory access, a register-to-register operation instruction entered later may be executed before said load or store instruction. by using "out-of-order-completion" like this, the m32r controls instruction execution without wasting clock cycles. (3) compact instruction code the m32r instructions come in two types: one consisting of 16 bits in length, and the other consisting of 32 bits in length. use of the 16-bit length instruction format especially helps to suppress the program code size. some 32-bit long instructions can branch directly to a location 32 mbytes forward or backward from the instruction address being executed. compared to architectures where address space is segmented, this direct jump allows for easy programming. overview 1.1 outline 1 1-3 32170/32174 group user's manual (rev. 2.1) overview 1.1 outline 1.1.2 built-in multiply-accumulate operation function (1) built-in high-speed multiplier the m32r incorporates a 32-bit 16-bit high-speed multiplier which enables it to execute a 32-bit 32-bit integral multiplication instruction in three cycles (1 cycle = 25 ns when using a 40 mhz internal cpu clock). (2) supports multiply-accumulate operation instructions comparable to dsp the m32r supports the following four modes of multiply-accumulate operation instructions (or multiplication instructions) using a 56-bit accumulator. any of these operations can be executed in one cycle. (a) 16 high-order register bits 16 high-order register bits (b) 16 low-order register bits 16 low-order register bits (c) entire 32 register bits 16 high-order register bits (d) entire 32 register bits 16 low-order register bits the m32r has instructions to round off the value stored in the accumulator to 16 or 32 bits, as well as instructions to shift the accumulator value to adjust digits and store the digit-adjusted value in a register. these instructions also can be executed in one cycle, so that when combined with high-speed data transfer instructions such as load & address update and store & address update, they enable the m32r to exhibit high data processing capability comparable to that of dsp. 1.1.3 built-in flash memory and ram this microcomputer contains flash memory and ram which can be accessed with no wait states, allowing you to build a high-speed embedded system. the internal flash memory allows for on-board programming (you can write to it while being mounted on the printed circuit board). use of flash memory means the chip engineered at the development phase can be used directly in mass-production, so that you can smoothly migrate from prototype to mass-production without changing the printed circuit board. the internal flash memory can be rewritten 100 times. the internal flash memory has a pseudo-flash emulation function, allowing the internal ram to be artificially mapped into part of the internal flash memory. this function, when combined with the internal real-time debugger (rtd), facilitates data tuning on rom tables. the internal ram can be accessed for read or rewrite from an external device independently of the m32r by using rtd (real-time debugger). it is communicated with external devices by rtd's exclusive clock-synchronized serial i/o. 1 1-4 32170/32174 group user's manual (rev. 2.1) overview 1.1 outline 1.1.4 built-in clock frequency multiplier this microcomputer internally multiplies the input clock signal frequency by 4 and the internal peripheral clock by 2. if the input clock frequency is 10.0 mhz, the cpu clock frequency will be 40 mhz and the internal clock frequency 20 mhz. 1.1.5 built-in powerful peripheral functions (1) built-in multijunction timer (mjt) the multijunction timer is configured with the following timers: (a) 16-bit output-related timer 35 channels (b) 16-bit input/output-related timer 10 channels (c) 16-bit input-related timer 11 channels (incorporating three channels of multiply-by-4 counter) (d) 32-bit input-related timer 8 channels each timer has multiple modes of operation, which can be selected according of the purpose of use. the multijunction timer has internal clock bus, input event bus, and output event bus, allowing multiple timers to be combined for use internally. this provides a flexible way to make use of timer functions. the output-related timers (top) have a correction function. this function allows the timer's count value in progress to be increased or reduced as desired, thus materializing real-time output control. (2) built-in 10-channel dma the 10-channel dma is built-in, supporting data transfers between internal peripheral i/os or between internal peripheral i/o and internal ram. not only can dma transfer requests be generated in software, but can also be triggered by a signal generated by an internal peripheral i/o (e.g., a-d converter, mjt, or serial i/o). cascaded connection between dma channels (dma transfer in a channel is started by completion of transfer in another) is also supported, allowing for high-speed transfer processing without imposing any extra load on the cpu. (3) built-in 16-channel a-d converters this microcomputer contains two 16-channel a-d converters which can convert data in 10-bit resolution. in addition to single a-d conversion in each channel, successive a-d conversion in four, eight, or 16 channels combined into one unit is possible. in addition to ordinary a-d conversion, a comparator mode is supported in which the a-d conversion result is compared with a given set value to determine the relative magnitudes of two quantities. when a-d conversion is completed, this microcomputer can generate not only an interrupt, but can also generate a dma transfer request. this microcomputer supports two read out modes, so that a-d conversion results can be read out in 8 bits or 10 bits. 1 1-5 32170/32174 group user's manual (rev. 2.1) overview 1.1 outline (4) high-speed serial i/o this microcomputer incorporates 6 channels of serial i/o, which can be set for clock- synchronized serial i/o or uart. when set for clock-synchronized serial i/o, the data transfer rate is a high 2 mbits per second. when data reception is completed or the transmit buffer becomes empty, the serial i/o can generate a dma transfer request signal. (5) built-in real-time debugger (rtd) the real-time debugger (rtd) provides a function for the m32r/ecu's internal ram to be accessed directly from an external device. the debugger communicates with external devices through its exclusive clock-synchronized serial i/o. by using the rtd, you can read the contents of the internal ram or rewrite its data from an external device independently of the m32r. the debugger can generate an rtd interrupt to notify that rtd-based data transmission or reception is completed. (6) eight-level interrupt controller the interrupt controller manages interrupt requests from each internal peripheral i/o by resolving interrupt priority in eight levels including an interrupt-disabled state. also, it can accept external interrupt requests due to power-down detection or generated by a watchdog timer as a system break interrupt (sbi). (7) three operation modes the m32r/ecu has three operation modes-single-chip mode, extended external mode, and processor mode. the address space and external pin functions of the m32r/ecu are switched over according to a mode in which it operates. the mod0 and mod1 pins are used to set a mode. (8) wait controller the wait controller supports access to external devices by the m32r. in all but single-chip mode, the extended external area provides 4 mbytes of space. 1 1-6 32170/32174 group user's manual (rev. 2.1) 1.1.6 built-in full-can function this microcomputer contains can specification v2.0b active-compliant can module, thereby providing 16 message slots. 1.1.7 built-in debug function this microcomputer supports jtag interface. boundary scan test can be performed using this jtag interface. overview 1.1 outline 1 1-7 32170/32174 group user's manual (rev. 2.1) overview 1.2 block diagram 1.2 block diagram figure 1.2.1 shows a block diagram of the 32170/32174. features of each block are shown in tables 1.2.1 through 1.2.3. figure 1.2.1 block diagram of the 32170/32174 pll clock generator circuit internal bus interface address data internal ram (m32170f6:40kb) (m32170f4:32kb) (m32170f3:32kb) (m32174f4:40kb) (m32174f3:40kb) internal flash memory (m32170f6:768kb) (m32170f4:512kb) (m32170f3:384kb) (m32174f4:512kb) (m32174f3:384kb) m32r cpu core (max 40mhz) multiplier- accumulator (32 16 + 56) dmac (10 channels) multijunction timer (mjt: 64 channels) serial i/o (6 channels) a-d converter (10-bit resolution, 16 channels) 2 wait controller interrupt controller (31 sources, 8 levels) real-time debugger (rtd) external bus interface internal 16-bit bus internal 32-bit bus input/output port (jtag), 157 lines full can (1 channel) 32170/32174 1 1-8 32170/32174 group user's manual (rev. 2.1) overview 1.2 block diagram table 1.2.1 features of the m32r family cpu core functional block features m32r family bus specifications cpu core basic bus cycle: 25 ns (when operating with 40 mhz cpu clock) logical address space: 4gbytes, linear extended external area: maximum 4 mbytes external data bus: 16 bits implementation: five-stage pipeline internal 32-bit architecture for the core register configuration general-purpose register: 32 bits 16 registers control register: 32 bits 5 registers instruction set 16-bit and 32-bit instruction formats 83 distinct instructions and 6 addressing modes built-in multiplier/accumulator (32 16 + 56) table 1.2.2 features of internal memory functional block features ram capacity m32170f6, m32174f4, m32174f3 : 40 kbytes m32170f4, m32170f3 : 32 kbytes no-wait access (when operating with 40 mhz cpu clock) by using rtd (real-time debugger), the internal ram can be accessed for read or rewrite from external devices independently of the m32r. flash memory capacity m32170f6 : 768 kbytes m32170f4, m32174f4 : 512 kbytes m32170f3, m32174f3 : 384 kbytes no-wait access (when operating with 40 mhz cpu clock) durability: can be rewritten 100 times 1 1-9 32170/32174 group user's manual (rev. 2.1) table 1.2.3 features of internal peripheral i/o functional block features dma 10-channel dma supports transfer between internal peripheral i/os and between internal peripheral i/o and internal ram. capable of advanced dma transfer when operating in combination with internal peripheral i/o capable of cascaded connection between dma channels (dma transfer in a channel is started by completion of transfer in another) multijunction 64-channel multifunction timer contains output-related timer 35 channels, input/output-related timer 10 channels, 16-bit input-related timer 11 channels, and 32-bit input-related timer 8 channels. capable of flexible timer configuration by mutual connection between each channel. a-d converter 16-channel, 10-bit resolution a-d converter 2 units incorporates comparator mode can generate interrupt or start dma transfer upon completion of a-d conversion. can read out conversion results in 8 or 10 bits. serial i/o 6-channel serial i/o can be set for clock-synchronized serial i/o or uart. capable of high-speed data transfer at 2 mbits per second when clock synchronized or 156 kbits per second during uart. real-time debugger can rewrite or monitor the internal ram independently of the cpu by command input from an external source. has its exclusive clock-synchronized serial port. interrupt controller accepts and manages interrupt requests from internal peripheral i/o. resolves interrupt priority in 8 levels including interrupt-disabled state. wait controller controls wait state for access to extended external areas. can insert 1 to 4 wait cycles by setting in software and extend wait period by external wait signal. clock pll multiply-by-4 clock generator circuit maximum 40 mhz of cpu clock (cpu, internal rom, internal ram access) maximum 20 mhz of internal peripheral clock (peripheral module access) maximum external input clock frequency=10 mhz can sixteen message slots jtag capable of boundary scan overview 1.2 block diagram 1 1-10 32170/32174 group user's manual (rev. 2.1) table 1.2.4 list of type name type name ram size (k bytes) rom size (k bytes) package number of pins m32170f3vfp 32 384 240qfp 240 m32170f4vfp 32 512 240qfp 240 m32170f6vfp 40 768 240qfp 240 m32170f3vwg 32 384 255fbga 255 m32170f4vwg 32 512 255fbga 255 m32170f6vwg 40 768 255fbga 255 m32174f3vfp 40 384 240qfp 240 m32174f4vfp 40 512 240qfp 240 m32174f3vwg 40 384 255fbga 255 m32174f4vwg 40 512 255fpga 255 overview 1.2 block diagram 1 1-11 32170/32174 group user's manual (rev. 2.1) overview 1.3 pin function 1.3 pin function figure 1.3.1 shows a pin function diagram of the 32170/32174 in 240qfp package. figure 1.3.2 shows a pin function diagram of the 32170/32174 in 255fbga package. table 1.3.1 explains the function of each pin of the 32170/32174. table 1.3.2 explains the function of the dedicated debug pins of the 32170/32174 in 255fbga package. figure 1.3.1 pin function diagram of 240qfp xin reset m32170f6vfp , m32170f4vfp , m32170f3vfp , m32174f4vfp , m32174f3vfp clock reset vcci vss 6 16 p20 p27/a23 a30 p30 p37/a15 a22 p46, p47/a13, a14 address bus 20 p00 p07/db0 db7 p10 p17/db8 db15 data bus 16 p72/hreq p73/hack bus control p71/wait interrupt controller p43/rd p44/cs0 p45/cs1 p41/blw/ble p42/bhw/bhe port 22 port 2 port 3 port 4 port 0 port 1 port 7 port 4 xout vcnt osc-vcc osc-vss mod0 mod1 mode p190 p197/tin26 tin33 p172, p173/tin24, tin25 p150 p157/tin0 tin7 p140 p147/tin8 tin15 p130 p137/tin16 tin23 34 port 19 port 17 port 15 port 14 port 13 p124 p127/ tclk0 tclk 3 4 multi- junction timer 45 p210 - p217/to37 - to44 p180 - p187/to29 - to36 p160 - p167/to21 - to28 p110 - p117/to0 - to7 p100 - p107/to8 - to15 p93 - p97/to16 - to20 port 12 port 21 port 18 port 16 port 11 port 10 port 9 p74/rtdtxd p75/rtdrxd p76/rtdack p77/rtdclk real-time debugger port 7 p70/bclk/wr port 7 p82/txd0 p83/rxd0 p84/sclki0/sclko0 p85/txd1 p86/rxd1 p87/sclki1/sclko1 serial i/o port 8 16 ad1in0 ad1in15 a-d converter p67/adtrg avcc0, avcc1 avss0, avss1 port 6 p61-p63 port 6 avref0, avref1 vdd fvcc fp vcce 7 p174/txd2 p175/rxd2 p176/txd3 p177/rxd3 port 17 3.3v 5v 3.3v 5v 3.3v 3.3v 5v note1: : denotes blocks operating with a 3.3 v power supply. : denotes blocks operating with a 5 v or 3.3v power supply. 16 ad0in0 ad0in15 2 2 2 p200/txd4 p201/rxd4 p202/txd5 p203/rxd5 port 20 p220/ctx p221/crx can jtms jtck jtrst jtdo jtag jtdi port 22 p222, p223 port 22 p224/a11(note2) p225/a12(note2) note2: use caution when using this port because it has a debug event function. p65/sclki4/sclko4 p64/sbi port 6 p66/sclki5/sclko5 port 6 3 1 1-12 32170/32174 group user's manual (rev. 2.1) overview 1.3 pin function figure 1.3.2 pin function diagram of 255fbga xin reset m32170f6vwg , m32170f4vwg , m32170f3vwg , m32174f4vwg , m32174f3vwg clock reset vcci vss 6 16 p20 p27/a23 a30 p30 p37/a15 a22 p46, p47/a13, a14 address bus 20 p00 p07/db0 db7 p10 p17/db8 db15 data bus 16 p72/hreq p73/hack bus control p71/wait interrupt controller p43/rd p44/cs0 p45/cs1 p41/blw/ble p42/bhw/bhe port 22 port 2 port 3 port 4 port 0 port 1 port 7 port 4 xout vcnt osc-vcc osc-vss mod0 mod1 mode p190 p197/tin26 tin33 p172, p173/tin24, tin25 p150 p157/tin0 tin7 p140 p147/tin8 tin15 p130 p137/tin16 tin23 34 port 19 port 17 port 15 port 14 port 13 p124 p127/ tclk0 tclk 3 4 multi- junction timer 45 p210 p217/to37 to44 p180 p187/to29 to36 p160 p167/to21 to28 p110 p117/to0 to7 p100 p107/to8 to15 p93 p97/to16 to20 port 12 port 21 port 18 port 16 port 11 port 10 port 9 p74/rtdtxd p75/rtdrxd p76/rtdack p77/rtdclk real-time debugger port 7 p70/bclk/wr port 7 p82/txd0 p83/rxd0 p84/sclki0/sclko0 p85/txd1 p86/rxd1 p87/sclki1/sclko1 serial i/o port 8 16 ad1in0 ad1in15 a-d converter p67/adtrg avcc0, avcc1 avss0, avss1 port 6 p61 p63 port 6 avref0, avref1 vdd fvcc fp vcce 7 p174/txd2 p175/rxd2 p176/txd3 p177/rxd3 port17 3.3v 5v 3.3v 5v 3.3v 3.3v 5v note1: : denotes blocks operating with a 3.3 v power supply : denotes blocks operating with a 5 v or 3.3v power supply. 16 ad0in0 ad0in15 2 2 2 p200/txd4 p201/rxd4 p202/txd5 p203/rxd5 port 20 p220/ctx p221/crx can jtms jtck jtrst jtdo jtag jtdi port 22 p222, p223 port 22 p224/a11 (note2) p225/a12 (note2) note2: use caution when using this port because it has a debug event function. p65/sclki4/sclko4 p64/sbi port 6 p66/sclki5/sclko5 port 6 3 8 trclk trsync trdata jdbi jevento jevent1 dbgug note3: 255fbga is currently under development. 1 1-13 32170/32174 group user's manual (rev. 2.1) table 1.3.1 description of the 32170 pin function (1/6) type pin name signal name input/output function power vcce power supply power supply to external i/o ports (5 v or 3.3v). supply vcci power supply power supply to internal logic (3.3 v). vdd ram power supply power supply for internal ram backup (3.3 v). fvcc flash power supply power supply for internal flash memory (3.3 v). vss ground connect all vss to ground (gnd). clock xin, clock input clock input/output pins. these pins contains a pll-based xout output frequency multiplier circuit. apply a clock whose frequency is 1/4 the operating frequency. (when using 40 mhz cpu clock, xin input = 10.0 mhz) __ bclk/wr system clock output when bclk pin is selected, it outputs a clock whose frequency is twice that of an external input clock (e.g., bclk output = 20 mhz when an external input clock is 10 mhz). use this facility for external synchronization design. when wr# pin is selected, it indicates the byte position in which valid data is transferred when writing to an external device. osc-vcc power supply power supply for pll circuit. connect osc-vcc to the power supply rail. osc-vss ground connect osc-vss to ground. vcnt pll control input this pin controls the pll circuit. connect a resistor and capacitor to it. (for external circuits, refer to section 18.1.1, "example of an oscillator circuit.") reset _____ reset reset input this pin resets the internal circuit. mode mod0 mode input these pins set operation mode. mod1 fp mod0 mod1 mode x 0 0 single-chip mode x 0 1 extended external mode 0 1 0 processor mode 1 1 110 0 00 (boot mode) (note) x 1 1 (reserved) address a11 ?a30 address output the device has 20 address lines (a11-a30) to allow two bus bus channels of up to 2 mb of memory space to be added external to the chip. a31 is not output. note: for boot mode, refer to chapter 6, "internal memory." overview 1.3 pin function 1 1-14 32170/32174 group user's manual (rev. 2.1) table 1.3.1 description of the 32170 pin function (2/6) type pin name signal name input/output function data db0-db15 data bus input/output these pins comprise 16-bit data bus to connect external devices. in write bus cycles, the valid byte positions to be ___ ___ written on the 16-bit data bus are output as bhw/bhe and ___ ___ blw/ble. in read cycles, data is always read from the 16- bit data bus. however, when transferring to the internal circuit of the m32r, only data at the valid byte positions are transferred. bus ___ cs0, chip select output these pins comprise external device chip select signal. for control ___ cs1 areas for which a chip select signal is output, refer to chapter 3, "address space." __ rd read output this signal is output when reading an external device. ___ ___ bhw/bhe byte high output indicates the byte position to which valid data is transferred write/enable ___ ___ when writing to an external device. bhw/bhe corresponds ___ ___ blw/ble byte low output ___ ___ to the upper address (d0-d7 is valid); blw/ble write/enable corresponds to the lower address (d8-d15 is valid). ____ wait wait input when the m32r accesses an external device, a low on this ____ wait input extends the wait cycle. ____ hreq hold request input this pin is used by an external device to request control of ____ the external bus. a low on this hreq input causes the m32r to enter a hold state. ____ hack hold output this signal is used to notify that the m32r has entered a acknowledge hold state and relinquished control of the external bus. tin 0 tin 33 timer input input input pins for multijunction timer. to 0 to 44 timer output output output pins for the multijunction timer. tclk 0 tclk 3 timer clock input clock input pins for the multijunction timer. a-d avcc0, analog power supply avcc0 is the power supply for the a-d0 converter. avcc1 converter avcc1 is the power supply for the a-d1 converter. connect avcc0 and 1 to the power supply rail. avss0, analog ground avss0 is analog ground for the a-d0 converter. avss1 is avss1 analog ground for the a-d1 converter. connect avss0 and 1 to the ground. ad0in0 analog input input 16-channel analog input pins for the a-d0 converter. ad0in15 ad1in0 16-channel analog input pins for the a-d1 converter. ad1in15 overview 1.3 pin function multi- junction timer 1 1-15 32170/32174 group user's manual (rev. 2.1) table 1.3.1 description of the 32170 pin function (3/6) type pin name signal name input/output function a-d vref0, reference input vref0 is the reference voltage input pin for the a-d0 converter. converter vref1 voltage input vref1 is the reference voltage input pin for the a-d1 converter. _____ adtrg conversion input hardware trigger input pin to start a-d conversion. trigger interrupt ___ sbi system break input system break interrupt (sbi) input pin for the interrupt controller interrupt controller serial i/o sclki0 / uart transmit/ input/output when channel 0 is in uart mode: sclko0 receive clock this pin outputs a clock derived from brg output by halving it . output or csio transmit/receive when channel 0 is in csio mode: clock input/output this pin accepts as its input a transmit/receive clock when external clock source is selected or outputs a transmit/receive clock when internal clock source is selected. sclki1 / uart transmit/ input/output when channel 1 is in uart mode: sclko1 receive clock this pin outputs a clock derived from brg output by halving it . output or csio transmit/receive when channel 1 is in csio mode: clock input/output this pin accepts as its input a transmit/receive clock when external clock source is selected or outputs a transmit/receive clock when internal clock source is selected. sclki4 / uart transmit/ input/output when channel 4 is in uart mode: sclko4 receive clock this pin outputs a clock derived from brg output by halving it . output or csio transmit/receive when channel 4 is in csio mode: clock input/output this pin accepts as its input a transmit/receive clock when external clock source is selected or outputs a transmit/receive clock when internal clock source is selected. sclki5 / uart transmit/ input/output when channel 5 is in uart mode: sclko5 receive clock this pin outputs a clock derived from brg output by halving it . output or csio transmit/receive when channel 5 is in csio mode: clock input/output this pin accepts as its input a transmit/receive clock when external clock source is selected or outputs a transmit/receive clock when internal clock source is selected. txd0 transmit data output transmit data output pin for serial i/o channel 0 rxd0 receive data input receive data input pin for serial i/o channel 0 overview 1.3 pin function 1 1-16 32170/32174 group user's manual (rev. 2.1) real-time debugger txd1 transmit data output transmit data output pin for serial i/o channel 1. rxd1 receive data input receive data input pin for serial i/o channel 1. txd2 transmit data output transmit data output pin for serial i/o channel 2. rxd2 receive data input receive data input pin for serial i/o channel 2. txd3 transmit data output transmit data output pin for serial i/o channel 3. rxd3 receive data input receive data input pin for serial i/o channel 3. txd4 transmit data output transmit data output pin for serial i/o channel 4. rxd4 receive data input receive data input pin for serial i/o channel 4. txd5 transmit data output transmit data output pin for serial i/o channel 5. rxd5 receive data input receive data input pin for serial i/o channel 5. rtdtxd transmit data output serial data output pin for the real-time debugger. rtdrxd receive data input serial data input pin for the real-time debugger. rtdclk clock input input serial data transmit/receive clock input pin for the real-time debugger. rtdack acknowledge output this pin outputs a low pulse synchronously with the beginning clock of the real-time debugger's serial data output word. the duration of this low pulse indicates the type of command/data that the real-time debugger has received. flash fp flash protect input this mode pin has a function to protect the flash -only memory against e/w in hardware. can ctx data output output this pin outputs data from the can module. crx data input input this pin is used to input data to the can module. jtag jtms test mode input test mode select input to control state transition of the test circuit. jtck clock input clock input for the debug module and test circuit. jtrst test reset input test reset input to initialize the test circuit asynchronously. jtdi serial input input this pin is used to input test instruction code or test data serially. jtdo serial output output this pin outputs test instruction code or test data serially. overview 1.3 pin function table 1.3.1 description of the 32170 pin function (4/6) type pin name signal name input/output function 1 1-17 32170/32174 group user's manual (rev. 2.1) overview 1.3 pin function table 1.3.1 description of the 32170 pin function (5/6) type pin name signal name input/output function p00 p07 input/output input/output programmable input/output port. port 0 p10 p17 input/output input/output programmable input/output port. port 1 p20 p27 input/output input/output programmable input/output port. port 2 p30 p37 input/output input/output programmable input/output port. port 3 p41 p47 input/output input/output programmable input/output port. port 4 p61 p67 input/output input/output programmable input/output port. port 6 (however, p64 is an input-only port.) p70 p77 input/output input/output programmable input/output port. port 7 p82 p87 input/output input/output programmable input/output port. port 8 p93 p97 input/output input/output programmable input/output port. port 9 p100 input/output input/output programmable input/output port. p107 port 10 p110 input/output input/output programmable input/output port. p117 port 11 p124 input/output input/output programmable input/output port. p127 port 12 p130 input/output input/output programmable input/output port. p137 port 13 p140 input/output input/output programmable input/output port. p147 port 14 p150 input/output input/output programmable input/output port. p157 port 15 p160 input/output input/output programmable input/output port. p167 port 16 input/ output port (note) note: input/output port 5 is reserved for future use. 1 1-18 32170/32174 group user's manual (rev. 2.1) p172 input/output input/output programmable input/output port. p177 port 17 p180 input/output input/output programmable input/output port. p187 port 18 p190 input/output input/output programmable input/output port. p197 port 19 p200 input/output input/output programmable input/output port. p203 port 20 p210 input/output input/output programmable input/output port. p217 port 21 p220 input/output input/output programmable input/output port. (note) p225 port 22 (however, p221 is an input only port.) note: use caution when using p224 and p225 because they have a debug event function. table 1.3.2 description of the debug-only pin function of 255fbga type pin name signal name input/output function debog jdbi debug interrupt input debug interrupt request input pin. a low on this input request requests a debug interrupt. jevent0, event output output output synchronously with trclk. when an event occurs, jevent1 this output is driven high for a 1 trclk period. trclk trace clock output clock output pin for trace operation. trace data is output output synchronously with this clock. trsync trace packet output this is a trace packet output start signal. when the device output start signal starts outputting a trace packet, this signal is driven high for a 1 trclk period. trdata0 trace packet output trace packet output pin. - trdata7 output note: 255fbga is currently under development. table 1.3.1 description of the 32170 pin function (6/6) type pin name signal name input/output function input/ output port overview 1.3 pin function 1 1-19 32170/32174 group user's manual (rev. 2.1) overview 1.4 pin layout 1.4 pin layout figure 1.4.1 shows a pin layout diagram of the 32170/32174 in 240qfp package. figure 1.4.2 shows a pin layout diagram of the 32170/32174 in 255fbga package. table 1.4.1 lists pin assignments of the 240qfp. table 1.4.2 lists pin assignments of the 255fbga. figure 1.4.1 pin layout diagram of the 240qfp (top view) package: 240p6y-a (0.5 mm pitch) note: use caution when using these pins because they have a debug event function. m32170f3vfp m32170f4vfp m32170f6vfp m32174f4vfp m32174f3vfp 2 4 3 44 43 5 6 7 8 9 35 36 37 38 39 40 22 23 24 25 26 27 28 29 30 31 32 33 34 11 12 13 14 15 16 17 18 19 20 21 41 42 10 1 60 59 51 52 53 54 55 56 45 46 47 48 49 50 57 58 89 90 99 98 97 96 95 94 93 92 91 103 102 101 112 111 110 109 108 107 106 105 104 120 119 118 117 116 115 114 113 63 64 66 67 68 69 70 71 72 73 74 65 84 75 76 77 78 79 80 81 82 83 85 86 87 88 61 62 100 124 132 130 129 127 121 137 146 145 144 143 142 141 140 139 138 155 154 153 152 151 150 149 148 147 156 159 158 157 133 136 135 134 123 122 131 128 126 125 166 165 164 163 162 161 175 174 173 172 171 170 169 168 167 176 179 178 177 160 180 195 185 184 183 182 181 186 189 188 187 194 193 192 191 190 196 199 198 197 205 204 203 202 201 200 206 209 208 207 215 214 213 212 211 210 216 239 217 219 218 225 224 223 222 221 220 226 227 229 228 230 235 234 233 232 231 236 237 238 240 p41/blw/ble p157/tin7 p156/tin6 p155/tin5 p154/tin4 p153/tin3 p152/tin2 p151/tin1 p150/tin0 p147/tin15 p146/tin14 p145/tin13 p144/tin12 p143/tin11 p142/tin10 p141/tin9 p140/tin8 vss vcce p137/tin23 p136/tin22 p135/tin21 p134/tin20 p133/tin19 p132/tin18 p131/tin17 p130/tin16 vss vcci p42/bhw/bhe p127/tclk3 p126/tclk2 p125/tclk1 p124/tclk0 p107/to15 p106/to14 p105/to13 p104/to12 vss vcci p103/to11 vss vcci p43/rd p44/cs0 p45/cs1 p14/db12 p37/a22 p36/a21 p33/a18 p31/a16 p30/a15 p35/a20 p34/a19 p32/a17 vcce p27/a30 p25/a28 p26/a29 p24/a27 p07/db7 p02/db2 p01/db1 p00/db0 p23/a26 p22/a25 p20/a23 p10/db8 p11/db9 vss p15/db13 p13/db11 p12/db10 p06/db6 p04/db4 p03/db3 p47/a14 p21/a24 p46/a13 vcce vss p16/db14 p17/db15 p82/txd0 vss vcce p172/tin24 p173/tin25 p174/txd2 p175/rxd2 p176/txd3 p177/rxd3 p160/to21 p161/to22 p162/to23 p163/to24 p164/to25 p165/to26 p166/to27 p167/to28 vss vcci vref0 avcc0 ad0in7 ad0in6 ad0in5 ad0in4 ad0in3 ad0in2 ad0in1 ad0in0 ad0in15 ad0in14 ad0in13 ad0in12 ad0in11 ad0in10 ad0in9 ad0in8 avss0 p181/to30 p182/to31 p183/to32 p184/to33 p180/to29 vss vcce p186/to35 p187/to36 p190/tin26 p185/to34 p194/tin30 p195/tin31 p196/tin32 p197/tin33 p191/tin27 p192/tin28 p193/tin29 reset p84/sclki0/sclko0 p83/rxd0 p85/txd1 p86/rxd1 p87/sclki1/sclko1 vss vcce vcci p62 vss fp p67/adtrg p66/sclki5/sclko5 p65/sclki4/sclko4 p94/to17 p74/rtdtxd p75/rtdrxd p76/rtdack p77/rtdclk p61 p63 p114/to4 p115/to5 p116/to6 p117/to7 vss vcce mod1 p100/to8 p101/to9 p102/to10 p110/to0 p111/to1 p112/to2 p113/to3 p95/to18 p96/to19 p97/to20 p70/bclk/wr p71/wait p72/ hreq p64/sbi mod0 p93/to16 p73/ hack vcci vss vdd fvcc p201/rxd4 p202/txd5 p203/rxd5 p200/txd4 ad1in5 ad1in4 ad1in3 ad1in2 ad1in1 ad1in0 vref1 ad1in15 ad1in14 ad1in13 ad1in12 avss1 ad1in6 jtdo jtrst jtck jtms jtdi p212/to39 p213/to40 p214/to41 p215/to42 p211/to38 p210/to37 p216/to43 p217/to44 vcnt osc-vcc xout xin osc-vss p221/crx p220/ctx vss vss p05/db5 ad1in11 ad1in10 ad1in9 ad1in8 ad1in7 p222 p223 (note) p224/a11 (note) p225/a12 vss avcc1 1 1-20 32170/32174 group user's manual (rev. 2.1) overview 1.4 pin layout table 1.4.1 pin assignments of the 240qfp (1/2) no. pin name no. pin name no. pin name no. pin name 1 ad1in12 41 p26 / a29 81 vss 121 p87 / sclki1 / sclko1 2 ad1in13 42 p27 / a30 82 p180 / to29 122 p200 / txd4 3 ad1in14 43 p00 / db0 83 p181 / to30 123 p201 / rxd4 4 ad1in15 44 p01 / db1 84 p182 / to31 124 p202 / txd5 5 avss1 45 p02 / db2 85 p183 / to32 125 p203 / rxd5 6 __ p43 / rd 46 p03 / db3 86 p184 / to33 126 vcci 7 ___ p44 / cs0 47 p04 / db4 87 p185 / to34 127 vss 8 ___ p45 / cs1 48 p05 / db5 88 p186 / to35 128 fvcc 9 p46 / a13 49 p06 / db6 89 p187 / to36 129 vss 10 p47 / a14 50 p07 / db7 90 p190 / tin26 130 p61 11 p220 / ctx 51 vcce 91 p191 / tin27 131 p62 12 p221 / crx 52 vss 92 p192 / tin28 132 p63 13 p222 53 p10 / db8 93 p193 / tin29 133 ___ p64 / sbi 14 p223 54 p11 / db9 94 p194 / tin30 134 p65 / sclki4 / sclko4 15 p224 / a11 55 p12 / db10 95 p195 / tin31 135 p66 / sclki5 / sclko5 16 p225 / a12 56 p13 / db11 96 p196 / tin32 136 _____ p67 / adtrg 17 vss 57 p14 / db12 97 p197 / tin33 137 vcci 18 osc-vss 58 p15 / db13 98 vcci 138 vss 19 xin 59 p16 / db14 99 vss 139 vcce 20 xout 60 p17 / db15 100 p160 / to21 140 ___ p70 / bclk / wr 21 osc-vcc 61 vref0 101 p161 / to22 141 ____ p71 / wait 22 vss 62 avcc0 102 p162 / to23 142 ____ p72 / hreq 23 vcnt 63 ad0in0 103 p163 / to24 143 ____ p73 / hack 24 vss 64 ad0in1 104 p164 / to25 144 p74 / rtdtxd 25 p30 / a15 65 ad0in2 105 p165 / to26 145 p75 / rtdrxd 26 p31 / a16 66 ad0in3 106 p166 / to27 146 p76 / rtdack 27 p32 / a17 67 ad0in4 107 p167 / to28 147 p77 / rtdclk 28 p33 / a18 68 ad0in5 108 p172 / tin24 148 p93 / to16 29 p34 / a19 69 ad0in6 109 p173 / tin25 149 p94 / to17 30 p35 / a20 70 ad0in7 110 p174 / txd2 150 p95 / to18 31 p36 / a21 71 ad0in8 111 p175 / rxd2 151 p96 / to19 32 p37 / a22 72 ad0in9 112 p176 / txd3 152 p97 / to20 33 p20 / a23 73 ad0in10 113 p177 / rxd3 153 _____ reset 34 p21 / a24 74 ad0in11 114 vcce 154 mod0 35 p22 / a25 75 ad0in12 115 vss 155 mod1 36 p23 / a26 76 ad0in13 116 p82 / txd0 156 fp 37 vcce 77 ad0in14 117 p83 / rxd0 157 vcce 38 vss 78 ad0in15 118 p84 / sclki0 / sclko0 158 vss 39 p24 / a27 79 avss0 119 p85 / txd1 159 p110 / to0 40 p25 / a28 80 vcce 120 p86 / rxd1 160 p111 / to1 1 1-21 32170/32174 group user's manual (rev. 2.1) overview 1.4 pin layout table 1.4.1 pin assignments of the 240qfp (2/2) no. pin name no. pin name no. pin name no. pin name 161 p112 / to2 181 jtms 201 p134 / tin20 221 p156 / tin6 162 p113 / to3 182 jtck 202 p135 / tin21 222 p157 / tin7 163 p114 / to4 183 jtrst 203 p136 / tin22 223 ___ ___ p41 / blw / ble 164 p115 / to5 184 jtdo 204 p137 / tin23 224 ___ ___ p42 / bhw / bhe 165 p116 / to6 185 jtdi 205 vcce 225 vcci 166 p117 / to7 186 p103 / to11 206 vss 226 vss 167 p100 / to8 187 p104 / to12 207 p140 / tin8 227 vref1 168 p101 / to9 188 p105 / to13 208 p141 / tin9 228 avcc1 169 p102 / to10 189 p106 / to14 209 p142 / tin10 229 ad1in0 170 vdd 190 p107 / to15 210 p143 / tin11 230 ad1in1 171 vcci 191 p124 / tclk0 211 p144 / tin12 231 ad1in2 172 vss 192 p125 / tclk1 212 p145 / tin13 232 ad1in3 173 p210 / to37 193 p126 / tclk2 213 p146 / tin14 233 ad1in4 174 p211 / to38 194 p127 / tclk3 214 p147 / tin15 234 ad1in5 175 p212 / to39 195 vcci 215 p150 / tin0 235 ad1in6 176 p213 / to40 196 vss 216 p151 / tin1 236 ad1in7 177 p214 / to41 197 p130 / tin16 217 p152 / tin2 237 ad1in8 178 p215 / to42 198 p131 / tin17 218 p153 / tin3 238 ad1in9 179 p216 / to43 199 p132 / tin18 219 p154 / tin4 239 ad1in10 180 p217 / to44 200 p133 / tin19 220 p155 / tin5 240 ad1in11 1 1-22 32170/32174 group user's manual (rev. 2.1) package: 255f7f (0.8 mm pitch) note 1: nc pins (w19, y1) are not internally connected. leave them open. note 2: use caution when using p224/a11 and p225/a12 because they have a debug event function. note 3: 255fbga is currently under development. figure 1.4.2 pin layout diagram of the 255fbga (top view) ab c de f gh jk l mnp rt uv wy 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ad1in12 ad1in13 ad1in14 ad1in15 avss1 p43 /rd p44 /cs0 p45 /cs1 p46 /a13 p47 /a14 p220 /ctx p221 /crx p222 p223 p224 /a11 p225 /a12 vss osc- vss xin xout osc- vcc vss vcnt vss p30 /a15 p31 /a16 p32 /a17 p33 /a18 p34 /a19 p35 /a20 trclk trsync p36 /a21 p37 /a22 p20 /a23 p21 /a24 p23 /a26 p22 /a25 vcce vss p24 /a27 p25 /a28 p26 /a29 p27 /a30 p00 /db0 p01 /db1 p02 /db2 p03 /db3 p04 /db4 p05 /db5 p06 /db6 p07 /db7 vcce vss p10 /db8 p11 /db9 p12 /db10 p13 /db11 p14 /db12 p15 /db13 p16 /db14 p17 /db15 vref0 avcc0 ad0in0 ad0in1 ad0in2 ad0in3 ad0in4 ad0in5 ad0in6 ad0in7 ad0in8 ad0in9 ad0in10 ad0in11 ad0in12 ad0in13 ad0in14 ad0in15 a vss0 vcce vss p180 /to29 p181 /to30 p182 /to31 p183 /to32 p184 /to33 p185 /to34 p186 /to35 p187 /to36 p190 /tin26 p191 /tin27 p192 /tin28 p193 /tin29 p194 /tin30 p196 /tin32 p195 /tin31 p197 /tin33 vcci vss p160 /to21 p161 /to22 p162 /to23 p163 /to24 p164 /to25 p165 /to26 p166 /to27 p167 /to28 p172 /tin24 p173 /tin25 p174 /txd2 p175 /rxd2 p176 /txd3 p177 /rxd3 vcce vss p82 /txd0 p87 /sclk1 p84 /sclk0 p85 /txd1 p86 /rxd1 trdata 0 trdata 1 trdata 2 trdata 3 p200 /txd4 p201 /rxd4 p202 /txd5 p203 /rxd5 vcci vss p83 /rxd0 vss p61 p62 fvcc p64 /sbi p65 /sclk4 p66 /sclk5 p63 vcci vss vcce p67 /adtrg p71 /wait p72 /hreq p73 /hack p74/ rtdtxd p75/ rtdrxd p76/ rtdack p77/ rtdclk p93 /to16 p94 /to17 p95 /to18 p96 /to19 p97 /to20 reset mod0 mod1 fp vcce vss p110 /to0 p111 /to1 p112 /to2 p113 /to3 trdata 4 trdata 5 trdata 6 trdata 7 p114 /to4 p115 /to5 p116 /to6 p117 /to7 p100 /to8 p101 /to9 p102 /to10 vdd vcci vss p210 /to37 p211 /to38 p212 /to39 p214 /to41 p215 /to42 p213 /to40 p216 /to43 p217 /to44 jdbi jtck jevent 0 jtrst jevent 1 jtdo jtdi p103 /to11 p104 /to12 p105 /to13 p106 /to14 p107 /to15 p124 /tclk0 p125 /tclk1 p126 /tclk2 p127 /tclk3 vcci vss p130 /tin16 p131 /tin17 p132 /tin18 p133 /tin19 p134 /tin20 p135 /tin21 p136 /tin22 p137 /tin23 vcce vss p140 /tin8 p141 /tin9 p142 /tin10 p143 /tin11 p144 /tin12 p145 /tin13 p146 /tin14 p147 /tin15 p150 /tin0 p151 /tin1 p152 /tin2 p153 /tin3 p154 /tin4 p155 /tin5 p156 /tin6 p157 /tin7 p41 /blw p42 /bhw vcci vss vref1 avcc1 ad1in0 ad1in1 ad1in2 ad1in3 ad1in4 ad1in5 ad1in6 ad1in7 ad1in8 ad1in10 ad1in9 ad1in11 m32170f3vwg m32170f4vwg m32170f6vwg m32174f4vwg m32174f3vwg p70 /bclk jtms n.c. n.c. overview 1.4 pin layout 1 1-23 32170/32174 group user's manual (rev. 2.1) table 1.4.2 pin assignments of the 255fbga (1/2) no. pin name no. pin name no. pin name no. pin name a1 c1 ad1in14 e1 p220 / ctx h1 vcnt a2 ad1in9 c2 ad1in13 e2 ______ p47 / a14 h2 vss a3 ad1in8 c3 ad1in4 e3 ___ p46 / a13 h3 osc-vcc a4 ad1in6 c4 ad1in5 e4 ___ p45 / cs1 h4 xout a5 ad1in2 c5 ad1in1 e17 p101 / to9 h17 p111 / to1 a6 vref1 c6 vss e18 vcci h18 trdata4 a7 _______ p41 / blw c7 p157 / tin7 e19 vdd h19 p113 / to3 a8 p154 / tin4 c8 p153 / tin3 e20 p102 / to10 h20 p112 / to2 a9 p150 / tin0 c9 p147 / tin15 f1 p224 / a11 j1 p32 / a17 a10 p144 / tin12 c10 p143 / tin11 f2 p223 j2 p31 / a16 a11 p140 / tin8 c11 p141 / tin9 f3 p222 j3 p30 / a15 a12 p136 / tin22 c12 p137 / tin23 f4 p221 / crx j4 vss a13 p132 / tin18 c13 p133 / tin19 f17 p115 / to5 j17 fp a14 vcci c14 vss f18 p100 / to8 j18 p110 / to0 a15 p124 / tclk0 c15 p125 / tclk1 f19 p117 / to7 j19 vss a16 p104 / to12 c16 p105 / to13 f20 p116 / to6 j20 vcce a17 jevent1 c17 jtdo g1 xin k1 trclk a18 jevent0 c18 p213 / to40 g2 osc-vss k2 p35 / a20 a19 jtck c19 p215 / to42 g3 vss k3 p34 / a19 a20 jtms c20 p214 / to41 g4 p225 / a12 k4 p33 / a18 b1 ad1in12 d1 _______ p44 / cs0 g17 trdata5 k17 p97 / to20 b2 ad1in11 d2 _____ p43 / rd g18 p114 / to4 k18 mod1 b3 ad1in10 d3 avss1 g19 trdata7 k19 mod0 b4 ad1in7 d4 ad1in15 g20 trdata6 k20 ____________ reset b5 ad1in3 d5 ad1in0 b6 avcc1 d6 vcci b7 ________ p42 / bhw d7 p156 / tin6 b8 p155 / tin5 d8 p152 / tin2 b9 p151 / tin1 d9 p146 / tin14 b10 p145 / tin13 d10 p142 / tin10 b11 vss d11 vcce b12 p135 / tin21 d12 p134 / tin20 b13 p131 / tin17 d13 p130 / tin16 b14 p127 / tclk3 d14 p126 / tclk2 b15 p107 / to15 d15 p106 / to14 b16 p103 / to11 d16 jtdi b17 jtrst d17 vss b18 jdbi d18 p212 / to39 b19 p217 / to44 d19 p211 / to38 b20 p216 / to43 d20 p210 / to37 overview 1.4 pin layout 1 1-24 32170/32174 group user's manual (rev. 2.1) table 1.4.2 pin assignments of the 255fbga (2/2) no. pin name no. pin name no. pin name no. pin name l1 p36 / a21 p1 p00 / db0 u1 p12 / db10 w1 p16 / db14 l2 p37 / a22 p2 p01 / db1 u2 p13 / db11 w2 vref0 l3 p20 / a23 p3 p02 / db2 u3 p14 / db12 w3 ad0in0 l4 trsync p4 p27 / a30 u4 p11 / db9 w4 ad0in3 l17 p93 / to16 p17 ______ p67 / adtrg u5 ad0in6 w5 ad0in7 l18 p94 / to17 p18 vcci u6 ad0in10 w6 ad0in11 l19 p95 / to18 p19 vss u7 ad0in14 w7 ad0in15 l20 p96 / to19 p20 vcce u8 vss w8 p180 / to29 m1 p22 / a25 r1 p04 / db4 u9 p183 / to32 w9 p184 / to33 m2 p23 / a26 r2 p05 / db5 u10 p187 / to36 w10 p190 / tin26 m3 vcce r3 p06 / db6 u11 p193 / tin29 w11 p196 / tin32 m4 p21 / a24 r4 p03 / db3 u12 p197 / tin33 w12 p160 / to21 m17 p74 / rtdtxd r17 p63 u13 p161 / to22 w13 p164 / to25 m18 p75 / rtdrxd r18 ___ p64 / sbi u14 p165 / to26 w14 p172 / tin24 m19 p76 / rtdack r19 p65 / sclk4 u15 p173 / tin25 w15 p176 / txd3 m20 p77 / rtdclk r20 p66 / sclk5 u16 p177 / rxd3 w16 p82 / txd0 n1 p24 / a27 t1 vcce u17 p83 / rxd0 w17 p86 / rxd1 n2 p25 / a28 t2 vss u18 p203 / rxd5 w18 trdata2 n3 p26 / a29 t3 p10 / db8 u19 vcci w19 n.c. n4 vss t4 p07 / db7 u20 vss w20 p201 / rxd4 n17 p70 / bclk t17 fvcc v1 p15 / db13 y1 n.c. n18 _____ p71 / wait t18 vss v2 p17 / db15 y2 avcc0 n19 _____ p72 / hreq t19 p61 v3 ad0in1 y3 ad0in2 n20 _____ p73 / hack t20 p62 v4 ad0in5 y4 ad0in4 v5 ad0in9 y5 ad0in8 v6 ad0in13 y6 ad0in12 v7 vcce y7 avss0 v8 p182 / to31 y8 p181 / to30 v9 p186 / to35 y9 p185 / to34 v10 p192 / tin28 y10 p191 / tin27 v11 p194 / tin30 y11 p195 / tin31 v12 vcci y12 vss v13 p162 / to23 y13 p163 / to24 v14 p166 / to27 y14 p167 / to28 v15 p174 / txd2 y15 p175 / rxd2 v16 vcce y16 vss v17 p84 / sclk0 y17 p85 / txd1 v18 p87 / sclk1 y18 trdata0 v19 p200 / txd4 y19 trdata1 v20 p202 / txd5 y20 trdata3 overview 1.4 pin layout chapter 2 chapter 2 cpu 2.1 cpu registers 2.2 general-purpose registers 2.3 control registers 2.4 accumulator 2.5 program counter 2.6 data formats 2.7 precautions on cpu 2 2-2 32170/32174 group user's manual (rev. 2.1) cpu 2.1 cpu registers 2.1 cpu registers the m32r has sixteen general-purpose registers, five control registers, an accumulator, and a program counter. the accumulator is a 56-bit configuration, and all other registers are a 32-bit configuration. 2.2 general-purpose registers general-purpose registers are 32 bits in width and there are sixteen of them (r0 to r15), which are used to hold data and base addresses. especially, r14 is used as a link register, and r15 is used as a stack pointer. the link register is used to store the return address when executing a subroutine call instruction. the stack pointer is switched between an interrupt stack pointer (spi) and a user stack pointer (spu) depending on the value of the processor status word register (psw)'s stack mode (sm) bit. 31 31 00 r8 r9 r10 r11 r12 r13 r14 (link register) r15 (stack pointer) (note) note: the stack pointer is switched between an interrupt stack pointer (spi) and a user stack pointer (spu) depending on the value of the psw's sm bit. r0 r1 r2 r3 r4 r5 r6 r7 figure 2.2.1 general-purpose registers 2 2-3 32170/32174 group user's manual (rev. 2.1) cpu 2.3 control registers 2.3 control registers there are five control registers-processor status word register (psw), condition bit register (cbr), interrupt stack pointer (spi), user stack pointer (spu), and backup pc (bpc). dedicated "mvtc" and "mvfc" instructions are used to set and read these control registers. figure 2.3.1 control registers control registers cr0 cr1 cr2 cr3 0 31 psw cbr spi spu processor status word register condition bit register interrupt stack pointer user stack pointer bpc cr6 backup pc crn note 1: crn (n = 0-3, 6) denotes control register numbers. note 2: dedicated "mvtc" and "mvfc" instructions are used to set and read the control registers. 2 2-4 32170/32174 group user's manual (rev. 2.1) cpu 2.3 control registers 2.3.1 processor status word register: psw (cr0) the processor status word register (psw) is used to indicate the status of the m32r. it consists of a regularly used psw field and a special bpsw field which is used to save the psw field when an eit occurs. the psw field consists of several bits labeled stack mode (sm), interrupt enable (ie), and condition bit (c). the bpsw field consists of backup bits of the foregoing, i.e., backup sm bit (bsm), backup ie bit (bie), and backup c bit (bc). d bit name function initial r w 16 bsm (backup sm) holds the value of sm bit when eit indeterminate is accepted. 17 bie (backup ie) holds the value of ie bit when eit indeterminate is accepted. 23 bc (backup c) holds the value of c bit when eit indeterminate is accepted. 24 sm (stack mode) 0: interrupt stack pointer is used. 0 1: user stack pointer is used. 25 ie (interrupt enable) 0: no interrupt is accepted. 0 1: interrupt is accepted. 31 c (condition bit) depending on instruction execution, it indicates 0 whether operation resulted in a carry, borrow, or overflow. note 1: "initial" shows the state immediately after reset, r = o means the register is readable, w = o means the register is writable. note 2: for changes of the state of each bit when an eit event occurs, refer to chapter 4, "eit. (note 1) 16 17 23 24 25 31(lsb) 15 8 7 0(msb) sm ie c bc bsm bie 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 psw bpsw field psw field 2 2-5 32170/32174 group user's manual (rev. 2.1) cpu 2.3 control registers 2.3.2 condition bit register: cbr (cr1) the condition bit register (cbr) is created as a separate register from the psw by extracting the condition bit (c) from it. the value written to the psw c bit is reflected in this register. this register is a read-only register (writes to this register by "mvtc" instruction are ignored). 2.3.3 interrupt stack pointer: spi (cr2) user stack pointer: spu (cr3) the interrupt stack pointer (spi) and user stack pointer (spu) hold the current address of the stack pointer. these registers can be accessed as general-purpose register r15. in this case, whether r15 is used as spi or as spu depends on the psw's stack mode (sm) bit. 2.3.4 backup pc: bpc (cr6) the backup pc (bpc) is a register used to save the value of the program counter (pc) when an eit occurs. bit 31 is fixed to 0. when an eit occurs, the value held in the pc immediately before the eit occurred or the value of the next instruction is set in this register. when the "rte" instruction is executed, the saved value is returned from the bpc to the pc. however, the two low-order bits of the pc when thus returned are always fixed to "00" (control always returns to word boundaries.) spi spi spu spu 0(msb) 0(msb) 31(lsb) 31(lsb) cbr 0(msb) 31(lsb) 0000000000000000000000000000000 c bpc bpc 0 31(lsb) 0(msb) 2 2-6 32170/32174 group user's manual (rev. 2.1) 2.4 accumulator the accumulator (acc) is a 56-bit register used by dsp function instructions. when read out or written to, it is handled as a 64-bit register. when reading, the value of bit 8 is sign-extended. when writing, bits 0--7 are ignored. also, the accumulator is used by the multiplication instruction "mul." note that when executing this instruction, the value of the accumulator is destroyed. the "mvtachi" and "mvtaclo" instructions are used to write to the accumulator. the "mvtachi" instruction writes data to the 32 high-order bits (bits 0-31), and the "mvtaclo" instruction writes data to the 32 low-order bits (bits 32-63). the "mvfachi," "mvfaclo," and "mvfacmi" instructions are used to read data from the accumulator. the "mvfachi" instruction reads data from the 32 high-order bits (bits 0-31), the "mvfaclo" instruction reads data from the 32 low-order bits (bits 32-63), and the "mvfachi" instruction reads data from the 32 middle bits (bits 16-47). cpu 2.4 accumulator note: bits 0-7 always show the sign-extended value of bit 8. writes to this bit field are ignored. pc pc 0 31(lsb) 0(msb) 2.5 program counter the program counter (pc) is a 32-bit counter used to hold the address of the currently executed instruction. because m32r instructions each start from an even address, the lsb (bit 31) is always 0. 32 48 63(lsb) 31 16 15 0(msb) 47 78 range of bits read by mvfacmi instruction range of bits read/written to by mvfachi/mvtachi instructions range of bits read/written to by mvfaclo/mvtaclo instructions acc (note) 2 2-7 32170/32174 group user's manual (rev. 2.1) 2.6 data formats 2.6.1 data types there are several data types that can be handled by the m32r's instruction set. these include signed and unsigned 8, 16, and 32-bit integers. values of signed integers are represented by 2's complements. figure 2.6.1 data types cpu 2.6 data formats signed byte (8-bit) integer unsigned byte (8-bit) integer signed halfword (16-bit) integer unsigned halfword (16-bit) integer signed word (32-bit) integer unsigned word (32-bit) integer 0(msb) 0(msb) 0(msb) 0(msb) 0(msb) 0(msb) 7(lsb) 7(lsb) 15(lsb) 15(lsb) 31(lsb) 31(lsb) s s s s : sign bit 2 2-8 32170/32174 group user's manual (rev. 2.1) cpu 2.6 data formats 2.6.2 data formats (1) data formats in register data sizes in m32r registers are always words (32 bits). when loading byte (8-bit) or halfword (16-bit) data from memory into a register, the data is sign- extended (ldb, ldh instructions) or zero-extended (ldub, lduh instructions) into word (32-bit) data before being stored in the register. when storing data from m32r register into memory, the register data is stored in memory in different sizes depending on the instructions used. the st instruction stores the entire 32-bit data of the register, the sth instruction stores the least significant 16-bit data, and the stb instruction stores the least significant 8-bit data. figure 2.6.2 data formats in register rn 0(msb) 31(lsb) 2 2-9 32170/32174 group user's manual (rev. 2.1) (2) data formats in memory data sizes in memory are either byte (8 bits), halfword (16 bits), or word (32 bits). byte data can be located at any address. however, halfword data must be located at halfword boundaries (where the lsb address bit = "0"), and word data must be located at word boundaries (where two lsb address bits = "00"). if an attempt is made to access memory data across these halfword or word boundaries, an address exception is generated. figure 2.6.3 data formats in memory cpu 2.6 data formats address byte halfword word + 0 address + 1 address + 2 address + 3 address 031 byte 7 8 15 16 23 24 (msb) (lsb) (msb) (lsb) byte byte byte halfword halfword word 2 2-10 32170/32174 group user's manual (rev. 2.1) cpu 2.6 data formats (3) endian the following shows the generally used endian methods and the m32r family endian. figure 2.6.4 endian methods figure 2.6.5 m32r family endian bit endian byte endian big endian little endian note: even for bit big endian, h'01 is not b'10000000. (h'01) (h'01234567) msb lsb hh hl lh ll h'01 h'23 h'45 h'67 msb lsb ll lh hl hh h'67 h'45 h'23 h'01 msb lsb b'0000001 d0 d7 msb lsb b'0000001 d7 d0 little/little ll lh hl hh big/big hh hl lh ll little/big hh hl lh ll endian (bit/byte) data arrangement mpu name 7700 family m16c family competition m32r family m16 family 7-0 31-24 15-8 23-16 0-7 24-31 8-15 16-23 bit number +0 +1 +2 +3 +0 +1 +2 +3 +0 +1 +2 +3 address msb lsb msb lsb msb lsb ex:0x01234567 .byte 67,45,23,01 .byte 01,23,45,67 .byte 01,23,45,67 note: the m32r's endian method is big endian for both bit and byte. 7-0 31-24 15-8 23-16 2 2-11 32170/32174 group user's manual (rev. 2.1) (4) transfer instructions figure 2.6.6 transfer instructions cpu 2.6 data formats ? constant transfer ld24 rdest, #imm24 ldi rdest, #imm16 ldi rdest, #imm8 seth rdest, #imm16 23 0 rdest imm24 31 0 ld24 rdest, #imm24 15 0 rdest imm16 31 0 seth rdest, #imm16 00 8 15 00 00 ? register to register transfer mv rdest, rsrc ? control register transfer mvfc rdest, crsrc mvtc rsrc, crdest note: for the mvtc instruction, the condition bit c does not change unless crdest is cr0 (psw). rsrc 31 0 rdest 31 0 rsrc 31 0 crdest 31 0 mvtc rsrc, crdest mv rdest, rsrc 2 2-12 32170/32174 group user's manual (rev. 2.1) (5) memory (signed) to register transfer figure 2.6.7 memory (signed) to register transfer (6) memory (unsigned) to register transfer figure 2.6.8 memory (unsigned) to register transfer signed 32 bits ld24 rsrc, #label ld rdest, @rsrc signed 16 bits ld24 rsrc, #label ldh rdest, @rsrc signed 8 bits ld24 rsrc, #label ldb rdest, @rsrc label rdest 31 0 +0 +1 +2 +3 rdest label 00 00 ff ff check the msb 0 = positive 1 = negative 31 0 +0 +1 +2 +3 rdest label 00 00 00 ff ff ff 31 0 +0 +1 +2 +3 memory register check the msb 0 = positive 1 = negative unsigned 32 bits ld24 rsrc, #label ld rdest, @rsrc unsigned 16 bits ld24 rsrc, #label ldub rdest, @rsrc unsigned 8 bits ld24 rsrc, #label lduh rdest, @rsrc rdest 00 00 31 0 label +0 +1 +2 +3 label +0 +1 +2 +3 rdest 31 0 label +0 +1 +2 +3 rdest 00 00 00 31 0 memory register cpu 2.6 data formats 2 2-13 32170/32174 group user's manual (rev. 2.1) (7) things to be noted for data transfer note that in data transfer, data arrangements in registers and those in memory are different. figure 2.6.9 difference in data arrangements data in memory data in register word data (32 bits) +0 +1 +2 +3 d0 d31 hh hl lh ll d0 d31 hh hl lh ll half-word data (16 bits) +0 +1 +2 +3 d0 d31 h l d0 d15 h l byte data (8 bits) +0 +1 +2 +3 d0 d31 d0 d7 msb lsb msb lsb msb lsb msb lsb msb lsb msb lsb (r0-r15) (r0-r15) (r0-r15) cpu 2.6 data formats 2 2-14 32170/32174 group user's manual (rev. 2.1) cpu 2.7 precautions on cpu 2.7 precautions on cpu ?usage notes for 0 division instruction problem and conditions inaccurate calculations for the instructions listed in (2) will result from execution of the 0 division instruction under the conditions described in (1). (1) if 0 division calculation is executed when the divisor = 0 for instructions div, divu, rem and remu, (2) the result will be inaccurate calculations for any of the following instructions that are executed immediately after 0 division: addv, addx, add, addi, addv3, add3, cmp, cmpu, cmpi, cmpui, subv, subx, sub, div, divu, rem, remu. countermeasure assuming that the 0 division occurrence itself is not expected by the system and therefore is the cause of miscalculations, before executing division or remainder instructions, do a 0 check on the divisor to make sure 0 division does not occur. chapter 3 chapter 3 address space 3.1 outline of address space 3.2 operation modes 3.3 internal rom area and extended external area 3.4 internal ram area and sfr area 3.5 eit vector entry 3.6 icu vector table 3.7 notes on address space 3 3-2 32170/32174 group user's manual (rev. 2.1) 3.1 outline of address space the m32r's logical addresses are always handled in 32 bits, providing 4 gbytes of linear ad- dress space. the m32r/ecu's address space consists of the following: (1) user space ?internal rom area ?extended external area ?internal ram area ?special function register (sfr) area (2) boot program space (3) system space (areas not open to the user) (1) user space a 2 gbytes of address space from h'0000 0000 to h'7fff ffff is the user space. located in this space are the internal rom area, extended external area, internal ram area, and spe- cial function register (sfr) area, an area containing a group of internal peripheral i/o regis- ters. of these, the internal rom and extended external areas are located differently depend- ing on mode settings which will be described later. (2) boot program space a 1 gbyte of address space from h'8000 0000 to h'bfff ffff is the boot program space. this space stores a program (boot program) which enables on-board programming when the internal flash area is blank. (3) system space a 1 gbyte of address space from h'c000 0000 to h'ffff ffff is the system space. this space is reserved for use by development tools such as an in-circuit emulator or a debug monitor, and cannot be used by the user. address space 3.1 outline of address space 3 3-3 32170/32174 group user's manual (rev. 2.1) address space 3.1 outline of address space figure 3.1.1 address space of the m32170f6 note 1: this location varies with chip mode settings. note 2: the boot program space can read out only when fp = 1, mod0 = 1, and mod1 = 0. boot rom area (8 kbytes) h'0000 0000 h'ffff ffff 3 3-4 32170/32174 group user's manual (rev. 2.1) address space 3.1 outline of address space figure 3.1.2 address space of the m32170f4 boot rom area (8 kbytes) h'0000 0000 h'ffff ffff 3 3-5 32170/32174 group user's manual (rev. 2.1) address space 3.1 outline of address space figure 3.1.3 address space of the m32170f3 boot rom area (8 kbytes) h'0000 0000 h'ffff ffff 3 3-6 32170/32174 group user's manual (rev. 2.1) address space 3.1 outline of address space figure 3.1.4 address space of the m32174f4 note 1: this location varies with chip mode settings. note 2: the boot program space can read out only when fp = 1, mod0 = 1, and mod1 = 0. boot rom area (8 kbytes) h 0000 0000 h ffff ffff 3 3-7 32170/32174 group user's manual (rev. 2.1) address space 3.1 outline of address space figure 3.1.5 address space of the m32174f3 note 1: this location varies with chip mode settings. note 2: the boot program space can read out only when fp = 1, mod0 = 1, and mod1 = 0. boot rom area (8 kbytes) h 0000 0000 h ffff ffff 3 3-8 32170/32174 group user's manual (rev. 2.1) 3.2 operation modes this microcomputer is placed in one of the following modes by setting its operation mode (using mod0 and mod1 pins). for details about the mode used to rewrite the internal flash memory, refer to section 6.5, "programming of internal flash memory." table 3.2.1 setting operation modes mod0 mod1 (note 1) operation mode (note 2) vss vss single-chip mode vss vcce extended external mode vcce vss processor mode (fp = vss) vcce vcce reserved (cannot be used) note 1: vcce connects to +5 v or 3.3v, and vss connects to gnd. note 2: for flash rewrite mode (fp = vcce) not listed in the above table, refer to section 6.5, "programming of internal flash memory." the internal rom and extended external areas are located differently depending on this microcomputer's operation mode. (all other areas in address space are located the same way.) the address maps of internal rom and extended external areas in each mode are shown below. (for details about internal flash memory rewrite mode, refer to section 6.5, "programming of internal flash memory.") address space 3.2 operation modes figure 3.2.1 m32170f6 operation mode and internal rom/extended external areas h'0000 0000 h'000b ffff h'000c 0000 h'003f ffff non-cs0 area 3 3-9 32170/32174 group user's manual (rev. 2.1) figure 3.2.2 m32170f4 and m32174f4 operation mode and internal rom/extended external areas figure 3.2.3 m32170f3 and m32174f3 operation mode and internal rom/extended external areas h'0000 0000 h'0007 ffff h'0008 0000 h'003f ffff non-cs0 area 3 3-10 32170/32174 group user's manual (rev. 2.1) 3.3 internal rom area and extended external area the 8 mbyte area at addresses h'0000 0000 to h'007f ffff in the user space accommodates the internal rom and extended external areas. of this, a 4 mbytes of address space from h'0000 0000 to h'0003 ffff is the area that the user can actually use. all other areas here comprise a 4 mbytes of ghost area. (when programming, do not use this ghost area intentionally.) for details on how the internal rom and extended external areas are located differently depending on this microcomputer's operation modes set, refer to section 3.2, "operation modes." 3.3.1 internal rom area the internal rom is located in the area shown below. also, this area has an eit vector entry (and icu vector table) located in it at the beginning. table 3.3.1 addresses at which the internal rom is located type name size located address mf32170f6 768 kbytes h'0000 0000 - h'000b ffff mf32170f4, m32174f4 512 kbytes h'0000 0000 - h'0007 ffff mf32170f3, m32174f3 384 kbytes h'0000 0000 - h'0005 ffff 3.3.2 extended external area an extended external area is provided only when extended external mode or processor mode has been selected when setting this microcomputer's operation mode. for access to this extended external area, this microcomputer outputs the control signals necessary to access external devices. ________ _______ this microcomputer's cs0 and cs1 signals are output corresponding to the address mapping of ________ _______ the extended external area. the cs0 signal is output for the cs0 area, and the cs1 signal is output for the cs1 area. table 3.3.2 address mapping of the extended external area in each operation mode operation mode address mapping of the extended external area single-chip mode none extended external mode addresses h'0010 0000 to h'001f ffff (cs0 area: 1 mbytes) addresses h'0020 0000 to h'003f ffff (cs1 area: 2 mbytes) processor mode addresses h'0000 0000 to h'001f ffff (cs0 area: 2 mbytes) addresses h'0020 0000 to h'003f ffff (cs1 area: 2 mbytes) address space 3.3 internal rom/extended external area 3 3-11 32170/32174 group user's manual (rev. 2.1) 3.4 internal ram area and sfr area the 8 mbyte area at addresses h'0080 0000 to h'00ff ffff in the user space accommodates the internal ram area and special function register (sfr) area. of this, a 128 kbytes of address space from h'0080 0000 to h'0081 ffff is the area that the user can actually use. all other areas here comprise a ghost area in units of 128 kbytes. (when programming, do not use this ghost area intentionally.) 3.4.1 internal ram area the internal ram is located in the area shown below. table 3.4.1 addresses at which the internal rom is located type name size located address m32170f6 40 kbytes h'0080 4000 - h'0080 dfff m32174f4 m32174f3 m32170f4 32 kbytes h'0080 4000 - h'0080 bfff m32170f3 3.4.2 special function register (sfr) area addresses h'0080 0000 to h'0080 3ffff are the special function register (sfr) area. this area has registers for internal peripheral i/o located in it. address space 3.4 internal rom/sfr area figure 3.4.1 internal ram area and special function register (sfr) area of the m32170f6 h?0080 0000 h?0080 dfff sfr area (16 kbytes) internal ram (40 kbytes) h?0080 3fff h?0080 4000 virtual-flash emulation areas separated in units of 8 kbytes or 4 kbytes can be allocated here. for details, refer to section 6.7. 3 3-12 32170/32174 group user's manual (rev. 2.1) address space 3.4 internal rom/sfr area figure 3.4.2 internal ram area and special function register (sfr) area of the m32170f4 and m32170f3 h ? 0080 0000 h ? 0080 bfff sfr area (16 kbytes) internal ram (32 kbytes) h ? 0080 3fff h ? 0080 4000 virtual-flash emulation areas separated in units of 8 kbytes or 4 kbytes can be allocated here. for details, refer to section 6.7. figure 3.4.3 internal ram area and special function register (sfr) area of the m32174f4 and m32174f3 h ? 0080 0000 h ? 0080 dfff sfr area (16 kbytes) internal ram (32 kbytes) h ? 0080 3fff h ? 0080 4000 h ? 0080 bfff the low-order 8 kbytes cannot be used for virtual-flash emulation. virtual-flash emulation areas separated in units of 8 kbytes or 4 kbytes can be allocated here. for details, refer to section 6.7. 3 3-13 32170/32174 group user's manual (rev. 2.1) address space 3.4 internal rom/sfr area figure 3.4.4 outline address mapping of the sfr area h 0080 0000 h 0080 007e h 0080 0180 interrupt controller (icu) h 0080 0080 a-d0 converter h 0080 00ee serial i/o0-3 h 0080 0100 h 0080 0146 wait controller mjt (common part) mjt (top) mjt (tio) mjt (tms) h 0080 0200 h 0080 0240 h 0080 0300 h 0080 03c0 h 0080 03e0 h 0080 03fe note: the real-time debugger (rtd) is designed to be an independent module operated from an external source, and is transparent to the cpu. 0 7 8 15 h 0080 0a00 +0 address +1 address 0 7 8 15 multijunction timer (mjt) flash control h 0080 07e0 h 0080 07f2 h 0080 023e h 0080 02fe mjt (tod0) h 0080 078c h 0080 07de mjt (tid0) h 0080 0790 h 0080 078e multijunction timer (mjt) serial i/o4, 5 h 0080 0a26 h 0080 0a80 a-d1 converter h 0080 0aee mjt (tod1) mjt (tom0) h 0080 0bde h 0080 0c8c h 0080 0cde mjt (tml1) h 0080 0fe0 h 0080 0ffe h 0080 0400 dmac h 0080 0478 can0 h 0080 1000 h 0080 11fe h 0080 0700 input/output port h 0080 0756 h 0080 03be h 0080 03d8 mjt (tml0) h 0080 0b8c mjt (tid1) h 0080 0b8e h 0080 0b90 h 0080 0c8e h 0080 0c90 mjt (tid2) h 0080 0760 h 0080 3ffe +0 address +1 address multijunction timer (mjt) 3 3-14 32170/32174 group user's manual (rev. 2.1) address space 3.4 internal rom/sfr area figure 3.4.5 register mapping of the sfr area (1) h 0080 0000 h 0080 0002 h 0080 0004 h 0080 0006 h 0080 006c h 0080 006e h 0080 0070 h 0080 0072 h 0080 0074 h 0080 0076 h 0080 0078 h 0080 007a h 0080 007c h 0080 007e h 0080 0080 h 0080 0082 h 0080 0084 h 0080 0086 h 0080 0088 h 0080 008a h 0080 0090 +0 address +1 address interrupt vector register (ivect) d0 d7 d8 d15 interrupt mask register (imask) sbi control register (sbicr) a-d0 conversion interrupt control register (iad0ccr) sio0 transmit interrupt control register (isio0txcr) sio0 receive interrupt control register (isio0rxcr) sio1 receive interrupt control register (isio1rxcr) sio1 transmit interrupt control register (isio1txcr) dma0-4 interrupt control register (idma04cr) mjt output interrupt control register 0 (imjtocr0) mjt output interrupt control register 2 (imjtocr2) mjt output interrupt control register 4 (imjtocr4) mjt output interrupt control register 6 (imjtocr6) mjt input interrupt control register 0 (imjticr0) mjt output interrupt control register 1 (imjtocr1) mjt output interrupt control register 3 (imjtocr3) mjt output interrupt control register 5 (imjtocr5) mjt output interrupt control register 7 (imjtocr7) mjt input interrupt control register 1 (imjticr1) mjt input interrupt control register 2 (imjticr2) mjt input interrupt control register 3 (imjticr3) mjt input interrupt control register 4 (imjticr4) a-d0 single mode register 0 (ad0sim0) a-d0 single mode register 1 (ad0sim1) a-d0 scan mode register 0 (ad0scm0) a-d0 scan mode register 1 (ad0scm1) a-d0 successive approximation register (ad0sar) a-d0 comparate data register (ad0cmp) h 0080 008c h 0080 0092 h 0080 0094 10-bit a-d0 data register 0 (ad0dt0) 10-bit a-d0 data register 1 (ad0dt1) 10-bit a-d0 data register 2 (ad0dt2) 10-bit a-d0 data register 3 (ad0dt3) 10-bit a-d0 data register 4 (ad0dt4) 10-bit a-d0 data register 5 (ad0dt5) 10-bit a-d0 data register 6 (ad0dt6) 10-bit a-d0 data register 7 (ad0dt7) 10-bit a-d0 data register 8 (ad0dt8) 10-bit a-d0 data register 9 (ad0dt9) 10-bit a-d0 data register 10 (ad0dt10) 10-bit a-d0 data register 11 (ad0dt11) 10-bit a-d0 data register 12 (ad0dt12) 10-bit a-d0 data register 13 (ad0dt13) 10-bit a-d0 data register 14 (ad0dt14) 10-bit a-d0 data register 15 (ad0dt15) h 0080 0096 h 0080 0098 h 0080 009a h 0080 009c h 0080 009e h 0080 00a0 h 0080 00a2 h 0080 00a4 h 0080 00a6 h 0080 00a8 h 0080 00aa h 0080 00ac h 0080 00ae h 0080 00d0 address h 0080 0066 h 0080 0068 h 0080 006a rtd interrupt control register (irtdcr) sio2,3 transmit/receive interrupt control register (iso23cr) dma5-9 interrupt control register (idma59cr) tod0 output interrupt control register (itod0cr) tid0 output interrupt control register (itid0cr) 8-bit a-d0 data register 0 (ad08dt0) h 0080 0064 h 0080 0062 h 0080 0060 can0 transmit/receive & error interrupt control register (ican0cr) tid2 output interrupt control register (itid2cr) tml1 input interrupt control register (itml1cr) a-d1 conversion interrupt control register (iad1ccr) sio4,5 transmit/receive interrupt control register (isio45cr) tod1-tom0 output interrupt control register (itom0cr) tid1 output interrupt control register (itid1cr) blank addresses are reserved areas 3 3-15 32170/32174 group user's manual (rev. 2.1) address space 3.4 internal rom/sfr area figure 3.4.6 register mapping of the sfr area (2) h 0080 00da h 0080 00dc h 0080 00de h 0080 00e0 h 0080 00e4 h 0080 00e6 h 0080 00e8 h 0080 00ea h 0080 00ec h 0080 00ee h 0080 0100 h 0080 0102 h 0080 0110 h 0080 0112 h 0080 0114 h 0080 0116 h 0080 0120 h 0080 0126 +0 address +1 address d0 d7 d8 d15 h 0080 0122 h 0080 0130 sio1 baud rate register (s1baur) sio0 transmit buffer register (s0txb) sio0 receive buffer register (s0rxb) sio23 interrupt status register (si23stat) 8-bit a-d0 data register 5 (ad08dt5) 8-bit a-d0 data register 6 (ad08dt6) 8-bit a-d0 data register 7 (ad08dt7) 8-bit a-d0 data register 8 (ad08dt8) 8-bit a-d0 data register 9 (ad08dt9) 8-bit a-d0 data register 10 (ad08dt10) 8-bit a-d0 data register 11 (ad08dt11) 8-bit a-d0 data register 12 (ad08dt12) 8-bit a-d0 data register 13 (ad08dt13) 8-bit a-d0 data register 14 (ad08dt14) 8-bit a-d0 data register 15 (ad08dt15) h 0080 0132 h 0080 0134 h 0080 0136 h 0080 0140 h 0080 0142 h 0080 0144 h 0080 0146 h 0080 0180 h 0080 0200 h 0080 0202 h 0080 0210 h 0080 0212 h 0080 0214 address h 0080 00e2 sio03 interrupt mask register (si03mask) sio03 receive interrupt cause select register (si03sel) sio0 transmit control register (s0tcnt) sio0 transmit/receive mode register (s0mod) sio0 receive control register (s0rcnt) h 0080 0124 sio1 baud rate register (s1baur) sio1 transmit buffer register (s1txb) sio1 receive buffer register (s1rxb) sio1 transmit control register (s1tcnt) sio0 transmit/receive mode register (s1mod) sio1 receive control register (s1rcnt) sio2 baud rate register (s2baur) sio2 transmit buffer register (s2txb) sio2 receive buffer register (s2rxb) sio2 transmit control register (s2tcnt) sio2 transmit/receive mode register (s2mod) sio2 receive control register (s2rcnt) sio3 baud rate register (s3baur) sio3 transmit buffer register (s3txb) sio3 receive buffer register (s3rxb) sio3 transmit control register (s3tcnt) sio3 transmit/receive mode register (s3mod) sio3 receive control register (s3rcnt) wait cycles control register (wtccr) h 0080 0204 clock bus & input event bus control register (ckiebcr) prescaler register 0 (prs0) output event bus control register (oebcr) prescaler register 1 (prs1) prescaler register 2 (prs2) tclk input processing control register (tclkcr) tin input processing control register 0 (tincr0) tin input processing control register 1 (tincr1) h 0080 00d2 h 0080 00d4 h 0080 00d6 h 0080 00d8 8-bit a-d0 data register 1 (ad08dt1) 8-bit a-d0 data register 2 (ad08dt2) 8-bit a-d0 data register 3 (ad08dt3) 8-bit a-d0 data register 4 (ad08dt4) blank addresses are reserved areas. 3 3-16 32170/32174 group user's manual (rev. 2.1) address space 3.4 internal rom/sfr area figure 3.4.7 register mapping of the sfr area (3) +0 address +1 address d0 d7 d8 d15 h 0080 021e f/f source select register 0 (ffs0) f/f source select register 1 (ffs1) f/f protect register 0 (ffp0) f/f data register 0 (ffd0) h 0080 0220 h 0080 0222 h 0080 0224 h 0080 0226 h 0080 0228 h 0080 022a f/f protect register 1 (ffp1) f/f data register 1 (ffd1) h 0080 0230 h 0080 0232 h 0080 0234 h 0080 0236 h 0080 0238 h 0080 023a h 0080 023c h 0080 023e h 0080 0240 h 0080 0242 h 0080 0244 h 0080 0246 h 0080 0250 top interrupt control register 0 (topir0) top interrupt control register 1 (topir1) top interrupt control register 2 (topir2) tio interrupt control register 0 (tioir0) tio interrupt control register 2 (tioir2) top interrupt control register 3 (topir3) tio interrupt control register 1 (tioir1) tms interrupt control register (tmsir) tin interrupt control register 0 (tinir0) tin interrupt control register 2 (tinir2) tin interrupt control register 4 (tinir4) tin interrupt control register 6 (tinir6) tin interrupt control register 1 (tinir1) tin interrupt control register 3 (tinir3) tin interrupt control register 5 (tinir5) top0 counter (top0ct) top0 reload register (top0rl) top0 correction register (top0cc) top1 counter (top1ct) address h 0080 0252 h 0080 0254 h 0080 0260 h 0080 0262 h 0080 0264 h 0080 0266 top1 reload register (top1rl) top1 correction register (top1cc) h 0080 0256 top2 counter (top2ct) top2 reload register (top2rl) top2 correction register (top2cc) top3 counter (top3ct) top3 reload register (top3rl) top3 correction register (top3cc) h 0080 0270 h 0080 0272 h 0080 0274 h 0080 0276 h 0080 0280 h 0080 0282 h 0080 0284 h 0080 0286 top4 counter (top4ct) top4 reload register (top4rl) top4 correction register (top4cc) top5 counter (top5ct) top5 reload register (top5rl) h 0080 0290 h 0080 0292 h 0080 0294 h 0080 0216 h 0080 021c h 0080 0218 h 0080 021a tin input processing control register 2 (tincr2) tin input processing control register 3 (tincr3) tin input processing control register 4 (tincr4) tin interrupt control register 7 (tinir7) blank addresses are reserved areas. 3 3-17 32170/32174 group user's manual (rev. 2.1) address space 3.4 internal rom/sfr area figure 3.4.8 register mapping of the sfr area (4) top5 correction register (top5cc) +0 address +1 address d0 d7 d8 d15 h 0080 029e h 0080 02a0 h 0080 02a2 h 0080 02a4 h 0080 02a6 top6 counter (top6ct) top6 reload register (top6rl) top6 correction register (top6cc) h 0080 02b0 h 0080 02b2 h 0080 02b4 top7 counter (top7ct) top7 reload register (top7rl) top7 correction register (top7cc) h 0080 02c0 h 0080 02c2 h 0080 02c4 h 0080 02c6 top8counter (top8ct) top8 reload register (top8rl) top8 correction register (top8cc) h 0080 02b6 h 0080 02a8 h 0080 02aa top6, 7 control register (top67cr) address h 0080 02d0 h 0080 02d2 h 0080 02d4 h 0080 02d6 top9 counter (top9ct) top9 reload register (top9rl) top9 correction register (top9cc) top10 counter (top10ct) top10 reload register (top10rl) top10 correction register (top10cc) h 0080 02e0 h 0080 02e2 h 0080 02e4 h 0080 02e6 h 0080 02e8 h 0080 02ea top8-10 control register (top810cr) top0-10 external enable register (topeen) top0-10 enable protect register (toppro) top0-10 count enable register (topcen) h 0080 02fa h 0080 02fc h 0080 02fe h 0080 0300 tio0 counter (tio0ct) tio0 reload 1 register (tio0rl) tio0 reload 0/measure register (tio0rl0) tio1 counter (tio1ct) tio1 reload 1 register (tio1rl) tio1 reload 0/measure register (tio1rl0) tio0-3 control register 0 (tio03cr0) h 0080 0302 h 0080 0304 h 0080 0306 h 0080 0310 h 0080 0312 h 0080 0314 h 0080 0316 h 0080 0318 h 0080 031a top0-5 control register 0 (top05cr0) top0-5 control register 1 (top05cr1) h 0080 0296 h 0080 0298 h 0080 029a h 0080 029c blank addresses are reserved areas. 3 3-18 32170/32174 group user's manual (rev. 2.1) address space 3.4 internal rom/sfr area figure 3.4.9 register mapping of the sfr area (5) +0 address +1 address d0 d7 d8 d15 h 0080 0324 h 0080 0326 tio2 reload 1 register (tio2rl1) tio2 reload 0/measure register (tio2rl0) h 0080 0330 h 0080 0332 h 0080 0334 h 0080 0336 tio3 counter (tio3ct) tio3 reload 1 register (tio3rl1) tio3 reload 0/measure register (tio3rl0) h 0080 0340 h 0080 0342 h 0080 0344 address tio4 counter (tio4ct) tio4 reload 1 register (tio4rl1) tio4 reload 0/measure register (tio4rl0) tio4 control register (tio4cr) tio5 control register (tio5cr) tio5 counter (tio5ct) tio5 reload 1 register (tio5rl1) tio5 reload 0/measure register (tio5rl0) h 0080 0346 h 0080 0348 h 0080 034a h 0080 0350 h 0080 0352 h 0080 0354 h 0080 0356 tio6 counter (tio6ct) tio6 reload 1 register (tio6rl1) tio6 reload 0/measure register (tio6rl0) tio6 control register (tio6cr) tio7 control register (tio7cr) h 0080 0360 h 0080 0362 h 0080 0364 h 0080 0366 h 0080 0368 h 0080 036a h 0080 0370 h 0080 0372 h 0080 0374 h 0080 0376 tio7 counter (tio7ct) tio7 reload 1 register (tio7rl1) tio7 reload 0/measure register (tio7rl0) h 0080 0380 h 0080 0382 h 0080 0384 h 0080 0386 h 0080 0388 h 0080 038a tio8 counter (tio8ct) tio8 reload 1 register (tio8rl1) tio8 reload 0/measure register (tio8rl0) tio8 control register (tio8cr) tio9 control register (tio9cr) h 0080 0390 h 0080 0392 h 0080 0394 h 0080 0396 tio9 counter (tio9ct) tio9 reload 1 register (tio9rl1) tio9 reload 0/measure register (tio9rl0) tio0-3 control register 1 (tio03cr1) tio2 counter (tio2ct) h 0080 031c h 0080 0320 h 0080 0322 blank addresses are reserved areas. 3 3-19 32170/32174 group user's manual (rev. 2.1) address space 3.4 internal rom/sfr area figure 3.4.10 register mapping of the sfr area (6) d0 d7 d8 d15 tms0 counter (tms0ct) tms0 measure 3 register (tms0mr3) tms0 measure 2 register (tms0mr2) tms0 measure 1 register (tms0mr1) h 0080 03c0 h 0080 03c2 h 0080 03c4 h 0080 03c6 tms0 measure 0 register (tms0mr0) tms0 control register (tms0cr) tms1 control register (tms1cr) tms1 counter (tms1ct) tms1 measure 3 register (tms1mr3) tms1 measure 2 register (tms1mr2) tms1 measure 1 register (tms1mr1) tms1 measure 0 register (tms1mr0) h 0080 03c8 h 0080 03ca h 0080 03d0 h 0080 03d2 h 0080 03d4 h 0080 03d6 h 0080 03d8 h 0080 03e0 h 0080 03e2 h 0080 03ea h 0080 03f0 h 0080 03f2 h 0080 03f4 h 0080 03f6 h 0080 03f8 h 0080 03fa h 0080 03fc tml0 counter, high (tml0cth) tml0 counter, low (tml0ctl) tml0 measure 3 register, high (tml0mr3h) tml0 measure 3 register, low (tml0mr3l) tml0 measure 2 register, high (tml0mr2h) tml0 measure 2 register, low (tml0mr2l) tml0 measure 1 register, high (tml0mr1h) tml0 measure 1 register, low (tml0mr1l) tml0 measure 0 register, high (tml0mr0h) tml0 control register (tml0cr) h 0080 03fe tml0 measure 0 register, low (tml0mr0l) dma0-4 interrupt mask register (dm04itmk) dma0 channel control register (dm0cnt) dma0 transfer count register (dm0tct) dma0 source address register (dm0sa) dma0 destination address register (dm0da) dma1 channel control register (dm1cnt) dma1 transfer count register (dm1tct) dma1 source address register (dm1sa) dma1 destination address register (dm1da) h 0080 0412 h 0080 0414 h 0080 0416 h 0080 0418 h 0080 041a h 0080 041c h 0080 0410 h 0080 041e h 0080 0422 h 0080 0424 h 0080 0426 h 0080 0428 h 0080 0420 dma0-4 interrupt request status register (dm04itst) h 0080 0400 h 0080 0408 dma5-9 interrupt mask register (dm59itmk) dma5-9 interrupt request status register (dm59itst) dma5 channel control register (dm5cnt) dma5 transfer count register (dm5tct) dma5 source address register (dm5sa) dma5 destination address register (dm5da) dma6 channel control register (dm6cnt) dma6 transfer count register (dm6tct) h 0080 03be tio0-9 count enable register (tiocen) h 0080 042a h 0080 042c h 0080 042e dma6 source address register (dm6sa) dma6 destination address register (dm6da) h 0080 03bc tio0-9 enable protect register (tiopro) +0 address +1 address address blank addresses are reserved areas. 3 3-20 32170/32174 group user's manual (rev. 2.1) address space 3.4 internal rom/sfr area figure 3.4.11 register mapping of the sfr area (7) d0 d7 d8 d15 dma2 channel control register (dm2cnt) dma2 transfer count register (dm2tct) h 0080 0430 h 0080 0432 h 0080 0434 h 0080 0436 h 0080 0438 h 0080 043a h 0080 043c h 0080 043e h 0080 0442 h 0080 0444 h 0080 0446 h 0080 0448 h 0080 044a h 0080 044c h 0080 0440 h 0080 044e h 0080 0450 h 0080 0452 h 0080 0454 h 0080 0456 h 0080 0458 h 0080 045a h 0080 045c h 0080 045e h 0080 0460 h 0080 0464 h 0080 0466 h 0080 0462 dma2 source address register (dm2sa) dma2 destination address register (dm2da) dma3 channel control register (dm3cnt) dma3 transfer count register (dm3tct) dma3 source address register (dm3sa) dma3 destination address register (dm3da) dma4 channel control register (dm4cnt) dma4 transfer count register (dm4tct) dma4 source address register (dm4sa) dma4 destination address register (dm4da) dma0 software request generation register (dm0sri) dma1 software request generation register (dm1sri) dma2 software request generation register (dm2sri) dma3 software request generation register (dm3sri) dma7 channel control register (dm7cnt) dma7 transfer count register (dm7tct) dma7 source address register (dm7sa) dma7 destination address register (dm7da) dma8 channel control register (dm8cnt) dma8 transfer count register (dm8tct) dma8 source address register (dm8sa) dma8 destination address register (dm8da) dma9 channel control register (dm9cnt) dma9 transfer count register (dm9tct) dma9 source address register (dm9sa) dma9 destination address register (dm9da) dma4 software request generation register (dm4sri) dma5 software request generation register (dm5sri) dma6 software request generation register (dm6sri) dma7 software request generation register (dm7sri) dma8 software request generation register (dm8sri) dma9 software request generation register (dm9sri) h 0080 0468 h 0080 0470 h 0080 0474 h 0080 0476 h 0080 0472 h 0080 0478 h 0080 0700 p0 data register (p0data) p1 data register (p1data) p2 data register (p2data) p3 data register (p3data) p4 data register (p4data) p6 data register (p6data) p7 data register (p7data) h 0080 0702 h 0080 0704 h 0080 0706 h 0080 0708 h 0080 070a h 0080 070c p8 data register (p8data) p10 data register (p10data) p12 data register (p12data) p9 data register (p9data) p11data register (p11data) p13 data register (p13data) p20 data register (p20data) p18 data register (p18data) p16 data register (p16data) p14 data register (p14data) h 0080 070e h 0080 0710 h 0080 0712 h 0080 0714 p15 data register (p15data) p17 data register (p17data) p19 data register (p19data) p21 data register (p21data) blank addresses are reserved areas. +0 address +1 address address 3 3-21 32170/32174 group user's manual (rev. 2.1) address space 3.4 internal rom/sfr area figure 3.4.12 register mapping of the sfr area (8) +0 address +1 address d0 d7 d8 d15 p2 direction register (p2dir) p3 direction register (p3dir) p4 direction register (p4dir) p6 direction register (p6dir) p7 direction register (p7dir) p8 direction register (p8dir) p9 direction register (p9dir) p10 direction register (p10dir) p11 direction register (p11dir) p12 direction register (p12dir) p13 direction register (p13dir) p14 direction register (p14dir) p15 direction register (p15dir) h 0080 0724 h 0080 0722 h 0080 0728 h 0080 0726 h 0080 072c h 0080 072a h 0080 0730 h 0080 072e address h 0080 0746 h 0080 074a h 0080 0748 h 0080 074e h 0080 074c p6 operation mode register (p6mod) p7 operation mode register (p7mod) p8 operation mode register (p8mod) p9 operation mode register (p9mod) p10 operation mode register (p10mod) p11 operation mode register (p11mod) p12 operation mode register (p12mod) p13 operation mode register (p13mod) p14 operation mode register (p14mod) p15 operation mode register (p15mod) p16 direction register (p16dir) p17 direction register (p17dir) h 0080 0750 p16 operation mode register (p16mod) p17 operation mode register (p17mod) h 0080 078c tid0 counter (tid0ct) tid0 reload register (tid0rl) h 0080 078e h 0080 0790 tod0_0 counter (tod00ct) tod0_0 reload 1 register (tod00rl1) tod0_0 reload 0 register (tod00rl0) tod0_1 counter (tod01ct) tod0_1 reload 1 register (tod01rl1) tod0_0 reload 0 register (tod01rl0) tod0_2 counter (tod02ct) tod0_2 reload 1 register (tod02rl1) h 0080 0794 h 0080 0792 h 0080 0798 h 0080 0796 h 0080 079c h 0080 079a h 0080 07a0 h 0080 079e h 0080 07a4 h 0080 07a2 h 0080 0744 port input function enable register (pien) p22 data register (p22data) h 0080 0716 h 0080 0720 h 0080 0732 h 0080 0734 h 0080 0736 p18 direction register (p18dir) p20 direction register (p20dir) p22 direction register (p22dir) p19 direction register (p19dir) p21 direction register (p21dir) h 0080 0752 h 0080 0754 h 0080 0756 p18 operation mode register (p18mod) p20 operation mode register (p20mod) p22 operation mode register (p22mod) p19 operation mode register (p19mod) p21 operation mode register (p21mod) bus mode control register (busmodc) p0 direction register (p0dir) p1 direction register (p1dir) h 0080 077e h 0080 07a6 h 0080 07a8 h 0080 07aa tod0_2 reload 0 register (tod02rl0) tod0_3 counter (tod03ct) tod0_3 reload 1 register (tod03rl1) tod0_3 reload 0 register (tod03rl0) h 0080 07ac h 0080 07ae blank addresses are reserved areas. 3 3-22 32170/32174 group user's manual (rev. 2.1) address space 3.4 internal rom/sfr area figure 3.4.13 register mapping of the sfr area (9) d0 d7 d8 d15 tod0_7 reload 1 register (tod07rl1) h 0080 07cc h 0080 07ca h 0080 07d0 h 0080 07ce h 0080 07d4 h 0080 07d2 h 0080 07d8 h 0080 07d6 h 0080 07de h 0080 07e2 h 0080 07e0 h 0080 07e8 flash mode register (fmod) flash control register 1 (fcnt1) h 0080 07dc h 0080 07da tod0_7 reload 0 register (tod07rl0) prescaler register 3 (prs3) tid0 control & prescaler 3 enable register (tid0pres3en) tod0 interrupt mask register (tod0ima) tod0 interrupt status register (tod0ist) f/f protect register 2 (ffp2) f/f data register 2 (ffd2) tod0 control register (tod0cr) tod0 enable protect register (tod0pro) tod0 count enable register (tod0cen) h 0080 07e4 flash status register 1 (fstat1) flash control register 2 (fcnt2) flash control register 3 (fcnt3) flash control register 4 (fcnt4) tod0_4 counter (tod04ct) tod0_4 reload 1 register (tod04rl1) tod0_4 reload 0 register (tod04rl0) tod0_5 counter (tod05ct) tod0_5 reload 1 register (tod05rl1) tod0_5 reload 0 register (tod05rl0) tod0_6 counter (tod06ct) tod0_6 reload 1 register (tod06rl1) tod0_6 reload 0 register (tod06rl0) tod0_7 counter (tod07ct) h 0080 07b0 h 0080 07b4 h 0080 07b8 h 0080 07b6 h 0080 07bc h 0080 07ba h 0080 07be h 0080 07b2 h 0080 07c0 h 0080 07c4 h 0080 07c8 h 0080 07c6 h 0080 07c2 pseudo-flash l bank register 0 (felbank0) h 0080 07ea h 0080 0a00 h 0080 0a02 h 0080 0a10 h 0080 0a12 h 0080 0a14 h 0080 0a16 h 0080 0a20 h 0080 0a22 h 0080 0a24 pseudo-flash l bank register 1 (felbank1) sio45 interrupt status register (si45stat) sio45 receive interrupt cause select register (si45sel) sio45 interrupt mask register (si45mask) sio4 transmit control register (s4tcnt) sio4 receive control register (s4rcnt) sio4 transmit buffer register (s4txb) sio4 receive buffer register (s4rxb) sio4 transmit/receive mode register (s4mod) sio4 baud rate register (s4baur) sio5 transmit control register (s5rcnt) sio5 transmit/receive mode register (s5mod) sio5 transmit buffer register (s5txb) sio5 receive buffer register (s5rxb) h 0080 07ec pseudo-flash l bank register 2 (felbank2) pseudo-flash l bank register 3 (felbank3) h 0080 0a26 sio5 receive control register (s5rcnt) sio5 baud rate register (s5baur) h 0080 07ee pseudo-flash s bank register 0 (fesbank0) pseudo-flash s bank register 1 (fesbank1) h 0080 07f0 h 0080 07f2 h 0080 07e6 blank addresses are reserved areas. +0 address +1 address address 3 3-23 32170/32174 group user's manual (rev. 2.1) figure 3.4.14 register mapping of the sfr area (10) address space 3.4 internal rom/sfr area d0 d7 d8 d15 10-bit a-d1 data register 9 (ad1dt9) h 0080 0aa2 h 0080 0aa0 h 0080 0aa6 h 0080 0aa4 h 0080 0aaa h 0080 0aa8 h 0080 0aae h 0080 0aac h 0080 0ad2 h 0080 0ad6 h 0080 0ad4 h 0080 0adc h 0080 0ad0 10-bit a-d1 data register 10 (ad1dt10) 8-bit a-d1 data register 0 (ad18dt0) 8-bit a-d1 data register 1 (ad18dt1) h 0080 0ad8 8-bit a-d1 data register 2 (ad18dt2) a-d1 successive approximation register (ad1sar) a-d1 comparate data register (ad1cmp) 10-bit a-d1 data register 1 (ad1dt1) 10-bit a-d1 data register 2 (ad1dt2) 10-bit a-d1 data register 3 (ad1dt3) 10-bit a-d1 data register 5 (ad1dt5) 10-bit a-d1 data register 6 (ad1dt6) 10-bit a-d1 data register 7 (ad1dt7) h 0080 0a82 h 0080 0a80 h 0080 0a84 h 0080 0a86 h 0080 0a8a h 0080 0a8c h 0080 0a92 h 0080 0a90 h 0080 0a94 h 0080 0a88 h 0080 0a96 h 0080 0a9a h 0080 0a9e h 0080 0a9c h 0080 0a98 h 0080 0ade h 0080 0ae2 h 0080 0ae4 h 0080 0ae8 h 0080 0aea h 0080 0aec h 0080 0aee h 0080 0b8c h 0080 0b8e h 0080 0b90 tid1 reload register (tid1rl) tod1_0 counter (tod10ct) a-d1 single mode register 0 (ad1sim0) a-d1 single mode register 1 (ad1sim1) a-d1 scan mode register 0 (ad1scm0) a-d1 scan mode register 1 (ad1scm1) 10-bit a-d1 data register 0 (ad1dt0) 10-bit a-d1 data register 4 (ad1dt4) 10-bit a-d1 data register 8 (ad1dt8) 10-bit a-d1 data register 11 (ad1dt11) 10-bit a-d1 data register 12 (ad1dt12) 10-bit a-d1 data register 13 (ad1dt13) 10-bit a-d1 data register 14 (ad1dt14) 10-bit a-d1 data register 15 (ad1dt15) h 0080 0ada h 0080 0ae0 h 0080 0ae6 8-bit a-d1 data register 3 (ad18dt3) 8-bit a-d1 data register 4 (ad18dt4) 8-bit a-d1 data register 5 (ad18dt5) 8-bit a-d1 data register 6 (ad18dt6) 8-bit a-d1 data register 7 (ad18dt7) 8-bit a-d1 data register 8 (ad18dt8) 8-bit a-d1 data register 9 (ad18dt9) 8-bit a-d1 data register 10 (ad18dt10) 8-bit a-d1 data register 11 (ad18dt11) 8-bit a-d1 data register 12 (ad18dt12) 8-bit a-d1 data register 13 (ad18dt13) 8-bit a-d1 data register 14 (ad18dt14) 8-bit a-d1 data register 15 (ad18dt15) tid1 counter (tid1ct) tod1_0 reload 1 register (tod10rl1) h 0080 0b92 h 0080 0b94 blank addresses are reserved areas. +0 address +1 address address 3 3-24 32170/32174 group user's manual (rev. 2.1) figure 3.4.15 register mapping of the sfr area (11) address space 3.4 internal rom/sfr area +0 address +1 address d0 d7 d8 d15 tod1_5 counter (tod15ct) h 0080 0bb8 h 0080 0bb6 h 0080 0bbc h 0080 0bba h 0080 0bc0 h 0080 0bbe h 0080 0bc4 h 0080 0bc2 h 0080 0bca address h 0080 0bce h 0080 0bcc h 0080 0bd4 h 0080 0bc8 h 0080 0bd0 tod1_1 reload 0 register (tod11rl0) tod1_3 counter (tod13ct) tod1_3 reload 1 register (tod13rl1) tod1_4 counter (tod14ct) tod1_4 reload 1 register (tod14rl1) h 0080 0b98 h 0080 0b96 h 0080 0b9a h 0080 0b9c h 0080 0ba0 h 0080 0ba2 h 0080 0ba8 h 0080 0ba6 h 0080 0baa h 0080 0b9e h 0080 0bac h 0080 0bb0 h 0080 0bb4 h 0080 0bb2 h 0080 0bae h 0080 0bd6 h 0080 0bda h 0080 0bdc h 0080 0c8c h 0080 0c8e h 0080 0c90 h 0080 0c94 h 0080 0c96 h 0080 0c98 tom0_0 reload 0 register (tom00rl0) tom0_1 counter (tom01ct) tod1_2 reload 0 register (tod12rl0) tod1_3 reload 0 register (tod13rl0) tod1_4 reload 0 register (tod14rl0) tod1_5 reload 1 register (tod15rl1) tod1_5 reload 0 register (tod15rl0) tod1_6 counter (tod16ct) tod1_6 reload 1 register (tod16rl1) h 0080 0bd2 h 0080 0bd8 h 0080 0bde tod1 interrupt status register (tod1ist) f/f protect register 3 (ffp3) f/f data register 3 (ffd3) tod1 enable protect register (tod1pro) tod1 count enable register (tod1cen) tom0_0 reload 1 register (tom00rl1) h 0080 0ba4 h 0080 0bc6 h 0080 0c92 tod1_0 reload 0 register (tod10rl0) tod1_1 counter (tod11ct) tod1_1 reload 1 register (tod11rl1) tod1_2 counter (tod12ct) tod1_2 reload 1 register (tod12rl1) tod1_6 reload 0 register (tod16rl0) tod1_7 counter (tod17ct) tod1_7 reload 1 register (tod17rl1) tod1_7 reload 0 register (tod17rl0) tid1 control & prescaler 4 enable register (tid1prs4en) prescaler register 4 (prs4) tod1 interrupt mask register (tod1ima) tod1 control register (tod1cr) tid2 counter (tid2ct) tid2 reload register (tid2rl) tom0_0 counter (tom00ct) h 0080 0c9a h 0080 0c9c tom0_1 reload 1 register (tom01rl1) blank addresses are reserved areas. 3 3-25 32170/32174 group user's manual (rev. 2.1) address space 3.4 internal rom/sfr area figure 3.4.16 register mapping of the sfr area (12) d0 d7 d8 d15 tom0_6 counter (tom06ct) h 0080 0cc0 h 0080 0cbe h 0080 0cc4 h 0080 0cc2 h 0080 0cc8 h 0080 0cc6 h 0080 0ccc h 0080 0cca h 0080 0cd2 h 0080 0cd6 h 0080 0cd4 h 0080 0cdc h 0080 0cd0 h 0080 0cd8 tom0_2 reload 0 register (tom02rl0) tom0_4 counter (tom04ct) tom0_4 reload 1 register (tom04rl1) tom0_5 counter (tom05ct) tom0_5 reload 1 register (tom05rl1) h 0080 0ca0 h 0080 0c9e h 0080 0ca2 h 0080 0ca4 h 0080 0ca8 h 0080 0caa h 0080 0cb0 h 0080 0cae h 0080 0cb2 h 0080 0ca6 h 0080 0cb4 h 0080 0cb8 h 0080 0cbc h 0080 0cba h 0080 0cb6 h 0080 0cde h 0080 0fe0 h 0080 0fe2 h 0080 0ff0 h 0080 0ff2 h 0080 0ff6 h 0080 0ff8 h 0080 0ffa tml1 measure 1 register, high (tml1mr1h) tml1 measure 1 register, low (tml1mr1l) tom0_3 reload 0 register (tom03rl0) tom0_4 reload 0 register (tom04rl0) tom0_5 reload 0 register (tom05rl0) tom0_6 reload 1 register (tom06rl1) tom0_6 reload 0 register (tom06rl0) tom0_7 counter (tom07ct) tom0_7 reload 1 register (tom07rl1) h 0080 0cda tom0 interrupt status register (tom0ist) f/f protect register 4 (ffp4) f/f data register 4 (ffd4) tom0 count enable register (tom0cen) tom0 enable protect register (tom0pro) tml1 measure 2 register, low (tml1mr2l) h 0080 0cac h 0080 0cce h 0080 0ff4 tom0_1 reload 0 register (tom01rl0) tom0_2 counter (tom02ct) tom0_2 reload 1 register (tom02rl1) tom0_3 counter (tom03ct) tom0_3 reload 1 register (tom03rl1) tom0_7 reload 0 register (tom07rl0) tid2 control & prescaler 5 enable register (tid2prs5en) prescaler register 5 (prs5) tom0 interrupt mask register (tom0ima) tom0 control register (tom0cr) tml1 measure 3 register, high (tml1mr3h) tml1 counter, high (tml1cth) tml1 counter, low (tml1ctl) h 0080 0fea tml1 control register (tml1cr) tml1 measure 2 register, high (tml1mr2h) h 0080 0ffc h 0080 0ffe tml1 measure 0 register, high (tml1mr0h) tml1 measure 0 register, low (tml1mr0l) blank addresses are reserved areas. +0 address +1 address address tml1 measure 3 register, low (tml1mr3l) 3 3-26 32170/32174 group user's manual (rev. 2.1) address space 3.4 internal rom/sfr area figure 3.4.17 register mapping of the sfr area (13) d0 d7 d8 d15 h 0080 1034 h 0080 1032 h 0080 1038 h 0080 1036 h 0080 103c h 0080 103a h 0080 1054 h 0080 1058 h 0080 1056 h 0080 1052 h 0080 105a can0 configuration register (can0conf) can0 global mask register standard id0 (c0gmsks0) can0 local mask register a standard id0 (c0lmskas0) h 0080 1000 h 0080 1002 h 0080 1004 h 0080 1008 h 0080 100a h 0080 1010 h 0080 100e h 0080 1006 h 0080 1028 h 0080 102c h 0080 1030 h 0080 102e h 0080 102a h 0080 105c h 0080 100c h 0080 1050 can0 control register (can0cnt) can0 extended id register (can0extid) can0 time stamp count register (can0tstmp) can0 slot interrupt status register (can0slist) can0 message slot 3 control register (c0msl3cnt) can0 message slot 2 control register (c0msl2cnt) can0 message slot 4 control register (c0msl4cnt) can0 status register (can0stat) can0 receive error count register (can0rec) can0 transmit error count register (can0tec) can0 message slot 0 control register (c0msl0cnt) can0 message slot 1 control register (c0msl1cnt) can0 message slot 5 control register (c0msl5cnt) can0 message slot 7 control register (c0msl7cnt) can0 message slot 9 control register (c0msl9cnt) can0 message slot 11 control register (c0msl11cnt) can0 message slot 13 control register (c0msl13cnt) can0 message slot 15 control register (c0msl15cnt) can0 message slot 6 control register (c0msl6cnt) can0 message slot 8 control register (c0msl8cnt) can0 message slot 10 control register (c0msl10cnt) can0 message slot 12 control register (c0msl12cnt) can0 message slot 14 control register (c0msl14cnt) h 0080 1012 can0 error interrupt status register (can0erist) can0 error interrupt mask register (can0erimk) h 0080 1014 h 0080 1016 can0 baud rate prescaler (can0brp) h 0080 105e can0 global mask register standard id1 (c0gmsks1) can0 global mask register extended id0 (c0gmske0) can0 global mask register extended id1 (c0gmske1) can0 global mask register extended id2 (c0gmske2) can0 local mask register a standard id1 (c0lmskas1) can0 local mask register a extended id0 (c0lmskae0) can0 local mask register a extended id1 (c0lmskae1) can0 local mask register a extended id2 (c0lmskae2) can0 local mask register b standard id0 (c0lmskbs0) can0 local mask register b standard id0 (c0lmskbs1) can0 local mask register b extended id0 (c0lmskbe0) can0 local mask register b extended id0 (c0lmskbe1) can0 local mask register b extended id0 (c0lmskbe0) blank addresses are reserved areas. +0 address +1 address address can0 slot interrupt mask register (can0slimk) 3 3-27 32170/32174 group user's manual (rev. 2.1) address space 3.4 internal rom/sfr area figure 3.4.18 register mapping of the sfr area (14) d0 d7 d8 d15 h'0080 1102 h'0080 1104 h'0080 110c h'0080 110e h'0080 1112 h'0080 1114 h'0080 1116 h'0080 1110 h'0080 1108 h'0080 1106 h'0080 110a can0 message slot 0 extended id0 (c0msl0eid0) can0 message slot 0 extended id2 (c0msl0eid2) can0 message slot 0 data 0 (c0msl0dt0) can0 message slot 0 data 2 (c0msl0dt2) can0 message slot 0 data 4 (c0msl0dt4) can0 message slot 0 extended id1 (c0msl0eid1) can0 message slot 0 data length register (c0msl0dlc) can0 message slot 0 data 1 (c0msl0dt1) can0 message slot 0 data 3 (c0msl0dt3) can0 message slot 0 data 5 (c0msl0dt5) can0 message slot 0 data 6 (c0msl0dt6) can0 message slot 0 data 7 (c0msl0dt7) can0 message slot 0 time stamp (c0msl0tsp) can0 message slot 1 standard id0 (c0msl1sid0) can0 message slot 1 extended id0 (c0msl1eid0) can0 message slot 1 extended id2 (c0msl1eid2) can0 message slot 1 data 0 (c0msl1dt0) can0 message slot 1 standard id1 (c0msl1sid1) can0 message slot 1 extended id1 (c0msl1eid1) can0 message slot 1 data length register (c0msl1dlc) can0 message slot 1 data 1 (c0msl1dt1) can0 message slot 1 data 3 (c0msl1dt3) can0 message slot 1 data 5 (c0msl1dt5) can0 message slot 1 data 2 (c0msl1dt2) can0 message slot 1 data 4 (c0msl1dt4) h'0080 1118 h'0080 111a h'0080 111e h'0080 1120 h'0080 1122 h'0080 1126 h'0080 1128 h'0080 112e h'0080 112c h'0080 1124 h'0080 112a can0 message slot 2 data 6 (c0msl2dt6) can0 message slot 2 time stamp (c0msl2tsp) can0 message slot 2 data 7 (c0msl2dt7) h'0080 111c can0 message slot 2 data 4 (c0msl2dt4) can0 message slot 2 data 2 (c0msl2dt2) can0 message slot 2 data 0 (c0msl2dt0) can0 message slot 2 extended id2 (c0msl2eid2) can0 message slot 2 extended id0 (c0msl2eid0) can0 message slot 2 standard id0 (c0msl2sid0) can0 message slot 1 time stamp (c0msl1tsp) can0 message slot 1 data 6 (c0msl1dt6) can0 message slot 2 data 5 (c0msl2dt5) can0 message slot 2 data 3 (c0msl2dt3) can0 message slot 2 data 1 (c0msl2dt1) can0 message slot 2 data length register (c0msl2dlc) can0 message slot 2 extended id1 (c0msl2eid1) can0 message slot 2 standard id1 (c0msl2sid1) can0 message slot 1 data 7 (c0msl1dt7) h'0080 1130 h'0080 1132 h'0080 1136 h'0080 1138 h'0080 113e h'0080 113c h'0080 1134 h'0080 113a can0 message slot 3 data 6 (c0msl3dt6) can0 message slot 3 time stamp (c0msl3tsp) can0 message slot 3 data 7 (c0msl3dt7) can0 message slot 3 data 4 (c0msl3dt4) can0 message slot 3 data 2 (c0msl3dt2) can0 message slot 3 data 0 (c0msl3dt0) can0 message slot 3 extended id2 (c0msl3eid2) can0 message slot 3 extended id0 (c0msl3eid0) can0 message slot 3 standard id0 (c0msl3sid0) can0 message slot 3 data 5 (c0msl3dt5) can0 message slot 3 data 3 (c0msl3dt3) can0 message slot 3 data 1 (c0msl3dt1) can0 message slot 3 data length register (c0msl3dlc) can0 message slot 3 extended id1 (c0msl3eid1) can0 message slot 3 standard id1 (c0msl3sid1) h'0080 1140 h'0080 1142 h'0080 1146 h'0080 1148 h'0080 114e h'0080 114c h'0080 1144 h'0080 114a can0 message slot 4 data 6 (c0msl4dt6) can0 message slot 4 time stamp (c0msl4tsp) can0 message slot 4 data 7 (c0msl4dt7) can0 message slot 4 data 4 (c0msl4dt4) can0 message slot 4 data 2 (c0msl4dt2) can0 message slot 4 data 0 (c0msl4dt0) can0 message slot 4 extended id2 (c0msl4eid2) can0 message slot 4 extended id0 (c0msl4eid0) can0 message slot 4 standard id0 (c0msl4sid0) can0 message slot 4 data 5 (c0msl4dt5) can0 message slot 4 data 3 (c0msl4dt3) can0 message slot 4 data 1 (c0msl4dt1) can0 message slot 4 data length register (c0msl4dlc) can0 message slot 4 extended id1 (c0msl4eid1) can0 message slot 4 standard id1 (c0msl4sid1) h'0080 1150 h'0080 1152 can0 message slot 5 extended id0 (c0msl5eid0) can0 message slot 5 standard id0 (c0msl5sid0) can0 message slot 5 extended id1 (c0msl5eid1) can0 message slot 5 standard id1 (c0msl5sid1) h'0080 1100 can0 message slot 0 standard id1 (c0msl0sid1) can0 message slot 0 standard id0 (c0msl0sid0) blank addresses are reserved areas. +0 address +1 address address 3 3-28 32170/32174 group user's manual (rev. 2.1) address space 3.4 internal rom/sfr area figure 3.4.19 register mapping of the sfr area (15) d0 d7 d8 d15 h'0080 1156 h'0080 1158 h'0080 115e h'0080 115c h'0080 1154 h'0080 115a h'0080 1160 h'0080 1162 h'0080 1166 h'0080 1168 h'0080 116e h'0080 116c h'0080 1164 h'0080 116a h'0080 1170 h'0080 1172 h'0080 1176 h'0080 1174 can0 message slot 5 data 6 (c0msl5dt6) can0 message slot 5 time stamp (c0msl5tsp) can0 message slot 5 data 7 (c0msl5dt7) can0 message slot 5 data 4 (c0msl5dt4) can0 message slot 5 data 2 (c0msl5dt2) can0 message slot 5 data 0 (c0msl5dt0) can0 message slot 5 extended id2 (c0msl5eid2) can0 message slot 5 data 5 (c0msl5dt5) can0 message slot 5 data 3 (c0msl5dt3) can0 message slot 5 data 1 (c0msl5dt1) can0 message slot 5 data length register (c0msl5dlc) can0 message slot 6 data 6 (c0msl6dt6) can0 message slot 6 time stamp (c0msl6tsp) can0 message slot 6 data 7 (c0msl6dt7) can0 message slot 6 data 4 (c0msl6dt4) can0 message slot 6 data 2 (c0msl6dt2) can0 message slot 6 data 0 (c0msl6dt0) can0 message slot 6 extended id2 (c0msl6eid2) can0 message slot 6 extended id0 (c0msl6eid0) can0 message slot 6 standard id0 (c0msl6sid0) can0 message slot 6 data 5 (c0msl6dt5) can0 message slot 6 data 3 (c0msl6dt3) can0 message slot 6 data 1 (c0msl6dt1) can0 message slot 6 data length register (c0msl6dlc) can0 message slot 6 extended id1 (c0msl6eid1) can0 message slot 6 standard id1 (c0msl6sid1) can0 message slot 7 data 0 (c0msl7dt0) can0 message slot 7 extended id2 (c0msl7eid2) can0 message slot 7 extended id0 (c0msl7eid0) can0 message slot 7 standard id0 (c0msl7sid0) can0 message slot 7 data 1 (c0msl7dt1) can0 message slot 7 data length register (c0msl7dlc) can0 message slot 7 extended id1 (c0msl7eid1) can0 message slot 7 standard id1 (c0msl7sid1) h'0080 117a h'0080 117c h'0080 117e h'0080 1182 h'0080 1184 h'0080 118a h'0080 1188 h'0080 1180 h'0080 1186 h'0080 1178 h'0080 118c h'0080 118e h'0080 1192 h'0080 1194 h'0080 119a h'0080 1198 h'0080 1190 h'0080 1196 h'0080 119c h'0080 119e can0 message slot 8 data 6 (c0msl8dt6) can0 message slot 8 time stamp (c0msl8tsp) can0 message slot 8 data 7 (c0msl8dt7) can0 message slot 8 data 4 (c0msl8dt4) can0 message slot 8 data 2 (c0msl8dt2) can0 message slot 8 data 0 (c0msl8dt0) can0 message slot 8 extended id2 (c0msl8eid2) can0 message slot 8 extended id0 (c0msl8eid0) can0 message slot 8 standard id0 (c0msl8sid0) can0 message slot 8 data 5 (c0msl8dt5) can0 message slot 8 data 3 (c0msl8dt3) can0 message slot 8 data 1 (c0msl8dt1) can0 message slot 8 data length register (c0msl8dlc) can0 message slot 8 extended id1 (c0msl8 eid1) can0 message slot 8 standard id1 (c0msl8sid1) can0 message slot 7 data 6 (c0msl7dt6) can0 message slot 7 time stamp (c0msl7tsp) can0 message slot 7 data 7 (c0msl7dt7) can0 message slot 7 data 4 (c0msl7dt4) can0 message slot 7 data 2 (c0msl7dt2) can0 message slot 7 data 5 (c0msl7dt5) can0 message slot 7 data 3 (c0msl7dt3) can0 message slot 9 data 6 (c0msl9dt6) can0 message slot 9 time stamp (c0msl9tsp) can0 message slot 9 data 7 (c0msl9dt7) can0 message slot 9 data 4 (c0msl9dt4) can0 message slot 9 data 2 (c0msl9dt2) can0 message slot 9 data 0 (c0msl9dt0) can0 message slot 9 extended id2 (c0msl9eid2) can0 message slot 9 extended id0 (c0msl9eid0) can0 message slot 9 standard id0 (c0msl9sid0) can0 message slot 9 data 5 (c0msl9dt5) can0 message slot 9 data 3 (c0msl9dt3) can0 message slot 9 data 1 (c0msl9dt1) can0 message slot 9 data length register (c0msl9dlc) can0 message slot 9 extended id1 (c0msl9eid1) can0 message slot 9 standard id1 (c0msl9sid1) h'0080 11a2 h'0080 11a4 h'0080 11a0 can0 message slot 10 extended id2 (c0msl10eid2) can0 message slot 10 extended id0 (c0msl10eid0) can0 message slot 10 standard id0 (c0msl10sid0) can0 message slot 10 data length register (c0msl10dlc) can0 message slot 10 extended id1 (c0msl10eid1) can0 message slot 10 standard id1 (c0msl10sid1) h'0080 11a6 can0 message slot 10 data 0 (c0msl10dt0) can0 message slot 10 data 1 (c0msl10dt1) blank addresses are reserved areas. +0 address +1 address address 3 3-29 32170/32174 group user's manual (rev. 2.1) figure 3.4.20 register mapping of the sfr area (16) address space 3.4 internal rom/sfr area d0 d7 d8 d15 h 0080 11aa h 0080 11a8 h 0080 11ac h 0080 11ae h 0080 11b2 h 0080 11bc h 0080 11ba h 0080 11b8 h 0080 11b0 h 0080 11b6 h 0080 11be h 0080 11c2 h 0080 11c4 h 0080 11ca h 0080 11c8 h 0080 11c0 h 0080 11c6 h 0080 11ce h 0080 11d2 h 0080 11d0 can0 message slot 10 data 6 (c0msl10dt6) can0 message slot 10 time stamp (c0msl10tsp) can0 message slot 10 data 7 (c0msl10dt7) can0 message slot 10 data 4 (c0msl10dt4) can0 message slot 10 data 2 (c0msl10dt2) can0 message slot 10 data 5 (c0msl10dt5) can0 message slot 10 data 3 (c0msl10dt3) can0 message slot 11 data 6 (c0msl11dt6) can0 message slot 11 time stamp (c0msl11tsp) can0 message slot 11 data 7 (c0msl11dt7) can0 message slot 11 data 4 (c0msl11dt4) can0 message slot 11 data 2 (c0msl11dt2) can0 message slot 11 data 0 (c0msl11dt0) can0 message slot 11 extended id2 (c0msl11eid2) can0 message slot 11 extended id0 (c0msl11eid0) can0 message slot 11 standard id0 (c0msl11sid0) can0 message slot 11 data 5 (c0msl11dt5) can0 message slot 11 data 3 (c0msl11dt3) can0 message slot 11 data 1 (c0msl11dt1) can0 message slot 11 data length register (c0msl11dlc) can0 message slot 11 extended id1 (c0msl11eid1) can0 message slot 11 standard id1 (c0msl11sid1) can0 message slot 12 data 6 (c0msl12dt6) can0 message slot 12 time stamp (c0msl12tsp) can0 message slot 12 data 7 (c0msl12dt7) can0 message slot 12 data 4 (c0msl12dt4) can0 message slot 12 data 2 (c0msl12dt2) can0 message slot 12 data 0 (c0msl12dt0) can0 message slot 12 extended id2 (c0msl12eid2) can0 message slot 12 extended id0 (c0msl12eid0) can0 message slot 12 standard id0 (c0msl12sid0) can0 message slot 12 data 5 (c0msl12dt5) can0 message slot 12 data 3 (c0msl12dt3) can0 message slot 12 data 1 (c0msl12dt1) can0 message slot 12 data length register (c0msl12dlc) can0 message slot 12 extended id1 (c0msl12eid1) can0 message slot 12 standard id1 (c0msl12sid1) can0 message slot 13 extended id0 (c0msl13eid0) can0 message slot 13 standard id0 (c0msl13sid0) can0 message slot 13 extended id1 (c0msl13eid1) can0 message slot 13 standard id1 (c0msl13sid1) h 0080 11d6 h 0080 11d8 h 0080 11da h 0080 11de h 0080 11e0 h 0080 11e6 h 0080 11e4 h 0080 11dc h 0080 11e2 h 0080 11d4 h 0080 11e8 h 0080 11ea h 0080 11ee h 0080 11f0 h 0080 11f6 h 0080 11f4 h 0080 11ec h 0080 11f2 h 0080 11f8 h 0080 11fa h 0080 11fe h 0080 3ffe h 0080 11fc can0 message slot 14 data 6 (c0msl14dt6) can0 message slot 14 time stamp (c0msl14tsp) can0 message slot 14 data 7 (c0msl14dt7) can0 message slot 14 data 4 (c0msl14dt4) can0 message slot 14 data 2 (c0msl14dt2) can0 message slot 14 data 0 (c0msl14dt0) can0 message slot 14 extended id2 (c0msl14eid2) can0 message slot 14 extended id0 (c0msl14eid0) can0 message slot 14 standard id0 (c0msl14sid0) can0 message slot 14 data 5 (c0msl14dt5) can0 message slot 14 data 3 (c0msl14dt3) can0 message slot 14 data 1 (c0msl14dt1) can0 message slot 14 data length register (c0msl14dlc) can0 message slot 14 extended id1 (c0msl14eid1) can0 message slot 14 standard id1 (c0msl14sid1) can0 message slot 13 data 6 (c0msl13dt6) can0 message slot 13 time stamp (c0msl13tsp) can0 message slot 13 data 7 (c0msl13dt7) can0 message slot 13 data 4 (c0msl13dt4) can0 message slot 13 data 2 (c0msl13dt2) can0 message slot 13 data 0 (c0msl13dt0) can0 message slot 13 extended id2 (c0msl13eid2) can0 message slot 13 data 5 (c0msl13dt5) can0 message slot 13 data 3 (c0msl13dt3) can0 message slot 13 data 1 (c0msl13dt1) can0 message slot 15 data 6 (c0msl15dt6) can0 message slot 15 time stamp (c0msl11tsp) can0 message slot 15 data 7 (c0msl15dt7) can0 message slot 15 data 4 (c0msl15dt4) can0 message slot 15 data 2 (c0msl15dt2) can0 message slot 15 data 0 (c0msl15dt0) can0 message slot 15 extended id2 (c0msl15eid2) can0 message slot 15 extended id0 (c0msl15eid0) can0 message slot 15 standard id0 (c0msl15sid0) can0 message slot 15 data 5 (c0msl15dt5) can0 message slot 15 data 3 (c0msl15dt3) can0 message slot 15 data 1 (c0msl15dt1) can0 message slot 15 data length register (c0msl15dlc) can0 message slot 15 extended id1 (c0msl15eid1) can0 message slot 15 standard id1 (c0msl15sid1) can0 message slot 13 data length register (c0msl13dlc) h 0080 11cc h 0080 11b4 blank addresses are reserved areas. +0 address +1 address address 3 3-30 32170/32174 group user's manual (rev. 2.1) address space 3.5 eit vector entry 3.5 eit vector entry the eit vector entry is located at the beginning of the internal rom/extended external areas. instructions for branching to the start addresses of respective eit event handlers are written here. note that it is branch instructions and not the jump addresses that are written here. for details, refer to chapter 4, "eit." figure 3.5.1 eit vector entry note: when flash entry bit = 1 (i.e., flash enable mode), the ei vector entry is at h'0080 4000. h ? 0000 0040 trap0 trap1 trap2 trap3 trap4 trap5 trap6 trap7 trap8 trap9 trap10 trap11 trap12 trap13 trap14 trap15 ae (address exception) ei (external interrupt) (note) h ? 0000 0044 h ? 0000 0048 h ? 0000 004c h ? 0000 0050 h ? 0000 0054 h ? 0000 0058 h ? 0000 005c h ? 0000 0060 h ? 0000 0064 h ? 0000 0068 h ? 0000 006c h ? 0000 0070 h ? 0000 0074 h ? 0000 0078 h ? 0000 007c h ? 0000 0080 ri (reset interrupt) sbi (system break interrupt) rie (reserved instruction exception) h ? 0000 0030 h ? 0000 0020 h ? 0000 0010 h ? 0000 0000 031 h ? 0000 0034 h ? 0000 0038 h ? 0000 003c h ? 0000 0024 h ? 0000 0028 h ? 0000 002c h ? 0000 0004 h ? 0000 0008 h ? 0000 000c h ? 0000 0014 h ? 0000 0018 h ? 0000 001c 3 3-31 32170/32174 group user's manual (rev. 2.1) 3.6 icu vector table the icu vector table is used by the internal interrupt controller. the start addresses of interrupt handlers for the interrupt requests from respective internal peripheral i/os are set at the ad- dresses shown below. for details, refer to chapter 5, "interrupt controller." the icu vector table is shown in figures 3.6.1 and 3.6.2. address space 3.6 icu vector table figure 3.6.1 icu vector table (1/2) h ? 0000 0094 address d0 d7 +0 address +1 address d8 d15 h ? 0000 0096 mjt input interrupt 4 handler start address (a0-a15) mjt input interrupt 4 handler start address (a16-a31) h ? 0000 0098 h ? 0000 009a h ? 0000 009c h ? 0000 009e h ? 0000 00a0 h ? 0000 00a2 h ? 0000 00a4 h ? 0000 00a6 h ? 0000 00a8 h ? 0000 00aa h ? 0000 00ac h ? 0000 00ae h ? 0000 00b0 h ? 0000 00b2 h ? 0000 00b4 h ? 0000 00b6 h ? 0000 00b8 h ? 0000 00ba h ? 0000 00bc h ? 0000 00be h ? 0000 00c0 h ? 0000 00c2 h ? 0000 00c4 h ? 0000 00c6 mjt output interrupt 7 handler start address (a0-a15) mjt output interrupt 7 handler start address (a16-a31) mjt input interrupt 3 handler start address (a0-a15) mjt input interrupt 3 handler start address (a16-a31) mjt input interrupt 2 handler start address (a0-a15) mjt input interrupt 2 handler start address (a16-a31) mjt input interrupt 1 handler start address (a0-a15) mjt input interrupt 1 handler start address (a16-a31) mjt input interrupt 0 handler start address (a0-a15) mjt input interrupt 0 handler start address (a16-a31) mjt output interrupt 6 handler start address (a0-a15) mjt output interrupt 6 handler start address (a16-a31) mjt output interrupt 5 handler start address (a0-a15) mjt output interrupt 5 handler start address (a16-a31) mjt output interrupt 4 handler start address (a0-a15) mjt output interrupt 4 handler start address (a16-a31) mjt output interrupt 3 handler start address (a0-a15) mjt output interrupt 3 handler start address (a16-a31) mjt output interrupt 2 handler start address (a0-a15) mjt output interrupt 2 handler start address (a16-a31) mjt output interrupt 1 handler start address (a0-a15) mjt output interrupt 1 handler start address (a16-a31) mjt output interrupt 0 handler start address (a0-a15) mjt output interrupt 0 handler start address (a16-a31) 3 3-32 32170/32174 group user's manual (rev. 2.1) address space 3.6 icu vector table figure 3.6.2 icu vector table (2/2) h'0000 00c8 address d0 d7 +0 address +1 address d8 d15 h'0000 00ca dma0-4 interrupt handler start address (a0-a15) dma0-4 interrupt handler start address (a16-a31) h'0000 00cc h'0000 00ce h'0000 00d0 h'0000 00d2 h'0000 00d4 h'0000 00d6 h'0000 00d8 h'0000 00da h'0000 00dc h'0000 00de sio1 receive interrupt handler start address (a0-a15) sio1 receive interrupt handler start address (a16-a31) sio1 transmit interrupt handler start address (a0-a15) sio1 transmit interrupt handler start address (a16-a31) a-d0 conversion interrupt handler start address (a0-a15) a-d0 conversion interrupt handler start address (a16-a31) h'0000 00e0 h'0000 00e2 h'0000 00e4 h'0000 00e6 h'0000 00e8 h'0000 00ea h'0000 00ec h'0000 00ee tid0 output interrupt handler start address (a0-a15) tid0 output transmit interrupt handler start address (a16-a31) tod0 output interrupt handler start address (a0-a15) tod0 output interrupt handler start address (a16-a31) dma5-9 interrupt handler start address (a0-a15) dma5-9 interrupt handler start address (a16-a31) sio2,3 transmit/receive interrupt handler start address (a0-a15) sio2,3 transmit/receive interrupt handler start address (a16-a31) h'0000 00f0 h'0000 00f2 rtd interrupt handler start address (a0-a15) rtd interrupt handler start address (a16-a31) h'0000 00f4 h'0000 00f6 tid1 output interrupt handler start address (a0-a15) tid1 output interrupt handler start address (a16-a31) h'0000 00f8 h'0000 00fa tod1+tom0 output interrupt handler start address (a0-a15) tod1+tom0 output interrupt handler start address (a16-a31) h'0000 00fc h'0000 00fe sio4,5 transmit/receive interrupt handler start address (a0-a15) sio4,5 transmit/receive interrupt handler start address (a16-a31) h'0000 0100 h'0000 0102 a-d1 conversion interrupt handler start address (a0-a15) a-d1 conversion interrupt handler start address (a16-a31) h'0000 0104 h'0000 0106 tid2 output interrupt handler start address (a0-a15) tid2 output interrupt handler start address (a16-a31) h'0000 0108 h'0000 010a tml1 input interrupt handler start address (a0-a15) tml1 input interrupt handler start address (a16-a31) h'0000 010c h'0000 010e can0 transmit/receive & error interrupt handler start address (a0-a15) can0 transmit/receive & error interrupt handler start address (a16-a31) sio0 receive interrupt handler start address (a0-a15) sio0 receive interrupt handler start address (a16-a31) sio0 transmit interrupt handler start address (a0-a15) sio0 transmit interrupt handler start address (a16-a31) 3 3-33 32170/32174 group user's manual (rev. 2.1) address space 3.7 notes on address space 3.7 notes on address space ?virtual-flash emulation function the 32170 and 32174 have a function for mapping 8-kbyte blocks (up to four blocks for the m32170f6 or up to three blocks for the m32170f4, m32170f3, m32174f4, and m32174f3) of the internal ram beginning with its start address into the internal flash memory areas divided in units of 8 kbytes (l banks), as well as mapping 4-kbyte blocks (up to two blocks) of the internal ram beginning with address h?080 c000 for the m32170f6 or h?080 a000 for the m32170f4, m32170f3, m32174f4, and m32174f3 into the internal flash memory areas divided in units of 4 kbytes (s banks). this is referred to as the virtual-flash emulation function. for details about this function, refer to section 6.7, ?irtual-flash emulation function. 3 3-34 32170/32174 group user's manual (rev. 2.1) address space 3.7 notes on address space ? this is a blank page. ? chapter 4 chapter 4 eit 4.1 outline of eit 4.2 eit event 4.3 eit processing procedure 4.4 eit processing mechanism 4.5 acceptance of eit events 4.6 saving and restoring the pc and psw 4.7 eit vector entry 4.8 exception processing 4.9 interrupt processing 4.10 trap processing 4.11 eit priority levels 4.12 example of eit processing 4.13 precautions on eit 4 4-2 32170/32174 group user's manual (rev. 2.1) eit 4.1 outline of eit 4.1 outline of eit if some event occurs when the cpu is executing an ordinary program, it may become necessary to suspend the program being executed and execute another program. events like this one are referred to by a generic name as eit (exception, interrupt, and trap). (1) exception this is an event related to the context being executed. it is generated by an error or violation during instruction execution. in the m32r/ecu, this type of event includes address exception (ae) and reserved instruction exception (rie). (2) interrupt this is an event generated irrespective of the context being executed. it is generated in hardware by a signal from an external source. in the m32r/ecu, this type of event includes external interrupt (ei), system break interrupt (sbi), and reset interrupt (ri). (3) trap this refers to a software interrupt generated by executing a trap instruction. this type of event is intentionally generated in a program as in the os's system call by the programmer. eit exception reserved instruction exception (rie) address exception (ae) interrupt reset interrupt (ri) system break interrupt (sbi) external interrupt (ei) trap trap figure 4.1.1 classification of eits 4 4-3 32170/32174 group user's manual (rev. 2.1) eit 4.2 eit event 4.2 eit event 4.2.1 exception (1) reserved instruction exception (rie) reserved instruction exception (rie) is generated when execution of a reserved instruction (unimplemented instruction) is detected. (2) address exception (ae) address exception (ae) is generated when an attempt is made to access a misaligned address in load or store instructions. 4.2.2 interrupt (1) reset interrupt (ri) ____________ reset interrupt (ri) is always accepted by entering the reset signal. the reset interrupt is assigned the highest priority. (2) system break interrupt (sbi) system break interrupt (sbi) is an emergency interrupt which is used when power outage is detected or a fault condition is notified by an external watchdog timer. this interrupt can only be used in cases when after interrupt processing, control will not return to the program that was being executed when the interrupt occurred. (3) external interrupt (ei) external interrupt (ei) is requested from internal peripheral i/os managed by the interrupt controller. the internal interrupt controller manages these interrupts by assigning each one of eight priority levels including an interrupt-disabled state. 4.2.3 trap traps are software interrupts which are generated by executing the trap instruction. sixteen distinct vector addresses are provided corresponding to trap instruction operands 0-15. 4 4-4 32170/32174 group user's manual (rev. 2.1) 4.3 eit processing procedure eit processing consists of two parts, one in which they are handled automatically by hardware, and one in which they are handled by user-created programs (eit handlers). the procedure for processing eits when accepted, except for a rest interrupt, is shown below. figure 4.3.1 outline of eit processing procedure instruction a instruction b instruction c pc bpc psw (b)psw eit vector entry eit handlers except for sbi rte instruc- tion instruction c instruction d program suspended eit request accepted instruction processing- canceled type (rie, ae) instruction processing -completed type (ei, trap) program execution restarted eit request generated hardware preprocessing bpc, (b)psw, and general-purpose registers saved to stack branch instruc -tion general-purpose registers, (b)psw, and bpc restored from stack sbi (system break interrupt processing) hardware postprocessing (sbi) program terminated or system is reset user-created eit handler (b)psw psw bpc pc processing by handler note: (b)psw denotes the bpsw field of the psw register. eit 4.3 eit processing procedure 4 4-5 32170/32174 group user's manual (rev. 2.1) when an eit is accepted, the m32r/ecu saves the pc and psw (as will be described later) and branches to the eit vector. the eit vector has an entry address assigned for each eit. this is where the bra (branch) instruction (note that these are not branch address) for the eit handler is written. in the m32r/ecu's hardware preprocessing, only the contents of the pc and psw registers are transferred to the backup registers (bpc register and the bpsw field of the psw register), and no other operations are performed. therefore, please make sure the bpc register, the psw register (including the bpsw field), and the general-purpose registers to be used in the eit handler are saved to the stack by the eit handler you write. (remember that these registers must be saved to the stack in a program by the user.) when processing by the eit handler is completed, restore the saved registers from the stack and finally execute the "rte" instruction. control is thereby returned from eit processing to the program that was being executed when the eit occurred. (this does not apply to the system break interrupt, however.) in the m32r/ecu's hardware postprocessing, the contents of the backup registers (bpc register and the bpsw field of the psw register) are moved back to the pc and psw registers. eit 4.3 eit processing procedure 4 4-6 32170/32174 group user's manual (rev. 2.1) 4.4 eit processing mechanism the m32r/ecu's eit processing mechanism consists of the m32r cpu core and the interrupt controller for internal peripheral i/os. it also has the backup registers for the pc and psw (bpc register and the bpsw field of the psw register). the m32r/ecu's internal eit processing mechanism is shown below. figure 4.4.1 the m32r/ecu's eit processing mechanism interrupt controller (icu) sbi ei internal peripheral i/o reset ri ae, rie, trap ie flag (psw) m32r cpu core sbi low high priority sbi ei ri m32r/ecu psw register psw bpsw bpc register pc register eit 4.4 eit processing mechanism 4 4-7 32170/32174 group user's manual (rev. 2.1) 4.5 acceptance of eit event when an eit event occurs, the m32r/ecu suspends the program it has hitherto been executing and branches to eit processing by the relevant handler. conditions under which each eit event occurs and the timing at which they are accepted are shown below. table 4.5.1 acceptance of eit events eit event type of processing acceptance timing values set in bpc register reserved instruction instruction processing - during instruction pc value of the instruction exception (rie) canceled type execution which generated rie address exception (ae) instruction processing - during instruction pc value of the instruction canceled type execution which generated ae reset interrupt (ri) instruction processing- each machine cycle indeterminate value aborted type system break instruction processing- break in instructions pc value of the next instruction interrupt (sbi) completed type (only word boundaries) external interrupt (ei) instruction processing- break in instructions pc value of the next instruction completed type (only word boundaries) trap (trap) instruction processing- break in instructions pc value of trap completed type instruction + 4 eit 4.5 acceptance of eit events 4 4-8 32170/32174 group user's manual (rev. 2.1) 4.6 saving and restoring the pc and psw the following describes operation of the m32r at the time when it accepts an eit and when it executes the "rte" instruction. (1) hardware preprocessing when an eit is accepted (a) save the sm, ie, and c bits of the psw register bsm sm bie ie bc c (b) update the sm, ie, and c bits of the psw register sm remains unchanged (rie, ae, trap) or set to 0 (sbi, ei, ri) ie set to 0 c set to 0 (c) save the pc register bpc pc (d) set the vector address in the pc register branches to the eit vector and executes the branch instruction ("bra" instruction) written in it, thereby transferring control to the user-created eit handler. (2) hardware postprocessing when the "rte" instruction is executed (e) restore the sm, ie, and c bits of the psw register from their backup bits. sm bsm ie bie c bc (f) restore the value of the pc register from the bpc register pc bpc note: the value of the bpc register and those of the bsm, bie, and bc bits of the psw register after execution of the "rte" instruction are indeterminate. eit 4.6 saving and restoring the pc and psw 4 4-9 32170/32174 group user's manual (rev. 2.1) figure 4.6.1 saving and restoring the pc and psw 16 17 23 24 25 31(lsb) 15 8 7 0(msb) sm ie c bc bsm bie 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 psw bpsw field psw field eit 4.6 saving and restoring the pc and psw psw bpc pc when accepting an eit when executing the rte instruction (b) (d) (a) save the sm, ie, and c bits (b) update the sm, ie, and c bits sm unchanged/0 (c) save the pc (d) set the vector address in the pc pc vector address (f) restore the bpc value into the pc after executing the rte instruction, the value of the bpc is indeterminate. (e) restore the bsm, bie, and bc bits after executing the rte instruction, the values of the bsm, bie, and bc bits are indeterminate. bsm bie bc sm ie c ie c 0 0 bpc pc sm ie c bsm bie bc (c) (a) (f) (e) 4 4-10 32170/32174 group user's manual (rev. 2.1) 4.7 eit vector entry the eit vector entry is located in the user space starting from address h'0000 0000. the table below lists the eit vector entry. table 4.7.1 eit vector entry note 1: during boot mode, this vector address is moved to the beginning of the boot rom (address h'8000 0000). for details, refer to section 6.5, "programming of internal flash memory." note 2: during flash e/w enable mode, this vector address is moved to the beginning of the internal ram (address h'0080 4000). for details, refer to section 6.5, "programming of internal flash memory." name abbreviation vector address sm ie bpc reset interrupt ri h'0000 0000 (note 1) 0 0 indeterminate system break interrupt sbi h'0000 0010 0 0 pc of the next instruction reserved instruction rie h'0000 0020 indeterminate 0 pc of the instruction that exception generated eit address exception ae h'0000 0030 indeterminate 0 pc of the instruction that generated rie trap trap0 h'0000 0040 indeterminate 0 pc of trap instruction + 4 trap1 h'0000 0044 indeterminate 0 pc of trap instruction + 4 trap2 h'0000 0048 indeterminate 0 pc of trap instruction + 4 trap3 h'0000 004c indeterminate 0 pc of trap instruction + 4 trap4 h'0000 0050 indeterminate 0 pc of trap instruction + 4 trap5 h'0000 0054 indeterminate 0 pc of trap instruction + 4 trap6 h'0000 0058 indeterminate 0 pc of trap instruction + 4 trap7 h'0000 005c indeterminate 0 pc of trap instruction + 4 trap8 h'0000 0060 indeterminate 0 pc of trap instruction + 4 trap9 h'0000 0064 indeterminate 0 pc of trap instruction + 4 trap10 h'0000 0068 indeterminate 0 pc of trap instruction + 4 trap11 h'0000 006c indeterminate 0 pc of trap instruction + 4 trap12 h'0000 0070 indeterminate 0 pc of trap instruction + 4 trap13 h'0000 0074 indeterminate 0 pc of trap instruction + 4 trap14 h'0000 0078 indeterminate 0 pc of trap instruction + 4 trap15 h'0000 007c indeterminate 0 pc of trap instruction + 4 external interrupt ei h'0000 0080 (note 2) 0 0 pc of the next instruction eit 4.7 eit vector entry 4 4-11 32170/32174 group user's manual (rev. 2.1) 4.8 exception processing 4.8.1 reserved instruction exception (rie) [occurrence conditions] reserved instruction exception (rie) is generated when execution of a reserved instruction (unimplemented instruction) is detected. instruction check is performed on the op-code part of the instruction. when a reserved instruction exception occurs, the instruction which generated it is not executed. if an external interrupt is requested at the same time a reserved instruction exception is detected, it is the reserved instruction exception that is accepted. [eit processing] (1) saving sm, ie, and c bits the sm, ie, and c bits of the psw register are saved to their backup bits the bsm, bie, and bc bits. bsm sm bie ie bc c (2) updating sm, ie, and c bits the sm, ie, and c bits of the psw register are updated as shown below. sm unchanged bie 0 bc 0 (3) saving pc the pc value of the instruction that generated the reserved instruction exception is set in the bpc register. for example, if the instruction that generated the reserved instruction exception is at address 4, the value 4 is set in the bpc register. similarly, if the instruction is at address 6, the value 6 is set in the bpc register. in this case, the value of the bpc register bit 30 indicates whether the instruction that generated the reserved instruction exception resides on a word boundary (bpc[30] = 0) or not on a word boundary (bpc[30] = 1). however, in either case of the above, the address to which the "rte" instruction returns after completion of processing by the eit handler is address 4. (this is because the two low-order bits are cleared to "00" when returning to the pc.) eit 4.8 exception processing 4 4-12 32170/32174 group user's manual (rev. 2.1) figure 4.8.1 example of a return address for reserved instruction exception (rie) (4) branching to the eit vector entry control branches to the address h'0000 0020 in the user space. this is the last operation performed in hardware preprocessing by the m32r/ecu. (5) jumping from the eit vector entry to the user-created handler the m32r/ecu executes the "bra" instruction written at address h'0000 0020 of the eit vector entry by the user to jump to the start address of the user-created handler. at the beginning of the eit handler you created, first save the bpc and psw registers and the necessary general-purpose registers to the stack. (6) returning from the eit handler at the end of the eit handler, restore the general-purpose registers and the bpc and psw registers from the stack and then execute the "rte" instruction. as you execute the "rte" instruction, hardware postprocessing is automatically performed by the m32r/ecu. h?00 address rie occurred h?04 h?08 h?0c +0 +1 +2 +3 h?00 address rie occurred h?04 h?08 h?0c +0 +1 +2 +3 return address return address bpc h?06 bpc h?04 eit 4.8 exception processing 4 4-13 32170/32174 group user's manual (rev. 2.1) 4.8.2 address exception (ae) [occurrence conditions] address exception (ae) is generated when an attempt is made to access a misaligned address in load or store instructions. the following lists the combination of instructions and accessed addresses that may cause address exceptions to occur: when the ldh, lduh, or sth instruction accesssed an address whose two low-order bits are "01" or "11" when the ld, st, lock, or unlock instruction accessed an address whose two low-order bits are "01," "10," or "11" when an address exception occurs, memory access by the instruction that generated the exception is not performed. if an external interrupt is requested at the same time an address exception is detected, it is the address exception that is accepted. [eit processing] (1) saving sm, ie, and c bits the sm, ie, and c bits of the psw register are saved to their backup bits the bsm, bie, and bc bits. bsm sm bie ie bc c (2) updating sm, ie, and c bits the sm, ie, and c bits of the psw register are updated as shown below. sm unchanged ie 0 c 0 (3) saving pc the pc value of the instruction that generated the address exception is set in the bpc register. for example, if the instruction that generated the address exception is at address 4, the value 4 is set in the bpc register. similarly, if the instruction is at address 6, the value 6 is set in the bpc register. in this case, the value of the bpc register bit 30 indicates whether the instruction that generated the address exception resides on a word boundary (bpc[30] = 0) or not on a word boundary (bpc[30] = 1). however, in either case of the above, the address to which the "rte" instruction returns after completion of processing by the eit handler is address 4. (this is because the two low-order bits are cleared to "00" when returning to the pc.) eit 4.8 exception processing 4 4-14 32170/32174 group user's manual (rev. 2.1) figure 4.8.2 example of a return address for address exception (ae) (4) branching to the eit vector entry control branches to the address h'0000 0030 in the user space. this is the last operation performed in hardware preprocessing by the m32r/ecu. (5) jumping from the eit vector entry to the user-created handler the m32r/ecu executes the "bra" instruction written at address h'0000 0030 of the eit vector entry by the user to jump to the start address of the user-created handler. at the beginning of the eit handler you created, first save the bpc and psw registers and the necessary general-purpose registers to the stack. (6) returning from the eit handler at the end of the eit handler, restore the general-purpose registers and the bpc and psw registers from the stack and then execute the "rte" instruction. as you execute the "rte" instruction, hardware postprocessing is automatically performed by the m32r/ecu. h ? 00 address ae occurred h ? 04 h ? 08 h ? 0c +0 +1 +2 +3 h ? 00 address ae occurred h ? 04 h ? 08 h ? 0c +0 +1 +2 +3 return address return address bpc h ? 06 bpc h ? 04 eit 4.8 exception processing 4 4-15 32170/32174 group user's manual (rev. 2.1) 4.9 interrupt processing 4.9.1 reset interrupt (ri) [occurrence conditions] ____________ reset interrupt (ri) is unconditionally accepted in any machine cycle by pulling the reset input signal low. the reset interrupt is assigned the highest priority among all eits. [eit processing] (1) initializing sm, ie, and c bits the sm, ie, and c bits of the psw register are initialized in the manner shown below. for the reset interrupt, the values of bsm, bie, and bc bits are indeterminate. sm 0 ie 0 c 0 (2) branching to the eit vector entry control branches to the address h'0000 0000 in the user space. however, when operating in boot mode, control goes to the beginning of the boot rom (address h'8000 0000). for details, refer to section 6.5, "programming of internal flash memory." (3) jumping from the eit vector entry to the user program the m32r/ecu executes the instruction written at address h'0000 0000 of the eit vector entry by the user. in the reset vector entry, be sure to initialize the psw and spi registers before jumping to the start address of the program you created. eit 4.9 interrupt processing 4 4-16 32170/32174 group user's manual (rev. 2.1) 4.9.2 system break interrupt (sbi) system break interrupt (sbi) is an emergency interrupt which is used when power outage is detected or a fault condition is notified by an external watchdog timer. the system break interrupt cannot be masked by the psw register ie bit. therefore, the system break interrupt can only be used when some fatal event has already occurred to the system when the interrupt is detected. also, this interrupt must be used on condition that after processing by the sbi handler, control will not return to the program that was being executed when the system break interrupt occurred. [occurrence conditions] _______ a system break interrupt is accepted by a falling edge on sbi input pin. (the system break interrupt cannot be masked by the psw register ie bit.) in no case will a system break interrupt be activated immediately after executing a 16-bit instruction that starts from a word boundary. (for 16-bit branch instructions, however, the interrupt may be accepted immediately after branching.) figure 4.9.1 timing at which system break interrupt (sbi) is accepted 16-bit instruction order in which instructions are executed address 1000 interrupt may be accepted interrupt cannot be accepted address 1002 address 1004 address 1008 16-bit instruction 32-bit instruction interrupt may be accepted interrupt may be accepted eit 4.9 interrupt processing 4 4-17 32170/32174 group user's manual (rev. 2.1) [eit processing] (1) saving sm, ie, and c bits the sm, ie, and c bits of the psw register are saved to their backup bits-the bsm, bie, and bc bits. bsm sm bie ie bc c (2) updating sm, ie, and c bits the sm, ie, and c bits of the psw register are updated as shown below. sm 0 ie 0 c 0 (3) saving pc the content (always word boundary) of the pc register is saved to the bpc register. (4) branching to the eit vector entry control branches to the address h'0000 0010 in the user space. this is the last operation performed in hardware preprocessing by the m32r/ecu. (5) jumping from the eit vector entry to the user-created handler the m32r/ecu executes the "bra" instruction written at address h'0000 0010 of the eit vector entry by the user to jump to the start address of the user-created handler. the system break interrupt can only be used when some fatal event has occurred to the system. also, this interrupt must be used on condition that after processing by the sbi handler, control will not return to the program that was being executed when the system break interrupt occurred. eit 4.9 interrupt processing 4 4-18 32170/32174 group user's manual (rev. 2.1) 4.9.3 external interrupt (ei) an external interrupt is generated upon an interrupt request which is output by the internal interrupt controller. the interrupt controller manages interrupt requests by assigning each one of seven priority levels. for details, refer to chapter 5, "interrupt controller." for details about the interrupt sources, refer to each section in which the relevant internal peripheral i/o is described. [occurrence conditions] external interrupts are managed based on interrupt requests from each internal peripheral i/o by the internal interrupt controller. these interrupt requests are notified to the m32r cpu by the interrupt controller. the m32r/ecu checks these interrupt requests at a break in instructions residing on word boundaries, and when an interrupt request is detected and the psw register ie flag = 1, accepts it as an external interrupt. in no case will an external interrupt be activated immediately after executing a 16-bit instruction that starts from a word boundary. (for 16-bit branch instructions, however, the interrupt may be accepted immediately after branching.) figure 4.9.2 timing at which external interrupt (ei) is accepted 16-bit instruction order in which instructions are executed address 1000 interrupt may be accepted interrupt cannot be accepted address 1002 address 1004 address 1008 16-bit instruction 32-bit instruction interrupt may be accepted interrupt may be accepted eit 4.9 interrupt processing 4 4-19 32170/32174 group user's manual (rev. 2.1) [eit processing] (1) saving sm, ie, and c bits the sm, ie, and c bits of the psw register are saved to their backup bits the bsm, bie, and bc bits. bsm sm bie ie bc c (2) updating sm, ie, and c bits the sm, ie, and c bits of the psw register are updated as shown below. sm 0 ie 0 c 0 (3) saving pc the content (always word boundary) of the pc register is saved to the bpc register. (4) branching to the eit vector entry control branches to the address h'0000 0080 in the user space. however, when operating in flash e/w enable mode, control goes to the beginning of the internal ram (address h'0080 4000). (for details, refer to section 6.5, "programming of internal flash memory.") this is the last operation performed in hardware preprocessing by the m32r/ecu. (5) jumping from the eit vector entry to the user-created handler the m32r/ecu executes the "bra" instruction written at address h'0000 0080 of the eit vector entry by the user to jump to the start address of the user-created handler. at the beginning of the eit handler you created, first save the bpc and psw registers and the necessary general-purpose registers to the stack. (6) returning from the eit handler at the end of the eit handler, restore the general-purpose registers and the bpc and psw registers from the stack and then execute the "rte" instruction. as you execute the "rte" instruction, hardware postprocessing is automatically performed by the m32r/ecu. eit 4.9 interrupt processing 4 4-20 32170/32174 group user's manual (rev. 2.1) 4.10 trap processing 4.10.1 trap (trap) [occurrence conditions] traps refer to software interrupts which are generated by executing the "trap" instruction. sixteen distinct traps are generated, each corresponding to one of "trap" instruction operands 0-15. accordingly, sixteen vector entries are provided. [eit processing] (1) saving sm, ie, and c bits the sm, ie, and c bits of the psw register are saved to their backup bits the bsm, bie, and bc bits. bsm sm bie ie bc c (2) updating sm, ie, and c bits the sm, ie, and c bits of the psw register are updated as shown below. unchanged sm 0 ie 0 c 0 (3) saving pc when the trap instruction is executed, the "pc value of the trap instruction + 4" is set in the bpc register. for example, if the "trap" instruction is located at address 4, the value h'08 is set in the bpc register. similarly, if the instruction is located at address 6, the value h'0a is set in the bpc register. in this case, the value of the bpc register bit 30 indicates whether the trap instruction resides on a word boundary (bpc[30] = 0) or not on a word boundary (bpc[30] = 1). however, in either case of the above, the address to which the "rte" instruction returns after completion of processing by the eit handler is address 8. (this is because the two low-order bits are cleared to "00" when returning to the pc.) normally, when the program has been written in assembler, the halfword that immediately follows the "trap" instruction placed at a word boundary has the "nop" instruction automatically inserted by the assembler. eit 4.10 trap processing 4 4-21 32170/32174 group user's manual (rev. 2.1) figure 4.10.1 example of a return address for trap (trap) (4) branching to the eit vector entry control branches to the addresses h'0000 0040 through h'0000 007c in the user space. this is the last operation performed in hardware preprocessing by the m32r/ecu. (5) jumping from the eit vector entry to the user-created handler the m32r/ecu executes the "bra" instruction written at addresses h'0000 0040 through h'0000 007c of the eit vector entry by the user to jump to the start address of the user- created handler. at the beginning of the eit handler you created, first save the bpc and psw registers and the necessary general-purpose registers to the stack. (6) returning from the eit handler at the end of the eit handler, restore the general-purpose registers and the bpc and psw registers from the stack and then execute the "rte" instruction. as you execute the "rte" instruction, hardware postprocessing is automatically performed by the m32r/ecu. h ? 00 h ? 04 h ? 08 h ? 0c +0 +1 +2 +3 h ? 00 h ? 04 h ? 08 h ? 0c +0 +1 +2 +3 bpc h ? 0a bpc h ? 08 address trap occurred return address return address address trap occurred eit 4.10 trap processing 4 4-22 32170/32174 group user's manual (rev. 2.1) 4.11 eit priority levels the table below lists the priority levels of eit events. when multiple eits occur simultaneously, the event with the highest priority is accepted first. table 4.11.1 priority of eit events and how returned from eit note that for external interrupt (ei), the priority levels of interrupt requests from each peripheral i/o are set by the internal interrupt controller. for details, refer to chapter 5, "interrupt controller." priorityeit event type of processing values set in bpc register 1(highest) reset interrupt (ri) instruction processing indeterminate -aborted type address exception (ae) instruction processing- pc of the instruction that canceled type generated ae 2 reserved instruction instruction processing- pc of the instruction that exception (rie) canceled type generated ae trap (trap) instruction processing- trap instruction + 4 completed type 3 system break instruction processing- pc of the next instruction interrupt (sbi) completed type 4 external interrupt (ei) instruction processing- pc of the next instruction completed type eit 4.11 eit priority levels 4 4-23 32170/32174 group user's manual (rev. 2.1) 4.12 example of eit processing (1) when rie, ae, sbi, ei, or trap occurs singly figure 4.12.1 processing of events when rie, ae, sbi, ei, or trap occurs singly (2) when rie, ae, or trap and ei occurs simultaneously figure 4.12.2 processing of events when rie, ae, or trap and ei occurs simultaneously rte instruction ie=0 ie=1 bpc register = return address a ie=1 rie, ae, sbi, ei, or trap occurrs singly return address a: if ie = 0, no events but reset and sbi are accepted :eit handler rie, ae, or trap is accepted first bpc register = return address a rie, ae, or trap and ei occurs simultaneously ei is accepted next bpc register = return address a rte instruction ie=0 ie=1 ie=1 return address a: :eit handler ie=0 ie=1 rte instruction eit 4.12 example of eit processing 4 4-24 32170/32174 group user's manual (rev. 2.1) bra instruction rte eit handler eit vector entry program being executed save bpc to stack save psw to stack save general-purpose registers to stack processing by eit handler restore general- purpose registers restore psw restore bpc eit event occurs (sbi) system break interrupt processing program terminated or system reset (any event other than sbi) pc bpc psw (b)psw hardware preprocessing hardware postprocessing (b)psw psw bpc pc eit 4.12 example of eit processing figure 4.12.3 example of eit processing 4 4-25 32170/32174 group user's manual (rev. 2.1) 4.13 precautions on eit address exception requires caution because when an address exception occurs pursuant to execution of an instruction (one of the following three) that uses the register indirect + register update addressing mode, the value of the automatically updated register (rsrc or rsrc2) becomes indeterminate. except that the values of rsrc and rsrc2 are indeterminate, the behavior is the same as when using other addressing modes. applicable instructions ld rdest, @rsrc+ st rsrc1, @-rsrc2 st rsrc1, @+rsrc2 if the above applies, because the register value becomes indeterminate as explained, consideration must be taken before continuing with system processing. (if an address exception occurs, it means that some fatal fault already occurred in the system at that point in time. therefore, use eit on condition that after processing by the address exception handler, the cpu will not return to the program it was executing when the exception occurred.) eit 4.13 precautions on eit 4 4-26 32170/32174 group user's manual (rev. 2.1) ? this is a blank page. ? chapter 5 chapter 5 interrupt controller (icu) 5.1 outline of interrupt controller (icu) 5.2 interrupt sources of internal peripheral i/os 5.3 icu-related registers 5.4 icu vector table 5.5 description of interrupt operation 5.6 description of system break interrupt (sbi) operation 5 5-2 32170/32174 group user's manual (rev. 2.1) interrupt controller (icu) 5.1 outline of the interrupt controller (icu) 5.1 outline of interrupt controller (icu) the interrupt controller (icu) manages maskable interrupts from internal peripheral i/os and a system break interrupt (sbi). the maskable interrupts from internal peripheral i/os are notified to the m32r cpu as external interrupts (ei). there are a total of 31 interrupt sources for the maskable interrupts from internal peripheral i/os, which are managed by assigning them one of eight priority levels including an interrupt-disabled state. when multiple interrupt requests of the same priority level occur simultaneously, their priorities are resolved by predetermined hardware priority. the source of an interrupt request generated in internal peripheral i/os is identified by reading the relevant interrupt status register provided for internal peripheral i/os. on the other hand, the system break interrupt (sbi) is recognized when a low-going transition _______ occurs on the sbi signal input pin. this interrupt is used for emergency purposes such as when power outage is detected or a fault condition is notified by an external watchdog timer, so that it is always accepted irrespective of the psw register ie bit status. when the icu has finished servicing an sbi, terminate or reset the system without returning to the program that was being executed when the interrupt occurred. specifications of the interrupt controller are outlined in the table below. table 5.1.1 outline of interrupt controller (icu) item specification interrupt source maskable interrupt from internal peripheral i/o : 31 sources system break interrupt ___ : 1 source (entered from sbi pin) level management eight levels including an interrupt-disabled state (however, interrupts of the same level have their priorities resolved by fixed hardware priority.) 5 5-3 32170/32174 group user's manual (rev. 2.1) interrupt controller (icu) 5.1 outline of the interrupt controller (icu) figure 5.1.1 block diagram of the interrupt controller interrupt vector register( ivect) interrupt mask register (imask) new_imask maskable interrupt request generated priority resolution by fixed hardware priority imask compar- ed ilevel priority resolution by interrupt priority levels set . . . . . . . system break interrupt request generated sbi ei sbi interrupt controller interrupt control register sbi control register (sbicr) sbireq ireq ireq ireq ireq ireq ireq peripheral circuits edge- recognized interrupt control circuit level- recognized interrupt request interrupt request interrupt request to the cpu core . . . . . . . . . edge- recognized edge- recognized level- recognized level- recognized interrupt control circuit interrupt control circuit to the cpu core 5 5-4 32170/32174 group user's manual (rev. 2.1) 5.2 interrupt sources of internal peripheral i/os the interrupt controller receives as its inputs the interrupt requests from mjt (multijunction timer), dmac, serial i/o, a-d converter, rtd, and can. for details about these interrupts, refer to each section in which the relevant internal peripheral i/o is described. table 5.2.1 interrupt sources of internal peripheral i/os (1/2) interrupt cause contents number of input icu type of input sources source(note) a-d0 conversion interrupt 1 edge-recognized a-d1 conversion interrupt 1 edge-recognized sio0 transmit interrupt 1 edge-recognized sio0 receive interrupt 1 edge-recognized sio1transmit interrupt 1 edge-recognized sio1 receive interrupt 1 edge-recognized sio2,3 transmit/receive 4 level-recognized interrupt sio4,5 transmit/receive 4 level-recognized interrupt tid0 output interrupt 1 edge-recognized tid1 output interrupt 1 edge-recognized tid2 output interrupt 1 edge-recognized tod0 output interrupt 8 level-recognized tod1 + tom0 output 16 level-recognized interrupt tml1 input interrupt 4 level-recognized rtd interrupt 1 edge-recognized dma transfer interrupt 0 5 level-recognized dma transfer interrupt 1 5 level-recognized can0 transmit/receive 5 level-recognized & error interrupt note: icu type of input source edge-recognized: interrupt requests are generated on a falling edge of the interrupt signal applied to the icu. level-recognized: interrupt requests are generated when the interrupt signal applied to the icu is held low. for these level-recognized interrupts, the icu's interrupt control register irq bit cannot be set or cleared in software. single-shot conversion in a-d0 converter scan mode completed, single mode completed, or comparator mode completed single-shot conversion in a-d1 converter scan mode completed, single mode completed, or comparator mode completed sio0 transmit buffer empty interrupt sio0 reception completed or receive error interrupt sio1 transmit buffer empty interrupt sio1 reception completed or receive error interrupt sio2, 3 reception completed or receive error interrupt transmit buffer empty interrupt sio4, 5 reception completed or receive error interrupt transmit buffer empty interrupt tid0 output tid1 output tid2 output tod0_0 to tod0_7 output tod1_0 to tod1_7 output + tom0_0 to tom0_7 output tml1 input (tin30 to tin33 input) rtd interrupt generation command dma0-4 transfer completed dma5-9 transfer completed can0 transmission completed, can0 reception completed, can0 error passive, can0 error bus-off, can0 bus error interrupt controller (icu) 5.2 interrupt sources of internal peripheral i/os 5 5-5 32170/32174 group user's manual (rev. 2.1) table 5.2.2 interrupt sources of internal peripheral i/os (2/2) interrupt source content number of input icu type of input sources source (note) mjt output interrupt 7 mjt output interrupt group 7 (tms0, tms1 output) 2 level-recognized mjt output interrupt 6 mjt output interrupt group 6 (top8, top9 output) 2 level-recognized mjt output interrupt 5 mjt output interrupt group 5 (top10 output) 1 edge-recognized mjt output interrupt 4 mjt output interrupt group 4 (tio4 - tio7 output) 4 level-recognized mjt output interrupt 3 mjt output interrupt group 3 (tio8, tio9 output) 2 level-recognized mjt output interrupt 2 mjt output interrupt group 2 (top0 - top5 output) 6 level-recognized mjt output interrupt 1 mjt output interrupt group 1 (top6, top7 output) 2 level-recognized mjt output interrupt 0 mjt output interrupt group 0 (tio0 - tio3 output) 4 level-recognized mjt input interrupt 4 mjt input interrupt group 4 (tin3-tin6 input) 4 level-recognized mjt input interrupt 3 mjt input interrupt group 3 (tin20-tin23 input) 4 level-recognized mjt input interrupt 2 mjt input interrupt group 2 (tin12-tin19 input) 8 level-recognized mjt input interrupt 1 mjt input interrupt group 1 (tin0-tin2 input) 3 level-recognized mjt input interrupt 0 mjt input interrupt group 0 (tin7-tin11 input) 5 level-recognized note: icu type of input source edge-recognized: interrupt requests are generated on a falling edge of the interrupt signal applied to the icu. level-recognized: interrupt requests are generated when the interrupt signal applied to the icu is held low. for these level-recognized interrupts, the icu's interrupt control register irq bit cannot be set or cleared in software. interrupt controller (icu) 5.2 interrupt sources of internal peripheral i/os 5 5-6 32170/32174 group user's manual (rev. 2.1) 5.3 icu-related registers the diagram below shows a map of the interrupt controller (icu)'s related registers. figure 5.3.1 interrupt controller (icu) related register map interrupt controller (icu) 5.3 icu-related registers h?0080 0000 address d0 d7 +0 address +1 address d8 d15 h?0080 0004 h?0080 0006 h?0080 0066 h?0080 0068 interrupt mask register (imask) sbi control register (sbicr) h?0080 006a h?0080 006c h?0080 006e h?0080 0070 h?0080 0072 h?0080 0074 h?0080 0076 h?0080 0078 h?0080 0002 h?0080 007a h?0080 007c h?0080 007e a-d0 conversion interrupt control register (iad0ccr) sio0 receive interrupt control register (isio0rxcr) sio1 receive interrupt control register (isio1rxcr) sio1 transmit interrupt control register (isio1txcr) sio0 transmit interrupt control register (isio0txcr) dma0-4 interrupt control register (idma04cr) mjt output interrupt control register 0 (imjtocr0) mjt output interrupt control register 2 (imjtocr2) mjt output interrupt control register 4 (imjtocr4) mjt output interrupt control register (imjtocr6) mjt output interrupt control register (imjtocr1) mjt output interrupt control register 3 (imjtocr3) mjt output interrupt control register5 (imjtocr5) mjt output interrupt control register7 (imjtocr7) mjt input interrupt control register 0 (imjticr0) mjt input interrupt control register 1 (imjticr1) mjt input interrupt control register 2 (imjticr2) mjt input interrupt control register 3 (imjticr3) mjt input interrupt control register 4 (imjticr4) tid1 output interrupt control register (itid1cr) sio2,3 transmit/receive interrupt control register (isio23cr) rtd interrupt control register (irtdcr) dma5-9 interrupt control register (idma59cr) tod0 output interrupt control register (itod0cr) tid0 output interrupt control register (itid0cr) interrupt vector register (ivect) note: the re g isters in the thick frames must alwa y s be accessed in halfwords. h?0080 0060 can0 transmit/receive & error interrupt control register (ican0cr) tml1 input interrupt control register (itml1cr) h?0080 0062 tid2 output interrupt control register (itid2cr) a-d1 conversion interrupt control register (iad1ccr) h?0080 0064 sio4,5 transmit/receive interrupt control register (isio45cr) tod1+tom0 output interrupt control register (itom0cr) blank addresses are reserved for future use. 5 5-7 32170/32174 group user's manual (rev. 2.1) 5.3.1 interrupt vector register interrupt vector register (ivect) 5 5-8 32170/32174 group user's manual (rev. 2.1) 5.3.2 interrupt mask register interrupt mask register (imask) 5 5-9 32170/32174 group user's manual (rev. 2.1) 5.3.3 sbi (system break interrupt) control register sbi (system break interrupt) control register 5 5-10 32170/32174 group user's manual (rev. 2.1) 5.3.4 interrupt control registers can0 transmit/receive & error interrupt control register (ican0cr) 5 5-11 32170/32174 group user's manual (rev. 2.1) w= : can be set and cleared only when the type of input source is "edge-recognized" type (with only one interrupt source being input). (1) ireq (interrupt request) bit (d3 or d11) when an interrupt request from some internal peripheral i/o occurs, the corresponding ireq (interrupt request) bit is set to 1. this bit can be set and cleared in software for only edge-recognized interrupt sources (and not for level-recognized interrupt sources). also, when the ireq bit is set by an interrupt request generated by an edge-recognized interrupt source, it is automatically cleared to 0 by reading out the interrupt vector register (ivect) (not cleared in the case of level-recognized interrupt sources). if the ireq bit is cleared in software at the same time it is set by an interrupt request generated, clearing in software has priority. also, if the ireq bit is cleared by reading out the ivect register at the same time it is set by an interrupt request generated, clearing by a read of ivect has priority. 5 5-12 32170/32174 group user's manual (rev. 2.1) figure 5.3.2 interrupt control register configuration (edge-recognized type) figure 5.3.3 interrupt control register configuration (level-recognized type) interrupt controller (icu) 5.3 icu-related registers interrupt priority resolving circuit interrupt request from each peripheral function interrupt enabled ilevel (levels 0-7) d3,11 data bus d5-7,13-15 3 f/f set set/clear ireq d3,11 d5-7,13-15 rd 3 ireq group interrupt interrupt priority resolving circuit group interrupt request from each peripheral function interrupt enabled ilevel (levels 0-7) data bus read-only circuit 5 5-13 32170/32174 group user's manual (rev. 2.1) (2) ilevel (interrupt priority level) (d5-d7 or d13-d15) these bits set the priority levels of interrupt requests from each internal peripheral i/o. set priority level 7 to disable interrupts from some internal peripheral i/o or priority levels 0-6 to enable interrupts. when an interrupt occurs, the interrupt controller resolves priority between this interrupt and other interrupt sources based on ilevel settings and finally compares its priority with the imask value to determine whether to forward an ei request to the cpu or keep it pending. the table below shows the relationship between ilevel settings and the imask values at which interrupts are accepted. table 5.3.1 ilevel settings and accepted imask values ilevel values set imask values at which interrupts are accepted 0 (ilevel="000") accepted when imask is 1-7 1 (ilevel="001") accepted when imask is 2-7 2 (ilevel="010") accepted when imask is 3-7 3 (ilevel="011") accepted when imask is 4-7 4 (ilevel="100") accepted when imask is 5-7 5 (ilevel="101") accepted when imask is 6-7 6 (ilevel="110") accepted when imask is 7 7 (ilevel="111") not accepted (interrupts disabled) interrupt controller (icu) 5.3 icu-related registers 5 5-14 32170/32174 group user's manual (rev. 2.1) 5.4 icu vector table the icu vector table is used to set the start addresses of interrupt handlers for each internal peripheral i/o. the 31-source interrupts are assigned the following addresses: table 5.4.1 icu vector table addresses interrupt source icu vector table address mjt input interrupt 4 h'0000 0094-h'0000 0097 mjt input interrupt 3 h'0000 0098-h'0000 009b mjt input interrupt 2 h'0000 009c-h'0000 009f mjt input interrupt 1 h'0000 00a0-h'0000 00a3 mjt input interrupt 0 h'0000 00a4-h'0000 00a7 mjt output interrupt 7 h'0000 00a8-h'0000 00ab mjt output interrupt 6 h'0000 00ac-h'0000 00af mjt output interrupt 5 h'0000 00b0-h'0000 00b3 mjt output interrupt 4 h'0000 00b4-h'0000 00b7 mjt output interrupt 3 h'0000 00b8-h'0000 00bb mjt output interrupt 2 h'0000 00bc-h'0000 00bf mjt output interrupt 1 h'0000 00c0-h'0000 00c3 mjt output interrupt 0 h'0000 00c4-h'0000 00c7 dma0-4 interrupt h'0000 00c8-h'0000 00cb sio1 receive interruptt h'0000 00cc-h'0000 00cf sio1 transmit interruptt h'0000 00d0-h'0000 00d3 sio0 receive interruptt h'0000 00d4-h'0000 00d7 sio0 transmit interruptt h'0000 00d8-h'0000 00db a-d0 converter interruptt h'0000 00dc-h'0000 00df tid0 output interruptt h'0000 00e0-h'0000 00e3 tod0 output interruptt h'0000 00e4-h'0000 00e7 dma5-9 interruptt h'0000 00e8-h'0000 00eb sio2,3 transmit/receive interrupt t h'0000 00ec-h'0000 00ef rtd interruptt h'0000 00f0-h'0000 00f3 tid1 output interrupt h'0000 00f4-h'0000 00f7 tod1+tom0 output interrupt h'0000 00f8-h'0000 00fb sio4,5 transmit/receive interrupt h'0000 00fc-h'0000 00ff a-d1 converter interrupt h'0000 0100-h'0000 0103 tid2 output interrupt h'0000 0104-h'0000 0107 tml1 input interrupt h'0000 0108-h'0000 010b can0 transmit/receive & error interrupt h'0000 010c-h'0000 010f interrupt controller (icu) 5.4 icu vector table 5 5-15 32170/32174 group user's manual (rev. 2.1) figure 5.4.1 icu vector table memory map (1/2) h'0000 0094 address d0 d7 +0 address +1 address d8 d15 h'0000 0096 mjt input interrupt 4 handler start address (a0-a15) mjt input interrupt 4 handler start address (a16-a31) h'0000 0098 h'0000 009a mjt input interrupt 3 handler start address (a0-a15) mjt input interrupt 3 handler start address (a16-a31) h'0000 009c h'0000 009e mjt input interrupt 2 handler start address (a0-a15) mjt input interrupt 2 handler start address (a16-a31) h'0000 00a0 h'0000 00a2 mjt input interrupt 1 handler start address (a0-a15) mjt input interrupt 1 handler start address (a16-a31) h'0000 00a4 h'0000 00a6 h'0000 00a8 h'0000 00aa h'0000 00ac h'0000 00ae h'0000 00b0 h'0000 00b2 h'0000 00b4 h'0000 00b6 h'0000 00b8 h'0000 00ba h'0000 00bc h'0000 00be h'0000 00c0 h'0000 00c2 h'0000 00c4 h'0000 00c6 mjt output interrupt 7 handler start address (a0-a15) mjt output interrupt 7 handler start address (a16-a31) mjt output interrupt 6 handler start address (a0-a15) mjt output interrupt 6 handler start address (a16-a31) mjt output interrupt 5 handler start address (a0-a15) mjt output interrupt 5 handler start address (a16-a31) mjt output interrupt 4 handler start address (a0-a15) mjt output interrupt 4 handler start address (a16-a31) mjt output interrupt 3 handler start address (a0-a15) mjt output interrupt 3 handler start address (a16-a31) mjt output interrupt 2 handler start address (a0-a15) mjt output interrupt 2 handler start address (a16-a31) mjt output interrupt 1 handler start address (a0-a15) mjt output interrupt 1 handler start address (a16-a31) mjt output interrupt 0 handler start address (a0-a15) mjt output interrupt 0 handler start address (a16-a31) mjt input interrupt 0 handler start address (a0-a15) mjt input interrupt 0 handler start address (a16-a31) interrupt controller (icu) 5.4 icu vector table 5 5-16 32170/32174 group user's manual (rev. 2.1) figure 5.4.2 icu vector table memory map (2/2) h'0000 00c8 address d0 d7 +0 address +1 address d8 d15 h'0000 00ca dma0-4 interrupt handler start address (a0-a15) dma0-4 interrupt handler start address (a16-a31) h'0000 00cc h'0000 00ce h'0000 00d0 h'0000 00d2 h'0000 00d4 h'0000 00d6 h'0000 00d8 h'0000 00da h'0000 00dc h'0000 00de sio1 receive interrupt handler start address (a0-a15) sio1 receive interrupt handler start address (a16-a31) sio1 transmit interrupt handler start address (a0-a15) sio1 transmit interrupt handler start address (a16-a31) sio0 receive interrupt handler start address (a0-a15) sio0 receive interrupt handler start address (a16-a31) sio0 transmit interrupt handler start address (a0-a15) sio0 transmit interrupt handler start address (a16-a31) a-d0 converter interrupt handler start address (a0-a15) a-d0 converter interrupt handler start address (a16-a31) h'0000 00e0 h'0000 00e2 h'0000 00e4 h'0000 00e6 h'0000 00e8 h'0000 00ea h'0000 00ec h'0000 00ee tid0 input interrupt handler start address (a0-a15) tid0 input interrupt handler start address (a16-a31) tod0 output interrupt handler start address (a0-a15) tod0 output interrupt handler start address (a16-a31) dma5-9 interrupt handler start address (a0-a15) dma5-9 interrupt handler start address (a16-a31) sio2,3 transmit/receive interrupt handler start address (a0-a15) sio2,3 transmit/receive interrupt handler start address (a16-a31) h'0000 00f0 h'0000 00f2 rtd interrupt handler start address (a0-a15) rtd interrupt handler start address (a16-a31) h'0000 00f4 h'0000 00f6 tid1 input interrupt handler start address (a0-a15) tid1 input interrupt handler start address (a16-a31) h'0000 00f8 h'0000 00fa tod1+tom0 output interrupt handler start address (a0-a15) tod1+tom0 output interrupt handler start address (a16-a31) h'0000 00fc h'0000 00fe sio4,5 transmit/receive interrupt handler start address (a0-a15) sio4,5 transmit/receive interrupt handler start address (a16-a31) h'0000 0100 h'0000 0102 a-d1 converter interrupt handler start address (a0-a15) a-d1 converter interrupt handler start address (a16-a31) h'0000 0104 h'0000 0106 tid2 input interrupt handler start address (a00-a15) tid2 input interrupt handler start address (a16-a31) h'0000 0108 h'0000 010a tml1 input interrupt handler start address (a00-a15) tml1 input interrupt handler start address (a16-a31) h'0000 010c h'0000 010e can0 transmit/receive & error interrupt handler start address (a0-a15) can0 transmit/receive & error interrupt handler start address (a16-a31) interrupt controller (icu) 5.4 icu vector table 5 5-17 32170/32174 group user's manual (rev. 2.1) 5.5 description of interrupt operation 5.5.1 acceptance of internal peripheral i/o interrupts an interrupt from any internal peripheral i/o is checked to see whether or not to accept by comparing its ilevel value set by the interrupt control register and the imask value of the interrupt mask register. if its priority is higher than the imask value, the interrupt is accepted. however, when multiple interrupt requests occur simultaneously, the interrupt controller resolves priority between these interrupt requests following the procedure described below. (a) the ilevel values set by the interrupt control register for each interrupt peripheral i/o are compared with each other. (b) if the ilevel values are the same, they are resolved according to the predetermined hardware priority. (c) the ilevel value is compared with imask value. when multiple interrupt requests occur simultaneously, the interrupt controller first compares their priority levels set by each interrupt control register's ilevel bit to select an interrupt request which has the highest priority. if the interrupt requests have the same level value, they are resolved according to the hardware-fixed priority. the interrupt request thus selected has its ilevel value compared with imask value and if its priority is higher than the imask value, the interrupt controller sends an ei request to the cpu. interrupt requests may be masked by setting the interrupt mask register and the interrupt control register's ilevel bit (level 7 = disabled) provided for each internal peripheral i/o and the psw register ie bit. figure 5.5.1 example of priority resolution when accepting interrupt (c) (b) (a) interrupt requested or not resolve priority according to interrupt priority levels (ilevel) resolve priority according to hardware priority compare with imask value mjt output interrupt 4 mjt output interrupt 3 mjt output interrupt 2 mjt output interrupt 1 dma0-4 interrupt a-d0 converter interrupt (ilevel settings) level 3 level 4 level 5 level 3 level 1 level 3 not requested requested requested requested requested requested hardware-fixed priority accept interrupt if psw register ie bit = 1 level 3 level 3 level 3 can be accepted when imask = 4-7 interrupt controller (icu) 5.5 description of interrupt operation 5 5-18 32170/32174 group user's manual (rev. 2.1) table 5.5.1 hardware-fixed priority levels priority interrupt source icu vector table address type of input source high mjt input interrupt 4 (irq12) h'0000 0094-h'0000 0097 level-recognized mjt input interrupt 3 (irq11) h'0000 0098-h'0000 009b level-recognized mjt input interrupt 2 (irq10) h'0000 009c-h'0000 009f level-recognized mjt input interrupt 1 (irq9) h'0000 00a0-h'0000 00a3 level-recognized mjt input interrupt 0 (irq8) h'0000 00a4-h'0000 00a7 level-recognized mjt output interrupt 7 (irq7) h'0000 00a8-h'0000 00ab level-recognized mjt output interrupt 6 (irq6) h'0000 00ac-h'0000 00af level-recognized mjt output interrupt 5 (irq5) h'0000 00b0-h'0000 00b3 edge-recognized mjt output interrupt 4 (irq4) h'0000 00b4-h'0000 00b7 level-recognized mjt output interrupt 3 (irq3) h'0000 00b8-h'0000 00bb level-recognized mjt output interrupt 2 (irq2) h'0000 00bc-h'0000 00bf level-recognized mjt output interrupt 1 (irq1) h'0000 00c0-h'0000 00c3 level-recognized mjt output interrupt 0 (irq0) h'0000 00c4-h'0000 00c7 level-recognized dma0-4 interrupt h'0000 00c8-h'0000 00cb level-recognized sio1 receive interrupt h'0000 00cc-h'0000 00cf edge-recognized sio1 transmit interrupt h'0000 00d0-h'0000 00d3 edge-recognized sio0 receive interrupt h'0000 00d4-h'0000 00d7 edge-recognized sio0 transmit interrupt h'0000 00d8-h'0000 00db edge-recognized a-d0 converter interrupt h'0000 00dc-h'0000 00df edge-recognized tid0 output interrupt h'0000 00e0-h'0000 00e3 edge-recognized tod0 output interrupt h'0000 00e4-h'0000 00e7 level-recognized dma5-9 interrupt h'0000 00e8-h'0000 00eb level-recognized sio2,3 transmit/receive interrupt h'0000 00ec-h'0000 00ef level-recognized rtd interrupt h'0000 00f0-h'0000 00f3 edge-recognized tid1 output interrupt h'0000 00f4-h'0000 00f7 edge-recognized tod1+tom0 output interrupt h'0000 00f8-h'0000 00fb level-recognized sio4,5 transmit/receive interrupt h'0000 00fc-h'0000 00ff level-recognized a-d1 converter interrupt h'0000 0100-h'0000 0103 edge-recognized tid2 output interrupt h'0000 0104-h'0000 0107 edge-recognized tml1 input interrupt h'0000 0108-h'0000 010b level-recognized low can0 transmit/receive & error interrupt h'0000 010c-h'0000 010f level-recognized interrupt controller (icu) 5.5 description of interrupt operation 5 5-19 32170/32174 group user's manual (rev. 2.1) table 5.5.2 ilevel settings and accepted imask values ilevel values set imask values at which interrupts are accepted 0 (ilevel="000") accepted when imask is 1-7 1 (ilevel="001") accepted when imask is 2-7 2 (ilevel="010") accepted when imask is 3-7 3 (ilevel="011") accepted when imask is 4-7 4 (ilevel="100") accepted when imask is 5-7 5 (ilevel="101") accepted when imask is 6-7 6 (ilevel="110") accepted when imask is 7 7 (ilevel="111") not accepted (interrupts disabled) interrupt controller (icu) 5.5 description of interrupt operation 5 5-20 32170/32174 group user's manual (rev. 2.1) 5.5.2 processing by internal peripheral i/o interrupt by handlers (1) branching to the interrupt handler upon accepting an interrupt request, the cpu branches to the eit vector entry after performing the hardware preprocessing as described in section 4.3, "eit processing procedure." the eit vector entry for external interrupt (ei) is located at the address h'0000 0080. this address is where the instruction (not the jump address itself) for branching to the beginning of the interrupt handler routine for external interrupt requests is written. (2) processing in the external interrupt (ei) handler a typical operation of the external interrupt (ei) handler (for interrupts from internal peripheral i/ o) is shown in figure 5.5.2. [1] saving each register to the stack save the bpc, psw and general-purpose registers to the stack. also, save the accumulator and fpsr register to the stack as necessary. [2] reading the interrupt request mask register (imask) and saving to the stack read the interrupt request mask register and save its content to the stack. [3] reading the interrupt vector register (ivect) read the interrupt vector register. this register holds the 16 low-order address bits of the icu vector table for the accepted interrupt request source that was stored in it when accepting an interrupt request. when the interrupt vector register is read, the following processing is automatically performed in hardware: ?the interrupt priority level of the accepted interrupt request (ilevel) is set in the imask register as a new imask value. (interrupts with lower priority levels than that of the accepted interrupt request source are masked.) ?the accepted interrupt request source is cleared (not cleared for level-recognized interrupt request sources). ?the interrupt request (ei) to the cpu core is dropped. ?the icu's internal sequencer is activated to start internal processing (interrupt priority resolution). [4] reading and overwriting the interrupt request mask register (imask) read the interrupt request mask register and overwrite it with the read value. this write to the imask register causes the following processing to be automatically performed in hardware: ?the interrupt request (ei) to the cpu core is dropped. ?the icu's internal sequencer is activated to start internal processing (interrupt priority resolution). note: ?processing in [4] here is unnecessary when multiple interrupts are to be enabled in [6] below. interrupt controller (icu) 5.5 description of interrupt operation 5 5-21 32170/32174 group user's manual (rev. 2.1) interrupt controller (icu) 5.5 description of interrupt operation [5] reading the icu vector table read the icu vector table for the accepted interrupt request source. the relevant icu vector table address can be obtained by zero-extending the content of the interrupt vector register that was read in [3] (i.e., the 16 low-order address bits of the icu vector table for the accepted interrupt request source). the icu vector table must have set in it the start address of the interrupt handler for the interrupt request source concerned.) [6] enabling multiple interrupts to enable another higher priority interrupt while processing the accepted interrupt (i.e., enabling multiple interrupts), set the psw register ie bit to "1". [7] branching to the internal peripheral i/o interrupt handler branch to the start address of the interrupt handler that was read out in [5]. [8] processing in the internal peripheral i/o interrupt handler [9] disabling interrupts clear the psw register ie bit to "0" to disable interrupts. [10] restoring the interrupt request mask register (imask) restore the interrupt request mask register that was saved to the stack in [2]. [11] restoring registers from the stack restore the registers that were saved to the stack in [1]. [12] completion of external interrupt processing execute the rte instruction to complete the external interrupt processing. the program returns to the state in which it was before the currently processed interrupt request was accepted. (3) identifying the source of the interrupt request generated if any internal peripheral i/o has two or more interrupt request sources, check the interrupt request status register provided for each internal peripheral i/o to identify the source of the interrupt request generated. (4) enabling multiple interrupts to enable multiple interrupts in the interrupt handler, set the psw register ie (interrupt enable) bit to enable interrupt requests to be accepted. however, before writing "1" to the ie bit, be sure to save each register (bpc, psw, general-purpose registers and imask) to the stack. note: ?before enabling multiple interrupts, read the interrupt vector register (ivect) and then the icu vector table, as shown in figure 5.5.2, "typical handler operation for interrupts from internal peripheral i/o." 5 5-22 32170/32174 group user's manual (rev. 2.1) note 1: for operations at eit acceptance and return from eit, also see section 4.3, "eit processing procedure." note 2: do not read the interrupt vector register (ivect) or write to the interrupt request mask register (imask) in the eit handler unless interrupts are disabled (psw register ie bit = 0). note 3: when multiple interrupts are disabled, execute processing in [4]. processing in [4] is unnecessary if multiple interrupts are enabled by executing processing in [6] and [9]. note 4: to enable multiple interrupts, execute processing in [6] and [9]. note 5: to reenable interrupts (by setting the ie bit to 1) after reading the interrupt vector register (ivect), perform a dummy access to the internal memory, etc. before reenabling interrupts. in the example here, there is no need to add a dummy access because the icu vector table is read after reading the ivect register. similarly, to reenable interrupts (by setting the ie bit to 1) after writing to the interrupt request mask register (imask), perform a dummy access to the internal memory, etc. before reenabling interrupts. h'0000 0080 bra instruction read interrupt vector register (ivect) read icu vector table branch to the interrupt handler for each internal peripheral i/o rte h'0080 0004 h'0000 0094 h'0000 0113 interrupt handler ei (external interrupt) handler ei (external interrupt) vector entry interrupt handler start address program being executed interrupt generated ivect save bpc to the stack save psw to the stack save general-purpose registers to the stack restore bpc from the stack restore psw from the stack restore general-purpose registers from the stack read and save interrupt request mask register (imask) to the stack imask h'0080 0000 set psw register ie bit to 1 clear psw register ie bit to 0 restore interrupt request mask register (imask) from the stack [1] [2] [3] [5] [7] [8] [9] [6] [10] [11] icu vector table (note 1) (note 1) hardware preprocessing when eit is accepted hardware postprocessing when rte instruction is executed read and overwrite interrupt request mask register (imask) [4] [12] (note 2) (note 2) (note 3) (note 4) (note 5) (note 4) (note 2) interrupt handler [1] to [12]: processing of ei by interrupt handler figure 5.5.2 typical operation for interrupts from internal peripheral i/o interrupt controller (icu) 5.5 description of interrupt operation 5 5-23 32170/32174 group user's manual (rev. 2.1) h?0000 0010 bra instruction sbi (system break interrupt) handler sbi (system break interrupt) vector entry program being executed sbi generated . . . . . . processing to terminate the system note: do not return to the program that was being executed when the interrupt occurred. terminate or reset the system interrupt controller (icu) 5.6 description of system break interrupt (sbi) operation 5.6 description of system break interrupt (sbi) operation 5.6.1 acceptance of sbi system break interrupt (sbi) is an emergency interrupt which is used when power failure is detected or a fault condition is notified by an external watchdog timer. the system break interrupt is _______ accepted anytime upon detection of a falling edge on the sbi signal regardless of how the psw register ie bit is set, and cannot be masked. 5.6.2 sbi processing by handler when the system break interrupt generated has been serviced, always be sure to terminate or reset the system without returning to the program that was being executed when the interrupt occurred. figure 5.6.1 typical sbi operation 5 5-24 32170/32174 group user's manual (rev. 2.1) interrupt controller (icu) 5.6 description of system break interrupt (sbi) operation ? this is a blank page. ? chapter 6 chapter 6 internal memory 6.1 outline of the internal memory 6.2 internal ram 6.3 internal flash memory 6.4 registers associated with the internal flash memory 6.5 programming of the internal flash memory 6.6 boot rom 6.7 virtual flash emulation function 6.8 connecting to a serial programmer 6.9 precautions to be taken when rewriting flash memory 6 6-2 32170/32174 group user's manual (rev. 2.1) 6.1 outline of the internal memory this microcomputer internally contains the following types of memory: ? 40 kbyte or 32 kbyte ram ? 768 kbyte, 512 kbyte, or 384 kbyte flash memory 6.2 internal ram specifications of the internal ram are shown below. table 6.2.1 specifications of the internal ram item specification capacity m32170f6, m32174f4, m32174f3 : 40 kbytes m32170f4, m32170f3 : 32kbytes location address m32170f6, m32174f4, m32174f3 : h'0080 4000 - h'0080 dfff m32170f4, m32170f3 : h'0080 4000 - h'0080 bfff wait insertion operates with no wait states (when using 40 mhz cpu clock) internal bus connection connected by 32-bit bus dual port by using the real-time debugger (rtd), data can be read (monitored) or written to any area of the internal ram via serial communication from external devices independently of the cpu. (refer to chapter 14, "real-time debugger.") internal memory 6.1 outline of the internal memory 6 6-3 32170/32174 group user's manual (rev. 2.1) internal memory 6.3 internal flash memory 6.3 internal flash memory specifications of the internal flash memory are shown below. table 6.3.1 specifications of the internal flash memory item specification capacity m32170f6 : 768 kbytes m32170f4, m32174f4 : 512kbytes m32170f3, m32174f3 : 384kbytes location address m32170f6 : h'0000 0000 - h'000b ffff m32170f4, m32174f4 : h'0000 0000 - h'0007 ffff m32170f3, m32174f3 : h'0000 0000 - h'0005 ffff wait insertion operates with no wait states (when using 40 mhz cpu clock) durability can be rewritten 100 times internal bus connection connected by 32-bit bus other virtual flash emulation function is included. (refer to section 6.7, "virtual flash emulation function.") 6 6-4 32170/32174 group user's manual (rev. 2.1) internal memory 6.4 registers associated with the internal flash memory figure 6.4.1 register map associated with the internal flash memory h?0080 07e0 h?0080 07e2 address d0 d7 +0 address +1 address d8 d15 h?0080 07e4 h?0080 07e6 h?0080 07e8 h?0080 07ea h?0080 07ec h?0080 07ee h?0080 07f0 h?0080 07f2 blank addresses are reserved for future use. (note) note: the m32170f4 and m32170f3 do not have the felbank3 register. flash mode register (fmod) flash controle register 1 (fcnt1) flash controle register 3 (fcnt3) flash status register 1 (fstat1) flash controle register 2 (fcnt2) flash controle register 4 (fcnt4) virtual flash l bank register 0 (felbank0) virtual flash l bank register 1 (felbank1) virtual flash l bank register 2 (felbank2) virtual flash l bank register 3 (felbank3) virtual flash s bank register 0 (fesbank0) virtual flash s bank register 1 (fesbank1) 6.4 registers associated with the internal flash memory the diagram below shows a register map associated with the internal flash memory. 6 6-5 32170/32174 group user's manual (rev. 2.1) d0123456d7 fpmod 6 6-6 32170/32174 group user's manual (rev. 2.1) internal memory 6.4 registers associated with the internal flash memory 6.4.2 flash status registers the 32170 has two registers to indicate the flash memory status, one of which is flash status register 1 (fstat1) located in the sfr area (address: h'0080 07e1), and the other is flash status register 2 (fstat2) included in the flash memory itself. when programming or erasing the flash memory, use these two status registers (fstat1, fstat2) to control the program/erase operations. flash status register 1 (fstat1) 6 6-7 32170/32174 group user's manual (rev. 2.1) flash status register 2 (fstat2) d8 9 1011121314d15 fbusy erase wrerr1 wrerr2 6 6-8 32170/32174 group user's manual (rev. 2.1) internal memory 6.4 registers associated with the internal flash memory (4) wrerr2 (program operating condition) bit (d12) the wrerr2 bit is used to determine after execution whether the flash memory program operation resulted in an error. when wrerr2 = 0, it means the program operation terminated normally; when wrerr2 = 1, the operation terminated in an error. the condition under which wrerr2 is set to 1 is when the flash memory could not be written to by repeating the write operation a specified number of times. note: this status register is included in the internal flash memory itself, and can be read out by writing the read status command (h'7070) to any address of the flash memory. for details, refer to section 6.5, "programming of internal flash memory." 6 6-9 32170/32174 group user's manual (rev. 2.1) d0123456d7 fentry femmod 6 6-10 32170/32174 group user's manual (rev. 2.1) when using a program in the flash memory while the fentry bit = 0, the ei vector entry is located at address h'0000 0080 of the flash memory. when running a flash rewrite program in ram while the fentry bit = 1, the ei vector entry is located at address h'0080 4000 of the ram, allowing for flash rewrite operation to be controlled using interrupts. table 6.4.1 changes of ei vector entry by fentry fentry ei vector entry address 0 flash memory area h'0000 0080 1 internal ram area h'0080 4000 (2) femmod (virtual flash emulation mode) bit (d7) the femmod bit controls entry to virtual flash emulation mode. virtual flash emulation mode is entered by setting the femmod bit to 1 while the fentry bit = 0. (for details, refer to section 6.7, "virtual flash emulation function.") internal memory 6.4 registers associated with the internal flash memory 6 6-11 32170/32174 group user's manual (rev. 2.1) internal memory 6.4 registers associated with the internal flash memory flash control register 2 (fcnt2) 6 6-12 32170/32174 group user's manual (rev. 2.1) internal memory 6.4 registers associated with the internal flash memory flash control register 3 (fcnt3) 6 6-13 32170/32174 group user's manual (rev. 2.1) internal memory 6.4 registers associated with the internal flash memory flash control register 4 (fcnt4) 6 6-14 32170/32174 group user's manual (rev. 2.1) figure 6.4.3 example for using the fcnt4 register internal memory 6.4 registers associated with the internal flash memory freset=1 yes no fentry=1 program/erase flash memory error found program/erase terminated normally freset=0 program/erase flash memory fentry=0 6 6-15 32170/32174 group user's manual (rev. 2.1) 6.4.4 virtual flash l bank registers virtual flash l bank register 0 (felbank0) 6 6-16 32170/32174 group user's manual (rev. 2.1) 6.4.5 virtual flash s bank registers virtual flash s bank register 0 (fesbank0) 6 6-17 32170/32174 group user's manual (rev. 2.1) 6.5 programming of the internal flash memory 6.5.1 outline of programming flash memory when writing to the internal flash memory, there are following two methods to use depending on situation: (1) when the write program does not exist in the internal flash memory (2) when the write program already exists in the internal flash memory for (1), set the fp pin = high, mod0 = high, and mod1 = low to enter boot flash e/w enable mode. in this case, the reset vector entry is located at the beginning of the boot program area (h'8000 0000). (normally, the reset vector entry is located at the start address of the internal flash memory.) transfer the "flash write program" from the boot area into the internal ram using a boot program. after this transfer, jump to the ram and set the flash control register 1 fentry bit to 1 to make the flash memory ready for write. you now can write to the internal flash memory using the "flash write program" that has been transferred into the internal ram. for (2), set the fp pin = high, mod0 = low, and mod1 = low to enter flash e/w enable mode in single-chip mode. transfer the "flash write program" from the internal flash memory in which it has been prepared beforehand into the internal ram. after this transfer, jump to the ram and set the flash control register 1 (fcnt1) fentry bit to 1 using a program in the ram to make the flash memory ready for write. you now can write to the internal flash memory using the "flash write program" that has been transferred into the internal ram. or you can set the fp pin = high, mod0 = low, and mod1 = high to enter flash e/w enable mode in extended external mode. when in flash e/w enable mode (fp pin = 1, fentry bit = 1), the eit vector entry for external interrupt (ei) is moved to the beginning of the internal ram (h'0080 4000). during normal mode, the eit vector entry exists in the flash area (h'0000 0080). internal memory 6.5 programming of the internal flash memory 6 6-18 32170/32174 group user's manual (rev. 2.1) internal memory 6.5 programming of the internal flash memory figure 6.5.1 ei vector entry when in flash e/w enable mode ei vector entry internal rom area internal ram (h'0000 0080) h'0000 0000 h'00ff ffff h'0080 4000 internal rom area internal ram h'0080 3fff flash e/w enable mode (fentry=1) normal mode (fentry=0) h'0000 0000 h'0080 3fff ei vector entry (h'0080 4000) h'0080 4000 h'00ff ffff 6 6-19 32170/32174 group user's manual (rev. 2.1) (1) when the write program does not exist in the internal flash memory use a program in the boot rom located on memory map to write to the flash memory. to transfer the write data, use serial i/o1 in clock-synchronized serial mode. use this serial transfer when writing to the flash memory using a flash programmer. internal memory 6.5 programming of the internal flash memory figure 6.5.2 procedure for writing to internal flash memory (when the write program does not exist in the flash memory) sio1 cpu sio1 cpu flash write program mod1= l sio1 cpu ram flash memory fp=l or h ram ram 6 6-20 32170/32174 group user's manual (rev. 2.1) internal memory 6.5 programming of the internal flash memory figure 6.5.3 internal flash memory write timings (when the write program does not exist in the flash memory) reset mod0 fentry fp mod1 power on mode selected reset deasserted (boot program starts) mode selected reset deasserted writes to flash memory by boot program settings by boot program 6 6-21 32170/32174 group user's manual (rev. 2.1) (2) when the write program already exists in the internal flash memory use the flash write program already stored in the internal flash memory to write to the flash memory. for write to the flash memory, use the internal peripheral circuits according to your programming system. (the data bus, serial i/o, and ports can be used.) the following shows an example for writing to the flash memory by using serial i/o0 in single-chip mode. internal memory 6.5 programming of the internal flash memory figure 6.5.4 procedure for writing to internal flash memory (when the write program already exists in the flash memory) sio0 cpu sio0 cpu flash write program mod1= l sio0 cpu ram flash write program fp=l or h ram ram 6 6-22 32170/32174 group user's manual (rev. 2.1) internal memory 6.5 programming of the internal flash memory figure 6.5.5 internal flash memory write timings (when the write program already exists in the flash memory) reset mod0 fentry fp "h" or "l" "h" or "l" (single-chip or extended external) mod1 "l" "h" or "l" write to flash memory by flash rewrite program flash rewrite starts flash mode turned off flash rewrite program transferred to ram flash mode turned on 6 6-23 32170/32174 group user's manual (rev. 2.1) 6.5.2 controlling operation mode during programming flash the device's operation modes are set by mod0, mod1, and flash control register 1 (fcnt1) fentry bit. the table below lists operation modes that may be set during flash write. table 6.5.1 operation modes set during flash write fp mod0 mod1 fentry (note) operation mode reset vector entry ei vector entry 00 0 single-chip mode start address of flash area 1 0 0 0 flash memory (h'0000 0080) (h'0000 0000) 01 0 processor mode start address of external area external area (h'0000 0080) (h'0000 0000) 00 1 extended external mode start address of flash area 1 0 1 0 flash memory (h'0000 0080) (h'0000 0000) 1 0 0 1 single-chip mode start address of beginning of + flash e/w enable flash memory internal ram (h'0000 0000) (h'0080 4000) 1 1 0 0 boot mode start address of flash area boot program area (h'0000 0080) (h'8000 0000) 1 1 0 1 boot mode start address of beginning of + flash e/w enable boot program area internal ram (h'8000 0000) (h'0080 4000) 10 11 extended external mode start address of beginning of + flash e/w enable flash memory internal ram (h'0000 0000) (h'0080 4000) 11 reserved note: indicates the fentry bit status of flash control register 1 (fcnt1). the bar " " denotes "don't care." (1) flash e/w enable mode flash e/w enable mode is a mode in which the internal flash memory can be programmed or erased. in flash e/w enable mode, no programs can be executed in the internal flash memory. therefore, before entering flash e/w enable mode, you need to transfer the necessary program into the internal ram and run the program in ram. internal memory 6.5 programming of the internal flash memory 6 6-24 32170/32174 group user's manual (rev. 2.1) internal memory 6.5 programming of the internal flash memory (2) entering flash e/w enable mode flash e/w enable mode can be entered only when the device is operating in single-chip mode or extended external mode. namely, you can enter flash e/w enable mode only when the fp pin = high and the flash control register 1 (fcnt1) fentry bit = 1. you cannot enter flash e/w enable mode when the device is operating in processor mode or the fp pin = low. (3) detecting the mod0 and mod1 pin levels the mod0 and mod1 pin levels (high or low) can be verified using the p8 data register (port data register, h'00800 0708) mod0dt and mod1dt bits. p8 data register (p8data) 6 6-25 32170/32174 group user's manual (rev. 2.1) internal memory 6.5 programming of the internal flash memory figure 6.5.6 procedure for entering flash e/w enable mode note: for details about each command, refer to section 6.5.3, "programming procedure to internal flash memory." end start enter one of the following modes: single-chip mode + flash e/w enable mode boot mode + flash e/w enable mode extended external mode + flash e/w enable mode transfer e/w program to internal ram in each mode set flash control register in sfr area (fcnt1, h'0080 07e2) flash entry (fentry) bit to 0 set flash control register in sfr area (fcnt1, h'0080 07e2) flash entry (fentry) bit to 1 execute flash e/w command and various read commands (note) switched to flash e/w program 1 s wait (by hardware timer or software timer) jump to flash memory or apply reset switched to normal mode mod0, 1 fp pin levels checked ok no end fmod(h'0080 07e0) fpmod p8data(h'0080 0708) d0=mod0dt d1=mod1dt 6 6-26 32170/32174 group user's manual (rev. 2.1) internal memory 6.5 programming of the internal flash memory 6.5.3 programming procedure to the internal flash memory to write to the internal flash memory, set the device's operation mode to enter flash e/w enable mode first and then use the flash write program that has already been transferred from the flash memory into the internal ram. in flash e/w enable mode, no data can be read out from the internal flash memory as in normal mode, so you cannot execute a program that exists in the internal flash memory. therefore, the flash write program must be prepared in the internal ram before entering flash e/w enable mode. (once you've entered flash e/w enable mode, you cannot use any command except flash commands to access the flash memory.) to access the internal flash memory in flash memory e/w enable mode, issue commands for the internal flash memory address to be operated on. the table below lists the commands that can be issued in flash memory e/w enable mode. note : during flash e/w enable mode, the flash memory cannot be accessed for read or write wordwise. table 6.5.2 commands in flash memory e/w enable mode command name issued command data read array command h'ffff page program command h'4141 lock bit program command h'7777 block erase command h'2020 erase all unlock block command h'a7a7 read status register command h'7070 clear status register command h'5050 read lock bit status command h'7171 verify command (note) h'd0d0 note: this command is used in conjunction with lock bit program, block erase, and erase all unlock block operations. (1) read array command read mode is entered by writing command data h'ffff to any address of the internal flash memory. then read the flash memory address you want to read out, and the content of that address will be read out. before exiting flash e/w enable mode, always be sure to execute the read array command. 6 6-27 32170/32174 group user's manual (rev. 2.1) internal memory 6.5 programming of the internal flash memory (2) page program command flash memory is programmed one page at a time, each page consisting of 256 bytes (lower addresses h'00 to h'ff). to write data to the flash memory (i.e., to program the flash memory), write the program command h'4141 to any address of the internal flash memory and then the program data to the address to which you want to write. with the page program command, you cannot write to the protected blocks. page program is automatically performed by the internal control circuit, and the completion of programming can be verified by checking the flash status register 1 (fstat1) fstat bit. (refer to section 6.4.2, "flash status registers.") while the fstat bit = 0, the next programming can not be performed. (3) lock bit program command flash memory can be protected against program/erase one block at a time. the lock bit program command is provided for protecting memory blocks. write the lock bit program command data h'7777 to any address of the internal flash memory. next, write the verify command data h'd0d0 to the last even address of the block you want to protect, and this memory block is protected against program/erase. to remove protection, disable lock bit-effectuated protection using the flash control register 2 (fcnt2) fprot bit (see section 6.4.3, "flash control registers") and erase the block whose protection you want to remove. (the content of this memory block is also erased.) the table below lists the target blocks and their specified addresses when writing the verify command data. 6 6-28 32170/32174 group user's manual (rev. 2.1) internal memory 6.5 programming of the internal flash memory table 6.5.3 m32170f6 target blocks and specified addresses target block specified address 0 h'0000 3ffe 1 h'0000 5ffe 2 h'0000 7ffe 3 h'0000 fffe 4 h'0001 fffe 5 h'0002 fffe 6 h'0003 fffe 7 h'0004 fffe 8 h'0005 fffe 9 h'0006 fffe 10 h'0007 fffe 11 h'0008 fffe 12 h'0009 fffe 13 h'000a fffe 14 h'000b fffe table 6.5.4 m32170f4 and m32174f4 target blocks and specified addresses target block specified address 0 h'0000 3ffe 1 h'0000 5ffe 2 h'0000 7ffe 3 h'0000 fffe 4 h'0001 fffe 5 h'0002 fffe 6 h'0003 fffe 7 h'0004 fffe 8 h'0005 fffe 9 h'0006 fffe 10 h'0007 fffe 6 6-29 32170/32174 group user's manual (rev. 2.1) internal memory 6.5 programming of the internal flash memory table 6.5.5 m32170f3 and m32174f3 target blocks and specified addresses target block specified address 0 h'0000 3ffe 1 h'0000 5ffe 2 h'0000 7ffe 3 h'0000 fffe 4 h'0001 fffe 5 h'0002 fffe 6 h'0003 fffe 7 h'0004 fffe 8 h'0005 fffe 6 6-30 32170/32174 group user's manual (rev. 2.1) internal memory 6.5 programming of the internal flash memory figure 6.5.7 block configuration of the m32170f6 flash memory m32170f6 s internal flash memory area (768kb) h 0002 0000 8kb 16kb 8kb 32kb 64kb h 0000 0000 h 0000 7fff h 0000 8000 h 0001 ffff h 0000 3fff h 0000 4000 h 0000 ffff h 0001 0000 h 0000 5fff h 0000 6000 64kb h 0002 ffff 64kb h 0009 ffff h 0009 0000 64kb h 000a ffff h 000a 0000 64kb h 000b ffff h 000b 0000 64kb block 0 64kb 64kb 64kb 64kb 64kb h 0003 0000 h 0003 ffff h 0004 0000 h 0004 ffff h 0005 0000 h 0005 ffff h 0006 0000 h 0006 ffff h 0007 0000 h 0007 ffff h 0008 0000 h 0008 ffff block 1 block 2 block 3 block 4 block 5 block 6 block 7 block 8 uneven blocks even blocks block 9 block 10 block 11 block 12 block 13 block 14 6 6-31 32170/32174 group user's manual (rev. 2.1) internal memory 6.5 programming of the internal flash memory figure 6.5.8 block configuration of the m32170f4 and m32174f4 flash memory m32170f4 s and m32174f4 s internal flash memory area (512kb) h 0002 0000 8kb 16kb 8kb 32kb 64kb h 0000 0000 h 0000 7fff h 0000 8000 h 0001 ffff h 0000 3fff h 0000 4000 h 0000 ffff h 0001 0000 h 0000 5fff h 0000 6000 64kb h 0002 ffff 64kb 64kb 64kb block 0 64kb 64kb h 0003 0000 h 0003 ffff h 0004 0000 h 0004 ffff h 0005 0000 h 0005 ffff h 0006 0000 h 0006 ffff h 0007 0000 h 0007 ffff block 1 block 2 block 3 block 4 block 5 block 6 block 7 block 8 uneven blocks even blocks block 9 block 10 6 6-32 32170/32174 group user's manual (rev. 2.1) internal memory 6.5 programming of the internal flash memory figure 6.5.9 block configuration of the m32170f3 and m32174f3 flash memory m32170f3 s and m32174f3 s internal flash memory area (384kb) h 0002 0000 8kb 16kb 8kb 32kb 64kb h 0000 0000 h 0000 7fff h 0000 8000 h 0001 ffff h 0000 3fff h 0000 4000 h 0000 ffff h 0001 0000 h 0000 5fff h 0000 6000 64kb h 0002 ffff 64kb 64kb 64kb block 0 h 0003 0000 h 0003 ffff h 0004 0000 h 0004 ffff h 0005 0000 h 0005 ffff block 1 block 2 block 3 block 4 block 5 block 6 block 7 block 8 uneven blocks even blocks 6 6-33 32170/32174 group user's manual (rev. 2.1) internal memory 6.5 programming of the internal flash memory (4) block erase command the block erase command erases the contents of internal flash memory one block at a time. for block erase, write the command data h'2020 to any address of the internal flash memory. next, write the verify command data h'd0d0 to the last even address of the memory block you want to erase (see table 6.5.3, table 6.5.4, and table 6.5.5, "target blocks and specified addresses"). the content of this memory block is erased. with the block erase command, you cannot erase the protected blocks. block erase is automatically performed by the internal control circuit, and the completion of block erase can be verified by checking the flash status register 1 (fstat1) fstat bit. (refer to section 6.4.2, "flash status registers.") while the fstat bit = 0, you cannot erase the next block. (5) erase all unlock block command the erase all unlock block command erases all memory blocks that are not protected. to erase all unlock blocks, write the command data h'a7a7 to any address of the internal flash memory. next, write the command data h'd0d0 to any address of the internal flash memory, and all of unprotected memory blocks are erased. (6) read status register command the read status register command reads out the content of flash status register 2 (fstat2) that indicates whether flash memory write or erase operation has terminated normally or not. to read flash status register 2, write the command data h'7070 to any address of the internal flash memory. next, read any address of the internal flash memory, and the content of flash status register 2 (fstat2) is read out. (7) clear status register command the clear status register command clears the flash status register 2 (fstat2) d10, d11, and d12 bits to 0. write the command data h'5050 to any address of the internal flash memory, and flash status register 2 is cleared to 0. if an error occurs when programming or erasing the flash memory and the flash status register 2 (fstat2) erase (auto erase operating condition) or wrerr2 (program operating condition 2) bit is set to 1, you cannot perform the next program or erase operation unless wrerr1 (program operating condition 1) or wrerr2 (program operating condition 2) is cleared to 0. 6 6-34 32170/32174 group user's manual (rev. 2.1) internal memory 6.5 programming of the internal flash memory flbst0 flbst1 d01234567891011121314d15 6 6-35 32170/32174 group user's manual (rev. 2.1) internal memory 6.5 programming of the internal flash memory follow the procedure described below to write to the lock bits. a) setting the lock bit to 0 (protect the block) issue the lock bit program command (h'7777) to the memory block you want to protect. b) setting the lock bit to 1 (unprotect the block) after setting the flash control register 2 fprot bit to invalidate lock bit-effectuated protection, use the block erase command (h'2020) or erase all unprotect block command (h'a7a7) to erase the memory block you want to unprotect. this is the only way to unprotect a memory block. you cannot set the lock bit alone to 1. c) status when the lock bit is reset the lock bit is unaffected by a reset or power outage because it is a nonvolatile bit. (9) execution flow of each command the diagrams below show an execution flow of each command. figure 6.5.10 read array start write read array command (h'ffff) to any address of internal flash memory read the internal flash memory address you want to read end 6 6-36 32170/32174 group user's manual (rev. 2.1) internal memory 6.5 programming of the internal flash memory figure 6.5.11 page program note 1: start writing from the beginning of a 256-byte boundary of the flash memory (lower address h'00). note 2: when program operation starts, you have the read status register command automatically entered. (you do not need to enter the read status register command until you issue another command.) note 3: examine the flash status register 2 erese (auto erase operating condition), wrerr1 (program operating condition 1), and wrerr2 (program operating condition 2) bits to check for program error. end write data to the internal flash memory address to which you want to write. (note 1) increment the previous write address by 2 and write the next data to the new address. write page program command (h'4141) to any address of internal flash memory. written to the internal flash memory by page program (note 2) programmed for one page ? no yes 1 s wait (by hardware timer or software timer) fstat bit = 1 yes no go to next page start read any address of internal flash memory to check for program error. (note 3) last address ? yes no time out ? 0.5s yes no forcibly terminated 6 6-37 32170/32174 group user's manual (rev. 2.1) internal memory 6.5 programming of the internal flash memory figure 6.5.12 lock bit program note 1: when program operation starts, you have the read status register command automatically entered. (you do not need to enter the read status register command until you issue another command.) note 2: examine the flash status register 2 erese (auto erase operating condition), wrerr1 (program operating condition 1), and wrerr2 (program operating condition 2) bits to check for program error. end write verify command (h'd0d0) to the last even address of the block you want to protect. written to the lock bit by program (note 1) write lock bit program command (h'7777) to any address of internal flash memory. 1 s wait (by hardware timer or software timer) fstat bit = 1 yes no start read any address of internal flash memory to check for program error. (note 2) time out ? 0.5s yes no forcibly terminated 6 6-38 32170/32174 group user's manual (rev. 2.1) internal memory 6.5 programming of the internal flash memory figure 6.5.13 block erase note 1: when erase operation starts, you have the read status register command automatically entered. (you do not need to enter the read status register command until you issue another command.) note 2: examine the flash status register 2 erese (auto erase operating condition), wrerr1 (program operating condition 1), and wrerr2 (program operating condition 2) bits to check for erase error. end write verify command (h'd0d0) to the last even address of the block you want to erase. flash memory contents erased by erase program (note 1) write erase command (h'2020) to any address of internal flash memory. 1 s wait (by hardware timer or software timer) fstat bit = 1 yes no start read any address of internal flash memory to check for erase error. (note 2) time out ? 1s yes no forcibly terminated 6 6-39 32170/32174 group user's manual (rev. 2.1) internal memory 6.5 programming of the internal flash memory figure 6.5.14 erase all unlock block note 1: when erase operation starts, you have the read status register command automatically entered. (you do not need to enter the read status register command until you issue another command.) note 2: examine the flash status register 2 erese (auto erase operating condition), wrerr1 (program operating condition 1), and wrerr2 (program operating condition 2) bits to check for erase error. end write verify command (h'd0d0) to any address in memory blocks you want to erase. flash memory contents erased by erase program (note 1) write erase all unlock block command (h'a7a7) to any address of internal flash memory. 1 s wait (by hardware timer or software timer) fstat bit = 1 yes no start read any address of internal flash memory to check for erase error. (note 2) time out ? 10s yes no forcibly terminated 6 6-40 32170/32174 group user's manual (rev. 2.1) internal memory 6.5 programming of the internal flash memory figure 6.5.15 read status register figure 6.5.17 read lock bit status register figure 6.5.16 clear status register write read status command (h'7070) to any address of internal flash memory. start read any address of internal flash memory. end write clear status command (h'5050) to any address of internal flash memory. start end write read lock bit status command (h'7171) to any address of internal flash memory. start read the last even address of the block whose status you want to read. end 6 6-41 32170/32174 group user's manual (rev. 2.1) internal memory 6.5 programming of the internal flash memory 6.5.4 flash write time (for reference) the time required for writing to the internal flash memory is shown below for your reference. (1) m32170f6 (a) transfer time by sio (for a transfer data size of 768 kb) 1/57600 bps 1 (frame) 11 (number of transfer bits) 768 kb 150.2 [s] (b) flash write time 768 kb/256-byte block 8 ms 24.6 [s] (c) erase time (entire area) 50 ms number of blocks = 750 [ms] (d) total flash write time (entire 768 kb area) when communicating at 57600 bps using uart, the flash write time can be ignored because it is very short compared to the serial communication time. therefore, the flash write time can be calculated using the equation below: (a) + (c) 151 [s] when writing data to flash memory at high speed by speeding up the serial communication or by other means, the fastest write time possible is as follows: (b) + (c) 25 [s] (2) m32170f4 and m32174f4 (a) transfer time by sio (for a transfer data size of 512 kb) 1/57600 bps 1 (frame) 11 (number of transfer bits) 512 kb 100.2 [s] (b) flash write time 512 kb/256-byte block 8 ms 16.4 [s] (c) erase time (entire area) 50 ms number of blocks = 550 [ms] (d) total flash write time (entire 512 kb area) when communicating at 57600 bps using uart, the flash write time can be ignored because it is very short compared to the serial communication time. therefore, the flash write time can be calculated using the equation below: (a) + (c) 101 [s] when writing data to flash memory at high speed by speeding up the serial communication or by other means, the fastest write time possible is as follows: (b) + (c) 17 [s] . = . . = . . = . . = . . = . . = . . = . . = . 6 6-42 32170/32174 group user's manual (rev. 2.1) internal memory 6.5 programming of the internal flash memory (3) m32170f3 and m32174f3 (a) transfer time by sio (for a transfer data size of 384 kb) 1/57600 bps 1 (frame) 11 (number of transfer bits) 384 kb 75.1 [s] (b) flash write time 384 kb/256-byte block 8 ms 12.3 [s] (c) erase time (entire area) 50 ms number of blocks = 450 [ms] (d) total flash write time (entire 384 kb area) when communicating at 57600 bps using uart, the flash write time can be ignored because it is very short compared to the serial communication time. therefore, the flash write time can be calculated using the equation below: (a) + (c) 76 [s] when writing data to flash memory at high speed by speeding up the serial communication or by other means, the fastest write time possible is as follows: (b) + (c) 13 [s] . = . . = . . = . . = . 6 6-43 32170/32174 group user's manual (rev. 2.1) internal memory 6.6 boot rom 6.6 boot rom the table below shows boot memory specifications of the 32170 and 32174. table 6.6.1 boot memory specifications item specification capacity 8 kbytes location address h'8000 0000 - h'8000 1fff wait insertion operates with no wait states (with 40 mhz internal cpu memory clock) internal bus connection connected by 32-bit bus read can only be read when fp = 1, mod0 = 1, and mod1 = 0. when read in other modes,indeterminate values are read out. cannot be accessed for write. other because the boot rom area is a reserved area that can only be used in boot mode, the program cannot be modified. 6 6-44 32170/32174 group user's manual (rev. 2.1) internal memory 6.7 virtual flash emulation function 6.7 virtual flash emulation function this microcomputer has a special function, called the "virtual flash emulation function," which allows the internal ram to be mapped in blocks of 8 kbytes from the beginning (up to four blocks for the m32170f6, up to three blocks for the m32170f4, m32170f3, m32174f4, and m32174f3) into the internal flash memory area divided in units of 8 kbytes (l banks). similarly, this function allows the internal ram to be mapped in blocks of 4 kbytes, for the m32170f6 (up to two blocks) starting from the ram address h'0080 c000, for the m32170f4, m32170f3, m32174f4, and m32174f3 (up to two blocks) starting from the ram address h'0080 a000 into the internal flash memory area divided in units of 4 kbytes (s banks). when this function is used, the data placed in 8 kbyte or 4 kbyte blocks of internal ram can be moved to or from the l or s banks in the flash memory that are specified by the virtual flash bank register. for applications that require modifying data during program operation, this enables dynamic modification of data using 8 kbytes or 4 kbytes of ram areas. the ram blocks allocated for virtual flash emulation can be read or written to from both internal ram and internal flash memory areas. this function, when used in combination with the real-time debugger (rtd), permits you to look up or rewrite from outside the data tables created in the internal flash memory, thus facilitating data table tuning from an external device. before accessing the internal flash memory for programming, be sure to terminate this virtual flash emulation mode. figure 6.7.1 internal ram bank configuration of the m32170f6 ram bank l block 0 (felbank0) 8 kbytes h 0080 4000 h 0080 6000 h 0080 8000 h 0080 a000 h 0080 c000 h 0080 d000 ram bank l block 1 (felbank1) 8 kbytes ram bank l block 2 (felbank2) 8 kbytes ram bank l block 3 (felbank3) 8 kbytes ram bank s block 0 (fesbank0) 4 kbytes ram bank s block 1 (fesbank1) 4 kbytes 6 6-45 32170/32174 group user's manual (rev. 2.1) internal memory 6.7 virtual flash emulation function figure 6.7.2 internal ram bank configuration of the m32170f4 and m3170f3 h 0080 4000 h 0080 6000 h 0080 8000 h 0080 a000 h 0080 b000 ram bank l block 0 (felbank0) 8 kbytes ram bank l block 1 (felbank1) 8 kbytes ram bank l block 2 (felbank2) 8 kbytes ram bank s block 0 (fesbank0) 4 kbytes ram bank s block 1 (fesbank1) 4 kbytes figure 6.7.3 internal ram bank configuration of the m32174f4 and m32174f3 ram bank l block 0 (felbank0) 8 kbytes h'0080 4000 h'0080 6000 h'0080 8000 h'0080 a000 h'0080 b000 ram bank l block 1 (felbank1) 8 kbytes ram bank l block 2 (felbank2) 8 kbytes ram bank s block 0 (fesbank0) 4k bytes ram bank s block 1 (fesbank1) 4 kbytes h'0080 c000 h'0080 dfff areas usable for virtual-flash emulation note: the 8-kbyte area from h'0080 c000 to h'0080 dfff cannot be used as a virtual-flash emulation area. 6 6-46 32170/32174 group user's manual (rev. 2.1) 6.7.1 virtual-flash emulation areas the following shows the areas in which the virtual-flash emulation function is effective. using the virtual-flash l bank registers (felbank0 felbank3 for the m32170f6 or felbank0 felbank2 for the m32170f4, m32170f3, m32174f4, and m32174f3), select an arbitrary l bank area from 8-kbyte l banks in the flash memory area (by setting the seven start address bits a12 a18 of the desired l bank in the virtual-flash l bank register lbankad bits). then set the virtual-flash l bank register modenl0 3 bits (for the m32170f6) or modenl0 2 bits (for the m32170f4, m32170f3, m32174f4, and m32174f3) to 1. the selected l bank areas can be replaced with 8-kbyte blocks of the internal ram beginning with its start address, up to four blocks for the m32170f6 or up to three blocks for the m32170f4, m32170f3, m32174f4, and m32174f3. similarly, using the virtual-flash s bank registers (fesbank0, fesbank1), select an arbitrary s bank area from 4-kbyte s banks in the flash memory (by setting the eight start address bits a12 a19 of each desired s bank in the virtual-flash s bank register sbankad bits). then set the virtual-flash s bank register modens0 and modens1 bits to 1. the selected s bank areas can be replaced with up to two 4-kbyte blocks of the internal ram beginning with address h 0080 c000 for the m32170f6 or h 0080 a000 for the m32170f4, m32170f3, m32174f4, and m32174f3. in this way, the m32170f6 can have four 8-kbyte blocks or l banks and two 4-kbyte blocks or s banks selected, for a total of up to six banks. for the m32170f4, m32170f3, m32174f4, and m32174f3, three 8-kbyte blocks or l banks and two 4-kbyte blocks or s banks can be selected, for a total of up to five banks. note 1 : if the virtual-flash emulation enable bit is enabled while the same bank area is set in two or more virtual-flash bank registers, the internal ram area (8 or 4 kbyte) to be replaced with is selected according to the priority of virtual-flash bank registers as follows: m32170f6 felbank0 > felbank1 > felbank2 > felbank3 > fesbank0 > fesbank1 m32170f4, m32170f3, m32174f4, and m32174f3 felbank0 > felbank1 > felbank2 > fesbank0 > fesbank1 note 2 : during virtual-flash emulation mode, the ram can be accessed for read and write from the internal ram area and the area that has been set as a virtual-flash area. note 3 : the internal ram area from h 0080 c000 to h 0080 dfff of the m32174f4 and m32174f3 cannot be used as a virtual-flash emulation area. note 4 : when performing virtual-flash read after setting flash control register 1 s virtual-flash emulation mode bit to 1, be sure to wait for three cpu clock periods or more before performing virtual-flash read after setting the said bit to 1. note 5 : when performing virtual-flash read after setting the virtual-flash bank register (l bank or s bank register) s virtual-flash emulation enable bit and bank address bits, be sure to wait for three cpu clock periods or more before performing virtual-flash read after setting the virtual-flash bank register. internal memory 6.7 virtual flash emulation function 6 6-47 32170/32174 group user's manual (rev. 2.1) internal memory 6.7 virtual flash emulation function figure 6.7.4 the m32170f6's virtual flash emulation area divided in units of 8 kbytes figure 6.7.5 the m32170f6's virtual flash emulation area divided in units of 4 kbytes note 1: if after setting the same bank area in multiple virtual flash bank registers, you enable the virtual flash emulation enable bit, the internal ram area selected in order of priority felbank0 > felbank1 > felbank2 > felbank3 > fesbank0 > fesbank1 is assigned. note 2: when you access an 8-kbyte area (l bank) specified by virtual flash l bank registers 0-3, its corresponding internal ram area is accessed. during virtual flash emulation mode, ram can be read or written to from both internal ram area and virtual flash setup area. note 1: if after setting the same bank area in multiple virtual flash bank registers, you enable the virtual flash emulation enable bit, the internal ram area selected in order of priority felbank0 > felbank1 > felbank2 > felbank3 > fesbank0 > fesbank1 is assigned. note 2: when you access an 4-kbyte area (s bank) specified by virtual flash s bank registers 0,1, its corresponding internal ram area is accessed. during virtual flash emulation mode, ram can be read or written to from both internal ram area and virtual flash setup area. h 0000 0000 h 0000 2000 h 0006 6000 6 6-48 32170/32174 group user's manual (rev. 2.1) internal memory 6.7 virtual flash emulation function figure 6.7.6 the m32170f4's virtual flash emulation area divided in units of 8 kbytes figure 6.7.7 the m32170f4's virtual flash emulation area divided in units of 4 kbytes note 1: if after setting the same bank area in multiple virtual flash bank registers, you enable the virtual flash emulation enable bit, the internal ram area selected in order of priority felbank0 > felbank1 > felbank2 > fesbank0 > fesbank1 is assigned. note 2: when you access an 8-kbyte area (l bank) specified by virtual flash l bank registers 0-2, its corresponding internal ram area is accessed. during virtual flash emulation mode, ram can be read or written to from both internal ram area and virtual flash setup area. note 1: if after setting the same bank area in multiple virtual flash bank registers, you enable the virtual flash emulation enable bit, the internal ram area selected in order of priority felbank0 > felbank1 > felbank2 > fesbank0 > fesbank1 is assigned. note 2: when you access an 4-kbyte area (s bank) specified by virtual flash s bank registers 0,1, its corresponding internal ram area is accessed. during virtual flash emulation mode, ram can be read or written to from both internal ram area and virtual flash setup area. h 0000 0000 h 0000 2000 6 6-49 32170/32174 group user's manual (rev. 2.1) internal memory 6.7 virtual flash emulation function figure 6.7.8 the m32170f3's virtual flash emulation area divided in units of 8 kbytes figure 6.7.9 the m32170f3's virtual flash emulation area divided in units of 4 kbytes note 1: if after setting the same bank area in multiple virtual flash bank registers, you enable the virtual flash emulation enable bit, the internal ram area selected in order of priority felbank0 > felbank1 > felbank2 > fesbank0 > fesbank1 is assigned. note 2: when you access an 8-kbyte area (l bank) specified by virtual flash l bank registers 0-2, its corresponding internal ram area is accessed. during virtual flash emulation mode, ram can be read or written to from both internal ram area and virtual flash setup area. note 1: if after setting the same bank area in multiple virtual flash bank registers, you enable the virtual flash emulation enable bit, the internal ram area selected in order of priority felbank0 > felbank1 > felbank2 > fesbank0 > fesbank1 is assigned. note 2: when you access an 4-kbyte area (s bank) specified by virtual flash s bank registers 0,1, its corresponding internal ram area is accessed. during virtual flash emulation mode, ram can be read or written to from both internal ram area and virtual flash setup area. h?0000 0000 h?0000 2000 6 6-50 32170/32174 group user's manual (rev. 2.1) internal memory 6.7 virtual flash emulation function figure 6.7.10 the m32174f4's virtual flash emulation area divided in units of 8 kbytes figure 6.7.11 the m32174f4's virtual flash emulation area divided in units of 4 kbytes note 1 : if the virtual-flash emulation enable bit is enabled while the same bank area is set in two or more virtual-flash bank registers, the internal ram area to be replaced with is selected by priority: felbank0 > felbank1 > felbank2 > fesbank0 > fesbank1. note 2 : when access is made to the 8-kbyte area (l bank) selected by one of virtual-flash l bank registers 0 ? 2, what actually is accessed is the internal ram area. during virtual-flash emulation mode, it is possible to read and write to ram from both the internal ram area and the area that has been set as a virtual-flash area. note 3 : the internal ram area from h ? 0080 c000 to h ? 0080 dfff cannot be used as a virtual-flash emulation area. note 1 : if the virtual-flash emulation enable bit is enabled while the same bank area is set in two or more virtual-flash bank registers, the internal ram area to be replaced with is selected by priority: felbank0 > felbank1 > felbank2 > fesbank0 > fesbank1. note 2 : when access is made to the 4-kbyte area (s bank) selected by virtual-flash s bank register 0 or 1, what actually is accessed is the internal ram area. during virtual-flash emulation mode, it is possible to read and write to ram from both the internal ram area and the area that has been set as a virtual-flash area. note 3 : the internal ram area from h ? 0080 c000 to h ? 0080 dfff cannot be used as a virtual-flash emulation area. h'0000 0000 h'0000 2000 6 6-51 32170/32174 group user's manual (rev. 2.1) internal memory 6.7 virtual flash emulation function figure 6.7.12 the m32174f3's virtual flash emulation area divided in units of 8 kbytes figure 6.7.13 the m32174f3's virtual flash emulation area divided in units of 4 kbytes note 1 : if the virtual-flash emulation enable bit is enabled while the same bank area is set in two or more virtual-flash bank registers, the internal ram area to be replaced with is selected by priority: felbank0 > felbank1 > felbank2 > fesbank0 > fesbank1. note 2 : when access is made to the 8-kbyte area (l bank) selected by one of virtual-flash l bank registers 0 ? 2, what actually is accessed is the internal ram area. during virtual-flash emulation mode, it is possible to read and write to ram from both the internal ram area and the area that has been set as a virtual-flash area. note 3 : the internal ram area from h ? 0080 c000 to h ? 0080 dfff cannot be used as a virtual-flash emulation area. note 1 : if the virtual-flash emulation enable bit is enabled while the same bank area is set in two or more virtual-flash bank registers, the internal ram area to be replaced with is selected by priority: felbank0 > felbank1 > felbank2 > fesbank0 > fesbank1. note 2 : when access is made to the 4-kbyte area (s bank) selected by virtual-flash s bank register 0 or 1, what actually is accessed is the internal ram area. during virtual-flash emulation mode, it is possible to read and write to ram from both the internal ram area and the area that has been set as a virtual-flash area. note 3 : the internal ram area from h ? 0080 c000 to h ? 0080 dfff cannot be used as a virtual-flash emulation area. h'0000 0000 h'0000 2000 6 6-52 32170/32174 group user's manual (rev. 2.1) internal memory 6.7 virtual flash emulation function figure 6.7.14 values set in the m32170f6's virtual flash bank register when divided in units of 8 kbytes figure 6.7.15 values set in the m32170f6's virtual flash bank register when divided in units of 4 kbytes note: set the seven bits a12-a18 of the start address (32-bit) of each l bank of flash memory divided every 8 kbytes in the virtual flash l bank register's l bank address (lbankad) bits. note: set the eight bits a12-a19 of the start address (32-bit) of each s bank of flash memory divided every 4 kbytes in the virtual flash s bank register's s bank address (sbankad) bits. h ? 000 0 0000 l bank start address of bank in flash memory l bank address (lbankad) bit set value h ? 000 0 2000 h ? 000 0 4000 h ? 000 b c000 h ? 000 b e000 h ? 00 h ? 02 h ? 04 h ? bc h ? be (note) l bank 0 l bank 1 l bank 2 l bank 94 l bank 95 h ? 000 0 0000 s bank start address of bank in flash memory s bank address (sbankad) bit set value h ? 000 0 1000 h ? 000 0 2000 h ? 000 b e000 h ? 000 b f000 h ? 00 h ? 01 h ? 02 h ? be h ? bf (note) s bank 0 s bank 1 s bank 2 s bank 190 s bank 191 6 6-53 32170/32174 group user's manual (rev. 2.1) internal memory 6.7 virtual flash emulation function figure 6.7.16 values set in the m32170f4's and the m32174f4's virtual flash bank register when divided in units of 8 kbytes figure 6.7.17 values set in the m32170f4's and the m32174f4's virtual flash bank register when divided in units of 4 kbytes note: set the seven bits a12-a18 of the start address (32-bit) of each l bank of flash memory divided every 8 kbytes in the virtual flash l bank register's l bank address (lbankad) bits. note: set the eight bits a12-a19 of the start address (32-bit) of each s bank of flash memory divided every 4 kbytes in the virtual flash s bank register's s bank address (sbankad) bits. h 000 0 0000 l bank start address of bank in flash memory l bank address (lbankad) bit set value h 000 0 2000 h 000 0 4000 h 000 7 c000 h 000 7 e000 h 00 h 02 h 04 h 7c h 7e (note) l bank 0 l bank 1 l bank 2 l bank 62 l bank 63 h 000 0 0000 s bank start address of bank in flash memory s bank address (sbankad) bit set value h 000 0 1000 h 000 0 2000 h 000 7 e000 h 000 7 f000 h 00 h 01 h 02 h 7e h 7f (note) s bank 0 s bank 1 s bank 2 s bank 126 s bank 127 6 6-54 32170/32174 group user's manual (rev. 2.1) internal memory 6.7 virtual flash emulation function figure 6.7.18 values set in the m32170f3's and the m32174f3's virtual flash bank register when divided in units of 8 kbytes figure 6.7.19 values set in the m32170f3's and the m32174f3's virtual flash bank register when divided in units of 4 kbytes note: set the seven bits a12-a18 of the start address (32-bit) of each l bank of flash memory divided every 8 kbytes in the virtual flash l bank register's l bank address (lbankad) bits. note: set the eight bits a12-a19 of the start address (32-bit) of each s bank of flash memory divided every 4 kbytes in the virtual flash s bank register's s bank address (sbankad) bits. h 000 0 0000 l bank start address of bank in flash memory l bank address (lbankad) bit set value h 000 0 2000 h 000 0 4000 h 000 5 c000 h 000 5 e000 h 00 h 02 h 04 h 5c h 5e (note) l bank 0 l bank 1 l bank 2 l bank 46 l bank 47 h 000 0 0000 s bank start address of bank in flash memory s bank address (sbankad) bit set value h 000 0 1000 h 000 0 2000 h 000 5 e000 h 000 5 f000 h 00 h 01 h 02 h 5e h 5f (note) s bank 0 s bank 1 s bank 2 s bank 94 s bank 95 6 6-55 32170/32174 group user's manual (rev. 2.1) internal memory 6.7 virtual flash emulation function 6.7.2 entering virtual flash emulation mode to enter virtual flash emulation mode, set the flash control register 1 (fcnt1) femmod bit to 1. after entering virtual flash emulation mode, set the virtual flash bank register moden bit to 1 to enable the virtual flash emulation function. even during virtual-flash emulation mode, the internal ram area (h 0080 4000 to h 0080 dfff for the m32170f6, h 0080 4000 to h 0080 bfff for the m32170f4 and m32170f3, or h 0080 4000 to h 0080 dfff for the m32174f4 and m32174f3) can be accessed as internal ram. figure 6.7.20 virtual flash emulation mode sequence set ram location address in virtual flash bank register lbankadn address a12-a18 sbankadn address a12-a19 write flash data to ram enable virtual flash emulation function modenln 1 modensn 1 settings completed go to virtual flash emulation mode femmod 1 settings completed 6 6-56 32170/32174 group user's manual (rev. 2.1) internal memory 6.7 virtual flash emulation function 6.7.3 application example of virtual flash emulation mode by locating two ram areas in the same virtual flash area using the virtual flash emulation function, you can rewrite data in the flash memory successively. figure 6.7.21 application example of virtual flash emulation (1/2) replace area flash ram block 0 data write to ram0 (1) operation when reset (2) program operation using ram block 0 initial value (3) program operation changed from ram block 0 to ram block 1 bank xx bank xx specified ram block 0 ram block 1 replace flash ram block 0 data write to ram1 initial value bank xx ram block 1 bank xx specified ram block 0 replace flash ram block 0 initial value bank xx ram block 1 ram block 1 bank xx specified (settings invalid) 6 6-57 32170/32174 group user's manual (rev. 2.1) internal memory 6.7 virtual flash emulation function figure 6.7.22 application example of virtual flash emulation (2/2) (6) go to item (2) note : valid area (4) program operation using ram block 1 bank xx specified ram block 1 replace flash ram block 0 data write to ram0 initial value bank xx ram block 1 (5) program operation changed from ram block 1 to ram block 0 bank xx specified ram block 0 replace flash ram block 0 initial value bank xx ram block 1 ram block 1 bank xx specified (settings invalid) 6 6-58 32170/32174 group user's manual (rev. 2.1) internal memory 6.8 connecting to a serial programmer 6.8 connecting to a serial programmer when you rewrite the internal flash memory using a general-purpose serial programmer in boot flash e/w enable mode, you need to process the pins on the 32170 and 32174 shown below to make them suitable for the serial programmer. table 6.8.1 processing the 32170 pins when using a serial programmer pin name pin number function remark fp mod0 reset sclki1 rxd1 txd1 p84 vcce vcci vss 156 154 153 121 120 119 118 37,51,80,114,139,157, 205 98,126,137,171,195,225 17,22,24,38,52,81,99, 115,127,129,138,158, 172,196,206,226 osc-vcc 21 xout 20 xin 19 osc-vss 18 vref0 vref1 61 227 avcc0 avcc1 62 228 avss0 avss1 79 5 fvcc 128 vdd 170 transfer clock input serial data input (receive data) serial data output (transmit data) transmit/receive enable output flash memory protect operation mode 1 reset clock input clock output pll circuit power supply pll circuit ground pll circuit control input vcnt 23 a-d converter reference voltage input analog power supply analog ground flash memory power supply ram backup power supply 5 v power supply ground mod1 155 operation mode 0 need to be pulled high connect to ground connect to 3.3 v power supply connect to 5 v power supply note: all other pins do not need to be processed. p83 117 transmit/receive control need to be pulled high need to be pulled high need to be pulled high connect to ground connect to ground connect to 5 v power supply connect to 3.3 v power supply connect to 3.3 v power supply 3.3 v power supply 6 6-59 32170/32174 group user's manual (rev. 2.1) internal memory 6.8 connecting to a serial programmer the diagram below shows an example of user system configuration which has had a serial programmer connected. after the user system is powered on, the serial programmer writes to the flash memory in clock-synchronized serial mode. no communication problems associated with the oscillation frequency may occur. if the system uses any 32170/32174 pins which will connect to a serial programmer, care must be taken to prevent adverse effects on the system when a serial programmer is connected. note that the serial programmer uses the addresses h'0000 0084 through h'0000 0093 as an area to check id for flash memory protection. figure 6.8.1 pin connection diagram note 1 : turn on the power to the user system before you write to the flash memory. note 2 : if the system circuit uses p83-p87, consideration must be taken for connection of a serial programmer. note 3 : p83 must have a high-level signal applied to it. note 4 : p64/sbi must be fixed high or low to ensure that interrupts will not be generated. note 5 : the pullup resistances of p83, p84, p86, and p87 must be set to suit system design conditions. note 6 : the typical pullup resistances of p83, p84, p86, and p87 are 4.7 to 10 k ? . note 7 : all other ports, whether high or low, do not affect flash memory programming. vref0, vref1 32170 32174 vdd vcci avcc0, avcc1 osc-vcc vcce connects to 5 v power supply p85/txd1 p86/rxd1 p87/sclki1/sclko1 p84/sclki0/sclko0 connector various signals on flash programmer mod0 fp reset vss set microcomputer operating conditions xin xout vcnt avss0, avss1 oscvss to system circuit p83/rxd0 rxd (input) txd (output) sclko(output) busy (input) mod0 (output) fp (output) reset(output) gnd (output) 5v (input) user system circuit board fvcc mod1 connects to 3.3 v power supply 6 6-60 32170/32174 group user's manual (rev. 2.1) 6.9 precautions to be taken when rewriting flash memory the following describes precautions to be taken when you rewrite the flash memory using a general-purpose serial programmer in boot flash e/w enable mode. when you use the pins with the system that are used by a serial programmer, take measures not to affect the system when connecting a serial programmer. if the flash memory needs to be protected, set an appropriate id in the flash memory protect id verification area (h'0000 0084 through h'0000 0093). if the flash memory does not require protection, fill the entire flash memory protect id verification area (h'0000 0084 through h'0000 0093) with h'ff. do not use wait function when entering the flash e/w mode because it may validate wait state if a low-level signal is applied to the wait# pin. internal memory 6.9 precautions to be taken when rewriting flash memory chapter 7 chapter 7 reset 7.1 outline of reset 7.2 reset operation 7.3 internal state immediately after reset release 7.4 things to be considered after reset release 7 7-2 32170/32174 group user's manual (rev. 2.1) 7.1 outline of reset _____ the device is reset by applying a low-level signal to the reset input pin. the device is gotten out _____ of a reset state by releasing the reset input back high, upon which the reset vector entry address is set in the program counter (pc) and the program starts executing from the reset vector entry. 7.2 reset operation 7.2.1 reset at power-on _____ when powering on the device, hold the reset input low until its internal multiply-by-4 clock generator becomes oscillating stably. 7.2.2 reset during operation _____ to reset the device during operation, hold the reset input low for more than four clock periods of xin signal. 7.2.3 reset vector relocation during flash rewrite when placed in boot mode, the reset vector entry address is moved to the start address of the boot program space (address h'8000 0000). for details, refer to section 6.5, "programming of internal flash memory." reset 7.1 outline of reset 7 7-3 32170/32174 group user's manual (rev. 2.1) reset 7.3 internal state immediately after reset release 7.3 internal state immediately after reset release the table below lists the register state of the device immediately after it has gotten out of reset. for details about the initial register state of each internal peripheral i/o, refer to each section in this manual where the relevant internal peripheral i/o is described. table 7.3.1 internal state immediately after reset register state after reset release psw (cr0) b'0000 0000 0000 0000 ??00 000? 0000 0000 (bsm, bie, bc bits = indeterminate) cbr (cr1) h'0000 0000 (c bit = 0) spi (cr2) indeterminate spu (cr3) indeterminate bpc (cr6) indeterminate pc h'0000 0000 (executed beginning with address h'0000 0000) (note) acc (accumulator) indeterminate note: when in boot mode, this changes to the start address of the boot program space (h'8000 0000). 7 7-4 32170/32174 group user's manual (rev. 2.1) reset 7.3 internal state immediately after reset release pin name single chip external extension microprocessor boot reset, mod0, mod1, and fp input input input input port input input input input hi-z p00 - p07, p10 - p17, p61 - p67, p70 - p77, p82 - p87, p93 - p97, p100 - p107, p110 - p117, p124 - p127, p130 - p137, p140 - p147, p150 - p157, p160 - p167, p172 - p177, p180 - p187, p190 - p197, p200 - p203, p210 - p217, p220 - p225 ad0in0 - 7 ad1in0 - 7 input input input input input input input jtag jtdo input input input input indeterminate indeterminate indeterminate indeterminate jtdi, jtms, jtck, jtrst mode p20 - p27, p30 - p37, p41 - p47 a-d converter xin xout vcnt (note 1) input input input input output output output output ?? ? ? dbi event[0:1] trclk trsync (note 4) trdata[0:7] (note 3) (note 4) (note 4) (note 4) (note 4) indeterminate indeterminate indeterminate indeterminate high output high output high output high output low-level output low-level output low-level output low-level output low-level output low-level output low-level output low-level output high-level output high-level output high-level output high-level output (note 2) table 7.3.2 pin status when reset note 1: the vcnt pin is used to control the pll circuit. note 2: the jtag pin is not initialized by a reset. it can be reset by pulling jtrst low. note 3: the dbi pin is pulled high internally. note 4: this applies only when using 255fbag (not available when using 240qfp). 7 7-5 32170/32174 group user's manual (rev. 2.1) reset 7.4 things to be considered after reset release 7.4 things to be considered after reset release ? input/output ports after reset release, the 32170's and 32174's input/output ports are disabled against input in order to prevent current from flowing through the port. to use any ports in input mode, enable them for input using the port input function enable register (pien) pien0 bit. for details, refer to section 8.3, "input/output port related registers." 7 7-6 32170/32174 group user's manual (rev. 2.1) reset 7.4 things to be considered after reset release ? this is a blank page. ? chapter 8 chapter 8 input/output ports and pin functions 8.1 outline of input/output ports 8.2 selecting pin functions 8.3 input/output port related registers 8.4 port peripheral circuits 8.5 precautions on input/output ports 8 8-2 32170/32174 group user's manual (rev. 2.1) 8.1 outline of input/output ports this microcomputer has a total of 157 input/output ports from p0 to p22 (of which p5 is reserved for future use, however). these input/output ports can be set for input or output mode by a direction register. each input/output port serves as a dual-function or triple-function pin, sharing the pin with other internal peripheral i/o or extended external bus signal line. pin functions are selected depending on the device's operation mode you choose or by setting the input/output port's operation mode register. (if any internal peripheral i/o has still another function, you need to set the register provided for that peripheral i/o.) as a new function, the 32170 internally contains a port input function enable bit that can be used to prevent current from flowing into the input ports. this helps to simplify the software and hardware processing to be performed immediately after reset or during flash rewrite. to use any ports in input mode, you need to set the port input function enable bit accordingly. the input/output ports are outlined in the next pages. input/output ports and pin functions 8.1 outline of input/output ports 8 8-3 32170/32174 group user's manual (rev. 2.1) p3 : p30 - p37 (8 lines) p4 : p41 - p47 (7 lines) p6 : p61 - p67 (7 lines) p7 : p70 - p77 (8 lines) p8 : p82 - p87 (6 lines) p9 : p93 - p97 (5 lines) p10 : p100 - p107 (8 lines) p11 : p110 - p117 (8 lines) p12 : p124 - p127 (4 lines) p13 : p130 - p137 (8 lines) p14 : p140 - p147 (8 lines) p15 : p150 - p157 (8 lines) p16 : p160 - p167 (8 lines) p17 : p172 - p177 (6 lines) p18 : p180 - p187 (8 lines) p19 : p190 - p197 (8 lines) p20 : p200 - p203 (4 lines) p21 : p210 - p217 (8 lines) p22 : p220 - p225 (6 lines) port function the input/output ports can individually be set for input or output mode using the ___ direction control register provided for each input/output port. (however, p64 is an sbi input-only port and p221 is a can input-only port.) pin function shared with peripheral i/o or extended external signals to serve dual functions (or with two or more peripheral i/o functions to serve multiple functions) pin function switchover p0 - p4, p224, p225 : depends on cpu operation mode (determined by setting mod0 and mod1 pins) p6 - p22 : as set by each input/output port's operation mode register (however, peripheral i/o pin functions are selected by peripheral i/o registers.) input/output ports and pin functions 8.1 outline of input/output ports table 8.1.1 outline of input/output ports item specification number of ports total 157 lines p0 : p00 - p07 (8 lines) p1 : p10 - p17 (8 lines) p2 : p20 - p27 (8 lines) 8 8-4 32170/32174 group user's manual (rev. 2.1) input/output ports and pin functions 8.2 selecting pin functions 8.2 selecting pin functions each input/output port serves dual functions sharing the pin with other internal peripheral i/o or extended external bus signal line (or triple functions sharing the pin with two or more peripheral i/o functions). pin functions are selected depending on the device's operation mode you choose or by setting the input/output port's operation mode register. p0-p4, p224, and p225, when the cpu is set to operate in extended external mode or processor mode, all are switched to serve as signal pins for external access. the cpu operation mode is determined by setting the mod0 and mod1 pins (see the table below). table 8.2.1 cpu operation mode and pin functions of p0-p4, p224, and p225 mod0 mod1 operation mode pin functions of p0-p4, p224, and p225 vss vss single-chip mode input/output port pin vss vcce extended external mode extended external signal pin vcce vss processor mode vcce vcce reserved (use inhibited) note: vcce and vss are connected to +5 v and gnd, respectively. p6-p22 (except p64, p221, p224, and p225) have their pin functions switched between input/ output port pins and internal peripheral i/o pins by setting each port's operation mode register. if any internal peripheral i/o has multiple pin functions, you need to set the register provided for that peripheral i/o to select the desired pin function. note that settings of fp pin and mod1 pin during internal flash memory write operation do not affect the pin functions. 8 8-5 32170/32174 group user's manual (rev. 2.1) input/output ports and pin functions 8.2 selecting pin functions figure 8.2.1 input/output ports and pin function assignments note 1: pin functions are switched over by setting mod0 and mod1 pins. note 2: pin functions are switched over by setting mod0 and mod1 pins. also, use of this pin requires caution because it has a debug event function. p0 p1 p2 p3 p4 p6 p7 p8 p9 p10 p11 p12 p13 p14 p15 p5 db0 012 3456 7 db1 db2 db3 db4 db5 db6 db7 db8 db9 db10 db11 db12 db13 db14 db15 a23 a24 a25 a26 a27 a28 a29 a30 a15 a16 a17 a18 a19 a20 a21 a22 blw/ ble bhw/ bhe rd cs0 cs1 a13 a14 (p61) (p62) (p63) sbi sclki4/ sclko4 adtrg bclk/ wr wait hreq hack rtdtxd rtdrxd rtdack rtdclk txd0 rxd0 sclki0/ sclko0 txd1 rxd1 sclki1/ sclko1 to16 to17 to18 to19 to20 to11 to12 to13 to14 to15 to10 to9 to8 to3 to4 to5 to6 to7 to2 to1 to0 tclk0 tclk1 tclk2 tclk3 tin16 tin17 tin18 tin19 tin20 tin21 tin22 tin23 tin8 tin9 tin10 tin11 tin12 tin13 tin14 tin15 tin0 tin1 tin2 tin3 tin4 tin5 tin6 tin7 settings of cpu operation mode (note 1) (reserved) settings of input/ output port operation mode register p16 to21 to22 to23 to24 to25 to26 to27 to28 p17 tin24 tin25 txd2 rxd2 txd3 rxd3 p18 p19 to29 to30 to31 to32 to33 to34 to35 to36 p20 txd4 rxd4 rxd5 p21 to37 to38 to39 to40 to41 to42 to43 to44 p22 ctx crx (p222) (p223) a11 (note 2) a12 (note 2) tin26 tin27 tin28 tin29 tin30 tin31 tin32 tin33 txd5 sclki5/ sclko5 8 8-6 32170/32174 group user's manual (rev. 2.1) input/output ports and pin functions 8.3 input/output port related registers 8.3 input/output port related registers included in the 32170 as input/output port related registers are the port data registers, port direction registers, and port operation mode registers. of these, the port operation mode registers are provided for only p6-p22. ports p0-p4, p224, and p225 have their pin functions determined by setting the cpu operation mode (fp, mod0, and mod1 pins). port p5 is reserved for future use. the tables below show an input/output port related register map. figure 8.3.1 input/output port related register map (1/2) address d0 d7 +0 address d8 d15 blank addresses are reserved. p1 data register (p1data) p3 data register (p3data) p7 data register (p7data) p9 data register (p9data) p11 data register (p11data) p13 data register (p13data) p15 data register (p15data) p1 direction register (p1dir) p3 direction register (p3dir) p7 direction register (p7dir) p9 direction register (p9dir) p11 direction register (p11dir) p17 data register (p17data) p19 data register (p19data) p21 data register (p21data) p13 direction register (p13dir) p15 direction register (p15dir) p17 direction register (p17dir) p19 direction register (p19dir) p21 direction register (p21dir) h'0080 0700 h'0080 0702 h'0080 0704 h'0080 0706 h'0080 0708 h'0080 070a h'0080 070c h'0080 070e h'0080 0720 h'0080 0722 h'0080 0724 h'0080 0726 h'0080 0728 h'0080 072a h'0080 072c h'0080 072e h'0080 0710 h'0080 0730 h'0080 0712 h'0080 0714 h'0080 0716 h'0080 0732 h'0080 0734 h'0080 0736 p0 data register (p0data) p2 data register (p2data) p4 data register (p4data) p6 data register (p6data) p8 data register (p8data) p10 data register (p10data) p12 data register (p12data) p14 data register (p14data) p0 direction register (p0dir) p2 direction register (p2dir) p4 direction register (p4dir) p6 direction register (p6dir) p8 direction register (p8dir) p10 direction register (p10dir) p16 data register (p16data) p18 data register (p18data) p20 data register (p20data) p22 data register (p22data) p12 direction register (p12dir) p14 direction register (p14dir) p16 direction register (p16dir) p18 direction register (p18dir) p20 direction register (p20dir) p22 direction register (p22dir) +1 address 8 8-7 32170/32174 group user's manual (rev. 2.1) 8.3.2 input/output port related register map (2/2) input/output ports and pin functions 8.3 input/output port related registers p7 operation mode register (p7mod) p9 operation mode register (p9mod) p11 operation mode register (p11mod) p13 operation mode register (p13mod) p15 operation mode register (p15mod) p17 operation mode register (p17mod) port input function enable register (pien) p19 operation mode register (p19mod) p21 operation mode register (p21mod) p6 operation mode register (p6mod) p8 operation mode register (p8mod) p10 operation mode register (p10mod) p12 operation mode register (p12mod) p14 operation mode register (p14mod) p16 operation mode register (p16mod) p18 operation mode register (p18mod) p20 operation mode register (p20mod) p22 operation mode register (p22mod) h'0080 0746 h'0080 0748 h'0080 074a h'0080 074c h'0080 074e h'0080 0750 h'0080 0744 h'0080 0752 h'0080 0754 h'0080 0756 blank addresses are reserved. address d0 d7 +0 address d8 d15 +1 address 8 8-8 32170/32174 group user's manual (rev. 2.1) 8.3.1 port data registers p0 data register (p0data) 8 8-9 32170/32174 group user's manual (rev. 2.1) input/output ports and pin functions 8.3 input/output port related registers 8 8-10 32170/32174 group user's manual (rev. 2.1) 8.3.2 port direction registers p0 direction register (p0dir) 8 8-11 32170/32174 group user's manual (rev. 2.1) input/output ports and pin functions 8.3 input/output port related registers 8 8-12 32170/32174 group user's manual (rev. 2.1) 8.3.3 port operation mode registers p6 operation mode register (p6mod) 8 8-13 32170/32174 group user's manual (rev. 2.1) input/output ports and pin functions 8.3 input/output port related registers p7 operation mode register (p7mod) 8 8-14 32170/32174 group user's manual (rev. 2.1) p8 operation mode register (p8mod) 8 8-15 32170/32174 group user's manual (rev. 2.1) input/output ports and pin functions 8.3 input/output port related registers p9 operation mode register (p9mod) 8 8-16 32170/32174 group user's manual (rev. 2.1) input/output ports and pin functions 8.3 input/output port related registers p10 operation mode register (p10mod) 8 8-17 32170/32174 group user's manual (rev. 2.1) input/output ports and pin functions 8.3 input/output port related registers p11 operation mode register (p11mod) 8 8-18 32170/32174 group user's manual (rev. 2.1) input/output ports and pin functions 8.3 input/output port related registers p12 operation mode register (p12mod) 8 8-19 32170/32174 group user's manual (rev. 2.1) input/output ports and pin functions 8.3 input/output port related registers p13 operation mode register (p13mod) 8 8-20 32170/32174 group user's manual (rev. 2.1) input/output ports and pin functions 8.3 input/output port related registers p14 operation mode register (p14mod) 8 8-21 32170/32174 group user's manual (rev. 2.1) input/output ports and pin functions 8.3 input/output port related registers p15 operation mode register (p15mod) 8 8-22 32170/32174 group user's manual (rev. 2.1) input/output ports and pin functions 8.3 input/output port related registers p16 operation mode register (p16mod) 8 8-23 32170/32174 group user's manual (rev. 2.1) input/output ports and pin functions 8.3 input/output port related registers p17 operation mode register (p17mod) 8 8-24 32170/32174 group user's manual (rev. 2.1) input/output ports and pin functions 8.3 input/output port related registers p18 operation mode register (p18mod) 8 8-25 32170/32174 group user's manual (rev. 2.1) input/output ports and pin functions 8.3 input/output port related registers p19 operation mode register (p19mod) 8 8-26 32170/32174 group user's manual (rev. 2.1) input/output ports and pin functions 8.3 input/output port related registers p20 operation mode register (p20mod) 8 8-27 32170/32174 group user's manual (rev. 2.1) input/output ports and pin functions 8.3 input/output port related registers p21 operation mode register (p21mod) 8 8-28 32170/32174 group user's manual (rev. 2.1) input/output ports and pin functions 8.3 input/output port related registers p22 operation mode register (p22mod) 8 8-29 32170/32174 group user's manual (rev. 2.1) input/output ports and pin functions 8.3 input/output port related registers port input function enable register (pien) 8 8-30 32170/32174 group user's manual (rev. 2.1) input/output ports and pin functions 8.3 input/output port related registers mode name controllable pins noncontrollable pins p00 - p07, p10 - p17, p20 - p27 p64, p221, fp p30 -p37 , p41 - p47, p61 - p63 single chip p65 - p67, p70 - p77, p82 - p87 p93 - p97, p100 - p107, p110 - p117 p124 - p127, p130 - p137, p140 - p147 p150 - p157, p160 - p167, p172 - p177 p180 - p187, p190 - p197, p200 - p203 p210 - p217, p220, p222 - p225 p61 - p63, p65 - p67, p70 - p77 p00 - p07, p10 - p17 p82 - p87, p93 -p97, p100 - p107 p20 - p27, p30 - p37 extended external p110 - p117, p124 - p127, p130 - p137 p41 - p47, p64, p221, p224 microprocessor p140 - p147, p150 - p157, p160 - p167 p225, fp p172 - p177, p180 - p187, p190 - p197 p200 - p203, p210 - p217, p220 p222 - p223 p00 - p07, p10 - p17, p20 - p27 p64, p65, p66, p82 - p87 p30 -p37 , p41 - p47, p61 - p63 p174 - p177, p200 - p203 boot (single chip) p67, p70 - p77, p93 - p97 p221, fp p100 - p107, p110 - p117, p124 - p127 p130 - p137, p140 - p147, p150 - p157 p160 - p167, p172 - p173, p180 - p187 p190 - p197, p210 - p217, p220 p222 - p225 8 8-31 32170/32174 group user's manual (rev. 2.1) input/output ports and pin functions 8.4 port peripheral circuits 8.4 port peripheral circuits figures 8.4.1 through 8.4.4 show the peripheral circuit diagrams of the input/output ports described in the preceding pages. figure 8.4.1 port peripheral circuit diagram (1) note 2: denotes pins. note 3: indicates a parasitic diode. make sure the voltages applied to each port do not exceed vcce. note 4: the input capacitance of each pin is approximately 10 pf. note 1: ports p00-p07, p10-p17, p20-p27, p30-p37, p41-p47, and p224-p225 when operating in extended external mode or processor mode, function as external bus interface control signals, but their functional description in this block diagram is omitted. p00 - p07 (db0-db7) p10 - p17 (db8-db15) p20 - p27 (a23-a30) p30 - p37 (a15-a22) ___ ___ p41 (blw / ble) ___ ___ p42 (bhw / bhe) __ p43 (rd) ___ p44 (cs0) ___ p45 (cs1) p46 - p47 (a13-a14) p61 - p63 p224 - p225 (a11-a12) p222 - p223 _____ p67 (adtrg) p75 (rtdrxd) p77 (rtdclk) p83 (rxd0) p86 (rxd1) p124 - p127 (tclk0-tclk3) p130 - p137 (tin16-tin23) p140 - p147 (tin8-tin15) p150 - p157 (tin0-tin7) p172, p173 (tin24, tin25) p175 (rxd2) p177 (rxd3) p190 - p197 (tin26-tin33) p201 (rxd4) p203 (rxd5) data bus (db0 - db15) operation mode register port output latch direction register input function enable peripheral function input data bus (db0 - db15) port output latch direction register input function enable 8 8-32 32170/32174 group user's manual (rev. 2.1) input/output ports and pin functions 8.4 port peripheral circuits figure 8.4.2 port peripheral circuit diagram (2) note 1: denotes pins. note 2: indicates a parasitic diode. make sure the voltages applied to each port do not exceed vcce. note 3: the input capacitance of each pin is approximately 10 pf. ___ p64 (sbi) p221 / crx ____ p72 (hreq) sbi operation mode register hreq data bus (db0 - db15) port output latch direction register input function enable data bus (db0 - db15) 8 8-33 32170/32174 group user's manual (rev. 2.1) input/output ports and pin functions 8.4 port peripheral circuits figure 8.4.3 port peripheral circuit diagram (3) note 1: denotes pins. note 2: indicates a parasitic diode. make sure the voltages applied to each port do not exceed vcce. note 3: the input capacitance of each pin is approximately 10 pf. ____ p71 (wait) __ p70 (bclk / wr) ____ p73 (hack) p74 (rtdtxd) p76 (rtdack) p82 (txd0) p85 (txd1) p93 - p97 (to16-to20) p100 - p107 (to8-to15) p110 - p117 (to0-to7) p160 - p167 (to21-to28) p174 (txd2) p176 (txd3) p180 - p187 (to29-to36) p200 (txd4) p202 (txd5) p210 - p217 (to37-to44) p220 (ctx) wait data bus (db0 - db15) operation mode register port output latch direction register input function enable peripheral function input data bus (db0 - db15) port output latch direction register input function enable operation mode register 8 8-34 32170/32174 group user's manual (rev. 2.1) input/output ports and pin functions 8.4 port peripheral circuits figure 8.4.4 port peripheral circuit diagram (4) note 1: denotes pins. note 2: indicates a parasitic diode. make sure the voltages applied to each port do not exceed vcce. p84(sclki0,sclko0) p87(sclki1,sclko1) p65(sclki4,sclko4) p66(sclki5,sclko5) operation mode register direction register port output latch data bus (db0 - db15) sclkii input uart/csio function select bit internal/external clock select bit sclkoi output osc-vcc vcci vcce vdd osc-vcc, vcci, vcce, vdd input function enable mod0 mod1 mod0, mod1 fp fp jtdi jtck jtms jtdi, jtck, jtms jtdo jtdo reset xin jtrst reset, xin, jtrst 8 8-35 32170/32174 group user's manual (rev. 2.1) input/output ports and pin functions 8.5 precautions on input/output ports 8.5 precautions on input/output ports ?when using the ports in output mode because the port data register values immediately after a reset are indeterminate, it is necessary that the initial value be written to the port data register before setting the port direction register for output. conversely, if the port direction register is set for output before writing to the port data register, indeterminate values will be output for a while until the initial value is set in the port data register. 8 8-36 32170/32174 group user's manual (rev. 2.1) ? this is a blank page. ? input/output ports and pin functions 8.5 precautions on input/output ports chapter 9 chapter 9 dmac 9.1 outline of the dmac 9.2 dmac related registers 9.3 functional description of the dmac 9.4 precautions about the dmac 9 9-2 32170/32174 group user's manual (rev. 2.1) 9.1 outline of the dmac this microcomputer contains a 10 channel-dma (direct memory access) controller. it allows you to transfer data at high speed between internal peripheral i/os, between internal ram and internal peripheral i/o, and between internal rams, as requested by a software trigger or from an internal peripheral i/o. table 9.1.1 outline of the dmac item description number of channel 10 channels transfer request ?software trigger ?request from internal peripheral i/os: a-d converter,multijunction timer, serial i/o (reception completed, transmit buffer empty) ?transfer operation can be cascaded between dma channels (note) maximum number 256 times of times transferred transferable ?64 kbytes (address space from h'0080 0000 to h'0080 ffff) address space ?transfers between internal peripheral i/os, between internal ram and internal peripheral i/o, between internal rams are supported transfer data size 16 or 8 bits transfer method single transfer dma (control of the internal bus is relinquished for each transfer performed), dual-address transfer transfer mode single transfer mode direction of transfer one of three modes can be selected for the source and destination: ?address fixed ?address incremental ?ring buffered channel priority channel 0 > channel 1 > channel 2 > channel 3 > channel 4 > channel 5 > channel 6 >channel 7 > channel 8 > channel 9 (priority is fixed) maximum transfer rate 13.3 mbytes per second (with 20 mhz internal peripheral clock) interrupt request group interrupt request can be generated when each transfer count register underflows. transfer area 64 kbytes from h'0080 0000 to h'0080 ffff (transferable in the entire internal ram/sfr area) note: transfer operation can be cascaded between dma channels as shown below. completion of one transfer in channel 0 starts dma transfer in channel 1 completion of one transfer in channel 1 starts dma transfer in channel 2 completion of one transfer in channel 2 starts dma transfer in channel 0 completion of one transfer in channel 3 starts dma transfer in channel 4 completion of one transfer in channel 5 starts dma transfer in channel 6 completion of one transfer in channel 6 starts dma transfer in channel 7 completion of one transfer in channel 7 starts dma transfer in channel 5 completion of one transfer in channel 8 starts dma transfer in channel 9 completion of all dma transfers in channel 0 (transfer count register underflow) starts dma transfer in channel 5 dmac 9.1 outline of the dmac 9 9-3 32170/32174 group user's manual (rev. 2.1) dmac 9.1 outline of the dmac figure 9.1.1 block diagram of the dmac dma request selector a-d0 conversion completed dma channel 0 software start mjt (tin13 input signal) one dma0 transfer completed internal bus software start software start serial i/o0 (reception completed) one dma2 transfer completed one dma3 transfer completed mjt (tio8_udf) mjt (input event bus 2) mjt (output event bus 0) mjt (tin19 input signal) software start mjt (tin18 input signal) one dma1 transfer completed mjt (output event bus 1) software start serial i/o0 (transmit buffer empty) serial i/o1 (reception completed) source address register destination address register determination block dma start mjt (tin0 input signal) all dma0 transfers completed (udf) software start mjt (tin1 input signal) one dma5 transfer completed software start one dma7 transfer completed serial i/o2 (reception completed) mjt (tin20 input signal) serial i/o1 (transmit buffer empty) software start mjt (tin2 input signal) one dma6 transfer completed serial i/o2 (transmit buffer empty) software start mjt (input event bus 0) serial i/o3 (reception completed) mjt (tin7 input signal) source destination transfer count interrupt request internal bus arbitration software start mjt (tin8 input signal) one dma8 transfer completed serial i/o3 (transmit buffer empty) transfer count register udf dma request selector dma channel 1 udf source destination transfer count dma request selector dma channel 2 udf source destination transfer count dma request selector dma channel 3 udf source destination transfer count dma request selector dma channel 4 udf source destination transfer count dma request selector dma channel 5 udf source destination transfer count dma request selector dma channel 6 udf source destination transfer count dma request selector dma channel 7 udf source destination transfer count dma request selector dma channel 8 udf source destination transfer count dma request selector dma channel 9 udf determination block dma start internal bus arbitration interrupt request 9 9-4 32170/32174 group user's manual (rev. 2.1) dmac 9.2 dmac related registers 9.2 dmac related registers the diagram below shows a memory map of dmac related registers. figure 9.2.1 dmac related register map (1/2) address d0 d7 +0 address +1 address d8 d15 note: the re g isters enclosed in thick frames can onl y be accessed in halfwords. dma0-4 interrupt request status register (dm04itst) h'0080 0400 h'0080 0414 h'0080 0416 h'0080 0418 h'0080 0410 h'0080 0412 h'0080 0422 h'0080 0424 h'0080 0426 h'0080 0428 h'0080 042a h'0080 0420 h'0080 0432 h'0080 0434 h'0080 0436 h'0080 0438 h'0080 043a h'0080 0430 h'0080 0408 h'0080 042c h'0080 042e h'0080 043c h'0080 043e h'0080 041a h'0080 041c h'0080 041e blank addresses are reserved. dma0 source address register (dm0sa) dma0 destination address register (dm0da) dma0-4 interrupt mask register (dm04itmk) dma5-9 interrupt request status register (dm59itst) dma5-9 interrupt mask register (dm59itmk) dma0 channel control register (dm0cnt) dma0 transfer count register (dm0tct) dma5 source address register (dm5sa) dma5 destination address register (dm5da) dma5 channel control register (dm5cnt) dma5 transfer count register (dm5tct) dma1 source address register (dm1sa) dma1 destination address register (dm1da) dma1 channel control register (dm1cnt) dma1 transfer count register (dm1tct) dma6 source address register (dm6sa) dma6 destination address register (dm6da) dma6 channel control register (dm6cnt) dma6 transfer count register (dm6tct) dma2 source address register (dm2sa) dma2 destination address register (dm2da) dma2 channel control register (dm2cnt) dma2 transfer count register (dm2tct) dma7 source address register (dm7sa) dma7 destination address register (dm7da) dma7 channel control register (dm7cnt) dma7 transfer count register (dm7tct) 9 9-5 32170/32174 group user's manual (rev. 2.1) dmac 9.2 dmac related registers figure 9.2.2 dmac related register map (2/2) address d0 d7 +0 address +1 address d8 d15 note: the registers enclosed in thick frames can only be accessed in halfwords. h'0080 0440 h'0080 044c h'0080 044e h'0080 0450 h'0080 0448 h'0080 044a h'0080 045a h'0080 045c h'0080 045e h'0080 0460 h'0080 0462 h'0080 0458 h'0080 0470 h'0080 0472 h'0080 0474 h'0080 0476 h'0080 0468 h'0080 0444 h'0080 0464 h'0080 0466 h'0080 0478 h'0080 0452 h'0080 0454 h'0080 0456 blank addresses are reserved. dma3 source address register (dm3sa) dma3 destination address register (dm3da) dma3 channel control register (dm3cnt) dma3 transfer count register (dm3tct) dma8 source address register (dm8sa) dma8 destination address register (dm8da) dma8 channel control register (dm8cnt) dma8 transfer count register (dm8tct) dma4 source address register (dm4sa) dma4 destination address register (dm4da) dma4 channel control register (dm4cnt) dma4 transfer count register (dm4tct) dma9 source address register (dm9sa) dma9 destination address register (dm9da) dma9 channel control register (dm9cnt) dma9 transfer count register (dm9tct) dma0 software request generation register (dm0sri) h'0080 0442 h'0080 0446 dma1 software request generation register (dm1sri) dma2 software request generation register (dm2sri) dma3 software request generation register (dm3sri) dma4 software request generation register (dm4sri) dma5 software request generation register (dm5sri) dma6 software request generation register (dm6sri) dma7 software request generation register (dm7sri) dma8 software request generation register (dm8sri) dma9 software request generation register (dm9sri) 9 9-6 32170/32174 group user's manual (rev. 2.1) dmac 9.2 dmac related registers 9.2.1 dma channel control register dma0 channel control register (dm0cnt) 9 9-7 32170/32174 group user's manual (rev. 2.1) dmac 9.2 dmac related registers dma1 channel control register (dm1cnt) 9 9-8 32170/32174 group user's manual (rev. 2.1) dmac 9.2 dmac related registers dma2 channel control register (dm2cnt) 9 9-9 32170/32174 group user's manual (rev. 2.1) dmac 9.2 dmac related registers dma3 channel control register (dm3cnt) 9 9-10 32170/32174 group user's manual (rev. 2.1) dmac 9.2 dmac related registers dma4 channel control register (dm4cnt) 9 9-11 32170/32174 group user's manual (rev. 2.1) dmac 9.2 dmac related registers dma5 channel control register (dm5cnt) 9 9-12 32170/32174 group user's manual (rev. 2.1) dmac 9.2 dmac related registers dma6 channel control register (dm6cnt) 9 9-13 32170/32174 group user's manual (rev. 2.1) dmac 9.2 dmac related registers dma7 channel control register (dm7cnt) 9 9-14 32170/32174 group user's manual (rev. 2.1) dmac 9.2 dmac related registers dma8 channel control register (dm8cnt) 9 9-15 32170/32174 group user's manual (rev. 2.1) dmac 9.2 dmac related registers dma9 channel control register (dm9cnt) 9 9-16 32170/32174 group user's manual (rev. 2.1) dmac 9.2 dmac related registers the dma channel control register consists of bits to select dma transfer mode in each channel, set dma transfer request flag, and the bits to select the cause of dma request, enable dma transfer, and set the transfer size and the source/destination address directions. (1) mdseln (dman transfer mode select) bit (d0) this bit when in single transfer mode selects normal mode or ring buffer mode. normal mode is selected by setting this bit to 0 or ring buffer mode is selected by setting it to 1. in ring buffer mode, transfer begins from the transfer start address and after performing transfers 32 times, control is recycled back to the transfer start address, from which transfer operation is repeated. in this case, the transfer count register counts in free-run mode during which time transfer operation is continued until the transfer enable bit is reset to 0 (to disable transfer). no interrupt is generated at completion of dma transfer. (2) treqfn (dman transfer request flag) bit (d1) this flag is set to 1 when a dma transfer request occurs. reading this flag helps to know dma transfer requests in each channel. the generated dma request is cleared by writing a 0 to this bit. if you write a 1, the value you wrote is ignored and the bit retains its previous value. if a new dma transfer request is generated for a channel whose dma transfer request flag has already been set to 1, the next dma transfer request is not accepted until the transfer under way in that channel is completed. (3) reqsln (cause of dman request select) bits (d2, d3) these bits select the cause of dma request in each dma channel. (4) tenln (dman transfer enable) bit (d4) transfer is enabled by setting this bit to 1, so that the channel is ready for dma transfer. conversely, transfer is disabled by setting this bit to 0. however, if a transfer request has already been accepted, transfer in that channel is not disabled until after the requested transfer is completed. (5) tszsln (dman transfer size select) bit (d5) this bit selects the number of bits to be transferred in one dma transfer operation (unit of one transfer). the unit of one transfer is 16 bits when tszsl = 0 or 8 bits when tszsl = 1. (6) sadsln (dman source address direction select) bit (d6) this bit selects the direction in which the source address changes as transfer proceeds. this mode can be selected from two choices: address fixed or address incremental. (7) dadsln (damn destination address direction select) bit (d7) this bit selects the direction in which the destination address changes as transfer proceeds. this mode can be selected from two choices: address fixed or address incremental. 9 9-17 32170/32174 group user's manual (rev. 2.1) dmac 9.2 dmac related registers 9.2.2 dma software request generation registers dma0 software request generation register (dm0sri) 9 9-18 32170/32174 group user's manual (rev. 2.1) dmac 9.2 dmac related registers 9.2.3 dma source address registers dma0 source address register (dm0sa) 9 9-19 32170/32174 group user's manual (rev. 2.1) dmac 9.2 dmac related registers 9.2.4 dma destination address registers dma0 destination address register (dm0da) 9 9-20 32170/32174 group user's manual (rev. 2.1) dmac 9.2 dmac related registers 9.2.5 dma transfer count registers dma0 transfer count register (dm0tct) |