Part Number Hot Search : 
1212A BD9328 ISL28113 PC567 H0G50 TP3055 74F40 AI1003
Product Description
Full Text Search
 

To Download HD6432223XXXFA Datasheet File

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


  Datasheet File OCR Text:
  2003.5.30 16 h8s/2239, h8s/2238, h8s/2237, h8s/2227 group hardware manual renesas 16-bit single-chip microcomputer h8s family/h8s/2200 series rev.2.00

renesas 16-bit single-chip microcomputer h8s family/h8s/2200 series h8s/2239, h8s/2238, h8s/2237, h8s/2227 group hardware manual rej09b0054-0200o
rev. 2.00, 05/03, page iv of lxii cautions keep safety first in your circuit designs! 1. renesas technology corporation puts the maximum effort into making semiconductor products 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 appropriate measures such as (i) placement of substitutive, auxiliary circuits, (ii) use of nonflammable material or (iii) prevention against any malfunction or mishap. notes regarding these materials 1. these materials are intended as a reference to assist our customers in the selection of the renesas technology corporation product best suited to the customer's application; they do not convey any license under any intellectual property rights, or an y other rights, belonging to renesas technology corporation or a third party. 2. renesas technology 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 i n these materials. 3. all information contained in these materials, including product data, diagrams, charts, programs and algorithms represents information on products at the time of publication of these materials, and are subject to change by renesas technology corporation without notice due to product improvements or other reasons. it is therefore recommended that customers contact renesas technology corporation or an authorized renesas technology corporation product distributor for the latest product information before purchasing a product listed herein. the information described here may contain technical inaccuracies or typographical errors. renesas technology 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 renesas technology corporation by various means, including the renesas technology corporation semiconductor home page (http://www.renesas.com). 4. when using any or all of the information contained in these materials, including product data, diagrams, charts, programs, an d algorithms, please be sure to evaluate all information as a total system before making a final decision on the applicability of the information and products. renesas technology corporation assumes no responsibility for any damage, liability or other loss resulting from the information contained herein. 5. renesas technology 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 renesas technology corporation or an authorized renesas technology corporation 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. 6. the prior written approval of renesas technology corporation is necessary to reprint or reproduce in whole or in part these materials. 7. if these products or technologies are subject to the japanese export control restrictions, they must be exported under a lice nse from the japanese government and cannot be imported 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. 8. please contact renesas technology corporation for further details on these materials or the products contained therein.
rev. 2.00, 05/03, page v of lxii general precautions on handling of product 1. treatment of nc pins note: do not connect anything to the nc pins. the nc (not connected) pins are either not connected to any of the internal circuitry or are used as test pins or to reduce noise. if something is connected to the nc pins, the operation of the lsi is not guaranteed. 2. treatment of unused input pins note: fix all unused input pins to high or low level. generally, the input pins of cmos products are high-impedance input pins. if unused pins are in their open states, intermediate levels are induced by noise in the vicinity, a pass- through current flows internally, and a malfunction may occur. 3. processing before initialization note: when power is first supplied, the products state is undefined. the states of internal circuits are undefined until full power is supplied throughout the chip and a low level is input on the reset pin. during the period where the states are undefined, the register settings and the output state of each pin are also undefined. design your system so that it does not malfunction because of processing while it is in this undefined state. for those products which have a reset function, reset the lsi immediately after the power supply has been turned on. 4. prohibition of access to undefined or reserved addresses note: access to undefined or reserved addresses is prohibited. the undefined or reserved addresses may be used to expand functions, or test registers may have been be allocated to these addresses. do not access these registers; the systems operation is not guaranteed if they are accessed.
rev. 2.00, 05/03, page vi of lxii configuration of this manual this manual comprises the following items: 1. general precautions on handling of product 2. configuration of this manual 3. preface 4. contents 5. overview 6. description of functional modules ? cpu and system-control modules ? on-chip peripheral modules the configuration of the functional description of each module differs according to the module. however, the generic style includes the following items: i) feature ii) input/output pin iii) register description iv) operation v) usage note when designing an application system that includes this lsi, take notes into account. each section includes notes in relation to the descriptions given, and usage notes are given, as required, as the final part of each section. 7. list of registers 8. electrical characteristics 9. appendix 10. main revisions and additions in this edition (only for revised versions) the list of revisions is a summary of points that have been revised or added to earlier versions. this does not include all of the revised contents. for details, see the actual locations in this manual. 11. index
rev. 2.00, 05/03, page vii of lxii preface the h8s/2239 group, h8s/2238 group, h8s/2237 group, and h8s/2227 group are high- performance microcomputers made up of the internal 32-bit configuration h8s/2000 cpu as their cores, and the peripheral functions required to configure a system. a single-power flash memory (f-ztat tm * ) version and masked rom version are available for these lsis' rom. these versions provide flexibility as they can be reprogrammed in no time to cope with all situations from the early stages of mass production to full-scale mass production. this is particularly applicable to application devices of which the specifications frequently changeable. on-chip peripheral functions of each microcomputer are summarized below. note: * f-ztat tm is a trademark of renesas technology corp.
rev. 2.00, 05/03, page viii of lxii list of on-chip peripheral functions group name h8s/2239 group h8s/2238 group h8s/2237 group h8s/2227 group microcomputer h8s/2239 h8s/2238b h8s/2238r h8s/2236b h8s/2236r h8s/2237 h8s/2235 h8s/2233 h8s/2227 h8s/2225 h8s/2224 h8s/2223 bus controller (bsc) o (16 bits) o (16 bits) o (16bits) o (16 bits) data transfer controller (dtc) oooo dma controller (dmac) o ??? pc break controller (pbc) 2 2 2 2 16-bit timer pulse unit (tpu) 6 6 6 3 8-bit timer (tmr) 4 4 2 2 watchdog timer (wdt) 2 2 2 2 serial communication interface (sci) 4 4 4 3 i 2 c bus interface (iic) 2 (option) 2 (option) ?? d/a converter 2 2 2 ? a/d converter analog input 8 8 8 8 target users: this manual was written for users who will be using the h8s/2239 group, h8s/2238 group, h8s/2237 group, and h8s/2227 group in the design of application systems. target users are expected to understand the fundamentals of electrical circuits, logical circuits, and microcomputers. objective: this manual was written to explain the h8s/2239 group, h8s/2238 group, h8s/2237 group, and h8s/2227 group hardware functions and electrical characteristics of this lsi to the target users. refer to the h8s/2600 series, h8s/2000 series programming manual for a detailed description of the instruction set.
rev. 2.00, 05/03, page ix of lxii notes on reading this manual: ? in order to understand the overall functions of the chip read the manual according to the contents. this manual can be roughly categorized into descriptions on the cpu, system control functions, peripheral functions, and electrical characteristics. ? in order to understand the details of the cpu's functions read the h8s/2600 series, h8s/2000 series programming manual. ? in order to understand the details of a register whole name is already known read the index that is the final part of the manual to find the page number of the entry on the register. the addresses, bits, and initial values of the registers are summarized in section 25, list of registers. rules: register name: the following notation is used for cases when the same or a similar function, e.g., 16-bit timer pulse unit or serial communication, is implemented on more than one channel: xxx_n (xxx is the register name and n is the channel number) bit order: the msb is on the left and the lsb is on the right. number notation: binary is b'xxxx, hexadecimal is h'xxxx, and decimal is xxxx. signal notation: an overbar is added to a low-active signal: xxxx related manuals: the latest versions of all related manuals are available from our web site. please ensure you have the latest versions of all documents. http://www.renesas.com/ h8s/2239 group, h8s/2238 group, h8s/2237 group, h8s/2227 group manuals: manual title ade no. h8s/2239 group, h8s/2238 group, h8s/2237 group, h8s/2227 group hardware manual this manual h8s/2600 series, h8s/2000 series programming manual ade-602-083 user's manuals for development tools: manual title ade no. h8s, h8/300 series c/c++ compiler, assembler, optimizing linkage editor user's manual ade-702-247 h8s, h8/300 series simulator/debugger user's manual ade-702-282 h8s, h8/300 series hi-performance embedded workshop, hdi tutorial ade-702-231 hi-performance embedded workshop user's manual ade-702-201
rev. 2.00, 05/03, page x of lxii
rev. 2.00, 05/03, page xi of lxii main revisions and additions in this edition item page revision (see manual for details) all (before) h8s/2238r group (after) h8s/2238 group 1.1 features 2 ? on-chip memory hd64f2238b, hd6432238b, hd6432238bw, hd6432236b, hd6432236bw lineup added. rom model rom ram remarks hd64f2239 384 kbytes 32 kbytes flash memory version hd64f2238b 256 kbytes 16 kbytes hd64f2238r 256 kbytes 16 kbytes hd64f2227 128 kbytes 16 kbytes prom version hd6472237 128 kbytes 16 kbytes hd6432239 384 kbytes 32 kbytes masked rom version hd6432239w 384 kbytes 32 kbytes hd6432238b 256 kbytes 16 kbytes hd6432238bw 256 kbytes 16 kbytes hd6432238r 256 kbytes 16 kbytes hd6432238rw 256 kbytes 16 kbytes hd6432236b 128 kbytes 8 kbytes hd6432236bw 128 kbytes 8 kbytes 3 ? compact package notes amended. notes: * 1supported only by the h8s/2238b, h8s/2237 group, and h8s/2227 group. * 2 being planned only for the h8s/2238r . 1.3.1 pin arrangement figure 1.7 pin arrangement of h8s/2238 group (fp-100a: top view, only for h8s/2238b) 10 newly added. figure 1.8 pin arrangement of h8s/2238 group (bp-112: top view, only for h8s/2238r, in planning stage) 11 figure title amended.
rev. 2.00, 05/03, page xii of lxii item page revision (see manual for details) 1.3.2 pin arrangements in each mode table 1.1 pin arrangements in each mode of h8s/2239 group 18, 19 flash memory programmable mode information amended for pins 58 and 67. pin no. pin name tfp-100b tfp-100g fp-100b mode 4 mode 5 mode 6 mode 7 flash memory programmable mode 58 osc1osc1osc1osc1vss 67 md2 md2 md2 md2 vss 21 to 25 fp-100a is added in pin no. table 1.2 pin arrangements in each mode of h8s/2238 group 23 flash memory programmable mode information amended for pins 58 and 67. pin no. pin name tfp-100b tfp-100g fp-100b fp-100a bp-112 mode 4 mode 5 mode 6 mode 7 flash memory programmable mode 58 61 h11osc1osc1osc1osc1vss 67 70 e9 md2 md2 md2 md2 vss 36 to 41fp-100a is added in pin no. 1.3.3 pin functions table 1.5 pin functions of h8s/2239 group and h8s/2238r group function of cvcc amended. with a 5-v external power supply (h8s/2238b used) , connect a 0.1-f stabilization capacitance between this pin and ground. permanent damage on the chip may result if the absolute maximum rating of cvcc 4.3 v is exceeded. must not connect the 5 v external power supply to this pin. with a 3-v external power supply (h8s/2239, h8s/2238r used), connect this pin to the system power supply. see section 24, power supply circuit, for connection examples. note on fp-100a added. * 3 supported only by the h8s/2238b. 5.4.1 external interrupts 113 description amended in 12th line. ? using iscr, it is possible to select whether an interrupt is generated by a low level, falling edge, rising edge, or both edges, at irqn pins. 5.5.2 interrupt control mode 0 123 description amended in 2nd line. enabling and disabling of irq interrupts, irq interrupts and on- chip peripheral module interrupts can be set by means of the i bit in the cpu's ccr. 7.4.1 area divisions 151 note * 2 deleted.
rev. 2.00, 05/03, page xiii of lxii item page revision (see manual for details) description deleted in 17th line. when 2-state access space is designated, wait insertion is disabled. . 7.4.2 bus specifications 152 description deleted in 21st line. from 0 to 3 program wait states can be selected. . 7.7 burst rom interface 170 note added. note: when the operating frequency ranges from 16 mhz to 20 mhz, the burst rom interface is not available. 7.9 bus release figure 7.24 bus- released state transition timing 176 figure amended. minimum 1 state back [1] [2] [3] [4] [5] 8.5.2 sequential mode table 8.5 register functions in sequential mode 213 table amended. 0 etcr 15 8.5.3 idle mode table 8.6 register functions in idle mode 216 table amended. 0 etcr 15 8.5.5 single address mode table 8.8 register functions in single address mode 223 table amended. 0 etcr 15 8.5.10 dma transfer (single address mode) bus cycles figure 8.29 example of single address mode transfer (byte write) 245 figure amended. h wr lwr
rev. 2.00, 05/03, page xiv of lxii item page revision (see manual for details) 8.7.2 module stop 256 description amended in 4th line. when the mstp a7 bit in mstpcr a is set to 1, the dmac clock stops, and the module stop state is entered. however, 1 cannot be written to the mstp a7 bit if any of the dmac channels is enabled. 9.2.2 dtc mode register b (mrb) 263 description of bit 7 amended. 0: dtc data transfer completed (waiting for start) 1:dtc chain transfer (reads new register information and transfers data) 9.4 location of register information and dtc vector table table 9.1 interrupt sources, dtc vector addresses, and corresponding dtces 268 table amended. interrupt source origin of interrupt source vector number dtc vector address dtce * 1 external pin irq6 22 h042c dtcea1 irq7 23 h042e dtcea0 a/d converter adi (a/d conversion end) 28 h0438 dtceb6 10.1.4 pin functions 292 p11/tiocb0/ dack1 /a21 note * 3 added. dack1 * 3 p10/tioca0/ dack0 /a20 note * 3 added. dack0 * 3 10.2.4 port 3 open drain control register (p3odr) 295 note added to description of bits 6 to 0. note: * when they are cleared to 0, the corresponding pins function as cmos outputs in the h8s/2237 group and h8s/2227 group. 10.2.5 pin functions 295 note amended. note: * the i 2 c bus interface is not available in the h8s/2237 group and h8s/2227 group. 296 p35/sck1/scl0/ irq5 note * 4 added. when this pin is specified as the p35 output pin or sck1 output pin, it functions as nmos push-pull output. * 4 * 4 it functions as cmos output in the h8s/2237 group and h8s/2227 group. 297 p34/rxd1/sda0 note * 3 added. when this pin is specified as p34 output pin, it functions as nmos push-pull output. * 3 * 3 it functions as cmos output in the h8s/2237 group and h8s/2227 group.
rev. 2.00, 05/03, page xv of lxii item page revision (see manual for details) 10.4.4 pin functions ? p73/tmo1/ tend1 / cs7 ? p72/tmo0/ tend0 / cs6 ? p71/tmri23/ tmci23/ dreq1 / cs5 ? p70/tmri01/ tmci01/ dreq0 / cs4 303, 304 note * added. note: * supported only by the h8s/2239 group. 11.1 features table 11.1 tpu functions 336 description of channel 3 buffer operation amended. item channel 0 channel 1 channel 2 channel 3 * 1 channel 4 * 1 channel 5 * 1 buffer operation o o 12.3.4 timer control register (tcr) 420 description of bits 2 to 0 amended. 100: for channel 0: counted on tcnt1 overflow signal * for channel 1: counted on tcnt0 compare-match a * for channel 2: counted on tcnt3 overflow signal * for channel 3: counted on tcnt2 compare-match a * 12.8.3 contention between tcor write and compare-match figure 12.12 contention between tcor write and compare-match 434 figure amended. address tcor address 14.1 features 454 description amended in 10th line. (before) irq7 (after) irq7 14.3.9 bit rate register (brr) table 14.2 the relationships between the n setting in brr and bit rate b 475 note * added to abcs bit. note: * if the abcs bit is set to 1, sci_0 on the h8s/2239 is the only valid bit rate.
rev. 2.00, 05/03, page xvi of lxii item page revision (see manual for details) 14.3.9 bit rate register (brr) 476 description amended in 9th line. when the abcs bit in semr_0 of sci_0 is set to 1 in asynchronous mode, the maximum bit rate is twice the value shown in tables 14.4 and 14.5 (valid for h8s/2239 only). table 14.3 brr settings for various bit rates (asynchronous mode) 478, 479 values when operating frequency is 17.2032 mhz, 18 mhz, 19.6608 mhz, and 20 mhz added. 480 values when operating frequency is 17.2032 mhz, 18 mhz, 19.6608 mhz, and 20 mhz added. table 14.4 maximum bit rate for each frequency (asynchronous mode) table 14.5 maximum bit rate with external clock input (asynchronous mode) value for 2.097152 (mhz) maximum bit rate (kbps) amended. (before) 327.68 (after) 32.768 values when operating frequency is 17.2032 mhz, 18 mhz, 19.6608 mhz, and 20 mhz added. table 14.6 brr settings for various bit rates (clocked synchronous mode) 481 values when operating frequency is 20 mhz added. table 14.7 maximum bit rate with external clock input (clocked synchronous mode) values when operating frequency is 18 mhz and 20 mhz added. table 14.8 examples of bit rate for various brr settings (smart card interface mode) (when n = 0 and s = 372) table 14.9 maximum bit rate at various frequencies (smart card interface mode) (when s = 372) 482 values when operating frequency is 18.00 mhz and 20.00 mhz added.
rev. 2.00, 05/03, page xvii of lxii item page revision (see manual for details) 14.3.10 serial expansion mode register (semr_0) figure 14.4 example of the internal base clock when the average transfer rate is selected (2) 486 figure amended = 16 mhz average transfer rate when f = 115.196 kbps 14.4.2 receive data sampling timing and reception margin in asynchronous mode 489 formula (1) replaced m = (0.5 ? ) ? (l ? 0.5) f ? (1 + f) 100 [%] 1 2n d ? 0.5 n where m : reception margin (%) n : bit rate ratio relative to clock (n = 16 if abcs = 0; n = 8 if abcs = 1) d : clock duty (d = 0 to 1.0) l : frame length (l = 9 to 12) f : clock frequency deviation absolute value note added in 17th line. note: example with abcs bit in semr0 set to 1. when abcs is set to 1, the clock frequency is 8 times the bit rate and sampling of received data takes place at the fourth rising edge of the basic clock. figure 14.6 receive data sampling timing in asynchronous mode note added note: example with abcs bit in semr0 set to 1. when abcs is set to 1, the clock frequency is 8 times the bit rate and sampling of received data takes place at the fourth rising edge of the basic clock. section 15 i 2 c bus interface (iic) (option) 535 note 2 added. 2. when the power supply voltage ranges from 2.2 v to 2.7 v, the i 2 c bus interface is not available. 15.1 features 536 description amended in 19th line. set the upper limit of voltage applied to the power supply (vcc) power supply range +0.3 v . 15.3.4 i 2 c bus mode register (icmr) table 15.3 i 2 c transfer rate 544 values when operating frequency is 20 mhz added.
rev. 2.00, 05/03, page xviii of lxii item page revision (see manual for details) 15.4.6 iric setting timing and scl control figure 15.11 iric setting timing and scl control 564 figure replaced (a) when wait = 0, and fs = 0 or fsx = 0 (i 2 c bus format, no wait) scl sda iric user processing write to icdr (transmit) or read icdr (receive) clear iric clear iric clear iric 1 a 8 1 1 a 7 1 2 2 2 2 2 2 89 7 (b) when wait = 1, and fs = 0 or fsx = 0 (i 2 c bus format, wait inserted) scl sda iric user processing clear iric write to icdr (transmit) or read icdr (receive) scl sda iric user processing (c) when fs = 1 and fsx = 1 (synchronous serial format) write to icdr (transmit) or read icdr (receive) 8 89 8 7 1 8 7 1 15.4.9 sample flowcharts figure 15.14 sample flowchart for master receive mode 568 figure amended [13] cancel wait mode. read received data. clear iric. (note: after setting wait = 0, iric should be cleared to 0.)
rev. 2.00, 05/03, page xix of lxii item page revision (see manual for details) 15.5 usage notes table 15.7 permissible scl rise time (t sr ) values 572 values when operating frequency is 20 mhz added. note * added in values when operating frequency is 16 mhz and 20 mhz. note * supported only by the h8s/2239 group. description amended in 10th line. the i 2 c bus interface specifications for the scl and sda rise and fall times are under 1000 ns and 300 ns. the i 2 c bus interface scl and sda output timing is prescribed by t cyc , as shown in table 15.6. table 15.8 i 2 c bus timing (with maximum influence of t sr /t sf ) 573 values when operating frequency is 20 mhz added. value or t stoso when = 16 mhz amended. time indication (at maximum transfer rate) [ns] item t cyc indication t sr /t sf influence (max) i 2 c bus specifi- cation (min) = 5 mhz = 8 mhz = 10 mhz = 16 mhz * 3 = 20 mhz * 3 t stoso standard mode 1000 4000 4400 4250 4200 4125 4100 0.5t sclo + 2t cyc (t sr ) high-speed mode 300 600 1350 1200 1150 1075 1050 note * 3 added in values when operating frequency is 16 mhz and 20 mhz. note: * 3 supported only by the h8s/2239 group. 578 description amended in 23rd line. re-execute initialization of the internal state according to the setting of bits clr3 to clr0 or ice bit. 16.1 features 579 description amended in 8th line. ? conversion time: 9.6 s per channel (at 13.5 mhz operation) 19.1 features 605 (before) h8s/2238r: 256 kbytes (after) h8s/2238 : 256 kbytes description amended in 12th and 15th lines. the flash memory of the h8s/2238 is configured as follows: 64 kbytes 3 block, 32 kbytes 1 block, and 4 kbytes 8 blocks. the flash memory of the h8s/2227 is configured as follows: 32 kbytes 2 blocks, 28 kbytes 1 block, 16 kbytes 1 block, 8 kbytes 2 block, and 1 kbyte 4 blocks. figure 19.1 block diagram of flash memory 606 (before) h8s/2238r: 256 kbytes (after) h8s/2238 : 256 kbytes
rev. 2.00, 05/03, page xx of lxii item page revision (see manual for details) 19.2 mode transitions figure 19.2 flash memory state transitions 607 boot mode on-board programming mode user program mode user mode reset state programmer mode res = 0 fwe = 1 fwe = 0 * 1 * 1 * 2 * 3 notes: only make a transition between user mode and user program mode when the cpu is not accessing the flash memory. * 1 ram emulation possible * 2 in the h8s/2239 group and h8s/2238 group, md0 = 0, md1 = 0, md2 = 0, p14 = 0, p16 = 0, pf0 = 1. * 3 in the h8s/2227 group, md0 = 0, md1 = 0, md2 = 0, p14 = 0, p16 = 0, pf0 = 1, pf3 = 1. res = 0 md1 = 1, md2 = 0, fwe = 1 res = 0 res = 0 md1 = 1, md2 = 1, fwe = 0 md1 = 1, md2 = 1, fwe = 1 19.4 input/output pins table 19.2 pin configuration 614 note amended. note: * sci_2 (txd2, txd2) is used for the h8s/2239 and h8s/2238, and sci_0 (txd0, rxd0) for the h8s/2227. 19.6 on-board programming modes table 19.3 setting on-board programming modes 623 note deleted 625 system clock frequency range of this lsi host bit rate h8s/2227, h8s/2238 h8s2239 19,200 bps 8 to 13.5 mhz 8 to 20 mhz 19.6.1 boot mode table 19.5 system clock frequencies for which automatic adjustment of lsi bit rate is possible 9,600 bps 4 to 13.5 mhz 4 to 20 mhz 4,800 bps 2 to 13.5 mhz 2 to 20 mhz
rev. 2.00, 05/03, page xxi of lxii item page revision (see manual for details) 19.7 flash memory emulation in ram 628 description amended in 1st and 3rd lines. (before) eb0 (after) eb 1 (before) a1-byte (after) a1- kbyte 19.9.3 error protection 633 note * added to dmac note: * supported only by h8s/2239 group. 19.11 programmer mode figure 19.13 socket adapter pin correspondence diagram 635 figure amended. this lsi fp-100b,tfp-100b, tfp-100g pin no. pin name 12, 53, 54, 60, 62, 72 * , 75, 99 14, 38, 40,42, 55, 56, 58, 64, 67, 100 v cc v ss fp-100a * 2, 15, 54, 57, 64, 65, 75, 78 3, 17, 41, 43, 45, 58, 59, 61, 67 note amended. note: * supported only by h8s/2238b and h8s/2227 group. 20.1 features 643 product class rom size rom address (modes 6 and 7) h8s/2239 group hd6432239 384 kbytes h'000000 to h'05ffff hd6432238b 256 kbytes h'000000 to h'03ffff h8s/2238 group hd6432236b 128 kbytes h'000000 to h'01ffff hd6432238r 256 kbytes h'000000 to h'03ffff hd6432236r 128 kbytes h'000000 to h'01ffff section 22 clock pulse generator figure 22.1 block diagram of clock pulse generator 657 figure amended. (before) wdt_1, tmr4, lcd count clock (after) wdt_1 count clock 22.2.1 connecting a crystal resonator table 22.1 damping resistance value table 22.2 crystal resonator characteristics 663 frequency of 20 mhz added.
rev. 2.00, 05/03, page xxii of lxii item page revision (see manual for details) 22.2.2 external clock input table 22.3 external clock input conditions (2) (h8s/2239 group) 665 values when v cc = 3.0 v to 3.6 v in f-ztat and masked rom versions added. table 22.4 external clock input conditions (duty adjustment circuit unused) (2) (h8s/2239 group) 666 values when v cc = 2.2 v to 3.6 v in masked rom version added. 22.6.2 handling pins when subclock not required 669 description added to 4th line. on the h8s/2237 and h8s/2227 group, the osc1 pin should be connected to v cc . section 23 power- down modes table 23.1 lsi internal states in each mode 672 note * 3 added to d/a. * 3 not available in the h8s/2227 group. 23.1 register description 675 description amended in 5th line. for details on timer control status register ( tcsr-_1), refer to section 13.3.2, timer control/status register ( tcsr_1). description amended in 13th line. ? timer control status register ( tcsr_1) 23.1.1 standby control register (sbycr) 676 description of bit 3 amended. bit bit name initial value r/w description 3 ope 1 r/w output port enable specifies whether the output of the address bus and bus control signals ( to , , , , and ) should be retained or driven to the high impedance state, when shifting to software standby mode, watch mode, or direct transition. 0: high impedance 1: output is retained.
rev. 2.00, 05/03, page xxiii of lxii item page revision (see manual for details) 23.1.2 module stop control registers a to c (mstpcra to mstpcrc) 677, 678 notes * 2, * 3, * 4 added. mstpcra bit bit name initial value r/w target module 7 mstpa7 0 r/w dma controller (dmac) * 2 0 mstpa0 1 r/w 8-bit timer (tmr_2, tmr_3) * 3 mstpcrb bit bit name initial value r/w target module 4 mstpb4 1 r/w i 2 c bus interface 0 (iic_0) (optional) * 3 3 mstpb3 1 r/w i 2 c bus interface 1 (iic_1) (optional) * 3 * 4 mstpcrc bit bit name initial value r/w target module 5 mstpc5 1 r/w d/a converter notes: * 2 h8s/2239 group only. * 3 not implemented on h8s/2237 and h8s/2227 group. * 4 not implemented on h8s/2237 group. 23.2 medium- speed mode 678 description amended in 16th line. (before) tcsr (after) tcsr_1 figure 23.2 medium-speed mode transition and clearance timing 679 figure amended. internal address bus sckcr sckcr 23.4.1 software standby mode 680 description amended in 5th line. (before) tcsr (after) tcsr_1 23.4.3 oscillation settling time after clearing software standby mode table 23.3 oscillation settling time settings 681 frequency of 20 mhz added 23.7.1 transition to watch mode 684 description amended in 5th line. (before) tcsr (after) tcsr_1 23.7.2 exiting watch mode description amended in 12th line. (before) wovi1 (after) wovi_1 23.8.1 transition to subsleep mode 685 description amended in 4th line. (before) tcsr (after) tcsr_1 23.9.1 transition to subactive mode 686 description amended in 4th line. (before) tcsr (after) tcsr_1
rev. 2.00, 05/03, page xxiv of lxii item page revision (see manual for details) 23.9.2 exiting subactive mode 686 description amended in 16th, 18th, and 21st lines. (before) tcsr (after) tcsr_1 23.10.1 direct transitions from high-speed mode to subactive mode 687 description amended in 9th line. (before) tcsr (after) tcsr_1 23.10.2 direct transitions from subactive mode to high-speed mode description amended in 13th line. (before) tcsr (after) tcsr_1 section 24 power supply circuit 691 to 694 newly added. 25.3 register states in each operating mode 716 to 724 manual reset state added. 26.1 power supply voltage and operating frequency range 725 figures 26.1, 26.2, 26.3, and 26.4 show power supply voltage and operating frequency ranges (shaded areas) of the h8s/2239 group, h8s/2238b group, h8s/2238r group, and h8s/2237 group and h8s/2227 group respectively.
rev. 2.00, 05/03, page xxv of lxii item page revision (see manual for details) 26.1 power supply voltage and operating frequency range figure 26.1 power supply voltage and operating ranges (h8s/2239 group) 725 system clock (2) power supply voltage/analog power supply voltage and oscilllation frequency range (masked rom version) (1) power supply voltage/analog power supply voltage and oscilllation frequency range (f-ztat version) (4) power supply voltageand instruction executing range (masked rom version) (3) power supply voltage and instruction executing range (f-ztat version) active (high/medium speed) mode sleep mode f (mhz) 20.0 16.0 6.25 2.0 0 2.2 2.7 3.0 3.6 5.5 vcc (v) avcc f (khz) 32.768 0 2.2 2.7 3.6 5.5 vcc (v) vcc (v) vcc (v) vcc (v) subclock system clock t (ns) 50.0 62.5 160 500 0 2.2 2.7 3.0 3.6 5.5 vcc (v) t (ms) 30.5 0 2.2 2.7 3.6 5.5 3.6 5.5 subclock system clock f (mhz) 20.0 16.0 6.25 2.0 0 2.2 2.7 3.0 3.6 5.5 vcc (v) avcc f (khz) 32.768 0 2.2 2.7 3.6 5.5 subclock system clock t (ns) 50.0 62.5 160 500 0 2.2 2.7 3.0 3.6 5.5 vcc (v) t (ms) 30.5 0 2.2 2.7 subclock all operating mode all operating mode subactive mode subactive mode active (high/medium speed) mode sleep mode active (high/medium speed) mode active (high/medium speed) mode figure 26.2 power supply voltage and operating ranges (5-v version h8s/2238b) 726 newly added. 26.2.2 dc characteristics table 26.2 dc characteristics (1) 730 condition c added.
rev. 2.00, 05/03, page xxvi of lxii item page revision (see manual for details) 26.2.2 dc characteristics 732 condition c added. table amended. item symbol min typ max unit test conditions table 26.2 dc characteristics (2) current consumption * c m * 4 ? 29 v cc = 3.0 v 55 v cc = 3.6 v ma f = 20.0 mhz ? 25 v cc = 3.0 v 42 v cc = 3.6 v ma f = 16.0 mhz sleep mode ? 19 v cc = 3.0 v 43 v cc = 3.6 v ma f = 20.0 mhz ? 17 v cc = 3.0 v 32 v cc = 3.6 v ma f = 16.0 mhz all modules stopped ? 16 ? ma f = 20.0 mhz, v cc = 3.0 v (reference value) ? 15 ? ma f = 16.0 mhz, v cc = 3.0 v (reference value) medium- speed mode ( /32) ? 15 ? ma f = 20.0 mhz, v cc = 3.0 v (reference value) ? 13 ? ma f = 16.0 mhz, v cc = 3.0 v (reference value)
rev. 2.00, 05/03, page xxvii of lxii item page revision (see manual for details) 734, 735 condition c added. table amended. 26.2.2 dc characteristics table 26.2 dc characteristics (3) item symbol min typ max unit test conditions current consumption * 2 normal operation i cc * 4 ? 29 v cc = 3.0 v 55 v cc = 3.6 v ma f = 20.0 mhz ? 25 v cc = 3.0 v 42 v cc = 3.6 v ma f = 16.0 mhz ? 10 v cc = 3.0 v 18 v cc = 3.6 v ma f = 6.25 mhz sleep mode ? 19 v cc = 3.0 v 43 v cc = 3.6 v ma f = 20.0 mhz ? 17 v cc = 3.0 v 32 v cc = 3.6 v ma f = 16.0 mhz ? 7.5 v cc = 3.0 v 14 v cc = 3.6 v ma f = 6.25 mhz all modules stopped ? 16 ? ma f = 20.0 mhz, v cc = 3.0 v (reference value) ? 15 ? ma f = 16.0 mhz, v cc = 3.0 v (reference value) medium- speed mode ( /32) i cc * 4 ? 15 ? ma f = 20.0 mhz, v cc = 3.0 v (reference value) ? 13 ? ma f = 16.0 mhz, v cc = 3.0 v (reference value) table 26.3 permissible output currents 736 condition c added. 26.2.3 ac characteristics table 26.5 clock timing 739, 740 condition c added. table 26.6 control signal timing 741 condition c added. table 26.7 bus timing 742, 743 condition c added. table 26.8 dmac timing 744 condition c added. table 26.9 timing of on-chip peripheral modules 745, 746 condition c added.
rev. 2.00, 05/03, page xxviii of lxii item page revision (see manual for details) 26.2.4 a/d conversion characteristics table 26.11 a/d conversion characteristics 748 condition c added. 26.2.5 d/a conversion characteristics table 26.12 d/a conversion characteristics 749 condition c added. 26.3 electrical characteristics of 5 v version h8s/2238b 752 to 771 newly added. 26.4 electrical characteristics of 3-v version h8s/2238r . 772 title amended. 26.4.2 dc characteristics table 26.27 dc characteristics (2) 775 table amended. item symbol min typ max unit test conditions current consumption * 2 normal operation i cc * 4 20 v cc = 3.0 v 37 v cc = 3.6 v ma f = 13.5 mhz 10 v cc = 3.0 v 18 v cc = 3.6 v ma f = 6.25 mhz sleep mode 15 v cc = 3.0 v 29 v cc = 3.6 v ma f = 13.5 mhz 7.5 v cc = 3.0 v 14 v cc = 3.6 v ma f = 6.25 mhz all modules stopped 15 ma f = 13.5 mhz, v cc = 3.0 v (reference value) 26.5.2 dc characteristics table 26.39 dc characteristics (4) 800 table amended. item symbol min typ max unit test conditions current consumption * 2 0.01 v cc = 3.0 v 10 v cc = 3.6 v at a 50 c when 32.768 khz crystal resonator is not used standby mode * 3
rev. 2.00, 05/03, page xxix of lxii item page revision (see manual for details) 26.5.3 ac characteristics table 26.44 timing of on-chip peripheral modules 807 table amended. condition a condition b condition c item symbol min max min max min max unit test conditions i/o portoutput data delay time t pwd ? 100 ? 100 ? 150 ns figure 26.21 input data setup time t prs 50 ? 50 ? 80 ? input data hold time t prh 50 ? 50 ? 80 ? 26.6.3 bus timing figure 26.17 dmac single address transfer timing (two-state access) figure 26.18 dmac single address transfer timing (three-state access) 820, 821 (before) (after) cs7 to cs0 cs7 to cs0 as as rd rd 832 product type product code mark code package (package code) h8s/2239 hd64f2239 hd64f2239te20 100-pin tqfp (tfp-100b) f-ztat version standard product hd64f2239tf20 100-pin tqfp (tfp-100g) hd64f2239fa20 100-pin qfp (fp-100b) hd64f2239te 16 100-pin tqfp (tfp-100b) appendix b product codes table b.1 product codes of h8s/2239 group hd64f2239tf 16 100-pin tqfp (tfp-100g) hd64f2239fa 16 100-pin qfp (fp-100b)
rev. 2.00, 05/03, page xxx of lxii item page revision (see manual for details) appendix b product codes table b.2 product codes of h8s/2238r group 833, 834 table amended product type product code mark code package (package code) h8s/2238 5-v version hd64f2238btf13 flash memory version hd64f2238bf13 hd64f2238bfa13 3-v version hd64f2238rtf13 hd64f2238rfa13 hd64f2238rbr13 5-v version 100-pin tqfp (tfp-100b) 100-pin tqfp (tfp-100b) 100-pin tqfp (tfp-100b) hd6432238b( *** ) masked rom version hd6432238b( *** )f hd6432238b( *** )fa hd6432238r *** )te 3-v version, 2.2-v version hd6432238r( *** )tf hd6432238r( *** )fa hd6432238rw *** )te hd6432238rw( *** )tf on-chip i 2 c bus interface product (3-v version, 2.2-v version) hd6432238rw( *** )fa hd64f2238b hd64f2238bte13 100-pin tqfp (tfp-100b) hd64f2238r 100-pin tqfp (tfp-100g) 100-pin qfp (fp-100a) 100-pin qfp (fp-100b) 100-pin tqfp (tfp-100b) 100-pin tqfp (tfp-100g) 100-pin qfp (fp-100b) 112-pin tfbga (bp-112) hd6432238b hd64f2238rte13 hd6432238b( *** )te 100-pin tqfp (tfp-100g) tf 100-pin qfp (fp-100a) 100-pin qfp (fp-100b) hd6432238r( 100-pin tqfp (tfp-100g) 100-pin qfp (fp-100b) hd6432238rw( 100-pin tqfp (tfp-100g) 100-pin qfp (fp-100b) h8s/2236 5-v version hd6432236b hd6432236b( *** )te 100-pin tqfp (tfp-100b) hd6432236b( *** )tf 100-pin tqfp (tfp-100g) masked rom version hd6432236b( *** )f 100-pin qfp (fp-100a) hd6432236b( *** )fa 100-pin qfp (fp-100b) hd6432236r hd6432236r( *** )te 100-pin tqfp (tfp-100b) 3-v version, 2.2-v version hd6432236r( *** )tf 100-pin tqfp (tfp-100g) hd6432236r( *** )fa 100-pin qfp (fp-100b) hd6432236bw hd6432236bw( *** )te 100-pin tqfp (tfp-100b) hd6432236bw( *** )tf 100-pin tqfp (tfp-100g) on-chip i 2 c bus interface product (5-v version) hd6432236bw( *** )f 100-pin qfp (fp-100a) hd6432236bw( *** )fa 100-pin qfp (fp-100b) hd6432236rw hd6432236rw( *** )te 100-pin tqfp (tfp-100b) hd6432236rw( *** )tf 100-pin tqfp (tfp-100g) on-chip i 2 c bus interface product (3-v version) hd6432236rw( *** )fa 100-pin qfp (fp-100b)
rev. 2.00, 05/03, page xxxi of lxii contents section 1 overview ............................................................................................................. 1 1.1 features .................................................................................................................... ......... 1 1.2 internal block diagram..................................................................................................... 4 1.3 pin description............................................................................................................. ..... 8 1.3.1 pin arrangement .................................................................................................. 8 1.3.2 pin arrangements in each mode ......................................................................... 16 1.3.3 pin functions ....................................................................................................... 36 section 2 cpu ...................................................................................................................... 47 2.1 features .................................................................................................................... ......... 47 2.1.1 differences between h8s/2600 cpu and h8s/2000 cpu .................................. 48 2.1.2 differences from h8/300 cpu ............................................................................ 49 2.1.3 differences from h8/300h cpu.......................................................................... 49 2.2 cpu operating modes ...................................................................................................... 50 2.2.1 normal mode....................................................................................................... 50 2.2.2 advanced mode ................................................................................................... 51 2.3 address space ............................................................................................................... .... 54 2.4 register configuration...................................................................................................... 55 2.4.1 general registers ................................................................................................. 56 2.4.2 program counter (pc) ......................................................................................... 57 2.4.3 extended control register (exr) ....................................................................... 57 2.4.4 condition-code register (ccr) .......................................................................... 58 2.4.5 initial values of cpu registers ........................................................................... 59 2.5 data formats ................................................................................................................ ..... 60 2.5.1 general register data formats ............................................................................ 60 2.5.2 memory data formats ......................................................................................... 62 2.6 instruction set ............................................................................................................. ...... 63 2.6.1 table of instructions classified by function ....................................................... 64 2.6.2 basic instruction formats .................................................................................... 73 2.7 addressing modes and effective addresscalculation ...................................................... 74 2.7.1 register directrn............................................................................................. 75 2.7.2 register indirect@ern .................................................................................... 75 2.7.3 register indirect with displacement@(d:16, ern) or @(d:32, ern).............. 75 2.7.4 register indirect with post-increment@ern+ or register indirect with pre-decrement@-ern ............................................................................. 75 2.7.5 absolute address@aa:8, @aa:16, @aa:24, or @aa:32.................................... 76 2.7.6 immediate#xx:8, #xx:16, or #xx:32 ................................................................. 76 2.7.7 program-counter relative@(d:8, pc) or @(d:16, pc).................................... 77 2.7.8memory indirect@@aa:8................................................................................ 77
rev. 2.00, 05/03, page xxxii of lxii 2.7.9 effective address calculation ............................................................................. 78 2.8processing states........................................................................................................... .... 80 2.9 usage notes ................................................................................................................. ..... 82 2.9.1 tas instruction.................................................................................................... 82 2.9.2 stm/ldm instruction......................................................................................... 82 2.9.3 bit manipulation instructions .............................................................................. 82 section 3 mcu operating modes .................................................................................. 83 3.1 operating mode selection ................................................................................................ 83 3.2 register descriptions ....................................................................................................... .84 3.2.1 mode control register (mdcr) ......................................................................... 84 3.2.2 system control register (syscr) ...................................................................... 85 3.3 operating mode descriptions ........................................................................................... 86 3.3.1 mode 4................................................................................................................. 86 3.3.2 mode 5................................................................................................................. 87 3.3.3 mode 6................................................................................................................. 87 3.3.4 mode 7................................................................................................................. 88 3.3.5 pin functions ....................................................................................................... 88 3.4 memory map in each operating mode ............................................................................ 89 section 4 exception handling ......................................................................................... 97 4.1 exception handling types and priority............................................................................ 97 4.2 exception sources and exception vector table ............................................................... 98 4.3 reset ....................................................................................................................... .......... 99 4.3.1 reset types.......................................................................................................... 99 4.3.2 reset exception handling.................................................................................... 100 4.3.3 interrupts after reset............................................................................................ 101 4.3.4 state of on-chip peripheral modules after reset release................................... 101 4.4 traces...................................................................................................................... .......... 101 4.5 interrupts.................................................................................................................. ......... 102 4.6 trap instruction............................................................................................................ ..... 102 4.7 stack status after exception handling.............................................................................. 103 4.8usage note.................................................................................................................. ...... 104 section 5 interrupt controller .......................................................................................... 105 5.1 features.................................................................................................................... ......... 105 5.2 input/output pins ........................................................................................................... ... 107 5.3 register descriptions ....................................................................................................... . 107 5.3.1 interrupt priority registers a to l, and o (ipra to iprl, ipro) ...................... 108 5.3.2 irq enable register (ier) .................................................................................. 109 5.3.3 irq sense control registers h and l (iscrh and iscrl) ............................... 109 5.3.4 irq status register (isr).................................................................................... 112 5.4 interrupt sources........................................................................................................... .... 113
rev. 2.00, 05/03, page xxxiii of lxii 5.4.1 external interrupts ............................................................................................... 113 5.4.2 internal interrupts................................................................................................. 114 5.4.3 interrupt exception handling vector table......................................................... 114 5.5 operation................................................................................................................... ........ 120 5.5.1 interrupt control modes and interrupt operation ................................................ 120 5.5.2 interrupt control mode 0 ..................................................................................... 123 5.5.3 interrupt control mode 2 ..................................................................................... 125 5.5.4 interrupt exception handling sequence .............................................................. 126 5.5.5 interrupt response times .................................................................................... 128 5.5.6 dtc and dmac activation by interrupt ............................................................ 129 5.6 usage notes ................................................................................................................. ..... 129 5.6.1 contention between interrupt generation and disabling..................................... 129 5.6.2 instructions that disable interrupts ...................................................................... 130 5.6.3 when interrupts are disabled ............................................................................. 130 5.6.4 interrupts during execution of eepmov instruction.......................................... 131 section 6 pc break controller (pbc) ........................................................................... 133 6.1 features .................................................................................................................... ......... 133 6.2 register descriptions ....................................................................................................... . 134 6.2.1 break address register a (bara) ..................................................................... 134 6.2.2 break address register b (barb)...................................................................... 135 6.2.3 break control register a (bcra) ...................................................................... 135 6.2.4 break control register b (bcrb)....................................................................... 136 6.3 operation................................................................................................................... ........ 136 6.3.1 pc break interrupt due to instruction fetch ....................................................... 136 6.3.2 pc break interrupt due to data access............................................................... 137 6.3.3 notes on pc break interrupt handling ................................................................ 137 6.3.4 operation in transitions to power-down modes ................................................ 137 6.3.5 when instruction execution is delayed by one state ......................................... 138 6.4 usage notes ................................................................................................................. ..... 139 6.4.1 module stop mode setting .................................................................................. 139 6.4.2 pc break interrupts.............................................................................................. 139 6.4.3 cmfa and cmfb ............................................................................................... 139 6.4.4 pc break interrupt when dtc or dmac is bus master .................................... 139 6.4.5 pc break set for instruction fetch at address following bsr, jsr, jmp, trapa, rte, or rts instruction ....................................................................... 139 6.4.6 i bit set by ldc, andc, orc, or xorc instruction ....................................... 140 6.4.7 pc break set for instruction fetch at address following bcc instruction.......... 140 6.4.8pc break set for instruction fetch at branch destination address of bcc instruction................................................................................................. 140 section 7 bus controller .................................................................................................... 141 7.1 features .................................................................................................................... ......... 141
rev. 2.00, 05/03, page xxxiv of lxii 7.2 input/output pins ........................................................................................................... ... 143 7.3 register descriptions ....................................................................................................... . 143 7.3.1 bus width control register (abwcr)............................................................... 144 7.3.2 access state control register (astcr) ............................................................. 144 7.3.3 wait control registers h and l (wcrh, wcrl).............................................. 145 7.3.4 bus control register h (bcrh) ......................................................................... 148 7.3.5 bus control register l (bcrl) .......................................................................... 149 7.3.6 pin function control register (pfcr) ................................................................ 150 7.4 bus control ................................................................................................................. ...... 151 7.4.1 area divisions ..................................................................................................... 151 7.4.2 bus specifications................................................................................................ 152 7.4.3 bus interface for each area................................................................................. 153 7.4.4 chip select signals .............................................................................................. 154 7.5 basic timing................................................................................................................ ..... 155 7.5.1 on-chip memory (rom, ram) access timing ................................................ 155 7.5.2 on-chip peripheral module access timing........................................................ 156 7.5.3 external address space access timing .............................................................. 157 7.6 basic bus interface ......................................................................................................... .. 158 7.6.1 data size and data alignment............................................................................. 158 7.6.2 valid strobes ....................................................................................................... 159 7.6.3 basic timing........................................................................................................ 160 7.6.4 wait control ........................................................................................................ 168 7.7 burst rom interface......................................................................................................... 170 7.7.1 basic timing........................................................................................................ 170 7.7.2 wait control ........................................................................................................ 172 7.8idle cycle.................................................................................................................. ........ 172 7.9 bus release................................................................................................................. ...... 175 7.9.1 bus release usage note ...................................................................................... 176 7.10 bus arbitration............................................................................................................ ...... 177 7.10.1 operation ............................................................................................................. 177 7.10.2 bus transfer timing............................................................................................ 178 7.10.3 external bus release usage note........................................................................ 178 7.11 resets and the bus controller........................................................................................... 179 section 8 dma controller (dmac) ............................................................................. 181 8.1 features.................................................................................................................... ......... 181 8.2 input/output pins ........................................................................................................... ... 183 8.3 register descriptions ....................................................................................................... .183 8.3.1 memory address registers (mara and marb)............................................... 185 8.3.2 i/o address registers (ioara and ioarb)...................................................... 185 8.3.3 execute transfer count registers (etcra and etcrb) .................................. 186 8.3.4 dma control registers (dmacra and dmacrb) ......................................... 187 8.3.5 dma band control registers h and l (dmabcrh and dmabcrl)............. 195
rev. 2.00, 05/03, page xxxv of lxii 8.3.6 dma write enable register (dmawer) .......................................................... 206 8.3.7 dma terminal control register (dmatcr)..................................................... 208 8.4 activation sources .......................................................................................................... .. 209 8.4.1 activation by internal interrupt request.............................................................. 209 8.4.2 activation by external request ........................................................................... 210 8.4.3 activation by auto-request................................................................................. 210 8.5 operation................................................................................................................... ........ 211 8.5.1 transfer modes .................................................................................................... 211 8.5.2 sequential mode .................................................................................................. 213 8.5.3 idle mode............................................................................................................. 216 8.5.4 repeat mode ........................................................................................................ 218 8.5.5 single address mode........................................................................................... 222 8.5.6 normal mode....................................................................................................... 226 8.5.7 block transfer mode ........................................................................................... 229 8.5.8 basic bus cycles.................................................................................................. 234 8.5.9 dma transfer (dual address mode) bus cycles ............................................... 235 8.5.10 dma transfer (single address mode) bus cycles............................................. 243 8.5.11 multi-channel operation ..................................................................................... 249 8.5.12 relation between dmac and external bus requests, and dtc ........................ 250 8.5.13 dmac and nmi interrupts.................................................................................. 250 8.5.14 forced termination of dmac operation............................................................ 252 8.5.15 clearing full address mode ................................................................................ 253 8.6 interrupt sources ........................................................................................................... .... 254 8.7 usage notes ................................................................................................................. ..... 255 8.7.1 dmac register access during operation........................................................... 255 8.7.2 module stop......................................................................................................... 256 8.7.3 medium-speed mode........................................................................................... 256 8.7.4 activation by falling edge on dreq pin ........................................................... 257 8.7.5 activation source acceptance ............................................................................. 257 8.7.6 internal interrupt after end of transfer................................................................ 257 8.7.7 channel re-setting .............................................................................................. 258 section 9 data transfer controller (dtc) ................................................................... 259 9.1 features .................................................................................................................... ......... 259 9.2 register descriptions ....................................................................................................... . 261 9.2.1 dtc mode register a (mra) ............................................................................ 262 9.2.2 dtc mode register b (mrb)............................................................................. 263 9.2.3 dtc source address register (sar).................................................................. 263 9.2.4 dtc destination address register (dar).......................................................... 263 9.2.5 dtc transfer count register a (cra) .............................................................. 264 9.2.6 dtc transfer count register b (crb)............................................................... 264 9.2.7 dtc enable register (dtcer) .......................................................................... 264 9.2.8dtc vector register (dtvecr)........................................................................ 265
rev. 2.00, 05/03, page xxxvi of lxii 9.3 activation sources .......................................................................................................... .. 266 9.4 location of register information and dtc vector table ................................................ 267 9.5 operation ................................................................................................................... ....... 270 9.5.1 normal mode....................................................................................................... 271 9.5.2 repeat mode........................................................................................................ 272 9.5.3 block transfer mode ........................................................................................... 273 9.5.4 chain transfer ..................................................................................................... 275 9.5.5 interrupts.............................................................................................................. 27 6 9.5.6 operation timing................................................................................................. 276 9.5.7 number of dtc execution states ....................................................................... 277 9.6 procedures for using dtc................................................................................................ 279 9.6.1 activation by interrupt......................................................................................... 279 9.6.2 activation by software ........................................................................................ 279 9.7 examples of use of the dtc ............................................................................................ 280 9.7.1 normal mode....................................................................................................... 280 9.7.2 software activation ............................................................................................. 280 9.8usage notes ................................................................................................................. ..... 281 9.8.1 module stop mode setting .................................................................................. 281 9.8.2 on-chip ram ..................................................................................................... 281 9.8.3 dtce bit setting................................................................................................. 281 section 10 i/o ports ............................................................................................................ 283 10.1 port 1..................................................................................................................... ............ 287 10.1.1 port 1 data direction register (p1ddr)............................................................. 287 10.1.2 port 1 data register (p1dr)................................................................................ 288 10.1.3 port 1 register (port1)...................................................................................... 288 10.1.4 pin functions ....................................................................................................... 289 10.2 port 3..................................................................................................................... ............ 293 10.2.1 port 3 data direction register (p3ddr)............................................................. 293 10.2.2 port 3 data register (p3dr)................................................................................ 294 10.2.3 port 3 register (port3)...................................................................................... 294 10.2.4 port 3 open drain control register (p3odr) .................................................... 295 10.2.5 pin functions ....................................................................................................... 295 10.3 port 4..................................................................................................................... ............ 299 10.3.1 port 4 register (port4)...................................................................................... 299 10.3.2 pin functions ....................................................................................................... 299 10.4 port 7..................................................................................................................... ............ 300 10.4.1 port 7 data direction register (p7ddr)............................................................. 300 10.4.2 port 7 data register (p7dr)................................................................................ 300 10.4.3 port 7 register (port7)...................................................................................... 301 10.4.4 pin functions ....................................................................................................... 301 10.5 port 9..................................................................................................................... ............ 304 10.5.1 port 9 register (port9)...................................................................................... 304
rev. 2.00, 05/03, page xxxvii of lxii 10.5.2 pin functions ....................................................................................................... 304 10.6 port a..................................................................................................................... ........... 305 10.6.1 port a data direction register (paddr) ........................................................... 305 10.6.2 port a data register (padr).............................................................................. 305 10.6.3 port a register (porta) .................................................................................... 306 10.6.4 port a pull-up mos control register (papcr) ................................................. 306 10.6.5 port a open drain control register (paodr)................................................... 306 10.6.6 pin functions ....................................................................................................... 307 10.6.7 input pull-up mos states in port a..................................................................... 309 10.7 port b ..................................................................................................................... ........... 310 10.7.1 port b data direction register (pbddr) ........................................................... 310 10.7.2 port b data register (pbdr) .............................................................................. 311 10.7.3 port b register (portb) .................................................................................... 311 10.7.4 port b pull-up mos control register (pbpcr) ................................................. 312 10.7.5 pin functions ....................................................................................................... 312 10.7.6 input pull-up mos states in port b..................................................................... 316 10.8port c ..................................................................................................................... ........... 317 10.8.1 port c data direction register (pcddr)............................................................ 317 10.8.2 port c data register (pcdr) .............................................................................. 317 10.8.3 port c register (portc) .................................................................................... 318 10.8.4 port c pull-up mos control register (pcpcr) ................................................. 318 10.8.5 pin functions ....................................................................................................... 319 10.8.6 input pull-up mos states in port c..................................................................... 319 10.9 port d..................................................................................................................... ........... 320 10.9.1 port d data direction register (pdddr) ........................................................... 320 10.9.2 port d data register (pddr).............................................................................. 320 10.9.3 port d register (portd).................................................................................... 321 10.9.4 port d pull-up mos control register (pdpcr) ................................................. 321 10.9.5 pin functions ....................................................................................................... 322 10.9.6 input pull-up mos states in port d..................................................................... 322 10.10 port e .................................................................................................................... ............ 323 10.10.1 port e data direction register (peddr) ............................................................ 323 10.10.2 port e data register (pedr)............................................................................... 324 10.10.3 port e register (porte)..................................................................................... 324 10.10.4 port e pull-up mos control register (pepcr).................................................. 325 10.10.5 pin functions ....................................................................................................... 325 10.10.6 input pull-up mos states in port e ..................................................................... 326 10.11 port f.................................................................................................................... ............. 327 10.11.1 port f data direction register (pfddr) ............................................................ 327 10.11.2 port f data register (pfdr) ............................................................................... 327 10.11.3 port f register (portf) ..................................................................................... 328 10.11.4 pin functions ....................................................................................................... 328 10.12 port g.................................................................................................................... ............ 331
rev. 2.00, 05/03, page xxxv iii of lxii 10.12.1 port g data direction register (pgddr) ........................................................... 331 10.12.2 port g data register (pgdr).............................................................................. 331 10.12.3 port g register (portg).................................................................................... 332 10.12.4 pin functions ....................................................................................................... 332 section 11 16-bit timer pulse unit (tpu) .................................................................. 335 11.1 features................................................................................................................... .......... 335 11.2 input/output pins .......................................................................................................... .... 340 11.3 register descriptions ...................................................................................................... .. 341 11.3.1 timer control register (tcr)............................................................................. 343 11.3.2 timer mode register (tmdr)............................................................................ 348 11.3.3 timer i/o control register (tior) ..................................................................... 349 11.3.4 timer interrupt enable register (tier).............................................................. 367 11.3.5 timer status register (tsr)................................................................................ 369 11.3.6 timer counter (tcnt)........................................................................................ 372 11.3.7 timer general register (tgr) ............................................................................ 372 11.3.8timer start register (tstr) ............................................................................... 372 11.3.9 timer synchronous register (tsyr).................................................................. 373 11.4 operation .................................................................................................................. ........ 374 11.4.1 basic functions.................................................................................................... 374 11.4.2 synchronous operation........................................................................................ 379 11.4.3 buffer operation .................................................................................................. 381 11.4.4 cascaded operation ............................................................................................. 384 11.4.5 pwm modes........................................................................................................ 386 11.4.6 phase counting mode.......................................................................................... 391 11.5 interrupt sources.......................................................................................................... ..... 397 11.6 dtc activation............................................................................................................. .... 399 11.7 dmac activation (h8s/2239 group only)..................................................................... 399 11.8a/d converter activation................................................................................................. 39 9 11.9 operation timing........................................................................................................... ... 400 11.9.1 input/output timing ............................................................................................ 400 11.9.2 interrupt signal timing........................................................................................ 404 11.10 usage notes ............................................................................................................... ....... 407 11.10.1 module stop mode setting .................................................................................. 407 11.10.2 input clock restrictions ...................................................................................... 407 11.10.3 caution on cycle setting ..................................................................................... 408 11.10.4 contention between tcnt write and clear operations ..................................... 408 11.10.5 contention between tcnt write and increment operations.............................. 409 11.10.6 contention between tgr write and compare match ......................................... 409 11.10.7 contention between buffer register write and compare match ........................ 410 11.10.8contention between tgr read and input capture.............................................. 411 11.10.9 contention between tgr write and input capture............................................. 411 11.10.10 contention between buffer register write and input capture ........................ 412
rev. 2.00, 05/03, page xxxix of lxii 11.10.11 contention between overflow/underflow and counter clearing.................... 413 11.10.12 contention between tcnt write and overflow/underflow........................... 413 11.10.13 multiplexing of i/o pins .................................................................................. 414 11.10.14 interrupts and module stop mode ................................................................... 414 section 12 8-bit timers ..................................................................................................... 415 12.1 features ................................................................................................................... .......... 415 12.2 input/output pins .......................................................................................................... .... 417 12.3 register descriptions ...................................................................................................... .. 417 12.3.1 timer counter (tcnt)........................................................................................ 418 12.3.2 time constant register a (tcora)................................................................... 418 12.3.3 time constant register b (tcorb) ................................................................... 418 12.3.4 timer control register (tcr)............................................................................. 419 12.3.5 timer control/status register (tcsr)................................................................ 421 12.4 operation.................................................................................................................. ......... 426 12.4.1 pulse output......................................................................................................... 426 12.5 operation timing........................................................................................................... ... 427 12.5.1 tcnt incrementation timing ............................................................................. 427 12.5.2 timing of cmfa and cmfb setting when a compare-match occurs............... 428 12.5.3 timing of timer output when a compare-match occurs ................................... 428 12.5.4 timing of compare-match clear when a compare-match occurs ..................... 429 12.5.5 tcnt external reset timing .............................................................................. 429 12.5.6 timing of overflow flag (ovf) setting ............................................................. 430 12.6 operation with cascaded connection ............................................................................... 430 12.6.1 16-bit count mode .............................................................................................. 430 12.6.2 compare-match count mode .............................................................................. 431 12.7 interrupt sources .......................................................................................................... ..... 431 12.7.1 interrupt sources and dtc activation ................................................................ 431 12.7.2 a/d converter activation.................................................................................... 432 12.8usage notes ................................................................................................................ ...... 432 12.8.1 contention between tcnt write and clear........................................................ 432 12.8.2 contention between tcnt write and increment ................................................ 433 12.8.3 contention between tcor write and compare-match ...................................... 434 12.8.4 contention between compare-matches a and b ................................................. 434 12.8.5 switching of internal clocks and tcnt operation............................................. 435 12.8.6 contention between interrupts and module stop mode ...................................... 436 12.8.7 mode setting of cascaded connection ................................................................ 436 section 13 watchdog timer (wdt) .............................................................................. 437 13.1 features ................................................................................................................... .......... 437 13.2 input/output pins .......................................................................................................... .... 439 13.3 register descriptions ...................................................................................................... .. 439 13.3.1 timer counter (tcnt)........................................................................................ 439
rev. 2.00, 05/03, page xl of lxii 13.3.2 timer control/status register (tcsr)................................................................ 439 13.3.3 reset control/status register (rstcsr) (only wdt_0) ................................... 444 13.4 operation .................................................................................................................. ........ 445 13.4.1 watchdog timer mode ........................................................................................ 445 13.4.2 interval timer mode............................................................................................ 446 13.4.3 timing of setting overflow flag (ovf) ............................................................. 447 13.4.4 timing of setting watchdog timer overflow flag (wovf) ............................. 448 13.5 interrupt sources.......................................................................................................... ..... 448 13.6 usage notes ................................................................................................................ ...... 449 13.6.1 notes on register access..................................................................................... 449 13.6.2 contention between timer counter (tcnt) write and increment ..................... 450 13.6.3 changing value of cks2 to cks0...................................................................... 450 13.6.4 switching between watchdog timer mode and interval timer mode................ 450 13.6.5 internal reset in watchdog timer mode............................................................. 451 13.6.6 ovf flag clearing in interval timer mode ........................................................ 451 section 14 serial communication interface (sci) .................................................... 453 14.1 features................................................................................................................... .......... 453 14.2 input/output pins .......................................................................................................... .... 457 14.3 register descriptions ...................................................................................................... .. 457 14.3.1 receive shift register (rsr) .............................................................................. 458 14.3.2 receive data register (rdr) .............................................................................. 458 14.3.3 transmit data register (tdr)............................................................................. 458 14.3.4 transmit shift register (tsr) ............................................................................. 458 14.3.5 serial mode register (smr) ............................................................................... 459 14.3.6 serial control register (scr) ............................................................................. 462 14.3.7 serial status register (ssr) ................................................................................ 467 14.3.8smart card mode register (scmr).................................................................... 474 14.3.9 bit rate register (brr) ...................................................................................... 475 14.3.10 serial expansion mode register (semr_0) ....................................................... 483 14.4 operation in asynchronous mode .................................................................................... 487 14.4.1 data transfer format........................................................................................... 487 14.4.2 receive data sampling timing and reception margin in asynchronous mode 489 14.4.3 clock.................................................................................................................... 490 14.4.4 sci initialization (asynchronous mode) ............................................................. 490 14.4.5 serial data transmission (asynchronous mode) ................................................ 491 14.4.6 serial data reception (asynchronous mode)...................................................... 494 14.5 multiprocessor communication function......................................................................... 498 14.5.1 multiprocessor serial data transmission ............................................................ 499 14.5.2 multiprocessor serial data reception ................................................................. 501 14.6 operation in clocked synchronous mode ........................................................................ 504 14.6.1 clock.................................................................................................................... 504 14.6.2 sci initialization (clocked synchronous mode)................................................. 504
rev. 2.00, 05/03, page xli of lxii 14.6.3 serial data transmission (clocked synchronous mode) .................................... 505 14.6.4 serial data reception (clocked synchronous mode).......................................... 508 14.6.5 simultaneous serial data transmission and reception (clocked synchronous mode)................................................................................................................... 510 14.7 operation in smart card interface .................................................................................... 512 14.7.1 pin connection example...................................................................................... 512 14.7.2 data format (except for block transfer mode).................................................. 512 14.7.3 block transfer mode ........................................................................................... 514 14.7.4 receive data sampling timing and reception margin....................................... 514 14.7.5 initialization ......................................................................................................... 51 5 14.7.6 serial data transmission (except for block transfer mode).............................. 516 14.7.7 serial data reception (except for block transfer mode) ................................... 519 14.7.8clock output control........................................................................................... 520 14.8sci select function (h8s/2239 group only)................................................................... 522 14.9 interrupt sources .......................................................................................................... ..... 524 14.9.1 interrupts in normal serial communication interface mode............................... 524 14.9.2 interrupts in smart card interface mode ............................................................. 526 14.10 usage notes ............................................................................................................... ....... 527 14.10.1 module stop mode setting .................................................................................. 527 14.10.2 break detection and processing (asynchronous mode only) .............................. 527 14.10.3 mark state and break detection (asynchronous mode only).............................. 527 14.10.4 receive error flags and transmit operations (clocked synchronous mode only) .................................................................................................................... 527 14.10.5 restrictions on use of dmac * or dtc.............................................................. 528 14.10.6 operation in case of mode transition................................................................. 528 14.10.7 switching from sck pin function to port pin function ..................................... 532 14.10.8assignment and selection of registers................................................................ 533 section 15 i 2 c bus interface (iic) (option) ................................................................ 535 15.1 features ................................................................................................................... .......... 535 15.2 input/output pins .......................................................................................................... .... 538 15.3 register descriptions ...................................................................................................... .. 539 15.3.1 i 2 c bus data register (icdr) ............................................................................. 539 15.3.2 slave address register (sar) ............................................................................. 541 15.3.3 second slave address register (sarx) ............................................................. 541 15.3.4 i 2 c bus mode register (icmr)........................................................................... 542 15.3.5 serial control registerx (scrx)........................................................................ 545 15.3.6 i 2 c bus control register (iccr)......................................................................... 546 15.3.7 i 2 c bus status register (icsr)............................................................................ 550 15.3.8ddc switch register (ddcswr) ...................................................................... 553 15.4 operation.................................................................................................................. ......... 553 15.4.1 i 2 c bus data format ............................................................................................ 553 15.4.2 master transmit operation .................................................................................. 555
rev. 2.00, 05/03, page xlii of lxii 15.4.3 master receive operation.................................................................................... 556 15.4.4 slave receive operation...................................................................................... 559 15.4.5 slave transmit operation .................................................................................... 561 15.4.6 iric setting timing and scl control ................................................................ 564 15.4.7 operation using the dtc .................................................................................... 565 15.4.8 noise chancellor.................................................................................................. 566 15.4.9 sample flowcharts............................................................................................... 566 15.5 usage notes ................................................................................................................ ...... 571 section 16 a/d converter ................................................................................................. 579 16.1 features................................................................................................................... .......... 579 16.2 input/output pins .......................................................................................................... .... 581 16.3 register descriptions ...................................................................................................... .. 582 16.3.1 a/d data registers a to d (addra to addrd) ............................................. 582 16.3.2 a/d control/status register (adcsr) ............................................................... 583 16.3.3 a/d control register (adcr) ............................................................................ 585 16.4 operation .................................................................................................................. ........ 586 16.4.1 single mode......................................................................................................... 586 16.4.2 scan mode ........................................................................................................... 587 16.4.3 input sampling and a/d conversion time ......................................................... 588 16.4.4 external trigger input timing............................................................................. 590 16.5 interrupt source ........................................................................................................... ..... 590 16.6 a/d conversion accuracy definitions ............................................................................. 591 16.7 usage notes ................................................................................................................ ...... 593 16.7.1 module stop mode setting .................................................................................. 593 16.7.2 permissible signal source impedance ................................................................. 593 16.7.3 influences on absolute accuracy ........................................................................ 593 16.7.4 range of analog power supply and other pin settings ...................................... 594 16.7.5 notes on board design ........................................................................................ 594 16.7.6 notes on noise countermeasures ........................................................................ 594 section 17 d/a converter ................................................................................................. 597 17.1 features................................................................................................................... .......... 597 17.2 input/output pins .......................................................................................................... .... 598 17.3 register description....................................................................................................... ... 598 17.3.1 d/a data registers 0 and 1 (dadr0 and dadr1)............................................ 598 17.3.2 d/a control register (dacr) ............................................................................ 599 17.4 operation .................................................................................................................. ........ 600 17.5 usage notes ................................................................................................................ ...... 601 17.5.1 analog power supply current in software standby mode ................................. 601 17.5.2 setting for module stop mode ............................................................................ 601 section 18 ram .................................................................................................................. 603
rev. 2.00, 05/03, page xliii of lxii section 19 rom .................................................................................................................. 605 19.1 features ................................................................................................................... .......... 605 19.2 mode transitions ........................................................................................................... ... 606 19.3 block configuration........................................................................................................ .. 610 19.4 input/output pins .......................................................................................................... .... 614 19.5 register descriptions ...................................................................................................... .. 614 19.5.1 flash memory control register 1 (flmcr1)..................................................... 615 19.5.2 flash memory control register 2 (flmcr2)..................................................... 616 19.5.3 erase block register 1 (ebr1) ........................................................................... 616 19.5.4 erase block register 2 (ebr2) ........................................................................... 618 19.5.5 ram emulation register (ramer)................................................................... 619 19.5.6 flash memory power control register (flpwcr) ............................................ 621 19.5.7 serial control register x (scrx)....................................................................... 621 19.6 on-board programming modes ........................................................................................ 623 19.6.1 boot mode ........................................................................................................... 623 19.6.2 programming/erasing in user program mode..................................................... 626 19.7 flash memory emulation in ram.................................................................................... 627 19.8flash memory programming/erasing ............................................................................... 629 19.8.1 program/program-verify ..................................................................................... 629 19.8.2 erase/erase-verify............................................................................................... 631 19.9 program/erase protection.................................................................................................. 6 33 19.9.1 hardware protection ............................................................................................ 633 19.9.2 software protection.............................................................................................. 633 19.9.3 error protection.................................................................................................... 633 19.10 interrupt handling when programming/erasing flash memory....................................... 634 19.11 programmer mode ........................................................................................................... . 634 19.12 power-down states for flash memory............................................................................. 636 19.13 flash memory programming and erasing precautions ..................................................... 637 19.14 note on switching from f-ztat version to masked rom version............................... 642 section 20 masked rom .................................................................................................. 643 20.1 features ................................................................................................................... .......... 643 section 21 prom ................................................................................................................ 645 21.1 prom mode setting......................................................................................................... 6 45 21.2 socket adapter and memory map .................................................................................... 645 21.3 programming................................................................................................................ ..... 649 21.3.1 programming and verification............................................................................. 649 21.3.2 programming precautions .................................................................................... 654 21.3.3 reliability of programmed data .......................................................................... 654 section 22 clock pulse generator .................................................................................. 657 22.1 register descriptions ...................................................................................................... .. 658
rev. 2.00, 05/03, page xliv of lxii 22.1.1 system clock control register (sckcr) ........................................................... 658 22.1.2 low-power control register (lpwrcr) ........................................................... 659 22.2 system clock oscillator.................................................................................................... 662 22.2.1 connecting a crystal resonator........................................................................... 662 22.2.2 external clock input ............................................................................................ 663 22.2.3 notes on switching external clock ..................................................................... 666 22.3 duty adjustment circuit................................................................................................... 6 68 22.4 medium-speed clock divider .......................................................................................... 668 22.5 bus master clock selection circuit.................................................................................. 668 22.6 subclock oscillator........................................................................................................ ... 668 22.6.1 connecting 32.768 khz crystal resonator.......................................................... 668 22.6.2 handling pins when subclock not required........................................................ 669 22.7 subclock waveform generation circuit ........................................................................... 670 22.8usage notes ................................................................................................................ ...... 670 22.8.1 note on crystal resonator ................................................................................... 670 22.8.2 note on board design.......................................................................................... 670 section 23 power-down modes ...................................................................................... 671 23.1 register description....................................................................................................... ... 675 23.1.1 standby control register (sbycr) .................................................................... 675 23.1.2 module stop control registers a to c (mstpcra to mstpcrc)................... 677 23.2 medium-speed mode........................................................................................................ 67 8 23.3 sleep mode ................................................................................................................. ...... 679 23.3.1 sleep mode .......................................................................................................... 679 23.3.2 exiting sleep mode ............................................................................................. 679 23.4 software standby mode.................................................................................................... 68 0 23.4.1 software standby mode....................................................................................... 680 23.4.2 clearing software standby mode ........................................................................ 680 23.4.3 oscillation settling time after clearing software standby mode....................... 681 23.4.4 software standby mode application example.................................................... 681 23.5 hardware standby mode .................................................................................................. 682 23.5.1 hardware standby mode ..................................................................................... 682 23.5.2 clearing hardware standby mode....................................................................... 682 23.5.3 hardware standby mode timing......................................................................... 683 23.6 module stop mode ........................................................................................................... 683 23.7 watch mode................................................................................................................. ..... 684 23.7.1 transition to watch mode ................................................................................... 684 23.7.2 exiting watch mode............................................................................................ 684 23.8subsleep mode.............................................................................................................. .... 685 23.8.1 transition to subsleep mode ............................................................................... 685 23.8.2 exiting subsleep mode ........................................................................................ 685 23.9 subactive mode ............................................................................................................. ... 686 23.9.1 transition to subactive mode.............................................................................. 686
rev. 2.00, 05/03, page xlv of lxii 23.9.2 exiting subactive mode....................................................................................... 686 23.10 direct transitions........................................................................................................ ...... 687 23.10.1 direct transitions from high-speed mode to subactive mode........................... 687 23.10.2 direct transitions from subactive mode to high-speed mode........................... 687 23.11 clock output enable...................................................................................................... 687 23.12 usage notes ............................................................................................................... ....... 688 23.12.1 i/o port status...................................................................................................... 688 23.12.2 current dissipation during oscillation settling wait period............................... 688 23.12.3 dtc and dmac module stop ............................................................................ 688 23.12.4 on-chip peripheral module interrupt.................................................................. 689 23.12.5 writing to mstpcr ............................................................................................ 689 23.12.6 entering subactive/watch mode and dmac and dtc module stop ................ 689 section 24 power supply circuit .................................................................................... 691 24.1 overview................................................................................................................... ........ 691 24.2 power supply connection for h8s/2238b (on-chip internal power supply step-down circuit) ........................................................................................................... 69 1 24.3 power supply connection for h8s/2239, h8s/2238r, h8s/2237, and h8s/2227 (no internal power supply step-down circuit) ............................................................... 692 24.4 note on bypass capacitor................................................................................................. 69 3 section 25 list of registers .............................................................................................. 695 25.1 register addresses (in address order)............................................................................... 695 25.2 register bits.............................................................................................................. ........ 705 25.3 register states in each operating mode........................................................................... 716 section 26 electrical characteristics .............................................................................. 725 26.1 power supply voltage and operating frequency range .................................................. 725 26.2 electrical characteristics of h8s/2239 group .................................................................. 729 26.2.1 absolute maximum ratings ................................................................................ 729 26.2.2 dc characteristics ............................................................................................... 730 26.2.3 ac characteristics ............................................................................................... 738 26.2.4 a/d conversion characteristics........................................................................... 748 26.2.5 d/a conversion characteristics........................................................................... 749 26.2.6 flash memory characteristics.............................................................................. 750 26.3 electrical characteristics of 5 v version h8s/2238b ...................................................... 752 26.3.1 absolute maximum ratings ................................................................................ 752 26.3.2 dc characteristics ............................................................................................... 753 26.3.3 ac characteristics ............................................................................................... 761 26.3.4 a/d conversion characteristics........................................................................... 769 26.3.5 d/a convervion characteristics .......................................................................... 769 26.3.6 flash memory characteristics.............................................................................. 770 26.4 electrical characteristics of 3-v version h8s/2238r...................................................... 772
rev. 2.00, 05/03, page xlvi of lxii 26.4.1 absolute maximum ratings ................................................................................ 772 26.4.2 dc characteristics ............................................................................................... 773 26.4.3 ac characteristics ............................................................................................... 780 26.4.4 a/d conversion characteristics........................................................................... 788 26.4.5 d/a conversion characteristics........................................................................... 789 26.4.6 flash memory characteristics ............................................................................. 790 26.5 electrical characteristics of h8s/2237 group and h8s/2227 group ............................... 792 26.5.1 absolute maximum ratings ................................................................................ 792 26.5.2 dc characteristics ............................................................................................... 793 26.5.3 ac characteristics ............................................................................................... 802 26.5.4 a/d conversion characteristics........................................................................... 809 26.5.5 d/a conversion characteristics........................................................................... 810 26.5.6 flash memory characteristics ............................................................................. 811 26.6 operating timing........................................................................................................... ... 813 26.6.1 clock timing ....................................................................................................... 813 26.6.2 control signal timing ......................................................................................... 814 26.6.3 bus timing .......................................................................................................... 815 26.6.4 timing of on-chip peripheral modules .............................................................. 822 26.7 usage note................................................................................................................. ....... 825 appendix a i/o port states in each pin state ............................................................ 827 a.1 i/o port state in each pin state ........................................................................................ 827 appendix b product codes .............................................................................................. 832 appendix c package dimensions .................................................................................. 836 index ............................................................................................................................... ........... 841
rev. 2.00, 05/03, page xlvii of lxii figures section 1 overview figure 1.1 internal block diagram of h8s/2239 group ......................................................... 4 figure 1.2 internal block diagram of h8s/2238 group ......................................................... 5 figure 1.3 internal block diagram of h8s/2237 group ......................................................... 6 figure 1.4 internal block diagram of h8s/2227 group ......................................................... 7 figure 1.5 pin arrangement of h8s/2239 group (tfp-100b, tfp-100g, fp-100b: top view) ....................................................... 8 figure 1.6 pin arrangement of h8s/2238 group (tfp-100b, tfp-100g, fp-100b: top view) ....................................................... 9 figure 1.7 pin arrangement of h8s/2238 group (fp-100a: top view, only for h8s/2238b) ......................................................... 10 figure 1.8 pin arrangement of h8s/2238 group (bp-112: top view, only for h8s/2238r, in planning stage).............................. 11 figure 1.9 pin arrangement of h8s/2237 group (tfp-100b, tfp-100g, fp-100b: top view) ....................................................... 12 figure 1.10 pin arrangement of h8s/2237 group (fp-100a: top view) ............................................................................................ 13 figure 1.11 pin arrangement of h8s/2227 group (tfp-100b, tfp-100g, fp-100b: top view) ....................................................... 14 figure 1.12 pin arrangement of h8s/2227 group (fp-100a: top view) ............................................................................................ 15 section 2 cpu figure 2.1 exception vector table (normal mode)................................................................ 51 figure 2.2 stack structure in normal mode............................................................................ 51 figure 2.3 exception vector table (advanced mode)............................................................ 52 figure 2.4 stack structure in advanced mode........................................................................ 53 figure 2.5 memory map.......................................................................................................... 5 4 figure 2.6 cpu registers ........................................................................................................ 55 figure 2.7 usage of general registers .................................................................................... 56 figure 2.8stack status ......................................................................................................... ... 57 figure 2.9 general register data formats (1)......................................................................... 60 figure 2.9 general register data formats (2)......................................................................... 61 figure 2.10 memory data formats............................................................................................ 62 figure 2.11 instruction formats (examples) ............................................................................. 74 figure 2.12 branch address specification in memory indirect mode ...................................... 77 figure 2.13 state transitions ................................................................................................... .. 81 section 3 mcu operating modes figure 3.1 h8s/2239 memory map in each operating mode................................................. 89 figure 3.2 h8s/2238 memory map in each operating mode................................................. 90
rev. 2.00, 05/03, page xlviii of lxii figure 3.3 h8s/2236 memory map in each operating mode ................................................ 91 figure 3.4 h8s/2237 and h8s/2227 memory map in each operating mode......................... 92 figure 3.5 h8s/2235 and h8s/2225 memory map in each operating mode......................... 93 figure 3.6 h8s/2224 memory map in each operating mode ................................................ 94 figure 3.7 h8s/2233 and h8s/2223 memory map in each operating mode......................... 95 section 4 exception handling figure 4.1 reset sequence (mode 4)....................................................................................... 100 figure 4.2 stack status after exception handling (advanced mode) ..................................... 103 figure 4.3 operation when sp value is odd........................................................................... 104 section 5 interrupt controller figure 5.1 block diagram of interrupt controller................................................................... 106 figure 5.2 block diagram of irqn interrupts......................................................................... 113 figure 5.3 set timing for irqnf ............................................................................................ 114 figure 5.4 block diagram of interrupt control operation ...................................................... 121 figure 5.5 flowchart of procedure up to interrupt acceptance in interrupt control mode 0 124 figure 5.6 flowchart of procedure up to interrupt acceptance in control mode 2 ............... 126 figure 5.7 interrupt exception handling................................................................................. 127 figure 5.8contention between interrupt generation and disabling ....................................... 130 section 6 pc break controller (pbc) figure 6.1 block diagram of pc break controller ................................................................. 134 figure 6.2 operation in power-down mode transitions ........................................................ 138 section 7 bus controller figure 7.1 block diagram of bus controller .......................................................................... 142 figure 7.2 overview of area divisions................................................................................... 151 figure 7.3 csn signal output timing (n = 0 to 7) .................................................................. 154 figure 7.4 on-chip memory access cycle............................................................................. 155 figure 7.5 pin states during on-chip memory access........................................................... 156 figure 7.6 on-chip peripheral module access cycle............................................................. 156 figure 7.7 pin states during on-chip peripheral module access........................................... 157 figure 7.8access sizes and data alignment control (8-bit access space) .......................... 158 figure 7.9 access sizes and data alignment control (16-bit access space) ........................ 159 figure 7.10 bus timing for 8-bit 2-state access space ........................................................... 160 figure 7.11 bus timing for 8-bit 3-state access space ........................................................... 161 figure 7.12 bus timing for 16-bit 2-state access space (1) (even address byte access) ..... 162 figure 7.13 bus timing for 16-bit 2-state access space (2) (odd address byte access) ...... 163 figure 7.14 bus timing for 16-bit 2-state access space (3) (word access)........................... 164 figure 7.15 bus timing for 16-bit 3-state access space (1) (even address byte access) ..... 165 figure 7.16 bus timing for 16-bit 3-state access space (2) (odd address byte access) ...... 166 figure 7.17 bus timing for 16-bit 3-state access space (3) (word access)........................... 167 figure 7.18example of wait state insertion timing................................................................ 169 figure 7.19 example of burst rom access timing (when ast0 = brsts1 = 1) ................ 171
rev. 2.00, 05/03, page xlix of lxii figure 7.20 example of burst rom access timing (when ast0 = brsts1 = 0)................. 171 figure 7.21 example of idle cycle operation (1) ..................................................................... 172 figure 7.22 example of idle cycle operation (2) ..................................................................... 173 figure 7.23 relationship between chip select ( cs ) and read ( rd )......................................... 174 figure 7.24 bus-released state transition timing ................................................................... 176 section 8 dma controller (dmac) figure 8.1 block diagram of dmac ...................................................................................... 182 figure 8.2 areas for register re-setting by dtc (channel 0a) ............................................ 207 figure 8.3 operation in sequential mode................................................................................ 214 figure 8.4 example of sequential mode setting procedure .................................................... 215 figure 8.5 operation in idle mode .......................................................................................... 216 figure 8.6 example of idle mode setting procedure............................................................... 217 figure 8.7 operation in repeat mode ...................................................................................... 220 figure 8.8 example of repeat mode setting procedure.......................................................... 221 figure 8.9 data bus in single address mode.......................................................................... 222 figure 8.10 operation in single address mode (when sequential mode is specified)............ 224 figure 8.11 example of single address mode setting procedure (when sequential mode is specified)............................................................................................................ 225 figure 8.12 operation in normal mode .................................................................................... 227 figure 8.13 example of normal mode setting procedure......................................................... 228 figure 8.14 operation in block transfer mode (blkdir = 0) ................................................ 230 figure 8.15 operation in block transfer mode (blkdir = 1) ................................................ 231 figure 8.16 operation flow in block transfer mode ............................................................... 232 figure 8.17 example of block transfer mode setting procedure............................................. 233 figure 8.18 example of dma transfer bus timing................................................................. 234 figure 8.19 example of short address mode transfer ............................................................. 235 figure 8.20 example of full address mode transfer (cycle steal) ......................................... 236 figure 8.21 example of full address mode transfer (burst mode)......................................... 237 figure 8.22 example of full address mode transfer (block transfer mode) ......................... 238 figure 8.23 example of dreq pin falling edge activated normal mode transfer................ 239 figure 8.24 example of dreq pin falling edge activated block transfer mode transfer.... 240 figure 8.25 example of dreq pin low level activated normal mode transfer................... 241 figure 8.26 example of dreq pin low level activated block transfer mode transfer....... 242 figure 8.27 example of single address mode transfer (byte read) ....................................... 243 figure 8.28 example of single address mode (word read) transfer...................................... 244 figure 8.29 example of single address mode transfer (byte write) ...................................... 245 figure 8.30 example of single address mode transfer (word write)..................................... 246 figure 8.31 example of dreq pin falling edge activated single address mode transfer.... 247 figure 8.32 example of dreq pin low level activated single address mode transfer....... 248 figure 8.33 example of multi-channel transfer....................................................................... 250 figure 8.34 example of procedure for continuing transfer on channel interrupted by nmi interrupt .................................................................................................... 251
rev. 2.00, 05/03, page l of lxii figure 8.35 example of procedure for forcibly terminating dmac operation...................... 252 figure 8.36 example of procedure for clearing full address mode ........................................ 253 figure 8.37 block diagram of transfer end/transfer break interrupt ..................................... 254 figure 8.38 dmac register update timing ............................................................................ 255 figure 8.39 contention between dmac register update and cpu read................................ 256 section 9 data transfer controller (dtc) figure 9.1 block diagram of dtc .......................................................................................... 260 figure 9.2 block diagram of dtc activation source control ............................................... 266 figure 9.3 the location of the dtc register information in the address space................... 267 figure 9.4 correspondence between dtc vector address and register information ............ 268 figure 9.5 flowchart of dtc operation ................................................................................. 271 figure 9.6 memory mapping in normal mode ....................................................................... 272 figure 9.7 memory mapping in repeat mode ........................................................................ 273 figure 9.8memory mapping in block transfer mode ........................................................... 274 figure 9.9 chain transfer operation....................................................................................... 275 figure 9.10 dtc operation timing (example in normal mode or repeat mode) .................. 276 figure 9.11 dtc operation timing (example of block transfer mode,with block size of 2) 277 figure 9.12 dtc operation timing (example of chain transfer) ........................................... 277 section 10 i/o ports figure 10.1 types of open drain outputs ................................................................................ 295 section 11 16-bit timer pulse unit (tpu) figure 11.1 block diagram of tpu (h8s/2239 group, h8s/2238 group, and h8s/2237 group) ............................................................................................ 338 figure 11.2 block diagram of tpu (h8s/2227 group)............................................................ 339 figure 11.3 example of counter operation setting procedure ................................................. 374 figure 11.4 free-running counter operation........................................................................... 375 figure 11.5 periodic counter operation.................................................................................... 376 figure 11.6 example of setting procedure for waveform output by compare match............. 376 figure 11.7 example of 0 output/1 output operation .............................................................. 377 figure 11.8example of toggle output operation .................................................................... 377 figure 11.9 example of setting procedure for input capture operation .................................. 378 figure 11.10 example of input capture operation ..................................................................... 379 figure 11.11 example of synchronous operation setting procedure ......................................... 380 figure 11.12 example of synchronous operation....................................................................... 381 figure 11.13 compare match buffer operation.......................................................................... 382 figure 11.14 input capture buffer operation ............................................................................. 382 figure 11.15 example of buffer operation setting procedure.................................................... 382 figure 11.16 example of buffer operation (1) ........................................................................... 383 figure 11.17 example of buffer operation (2) ........................................................................... 384 figure 11.18cascaded operation setting procedure .................................................................. 385 figure 11.19 example of cascaded operation (1) ...................................................................... 385
rev. 2.00, 05/03, page li of lxii figure 11.20 example of cascaded operation (2)....................................................................... 386 figure 11.21 example of pwm mode setting procedure ........................................................... 388 figure 11.22 example of pwm mode operation (1) .................................................................. 389 figure 11.23 example of pwm mode operation (2) .................................................................. 389 figure 11.24 example of pwm mode operation (3) .................................................................. 390 figure 11.25 example of phase counting mode setting procedure............................................ 391 figure 11.26 example of phase counting mode 1 operation ..................................................... 392 figure 11.27 example of phase counting mode 2 operation ..................................................... 393 figure 11.28example of phase counting mode 3 operation ..................................................... 394 figure 11.29 example of phase counting mode 4 operation ..................................................... 395 figure 11.30 phase counting mode application example.......................................................... 396 figure 11.31 count timing in internal clock operation............................................................. 400 figure 11.32 count timing in external clock operation ........................................................... 400 figure 11.33 output compare output timing ............................................................................ 401 figure 11.34 input capture input signal timing......................................................................... 401 figure 11.35 counter clear timing (compare match) ............................................................... 402 figure 11.36 counter clear timing (input capture) ................................................................... 402 figure 11.37 buffer operation timing (compare match) .......................................................... 403 figure 11.38buffer operation timing (input capture) .............................................................. 403 figure 11.39 tgi interrupt timing (compare match) ................................................................ 404 figure 11.40 tgi interrupt timing (input capture) .................................................................... 405 figure 11.41 tciv interrupt setting timing............................................................................... 405 figure 11.42 tciu interrupt setting timing............................................................................... 406 figure 11.43 timing for status flag clearing by cpu ............................................................... 406 figure 11.44 timing for status flag clearing by dtc/dmac activation ................................ 407 figure 11.45 phase difference, overlap, and pulse width in phase counting mode ................. 408 figure 11.46 contention between tcnt write and clear operations........................................ 409 figure 11.47 contention between tcnt write and increment operations ................................ 409 figure 11.48contention between tgr write and compare match............................................ 410 figure 11.49 contention between buffer register write and compare match........................... 410 figure 11.50 contention between tgr read and input capture ................................................ 411 figure 11.51 contention between tgr write and input capture ............................................... 412 figure 11.52 contention between buffer register write and input capture............................... 412 figure 11.53 contention between overflow and counter clearing............................................. 413 figure 11.54 contention between tcnt write and overflow.................................................... 414 section 12 8-bit timers figure 12.1 block diagram of 8-bit timer module.................................................................. 416 figure 12.2 example of pulse output........................................................................................ 427 figure 12.3 count timing for internal clock input................................................................... 427 figure 12.4 count timing for external clock input ................................................................. 428 figure 12.5 timing of cmf setting .......................................................................................... 428 figure 12.6 timing of timer output ......................................................................................... 429
rev. 2.00, 05/03, page lii of lxii figure 12.7 timing of compare-match clear ........................................................................... 429 figure 12.8timing of clearing by external reset input .......................................................... 429 figure 12.9 timing of ovf setting .......................................................................................... 430 figure 12.10 contention between tcnt write and clear .......................................................... 432 figure 12.11 contention between tcnt write and increment................................................... 433 figure 12.12 contention between tcor write and compare-match ........................................ 434 section 13 watchdog timer (wdt) figure 13.1 block diagram of wdt_0 (1) ............................................................................... 438 figure 13.1 block diagram of wdt_1 (2) ............................................................................... 438 figure 13.2 watchdog timer mode operation ......................................................................... 446 figure 13.3 interval timer mode operation ............................................................................. 446 figure 13.4 timing of ovf setting .......................................................................................... 447 figure 13.5 timing of wovf setting....................................................................................... 448 figure 13.6 writing to tcnt and tcsr (example for wdt_0) ............................................. 449 figure 13.7 contention between tcnt write and increment................................................... 450 section 14 serial communication interface (sci) figure 14.1 block diagram of sci............................................................................................ 455 figure 14.2 block diagram of sci_0 of h8s/2239 group ....................................................... 456 figure 14.3 example of the internal base clock when the average transfer rate is selected (1)......................................................................................................... 485 figure 14.4 example of the internal base clock when the average transfer rate is selected (2)......................................................................................................... 486 figure 14.5 data format in asynchronous communication (example with 8-bit data, parity, two stop bits)............................................................................................ 487 figure 14.6 receive data sampling timing in asynchronous mode ....................................... 489 figure 14.7 relationship between output clock and transfer data phase (asynchronous mode)............................................................................................ 490 figure 14.8sample sci initialization flowchart ...................................................................... 491 figure 14.9 example of operation in transmission in asynchronous mode (example with 8-bit data, parity, one stop bit) ................................................... 492 figure 14.10 sample serial transmission flowchart .................................................................. 493 figure 14.11 example of sci operation in reception (example with 8-bit data, parity, one stop bit).......................................................................................................... 494 figure 14.12 sample serial reception data flowchart (1) ......................................................... 496 figure 14.12 sample serial reception data flowchart (2) ......................................................... 497 figure 14.13 example of communication using multiprocessor format (transmission of data h'aa to receiving station a) ........................................... 499 figure 14.14 sample multiprocessor serial transmission flowchart ......................................... 500 figure 14.15 example of sci operation in reception (example with 8-bit data, multiprocessor bit, one stop bit).......................................................................... 501 figure 14.16 sample multiprocessor serial reception flowchart (1)......................................... 502 figure 14.16 sample multiprocessor serial reception flowchart (2)......................................... 503
rev. 2.00, 05/03, page liii of lxii figure 14.17 data format in synchronous communication (for lsb-first) ............................. 504 figure 14.18sample sci initialization flowchart ...................................................................... 505 figure 14.19 sample sci transmission operation in clocked synchronous mode ................... 506 figure 14.20 sample serial transmission flowchart .................................................................. 507 figure 14.21 example of sci operation in reception ................................................................ 508 figure 14.22 sample serial reception flowchart ....................................................................... 509 figure 14.23 sample flowchart of simultaneous serial transmit and receive operations ....... 511 figure 14.24 schematic diagram of smart card interface pin connections............................... 512 figure 14.25 normal smart card interface data format ............................................................ 513 figure 14.26 direct convention (sdir = sinv = o/ e = 0) ....................................................... 513 figure 14.27 inverse convention (sdir = sinv = o/ e = 1) ..................................................... 513 figure 14.28receive data sampling timing in smart card mode (using clock of 372 times the transfer rate)................................................................................................... 515 figure 14.29 retransfer operation in sci transmit mode ......................................................... 517 figure 14.30 tend flag generation timing in transmission operation .................................. 517 figure 14.31 example of transmission processing flow............................................................ 518 figure 14.32 retransfer operation in sci receive mode ........................................................... 519 figure 14.33 example of reception processing flow................................................................. 520 figure 14.34 timing for fixing clock output level................................................................... 520 figure 14.35 clock halt and restart procedure .......................................................................... 521 figure 14.36 example of communication using sci select function ....................................... 522 figure 14.37 summary of sci select function operation .......................................................... 523 figure 14.38example of clocked synchronous transmission by dmac or dtc.................... 528 figure 14.39 sample flowchart for mode transition during transmission................................ 529 figure 14.40 asynchronous transmission using internal clock ................................................ 529 figure 14.41 synchronous transmission using internal clock .................................................. 530 figure 14.42 sample flowchart for mode transition during reception ..................................... 531 figure 14.43 operation when switching from sck pin function to port pin function ............. 532 figure 14.44 operation when switching from sck pin function to port pin function (example of preventing low-level output).......................................................... 533 section 15 i 2 c bus interface (iic) (option) figure 15.1 block diagram of i 2 c bus interface....................................................................... 537 figure 15.2 i 2 c bus interface connections (example: this lsi as master) ............................. 538 figure 15.3 i 2 c bus data formats (i 2 c bus formats)............................................................... 554 figure 15.4 i 2 c bus data format (serial format) ..................................................................... 554 figure 15.5 i 2 c bus timing....................................................................................................... 554 figure 15.6 master transmit mode operation timing example (mls = wait = 0).............. 556 figure 15.7 (1) master receive mode operation timing example (mls = ackb = 0, wait = 1) ......................................................................................................... 558 figure 15.7 (2) master receive mode operation timing example (mls = ackb = 0, wait = 1) ......................................................................................................... 558 figure 15.8example of slave receive mode operation timing (1) (mls = ackb = 0) ....... 560
rev. 2.00, 05/03, page liv of lxii figure 15.9 example of slave receive mode operation timing (2) (mls = ackb = 0)....... 561 figure 15.10 example of slave transmit mode operation timing (mls = 0) .......................... 563 figure 15.11 iric setting timing and scl control................................................................... 564 figure 15.12 block diagram of noise chancellor ...................................................................... 566 figure 15.13 sample flowchart for master transmit mode ....................................................... 567 figure 15.14 sample flowchart for master receive mode ......................................................... 568 figure 15.15 sample flowchart for slave receive mode ........................................................... 569 figure 15.16 sample flowchart for slave transmit mode.......................................................... 570 figure 15.17 points for attention concerning reading of master receive data........................ 574 figure 15.18flowchart and timing of start condition instruction issuance for retransmission.................................................................................................. 576 figure 15.19 timing of stop condition issuance........................................................................ 577 section 16 a/d converter figure 16.1 block diagram of a/d converter .......................................................................... 580 figure 16.2 example of a/d converter operation (single mode, channel 1 selected)............ 587 figure 16.3 example of a/d converter operation (scan mode, channels an0 to an2 selected)................................................................................................................. 588 figure 16.4 a/d conversion timing......................................................................................... 589 figure 16.5 external trigger input timing ............................................................................... 590 figure 16.6 a/d conversion accuracy definitions .................................................................. 592 figure 16.7 a/d conversion accuracy definitions .................................................................. 592 figure 16.8example of analog input circuit ........................................................................... 593 figure 16.9 example of analog input protection circuit.......................................................... 595 figure 16.10 analog input pin equivalent circuit ...................................................................... 595 section 17 d/a converter figure 17.1 block diagram of d/a converter .......................................................................... 597 figure 17.2 d/a converter operation example ........................................................................ 601 section 19 rom figure 19.1 block diagram of flash memory........................................................................... 606 figure 19.2 flash memory state transitions............................................................................. 607 figure 19.3 boot mode (example)............................................................................................ 608 figure 19.4 user program mode (example) ............................................................................. 609 figure 19.5 block configuration of 384-kbyte flash memory ................................................. 611 figure 19.6 block configuration of 256-kbyte flash memory ................................................. 612 figure 19.7 block configuration of 128-kbyte flash memory ................................................. 613 figure 19.8programming/erasing flowchart example in user program mode....................... 626 figure 19.9 flowchart for flash memory emulation in ram .................................................. 627 figure 19.10 example of ram overlap operation..................................................................... 628 figure 19.11 program/program-verify flowchart ...................................................................... 630 figure 19.12 erase/erase-verify flowchart ................................................................................ 632 figure 19.13 socket adapter pin correspondence diagram ....................................................... 635
rev. 2.00, 05/03, page lv of lxii figure 19.14 power-on/off timing (boot mode) ...................................................................... 639 figure 19.15 power-on/off timing (user program mode) ........................................................ 640 figure 19.16 mode transition timing (example: boot mode user mode ? user program mode)............................. 641 section 20 masked rom figure 20.1 block diagram of on-chip masked rom (384 kbytes)....................................... 644 section 21 prom figure 21.1 hd6472237 socket adapter pin correspondence diagram (fp-100b, tfp-100b, tfp-100g) ......................................................................... 646 figure 21.2 hd6472237 socket adapter pin correspondence diagram (fp-100a) ................ 647 figure 21.3 memory map in prom mode ............................................................................... 648 figure 21.4 high-speed programming flowchart..................................................................... 650 figure 21.5 prom programming/verification timing............................................................. 653 figure 21.6 recommended screening procedure...................................................................... 654 section 22 clock pulse generator figure 22.1 block diagram of clock pulse generator .............................................................. 657 figure 22.2 connection of crystal resonator (example).......................................................... 662 figure 22.3 crystal resonator equivalent circuit ..................................................................... 663 figure 22.4 external clock input (examples) ........................................................................... 664 figure 22.5 external clock input timing.................................................................................. 666 figure 22.6 external clock switching circuit (example) ......................................................... 667 figure 22.7 external clock switching timing (example) ........................................................ 667 figure 22.8connection example of 32.768-khz quartz oscillator.......................................... 668 figure 22.9 equivalence circuit for 32.768-khz oscillator ...................................................... 669 figure 22.10 pin handling when subclock not required............................................................ 669 figure 22.11 note on board design of oscillator circuit ........................................................... 670 section 23 power-down modes figure 23.1 mode transition diagram ...................................................................................... 673 figure 23.2 medium-speed mode transition and clearance timing ....................................... 679 figure 23.3 software standby mode application example ...................................................... 682 figure 23.4 hardware standby mode timing ........................................................................... 683 section 24 power supply circuit figure 24.1 power supply connection for h8s/2238b (on-chip internal power supply step-down circuit) ................................................................................................ 692 figure 24.2 power supply connection for h8s/2239, h8s/2238r, h8s/2237, and h8s/2227 (no internal power supply step-down circuit)............................. 692 section 26 electrical characteristics figure 26.1 power supply voltage and operating ranges (h8s/2239 group)......................... 725 figure 26.2 power supply voltage and operating ranges (5-v version h8s/2238b) ............ 726 figure 26.3 power supply voltage and operating ranges (h8s/2238r group) ...................... 727
rev. 2.00, 05/03, page lvi of lxii figure 26.4 power supply voltage and operating ranges (h8s/2237 group and h8s/2227 group) ............................................................................................ 728 figure 26.5 output load circuit ............................................................................................... 73 8 figure 26.6 output load circuit ............................................................................................... 76 1 figure 26.7 system clock timing............................................................................................. 813 figure 26.8oscillation stabilization timing ............................................................................ 813 figure 26.9 reset input timing................................................................................................. 8 14 figure 26.10 interrupt input timing............................................................................................ 8 14 figure 26.11 basic bus timing (two-state access)................................................................... 815 figure 26.12 basic bus timing (three-state access)................................................................. 816 figure 26.13 basic bus timing (three-state access with one wait state) ............................... 817 figure 26.14 burst rom access timing (two-state access).................................................... 818 figure 26.15 burst rom access timing (one-state access) .................................................... 819 figure 26.16 external bus release timing ................................................................................. 819 figure 26.17 dmac single address transfer timing (two-state access) ............................... 820 figure 26.18dmac single address transfer timing (three-state access) ............................. 821 figure 26.19 dmac tend output timing ............................................................................... 821 figure 26.20 dmac dreq input timing.................................................................................. 822 figure 26.21 i/o port input/output timing................................................................................. 822 figure 26.22 tpu input/output timing...................................................................................... 822 figure 26.23 tpu clock input timing........................................................................................ 823 figure 26.24 8-bit timer output timing .................................................................................... 823 figure 26.25 8-bit timer clock input timing ............................................................................ 823 figure 26.26 8-bit timer reset input timing............................................................................. 823 figure 26.27 wdt_1 output timing.......................................................................................... 824 figure 26.28sck clock input timing ....................................................................................... 824 figure 26.29 sci input/output timing (clocked synchronous mode) ...................................... 824 figure 26.30 a/d converter external trigger input timing....................................................... 824 figure 26.31 i 2 c bus interface input/output timing (optional) ................................................ 825 appendix figure c.1 tfp-100b package dimensions............................................................................. 836 figure c.2 tfp-100g package dimensions ............................................................................ 837 figure c.3 fp-100a package dimensions............................................................................... 838 figure c.4 fp-100b package dimensions ............................................................................... 839 figure c.5 bp-112 package dimensions ................................................................................. 840
rev. 2.00, 05/03, page lvii of lxii tables section 1 overview table 1.1 pin arrangements in each mode of h8s/2239 group ........................................... 16 table 1.2 pin arrangements in each mode of h8s/2238r group ........................................ 21 table 1.3 pin arrangements in each mode of h8s/2237 group ........................................... 26 table 1.4 pin arrangements in each mode of h8s/2227 group ........................................... 31 table 1.5 pin functions of h8s/2239 group and h8s/2238r group.................................... 36 table 1.6 pin functions of h8s/2237 group and h8s/2227 group ...................................... 42 section 2 cpu table 2.1 instruction classification........................................................................................ 63 table 2.2 operation notation................................................................................................. 64 table 2.3 data transfer instructions ...................................................................................... 65 table 2.4 arithmetic operations instructions ........................................................................ 66 table 2.5 logic operations instructions ................................................................................ 68 table 2.6 shift instructions .................................................................................................... 68 table 2.7 bit manipulation instructions................................................................................. 69 table 2.8branch instructions................................................................................................. 71 table 2.9 system control instructions ................................................................................... 72 table 2.10 block data transfer instructions............................................................................ 73 table 2.11 addressing modes.................................................................................................. 74 table 2.12 absolute address access ranges .......................................................................... 76 table 2.13 effective address calculation................................................................................ 78 section 3 mcu operating modes table 3.1 mcu operating mode selection............................................................................ 83 table 3.2 pin functions in each operating mode.................................................................. 88 section 4 exception handling table 4.1 exception types and priority ................................................................................. 97 table 4.2 exception handling vector table .......................................................................... 98 table 4.3 reset types ........................................................................................................... .99 table 4.4 status of ccr and exr after trace exception handling ...................................... 102 table 4.5 status of ccr and exr after trap instruction exception handling ..................... 103 section 5 interrupt controller table 5.1 pin configuration ................................................................................................... 10 7 table 5.2 interrupt sources, vector addresses, and interrupt priorities ................................ 115 table 5.3 interrupt control modes......................................................................................... 120 table 5.4 interrupts selected in each interrupt control mode (1)......................................... 121 table 5.5 interrupts selected in each interrupt control mode (2)......................................... 122 table 5.6 operations and control signal functions in each interrupt control mode ........... 122 table 5.7 interrupt response times....................................................................................... 128
rev. 2.00, 05/03, page lviii of lxii table 5.8number of states in interrupt handling routine execution status........................ 128 section 7 bus controller table 7.1 pin configuration ................................................................................................... 14 3 table 7.2 bus specifications for each area (basic bus interface) ........................................ 153 table 7.3 data buses used and valid strobes ....................................................................... 159 table 7.4 pin states in idle cycle .......................................................................................... 174 table 7.5 pin states in bus released state ............................................................................ 175 section 8 dma controller (dmac) table 8.1 pin configuration ................................................................................................... 18 3 table 8.2 short address mode and full address mode (channel 0)..................................... 184 table 8.3 dmac activation sources .................................................................................... 209 table 8.4 dmac transfer modes ......................................................................................... 211 table 8.5 register functions in sequential mode.................................................................. 213 table 8.6 register functions in idle mode ............................................................................ 216 table 8.7 register functions in repeat mode ....................................................................... 218 table 8.8 register functions in single address mode .......................................................... 223 table 8.9 register functions in normal mode ...................................................................... 226 table 8.10 register functions in block transfer mode .......................................................... 229 table 8.11 dmac channel priority order .............................................................................. 249 table 8.12 interrupt sources and priority order ...................................................................... 254 section 9 data transfer controller (dtc) table 9.1 interrupt sources, dtc vector addresses, and corresponding dtces ................ 268 table 9.2 register information in normal mode ................................................................... 272 table 9.3 register information in repeat mode .................................................................... 273 table 9.4 register information in block transfer mode ....................................................... 274 table 9.5 dtc execution status............................................................................................ 277 table 9.6 number of states required for each execution status .......................................... 278 section 10 i/o ports table 10.1 port functions ....................................................................................................... .284 table 10.2 input pull-up mos states in port a....................................................................... 309 table 10.3 input pull-up mos states in port b ....................................................................... 316 table 10.4 input pull-up mos states in port c ....................................................................... 319 table 10.5 input pull-up mos states in port d....................................................................... 322 table 10.6 input pull-up mos states in port e ....................................................................... 326 section 11 16-bit timer pulse unit (tpu) table 11.1 tpu functions ....................................................................................................... 3 36 table 11.2 pin configuration ................................................................................................... 3 40 table 11.3 cclr2 to cclr0 (channels 0 and 3)................................................................... 344 table 11.4 cclr2 to cclr0 (channels 1, 2, 4, and 5).......................................................... 344 table 11.5 tpsc2 to tpsc0 (channel 0)................................................................................ 345 table 11.6 tpsc2 to tpsc0 (channel 1)................................................................................ 345
rev. 2.00, 05/03, page lix of lxii table 11.7 tpsc2 to tpsc0 (channel 2)................................................................................ 346 table 11.8tpsc2 to tpsc0 (channel 3)................................................................................ 346 table 11.9 tpsc2 to tpsc0 (channel 4)................................................................................ 347 table 11.10 tpsc2 to tpsc0 (channel 5)................................................................................ 347 table 11.11 md3 to md0.......................................................................................................... 349 table 11.12 tiorh_0............................................................................................................. ... 351 table 11.13 tiorl_0 ............................................................................................................. ... 352 table 11.14 tior_1 .............................................................................................................. .... 353 table 11.15 tior_2 .............................................................................................................. .... 354 table 11.16 tiorh_3............................................................................................................. ... 355 table 11.17 tiorl_3 ............................................................................................................. ... 356 table 11.18tior_4 .............................................................................................................. .... 357 table 11.19 tior_5 .............................................................................................................. .... 358 table 11.20 tiorh_0............................................................................................................. ... 359 table 11.21 tiorl_0 ............................................................................................................. ... 360 table 11.22 tior_1 .............................................................................................................. .... 361 table 11.23 tior_2 .............................................................................................................. .... 362 table 11.24 tiorh_3............................................................................................................. ... 363 table 11.25 tiorl_3 ............................................................................................................. ... 364 table 11.26 tior_4 .............................................................................................................. .... 365 table 11.27 tior_5 .............................................................................................................. .... 366 table 11.28register combinations in buffer operation........................................................... 381 table 11.29 cascaded combinations ......................................................................................... 384 table 11.30 pwm output registers and output pins................................................................ 387 table 11.31 clock input pins in phase counting mode............................................................. 391 table 11.32 up/down-count conditions in phase counting mode 1 ....................................... 392 table 11.33 up/down-count conditions in phase counting mode 2 ....................................... 393 table 11.34 up/down-count conditions in phase counting mode 3 ...................................... 394 table 11.35 up/down-count conditions in phase counting mode 4 ....................................... 395 table 11.36 tpu interrupts...................................................................................................... .. 398 section 12 8-bit timers table 12.1 pin configuration ................................................................................................... 4 17 table 12.2 8-bit timer interrupt sources ................................................................................ 431 table 12.3 timer output priorities .......................................................................................... 434 table 12.4 switching of internal clock and tcnt operation................................................. 435 section 13 watchdog timer (wdt) table 13.1 lists wdt pin ........................................................................................................ . 439 table 13.2 wdt interrupt source............................................................................................ 448 section 14 serial communication interface (sci) table 14.1 pin configuration ................................................................................................... 4 57 table 14.2 the relationships between the n setting in brr and bit rate b ........................ 475
rev. 2.00, 05/03, page lx of lxii table 14.3 brr settings for various bit rates (asynchronous mode) .................................. 476 table 14.4 maximum bit rate for each frequency (asynchronous mode)............................ 480 table 14.5 maximum bit rate with external clock input (asynchronous mode).................. 480 table 14.6 brr settings for various bit rates (clocked synchronous mode) ...................... 481 table 14.7 maximum bit rate with external clock input (clocked synchronous mode)...... 481 table 14.8examples of bit rate for various brr settings (smart card interface mode) (when n = 0 and s = 372) ...................................................................................... 482 table 14.9 maximum bit rate at various frequencies (smart card interface mode) (when s = 372) ....................................................................................................... 482 table 14.10 serial transfer formats (asynchronous mode) ..................................................... 488 table 14.11 ssr status flags and receive data handling........................................................ 495 table 14.12 interrupt sources of serial communication interface mode.................................. 525 table 14.13 interrupt sources in smart card interface mode.................................................... 526 section 15 i 2 c bus interface (iic) (option) table 15.1 pin configuration ................................................................................................... 5 38 table 15.2 transfer format...................................................................................................... 542 table 15.3 i 2 c transfer rate.................................................................................................... 544 table 15.4 flags and transfer states ....................................................................................... 550 table 15.5 flags and transfer states ....................................................................................... 565 table 15.6 i 2 c bus timing (scl and sda output)................................................................ 571 table 15.7 permissible scl rise time (t sr ) values................................................................. 572 table 15.8i 2 c bus timing (with maximum influence of t sr /t sf ) ............................................. 573 section 16 a/d converter table 16.1 pin configuration ................................................................................................... 5 81 table 16.2 analog input channels and corresponding addr registers................................ 582 table 16.3 a/d conversion time (single mode) .................................................................... 589 table 16.4 a/d conversion time (scan mode) ...................................................................... 589 table 16.5 a/d converter interrupt source ............................................................................. 590 table 16.6 analog pin specifications ...................................................................................... 595 section 17 d/a converter table 17.1 pin configuration ................................................................................................... 5 98 table 17.2 d/a conversion control ........................................................................................ 600 section 19 rom table 19.1 differences between boot mode and user program mode.................................... 607 table 19.2 pin configuration ................................................................................................... 6 14 table 19.3 setting on-board programming modes................................................................. 623 table 19.4 boot mode operation............................................................................................. 625 table 19.5 system clock frequencies for which automatic adjustment of lsi bit rate is possible............................................................................................................... 625 table 19.6 flash memory operating states ............................................................................. 636 table 19.7 registers present in f-ztat version but absent in masked rom version ........ 642
rev. 2.00, 05/03, page lxi of lxii section 21 prom table 21.1 selecting prom mode .......................................................................................... 645 table 21.2 socket adapters...................................................................................................... 648 table 21.3 mode selection in prom mode ............................................................................ 649 table 21.4 dc characteristics in prom mode ....................................................................... 651 table 21.5 ac characteristics in prom mode ....................................................................... 652 section 22 clock pulse generator table 22.1 damping resistance value..................................................................................... 663 table 22.2 crystal resonator characteristics........................................................................... 663 table 22.3 external clock input conditions (1) (h8s/2238 group, h8s/2237 group, h8s/2227 group) ................................................................................................... 664 table 22.3 external clock input conditions (2) (h8s/2239 group) ...................................... 665 table 22.4 external clock input conditions (duty adjustment circuit unused) (1) (h8s/2238 group, h8s/2237 group, h8s/2227 group) ....................................... 665 table 22.4 external clock input conditions (duty adjustment circuit unused) (2) (h8s/2239 group).................................................................................................. 666 section 23 power-down modes table 23.1 lsi internal states in each mode........................................................................... 672 table 23.2 low power dissipation mode transition conditions ............................................ 674 table 23.3 oscillation settling time settings.......................................................................... 681 table 23.4 pin states in respective processes ...................................................................... 688 section 26 electrical characteristics table 26.1 absolute maximum ratings................................................................................... 729 table 26.2 dc characteristics (1) ............................................................................................ 730 table 26.2 dc characteristics (2) ............................................................................................ 732 table 26.2 dc characteristics (3) ............................................................................................ 734 table 26.3 permissible output currents................................................................................... 736 table 26.4 bus driving characteristics.................................................................................... 737 table 26.5 clock timing......................................................................................................... . 739 table 26.6 control signal timing............................................................................................ 741 table 26.7 bus timing........................................................................................................... .. 742 table 26.8dmac timing ....................................................................................................... 744 table 26.9 timing of on-chip peripheral modules................................................................. 745 table 26.10 i 2 c bus timing....................................................................................................... 747 table 26.11 a/d conversion characteristics ............................................................................. 748 table 26.12 d/a conversion characteristics ............................................................................. 749 table 26.13 flash memory characteristics................................................................................ 750 table 26.14 absolute maximum ratings................................................................................... 752 table 26.15 dc characteristics (1) ............................................................................................ 75 3 table 26.15 dc characteristics (2) ............................................................................................ 75 5 table 26.15 dc characteristics (3) ............................................................................................ 75 7
rev. 2.00, 05/03, page lxii of lxii table 26.16 permissible output currents .................................................................................. 759 table 26.17 bus drive characteristics....................................................................................... 760 table 26.18clock timing ........................................................................................................ . 762 table 26.19 control signal timing............................................................................................ 763 table 26.20 bus timing.......................................................................................................... ... 764 table 26.21 timing of on-chip peripheral modules................................................................. 766 table 26.22 i 2 c bus timing....................................................................................................... 768 table 26.23 a/d conversion characteristics (f-ztat and masked rom versions) .............. 769 table 26.24 d/a conversion characteristics (f-ztat and masked rom versions) .............. 769 table 26.25 flash memory characteristics................................................................................ 770 table 26.26 absolute maximum ratings................................................................................... 772 table 26.27 dc characteristics (1)............................................................................................ 77 3 table 26.27 dc characteristics (2)............................................................................................ 77 5 table 26.27 dc characteristics (3)............................................................................................ 77 7 table 26.28permissible output currents .................................................................................. 779 table 26.29 bus driving characteristics.................................................................................... 780 table 26.30 clock timing ........................................................................................................ .781 table 26.31 control signal timing............................................................................................ 782 table 26.32 bus timing.......................................................................................................... ... 783 table 26.33 timing of on-chip peripheral modules................................................................. 785 table 26.34 i 2 c bus timing....................................................................................................... 787 table 26.35 a/d conversion characteristics............................................................................. 788 table 26.36 d/a conversion characteristics............................................................................. 789 table 26.37 flash memory characteristics................................................................................ 790 table 26.38absolute maximum ratings................................................................................... 792 table 26.39 dc characteristics (1)............................................................................................ 79 3 table 26.39 dc characteristics (2)............................................................................................ 79 5 table 26.39 dc characteristics (3)............................................................................................ 79 7 table 26.39 dc characteristics (4)............................................................................................ 79 9 table 26.40 permissible output currents .................................................................................. 801 table 26.41 clock timing ........................................................................................................ .802 table 26.42 control signal timing............................................................................................ 804 table 26.43 bus timing.......................................................................................................... ... 805 table 26.44 timing of on-chip peripheral modules................................................................. 807 table 26.45 a/d conversion characteristics............................................................................. 809 table 26.46 d/a conversion characteristics............................................................................. 810 table 26.47 flash memory characteristics................................................................................ 811 appendix table b.1 product codes of h8s/2239 group........................................................................ 832 table b.2 product codes of h8s/2238r group ..................................................................... 833 table b.3 product codes of h8s/2237 group and h8s/2227 group..................................... 835
rev. 2.00, 05/03, page 1 of 846 section 1 overview 1.1 features ? high-speed h8s/2000 central processing unit with an internal 16-bit architecture ? upward-compatible with h8/300 and h8/300h cpus on an object level ? sixteen 16-bit general registers ? 65 basic instructions ? various peripheral functions ? pc break controller ? dma controller (dmac) supported only by the h8s/2239 group. ? data transfer controller (dtc) ? 16-bit timer-pulse unit (tpu) h8s/2239 group, h8s/2238 group, and h8s/2237 group: six channels h8s/2227 group: three channels ? 8-bit timer (tmr) h8s/2239 group, h8s/2238 group: four channels h8s/2237 group, h8s/2227 group: two channels ? watchdog timer (wdt) ? serial communication interface (sci) h8s/2239 group, h8s/2238 group, and h8s/2237 group: four channels (sci_0 to sci_3) h8s/2227 group: three channels (sci_0, sci_1, and sci_3) ? i 2 c bus interface (iic) optional function for the h8s/2239 group and h8s/2238 group ? 10-bit a/d converter ? 8-bit d/a converter not available in the h8s/2227 group.
rev. 2.00, 05/03, page 2 of 846 ? on-chip memory rom model rom ram remarks hd64f2239 384 kbytes 32 kbytes hd64f2238b 256 kbytes 16 kbytes flash memory version hd64f2238r 256 kbytes 16 kbytes hd64f2227 128 kbytes 16 kbytes prom version hd6472237 128 kbytes 16 kbytes hd6432239 384 kbytes 32 kbytes hd6432239w 384 kbytes 32 kbytes masked rom version hd6432238b 256 kbytes 16 kbytes hd6432238bw 256 kbytes 16 kbytes hd6432238r 256 kbytes 16 kbytes hd6432238rw 256 kbytes 16 kbytes hd6432236b 128 kbytes 8 kbytes hd6432236bw 128 kbytes 8 kbytes hd6432236r 128 kbytes 8 kbytes hd6432236rw 128 kbytes 8 kbytes hd6432237 128 kbytes 16 kbytes hd6432235 128 kbytes 4 kbytes hd6432233 64 kbytes 4 kbytes hd6432227 128 kbytes 16 kbytes hd6432225 128 kbytes 4 kbytes hd6432224 96 kbytes 4 kbytes hd6432223 64 kbytes 4 kbytes ? general i/o ports ? i/o pins: 72 ? input-only pins: 10 ? supports various power-down states
rev. 2.00, 05/03, page 3 of 846 ? compact package package (code) body size pin pitch tqfp-100 tfp-100b 14.0 14.0 mm 0.5 mm tqfp-100 tfp-100g 12.0 12.0 mm 0.4 mm qfp-100 * 1 fp-100a 14.0 20.0 mm 0.65 mm qfp-100 fp-100b 14.0 14.0 mm 0.5 mm tfbga-112 * 2 bp-112 10.0 10.0 mm 0.8 mm notes: * 1 supported only by the h8s/2238b, h8s/2237 group, and h8s/2227 group. * 2 being planned only for the h8s/2238r.
rev. 2.00, 05/03, page 4 of 846 1.2 internal block diagram figures 1.1, 1.2, 1.3, and 1.4 show the internal block diagrams of the h8s/2239 group, the h8s/2238 group, h8s/2237 group, and the h8s/2227 group, respectively. pe7 /d7 pe6 /d6 pe5/d5 pe4/d4 pe3/d3 pe2/d2 pe1/d1 pe0/d0 internal data bus pd7 /d15 pd6 /d14 pd5 /d13 pd4 /d12 pd3 /d11 pd2 /d10 pd1 /d9 pd0 /d8 port d cvcc vcc vss vss pa3 /a19/sck2 pa2 /a18/rxd2 pa1 /a17/txd2 pa0 / a16 pb7 /a15/tiocb5 pb6 /a14/tioca5 pb5 /a13/tiocb4 pb4 /a12/tioca4 pb3 / a11/tiocd3 pb2/a10/tiocc3 pb1 /a9/tiocb3 pb0 /a8/tioca3 pc7 /a7 pc6 /a6 pc5 /a5 pc4 /a4 pc3 /a3 pc2 /a2 pc1 /a1 pc0 /a0 p36 p35 /sck1/scl0/ irq5 p34 /rxd1/sda0 p33 /txd1/scl1 p32 /sck0/sda1/ irq 4 p31 /rxd0 p30 /txd0 p97 /da1 p96 /da0 p47 / an7 p46 / an6 p45 / an5 p44 / an4 p43 / an3 p42 / an2 p41 / an1 p40 / an0 vref avcc avss p10 / tioca0 / dack0 /a20 p11 / tiocb0 / dack1 /a21 p12 / tiocc0 / tclka/a22 p13 / tiocd0 / tclkb/a23 p14 / tioca1/ irq0 p15 / tiocb1 / tclkc p16 / tioca2/ irq1 p17 / tiocb2/tclkd p70/tmri01/tmci01/ dreq0 / cs4 p71/tmri23/tmci23/ dreq1 / cs5 p72 / tmo0/ tend0 / cs6 p73 / tmo1/ tend1 / cs7 p74/tmo2/ mres p75/tmo3/ sck3 p76 / rxd3 p77 / txd3 pg4 / cs0 pg3 / cs1 pg2 / cs2 pg1 / cs3 / irq7 pg0 / irq6 pf7 / pf6 / as pf5 / rd pf4 / hwr pf3 / lwr / adtrg / irq3 pf2 / wait pf1 / back /buzz pf0 / breq / irq2 pc break controller (2 channels) rom ram tpu (6 channels) md2 md1 md0 extal xtal osc1 osc2 stby res nmi fwe h8s/2000 cpu dmac dtc interrupt controller port e port 4 port 1 port 7 internal address bus port a port b bus controller port c port 3 port 9 port g port f sci (4channels) d/a converter (2 channels) 8-bit timer (4 channels) a/d converter (8 channels) wdt0 wdt1 (subclock) subclock pulse generator system clock pulse generator iic bus interface (option) peripheral data bus peripheral address bus figure 1.1 internal block diagram of h8s/2239 group
rev. 2.00, 05/03, page 5 of 846 pe7 /d7 pe6 /d6 pe5 / d5 pe4 / d4 pe3 / d3 pe2 / d2 pe1 / d1 pe0 / d0 pd7 /d15 pd6 /d14 pd5 /d13 pd4 /d12 pd3 /d11 pd2 /d10 pd1 /d9 pd0 /d8 cv cc v cc v ss v ss pa3 /a19/sck2 pa2 /a18/rxd2 pa1 /a17/txd2 pa0 / a16 pb7 /a15/tiocb5 pb6 /a14/tioca5 pb5 /a13/tiocb4 pb4 /a12/tioca4 pb3 / a11/tiocd3 pb2/a10/tiocc3 pb1 /a9/tiocb3 pb0 /a8/tioca3 pc7 /a7 pc6 /a6 pc5 /a5 pc4 /a4 pc3 /a3 pc2 /a2 pc1 /a1 pc0 /a0 p36 p35 /sck1/scl0/ irq5 p34 /rxd1/sda0 p33 /txd1/scl1 p32 /sck0/sda1/ irq 4 p31 /rxd0 p30 /txd0 p97 /da1 p96 /da0 p47/ an7 p46/ an6 p45/ an5 p44/ an4 p43/ an3 p42/ an2 p41/ an1 p40/ an0 vref avcc avss p10 / tioca0 /a20 p11 / tiocb0 /a21 p12 / tiocc0 / tclka/a22 p13 / tiocd0 / tclkb/a23 p14/ tioca1/i rq0 p15 / tiocb1 / tclkc p16 / tioca2/ irq1 p17/ tiocb2/tclkd p70/tmri01/tmci01/ cs4 p71/tmri23/tmci23/ cs5 p72/tmo0/ cs6 p73/tmo1/ cs7 p74/tmo2/ mres p75/tmo3/sck3 p76/rxd3 p77/txd3 pg4 / cs0 pg3 / cs1 pg2 / cs2 pg1 / cs3 / irq7 pg0 / irq6 pf7 / pf6 / as pf5 / rd pf4 / hwr pf3 / lwr / adtrg / irq3 pf2 / wait pf1 / back /buzz pf0 / breq / irq2 md2 md1 md0 extal xtal osc1 osc2 stby res nmi fwe h8s/2000 cpu dtc internal data bus port d pc break controller (2 channels) rom ram tpu (6 channels) interrupt controller port e port 4 port 1 port 7 internal address bus port a port b bus controller port c port 3 port 9 port g port f sci (4channels) d/a converter (2 channels) 8-bit timer (4 channels) a/d converter (8 channels) wdt0 wdt1 (subclock) subclock pulse generator system clock pulse generator iic bus interface (option) peripheral data bus peripheral address bus figure 1.2 internal block diagram of h8s/2238 group
rev. 2.00, 05/03, page 6 of 846 pe7 /d7 pe6 /d6 pe5 / d5 pe4 / d4 pe3 / d3 pe2 / d2 pe1 / d1 pe0 / d0 pd7 /d15 pd6 /d14 pd5 /d13 pd4 /d12 pd3 /d11 pd2 /d10 pd1 /d9 pd0 /d8 v cc v cc v ss v ss pa3/ a19/sck2 pa2/ a18/rxd2 pa1/ a17/txd2 pa0 / a16 pb7 / a15/tiocb5 pb6 / a14/tioca5 pb5 / a13/tiocb4 pb4 / a12/tioca4 pb3 / a11/tiocd3 pb2/a10/tiocc3 pb1 / a9/tiocb3 pb0 / a8/tioca3 pc7/ a7 pc6/ a6 pc5/ a5 pc4/ a4 pc3/ a3 pc2/ a2 pc1/ a1 pc0/ a0 p36 p35 / sck1/ irq5 p34 / rxd1 p33 / txd1 p32 / sck0/ irq4 p31 / rxd0 p30 / txd0 p97/ da1 p96 /da0 p47/ an7 p46/ an6 p45/ an5 p44/ an4 p43/ an3 p42/ an2 p41/ an1 p40/ an0 vref avcc avss p10 / tioca0 /a20 p11 / tiocb0 /a21 p12 / tiocc0 / tclka/a22 p13 / tiocd0 / tclkb/a23 p14 / tioca1/ irq0 p15 / tiocb1 / tclkc p16 / tioca2/ irq1 p17/ tiocb2/tclkd p70/tmri01/ tmci01/ cs4 p71/ cs5 p72/ tmo0/ cs6 p73/ tmo1/ cs7 p74/ mres p75 / sck3 p76 / rxd3 p77 / txd3 pg4 / cs0 pg3 / cs1 pg2 / cs2 pg1 / cs3 / irq7 pg0 / irq6 pf7 / pf6 / as pf5 / rd pf4 / hwr pf3 / lwr / adtrg / irq3 pf2 / wait pf1 / back /buzz pf0 / breq / irq2 md2 md1 md0 extal xtal osc1 osc2 stby res nmi fwe h8s/2000 cpu internal data bus port d pc break controller (2 channels) rom ram tpu (6 channels) dtc interrupt controller port e port 4 port 1 port 7 internal address bus port a port b bus controller port c port 3 port 9 port g port f sci (4channels) d/a converter (2 channels) 8-bit timer (2 channels) a/d converter (8 channels) wdt0 wdt1 (subclock) subclock pulse generator system clock pulse generator peripheral data bus peripheral address bus figure 1.3 internal block diagram of h8s/2237 group
rev. 2.00, 05/03, page 7 of 846 pe7 /d7 pe6 /d6 pe5 /d5 pe4 /d4 pe3 /d3 pe2 /d2 pe1 /d1 pe0 /d0 pd7 /d15 pd6 /d14 pd5 /d13 pd4 /d12 pd3 /d11 pd2 /d10 pd1 /d9 pd0 /d8 v cc v cc v ss v ss pa3 / a19 pa2 / a18 pa1 / a17 pa0 / a16 pb7 / a15 pb6 / a14 pb5 / a13 pb4 / a12 pb3 / a11 pb2/a10 pb1/a9 pb0/a8 pc7/a7 pc6/a6 pc5/a5 pc4/a4 pc3/a3 pc2/a2 pc1/a1 pc0/a0 p36 p35 / sck1/ irq 5 p34 / rxd1 p33 / txd1 p32 / sck0/ irq 4 p31 / rxd0 p30 / txd0 p97 p96 p47 /an7 p46 /an6 p45 /an5 p44 /an4 p43 /an3 p42 /an2 p41 /an1 p40 /an0 vref avcc avss p10 /tioca0 /a20 p11 /tiocb0 /a21 p12 /tiocc0 /tclka/a22 p13 /tiocd0 /tclkb/a23 p14 /tioca1/ irq0 p15 /tiocb1 /tclkc p16 /tioca2/ irq1 p17 /tiocb2/tclkd p70/tmri01/ tmci01/ cs4 p71 / cs5 p72 /tmo0/ cs6 p73 /tmo1/ cs7 p74 / mres p75 /sck3 p76 /rxd3 p77 /txd3 pg4 / cs0 pg3 / cs1 pg2 / cs2 pg1 / cs3 / irq7 pg0 / irq6 pf7 / pf6 / as pf5 / rd pf4 / hwr pf3 / lwr / adtrg / irq3 pf2 / wait pf1 / back / buzz pf0 / breq / irq2 md2 md1 md0 extal xtal osc1 osc2 stby res nmi fwe h8s/2000 cpu internal data bus port d pc break controller (2 channels) rom ram tpu (3 channels) dtc interrupt controller port e port 4 port 1 port 7 internal address bus port a port b bus controller port c port 3 port 9 port g port f sci (3 channels) 8-bit timer (2 channels) a/d converter (8 channels) wdt0 wdt1 (subclock) subclock pulse generator system clock pulse generator peripheral data bus peripheral address bus figure 1.4 internal block diagram of h8s/2227 group
rev. 2.00, 05/03, page 8 of 846 1.3 pin description 1.3.1 pin arrangement (1) pin arrangement of h8s/2239 group figure 1.5 shows the pin arrangement of the h8s/2239 group. p30/txd0 p31/rxd0 p32/sck0/sda1/ irq4 p33/txd1/scl1 p34/rxd1/sda0 p35/sck1/scl0/ irq5 p36 p77/txd3 p76/rxd3 p75/tmo3/sck3 p74/tmo2/ mres p73/tmo1/ tend1 / cs7 p72/tmo0/ tend0 / cs6 p71/tmri23/tmci23/ dreq1 / cs5 p70/tmri01/tmci01/ dreq0 / cs4 pg0/irq6 pg1/ cs3 / irq7 pg2/ cs2 pg3/ cs1 pg4/ cs0 pe0/d0 pe1/d1 pe2/d2 pe3/d3 pe4/d4 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 pf0/ breq / irq2 pf1/ back /buzz pf2/ wait pf3/ lwr / adtrg / irq 3 pf4/ hwr pf5/ rd pf6/ as pf7/ md2 fwe extal vss xtal vcc stby nmi res osc1 osc2 md1 md0 avcc vref p40/an0 p41/an1 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 p42/an2 p43/an3 p44/an4 p45/an5 p46/an6 p47/an7 p96/da0 p97/da1 p17/tiocb2/tclkd p16/tioca2/ irq1 p14/tioca1/ irq0 p13/tiocd0/tclkb/a23 p12/tiocc0/tclka/a22 p11/tiocb0/ dack1 /a21 p10/tioca0/ dack0 /a20 pa3/a19/sck2 pa2/a18/rxd2 pa1/a17/txd2 pa0/a16 pb7/a15/tiocb5 pb6/a14/tioca5 pb5/a13/tiocb4 pb4/a12/tioca4 avss p15/tiocb1/tclkc 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 pe5/d5 pe6/d6 pe7/d7 pd0/d8 pd1/d9 pd2/d10 pd3/d11 pd4/d12 pd5/d13 pd6/d14 pd7/d15 pc1/a1 pc2/a2 pc3/a3 pc4/a4 pc5/a5 pc6/a6 pc7/a7 pb0/a8/tioca3 pb2/a10/tiocc3 pb3/a11/tiocd3 cvcc pc0/a0 vss pb1/a9/tiocb3 tfp-100b tfp-100g fp-100b (top view) figure 1.5 pin arrangement of h8s/2239 group (tfp-100b, tfp-100g, fp-100b: top view)
rev. 2.00, 05/03, page 9 of 846 (2) pin arrangement of h8s/2238 group figures 1.6, 1.7, and 1.8 show the pin arrangement of the h8s/2238 group. p30/txd0 p31/rxd0 p32/sck0/sda1/ irq4 p33/txd1/scl1 p34/rxd1/sda0 p35/sck1/scl0/ irq5 p36 p77/txd3 p76/rxd3 p75/tmo3/sck3 p74/tmo2/ mres p73/tmo1/ cs7 p72/tmo0/ cs6 p71/tmri23/tmci23/ cs5 p70/tmri01/tmci01/ cs4 pg0/ irq6 pg1/ cs3 / irq7 pg2/ cs2 pg3/ cs1 pg4/ cs0 pe0/d0 pe1/d1 pe2/d2 pe3/d3 pe4/d4 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 pf0/ breq / irq2 pf1/ back /buzz pf2/ wait pf3/ lwr / adtrg / irq 3 pf4/ hwr pf5/ rd pf6/ as pf7/ md2 fwe extal vss xtal vcc stby nmi res osc1 osc2 md1 md0 avcc vref p40/an0 p41/an1 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 p42/an2 p43/an3 p44/an4 p45/an5 p46/an6 p47/an7 p96/da0 p97/da1 p17/tiocb2/tclkd p16/tioca2/ irq1 p14/tioca1/ irq0 p13/tiocd0/tclkb/a23 p12/tiocc0/tclka/a22 p11/tiocb0/a21 p10/tioca0/a20 pa3/a19/sck2 pa2/a18/rxd2 pa1/a17/txd2 pa0/a16 pb7/a15/tiocb5 pb6/a14/tioca5 pb5/a13/tiocb4 pb4/a12/tioca4 avss p15/tiocb1/tclkc 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 pe5/d5 pe6/d6 pe7/d7 pd0/d8 pd1/d9 pd2/d10 pd3/d11 pd4/d12 pd5/d13 pd6/d14 pd7/d15 pc1/a1 pc2/a2 pc3/a3 pc4/a4 pc5/a5 pc6/a6 pc7/a7 pb0/a8/tioca3 pb2/a10/tiocc3 pb3/a11/tiocd3 cvcc pc0/a0 vss pb1/a9/tiocb3 tfp-100b tfp-100g fp-100b (top view) figure 1.6 pin arrangement of h8s/2238 group (tfp-100b, tfp-100g, fp-100b: top view)
rev. 2.00, 05/03, page 10 of 846 p32/sck0/sda1/ irq4 p33/txd1/scl1 p34/rxd1/sda0 p35/sck1/scl0/ irq5 p36 p77/txd3 p76/rxd3 p75/tmo3/sck3 p74/tmo2/ mres p73/tmo1/ cs7 p72/tmo0/ cs6 p71/tmri23/tmci23/ cs5 p70/tmri01/tmci01/ cs4 pg0/ irq6 pg1/ cs3 / irq7 pg2/ cs2 pg3/ cs1 pg4/ cs0 pe0/d0 pe1/d1 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 pf3/ lwr / adtrg / irq 3 pf2/ wait pf1/ back /buzz pf0/ breq / irq2 p30/txd0 p31/rxd0 pf4/ hwr pf5/ rd pf6/ as pf7/ md2 fwe extal vss xtal vcc stby nmi res osc1 osc2 md1 md0 avcc vref p40/an0 p41/an1 p42/an2 p43/an3 p44/an4 75 74 76 77 78 79 80 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 p45/an5 p46/an6 p47/an7 p97/da1 avss p16/tioca2/ irq1 p15/tiocb1/tclkc p14/tioca1/ irq0 p13/tiocd0/tclkb/a23 p12/tiocc0/tclka/a22 p11/tiocb0/a21 p10/tioca0/a20 pa3/a19/sck2 pa2/a18/rxd2 pa1/a17/txd2 pa0/a16 pb7/a15/tiocb5 pb6/a14/tioca5 p96/da0 p17/tiocb2/tclkd 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 pe2/d2 pe3/d3 pe4/d4 pe5/d5 pe6/d6 pe7/d7 pd0/d8 pd1/d9 pd2/d10 pd3/d11 pd4/d12 vcc pc0/a0 vss pc1/a1 pc2/a2 pc3/a3 pc4/a4 pc5/a5 pb1/a9/tiocb3 pb2/a10/tiocc3 pb3/a11/tiocd3 pb4/a12/tioca4 pb5/a13/tiocb4 pc7/a7 pb0/a8/tioca3 pd5/d13 pd6/d14 pd7/d15 pc6/a6 fp-100a (top view) figure 1.7 pin arrangement of h8s/2238 group (fp-100a: top view, only for h8s/2238b)
rev. 2.00, 05/03, page 11 of 846 12345678 91011 a b c d e f g h j k l a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 b1 b2 b3 b4 b5 b6 b7 b8 b9 b10 b11 c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 d1 d2 d3 d4 d5 d6 d7 d8 d9 d10 d11 nc (reserve) pe4/d4 pe1/d1 pg3/ cs1 pg0/ irq6 p72/tmo0/ cs6 p75/tmo3/sck3 p36 p33/txd1/scl1 p30/txd0 nc (reserve) pe6/d6 pe5/d5 pe3/d3 pe0/d0 pg1/cs3/ irq7 p71/tmri23/tmci23/ cs5 p74/tmo2/ mres p35/sck1/scl0/ irq5 p32/sck0/sda1/ irq4 nc (reserve) pf1/ back /buzz pd1/d9 pd0/d8 nc (reserve) pe2/d2 pg2/ cs2 p73/tmo1/ cs7 p76/rxd3 p34/rxd1/sda0 pf0/breq/ irq2 pf2/ wait pf4/ hwr pd4/d12 pd3/d11 pd2/d10 pe7/d7 pg4/ cs0 p70/tmri01/tmci01/ cs4 p77/txd3 p31/rxd0 pf3/lwr/ adtrg / irq3 pf5/ rd pf7/ e1 e2 e3 e4 e8 e9 e10 e11 f1 f2 f3 f4 f8 f9 f10 f11 g1 g2 g3 g4 g8 g9 g10 g11 h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 j1 j2 j3 j4 j5 j6 j7 j8 j9 j10 j11 k1 k2 k3 k4 k5 k6 k7 k8 k9 k10 k11 l1 l2 l3 l4 l5 l6 l7 l8 l9 l10 l11 pd7/d15 cvcc pd6/d14 pd5/d13 pf6/ as md2 fwe extal pc0/a0 vss cvcc vss vss vcc vss xtal pc1/a1 pc2/a2 pc3/a3 pc5/a5 res nmi vcc stby pc4/a4 pc6/a6 pb0/a8/tioca3 pb6/a14/tioca5 p10/tioca0/a20 p17/tiocb2/tclkd p47/an7 vref md1 osc2 osc1 pc7/a7 pb1/a9/tiocb3 pb3/a11/tiocd3 pa1/a17/txd2 p11/tiocb0/a21 p14/tioca1/ irq0 p97/da1 p44/an4 nc (reserve) avcc md0 pb2/a10/tiocc3 pb4/a12/tioca4 pb7/a15/tiocb5 pa2/a18/rxd2 p13/tiocd0/tclkb/a23 p16/tioca2/ irq1 avss p46/an6 p43/an3 p41/an1 p40/an0 nc (reserve) pb5/a13/tiocb4 pa0/a16 pa3/a19/sck2 p12/tiocc0/tclka/a22 p15/tiocb1/tclkc avss p96/da0 p45/an5 p42/an2 nc (reserve) pin no. bp-112 (top view) pin name pin no. pin name pin no. pin name figure 1.8 pin arrangement of h8s/2238 group (bp-112: top view, only for h8s/2238r, in planning stage)
rev. 2.00, 05/03, page 12 of 846 (3) pin arrangement of h8s/2237 group figure1.9 and figure 1.10 show the pin arrangement of the h8s/2237 group. p30/txd0 p31/rxd0 p32/sck0/ irq4 p33/txd1 p34/rxd1 p35/sck1/ irq5 p36 p77/txd3 p76/rxd3 p75/sck3 p74/ mres p73/tmo1/ cs7 p72/tmo0/ cs6 p71/ cs5 p70/tmri01/tmci01/ cs4 pg0/ irq6 pg1/ cs3 / irq7 pg2/ cs2 pg3/ cs1 pg4/ cs0 pe0/d0 pe1/d1 pe2/d2 pe3/d3 pe4/d4 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 pf0/ breq / irq2 pf1/ back /buzz pf2/ wait pf3/ lwr / adtrg / irq 3 pf4/ hwr pf5/ rd pf6/ as pf7/ md2 fwe extal vss xtal vcc stby nmi res osc1 osc2 md1 md0 avcc vref p40/an0 p41/an1 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 p42/an2 p43/an3 p44/an4 p45/an5 p46/an6 p47/an7 p96/da0 p97/da1 p17/tiocb2/tclkd p16/tioca2/ irq1 p14/tioca1/ irq0 p13/tiocd0/tclkb/a23 p12/tiocc0/tclka/a22 p11/tiocb0/a21 p10/tioca0/a20 pa3/a19/sck2 pa2/a18/rxd2 pa1/a17/txd2 pa0/a16 pb7/a15/tiocb5 pb6/a14/tioca5 pb5/a13/tiocb4 pb4/a12/tioca4 avss p15/tiocb1/tclkc 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 pe5/d5 pe6/d6 pe7/d7 pd0/d8 pd1/d9 pd2/d10 pd3/d11 pd4/d12 pd5/d13 pd6/d14 pd7/d15 pc1/a1 pc2/a2 pc3/a3 pc4/a4 pc5/a5 pc6/a6 pc7/a7 pb0/a8/tioca3 pb2/a10/tiocc3 pb3/a11/tiocd3 vcc pc0/a0 vss pb1/a9/tiocb3 tfp-100b tfp-100g fp-100b (top view) figure 1.9 pin arrangement of h8s/2237 group (tfp-100b, tfp-100g, fp-100b: top view)
rev. 2.00, 05/03, page 13 of 846 p32/sck0/ irq4 p33/txd1 p34/rxd1 p35/sck1/ irq5 p36 p77/txd3 p76/rxd3 p75/sck3 p74/ mres p73/tmo1/ cs7 p72/tmo0/ cs6 p71/ cs5 p70/tmri01/tmci01/ cs4 pg0/ irq6 pg1/ cs3 / irq7 pg2/ cs2 pg3/ cs1 pg4/ cs0 pe0/d0 pe1/d1 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 pf3/ lwr / adtrg / irq 3 pf2/ wait pf1/ back /buzz pf0/ breq / irq2 p30/txd0 p31/rxd0 pf4/ hwr pf5/ rd pf6/ as pf7/ md2 fwe extal vss xtal vcc stby nmi res osc1 osc2 md1 md0 avcc vref p40/an0 p41/an1 p42/an2 p43/an3 p44/an4 75 74 76 77 78 79 80 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 p45/an5 p46/an6 p47/an7 p97/da1 avss p16/tioca2/ irq1 p15/tiocb1/tclkc p14/tioca1/ irq0 p13/tiocd0/tclkb/a23 p12/tiocc0/tclka/a22 p11/tiocb0/a21 p10/tioca0/a20 pa3/a19/sck2 pa2/a18/rxd2 pa1/a17/txd2 pa0/a16 pb7/a15/tiocb5 pb6/a14/tioca5 p96/da0 p17/tiocb2/tclkd 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 pe2/d2 pe3/d3 pe4/d4 pe5/d5 pe6/d6 pe7/d7 pd0/d8 pd1/d9 pd2/d10 pd3/d11 pd4/d12 vcc pc0/a0 vss pc1/a1 pc2/a2 pc3/a3 pc4/a4 pc5/a5 pb1/a9/tiocb3 pb2/a10/tiocc3 pb3/a11/tiocd3 pb4/a12/tioca4 pb5/a13/tiocb4 pc7/a7 pb0/a8/tioca3 pd5/d13 pd6/d14 pd7/d15 pc6/a6 fp-100a (top view) figure 1.10 pin arrangement of h8s/2237 group (fp-100a: top view)
rev. 2.00, 05/03, page 14 of 846 (4) pin arrangement of h8s/2227 group figure 1.11 and figure 1.12 show the pin arrangement of the h8s/2227 group. p30/txd0 p31/rxd0 p32/sck0/ irq4 p33/txd1 p34/rxd1 p35/sck1/ irq5 p36 p77/txd3 p76/rxd3 p75/sck3 p74/ mres p73/tmo1/ cs7 p72/tmo0/ cs6 p71/ cs5 p70/tmri01/tmci01/ cs4 pg0/ irq6 pg1/ cs3 / irq7 pg2/ cs2 pg3/ cs1 pg4/ cs0 pe0/d0 pe1/d1 pe2/d2 pe3/d3 pe4/d4 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 pf0/ breq / irq2 pf1/ back /buzz pf2/ wait pf3/ lwr / adtrg / irq 3 pf4/ hwr pf5/ rd pf6/ as pf7/ md2 fwe extal vss xtal vcc stby nmi res osc1 osc2 md1 md0 avcc vref p40/an0 p41/an1 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 p42/an2 p43/an3 p44/an4 p45/an5 p46/an6 p47/an7 p96 p97 p17/tiocb2/tclkd p16/tioca2/ irq1 p14/tioca1/ irq0 p13/tiocd0/tclkb/a23 p12/tiocc0/tclka/a22 p11/tiocb0/a21 p10/tioca0/a20 pa3/a19 pa2/a18 pa1/a17 pa0/a16 pb7/a15 pb6/a14 pb5/a13 pb4/a12 avss p15/tiocb1/tclkc 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 pe5/d5 pe6/d6 pe7/d7 pd0/d8 pd1/d9 pd2/d10 pd3/d11 pd4/d12 pd5/d13 pd6/d14 pd7/d15 pc1/a1 pc2/a2 pc3/a3 pc4/a4 pc5/a5 pc6/a6 pc7/a7 pb0/a8 pb2/a10 pb3/a11 vcc pc0/a0 vss pb1/a9 tfp-100b tfp-100g fp-100b (top view) figure 1.11 pin arrangement of h8s/2227 group (tfp-100b, tfp-100g, fp-100b: top view)
rev. 2.00, 05/03, page 15 of 846 p32/sck0/ irq4 p33/txd1 p34/rxd1 p35/sck1/ irq5 p36 p77/txd3 p76/rxd3 p75/sck3 p74/ mres p73/tmo1/ cs7 p72/tmo0/ cs6 p71/ cs5 p70/tmri01/tmci01/ cs4 pg0/ irq6 pg1/ cs3 / irq7 pg2/ cs2 pg3/ cs1 pg4/ cs0 pe0/d0 pe1/d1 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 pf3/ lwr / adtrg / irq 3 pf2/ wait pf1/ back /buzz pf0/ breq / irq2 p30/txd0 p31/rxd0 pf4/ hwr pf5/ rd pf6/ as pf7/ md2 fwe extal vss xtal vcc stby nmi res osc1 osc2 md1 md0 avcc vref p40/an0 p41/an1 p42/an2 p43/an3 p44/an4 75 74 76 77 78 79 80 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 p45/an5 p46/an6 p47/an7 p97 avss p16/tioca2/ irq1 p15/tiocb1/tclkc p14/tioca1/ irq0 p13/tiocd0/tclkb/a23 p12/tiocc0/tclka/a22 p11/tiocb0/a21 p10/tioca0/a20 pa3/a19 pa2/a18 pa1/a17 pa0/a16 pb7/a15 pb6/a14 p96 p17/tiocb2/tclkd 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 pe2/d2 pe3/d3 pe4/d4 pe5/d5 pe6/d6 pe7/d7 pd0/d8 pd1/d9 pd2/d10 pd3/d11 pd4/d12 vcc pc0/a0 vss pc1/a1 pc2/a2 pc3/a3 pc4/a4 pc5/a5 pb1/a9 pb2/a10 pb3/a11 pb4/a12 pb5/a13 pc7/a7 pb0/a8 pd5/d13 pd6/d14 pd7/d15 pc6/a6 fp-100a (top view) figure 1.12 pin arrangement of h8s/2227 group (fp-100a: top view)
rev. 2.00, 05/03, page 16 of 846 1.3.2 pin arrangements in each mode tables 1.1, 1.2, 1.3, and 1.4 list the pin arrangements in each mode of the h8s/2239 group, the h8s/2238 group, the h8s/2237 group, and the h8s/2227 group, respectively. table 1.1 pin arrangements in each mode of h8s/2239 group pin no. pin name tfp-100b tfp-100g fp-100b mode 4 mode 5 mode 6 mode 7 flash memory programmable mode 1 pe5/d5 pe5/d5 pe5/d5 pe5 oe 2 pe6/d6 pe6/d6 pe6/d6 pe6 we 3 pe7/d7 pe7/d7 pe7/d7 pe7 ce 4d8d8d8pd0d0 5d9d9d9pd1d1 6 d10 d10 d10 pd2 d2 7 d11 d11 d11 pd3 d3 8 d12 d12 d12 pd4 d4 9 d13 d13 d13 pd5 d5 10 d14 d14 d14 pd6 d6 11 d15 d15 d15 pd7 d7 12 cvcc cvcc cvcc cvcc vcc 13 a0 a0 pc0/a0 pc0 a0 14 vss vss vss vss vss 15 a1 a1 pc1/a1 pc1 a1 16 a2 a2 pc2/a2 pc2 a2 17 a3 a3 pc3/a3 pc3 a3 18 a4 a4 pc4/a4 pc4 a4 19 a5 a5 pc5/a5 pc5 a5 20 a6 a6 pc6/a6 pc6 a6
rev. 2.00, 05/03, page 17 of 846 pin no. pin name tfp-100b tfp-100g fp-100b mode 4 mode 5 mode 6 mode 7 flash memory programmable mode 21 a7 a7 pc7/a7 pc7 a7 22 pb0/a8/ tioca3 pb0/a8/ tioca3 pb0/a8/ tioca3 pb0/tioca3 a8 23 pb1/a9/ tiocb3 pb1/a9/ tiocb3 pb1/a9/ tiocb3 pb1/tiocb3 a9 24 pb2/a10/ tiocc3 pb2/a10/ tiocc3 pb2/a10/ tiocc3 pb2/tiocc3 a10 25 pb3/a11/ tiocd3 pb3/a11/ tiocd3 pb3/a11/ tiocd3 pb3/tiocd3 a11 26 pb4/a12/ tioca4 pb4/a12/ tioca4 pb4/a12/ tioca4 pb4/tioca4 a12 27 pb5/a13/ tiocb4 pb5/a13/ tiocb4 pb5/a13/ tiocb4 pb5/tiocb4 a13 28 pb6/a14/ tioca5 pb6/a14/ tioca5 pb6/a14/ tioca5 pb6/tioca5 a14 29 pb7/a15/ tiocb5 pb7/a15/ tiocb5 pb7/a15/ tiocb5 pb7/tiocb5 a15 30 pa0/a16 pa0/a16 pa0/a16 pa0 a16 31 pa1/a17/txd2 pa1/a17/txd2 pa1/a17/txd2 pa1/txd2 a17 32 pa2/a18/rxd2 pa2/a18/rxd2 pa2/a18/rxd2 pa2/rxd2 a18 33 pa3/a19/ sck2 pa3/a19/ sck2 pa3/a19/ sck2 pa3/sck2 nc 34 p10/tioca0/ dack0 /a20 p10/tioca0/ dack0 /a20 p10/tioca0/ dack0 /a20 p10/tioca0/ dack0 nc 35 p11/tiocb0/ dack1 /a21 p11/tiocb0/ dack1 /a21 p11/tiocb0/ dack1 /a21 p11/tiocb0/ dack1 nc
rev. 2.00, 05/03, page 18 of 846 pin no. pin name tfp-100b tfp-100g fp-100b mode 4 mode 5 mode 6 mode 7 flash memory programmable mode 36 p12/tiocc0/ tclka/a22 p12/tiocc0/ tclka/a22 p12/tiocc0/ tclka/a22 p12/tiocc0/ tclka nc 37 p13/tiocd0/ tclkb/a23 p13/tiocd0/ tclkb/a23 p13/tiocd0/ tclkb/a23 p13/tiocd0/ tclkb nc 38 p14/tioca1/ irq0 p14/tioca1/ irq0 p14/tioca1/ irq0 p14/tioca1/ irq0 vss 39 p15/tiocb1/ tclkc p15/tiocb1/ tclkc p15/tiocb1/ tclkc p15/tiocb1/ tclkc nc 40 p16/tioca2/ irq1 p16/tioca2/ irq1 p16/tioca2/ irq1 p16/tioca2/ irq1 vss 41 p17/tiocb2/ tclkd p17/tiocb2/ tclkd p17/tiocb2/ tclkd p17/tiocb2/ tclkd nc 42 avss avss avss avss vss 43 p97/da1 p97/da1 p97/da1 p97/da1 nc 44 p96/da0 p96/da0 p96/da0 p96/da0 nc 45 p47/an7 p47/an7 p47/an7 p47/an7 nc 46 p46/an6 p46/an6 p46/an6 p46/an6 nc 47 p45/an5 p45/an5 p45/an5 p45/an5 nc 48 p44/an4 p44/an4 p44/an4 p44/an4 nc 49 p43/an3 p43/an3 p43/an3 p43/an3 nc 50 p42/an2 p42/an2 p42/an2 p42/an2 nc 51 p41/an1 p41/an1 p41/an1 p41/an1 nc 52 p40/an0 p40/an0 p40/an0 p40/an0 nc 53 vref vref vref vref vcc 54 avcc avcc avcc avcc vcc 55 md0 md0 md0 md0 vss 56 md1 md1 md1 md1 vss 57 osc2 osc2 osc2 osc2 nc 58 osc1 osc1 osc1 osc1 vss 59 res res res res res 60 nmi nmi nmi nmi vcc
rev. 2.00, 05/03, page 19 of 846 pin no. pin name tfp-100b tfp-100g fp-100b mode 4 mode 5 mode 6 mode 7 flash memory programmable mode 61 stby stby stby stby vcc 62 vcc vcc vcc vcc vcc 63 xtal xtal xtal xtal xtal 64 vss vss vss vss vss 65 extal extal extal extal extal 66 fwe fwe fwe fwe fwe 67 md2 md2 md2 md2 vss 68 pf7/ pf7/ pf7/ pf7/ nc 69 as as as pf6 nc 70 rd rd rd pf5 nc 71 hwr hwr hwr pf4 nc 72 pf3/ lwr / adtrg / irq3 pf3/ lwr / adtrg / irq3 pf3/ lwr / adtrg / irq3 pf3/ adtrg / irq3 nc 73 pf2/ wait pf2/ wait pf2/ wait pf2 nc 74 pf1/ back / buzz pf1/ back / buzz pf1/ back / buzz pf1/buzz nc 75 pf0/ breq / irq2 pf0/ breq / irq2 pf0/ breq / irq2 pf0/ irq2 vcc 76 p30/txd0 p30/txd0 p30/txd0 p30/txd0 nc 77 p31/rxd0 p31/rxd0 p31/rxd0 p31/rxd0 nc 78 p32/sck0/ sda1/ irq4 p32/sck0/ sda1/ irq4 p32/sck0/ sda1/ irq4 p32/sck0/ sda1/ irq4 nc 79 p33/txd1/ scl1 p33/txd1/ scl1 p33/txd1/ scl1 p33/txd1/ scl1 nc 80 p34/rxd1/ sda0 p34/rxd1/ sda0 p34/rxd1/ sda0 p34/rxd1/ sda0 nc
rev. 2.00, 05/03, page 20 of 846 pin no. pin name tfp-100b tfp-100g fp-100b mode 4 mode 5 mode 6 mode 7 flash memory programmable mode 81 p35/sck1/ scl0/ irq5 p35/sck1/ scl0/ irq5 p35/sck1/ scl0/ irq5 p35/sck1/ scl0/ irq5 nc 82 p36 p36 p36 p36 nc 83 p77/txd3 p77/txd3 p77/txd3 p77/txd3 nc 84 p76/rxd3 p76/rxd3 p76/rxd3 p76/rxd3 nc 85 p75/tmo3/ sck3 p75/tmo3/ sck3 p75/tmo3/ sck3 p75/tmo3/ sck3 nc 86 p74/tmo2/ mres p74/tmo2/ mres p74/tmo2/ mres p74/tmo2/ mres nc 87 p73/tmo1/ tend1 / cs7 p73/tmo1/ tend1 / cs7 p73/tmo1/ tend1 / cs7 p73/tmo1/ tend1 nc 88 p72/tmo0/ tend0 / cs6 p72/tmo0/ tend0 / cs6 p72/tmo0/ tend0 / cs6 p72/tmo0/ tend0 nc 89 p71/tmri23/ tmci23/ dreq1 / cs5 p71/tmri23/ tmci23/ dreq1 / cs5 p71/tmri23/ tmci23/ dreq1 / cs5 p71/tmri23/ tmci23/ dreq1 nc 90 p70/tmri01/ tmci01/ dreq0 / cs4 p70/tmri01/ tmci01/ dreq0 / cs4 p70/tmri01/ tmci01/ dreq0 / cs4 p70/tmri01/ tmci01/ dreq0 nc 91 pg0/ irq6 pg0/ irq6 pg0/ irq6 pg0/ irq6 nc 92 pg1/ cs3 / irq7 pg1/ cs3 / irq7 pg1/ cs3 / irq7 pg1/ irq7 nc 93 pg2/ cs2 pg2/ cs2 pg2/ cs2 pg2 nc 94 pg3/ cs1 pg3/ cs1 pg3/ cs1 pg3 nc 95 pg4/ cs0 pg4/ cs0 pg4/ cs0 pg4 nc 96 pe0/d0 pe0/d0 pe0/d0 pe0 nc 97 pe1/d1 pe1/d1 pe1/d1 pe1 nc 98 pe2/d2 pe2/d2 pe2/d2 pe2 nc 99 pe3/d3 pe3/d3 pe3/d3 pe3 vcc 100 pe4/d4 pe4/d4 pe4/d4 pe4 vss
rev. 2.00, 05/03, page 21 of 846 table 1.2 pin arrangements in each mode of h8s/2238 group pin no. pin name tfp-100b tfp-100g fp-100b fp-100a bp-112 mode 4 mode 5 mode 6 mode 7 flash memory programmable mode 1 4 b2 pe5/d5 pe5/d5 pe5/d5 pe5 oe 2 5 b1 pe6/d6 pe6/d6 pe6/d6 pe6 we 3 6 d4 pe7/d7 pe7/d7 pe7/d7 pe7 ce 4 7 c2 d8 d8 d8 pd0 d0 5 8 c1 d9 d9 d9 pd1 d1 6 9 d3 d10 d10 d10 pd2 d2 7 10 d2 d11 d11 d11 pd3 d3 8 11 d1 d12 d12 d12 pd4 d4 9 12 e4 d13 d13 d13 pd5 d5 10 13 e3 d14 d14 d14 pd6 d6 11 14 e1 d15 d15 d15 pd7 d7 12 15 e2, f3 cvcc cvcc cvcc cvcc vcc 13 16 f1 a0 a0 pc0/a0 pc0 a0 14 17 f2, f4 vss vss vss vss vss 15 18 g1 a1 a1 pc1/a1 pc1 a1 16 19 g2 a2 a2 pc2/a2 pc2 a2 17 20 g3 a3 a3 pc3/a3 pc3 a3 18 21 h1 a4 a4 pc4/a4 pc4 a4 19 22 g4 a5 a5 pc5/a5 pc5 a5 20 23 h2 a6 a6 pc6/a6 pc6 a6 21 24 j1 a7 a7 pc7/a7 pc7 a7 22 25 h3 pb0/a8/ tioca3 pb0/a8/ tioca3 pb0/a8/ tioca3 pb0/ tioca3 a8 23 26 j2 pb1/a9/ tiocb3 pb1/a9/ tiocb3 pb1/a9/ tiocb3 pb1/ tiocb3 a9 24 27 k1 pb2/a10/ tiocc3 pb2/a10/ tiocc3 pb2/a10/ tiocc3 pb2/ tiocc3 a10 25 28 j3 pb3/a11/ tiocd3 pb3/a11/ tiocd3 pb3/a11/ tiocd3 pb3/ tiocd3 a11
rev. 2.00, 05/03, page 22 of 846 pin no. pin name tfp-100b tfp-100g fp-100b fp-100a bp-112 mode 4 mode 5 mode 6 mode 7 flash memory programmable mode 26 29 k2 pb4/a12/ tioca4 pb4/a12/ tioca4 pb4/a12/ tioca4 pb4/ tioca4 a12 27 30 l2 pb5/a13/ tiocb4 pb5/a13/ tiocb4 pb5/a13/ tiocb4 pb5/ tiocb4 a13 28 31 h4 pb6/a14/ tioca5 pb6/a14/ tioca5 pb6/a14/ tioca5 pb6/ tioca5 a14 29 32 k3 pb7/a15/ tiocb5 pb7/a15/ tiocb5 pb7/a15/ tiocb5 pb7/ tiocb5 a15 30 33 l3 pa0/a16 pa0/a16 pa0/a16 pa0 a16 31 34 j4 pa1/a17/ txd2 pa1/a17/ txd2 pa1/a17/ txd2 pa1/txd2 a17 32 35 k4 pa2/a18/ rxd2 pa2/a18/ rxd2 pa2/a18/ rxd2 pa2/ rxd2 a18 33 36 l4 pa3/a19/ sck2 pa3/a19/ sck2 pa3/a19/ sck2 pa3/ sck2 nc 34 37 h5 p10/ tioca0/ a20 p10/ tioca0/ a20 p10/ tioca0/ a20 p10/ tioca0 nc 35 38 j5 p11/ tiocb0/ a21 p11/ tiocb0/ a21 p11/ tiocb0/ a21 p11/ tiocb0 nc 36 39 l5 p12/ tiocc0/ tclka/a22 p12/ tiocc0/ tclka/a22 p12/ tiocc0/ tclka/a22 p12/ tiocc0/ tclka nc 37 40 k5 p13/ tiocd0/ tclkb/a23 p13/ tiocd0/ tclkb/a23 p13/ tiocd0/ tclkb/a23 p13/ tiocd0/ tclkb nc 38 41 j6 p14/ tioca1/ irq0 p14/ tioca1/ irq0 p14/ tioca1/ irq0 p14/ tioca1/ irq0 vss 39 42 l6 p15/ tiocb1/ tclkc p15/ tiocb1/ tclkc p15/ tiocb1/ tclkc p15/ tiocb1/ tclkc nc 40 43 k6 p16/ tioca2/ irq1 p16/ tioca2/ irq1 p16/ tioca2/ irq1 p16/ tioca2/ irq1 vss
rev. 2.00, 05/03, page 23 of 846 pin no. pin name tfp-100b tfp-100g fp-100b fp-100a bp-112 mode 4 mode 5 mode 6 mode 7 flash memory programmable mode 41 44 h6 p17/ tiocb2/ tclkd p17/ tiocb2/ tclkd p17/ tiocb2/ tclkd p17/ tiocb2/ tclkd nc 42 45 k7, l7 avss avss avss avss vss 43 46 j7 p97/da1 p97/da1 p97/da1 p97/da1 nc 44 47 l8 p96/da0 p96/da0 p96/da0 p96/da0 nc 45 48 h7 p47/an7 p47/an7 p47/an7 p47/an7 nc 46 49 k8 p46/an6 p46/an6 p46/an6 p46/an6 nc 47 50 l9 p45/an5 p45/an5 p45/an5 p45/an5 nc 48 51 j8 p44/an4 p44/an4 p44/an4 p44/an4 nc 49 52 k9 p43/an3 p43/an3 p43/an3 p43/an3 nc 50 53 l10 p42/an2 p42/an2 p42/an2 p42/an2 nc 51 54 k10 p41/an1 p41/an1 p41/an1 p41/an1 nc 52 55 k11 p40/an0 p40/an0 p40/an0 p40/an0 nc 53 56 h8 vref vref vref vref vcc 54 57 j10 avcc avcc avcc avcc vcc 55 58 j11 md0 md0 md0 md0 vss 56 59 h9 md1 md1 md1 md1 vss 57 60 h10 osc2 osc2 osc2 osc2 nc 58 61 h11 osc1 osc1 osc1 osc1 vss 59 62 g8 res res res res res 60 63 g9 nmi nmi nmi nmi vcc 61 64 g11 stby stby stby stby vcc 62 65 f9, g10 vcc vcc vcc vcc vcc 63 66 f11 xtal xtal xtal xtal xtal 64 67 f8, f10 vss vss vss vss vss 65 68 e11 extal extal extal extal extal 66 69 e10 fwe fwe fwe fwe fwe 67 70 e9 md2 md2 md2 md2 vss 68 71 d11 pf7/ pf7/ pf7/ pf7/ nc 69 72 e8 as as as pf6 nc 70 73 d10 rd rd rd pf5 nc
rev. 2.00, 05/03, page 24 of 846 pin no. pin name tfp-100b tfp-100g fp-100b fp-100a bp-112 mode 4 mode 5 mode 6 mode 7 flash memory programmable mode 71 74 c11 hwr hwr hwr pf4 nc 72 75 d9 pf3/ lwr / adtrg / irq3 pf3/ lwr / adtrg / irq3 pf3/ lwr / adtrg / irq3 pf3/ adtrg / irq3 nc 73 76 c10 pf2/ wait pf2/ wait pf2/ wait pf2 nc 74 77 b11 pf1/ back / buzz pf1/ back / buzz pf1/ back / buzz pf1/ buzz nc 75 78 c9 pf0/ breq / irq2 pf0/ breq / irq2 pf0/ breq / irq2 pf0/ irq2 vcc 76 79 a10 p30/ txd0 p30/ txd0 p30/ txd0 p30/ txd0 nc 77 80 d8 p31/ rxd0 p31/ rxd0 p31/ rxd0 p31/ rxd0 nc 78 81 b9 p32/ sck0/ sda1/ irq4 p32/ sck0/ sda1/ irq4 p32/ sck0/ sda1/ irq4 p32/ sck0/ sda1/ irq4 nc 79 82 a9 p33/ txd1/ scl1 p33/ txd1/ scl1 p33/ txd1/ scl1 p33/ txd1/ scl1 nc 80 83 c8 p34/ rxd1/ sda0 p34/ rxd1/ sda0 p34/ rxd1/ sda0 p34/ rxd1/ sda0 nc 81 84 b8 p35/ sck1/ scl0/ irq5 p35/ sck1/ scl0/ irq5 p35/ sck1/ scl0/ irq5 p35/ sck1/ scl0/ irq5 nc 82 85 a8 p36 p36 p36 p36 nc 83 86 d7 p77/ txd3 p77/ txd3 p77/ txd3 p77/ txd3 nc 84 87 c7 p76/ rxd3 p76/ rxd3 p76/ rxd3 p76/ rxd3 nc 85 88 a7 p75/ tmo3/ sck3 p75/ tmo3/ sck3 p75/ tmo3/ sck3 p75/ tmo3/ sck3 nc
rev. 2.00, 05/03, page 25 of 846 pin no. pin name tfp-100b tfp-100g fp-100b fp-100a bp-112 mode 4 mode 5 mode 6 mode 7 flash memory programmable mode 86 89 b7 p74/ tmo2/ mres p74/ tmo2/ mres p74/ tmo2/ mres p74/ tmo2/ mres nc 87 90 c6 p73/ tmo1/ cs7 p73/ tmo1/ cs7 p73/ tmo1/ cs7 p73/ tmo1 nc 88 91 a6 p72/ tmo0/ cs6 p72/ tmo0/ cs6 p72/ tmo0/ cs6 p72/ tmo0 nc 89 92 b6 p71/ tmri23/ tmci23/ cs5 p71/ tmri23/ tmci23/ cs5 p71/ tmri23/ tmci23/ cs5 p71/ tmri23/ tmci23 nc 90 93 d6 p70/ tmri01/ tmci01/ cs4 p70/ tmri01/ tmci01/ cs4 p70/ tmri01/ tmci01/ cs4 p70/ tmri01/ tmci01 nc 91 94 a5 pg0/ irq6 pg0/ irq6 pg0/ irq6 pg0/ irq6 nc 92 95 b5 pg1/ cs3 / irq7 pg1/ cs3 / irq7 pg1/ cs3 / irq7 pg1/ irq7 nc 93 96 c5 pg2/ cs2 pg2/ cs2 pg2/ cs2 pg2 nc 94 97 a4 pg3/ cs1 pg3/ cs1 pg3/ cs1 pg3 nc 95 98 d5 pg4/ cs0 pg4/ cs0 pg4/ cs0 pg4 nc 96 99 b4 pe0/d0 pe0/d0 pe0/d0 pe0 nc 97 100 a3 pe1/d1 pe1/d1 pe1/d1 pe1 nc 98 1 c4 pe2/d2 pe2/d2 pe2/d2 pe2 nc 99 2 b3 pe3/d3 pe3/d3 pe3/d3 pe3 vcc 100 3 a2 pe4/d4 pe4/d4 pe4/d4 pe4 vss
rev. 2.00, 05/03, page 26 of 846 table 1.3 pin arrangements in each mode of h8s/2237 group pin no. pin name tfp-100b tfp-100g fp-100b fp-100a mode 4 mode 5 mode 6 mode 7 prom mode 1 4 pe5/d5 pe5/d5 pe5/d5 pe5 nc 2 5 pe6/d6 pe6/d6 pe6/d6 pe6 nc 3 6 pe7/d7 pe7/d7 pe7/d7 pe7 nc 4 7 d8 d8 d8 pd0 d0 5 8 d9 d9 d9 pd1 d1 6 9 d10 d10 d10 pd2 d2 7 10 d11 d11 d11 pd3 d3 8 11 d12 d12 d12 pd4 d4 9 12 d13 d13 d13 pd5 d5 10 13 d14 d14 d14 pd6 d6 11 14 d15 d15 d15 pd7 d7 12 15 vcc vcc vcc vcc vcc 13 16 a0 a0 pc0/a0 pc0 a0 14 17 vss vss vss vss vss 15 18 a1 a1 pc1/a1 pc1 a1 16 19 a2 a2 pc2/a2 pc2 a2 17 20 a3 a3 pc3/a3 pc3 a3 18 21 a4 a4 pc4/a4 pc4 a4 19 22 a5 a5 pc5/a5 pc5 a5 20 23 a6 a6 pc6/a6 pc6 a6 21 24 a7 a7 pc7/a7 pc7 a7 22 25 pb0/a8/ tioca3 pb0/a8/ tioca3 pb0/a8/ tioca3 pb0/ tioca3 a8 23 26 pb1/a9/ tiocb3 pb1/a9/ tiocb3 pb1/a9/ tiocb3 pb1/ tiocb3 oe 24 27 pb2/a10/ tiocc3 pb2/a10/ tiocc3 pb2/a10/ tiocc3 pb2/ tiocc3 a10 25 28 pb3/a11/ tiocd3 pb3/a11/ tiocd3 pb3/a11/ tiocd3 pb3/ tiocd3 a11
rev. 2.00, 05/03, page 27 of 846 pin no. pin name tfp-100b tfp-100g fp-100b fp-100a mode 4 mode 5 mode 6 mode 7 prom mode 26 29 pb4/a12/ tioca4 pb4/a12/ tioca4 pb4/a12/ tioca4 pb4/ tioca4 a12 27 30 pb5/a13/ tiocb4 pb5/a13/ tiocb4 pb5/a13/ tiocb4 pb5/ tiocb4 a13 28 31 pb6/a14/ tioca5 pb6/a14/ tioca5 pb6/a14/ tioca5 pb6/ tioca5 a14 29 32 pb7/a15/ tiocb5 pb7/a15/ tiocb5 pb7/a15/ tiocb5 pb7/ tiocb5 a15 30 33 pa0/a16 pa0/a16 pa0/a16 pa0 a16 31 34 pa1/a17/ txd2 pa1/a17/ txd2 pa1/a17/ txd2 pa1/txd2 vcc 32 35 pa2/a18/ rxd2 pa2/a18/ rxd2 pa2/a18/ rxd2 pa2/rxd2 vcc 33 36 pa3/a19/ sck2 pa3/a19/ sck2 pa3/a19/ sck2 pa3/sck2 nc 34 37 p10/ tioca0/a20 p10/ tioca0/a20 p10/ tioca0/a20 p10/ tioca0 nc 35 38 p11/ tiocb0/a21 p11/ tiocb0/a21 p11/ tiocb0/a21 p11/ tiocb0 nc 36 39 p12/ tiocc0/ tclka/a22 p12/ tiocc0/ tclka/a22 p12/ tiocc0/ tclka/a22 p12/ tiocc0/ tclka nc 37 40 p13/ tiocd0/ tclkb/a23 p13/ tiocd0/ tclkb/a23 p13/ tiocd0/ tclkb/a23 p13/ tiocd0/ tclkb nc 38 41 p14/ tioca1/ irq0 p14/ tioca1/ irq0 p14/ tioca1/ irq0 p14/ tioca1/ irq0 nc 39 42 p15/ tiocb1/ tclkc p15/ tiocb1/ tclkc p15/ tiocb1/ tclkc p15/ tiocb1/ tclkc nc 40 43 p16/ tioca2/ irq1 p16/ tioca2/ irq1 p16/ tioca2/ irq1 p16/ tioca2/ irq1 nc
rev. 2.00, 05/03, page 28 of 846 pin no. pin name tfp-100b tfp-100g fp-100b fp-100a mode 4 mode 5 mode 6 mode 7 prom mode 41 44 p17/ tiocb2/ tclkd p17/ tiocb2/ tclkd p17/ tiocb2/ tclkd p17/ tiocb2/ tclkd nc 42 45 avss avss avss avss vss 43 46 p97/da1 p97/da1 p97/da1 p97/da1 nc 44 47 p96/da0 p96/da0 p96/da0 p96/da0 nc 45 48 p47/an7 p47/an7 p47/an7 p47/an7 nc 46 49 p46/an6 p46/an6 p46/an6 p46/an6 nc 47 50 p45/an5 p45/an5 p45/an5 p45/an5 nc 48 51 p44/an4 p44/an4 p44/an4 p44/an4 nc 49 52 p43/an3 p43/an3 p43/an3 p43/an3 nc 50 53 p42/an2 p42/an2 p42/an2 p42/an2 nc 51 54 p41/an1 p41/an1 p41/an1 p41/an1 nc 52 55 p40/an0 p40/an0 p40/an0 p40/an0 nc 53 56 vref vref vref vref vcc 54 57 avcc avcc avcc avcc vcc 55 58 md0 md0 md0 md0 vss 56 59 md1 md1 md1 md1 vss 57 60 osc2 osc2 osc2 osc2 nc 58 61 osc1 osc1 osc1 osc1 nc 59 62 res res res res vpp 60 63 nmi nmi nmi nmi a9 61 64 stby stby stby stby vss 62 65 vcc vcc vcc vcc vcc 63 66 xtal xtal xtal xtal nc 64 67 vss vss vss vss vss 65 68 extal extal extal extal nc 66 69 fwe fwe fwe fwe nc 67 70 md2 md2 md2 md2 vss 68 71 pf7/ pf7/ pf7/ pf7/ nc 69 72 as as as pf6 nc 70 73 rd rd rd pf5 nc
rev. 2.00, 05/03, page 29 of 846 pin no. pin name tfp-100b tfp-100g fp-100b fp-100a mode 4 mode 5 mode 6 mode 7 prom mode 71 74 hwr hwr hwr pf4 nc 72 75 pf3/ lwr / adtrg / irq3 pf3/ lwr / adtrg / irq3 pf3/ lwr / adtrg / irq3 pf3/ adtrg / irq3 nc 73 76 pf2/ wait pf2/ wait pf2/ wait pf2 ce 74 77 pf1/ back / buzz pf1/ back / buzz pf1/ back / buzz pf1/buzz pgm 75 78 pf0/ breq / irq2 pf0/ breq / irq2 pf0/ breq / irq2 pf0/ irq2 nc 76 79 p30/txd0 p30/txd0 p30/txd0 p30/txd0 nc 77 80 p31/rxd0 p31/rxd0 p31/rxd0 p31/rxd0 nc 78 81 p32/sck0/ irq4 p32/sck0/ irq4 p32/sck0/ irq4 p32/sck0/ irq4 nc 79 82 p33/txd1 p33/txd1 p33/txd1 p33/txd1 nc 80 83 p34/rxd1 p34/rxd1 p34/rxd1 p34/rxd1 nc 81 84 p35/sck1/ irq5 p35/sck1/ irq5 p35/sck1/ irq5 p35/sck1/ irq5 nc 82 85 p36 p36 p36 p36 nc 83 86 p77/txd3 p77/txd3 p77/txd3 p77/txd3 nc 84 87 p76/rxd3 p76/rxd3 p76/rxd3 p76/rxd3 nc 85 88 p75/sck3 p75/sck3 p75/sck3 p75/sck3 nc 86 89 p74/ mres p74/ mres p74/ mres p74/ mres nc 87 90 p73/tmo1/ cs7 p73/tmo1/ cs7 p73/tmo1/ cs7 p73/tmo1 nc 88 91 p72/tmo0/ cs6 p72/tmo0/ cs6 p72/tmo0/ cs6 p72/tmo0 nc 89 92 p71/ cs5 p71/ cs5 p71/ cs5 p71 nc 90 93 p70/ tmri01/ tmci01/ cs4 p70/ tmri01/ tmci01/ cs4 p70/ tmri01/ tmci01/ cs4 p70/ tmri01/ tmci01 nc
rev. 2.00, 05/03, page 30 of 846 pin no. pin name tfp-100b tfp-100g fp-100b fp-100a mode 4 mode 5 mode 6 mode 7 prom mode 91 94 pg0/ irq6 pg0/ irq6 pg0/ irq6 pg0/ irq6 nc 92 95 pg1/ cs3 / irq7 pg1/ cs3 / irq7 pg1/ cs3 / irq7 pg1/ irq7 nc 93 96 pg2/ cs2 pg2/ cs2 pg2/ cs2 pg2 nc 94 97 pg3/ cs1 pg3/ cs1 pg3/ cs1 pg3 nc 95 98 pg4/ cs0 pg4/ cs0 pg4/ cs0 pg4 nc 96 99 pe0/d0 pe0/d0 pe0/d0 pe0 nc 97 100 pe1/d1 pe1/d1 pe1/d1 pe1 nc 98 1 pe2/d2 pe2/d2 pe2/d2 pe2 nc 99 2 pe3/d3 pe3/d3 pe3/d3 pe3 nc 100 3 pe4/d4 pe4/d4 pe4/d4 pe4 nc
rev. 2.00, 05/03, page 31 of 846 table 1.4 pin arrangements in each mode of h8s/2227 group pin no. pin name tfp-100b tfp-100g fp-100b fp-100a mode 4 mode 5 mode 6 mode 7 flash memory programmable mode 1 4 pe5/d5 pe5/d5 pe5/d5 pe5 oe 2 5 pe6/d6 pe6/d6 pe6/d6 pe6 we 3 6 pe7/d7 pe7/d7 pe7/d7 pe7 ce 4 7 d8 d8 d8 pd0 d0 5 8 d9 d9 d9 pd1 d1 6 9 d10 d10 d10 pd2 d2 7 10 d11 d11 d11 pd3 d3 8 11 d12 d12 d12 pd4 d4 9 12 d13 d13 d13 pd5 d5 10 13 d14 d14 d14 pd6 d6 11 14 d15 d15 d15 pd7 d7 12 15 vcc vcc vcc vcc vcc 13 16 a0 a0 pc0/a0 pc0 a0 14 17 vss vss vss vss vss 15 18 a1 a1 pc1/a1 pc1 a1 16 19 a2 a2 pc2/a2 pc2 a2 17 20 a3 a3 pc3/a3 pc3 a3 18 21 a4 a4 pc4/a4 pc4 a4 19 22 a5 a5 pc5/a5 pc5 a5 20 23 a6 a6 pc6/a6 pc6 a6 21 24 a7 a7 pc7/a7 pc7 a7 22 25 pb0/a8 pb0/a8 pb0/a8 pb0 a8 23 26 pb1/a9 pb1/a9 pb1/a9 pb1 a9 24 27 pb2/a10 pb2/a10 pb2/a10 pb2 a10 25 28 pb3/a11 pb3/a11 pb3/a11 pb3 a11
rev. 2.00, 05/03, page 32 of 846 pin no. pin name tfp-100b tfp-100g fp-100b fp-100a mode 4 mode 5 mode 6 mode 7 flash memory programmable mode 26 29 pb4/a12 pb4/a12 pb4/a12 pb4 a12 27 30 pb5/a13 pb5/a13 pb5/a13 pb5 a13 28 31 pb6/a14 pb6/a14 pb6/a14 pb6 a14 29 32 pb7/a15 pb7/a15 pb7/a15 pb7 a15 30 33 pa0/a16 pa0/a16 pa0/a16 pa0 a16 31 34 pa1/a17 pa1/a17 pa1/a17 pa1 a17 32 35 pa2/a18 pa2/a18 pa2/a18 pa2 a18 33 36 pa3/a19 pa3/a19 pa3/a19 pa3 nc 34 37 p10/ tioca0/ a20 p10/ tioca0/ a20 p10/ tioca0/ a20 p10/ tioca0 nc 35 38 p11/ tiocb0/ a21 p11/ tiocb0/ a21 p11/ tiocb0/ a21 p11/ tiocb0 nc 36 39 p12/ tiocc0/ tclka/a22 p12/ tiocc0/ tclka/a22 p12/ tiocc0/ tclka/a22 p12/ tiocc0/ tclka nc 37 40 p13/ tiocd0/ tclkb/a23 p13/ tiocd0/ tclkb/a23 p13/ tiocd0/ tclkb/a23 p13/ tiocd0/ tclkb nc 38 41 p14/ tioca1/ irq0 p14/ tioca1/ irq0 p14/ tioca1/ irq0 p14/ tioca1/ irq0 vss 39 42 p15/ tiocb1/ tclkc p15/ tiocb1/ tclkc p15/ tiocb1/ tclkc p15/ tiocb1/ tclkc nc 40 43 p16/ tioca2/ irq1 p16/ tioca2/ irq1 p16/ tioca2/ irq1 p16/ tioca2/ irq1 vss 41 44 p17/ tiocb2/ tclkd p17/ tiocb2/ tclkd p17/ tiocb2/ tclkd p17/ tiocb2/ tclkd nc 42 45 avss avss avss avss vss 43 46 p97 p97 p97 p97 nc 44 47 p96 p96 p96 p96 nc 45 48 p47/an7 p47/an7 p47/an7 p47/an7 nc
rev. 2.00, 05/03, page 33 of 846 pin no. pin name tfp-100b tfp-100g fp-100b fp-100a mode 4 mode 5 mode 6 mode 7 flash memory programmable mode 46 49 p46/an6 p46/an6 p46/an6 p46/an6 nc 47 50 p45/an5 p45/an5 p45/an5 p45/an5 nc 48 51 p44/an4 p44/an4 p44/an4 p44/an4 nc 49 52 p43/an3 p43/an3 p43/an3 p43/an3 nc 50 53 p42/an2 p42/an2 p42/an2 p42/an2 nc 51 54 p41/an1 p41/an1 p41/an1 p41/an1 nc 52 55 p40/an0 p40/an0 p40/an0 p40/an0 nc 53 56 vref vref vref vref vcc 54 57 avcc avcc avcc avcc vcc 55 58 md0 md0 md0 md0 vss 56 59 md1 md1 md1 md1 vss 57 60 osc2 osc2 osc2 osc2 nc 58 61 osc1 osc1 osc1 osc1 vcc 59 62 res res res res res 60 63 nmi nmi nmi nmi vcc 61 64 stby stby stby stby vcc 62 65 vcc vcc vcc vcc vcc 63 66 xtal xtal xtal xtal xtal 64 67 vss vss vss vss vss 65 68 extal extal extal extal extal 66 69 fwe fwe fwe fwe fwe 67 70 md2 md2 md2 md2 vss 68 71 pf7/ pf7/ pf7/ pf7/ nc 69 72 as as as pf6 nc 70 73 rd rd rd pf5 nc
rev. 2.00, 05/03, page 34 of 846 pin no. pin name tfp-100b tfp-100g fp-100b fp-100a mode 4 mode 5 mode 6 mode 7 flash memory programmable mode 71 74 hwr hwr hwr pf4 nc 72 75 pf3/ lwr / adtrg / irq3 pf3/ lwr / adtrg / irq3 pf3/ lwr / adtrg / irq3 pf3/ adtrg / irq3 vcc 73 76 pf2/ wait pf2/ wait pf2/ wait pf2 nc 74 77 pf1/ back / buzz pf1/ back / buzz pf1/ back / buzz pf1/buzz nc 75 78 pf0/ breq / irq2 pf0/ breq / irq2 pf0/ breq / irq2 pf0/ irq2 vcc 76 79 p30/txd0 p30/txd0 p30/txd0 p30/txd0 nc 77 80 p31/rxd0 p31/rxd0 p31/rxd0 p31/rxd0 nc 78 81 p32/sck0/ irq4 p32/sck0/ irq4 p32/sck0/ irq4 p32/sck0/ irq4 nc 79 82 p33/txd1 p33/txd1 p33/txd1 p33/txd1 nc 80 83 p34/rxd1 p34/rxd1 p34/rxd1 p34/rxd1 nc 81 84 p35/sck1/ irq5 p35/sck1/ irq5 p35/sck1/ irq5 p35/sck1/ irq5 nc 82 85 p36 p36 p36 p36 nc 83 86 p77/txd3 p77/txd3 p77/txd3 p77/txd3 nc 84 87 p76/rxd3 p76/rxd3 p76/rxd3 p76/rxd3 nc 85 88 p75/sck3 p75/sck3 p75/sck3 p75/sck3 nc 86 89 p74/ mres p74/ mres p74/ mres p74/ mres nc 87 90 p73/tmo1/ cs7 p73/tmo1/ cs7 p73/tmo1/ cs7 p73/tmo1 nc 88 91 p72/tmo0/ cs6 p72/tmo0/ cs6 p72/tmo0/ cs6 p72/tmo0 nc 89 92 p71/ cs5 p71/ cs5 p71/ cs5 p71 nc 90 93 p70/ tmri01/ tmci01/ cs4 p70/ tmri01/ tmci01/ cs4 p70/ tmri01/ tmci01/ cs4 p70/ tmri01/ tmci01 nc
rev. 2.00, 05/03, page 35 of 846 pin no. pin name tfp-100b tfp-100g fp-100b fp-100a mode 4 mode 5 mode 6 mode 7 flash memory programmable mode 91 94 pg0/ irq6 pg0/ irq6 pg0/ irq6 pg0/ irq6 nc 92 95 pg1/ cs3 / irq7 pg1/ cs3 / irq7 pg1/ cs3 / irq7 pg1/ irq7 nc 93 96 pg2/ cs2 pg2/ cs2 pg2/ cs2 pg2 nc 94 97 pg3/ cs1 pg3/ cs1 pg3/ cs1 pg3 nc 95 98 pg4/ cs0 pg4/ cs0 pg4/ cs0 pg4 nc 96 99 pe0/d0 pe0/d0 pe0/d0 pe0 nc 97 100 pe1/d1 pe1/d1 pe1/d1 pe1 nc 98 1 pe2/d2 pe2/d2 pe2/d2 pe2 nc 99 2 pe3/d3 pe3/d3 pe3/d3 pe3 vcc 100 3 pe4/d4 pe4/d4 pe4/d4 pe4 vss
rev. 2.00, 05/03, page 36 of 846 1.3.3 pin functions table 1.5 lists the pin functions of the h8s/2239 group and h8s/2238r group. table 1.6 lists the pin functions of the h8s/2237 group and h8s/2227 group. table 1.5 pin functions of h8s/2239 group and h8s/2238r group pin no. type symbol tfp-100b tfp-100g fp-100b fp-100a * 3 bp-112 * 1 i/o function power supply vcc 62 65 f9, g10 input for connection to the power supply. connect all vcc pins to the system power supply. cvcc 12 15 e2, f3 input with a 5-v external power supply (h8s/2238b used), connect a 0.1-f stabilization capacitance between this pin and ground. permanent damage on the chip may result if the absolute maximum rating of cvcc 4.3 v is exceeded. must not connect the 5 v external power supply to this pin. with a 3-v external power supply (h8s/2239, h8s/2238r used), connect this pin to the system power supply. see section 24, power supply circuit, for connection examples. vss 14 64 17 67 f2, f3 f8, f10 input for connection to the power supply (0 v). connect all vss pins to the system power supply (0 v). clock xtal 63 66 f11 input for connection to a crystal resonator. for examples of crystal resonator connection and external clock input, see section 22, clock pulse generator. extal 65 68 e11 input for connection to a crystal resonator. this pin can be also used for external clock input. for examples of crystal resonator connection and external clock input, see section 22, clock pulse generator. osc1 58 61 h11 input connects to a 32.768 khz crystal resonator. see section 22, clock pulse generator, for typical connection diagrams for a crystal resonator. osc2 57 60 h10 input connects to a 32.768 khz crystal resonator. see section 22, clock pulse generator, for typical connection diagrams for a crystal resonator.
rev. 2.00, 05/03, page 37 of 846 pin no. type symbol tfp-100b tfp-100g fp-100b fp-100a * 3 bp-112 * 1 i/o function clock 68 71 d11 output supplies the system clock to external devices. operating mode control md2 md1 md0 67 56 55 70 59 58 e9 h9 j11 input sets the operating mode. inputs at these pins should not be changed during operation. except for mode changing, be sure to fix the levels of the mode pins (md2 to md0) by pulling them down or pulling them up until the power turns off. system control res 59 62 g8 input reset input pin. when this pin is low, the chip enters the power-on reset state. mres 86 89 b7 input when this pin is low, the chip enters the manual reset state. stby 61 64 g11 input when this pin is low, a transition is made to hardware standby mode. breq 75 78 c9 input used by an external bus master to request the bus mastership to this lsi. back 74 77 b11 output indicates that the bus mastership has been granted to an external bus master. fwe 66 69 e10 input enables/disables programming the flash memory. interrupts nmi 60 63 g9 input nonmaskable interrupt pin. if this pin is not used, it should be fixed high. irq7 irq6 irq5 irq4 irq3 irq2 irq1 irq0 92 91 81 78 72 75 40 38 95 94 84 81 75 78 43 41 b5 a5 b8 b9 d9 c9 k6 j6 input these pins request a maskable interrupt. address bus a23 to a0 37 to 15, 13 40 to 18, 16 k5, l5, j5, h5, l4, k4, j4, l3, k3, h4, l2, k2, j3, k1, j2, h3, j1, h2, g4, h1, g3, g2, g1, f1 output outputs address.
rev. 2.00, 05/03, page 38 of 846 pin no. type symbol tfp-100b tfp-100g fp-100b fp-100a * 3 bp-112 * 1 i/o function data bus d15 to d0 11 to 1 100 to 96 14 to 1, 100, 99 e1, e3, e4, d1, d2, d3, c1, c2, d4, b1, b2, a2, b3, c4, a3, b4 input/ output used as the bidirectional data bus. bus control cs7 cs6 cs5 cs4 cs3 cs2 cs1 cs0 87 88 89 90 92 93 94 95 90 91 92 93 95 96 97 98 c6 a6 b6 d6 b5 c5 a4 d5 output select signals for areas 7 to 0. as 69 72 e8 output when this pin is low, it indicates valid address output on the address bus. rd 70 73 d10 output when this pin is low, it indicates that the external address space is being read. hwr 71 74 c11 output strobe signal: writes to the external address bus to indicate valid data on the upper data bus (d15 to d8). lwr 72 75 d9 output strobe signal: writes to the external bus to indicate valid data on the lower data bus (d7 to d0). wait 73 76 c10 input requests insertion of wait states in bus cycle when accesses to the external three- state address. dma controller (dmac) * 2 dreq1 dreq0 89 90 ?? input request dmac activation. (supported only by the h8s/2239 group.) tend1 tend0 87 88 ?? output indicate that the dmac has ended transmitting data. (supported only by the h8s/2239 group.) dack1 dack0 35 34 ?? output these pins function as single address transmitting acknowledge of dmac. (supported only by the h8s/2239 group.)
rev. 2.00, 05/03, page 39 of 846 pin no. type symbol tfp-100b tfp-100g fp-100b fp-100a * 3 bp-112 * 1 i/o function 16-bit timer- pulse unit (tpu) tclkd tclkc tclkb tclka 41 39 37 36 44 42 40 39 h6 l6 k5 l5 input these pins input an external clock. tioca0 tiocb0 tiocc0 tiocd0 34 35 36 37 37 38 39 40 h5 j5 l5 k5 input/ output pins for the tgra_0 to tgrd_0 input capture input, output compare output, or pwm output. tioca1 tiocb1 38 39 41 42 j6 l6 input/ output pins for the tgra _ 1 and tgrb _ 1 input capture input, output compare output, or pwm output. tioca2 tiocb2 40 41 43 44 k6 h6 input/ output pins for the tgra _ 2 and tgrb _ 2 input capture input, output compare output, or pwm output. tioca3 tiocb3 tiocc3 tiocd3 22 23 24 25 25 26 27 28 h3 j2 k1 j3 input/ output pins for the tgra_3 to tgrd_3 input capture input, output compare output, or pwm output. tioca4 tiocb4 26 27 29 30 k2 l2 input/ output pins for the tgra_4 and tgrb_4 input capture input, output compare output, or pwm output. tioca5 tiocb5 28 29 31 32 h4 k3 input/ output pins for the tgra_5 and tgrb_5 input capture input, output compare output, or pwm output. 8-bit timer tmo3 to tmo0 85 to 88 88 to 91 a7, b7, c6, a6, output compare-match output pins tmci23 tmci01 89 90 92 93 b6 d6 input pins for external clock input to the counter tmri23 tmri01 89 90 92 93 b6 d6 input counter reset input pins. watchdog timer (wdt) buzz 74 77 b11 output this pin outputs the pulse that is divided by watchdog timer.
rev. 2.00, 05/03, page 40 of 846 pin no. type symbol tfp-100b tfp-100g fp-100b fp-100a * 3 bp-112 * 1 i/o function txd3 txd2 txd1 txd0 83 31 79 76 86 34 82 79 d7 j4 a9 a10 output data output pins serial communi- cation interface (sci)/ smart card interface rxd3 rxd2 rxd1 rxd0 84 32 80 77 87 35 83 80 c7 k4 c8 d8 input data input pins sck3 sck2 sck1 sck0 85 33 81 78 88 36 84 81 a7 l4 b8 b9 input/ output clock input/output pins i 2 c bus interface (iic) (optional) scl1 scl0 79 81 82 84 a9 b8 input/ output i 2 c clock input/output pins. these pins drive bus. the output of scl0 is nmos open drain. sda1 sda0 78 80 81 83 b9 c8 input/ output i 2 c data input/output pins. these pins drive bus. the output of sda0 is nmos open drain. a/d converter an7 to an0 45 to 52 48 to 55 h7, k8, l9, j8, k9, l10, k10, k11 input analog input pins for the a/d converter adtrg 72 75 d9 input pin for input of an external trigger to start a/d conversion d/a converter da1 da0 43 44 46 47 j7 l8 output analog output pins for the d/a converter. a/d converter, d/a converter avcc 54 57 j10 input power supply pin for the a/d converter and d/a converter. if none of the a/d converter and d/a converter is used, connect this pin to the system power supply. avss 42 45 k7, l7 input ground pin for the a/d converter and d/a converter. connect this pin to the system power supply (0 v). vref 53 56 h8 input reference voltage input pin for the a/d converter and d/a converter. if neither the a/d converter nor d/a converter is used, connect this pin to the system power supply.
rev. 2.00, 05/03, page 41 of 846 pin no. type symbol tfp-100b tfp-100g fp-100b fp-100a * 3 bp-112 * 1 i/o function i/o ports p17 to p10 41 to 34 44 to 37 h6, k6, l6, j6, k5, l5, j5, h5 input/ output 8-bit i/o pins p36 to p30 82 to 76 85 to 79 a8, b8, c8, a9, b9, d8, a10 input/ output 7-bit i/o pins p34 and p35 output nmos push/pull. p47 to p40 45 to 52 48 to 55 h7, k8, l9, j8, k9, l10, k10, k11 input 8-bit input pins p77 to p70 83 to 90 86 to 93 d7, c7, a7, b7, c6, a6, b6, d6 input/ output 8-bit i/o pins p97 p96 43 44 46 47 j7 l8 input 2-bit input pins pa3 to pa0 33 to 30 36 to 33 l4, k4, j4, l3 input/ output 4-bit i/o pins pb7 to pb0 29 to 22 32 to 25 k3, h4, l2, k2, j3, k1, j2, h3 input/ output 8-bit i/o pins pc7 to pc0 21 to 15, 13 24 to 18, 16 j1, h2, g4, h1, g3, g2, g1, f1 input/ output 8-bit i/o pins pd7 to pd0 11 to 4 14 to 7 e1, e3, e4, d1, d2, d3, c1, c2 input/ output 8-bit i/o pins pe7 to pe0 3 to 1, 100 to 96 6 to 1, 100 to 99 d4, b1, b2, a2, b3, c4, a3, b4 input/ output 8-bit i/o pins pf7 to pf0 68 to 75 71 to 78 d11, e8, d10, c11, d9, c10, b11, c9 input/ output 8-bit i/o pins pg4 to pg0 95 to 91 98 to 94 d5, a4, c5, b5, a5 input/ output 5-bit i/o pins notes: * 1 supported only by the h8s/2238r. * 2 supported only by the h8s/2239 group. * 3 supported only by the h8s/2238b.
rev. 2.00, 05/03, page 42 of 846 table 1.6 pin functions of h8s/2237 group and h8s/2227 group pin no. type symbol tfp-100b tfp-100g fp-100b bp-100a i/o function power supply vcc 12 62 15 65 input for connection to the power supply. connect all vcc pins to the system power supply. vss 14 64 17 67 input for connection to the power supply (0 v). connect all vss pins to the system power supply (0 v). clock xtal 63 66 input for connection to a crystal resonator. for examples of crystal resonator connection and external clock input, see section 22, clock pulse generator. extal 65 68 input for connection to a crystal resonator. this pin can be also used for external clock input. for examples of crystal resonator connection and external clock input, see section 22, clock pulse generator. osc1 58 61 input connects to a 32.768 khz crystal resonator. see section 22, clock pulse generator, for typical connection diagrams for a crystal resonator. osc2 57 60 input connects to a 32.768 khz crystal resonator. see section 22, clock pulse generator, for typical connection diagrams for a crystal resonator. 68 71 output supplies the system clock to external devices. operating mode control md2 md1 md0 67 56 55 70 59 58 input sets the operating mode. inputs at these pins should not be changed during operation. except for mode changing, be sure to fix the levels of the mode pins (md2 to md0) by pulling them down or pulling them up until the power turns off. system control res 59 62 input reset input pin. when this pin is low, the chip enters in the power-on reset state. mres 86 89 input when this pin is low, the chip enters in the manual reset state. stby 61 64 input when this pin is low, a transition is made to hardware standby mode. breq 75 78 input used by an external bus master to request the bus mastership to this lsi. back 74 77 output indicates that the bus mastership has been granted to an external bus master. fwe 66 69 input enables/disables programming the flash memory.
rev. 2.00, 05/03, page 43 of 846 pin no. type symbol tfp-100b tfp-100g fp-100b bp-100a i/o function interrupts nmi 60 63 input nonmaskable interrupt pin. if this pin is not used, it should be fixed-high. irq7 irq6 irq5 irq4 irq3 irq2 irq1 irq0 92 91 81 78 72 75 40 38 95 94 84 81 75 78 43 41 input these pins request a maskable interrupt. address bus a23 to a0 37 to 15, 13 40 to 18, 16 output outputs address. data bus d15 to d0 11 to 1 100 to 96 14 to 1, 100, 99 input/ output used as the bidirectional data bus. bus control cs7 cs6 cs5 cs4 cs3 cs2 cs1 cs0 87 88 89 90 92 93 94 95 90 91 92 93 95 96 97 98 output select signals for areas 7 to 0. as 69 72 output when this pin is low, it indicates valid address output on the address bus. rd 70 73 output when this pin is low, it indicates that the external address space is being read. hwr 71 74 output strobe signal: writes to the external address bus to indicate valid data on the upper data bus (d15 to d8). lwr 72 75 output strobe signal: writes to the external bus to indicate valid data on the lower data bus (d7 to d0). wait 73 76 input requests insertion of wait states in bus cycle when accesses to the external three state address.
rev. 2.00, 05/03, page 44 of 846 pin no. type symbol tfp-100b tfp-100g fp-100b bp-100a i/o function 16-bit timer- pulse unit (tpu) tclkd tclkc tclkb tclka 41 39 37 36 44 42 40 39 input these pins input an external clock. tioca0 tiocb0 tiocc0 tiocd0 34 35 36 37 37 38 39 40 input/ output pins for the tgra_0 to tgrd_0 input capture input, output compare output, or pwm output. tioca1 tiocb1 38 39 41 42 input/ output pins for the tgra _ 1 and tgrb _ 1 input capture input, output compare output, or pwm output. tioca2 tiocb2 40 41 43 44 input/ output pins for the tgra _ 2 and tgrb _ 2 input capture input, output compare output, or pwm output. tioca3 tiocb3 tiocc3 tiocd3 22 23 24 25 25 26 27 28 input/ output pins for the tgra_3 to tgrd_3 input capture input, output compare output, or pwm output. (not available in the h8s/2227 group.) tioca4 tiocb4 26 27 29 30 input/ output pins for the tgra_4 and tgrb_4 input capture input, output compare output, or pwm output. (not available in the h8s/2227 group.) tioca5 tiocb5 28 29 31 32 input/ output pins for the tgra_5 and tgrb_5 input capture input, output compare output, or pwm output. (not available in the h8s/2227 group.) 8-bit timer tmo1 tmo0 87 88 90 91 output compare-match output pins tmci01 90 93 input pin for external clock input to the counter tmri01 90 93 input counter reset input pin watchdog timer (wdt) buzz 74 77 output this pin outputs the pulse that is divided by watchdog timer. txd3 txd2 txd1 txd0 83 31 79 76 86 34 82 79 output data output pins (txd2 is not available in the h8s/2227 group.) serial communi- cation interface (sci)/ smart card interface rxd3 rxd2 rxd1 rxd0 84 32 80 77 87 35 83 80 input data input pins (rxd2 is not available in the h8s/2227 group.) sck3 sck2 sck1 sck0 85 33 81 78 88 36 84 81 input/ output clock input/output pins (sck2 is not available in the h8s/2227 group.)
rev. 2.00, 05/03, page 45 of 846 pin no. type symbol tfp-100b tfp-100g fp-100b bp-100a i/o function a/d converter an7 to an0 45 to 52 48 to 55 input analog input pins for the a/d converter adtrg 72 75 input pin for input of an external trigger to start a/d conversion d/a converter da1 da0 43 44 46 47 output analog output pins for the d/a converter. (not available in the h8s/2227 group.) a/d converter, d/a converter avcc 54 57 input power supply pin for the a/d converter and d/a converter. if none of the a/d converter and d/a converter is used, connect this pin to the system power supply (+3 v). avss 42 45 input ground pin for the a/d converter and d/a converter. connect this pin to the system power supply (0 v). vref 53 56 input reference voltage input pin for the a/d converter and d/a converter. if neither the a/d converter nor d/a converter is used, connect this pin to the system power supply (+3 v). i/o ports p17 to p10 41 to 34 44 to 37 input/ output 8-bit i/o pins p36 to p30 82 to 76 85 to 79 input/ output 7-bit i/o pins p47 to p40 45 to 52 48 to 55 input 8-bit input pins p77 to p70 83 to 90 86 to 93 input/ output 8-bit i/o pins p97 p96 43 44 46 47 input 2-bit input pins pa3 to pa0 33 to 30 36 to 33 input/ output 4-bit i/o pins pb7 to pb0 29 to 22 32 to 25 input/ output 8-bit i/o pins pc7 to pc0 21 to 15, 13 24 to 18, 16 input/ output 8-bit i/o pins pd7 to pd0 11 to 4 14 to 7 input/ output 8-bit i/o pins
rev. 2.00, 05/03, page 46 of 846 pin no. type symbol tfp-100b tfp-100g fp-100b bp-100a i/o function i/o ports pe7 to pe0 3 to 1, 100 to 96 6 to 1, 100, 99 input/ output 8-bit i/o pins pf7 to pf0 68 to 75 71 to 78 input/ output 8-bit i/o pins pg4 to pg0 95 to 91 98 to 94 input/ output 5-bit i/o pins
cpu214a_000020020700 rev. 2.00, 05/03, page 47 of 846 section 2 cpu the h8s/2000 cpu is a high-speed central processing unit with an internal 32-bit architecture that is upward-compatible with the h8/300 and h8/300h cpus. the h8s/2000 cpu has sixteen 16-bit general registers, can address a 16-mbyte linear address space, and is ideal for realtime control. this section describes the h8s/2000 cpu. the usable modes and address spaces differ depending on the product. for details on each product, refer to section 3, mcu operating modes. 2.1 features ? upward-compatible with h8/300 and h8/300h cpu ? can execute h8/300 and h8/300h cpu object programs ? general-register architecture ? sixteen 16-bit general registers also usable as sixteen 8-bit registers or eight 32-bit registers ? sixty-five basic instructions ? 8/16/32-bit arithmetic and logic instructions ? multiply and divide instructions ? powerful bit-manipulation instructions ? eight addressing modes ? register direct [rn] ? register indirect [@ern] ? register indirect with displacement [@(d:16,ern) or @(d:32,ern)] ? register indirect with post-increment or pre-decrement [@ern+ or @?ern] ? absolute address [@aa:8, @aa:16, @aa:24, or @aa:32] ? immediate [#xx:8, #xx:16, or #xx:32] ? program-counter relative [@(d:8,pc) or @(d:16,pc)] ? memory indirect [@@aa:8] ? 16-mbyte address space ? program: 16 mbytes ? data: 16 mbytes ? high-speed operation ? all frequently-used instructions execute in one or two states ? 8/16/32-bit register-register add/subtract : 1 state ? 8 ? 16 8-bit register-register divide : 12 states ? 16 ? 32 16-bit register-register divide : 20 states
rev. 2.00, 05/03, page 48 of 846 ? two cpu operating modes ? normal mode * ? advanced mode ? power-down state ? transition to power-down state by a sleep instruction ? cpu clock speed selection note: * normal mode is not available in this lsi. 2.1.1 differences between h8s/2600 cpu and h8s/2000 cpu the differences between the h8s/2600 cpu and the h8s/2000 cpu are shown below. ? register configuration ? the mac register is supported by the h8s/2600 cpu only. ? basic instructions ? the four instructions mac, clrmac, ldmac, and stmac are supported by the h8s/2600 cpu only. ? the number of execution states of the mulxu and mulxs instructions; execution states instruction mnemonic h8s/2600 h8s/2000 mulxu mulxu.b rs, rd 3 12 mulxu.w rs, erd 4 20 mulxs mulxs.b rs, rd 4 13 mulxs.w rs, erd 5 21 in addition, there are differences in address space, ccr and exr register functions, and power- down modes, etc., depending on the model.
rev. 2.00, 05/03, page 49 of 846 2.1.2 differences from h8/300 cpu in comparison to the h8/300 cpu, the h8s/2000 cpu has the following enhancements: ? more general registers and control registers ? eight 16-bit expanded registers, and one 8-bit and two 32-bit control registers, have been added. ? expanded address space ? normal mode supports the same 64-kbyte address space as the h8/300 cpu. ? advanced mode supports a maximum 16-mbyte address space. ? enhanced addressing ? the addressing modes have been enhanced to make effective use of the 16-mbyte address space. ? enhanced instructions ? addressing modes of bit-manipulation instructions have been enhanced. ? signed multiply and divide instructions have been added. ? two-bit shift instructions have been added. ? instructions for saving and restoring multiple registers have been added. ? a test and set instruction has been added. ? higher speed ? basic instructions execute twice as fast. 2.1.3 differences from h8/300h cpu in comparison to the h8/300h cpu, the h8s/2000 cpu has the following enhancements: ? additional control register ? one 8-bit control registers have been added. ? enhanced instructions ? addressing modes of bit-manipulation instructions have been enhanced. ? two-bit shift instructions have been added. ? instructions for saving and restoring multiple registers have been added. ? a test and set instruction has been added. ? higher speed ? basic instructions execute twice as fast.
rev. 2.00, 05/03, page 50 of 846 2.2 cpu operating modes the h8s/2000 cpu has two operating modes: normal and advanced. normal mode supports a maximum 64-kbyte address space. advanced mode supports a maximum 16-mbyte total address space. the mode is selected by the mode pins. 2.2.1 normal mode in normal mode, the exception vector table and stack have the same structure as the h8/300 cpu. ? address space linear access is provided to a maximum address space of 64 kbytes. ? extended registers (en) the extended registers (e0 to e7) can be used as 16-bit registers, or as the upper 16-bit segments of 32-bit registers. when en is used as a 16-bit register it can contain any value, even when the corresponding general register (rn) is used as an address register. if the general register is referenced in the register indirect addressing mode with pre-decrement (@?rn) or post-increment (@rn+) and a carry or borrow occurs, however, the value in the corresponding extended register (en) will be affected. ? instruction set all instructions and addressing modes can be used. only the lower 16 bits of effective addresses (ea) are valid. ? exception vector table and memory indirect branch addresses in normal mode the top area starting at h'0000 is allocated to the exception vector table. one branch address is stored per 16 bits. figure 2.1 shows the structure of the exception vector table in normal mode. for details of the exception vector table, see section 4, exception handling. the memory indirect addressing mode (@@aa:8) employed in the jmp and jsr instructions uses an 8-bit absolute address included in the instruction code to specify a memory operand that contains a branch address. in normal mode the operand is a 16-bit word operand, providing a 16-bit branch address. branch addresses can be stored in the top area from h'0000 to h'00ff. note that this area is also used for the exception vector table. ? stack structure in normal mode, when the program counter (pc) is pushed onto the stack in a subroutine call, and the pc, condition-code register (ccr) and extended control register (exr) are pushed onto the stack in exception handling, they are stored as shown in figure 2.2. exr is not pushed onto the stack in interrupt control mode 0. for details, see section 4, exception handling. note: normal mode is not available in this lsi.
rev. 2.00, 05/03, page 51 of 846 h?0000 h?0001 h?0002 h?0003 h?0004 h?0005 h?0006 h?0007 h?0008 h?0009 h?000a h?000b reset exception vector (reserved for system use) exception vector 1 exception vector 2 exception vector table figure 2.1 exception vector table (normal mode) pc (16 bits) pc (16 bits) sp sp exr * 1 reserved * 1 * 3 ccr ccr * 3 (sp * 2 ) * 1 when exr is not used it is not stored on the stack. * 2 sp when exr is not used. * 3 lgnored when returning. notes: (b) exception handling (a) subroutine branch figure 2.2 stack structure in normal mode 2.2.2 advanced mode ? address space linear access is provided to a maximum 16-mbyte address space. ? extended registers (en) the extended registers (e0 to e7) can be used as 16-bit registers, or as the upper 16-bit segments of 32-bit registers or address registers. ? instruction set all instructions and addressing modes can be used.
rev. 2.00, 05/03, page 52 of 846 ? exception vector table and memory indirect branch addresses in advanced mode, the top area starting at h'00000000 is allocated to the exception vector table in units of 32 bits. in each 32 bits, the upper 8 bits are ignored and a branch address is stored in the lower 24 bits (figure 2.3). for details of the exception vector table, see section 4, exception handling. h ? 00000000 h ? 00000003 h ? 00000004 h ? 0000000b h ? 0000000c h ? 00000010 h ? 00000008 h ? 00000007 reserved reserved reset exception vector (reserved for system use) exception vector table exception vector 1 figure 2.3 exception vector table (advanced mode) the memory indirect addressing mode (@@aa:8) employed in the jmp and jsr instructions uses an 8-bit absolute address included in the instruction code to specify a memory operand that contains a branch address. in advanced mode, the operand is a 32-bit longword operand, providing a 32-bit branch address. the upper 8 bits of these 32 bits is a reserved area that is regarded as h'00. branch addresses can be stored in the area from h'00000000 to h'000000ff. note that the first part of this range is also the exception vector table. ? stack structure in advanced mode, when the program counter (pc) is pushed onto the stack in a subroutine call, and the pc, condition-code register (ccr), and extended control register (exr * ) are pushed onto the stack in exception handling, they are stored as shown in figure 2.4. when exr is invalid, it is not pushed onto the stack. for details, see section 4, exception handling.
rev. 2.00, 05/03, page 53 of 846 pc (24 bits) pc (24 bits) sp sp exr * 1 reserved * 1 * 3 ccr (sp * 2 ) reserved (a) subroutine branch (b) exception handling notes: * 1 when exr is not used it is not stored on the stack. * 2 sp when exr is not used. * 3 ignored when returning. figure 2.4 stack structure in advanced mode
rev. 2.00, 05/03, page 54 of 846 2.3 address space figure 2.5 shows a memory map of the h8s/2000 cpu. the h8s/2000 cpu provides linear access to a maximum 64-kbyte address space in normal mode, and a maximum 16-mbyte (architecturally 4-gbyte) address space in advanced mode. the usable modes and address spaces differ depending on the product. for details on each product, refer to section 3, mcu operating modes. h ? 0000 h ? ffff h ? 00000000 h ? ffffffff h ? 00ffffff 64-kbyte 16-mbyte program area data area (b) advanced mode (a) normal mode * note: * normal mode is not available in this lsi. figure 2.5 memory map
rev. 2.00, 05/03, page 55 of 846 2.4 register configuration the h8s/2000 cpu has the internal registers shown in figure 2.6. there are two types of registers: general registers and control registers. control registers are a 24-bit program counter (pc), an 8-bit extended control register (exr), and an 8-bit condition code register (ccr). ti2i1i0 exr 76543210 pc 23 0 15 0 7 0 7 0 e0 e1 e2 e3 e4 e5 e6 e7 r0h r1h r2h r3h r4h r5h r6h r7h r0l r1l r2l r3l r4l r5l r6l r7l sp pc exr t i2 to i0 ccr i ui : stack pointer : program counter : extended control register : trace bit : interrupt mask bits : condition-code register : interrupt mask bit : user bit or interrupt mask bit * : half-carry flag : user bit : negative flag : zero flag : overflow flag : carry flag er0 er1 er2 er3 er4 er5 er6 er7 (sp) iuihunzvc ccr 76543210 h u n z v c general registers (rn) and extended registers (en) control registers (cr) legend ---- note: * the interrupt mask bit is not available in this lsi. figure 2.6 cpu registers
rev. 2.00, 05/03, page 56 of 846 2.4.1 general registers the h8s/2000 cpu has eight 32-bit general registers. these general registers are all functionally alike and can be used as both address registers and data registers. when a general register is used as a data register, it can be accessed as a 32-bit, 16-bit, or 8-bit register. figure 2.7 illustrates the usage of the general registers. when the general registers are used as 32-bit registers or address registers, they are designated by the letters er (er0 to er7). the er registers divide into 16-bit general registers designated by the letters e (e0 to e7) and r (r0 to r7). these registers are functionally equivalent, providing a maximum sixteen 16-bit registers. the e registers (e0 to e7) are also referred to as extended registers. the r registers divide into 8-bit general registers designated by the letters rh (r0h to r7h) and rl (r0l to r7l). these registers are functionally equivalent, providing a maximum sixteen 8-bit registers. the usage of each register can be selected independently. general register er7 has the function of stack pointer (sp) in addition to its general-register function, and is used implicitly in exception handling and subroutine calls. figure 2.8 shows the stack.  address registers  32-bit registers  16-bit registers  8-bit registers er registers (er0 to er7) e registers (extended registers) (e0 to e7) r registers (r0 to r7) rh registers (r0h to r7h) rl registers (r0l to r7l) figure 2.7 usage of general registers
rev. 2.00, 05/03, page 57 of 846 sp (er7) free area stack area figure 2.8 stack status 2.4.2 program counter (pc) this 24-bit counter indicates the address of the next instruction the cpu will execute. the length of all cpu instructions is 2 bytes (one word), so the least significant pc bit is ignored. (when an instruction is fetched, the least significant pc bit is regarded as 0.) 2.4.3 extended control register (exr) exr is an 8-bit register that manipulates the ldc, stc, andc, orc, and xorc instructions. when these instructions except for the stc instruction is executed, all interrupts including nmi will be masked for three states after execution is completed. bit bit name initial value r/w description 7 t 0 r/w trace bit when this bit is set to 1, a trace exception is generated each time an instruction is executed. when this bit is cleared to 0, instructions are executed in sequence. 6 to 3 ? 1 ? reserved these bits are always read as 1. 2 1 0 i2 i1 i0 1 1 1 r/w r/w r/w these bits designate the interrupt mask level (0 to 7). for details, refer to section 5, interrupt controller.
rev. 2.00, 05/03, page 58 of 846 2.4.4 condition-code register (ccr) this 8-bit register contains internal cpu status information, including an interrupt mask bit (i) and half-carry (h), negative (n), zero (z), overflow (v), and carry (c) flags. operations can be performed on the ccr bits by the ldc, stc, andc, orc, and xorc instructions. the n, z, v, and c flags are used as branching conditions for conditional branch (bcc) instructions. bit bit name initial value r/w description 7 i 1 r/w interrupt mask bit masks interrupts other than nmi when set to 1. nmi is accepted regardless of the i bit setting. the i bit is set to 1 by hardware at the start of an exception-handling sequence. for details, refer to section 5, interrupt controller. 6 ui undefined r/w user bit or interrupt mask bit can be written and read by software using the ldc, stc, andc, orc, and xorc instructions. this bit cannot be used as an interrupt mask bit in this lsi. 5 h undefined r/w half-carry flag when the add.b, addx.b, sub.b, subx.b, cmp.b, or neg.b instruction is executed, this flag is set to 1 if there is a carry or borrow at bit 3, and cleared to 0 otherwise. when the add.w, sub.w, cmp.w, or neg.w instruction is executed, the h flag is set to 1 if there is a carry or borrow at bit 11, and cleared to 0 otherwise. when the add.l, sub.l, cmp.l, or neg.l instruction is executed, the h flag is set to 1 if there is a carry or borrow at bit 27, and cleared to 0 otherwise. 4 u undefined r/w user bit can be written and read by software using the ldc, stc, andc, orc, and xorc instructions. 3 n undefined r/w negative flag stores the value of the most significant bit of data as a sign bit.
rev. 2.00, 05/03, page 59 of 846 bit bit name initial value r/w description 2 z undefined r/w zero flag set to 1 to indicate zero data, and cleared to 0 to indicate non-zero data. 1 v undefined r/w overflow flag set to 1 when an arithmetic overflow occurs, and cleared to 0 at other times. 0 c undefined r/w carry flag set to 1 when a carry occurs, and cleared to 0 otherwise. used by: ? add instructions, to indicate a carry ? subtract instructions, to indicate a borrow ? shift and rotate instructions, to indicate a carry the carry flag is also used as a bit accumulator by bit manipulation instructions. 2.4.5 initial values of cpu registers reset exception handling loads the cpu's program counter (pc) from the vector table, clears the trace bit in exr to 0, and sets the interrupt mask bits in ccr and exr to 1. the other ccr bits and the general registers are not initialized. in particular, the stack pointer (er7) is not initialized. the stack pointer should therefore be initialized by an mov.l instruction executed immediately after a reset.
rev. 2.00, 05/03, page 60 of 846 2.5 data formats the h8s/2000 cpu can process 1-bit, 4-bit (bcd), 8-bit (byte), 16-bit (word), and 32-bit (longword) data. bit-manipulation instructions operate on 1-bit data by accessing bit n (n = 0, 1, 2, ? , 7) of byte operand data. the daa and das decimal-adjust instructions treat byte data as two digits of 4-bit bcd data. 2.5.1 general register data formats figure 2.9 shows the data formats in general registers. 70 70 msb lsb msb lsb 70 43 don ? t care don ? t care don ? t care 70 43 70 don ? t care 65432 710 70 don ? t care 65432 710 don ? t care data type register number data format byte data byte data 4-bit bcd data 4-bit bcd data 1-bit data 1-bit data rnh rnl rnh rnl rnh rnl upper lower upper lower figure 2.9 general register data formats (1)
rev. 2.00, 05/03, page 61 of 846 15 0 msb lsb 15 0 msb lsb 31 16 msb 15 0 lsb en rn ern en rn rnh rnl msb lsb : general register er : general register e : general register r : general register rh : general register rl : most significant bit : least significant bit data type data format register number word data word data rn en longword data legend ern figure 2.9 general register data formats (2)
rev. 2.00, 05/03, page 62 of 846 2.5.2 memory data formats figure 2.10 shows the data formats in memory. the h8s/2000 cpu can access word data and longword data in memory, but word or longword data must begin at an even address. if an attempt is made to access word or longword data at an odd address, no address error occurs but the least significant bit of the address is regarded as 0, so the access starts at the preceding address. this also applies to instruction fetches. when er7 is used as an address register to access the stack, the operand size should be word or longword. 70 76 543210 msb lsb msb msb lsb lsb data type address 1-bit data byte data word data address l address l address 2m address 2m+1 longword data address 2n address 2n+1 address 2n+2 address 2n+3 data format figure 2.10 memory data formats
rev. 2.00, 05/03, page 63 of 846 2.6 instruction set the h8s/2000 cpu has 65 types of instructions. the instructions are classified by function in table 2.1. table 2.1 instruction classification function instructions size types data transfer mov b/w/l 5 pop * 1 , push * 1 w/l ldm, stm l movfpe * 3 , movtpe * 3 b arithmetic add, sub, cmp, neg b/w/l 19 operations addx, subx, daa, das b inc, dec b/w/l adds, subs l mulxu, divxu, mulxs, divxs b/w extu, exts w/l tas * 4 b logic operations and, or, xor, not b/w/l 4 shift shal, shar, shll, shlr, rotl, rotr, rotxl, rotxr b/w/l 8 bit manipulation bset, bclr, bnot, btst, bld, bild, bst, bist, band, biand, bor, bior, bxor, bixor b14 branch bcc * 2 , jmp, bsr, jsr, rts ? 5 system control trapa, rte, sleep, ldc, stc, andc, orc, xorc, nop ? 9 block data transfer eepmov ? 1 total: 65 notes: b: byte; w: word; l: longword * 1 pop.w rn and push.w rn are identical to mov.w @sp+, rn and mov.w rn, @-sp. pop.l ern and push.l ern are identical to mov.l @sp+, ern and mov.l ern, @-sp. * 2 bcc is the general name for conditional branch instructions. * 3 cannot be used in this lsi. * 4 only register er0, er1, er4, or er5 should be used when using the tas instruction.
rev. 2.00, 05/03, page 64 of 846 2.6.1 table of instructions classified by function tables 2.3 to 2.10 summarize the instructions in each functional category. the notation used in tables 2.3 to 2.10 is defined below. table 2.2 operation notation symbol description rd general register (destination) * rs general register (source) * rn general register * ern general register (32-bit register) (ead) destination operand (eas) source operand exr extended control register ccr condition-code register n n (negative) flag in ccr z z (zero) flag in ccr v v (overflow) flag in ccr c c (carry) flag in ccr pc program counter sp stack pointer #imm immediate data disp displacement + addition ? subtraction multiplication division logical and logical or logical xor move ? not (logical complement) :8/:16/:24/:32 8-, 16-, 24-, or 32-bit length note: * general registers include 8-bit registers (r0h to r7h, r0l to r7l), 16-bit registers (r0 to r7, e0 to e7), and 32-bit registers (er0 to er7).
rev. 2.00, 05/03, page 65 of 846 table 2.3 data transfer instructions instruction size * function mov b/w/l (eas) rd, rs (ead) moves data between two general registers or between a general register and memory, or moves immediate data to a general register. movfpe b cannot be used in this lsi. movtpe b cannot be used in this lsi. pop w/l @sp+ rn pops a general register from the stack. pop.w rn is identical to mov.w @sp+, rn. pop.l ern is identical to mov.l @sp+, ern. push w/l rn @ ? sp pushes a general register onto the stack. push.w rn is identical to mov.w rn, @ ? sp. push.l ern is identical to mov.l ern, @ ? sp. ldm l @sp+ rn (register list) pops two or more general registers from the stack. stm l rn (register list) @ ? sp pushes two or more general registers onto the stack. note: * refers to the operand size. b: byte w: word l: longword
rev. 2.00, 05/03, page 66 of 846 table 2.4 arithmetic operations instructions instruction size * 1 function add sub b/w/l rd rs rd, rd #imm rd performs addition or subtraction on data in two general registers, or on immediate data and data in a general register. (immediate byte data cannot be subtracted from byte data in a general register. use the subx or add instruction.) addx subx b rd rs c rd, rd #imm c rd performs addition or subtraction with carry on byte data in two general registers, or on immediate data and data in a general register. inc dec b/w/l rd 1 rd, rd 2 rd increments or decrements a general register by 1 or 2. (byte operands can be incremented or decremented by 1 only.) adds subs l rd 1 rd, rd 2 rd, rd 4 rd adds or subtracts the value 1, 2, or 4 to or from data in a 32-bit register. daa das b rd decimal adjust rd decimal-adjusts an addition or subtraction result in a general register by referring to the ccr to produce 4-bit bcd data. mulxu b/w rd rs rd performs unsigned multiplication on data in two general registers: either 8 bits 8 bits 16 bits or 16 bits 16 bits 32 bits. mulxs b/w rd rs rd performs signed multiplication on data in two general registers: either 8 bits 8 bits 16 bits or 16 bits 16 bits 32 bits. divxu b/w rd rs rd performs unsigned division on data in two general registers: either 16 bits 8 bits 8-bit quotient and 8-bit remainder or 32 bits 16 bits 16-bit quotient and 16-bit remainder.
rev. 2.00, 05/03, page 67 of 846 instruction size * 1 function divxs b/w rd rs rd performs signed division on data in two general registers: either 16 bits 8 bits 8-bit quotient and 8-bit remainder or 32 bits 16 bits 16-bit quotient and 16-bit remainder. cmp b/w/l rd ? rs, rd ? #imm compares data in a general register with data in another general register or with immediate data, and sets ccr bits according to the result. neg b/w/l 0 ? rd rd takes the two's complement (arithmetic complement) of data in a general register. extu w/l rd (zero extension) rd extends the lower 8 bits of a 16-bit register to word size, or the lower 16 bits of a 32-bit register to longword size, by padding with zeros on the left. exts w/l rd (sign extension) rd extends the lower 8 bits of a 16-bit register to word size, or the lower 16 bits of a 32-bit register to longword size, by extending the sign bit. tas * 2 b@erd ? 0, 1 ( of @erd) tests memory contents, and sets the most significant bit (bit 7) to 1. notes: * 1 refers to the operand size. b: byte w: word l: longword * 2 only register er0, er1, er4, or er5 should be used when using the tas instruction.
rev. 2.00, 05/03, page 68 of 846 table 2.5 logic operations instructions instruction size * function and b/w/l rd rs rd, rd #imm rd performs a logical and operation on a general register and another general register or immediate data. or b/w/l rd rs rd, rd #imm rd performs a logical or operation on a general register and another general register or immediate data. xor b/w/l rd rs rd, rd #imm rd performs a logical exclusive or operation on a general register and another general register or immediate data. not b/w/l ? (rd) (rd) takes the one's complement of general register contents. note: * refers to the operand size. b: byte w: word l: longword table 2.6 shift instructions instruction size * function shal shar b/w/l rd (shift) rd performs an arithmetic shift on general register contents. 1-bit or 2-bit shifts are possible. shll shlr b/w/l rd (shift) rd performs a logical shift on general register contents. 1-bit or 2-bit shifts are possible. rotl rotr b/w/l rd (rotate) rd rotates general register contents. 1-bit or 2-bit rotations are possible. rotxl rotxr b/w/l rd (rotate) rd rotates general register contents through the carry flag. 1-bit or 2-bit rotations are possible. note: * refers to the operand size. b: byte w: word l: longword
rev. 2.00, 05/03, page 69 of 846 table 2.7 bit manipulation instructions instruction size * function bset b 1 ( of ) sets a specified bit in a general register or memory operand to 1. the bit number is specified by 3-bit immediate data or the lower three bits of a general register. bclr b 0 ( of ) clears a specified bit in a general register or memory operand to 0. the bit number is specified by 3-bit immediate data or the lower three bits of a general register. bnot b ? ( of ) ( of ) inverts a specified bit in a general register or memory operand. the bit number is specified by 3-bit immediate data or the lower three bits of a general register. btst b ? ( of ) z tests a specified bit in a general register or memory operand and sets or clears the z flag accordingly. the bit number is specified by 3-bit immediate data or the lower three bits of a general register. band biand b b c ( of ) c ands the carry flag with a specified bit in a general register or memory operand and stores the result in the carry flag. c ? ( of ) c ands the carry flag with the inverse of a specified bit in a general register or memory operand and stores the result in the carry flag. the bit number is specified by 3-bit immediate data. bor bior b b c ( of ) c ors the carry flag with a specified bit in a general register or memory operand and stores the result in the carry flag. c ? ( of ) c ors the carry flag with the inverse of a specified bit in a general register or memory operand and stores the result in the carry flag. the bit number is specified by 3-bit immediate data.
rev. 2.00, 05/03, page 70 of 846 instruction size * function bxor bixor b b c ( of ) c xors the carry flag with a specified bit in a general register or memory operand and stores the result in the carry flag. c ? ( of ) c xors the carry flag with the inverse of a specified bit in a general register or memory operand and stores the result in the carry flag. the bit number is specified by 3-bit immediate data. bld bild b b ( of ) c transfers a specified bit in a general register or memory operand to the carry flag. ? ( of ) c transfers the inverse of a specified bit in a general register or memory operand to the carry flag. the bit number is specified by 3-bit immediate data. bst bist b b c ( of ) transfers the carry flag value to a specified bit in a general register or memory operand. ? c ( of ) transfers the inverse of the carry flag value to a specified bit in a general register or memory operand. the bit number is specified by 3-bit immediate data. note: * refers to the operand size. b: byte
rev. 2.00, 05/03, page 71 of 846 table 2.8 branch instructions instruction size function bcc ? branches to a specified address if a specified condition is true. the branching conditions are listed below. mnemonic description condition bra(bt) always (true) always brn(bf) never (false) never bhi high c z = 0 bls low or same c z = 1 bcc(bhs) carry clear (high or same) c = 0 bcs(blo) carry set (low) c = 1 bne not equal z = 0 beq equal z = 1 bvc overflow clear v = 0 bvs overflow set v = 1 bpl plus n = 0 bmi minus n = 1 bge greater or equal n v = 0 blt less than n v = 1 bgt greater than z (n v) = 0 ble less or equal z (n v) = 1 jmp ? branches unconditionally to a specified address. bsr ? branches to a subroutine at a specified address. jsr ? branches to a subroutine at a specified address. rts ? returns from a subroutine
rev. 2.00, 05/03, page 72 of 846 table 2.9 system control instructions instruction size * function trapa ? starts trap-instruction exception handling. rte ? returns from an exception-handling routine. sleep ? causes a transition to a power-down state. ldc b/w (eas) ccr, (eas) exr moves the source operand contents or immediate data to ccr or exr. although ccr and exr are 8-bit registers, word-size transfers are performed between them and memory. the upper 8 bits are valid. stc b/w ccr (ead), exr (ead) transfers ccr or exr contents to a general register or memory. although ccr and exr are 8-bit registers, word-size transfers are performed between them and memory. the upper 8 bits are valid. andc b ccr #imm ccr, exr #imm exr logically ands the ccr or exr contents with immediate data. orc b ccr #imm ccr, exr #imm exr logically ors the ccr or exr contents with immediate data. xorc b ccr #imm ccr, exr #imm exr logically xors the ccr or exr contents with immediate data. nop ? pc + 2 pc only increments the program counter. note: * refers to the operand size. b: byte w: word
rev. 2.00, 05/03, page 73 of 846 table 2.10 block data transfer instructions instruction size function eepmov.b ? if r4l 0 then repeat @er5+ @er6+ r4l ? 1 r4l until r4l = 0 else next; eepmov.w ? if r4 0 then repeat @er5+ @er6+ r4 ? 1 r4 until r4 = 0 else next; transfers a data block. starting from the address set in er5, transfers data for the number of bytes set in r4l or r4 to the address location set in er6. execution of the next instruction begins as soon as the transfer is completed. 2.6.2 basic instruction formats this lsi instructions consist of 2-byte (1-word) units. an instruction consists of an operation field (op field), a register field (r field), an effective address extension (ea field), and a condition field (cc). figure 2.11 shows examples of instruction formats. ? operation field indicates the function of the instruction, the addressing mode, and the operation to be carried out on the operand. the operation field always includes the first four bits of the instruction. some instructions have two operation fields. ? register field specifies a general register. address registers are specified by 3 bits, and data registers by 3 bits or 4 bits. some instructions have two register fields. some have no register field. ? effective address extension 8, 16, or 32 bits specifying immediate data, an absolute address, or a displacement. ? condition field specifies the branching condition of bcc instructions.
rev. 2.00, 05/03, page 74 of 846 op op rn rm nop, rts, etc. add.b rn, rm, etc. mov.b @(d:16, rn), rm, etc. rn rm op ea(disp) op cc ea(disp) bra d:16, etc. (1) operation field only (2) operation field and register fields (3) operation field, register fields, and effective address extension (4) operation field, effective address extension, and condition field figure 2.11 instruction formats (examples) 2.7 addressing modes and effective addresscalculation the h8s/2000 cpu supports the eight addressing modes listed in table 2.11. each instruction uses a subset of these addressing modes. arithmetic and logic instructions can use the register direct and immediate modes. data transfer instructions can use all addressing modes except program- counter relative and memory indirect. bit manipulation instructions use register direct, register indirect, or the absolute addressing mode to specify an operand, and register direct (bset, bclr, bnot, and btst instructions) or immediate (3-bit) addressing mode to specify a bit number in the operand. table 2.11 addressing modes no. addressing mode symbol 1 register direct rn 2 register indirect @ern 3 register indirect with displacement @(d:16,ern)/@(d:32,ern) 4 register indirect with post-increment register indirect with pre-decrement @ern+ @ ? ern 5 absolute address @aa:8/@aa:16/@aa:24/@aa:32 6 immediate #xx:8/#xx:16/#xx:32 7 program-counter relative @(d:8,pc)/@(d:16,pc) 8 memory indirect @@aa:8
rev. 2.00, 05/03, page 75 of 846 2.7.1 register direct?rn the register field of the instruction specifies an 8-, 16-, or 32-bit general register containing the operand. r0h to r7h and r0l to r7l can be specified as 8-bit registers. r0 to r7 and e0 to e7 can be specified as 16-bit registers. er0 to er7 can be specified as 32-bit registers. 2.7.2 register indirect?@ern the register field of the instruction code specifies an address register (ern) which contains the address of the operand on memory. if the address is a program instruction address, the lower 24 bits are valid and the upper 8 bits are all assumed to be 0 (h'00). 2.7.3 register indirect with displacement?@(d:16, ern) or @(d:32, ern) a 16-bit or 32-bit displacement contained in the instruction is added to an address register (ern) specified by the register field of the instruction, and the sum gives the address of a memory operand. a 16-bit displacement is sign-extended when added. 2.7.4 register indirect with post-increment?@ern+ or register indirect with pre- decrement?@-ern register indirect with post-increment?@ern+: the register field of the instruction code specifies an address register (ern) which contains the address of a memory operand. after the operand is accessed, 1, 2, or 4 is added to the address register contents and the sum is stored in the address register. the value added is 1 for byte access, 2 for word transfer instruction, or 4 for longword transfer instruction. for the word or longword transfer instructions, the register value should be even. register indirect with pre-decrement?@-ern: the value 1, 2, or 4 is subtracted from an address register (ern) specified by the register field in the instruction code, and the result is the address of a memory operand. the result is also stored in the address register. the value subtracted is 1 for byte access, 2 for word transfer instruction, or 4 for longword transfer instruction. for the word or longword transfer instructions, the register value should be even.
rev. 2.00, 05/03, page 76 of 846 2.7.5 absolute address?@aa:8, @aa:16, @aa:24, or @aa:32 the instruction code contains the absolute address of a memory operand. the absolute address may be 8 bits long (@aa:8), 16 bits long (@aa:16), 24 bits long (@aa:24), or 32 bits long (@aa:32). table 2.12 indicates the accessible absolute address ranges. to access data, the absolute address should be 8 bits (@aa:8), 16 bits (@aa:16), or 32 bits (@aa:32) long. for an 8-bit absolute address, the upper 24 bits are all assumed to be 1 (h'ffff). for a 16-bit absolute address the upper 16 bits are a sign extension. a 32-bit absolute address can access the entire address space. a 24-bit absolute address (@aa:24) indicates the address of a program instruction. the upper 8 bits are all assumed to be 0 (h'00). table 2.12 absolute address access ranges absolute address normal mode * advanced mode data address 8 bits (@aa:8) h'ff00 to h'ffff h'ffff00 to h'ffffff 16 bits (@aa:16) h'0000 to h'ffff h'000000 to h'007fff, h'ff8000 to h'ffffff 32 bits (@aa:32) h'000000 to h'ffffff program instruction address 24 bits (@aa:24) note: * normal mode is not available in this lsi. 2.7.6 immediate ? #xx:8, #xx:16, or #xx:32 the instruction contains 8-bit (#xx:8), 16-bit (#xx:16), or 32-bit (#xx:32) immediate data as an operand. the adds, subs, inc and dec instructions contain immediate data implicitly. some bit manipulation instructions contain 3-bit immediate data in the instruction code, specifying a bit number. the trapa instruction contains 2-bit immediate data in its instruction code, specifying a vector address.
rev. 2.00, 05/03, page 77 of 846 2.7.7 program-counter relative?@(d:8, pc) or @(d:16, pc) this mode is used in the bcc and bsr instructions. an 8-bit or 16-bit displacement contained in the instruction is sign-extended and added to the 24-bit pc contents to generate a branch address. only the lower 24 bits of this branch address are valid; the upper 8 bits are all assumed to be 0 (h'00). the pc value to which the displacement is added is the address of the first byte of the next instruction, so the possible branching range is ? 126 to +128 bytes ( ? 63 to +64 words) or ? 32766 to +32768 bytes ( ? 16383 to +16384 words) from the branch instruction. the resulting value should be an even number. 2.7.8 memory indirect?@@aa:8 this mode can be used by the jmp and jsr instructions. the instruction code contains an 8-bit absolute address specifying a memory operand. this memory operand contains a branch address. the upper bits of the absolute address are all assumed to be 0, so the address range is 0 to 255 (h'0000 to h'00ff in normal mode * , h'000000 to h'0000ff in advanced mode). in normal mode, the memory operand is a word operand and the branch address is 16 bits long. in advanced mode, the memory operand is a longword operand, the first byte of which is assumed to be 0 (h'00). note that the first part of the address range is also the exception vector area. for further details, refer to section 4, exception handling. if an odd address is specified in word or longword memory access, or as a branch address, the least significant bit is regarded as 0, causing data to be accessed or instruction code to be fetched at the address preceding the specified address. (for further information, see section 2.5.2, memory data formats.) note: * normal mode is not available in this lsi. specified by @aa:8 specified by @aa:8 branch address branch address reserved (a) normal mode * (a) advanced mode note: * normal mode is not available in this lsi. figure 2.12 branch address specification in memory indirect mode
rev. 2.00, 05/03, page 78 of 846 2.7.9 effective address calculation table 2.13 indicates how effective addresses are calculated in each addressing mode. in normal mode the upper 8 bits of the effective address are ignored in order to generate a 16-bit address. table 2.13 effective address calculation no 1 offset 1 2 4 r op 31 0 31 23 2 3 register indirect with displacement @(d:16,ern) or @(d:32,ern) 4 r op disp r op rm op rn 31 0 31 0 r op don't care 31 23 31 0 don't care 31 0 disp 31 0 31 0 31 23 31 0 don't care 31 23 31 0 don't care 24 24 24 24 addressing mode and instruction format effective address calculation effective address (ea) register direct(rn) general register contents general register contents general register contents general register contents sign extension register indirect(@ern) register indirect with post-increment or pre-decrement register indirect with post-increment @ern+ register indirect with pre-decrement @-ern 1, 2, or 4 1, 2, or 4 operand size byte word longword operand is general register contents.
rev. 2.00, 05/03, page 79 of 846 no 5 op 31 23 31 0 don ? t care abs op abs op abs @ aa:8 7 h ? ffff op 31 23 31 0 don ? t care @aa:16 op @ aa:24 @aa:32 abs 15 15 16 31 23 31 0 don ? t care 31 23 31 0 don ? t care abs op abs 6 op imm op #xx:8/#xx:16/#xx:32 8 24 24 24 24 31 31 0 31 31 0 31 23 31 0 don ? t care 24 addressing mode and instruction format absolute address immediate effective address calculation effective address (ea) sign extension 16 h ? 00 15 31 23 31 0 don ? t care 24 16 h ? 00 31 23 31 0 don ? t care 24 7 31 31 0 abs 8 7 8 h ? 000000 h ? 000000 31 31 0 abs operand is immediate data. 7 8 program-counter relative @ (d:8,pc),@(d:16,pc) pc contents 31 31 0 memory contents 31 31 0 memory contents disp sign extension disp note: * normal mode is not available in this lsi. memory indirect @@aa : 8 nomal mode * advanced extended modes
rev. 2.00, 05/03, page 80 of 846 2.8 processing states the h8s/2000 cpu has five main processing states: the reset state, exception handling state, program execution state, bus-released state, and power-down state. figure 2.13 indicates the state transitions. ? reset state in this state, the cpu and all on-chip peripheral modules are initialized and not operating. when the res input goes low, all current processing stops and the cpu enters the reset state. all interrupts are masked in the reset state. reset exception handling starts when the res signal changes from low to high. for details, refer to section 4, exception handling. the reset state can also be entered by a watchdog timer overflow. ? exception-handling state the exception-handling state is a transient state that occurs when the cpu alters the normal processing flow due to an exception source, such as a reset, trace, interrupt, or trap instruction. the cpu fetches a start address (vector) from the exception vector table and branches to that address. for further details, refer to section 4, exception handling. ? program execution state in this state, the cpu executes program instructions in sequence. ? bus-released state in a product which has a dma controller (dmac) * or data transfer controller (dtc), the bus- released state occurs when the bus has been released in response to a bus request from a bus master other than the cpu. while the bus is released, the cpu halts operations. ? power-down state this is a power-down state in which the cpu stops operating. the program stop state occurs when a sleep instruction is executed or the cpu enters hardware standby mode. for further details, refer to section 23, power-down modes. note: * supported only by the h8s/2239 group.
rev. 2.00, 05/03, page 81 of 846 exception handling state bus-released state hardware standby mode * 2 software standby mode reset state * 1 sleep mode power-down state * 3 program execution state end of bus request bus request interrupt request external interrupt request res = high mres = high request for exce ption handling stby = high, res = low end of bus request bus request sleep instruc tion, ssby = 0 sleep instruc tion, ssby = 1 notes: * 1 * 2 * 3 from any state except hardware standby mode, a transition to the reset state occurs whenever res goes low. a transition can also be made to the reset state when the watchdog timer overflows. from any state except hardware standby mode and power-on reset state, a transition to the manual reset state occurs whenever mres goes low. from any state, a transition to hardware standby mode occurs when stby goes low. apart from these states, there are also the watch mode, subactive mode, and the subsleep mode. see section 23, power-down modes. end of exception handling figure 2.13 state transitions
rev. 2.00, 05/03, page 82 of 846 2.9 usage notes 2.9.1 tas instruction only register er0, er1, er4, or er5 should be used when using the tas instruction. the tas instruction is not generated by the renesas technology h8s and h8/300 series c/c++ compilers. if the tas instruction is used as a user-defined intrinsic function, ensure that only register er0, er1, er4, or er5 is used. 2.9.2 stm/ldm instruction with the stm or ldm instruction, the er7 register is used as the stack pointer, and thus cannot be used as a register that allows save (stm) or restore (ldm) operation. with a single stm or ldm instruction, two to four registers can be saved or restored. the available registers are as follows: for two registers: er0 and er1, er2 and er3, or er4 and er5 for three registers: er0 to er2, or er4 to er6 for four registers: er0 to er3 for the renesas technology h8s or h8/300 series c/c++ compiler, the stm/ldm instruction including er7 is not created. 2.9.3 bit manipulation instructions the bset, bclr, bnot, bst, and bist instructions are used to read data in byte-wise, operate the data in bit-wise, and write the result of the bit-wise operation in bit-wise again. therefore, special care is necessary to use these instructions for the registers and the ports that include write- only bit. the bclr instruction can be used to clear to 0 the flags in the internal i/o registers. in this time, if it is obvious that the flag has been set to 1 in the interrupt handler, there is no need to read the flag beforehand.
rev. 2.00, 05/03, page 83 of 846 section 3 mcu operating modes 3.1 operating mode selection this lsi supports four operating modes (modes 4 to 7). these modes enable selection of the cpu operating mode, enabling/disabling of on-chip rom, and the initial bus width setting, by setting the mode pins (md2 to md0) as show in table 3.1. do not change the mode pin settings during operation. table 3.1 mcu operating mode selection external data bus mcu operating mode md2 md1 md0 cpu operating mode description on-chip rom initial value maximum value 4 100advanced modeon-chip rom disabled, extended mode disabled 16 bits 16 bits 5 101advanced modeon-chip rom disabled, extended mode disabled 8 bits 16 bits 6 110advanced modeon-chip rom enabled, extended mode enabled 8 bits 16 bits 7 111advanced modesingle-chip modeenabled
rev. 2.00, 05/03, page 84 of 846 3.2 register descriptions the following registers are related to the operating mode. ? mode control register (mdcr) ? system control register (syscr) 3.2.1 mode control register (mdcr) mdcr is used to monitor the current operating mode of this lsi. bit bit name initial value r/w description 7 1 reserved this bit is always read as 1 and cannot be modified. 6 to 3 0 reserved these bits are always read as 0 and cannot be modified. 2 1 0 mds2 mds1 mds0 * * * r r r mode select 2 to 0 these bits indicate the input levels at pins md2 to md0 (the current operating mode).bits mds2 to mds0 correspond to md2 to md0. mds2 to mds0 are read-only bits and they cannot be written to. the mode pin (md2 to md0) input levels are latched into these bits when mdcr is read. these latches are canceled by a power-on reset, but maintained at manual reset. note: * determined by the md2 to md0 pin settings.
rev. 2.00, 05/03, page 85 of 846 3.2.2 system control register (syscr) syscr is used to select the interrupt control mode and the detected edge for nmi, select the mres input pin enable or disable, and enables or disables on-chip ram. bit bit name initial value r/w description 7 0 r/wreserved the write value should always be 0. 6 0 reserved these bits are always read as 0 and cannot be modified. 5 4 intm1 intm0 0 0 r/w r/w these bits select the control mode of the interrupt controller. for details of the interrupt control modes, see section 5.5.1, interrupt control modes and interrupt operation. 00: interrupt control mode 0 (interrupt is controlled by i bit.) 01: setting prohibited 10: interrupt control mode 2 (interrupt is controlled by i2 to i0 bits and ipr.) 11: setting prohibited 3 nmieg 0 r/w nmi edge select selects the valid edge of the nmi interrupt input. 0: an interrupt is requested at the falling edge of nmi input 1: an interrupt is requested at the rising edge of nmi input 2 mrese 0 r/w manual reset select enables or disables the mres pin input. 0: the mres pin input (manual reset) is disabled 1: the mres pin input (manual reset) is enabled the mres input pin can be used 1 0 reserved these bits are always read as 0 and cannot be modified. 0 rame 1 r/w ram enable enables or disables the on-chip ram. the rame bit is initialized when the reset status is released. 0: on-chip ram is disabled 1: on-chip ram is enabled
rev. 2.00, 05/03, page 86 of 846 3.3 operating mode descriptions this lsi has four operating modes, modes 4 to 7. modes 4 to 6 are extended modes in which external memory and external peripheral devices can be accessed. in extended modes, each area can be used as 8-bit or 16-bit address space according to the bus controller settings after program execution. in this case, if an area is specified as 16-bit access space, 16-bit bus mode is employed for all areas; while if an area is specified as 8-bit access space, 8-bit bus mode is employed for all areas. in mode 7, external addresses cannot be used. 3.3.1 mode 4 the cpu can access a 16-mbyte address space in advanced mode. the on-chip rom is disabled. pins p13 to p10, and ports a, b, and c function as an address bus, ports d and e function as a data bus, and part of port f carries bus control signals. pins p13 to p11 function as input ports immediately after a reset. pin 10 and ports a and b function as address (a20 to a8) outputs immediately after a reset. address (a23 to a21) output can be enabled or disabled by bits ae3 to ae0 in the pin function control register (pfcr) regardless of the corresponding data direction register (ddr) values. pins for which address output is disabled among pins p13 to p10 and in ports a and b become port outputs when the corresponding ddr bits are set to 1. port c always has an address (a7 to a0) output function. the initial bus mode after a reset is 16 bits, with 16-bit access to all areas. however, note that if 8- bit access is designated by the bus controller for all areas, the bus mode switches to 8 bits.
rev. 2.00, 05/03, page 87 of 846 3.3.2 mode 5 the cpu can access a 16-mbyte address space in advanced mode. the on-chip rom is disabled. pins p13 to p10, and ports a, b, and c function as an address bus, ports d and e function as a data bus, and part of port f carries bus control signals. pins p13 to p11 function as input ports immediately after a reset. pin 10 and ports a and b function as address (a20 to a8) outputs immediately after a reset. address (a23 to a21) output can be enabled or disabled by bits ae3 to ae0 in the pin function control register (pfcr) regardless of the corresponding data direction register (ddr) values. pins for which address output is disabled among pins p13 to p10 and in ports a and b become port outputs when the corresponding ddr bits are set to 1. port c always has an address (a7 to a0) output function. the initial bus mode after a reset is 8 bits, with 8-bit access to all areas. however, note that if 16- bit access is designated by the bus controller for any area, the bus mode switches to 16 bits and port e becomes a data bus. 3.3.3 mode 6 the cpu can access a 16-mbyte address space in advanced mode. the on-chip rom is enabled. pins p13 to p10, and ports a, b, and c function as input ports immediately after a reset. address (a23 to a8) output can be enabled or disabled by bits ae3 to ae0 in the pin function control register (pfcr) regardless of the corresponding data direction register (ddr) values. pins for which address output is disabled among pins p13 to p10 and in ports a and b become port outputs when the corresponding ddr bits are set to 1. port c is an input port immediately after a reset. addresses a7 to a0 are output by setting the corresponding ddr bits to 1. ports d and e function as a data bus, and part of port f carries data bus signals. the initial bus mode after a reset is 8 bits, with 8-bit access to all areas. however, note that if 16- bit access is designated by the bus controller for any area, the bus mode switches to 16 bits and port e becomes a data bus.
rev. 2.00, 05/03, page 88 of 846 3.3.4 mode 7 the cpu can access a 16-mbyte address space in advanced mode. the on-chip rom is enabled, but external addresses cannot be accessed. all i/o ports are available for use as input-output ports. 3.3.5 pin functions the pin functions of ports 1, and a to f vary depending on the operating mode. table 3.2 shows their functions in each operating mode. table 3.2 pin functions in each operating mode port mode 4 mode 5 mode 6 mode 7 * 1 port 1 p13 to p11 p * /a p * /a p * /a p p10 p/a * p/a * p * /a p port a pa3 to pa0 p/a * p/a * p * /a p port b p/a * p/a * p * /a p port c a a p * /a p port d d d d p port e p/d * p * /d p * /d p port f pf7 p/c * p/c * p/c * p * /c pf6 to pf4 c c c p pf3 p/c * p * /c p * /c pf2 to pf0 p * /c p * /c p * /c legend p: i/o port a: address bus output d: data bus i/o c: control signals, clock i/o * : after reset
rev. 2.00, 05/03, page 89 of 846 3.4 memory map in each operating mode figures 3.1 to 3.7 show the memory map in each operating mode. modes 4 and 5 (advanced extended modes with on-chip rom disabled) mode 6 (advanced extended mode with on-chip rom enabled) mode 7 (advanced single-chip mode) external address space note: * extermal addresses can be accessed by clearing the rame bit in syscr to 0. internal i/o registers internal i/o registers external address space external address space external address space on-chip ram on-chip ram * on-chip rom on-chip rom internal i/o registers internal i/o registers on-chip ram * external address space external address space on-chip ram on-chip ram internal i/o registers internal i/o registers on-chip ram h000000 hff7000 hffefc0 h060000 h000000 h05ffff h000000 hff7000 hffefbf hffff40 hffff60 hffffc0 hffffff hfff800 hff7000 hffefc0 hffff40 hffff60 hffff60 hffffc0 hffffff hfff800 hffff3f hffffff hfff800 hffffc0 figure 3.1 h8s/2239 memory map in each operating mode
rev. 2.00, 05/03, page 90 of 846 modes 4 and 5 (advanced extended modes with on-chip rom disabled) mode 6 (advanced extended mode with on-chip rom enabled) mode 7 * (advanced single-chip mode) external address space note: * extermal addresses can be accessed by clearing the rame bit in syscr to 0. external address space internal i/o registers on-chip ram * external address space external address space external address space on-chip ram * on-chip ram * on-chip rom on-chip rom internal i/o registers internal i/o registers internal i/o registers on-chip ram * external address space on-chip ram internal i/o registers internal i/o registers on-chip ram h'000000 h'ffb000 h'ffefc0 h'040000 h'000000 h'03ffff h'000000 h'ffb000 h'ffefbf h'ffff40 h'ffff60 h'ffffc0 h'ffffff h'fff800 h'ffb000 h'ffefc0 h'ffff40 h'ffff60 h'ffff60 h'ffffc0 h'ffffff h'fff800 h'ffff3f h'ffffff h'fff800 h'ffffc0 figure 3.2 h8s/2238 memory map in each operating mode
rev. 2.00, 05/03, page 91 of 846 modes 4 and 5 (advanced extended modes with on-chip rom disabled) mode 6 (advanced extended mode with on-chip rom enabled) mode 7 (advanced single-chip mode) external address space note: * extermal addresses can be accessed by clearing the rame bit in syscr to 0. external address space external address space on-chip ram * internal i/o registers reserved * on-chip ram * external address space external address space on-chip rom on-chip ram * internal i/o registers reserved * external address space reserved on-chip ram * on-chip rom on-chip ram internal i/o registers internal i/o registers internal i/o registers internal i/o registers on-chip ram h'000000 h'ffb000 h'ffefc0 h'040000 h'020000 h'000000 h'01ffff h'000000 h'ffd000 h'ffd000 h'ffd000 h'ffefbf h'ffff40 h'ffff60 h'ffffc0 h'ffffff h'fff800 h'ffb000 h'ffefc0 h'ffff40 h'ffff60 h'ffff60 h'ffffc0 h'ffffff h'fff800 h'ffff3f h'ffffff h'fff800 h'ffffc0 figure 3.3 h8s/2236 memory map in each operating mode
rev. 2.00, 05/03, page 92 of 846 h'000000 h'ffb000 h'ffefc0 h'020000 h'000000 h'01ffff h'000000 h'ffb000 h'ffefbf h'ffff40 h'ffff60 h'ffffc0 h'ffffff h'fff800 h'ffb000 h'ffefc0 h'ffff40 h'ffff60 h'ffff60 h'ffffc0 h'ffffff h'fff800 h'ffff3f h'ffffff h'fff800 h'ffffc0 modes 4 and 5 (advanced extended modes with on-chip rom disabled) mode 6 (advanced extended mode with on-chip rom enabled) mode 7 (advanced single-chip mode) external address space note: * extermal addresses can be accessed by clearing the rame bit in syscr to 0. external address space external address space on-chip ram * internal i/o registers on-chip ram * external address space external address space on-chip rom on-chip ram * internal i/o registers external address space on-chip ram * on-chip rom on-chip ram internal i/o registers internal i/o registers internal i/o registers internal i/o registers on-chip ram figure 3.4 h8s/2237 and h8s/2227 memory map in each operating mode
rev. 2.00, 05/03, page 93 of 846 h'000000 h'ffb000 h'ffefc0 h'020000 h'000000 h'01ffff h'000000 h'ffe000 h'ffe000 h'ffe000 h'ffefbf h'ffff40 h'ffff60 h'ffffc0 h'ffffff h'fff800 h'ffb000 h'ffefc0 h'ffff40 h'ffff60 h'ffff60 h'ffffc0 h'ffffff h'fff800 h'ffff3f h'ffffff h'fff800 h'ffffc0 modes 4 and 5 (advanced extended modes with on-chip rom disabled) mode 6 (advanced extended mode with on-chip rom enabled) mode 7 (advanced single-chip mode) exter nal address space note: * extermal addresses can be accessed by clearing the rame bit in syscr to 0. external address space external address space on-chip ram * internal i/o registers reserved * on-chip ram * external address space external address space on-chip ram on-chip ram * internal i/o registers reserved * external address space on-chip ram * on-chip rom on-chip ram internal i/o registers internal i/o registers internal i/o registers internal i/o registers on-chip ram figure 3.5 h8s/2235 and h8s/2225 memory map in each operating mode
rev. 2.00, 05/03, page 94 of 846 reserved * reserved * reserved * h'000000 h'ffb000 h'ffefc0 h'020000 h'018000 h'000000 h'017fff h'000000 h'ffe000 h'ffe000 h'ffe000 h'ffefbf h'ffff40 h'ffff60 h'ffffc0 h'ffffff h'fff800 h'ffb000 h'ffefc0 h'ffff40 h'ffff60 h'ffff60 h'ffffc0 h'ffffff h'fff800 h'ffff3f h'ffffff h'fff800 h'ffffc0 modes 4 and 5 (advanced extended modes with on-chip rom disabled) mode 6 (advanced extended mode with on-chip rom enabled) mode 7 (advanced single-chip mode) external address space note: * extermal addresses can be accessed by clearing the rame bit in syscr to 0. external address space external address space on-chip ram * internal i/o registers on-chip ram * external address space external address space on-chip rom on-chip ram * internal i/o registers external address space on-chip ram * on-chip rom on-chip ram internal i/o registers intermal i/o registers internal i/o registers internal i/o registers on-chip ram figure 3.6 h8s/2224 memory map in each operating mode
rev. 2.00, 05/03, page 95 of 846 h000000 hffb000 hffefc0 h020000 h010000 h000000 h00ffff h000000 hffe000 hffe000 hffe000 hffefbf hffff40 hffff60 hffffc0 hffffff hfff800 hffb000 hffefc0 hffff40 hffff60 hffff60 hffffc0 hffffff hfff800 hffff3f hffffff hfff800 hffffc0 reserved * reserved * reserved * modes 4 and 5 (advanced extended modes with on-chip rom disabled) mode 6 (advanced extended mode with on-chip rom enabled) mode 7 (advanced single-chip mode) external address space note: * extermal addresses can be accessed by clearing the rame bit in syscr to 0. external address space external address space on-chip ram * internal i/o registers on-chip ram * external address space external address space on-chip rom on-chip ram * internal i/o registers external address space on-chip ram * on-chip rom on-chip ram internal i/o registers internal i/o registers internal i/o registers internal i/o registers on-chip ram figure 3.7 h8s/2233 and h8s/2223 memory map in each operating mode
rev. 2.00, 05/03, page 96 of 846
rev. 2.00, 05/03, page 97 of 846 section 4 exception handling 4.1 exception handling types and priority as table 4.1 indicates, exception handling may be caused by a reset, trace, trap instruction, or interrupt. exception handling is prioritized as shown in table 4.1. if two or more exceptions occur simultaneously, they are accepted and processed in order of priority. trap instruction exception handling requests are accepted at all times in program execution state. exception sources, the stack structure, and operation of the cpu vary depending on the interrupt control mode set by the intm0 and intm1 bits in syscr. table 4.1 exception types and priority priority exception type start of exception handling high reset starts immediately after a low-to-high transition at the res or mres pin, or when the watchdog timer overflows. the cpu enters the power-on reset state when the res pin is low. the cpu enters the manual reset state when the mres pin is low. trace starts when execution of the current instruction or exception handling ends, if the trace (t) bit in the exr is set to 1. traces are enabled only in interrupt control mode 2. trace exception handling is not executed after execution of an rte instruction. interrupt starts when execution of the current instruction or exception handling ends, if an interrupt request has been issued. interrupt detection is not performed on completion of andc, orc, xorc, or ldc instruction execution, or on completion of reset exception handling. low trap instruction (trapa) started by execution of a trap instruction (trapa). trap instruction exception handling requests are accepted at all times in program execution state.
rev. 2.00, 05/03, page 98 of 846 4.2 exception sources and exception vector table different vector addresses are assigned to different exception sources. table 4.2 lists the exception sources and their vector addresses. table 4.2 exception handling vector table exception source vector number vector address advanced mode * 1 power-on reset 0 h'0000 to h'0003 manual reset 1 h'0004 to h'0007 reserved for system use 2 h'0008 to h'000b 3 h'000c to h'000f 4 h'0010 to h'0013 trace 5 h'0014 to h'0017 direct transitions * 3 6 h'0018 to h'001b external interrupt (nmi) 7 h'001c to h'001f trap instruction (four sources) 8 h'0020 to h'0023 9 h'0024 to h'0027 10 h'0028 to h'002b 11 h'002c to h'002f reserved for system use 12 h'0030 to h'0033 13 h'0034 to h'0037 14 h'0038 to h'003b 15 h'003c to h'003f external interrupt irq0 16 h'0040 to h'0043 irq1 17 h'0044 to h'0047 irq2 18 h'0048 to h'004b irq3 19 h'004c to h'004f irq4 20 h'0050 to h'0053 irq5 21 h'0054 to h'0057 irq6 22 h'0058 to h'005b irq7 23 h'005c to h'005f internal interrupt * 2 24 ? 123 h'0060 to h'0063 ? h'01ec to h'01ef notes: * 1 lower 16 bits of the address. * 2 for details of internal interrupt vectors, see section 5.4.3, interrupt exception handling vector table. * 3 for details on direct transitions, see section 23.10, direct transitions.
rev. 2.00, 05/03, page 99 of 846 4.3 reset a reset has the highest exception priority. when the res or mres pin goes low, all processing halts and this lsi enters the reset. a reset initializes the internal state of the cpu and the registers of on-chip peripheral modules. the interrupt control mode is 0 immediately after reset. when the res or mres pin goes high from the low state, this lsi starts reset exception handling. the chip can also be reset by overflow of the watchdog timer. for details see section 13, watchdog timer (wdt). 4.3.1 reset types the power-on reset and the manual reset are available as the reset. table 4.3 lists the reset types. when the power is supplied, select the power-on reset. both the power-on reset and the manual reset initialize the internal state of the cpu. the power- on reset initializes all registers in on-chip peripheral modules. the manual reset initializes the registers in on-chip peripheral modules except the bus controller and the i/o ports. the state of the bus controller and the i/o ports are maintained. at the manual reset, the on-chip peripheral modules are initialized. thus, the ports that are used as i/o pins for the on-chip peripheral modules are changed to the ports controlled by the ddr and the dr. table 4.3 reset types condition to enter reset internal state reset mres res cpu internal peripheral modules power-on reset * low initialized initialized manual reset low high initialized initialized except the bus controller and the i/o ports note: * don't care the power-on reset and the manual reset are also available for the reset by the watchdog timer. to enable the mres pin, set the mrese bit in syscr to 1.
rev. 2.00, 05/03, page 100 of 846 4.3.2 reset exception handling when the res or mres pin goes low, this lsi enters the reset. to ensure that this lsi is reset, hold the res or mres pin low for at least 20 ms at power-up. to reset the chip during operation, hold the res or mres pin low for at least 20 states. when the res or mres pin goes high after being held low for the necessary time, this lsi starts reset exception handling as follows. 1. the internal state of the cpu and the registers of the on-chip peripheral modules are initialized, the t bit in exr is cleared to 0, and the i bits in exr and ccr are set to 1. 2. the reset exception handling vector address is read and transferred to the pc, and program execution starts from the address indicated by the pc. figures 4.1 shows an example of the reset sequence. * * * res,mres high vector fetch internal processing prefetch of first program instruction (1)(3) reset exception handling vector address (at power on reset, (1)=h'000000, (3)=h'000002, at manual reset, (1)=h'000004, (3)=h'000006) (2)(4) start address (contents of reset exception handling vector address) (5) start address ((5)=(2)(4)) (6) first program instruction address bus rd hwr,lwr d15 to d0 (1) (2) (4) (6) (3) (5) note: * three states are inserted for waiting. figure 4.1 reset sequence (mode 4)
rev. 2.00, 05/03, page 101 of 846 4.3.3 interrupts after reset if an interrupt is accepted after a reset and before the stack pointer (sp) is initialized, the pc and ccr will not be saved correctly, leading to a program crash. to prevent this, all interrupt requests, including nmi, are disabled immediately after a reset. since the first instruction of a program is always executed immediately after the reset state ends, make sure that this instruction initializes the stack pointer (example: mov.l #xx: sp). 4.3.4 state of on-chip peripheral modules after reset release after reset release, mstpcra is initialized to h'3f, mstpcrb and mstpcrc are initialized to h'ff, and all modules except the dmac * and dtc enter module stop mode. consequently, on- chip peripheral module registers cannot be read or written to. register reading and writing is enabled when the module stop mode is exited. note: * supported only by the h8s/2239 group. 4.4 traces traces are enabled in interrupt control mode 2. trace mode is not activated in interrupt control mode 0, irrespective of the state of the t bit. for details of interrupt control modes, see section 5, interrupt controller. if the t bit in exr is set to 1, trace mode is activated. in trace mode, a trace exception occurs on completion of each instruction. trace mode is not affected by interrupt masking. table 4.4 shows the state of ccr and exr after execution of trace exception handling. trace mode is canceled by clearing the t bit in exr to 0. interrupts are accepted even within the trace exception handling routine. the t bit saved on the stack retains its value of 1, and when control is returned from the trace exception handling routine by the rte instruction, trace mode resumes. trace exception handling is not carried out after execution of the rte instruction.
rev. 2.00, 05/03, page 102 of 846 table 4.4 status of ccr and exr after trace exception handling ccr exr interrupt control mode i ui i2 to i0 t 0 trace exception handling cannot be used. 210 legend 1: set to 1 0: cleared to 0 : retains value prior to execution 4.5 interrupts interrupts are controlled by the interrupt controller. the interrupt control has two interrupt control modes and can assign interrupts other than nmi to eight priority/mask levels to enable multiplexed interrupt control. for details, refer to section 5, interrupt controller. interrupt exception handling is conducted as follows: 1. the values in the program counter (pc), condition code register (ccr), and extended control register (exr) are saved to the stack. 2. the interrupt mask bit is updated and the t bit is cleared to 0. 3. a vector address corresponding to the interrupt source is generated, the start address is loaded from the vector table to the pc, and program execution begins from that address. 4.6 trap instruction trap instruction exception handling starts when a trapa instruction is executed. trap instruction exception handling can be executed at all times in the program execution state. trap instruction exception handling is conducted as follows: 1. the values in the program counter (pc), condition code register (ccr), and extended control register (exr) are saved to the stack. 2. the interrupt mask bit is updated and the t bit is cleared to 0. 3. a vector address corresponding to the interrupt source is generated, the start address is loaded from the vector table to the pc, and program execution starts from that address. the trapa instruction fetches a start address from a vector table entry corresponding to a vector number from 0 to 3, as specified in the instruction code. table 4.5 shows the status of ccr and exr after execution of trap instruction exception handling.
rev. 2.00, 05/03, page 103 of 846 table 4.5 status of ccr and exr after trap instruction exception handling ccr exr interrupt control mode i ui i2 to i0 t 01 210 legend 1: set to 1 0: cleared to 0 : retains value prior to execution 4.7 stack status after exception handling figures 4.2 shows the stack after completion of trap instruction exception handling and interrupt exception handling. ccr ccr pc (24 bit) sp note: * ignored on return exr pc (24 bit) sp (a) interrupt control mode 0 (b) interrupt control mode 2 reserved * figure 4.2 stack status after exception handling (advanced mode)
rev. 2.00, 05/03, page 104 of 846 4.8 usage note when accessing word data or longword data, this lsi assumes that the lowest address bit is 0. the stack should always be accessed by word transfer instruction or longword transfer instruction, and the value of the stack pointer (sp, er7) should always be kept even. use the following instructions to save registers: push.w rn (or mov.w rn, @-sp) push.l ern (or mov.l ern, @-sp) use the following instructions to restore registers: pop.w rn (or mov.w @sp+, rn) pop.l ern (or mov.l @sp+, ern) setting sp to an odd value may lead to a malfunction. figure 4.3 shows an example of what happens when the sp value is odd. sp h'fffefa h'fffefb h'fffefc h'fffefd h'fffeff r1l pc sp ccr pc sp ccr : pc : r1l : sp : condition code register program counter general register r1l stack pointer trap instruction executed sp set to h'fffeff data saved above sp mov.b r1l, @-er7 executed contents of ccr lost legend note: this diagram illustrates an example in which the interrupt control mode is 0, in advanced mode. figure 4.3 operation when sp value is odd
rev. 2.00, 05/03, page 105 of 846 section 5 interrupt controller 5.1 features this lsi controls interrupts with the interrupt controller. the interrupt controller has the following features: ? two interrupt control modes ? any of two interrupt control modes can be set by means of the intm1 and intm0 bits in the system control register (syscr). ? priorities settable with ipr ? an interrupt priority register (ipr) is provided for setting interrupt priorities. eight priority levels can be set for each module for all interrupts except nmi. nmi is assigned the highest priority level of 8, and can be accepted at all times. ? independent vector addresses ? all interrupt sources are assigned independent vector addresses, making it unnecessary for the source to be identified in the interrupt handling routine. ? nine external interrupts ? nmi is the highest-priority interrupt, and is accepted at all times. rising edge or falling edge can be selected for nmi. falling edge, rising edge, or both edge detection, or level sensing, can be independently selected for irq7 to irq0. ? dtc and dmac * control ? the dtc and dmac * can be activated by an interrupt request. note: * supported only by the h8s/2239 group.
rev. 2.00, 05/03, page 106 of 846 a block diagram of the interrupt controller is shown in figure 5.1. syscr nmi input irq input internal interrupt request swdtend to tei3 nmieg intm1, intm0 nmi input unit irq input unit isr iscr ier ipr interrupt controller priority determination interrupt request vector number i i2 to i0 ccr exr cpu iscr ier isr ipr syscr : irq sense control register : irq enable register : irq status register : interrupt priority register : system control register legend figure 5.1 block diagram of interrupt controller
rev. 2.00, 05/03, page 107 of 846 5.2 input/output pins table 5.1 summarizes the pins of the interrupt controller. table 5.1 pin configuration name i/o function nmi input nonmaskable external interrupt rising or falling edge can be selected irq7 irq6 irq5 irq4 irq3 irq2 irq1 irq0 input input input input input input input input maskable external interrupts rising, falling, or both edges, or level sensing can be selected 5.3register descriptions the interrupt controller has the following registers. for the system control register, see section 3.2.2, system control register (syscr). ? system control register (syscr) ? irq sense control register h (iscrh) ? irq sense control register l (iscrl) ? irq enable register (ier) ? irq status register (isr) ? interrupt priority register a (ipra) ? interrupt priority register b (iprb) ? interrupt priority register c (iprc) ? interrupt priority register d (iprd) ? interrupt priority register e (ipre) ? interrupt priority register f (iprf) ? interrupt priority register g (iprg) ? interrupt priority register h (iprh) ? interrupt priority register i (ipri) ? interrupt priority register j (iprj) ? interrupt priority register k (iprk)
rev. 2.00, 05/03, page 108 of 846 ? interrupt priority register l (iprl) ? interrupt priority register o (ipro) 5.3.1 interrupt priority registers a to l, and o (ipra to iprl, ipro) the ipr registers are thirteen 8-bit readable/writable registers that set priorities (levels 7 to 0) for interrupts other than nmi. the correspondence between interrupt sources and ipr settings is shown in table 5.2. setting a value in the range from h'0 to h'7 in the 3-bit groups of bits 0 to 2 and 4 to 6 sets the priority of the corresponding interrupt. bit bit name initial value r/w description 7 ? 0 ? reserved this bit is always read as 0, and cannot be modified. 6 5 4 ipr6 ipr5 ipr4 1 1 1 r/w r/w r/w sets the priority of the corresponding interrupt source 000: priority level 0 (lowest) 001: priority level 1 010: priority level 2 011: priority level 3 100: priority level 4 101: priority level 5 110: priority level 6 111: priority level 7 (highest) 3 ? 0 ? reserved this bit is always read as 0, and cannot be modified. 2 1 0 ipr2 ipr1 ipr0 1 1 1 r/w r/w r/w sets the priority of the corresponding interrupt source. 000: priority level 0 (lowest) 001: priority level 1 010: priority level 2 011: priority level 3 100: priority level 4 101: priority level 5 110: priority level 6 111: priority level 7 (highest)
rev. 2.00, 05/03, page 109 of 846 5.3.2 irq enable register (ier) ier controls the enabling and disabling of interrupt requests irqn (n = 7 to 0). bit bit name initial value r/w description 7 irq7e 0 r/w irq7 enable the irq7 interrupt request is enabled when this bit is 1. 6 irq6e 0 r/w irq6 enable the irq6 interrupt request is enabled when this bit is 1. 5 irq5e 0 r/w irq5 enable the irq5 interrupt request is enabled when this bit is 1. 4 irq4e 0 r/w irq4 enable the irq4 interrupt request is enabled when this bit is 1. 3 irq3e 0 r/w irq3 enable the irq3 interrupt request is enabled when this bit is 1. 2 irq2e 0 r/w irq2 enable the irq2 interrupt request is enabled when this bit is 1. 1 irq1e 0 r/w irq1 enable the irq1 interrupt request is enabled when this bit is 1. 0 irq0e 0 r/w irq0 enable the irq0 interrupt request is enabled when this bit is 1. 5.3.3 irq sense control registers h and l (iscrh and iscrl) the iscr registers select the source that generates an interrupt request at pins irqn (n = 7 to 0). specifiable sources are the falling edge, rising edge, or both edge detection, and level sensing.
rev. 2.00, 05/03, page 110 of 846 bit bit name initial value r/w description 15 14 irq7scb irq7sca 0 0 r/w r/w irq7 sense control b irq7 sense control a 00: interrupt request generated at irq7 input level low 01: interrupt request generated at falling edge of irq7 input 10: interrupt request generated at rising edge of irq7 input 11: interrupt request generated at both falling and rising edges of irq7 input 13 12 irq6scb irq6sca 0 0 r/w r/w irq6 sense control b irq6 sense control a 00: interrupt request generated at irq6 input level low 01: interrupt request generated at falling edge of irq6 input 10: interrupt request generated at rising edge of irq6 input 11: interrupt request generated at both falling and rising edges of irq6 input 11 10 irq5scb irq5sca 0 0 r/w r/w irq5 sense control b irq5 sense control a 00: interrupt request generated at irq5 input level low 01: interrupt request generated at falling edge of irq5 input 10: interrupt request generated at rising edge of irq5 input 11: interrupt request generated at both falling and rising edges of irq5 input 9 8 irq4scb irq4sca 0 0 r/w r/w irq4 sense control b irq4 sense control a 00: interrupt request generated at irq4 input level low 01: interrupt request generated at falling edge of irq4 input 10: interrupt request generated at rising edge of irq4 input 11: interrupt request generated at both falling and rising edges of irq4 input
rev. 2.00, 05/03, page 111 of 846 bit bit name initial value r/w description 7 6 irq3scb irq3sca 0 0 r/w r/w irq3 sense control b irq3 sense control a 00: interrupt request generated at irq3 input level low 01: interrupt request generated at falling edge of irq3 input 10: interrupt request generated at rising edge of irq3 input 11: interrupt request generated at both falling and rising edges of irq3 input 5 4 irq2scb irq2sca 0 0 r/w r/w irq2 sense control b irq2 sense control a 00: interrupt request generated at irq2 input level low 01: interrupt request generated at falling edge of irq2 input 10: interrupt request generated at rising edge of irq2 input 11: interrupt request generated at both falling and rising edges of irq2 input 3 2 irq1scb irq1sca 0 0 r/w r/w irq1 sense control b irq1 sense control a 00: interrupt request generated at irq1 input level low 01: interrupt request generated at falling edge of irq1 input 10: interrupt request generated at rising edge of irq1 input 11: interrupt request generated at both falling and rising edges of irq1 input 1 0 irq0scb irq0sca 0 0 r/w r/w irq0 sense control b irq0 sense control a 00: interrupt request generated at irq0 input level low 01: interrupt request generated at falling edge of irq0 input 10: interrupt request generated at rising edge of irq0 input 11: interrupt request generated at both falling and rising edges of irq0 input
rev. 2.00, 05/03, page 112 of 846 5.3.4 irq status register (isr) isr indicates the status of irqn (n = 7 to 0) interrupt requests. bit bit name initial value r/w description 7 6 5 4 3 2 1 0 irq7f irq6f irq5f irq4f irq3f irq2f irq1f irq0f 0 0 0 0 0 0 0 0 r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * irq7 to irq0 flags indicates the status of irq7 to irq0 interrupt requests. [setting condition] when the interrupt source selected by the iscrh, or iscrl occurs [clearing conditions] ? cleared by reading irqnf flag when irqnf = 1, then writing 0 to irqnf flag ? when interrupt exception handling is executed when low-level detection is set and irqn input is high level ? when irqn interrupt exception handling is executed when falling, rising, or both-edge detection is set ? when the dtc is activated by an irqn interrupt, and the disel bit in mrb of the dtc is cleared to 0 note: * only 0 can be written to this bit to clear the flag.
rev. 2.00, 05/03, page 113 of 846 5.4 interrupt sources 5.4.1 external interrupts there are nine external interrupts: nmi and irq7 to irq0. these interrupts can be used to restore this lsi from software standby mode. nmi interrupt: nmi is the highest-priority interrupt, and is always accepted by the cpu regardless of the interrupt control mode or the status of the cpu interrupt mask bits. the nmieg bit in syscr can be used to select whether an interrupt is requested at a rising edge or a falling edge on the nmi pin. irqn interrupts (n = 7 to 0): irqn interrupts are requested by an input signal at irqn pins. irqn interrupts have the following features: ? using iscr, it is possible to select whether an interrupt is generated by a low level, falling edge, rising edge, or both edges, at irqn pins. ? enabling or disabling of irqn interrupt requests can be selected with ier. ? the interrupt priority level can be set with ipr. ? the status of irqn interrupt requests is indicated in isr. isr flags can be cleared to 0 by software. a block diagram of irqn interrupts is shown in figure 5.2. irqne irqnf s r q irqn interrupt request clear signal edge / level detection circuit irqnsca, irqnscb irqn input note: n = 7 to 0 figure 5.2 block diagram of irqn interrupts
rev. 2.00, 05/03, page 114 of 846 the set timing for irqnf is shown in figure 5.3. irqn input pin irqnf note: n = 7 to 0 figure 5.3 set timing for irqnf the detection of irqn interrupts does not depend on whether the relevant pin has been set for input or output. however, when a pin is used as an external interrupt input pin, do not clear the corresponding ddr to 0; and use the pin as an i/o pin for another function. irqnf interrupt request flag is set to 1 when the setting condition is satisfied, regardless of ier settings. accordingly, refer to only necessary flags. 5.4.2 internal interrupts internal interrupts that are requested from the on-chip peripheral modules have the following features. ? for each on-chip peripheral module, there are flags that indicate the interrupt request status, and enable bits that select enabling or disabling of these interrupts, and they are masked independently. if the enable bit is set to 1 for a particular interrupt source, an interrupt request is issued to the interrupt controller. ? the interrupt priority level can be set with ipr. ? tpu and sci interrupt requests can activate the dmac * or dtc. when the dmac * or dtc is activated by the interrupt request, the interrupt control mode and cpu interrupt mask bits are disregarded. note: * supported only by the h8s/2239 group. 5.4.3interrupt exception handling vector table table 5.2 shows interrupt exception handling sources, vector addresses, and interrupt priorities. for default priorities, the lower the vector number, the higher the priority. priorities among modules can be set by means of the ipr. modules set at the same priority will conform to their default priorities. priorities within a module are fixed.
rev. 2.00, 05/03, page 115 of 846 table 5.2 interrupt sources, vector addresses, and interrupt priorities vector address * 1 interrupt source origin of interrupt source vector number advanced mode ipr * 2 priority nmi 7 h'001c high external pin irq0 16 h'0040 ipra6 to ipra4 irq1 17 h'0044 ipra2 to ipra0 irq2 18 h'0048 iprb6 to iprb4 irq3 19 h'004c irq4 20 h'0050 iprb2 to iprb0 irq5 21 h'0054 irq6 22 h'0058 irq7 23 h'005c iprc6 to iprc4 dtc swdtend (completion of software initiation data transfer) 24 h'0060 iprc2 to iprc0 watchdog timer 0 wovi0 (interval timer 0) 25 h'0064 iprd6 to iprd4 pc break pc break 27 h'006c ipre6 to ipre4 a/d adi (completion of a/d conversion) 28 h'0070 ipre2 to ipre0 watchdog timer 1 wovi1 (interval timer 1) 29 h'0074 ? reserved 30 31 h'0078 h'007c tpu channel 0 tgi0a (tgr0a input capture/compare- match) 32 h'0080 iprf6 to iprf4 tgi0b (tgr0b input capture/compare- match) 33 h'0084 tgi0c (tgr0c input capture/compare- match) 34 h'0088 low
rev. 2.00, 05/03, page 116 of 846 vector address * 1 interrupt source origin of interrupt source vector number advanced mode ipr * 2 priority tpu channel 0 tgi0d (tgr0d input capture/compare- match) 35 h'008c high tci0v (overflow 0) 36 h'0090 ? reserved 37 38 39 h'0094 h'0098 h'009c tpu channel 1 tgi1a (tgr1a input capture/compare- match) 40 h'00a0 iprf2 to iprf0 tgi1b (tgr1b input capture/compare- match) 41 h'00a4 tci1v (overflow 1) 42 h'00a8 tci1u (underflow 1) 43 h'00ac tpu channel 2 tgi2a (tgr2a input capture/compare- match) 44 h'00b0 iprg6 to iprg4 tgi2b (tgr2b input capture/compare- match) 45 h'00b4 tci2v (overflow 2) 46 h'00b8 tci2u (underflow 2) 47 h'00bc tpu channel 3 * 3 tgi3a (tgr3a input capture/compare- match) 48 h'00c0 tgi3b (tgr3b input capture/compare- match) 49 h'00c4 tgi3c (tgr3c input capture/compare- match) 50 h'00c8 tgi3d (tgr3d input capture/compare- match) 51 h'00cc iprg2 to iprg0 tci3v (overflow 3) 52 h'00d0 low
rev. 2.00, 05/03, page 117 of 846 vector address * 1 interrupt source origin of interrupt source vector number advanced mode ipr * 2 priority 53 h'00d4 54 h'00d8 ? reserved 55 h'00dc iprg2 to iprg0 high tgi4a (tgr4a input capture/compare- match) 56 h'00e0 tgi4b (tgr4b input capture/compare- match) 57 h'00e4 tci4v (overflow 4) 58 h'00e8 tpu channel 4 * 3 tci4u (underflow 4) 59 h'00ec iprh6 to iprh4 tpu channel 5 * 3 tgi5a (tgr5a input capture/compare- match) 60 h'00f0 iprh2 to iprh0 tgi5b (tgr5b input capture/compare- match) 61 h'00f4 tci5v (overflow 5) 62 h'00f8 tci5u (underflow 5) 63 h'00fc cmia0 (compare- match a0) 64 h'0100 cmib0 (compare- match b0) 65 h'0104 8-bit timer channel 0 ovi0 (overflow 0) 66 h'0108 ipri6 to ipri4 ? reserved 67 h'010c 8-bit timer channel 1 cmia1 (compare- match a1) 68 h'0110 ipri2 to ipri0 cmib1 (compare- match b1) 69 h'0114 ovi1 (overflow 1) 70 h'0118 ? reserved 71 h'011c low
rev. 2.00, 05/03, page 118 of 846 vector address * 1 interrupt source origin of interrupt source vector number advanced mode ipr * 2 priority dmac * 5 dend0a (completion of channel 0/channel 0a transfer) 72 h'0120 iprj6 to iprj4 high dend0b (completion of channel 0b transfer) 73 h'0124 dend1a (completion of channel 1/channel 1a transfer) 74 h'0128 dend1b (completion of channel 1b transfer) 75 h'012c eri0 (receive error 0) 80 h'0140 iprj2 to iprj0 rxi0 (receive completion 0) 81 h'0144 txi0 (transmit data empty 0) 82 h'0148 sci channel 0 tei0 (transmit end 0) 83 h'014c eri1 (receive error 1) 84 h'0150 iprk6 to iprk4 sci channel 1 rxi1 (receive completion 1) 85 h'0154 txi1 (transmit data empty 1) 86 h'0158 tei1 (transmit end 1) 87 h'015c sci channel 2 * 3 eri2 (receive error 2) 88 h'0160 iprk2 to iprk0 rxi2 (receive completion 2) 89 h'0164 txi2 (transmit data empty 2) 90 h'0168 tei2 (transmit end 2) 91 h'016c 8-bit timer channel 2 * 4 cmia2 (compare- match a2) 92 h'0170 iprl6 to iprl4 cmib2 (compare- match b2) 93 h'0174 ovi2 (overflow 2) 94 h'0178 ? reserved 95 h'017c low
rev. 2.00, 05/03, page 119 of 846 vector address * 1 interrupt source origin of interrupt source vector number advanced mode ipr * 2 priority 8-bit timer channel 3 * 4 cmia3 (compare- match a3) 96 h'0180 iprl6 to iprl4 high cmib3 (compare- match b3) 97 h'0184 ovi3 (overflow 3) 98 h'0188 ? reserved 99 h'018c iic channel 0 * 4 (option) iici0 (1-byte transmission/ reception completion) 100 h'0190 reserved 101 h'0194 iprl2 to iprl0 iici1 (1-byte transmission/ reception completion) 102 h'0198 iic channel 1 * 4 (option) reserved 103 h'019c iprl2 to iprl0 eri3 (receive error 3) 120 h'01e0 ipro6 to ipro4 rxi3 (receive completion 3) 121 h'01e4 txi3 (transmit data empty 3) 122 h'01e8 sci channel 3 tei3 (transmit end ) 123 h'01ec low notes: * 1 lower 16 bits of the start address. * 2 ipr6 to ipr4, and ipr2 to ipr0 bits are reserved, because these bits have no corresponding interruption. these bits are always read as 0 and cannot be modified. * 3 not available in the h8s/2227 group. * 4 not available in the h8s/2237 group and h8s/2227 group. * 5 supported only by the h8s/2239 group.
rev. 2.00, 05/03, page 120 of 846 5.5 operation 5.5.1 interrupt control modes and interrupt operation interrupt operations in this lsi differ depending on the interrupt control mode. nmi interrupts are accepted at all times except in the reset state and the hardware standby state. in the case of irq interrupts and on-chip peripheral module interrupts, an enable bit is provided for each interrupt. clearing an enable bit to 0 disables the corresponding interrupt request. interrupt sources for which the enable bits are set to 1 are controlled by the interrupt controller. table 5.3 shows the interrupt control modes. the interrupt controller performs interrupt control according to the interrupt control mode set by the intm1 and intm0 bits in syscr, the priorities set in ipr, and the masking state indicated by the i bit in the cpu's ccr, and bits i2 to i0 in exr. table 5.3interrupt control modes syscr interrupt control mode intm1 intm0 priority setting registers interrupt mask bits description 000 ? i interrupt mask control is performed by the i bit. ? 1 ?? setting prohibited 2 1 0 ipr i2 to i0 8-level interrupt mask control is performed by bits i2 to i0. 8 priority levels can be set with ipr. ? 1 ?? setting prohibited
rev. 2.00, 05/03, page 121 of 846 figure 5.4 shows the block diagram of the priority decision circuits. i interrupt acceptance control 8-level mask control default priority determination vector number interrupt control mode 2 ipr interrupt source i2 to i0 interrupt control mode 0 figure 5.4 block diagram of interrupt control operation interrupt acceptance control: in interrupt control mode 0, interrupt acceptance is controlled by the i bit in ccr. table 5.4 shows the interrupts selected in each interrupt control mode. table 5.4 interrupts selected in each interrupt control mode (1) interrupt mask bits interrupt control mode i selected interrupts 0 0 all interrupts 1 nmi interrupts 2 x all interrupts legend: x: don't care
rev. 2.00, 05/03, page 122 of 846 8-level control: in interrupt control mode 2, 8-level mask level determination is performed for the selected interrupts in interrupt acceptance control according to the interrupt priority level (ipr). the interrupt source selected is the interrupt with the highest priority level, and whose priority level set in ipr is higher than the mask level. table 5.5 interrupts selected in each interrupt control mode (2) interrupt control mode selected interrupts 0 all interrupts 2 highest-priority-level (ipr) interrupt whose priority level is greater than the mask level (ipr > i2 to i0). default priority determination: when an interrupt is selected by 8-level control, its priority is determined and a vector number is generated. if the same value is set for ipr, acceptance of multiple interrupts is enabled, and so only the interrupt source with the highest priority according to the preset default priorities is selected and has a vector number generated. interrupt sources with a lower priority than the accepted interrupt source are held pending. table 5.6 shows operations and control signal functions in each interrupt control mode. table 5.6 operations and control signal functions in each interrupt control mode setting interrupt acceptance control 8-level control interrupt control mode intm1 intm0 i i2 to i0 ipr default priority determination t (trace) 000 o im x ?? * 2 o ? 210x ? * 1 o im pr o t legend o : interrupt operation control performed x : no operation. (all interrupts enabled) im : used as interrupt mask bit pr : sets priority. ? : not used. notes: * 1 set to 1 when interrupt is accepted. * 2 keep the initial setting.
rev. 2.00, 05/03, page 123 of 846 5.5.2 interrupt control mode 0 enabling and disabling of irq interrupts, irq interrupts and on-chip peripheral module interrupts can be set by means of the i bit in the cpu's ccr. interrupts are enabled when the i bit is cleared to 0, and disabled when set to 1. figure 5.5 shows a flowchart of the interrupt acceptance operation in this case. 1. if an interrupt source occurs when the corresponding interrupt enable bit is set to 1, an interrupt request is sent to the interrupt controller. 2. if the i bit is set to 1, only an nmi interrupt is accepted, and other interrupt requests are held pending. if the i bit is cleared, an interrupt request is accepted. 3. interrupt requests are sent to the interrupt controller, the highest-ranked interrupt according to the priority system is accepted, and other interrupt requests are held pending. 4. when the cpu accepts an interrupt request, it starts interrupt exception handling after execution of the current instruction has been completed. 5. the pc and ccr are saved to the stack area by interrupt exception handling. the pc saved on the stack shows the address of the first instruction to be executed after returning from the interrupt handling routine. 6. next, the i bit in ccr is set to 1. this masks all interrupts except nmi. 7. the cpu generates a vector address for the accepted interrupt and starts execution of the interrupt handling routine at the address indicated by the contents of the vector address in the vector table.
rev. 2.00, 05/03, page 124 of 846 yes program execution status interrupt generated nmi irq1 irq0 save pc and ccr i=1 read vector address branch to interrupt handling routine hold pending tei3 yes yes no yes yes yes no no no i=0 no figure 5.5 flowchart of procedure up to interrupt acceptance in interrupt control mode 0
rev. 2.00, 05/03, page 125 of 846 5.5.3interrupt control mode 2 eight-level masking is implemented for irq interrupts, and on-chip peripheral module interrupts by comparing the interrupt mask level set by bits i2 to i0 of exr in the cpu with ipr. figure 5.6 shows a flowchart of the interrupt acceptance operation in this case. 1. if an interrupt source occurs when the corresponding interrupt enable bit is set to 1, an interrupt request is sent to the interrupt controller. 2. when interrupt requests are sent to the interrupt controller, the interrupt with the highest priority according to the interrupt priority levels set in ipr is selected, and lower-priority interrupt requests are held pending. if a number of interrupt requests with the same priority are generated at the same time, the interrupt request with the highest priority according to the priority system shown in table 5.2 is selected. 3. next, the priority of the selected interrupt request is compared with the interrupt mask level set in exr. an interrupt request with a priority no higher than the mask level set at that time is held pending, and only an interrupt request with a priority higher than the interrupt mask level is accepted. 4. when the cpu accepts an interrupt request, it starts interrupt exception handling after execution of the current instruction has been completed. 5. the pc, ccr, and exr are saved to the stack area by interrupt exception handling. the pc saved on the stack shows the address of the first instruction to be executed after returning from the interrupt handling routine. 6. the t bit in exr is cleared to 0. the interrupt mask level is rewritten with the priority level of the accepted interrupt. if the accepted interrupt is nmi, the interrupt mask level is set to h'7. 7. the cpu generates a vector address for the accepted interrupt and starts execution of the interrupt handling routine at the address indicated by the contents of the vector address in the vector table.
rev. 2.00, 05/03, page 126 of 846 yes program execution status interrupt generated? nmi level 6 interrupt? mask level 5 or below? level 7 interrupt? mask level 6 or below? save pc, ccr, and exr clear t bit to 0 update mask level read vector address branch to interrupt handling routine hold pending level 1 interrupt? mask level 0? yes yes no yes yes yes no yes yes no no no no no no figure 5.6 flowchart of procedure up to interrupt acceptance in control mode 2 5.5.4 interrupt exception handling sequence figure 5.7 shows the interrupt exception handling sequence. the example shown is for the case where interrupt control mode 0 is set in advanced mode, and the program area and stack area are in on-chip memory.
rev. 2.00, 05/03, page 127 of 846 (14) (12) (10) (6) (4) (2) (1) (5) (7) (9) (11) (13) interrupt service routine instruction prefetch internal operation vector fetch stack instruction prefetch internal operation interrupt acceptance interrupt level determination wait for end of instruction interrupt request signal internal address bus internal read signal internal write signal internal data bus (3) (1) (2) (4) (3) (5) (7) instruction prefetch address (not executed. this is the contents of the saved pc, the return address) instruction code (not executed) instruction prefetch address (not executed) sp-2 sp-4 saved pc and saved ccr vector address interrupt handling routine start address (vector address contents) interrupt handling routine start address ((13) = (10)(12)) first instruction of interrupt handling routine (6) (8) (9) (11) (10) (12) (13) (14) (8) figure 5.7 interrupt exception handling
rev. 2.00, 05/03, page 128 of 846 5.5.5 interrupt response times this lsi is capable of fast word transfer to on-chip memory, has the program area in on-chip rom and the stack area in on-chip ram, enabling high-speed processing. table 5.7 shows interrupt response times - the interval between generation of an interrupt request and execution of the first instruction in the interrupt handling routine. the execution status symbols used in table 5.7 are explained in table 5.8. table 5.7 interrupt response times normal mode * 5 advanced mode no. execution status intm1 = 0 intm1 = 1 intm1 = 0 intm1 = 1 1 interrupt priority determination * 1 33 33 2 number of wait states until executing instruction ends * 2 1 to 19 + 2s i 1 to 19 + 2s i 1 to 19 + 2s i 1 to 19 + 2s i 3 pc, ccr, exr stack save 2s k 3s k 2s k 3s k 4 vector fetch s i s i 2s i 2s i 5 instruction fetch * 3 2s i 2s i 2s i 2s i 6 internal processing * 4 22 22 total (using on-chip memory) 11 to 31 12 to 32 12 to 32 13 to 33 notes: * 1 two states in case of internal interrupt. * 2 refers to mulxs and divxs instructions. * 3 prefetch after interrupt acceptance and interrupt handling routine prefetch. * 4 internal processing after interrupt acceptance and internal processing after vector fetch. * 5 not available in this lsi. table 5.8 number of states in interrupt handling routine execution status object of access external device * 8 bit bus 16 bit bus symbol internal memory 2-state access 3-state access 2-state access 3-state access instruction fetch s i 1 4 6 + 2m 2 3 + m branch address read s j stack manipulation s k legend m: number of wait states in an external device access. note: * cannot be used in this lsi.
rev. 2.00, 05/03, page 129 of 846 5.5.6 dtc and dmac activation by interrupt the dtc and dmac can be activated by an interrupt. for details, see section 9, data transfer controller (dtc) and section 8, dma controller (dmac) * . note: * supported only by the h8s/2239 group. 5.6 usage notes 5.6.1 contention between interrupt generation and disabling when an interrupt enable bit is cleared to 0 to disable interrupts, the disabling becomes effective after execution of the instruction. when an interrupt enable bit is cleared to 0 by an instruction such as bclr or mov, and if an interrupt is generated during execution of the instruction, the interrupt concerned will still be enabled on completion of the instruction, and so interrupt exception handling for that interrupt will be executed on completion of the instruction. however, if there is an interrupt request of higher priority than that interrupt, interrupt exception handling will be executed for the higher-priority interrupt, and the lower-priority interrupt will be ignored. the same also applies when an interrupt source flag is cleared to 0. figure 5.8 shows an example in which the cmiea bit in the tcr register of the 8-bit timer is cleared to 0.
rev. 2.00, 05/03, page 130 of 846 internal address bus internal write signal cmiea cmfa cmia interrupt signal tcr write cycle by cpu cmia exception handling tcr address figure 5.8 contention between interrupt generation and disabling the above contention will not occur if an enable bit or interrupt source flag is cleared to 0 while the interrupt is masked. 5.6.2 instructions that disable interrupts the instructions that disable interrupts are ldc, andc, orc, and xorc. after any of these instructions are executed, all interrupts including nmi are disabled and the next instruction is always executed. when the i bit is set by one of these instructions, the new value becomes valid two states after execution of the instruction ends. 5.6.3when interrupts are disabled there are times when interrupt acceptance is disabled by the interrupt controller. the interrupt controller disables interrupt acceptance for a 3-state period after the cpu has updated the mask level with an ldc, andc, orc, or xorc instruction.
rev. 2.00, 05/03, page 131 of 846 5.6.4 interrupts during execution of eepmov instruction interrupt operation differs between the eepmov.b instruction and the eepmov.w instruction. with the eepmov.b instruction, an interrupt request (including nmi) issued during the transfer is not accepted until the move is completed. with the eepmov.w instruction, if an interrupt request is issued during the transfer, interrupt exception handling starts at a break in the transfer cycle. the pc value saved on the stack in this case is the address of the next instruction. therefore, if an interrupt is generated during execution of an eepmov.w instruction, the following coding should be used. l1: eepmov.w mov.w r4,r4 bne l1
rev. 2.00, 05/03, page 132 of 846
pbc002a_000020020700 rev. 2.00, 05/03, page 133 of 846 section 6 pc break controller (pbc) the pc break controller (pbc) provides functions that simplify program debugging. using these functions, it is easy to create a self-monitoring debugger, enabling programs to be debugged with the chip alone, without using an in-circuit emulator. a block diagram of the pc break controller is shown in figure 6.1. 6.1 features ? two break channels (a and b) ? 24-bit break address ? bit masking possible ? four types of break compare conditions ? instruction fetch ? data read ? data write ? data read/write ? bus master ? either cpu or cpu/dtc can be selected ? the timing of pc break exception handling after the occurrence of a break condition is as follows: ? immediately before execution of the instruction fetched at the set address (instruction fetch) ? immediately after execution of the instruction that accesses data at the set address (data access) ? module stop mode can be set
rev. 2.00, 05/03, page 134 of 846 output control output control mask control pc break interrupt match signal mask control bara bcra barb bcrb comparator control logic comparator control logic internal address access status match signal figure 6.1 block diagram of pc break controller 6.2 register descriptions the pc break controller has the following registers. ? break address register a (bara) ? break address register b (barb) ? break control register a (bcra) ? break control register b (bcrb) 6.2.1 break address register a (bara) bara is a 32-bit readable/writable register that specifies the channel a break address. bit bit name initial value r/w description 31 to 24 ? undefined ? reserved these bits are read as an undefined value and cannot be modified. 23 to 0 baa23 to baa0 all 0 r/w break address 23 to 0 these bits set the channel a pc break address.
rev. 2.00, 05/03, page 135 of 846 6.2.2 break address register b (barb) barb is the channel b break address register. the bit configuration is the same as for bara. 6.2.3break control register a (bcra) bcra controls channel a pc breaks. bit bit name initial value r/w description 7cmfa 0 r/(w) * 1 condition match flag a [setting condition] when a condition set for channel a is satisfied [clearing condition] when 0 is written to cmfa after reading * 2 cmfa = 1 6 cda 0 r/w cpu cycle/dtc cycle select a selects the channel a break condition bus master. 0: cpu 1: cpu, dtc, or dmac * 3 5 4 3 bamra2 bamra1 bamra0 0 0 0 r/w r/w r/w break address mask register a2 to a0 these bits specify which bits of the break address set in bara are to be masked. 000: baa23C0 (all bits are unmasked) 001: baa23C1 (lowest bit is masked) 010: baa23C2 (lower 2 bits are masked) 011: baa23C3 (lower 3 bits are masked) 100: baa23C4 (lower 4 bits are masked) 101: baa23C8 (lower 8 bits are masked) 110: baa23C12 (lower 12 bits are masked) 111: baa23C16 (lower 16 bits are masked) 2 1 csela1 csela0 0 0 r/w r/w break condition select selects break condition of channel a. 00: instruction fetch is used as break condition 01: data read cycle is used as break condition 10: data write cycle is used as break condition 11: data read/write cycle is used as break condition
rev. 2.00, 05/03, page 136 of 846 bit bit name initial value r/w description 0 biea 0 r/w break interrupt enable when this bit is 1, the pc break interrupt request of channel a is enabled. notes: * 1 only a 0 can be written to this bit to clear the flag. * 2 read the state wherein cmfa = 1 twice or more, when the cmfa is polled after inhibiting the pc break interruption. * 3 supported only by the h8s/2239 group. 6.2.4 break control register b (bcrb) bcrb is the channel b break control register. the bit configuration is the same as for bcra. 6.3operation the operation flow from break condition setting to pc break interrupt exception handling is shown in section 6.3.1, pc break interrupt due to instruction fetch, and section 6.3.2, pc break interrupt due to data access, taking the example of channel a. 6.3.1 pc break interrupt due to instruction fetch 1. set the break address in bara. for a pc break caused by an instruction fetch, set the address of the first instruction byte as the break address. 2. set the break conditions in bcra. set bit 6 (cda) to 0 to select the cpu because the bus master must be the cpu for a pc break caused by an instruction fetch. set the address bits to be masked to bits 3 to 5 (bamra2 to 0). set bits 1 and 2 (csela1 to 0) to 00 to specify an instruction fetch as the break condition. set bit 0 (biea) to 1 to enable break interrupts. 3. when the instruction at the set address is fetched, a pc break request is generated immediately before execution of the fetched instruction, and the condition match flag (cmfa) is set. 4. after priority determination by the interrupt controller, pc break interrupt exception handling is started.
rev. 2.00, 05/03, page 137 of 846 6.3.2 pc break interrupt due to data access 1. set the break address in bara. for a pc break caused by a data access, set the target rom, ram, i/o, or external address space address as the break address. stack operations and branch address reads are included in data accesses. 2. set the break conditions in bcra. select the bus master with bit 6 (cda). set the address bits to be masked to bits 3 to 5 (bamra2 to 0). set bits 1 and 2 (csela1 to 0) to 01, 10, or 11 to specify data access as the break condition. set bit 0 (biea) to 1 to enable break interrupts. 3. after execution of the instruction that performs a data access on the set address, a pc break request is generated and the condition match flag (cmfa) is set. 4. after priority determination by the interrupt controller, pc break interrupt exception handling is started. 6.3.3 notes on pc break interrupt handling ? when a pc break interrupt is generated at the transfer address of an eepmov.b instruction pc break exception handling is executed after all data transfers have been completed and the eepmov.b instruction has ended. ? when a pc break interrupt is generated at a dtc transfer address pc break exception handling is executed after the dtc has completed the specified number of data transfers, or after data for which the disel bit is set to 1 has been transferred. 6.3.4 operation in transitions to power-down modes the operation when a pc break interrupt is set for an instruction fetch at the address after a sleep instruction is shown below. ? when the sleep instruction causes a transition from high-speed (medium-speed) mode to sleep mode: after execution of the sleep instruction, a transition is not made to sleep mode, and pc break interrupt handling is executed. after execution of pc break interrupt handling, the instruction at the address after the sleep instruction is executed (figure 6.2 (a)). ? when the sleep instruction causes a transition from high speed (medium speed) mode to subactive mode (figure 6.2 (b)). ? when the sleep instruction causes a transition from subactive mode to high speed (medium speed) mode (figure 6.2 (c)). ? when the sleep instruction causes a transition to software standby mode:
rev. 2.00, 05/03, page 138 of 846 after execution of the sleep instruction, a transition is made to the respective mode, and pc break interrupt handling is not executed. however, the cmfa or cmfb flag is set (figure 6.2 (d)). sleep instruction execution high-speed (medium-speed) mode sleep instruction execution subactive mode system clock subclock direct transition exception handling pc break exception handling execution of instruction after sleep instruction subclock system clock, oscillation settling time sleep instruction execution transition to respective mode direct transition exception handling pc break exception handling execution of instruction after sleep instruction pc break exception handling execution of instruction after sleep instruction (a) (b) (c) (d) sleep instruction execution figure 6.2 operation in power-down mode transitions 6.3.5 when instruction execution is delayed by one state while the break interrupt enable bit is set to 1, instruction execution is one state later than usual. ? for 1-word branch instructions (bcc d:8, bsr, jsr, jmp, trapa, rte, and rts) in on-chip rom or ram. ? when break interruption by instruction fetch is set, the set address indicates on-chip rom or ram space, and that address is used for data access, the instruction that executes the data access is one state later than in normal operation. ? when break interruption by instruction fetch is set and a break interrupt is generated, if the executing instruction immediately preceding the set instruction has one of the addressing modes shown below, and that address indicates on-chip rom or ram, the instruction will be one state later than in normal operation. addressing modes: @ern, @(d:16,ern), @(d:32,ern), @-ern/ern+, @aa:8, @aa:24, @aa:32, @(d:8,pc), @(d:16,pc), @@aa:8 ? when break interruption by instruction fetch is set and a break interrupt is generated, if the executing instruction immediately preceding the set instruction is nop or sleep, or has #xx, rn as its addressing mode, and that instruction is located in on-chip rom or ram, the instruction will be one state later than in normal operation.
rev. 2.00, 05/03, page 139 of 846 6.4 usage notes 6.4.1 module stop mode setting pbc operation can be disabled or enabled using the module stop control register. the initial setting is for pbc operation to be halted. register access is enabled by clearing module stop mode. for details, refer to section 23, power-down modes. 6.4.2 pc break interrupts the pc break interrupt is shared by channels a and b. the channel from which the request was issued must be determined by the interrupt handler. 6.4.3cmfa and cmfb the cmfa and cmfb flags are not automatically cleared to 0, so 0 must be written to cmfa or cmfb after first reading the flag while it is set to 1. if the flag is left set to 1, another interrupt will be requested after interrupt handling ends. 6.4.4 pc break interrupt when dtc or dmac is bus master a pc break interrupt generated when the dtc or dmac * is the bus master is accepted after the bus has been transferred to the cpu by the bus controller. note: * supported only by the h8s/2239 group. 6.4.5 pc break set for instruction fetch at address following bsr, jsr, jmp, trapa, rte, or rts instruction even if the instruction at the address following a bsr, jsr, jmp, trapa, rte, or rts instruction is fetched, it is not executed, and so a pc break interrupt is not generated by the instruction fetch at the next address.
rev. 2.00, 05/03, page 140 of 846 6.4.6 i bit set by ldc, andc, orc, or xorc instruction when the i bit is set by an ldc, andc, orc, or xorc instruction, a pc break interrupt becomes valid two states after the end of the executing instruction. if a pc break interrupt is set for the instruction following one of these instructions, since interrupts, including nmi, are disabled for a 3-state period in the case of ldc, andc, orc, and xor, the next instruction is always executed. for details, see section 5, interrupt controller. 6.4.7 pc break set for instruction fetch at address following bcc instruction when a pc break is set for an instruction fetch at an address following a bcc instruction: a pc break interrupt is generated if the instruction at the next address is executed in accordance with the branch condition, and is not generated if the instruction at the next address is not executed. 6.4.8 pc break set for instruction fetch at branch destination address of bcc instruction a pc break interrupt is generated if the instruction at the branch destination is executed in accordance with the branch condition, and is not generated if the instruction at the branch destination is not executed.
bscs207a_010020020100 rev. 2.00, 05/03, page 141 of 846 section 7 bus controller this lsi has a built-in bus controller (bsc) that manages the external address space divided into eight areas. the bus controller also has a bus arbitration function, and controls the operation of the internal bus masters: the cpu, dma controller (dmac) * , and data transfer controller (dtc). note: * supported only by the h8s/2239 group. 7.1 features ? manages external address space in area units ? manages the external space as 8 areas of 2-mbytes ? bus specifications can be set independently for each area ? burst rom interface can be set ? basic bus interface ? chip select ( cs0 to cs7 ) can be output for areas 0 to 7 ? 8-bit access or 16-bit access can be selected for each area ? 2-state access or 3-state access can be selected for each area ? program wait states can be inserted for each area ? burst rom interface ? burst rom interface can be selected for area 0 ? one or two states can be selected for the burst cycle ? idle cycle insertion ? idle cycle can be inserted between consecutive read accesses to different areas ? idle cycle can be inserted before a write access to an external area immediately after a read access to an external area ? bus arbitration ? the on-chip bus arbiter arbitrates bus mastership among cpu, dmac * , and dtc. ? other features ? external bus release function note: * supported only by the h8s/2239 group.
rev. 2.00, 05/03, page 142 of 846 figure 7.1 shows a block diagram of the bus controller. area decorder bus controller abwcr astcr bcrh bcrl internal address bus external bus control signals chip select signals breq back internal control signals wait controller wcrh wcrl bus mode signal internal data bus bus arbiter dtc bus request signal dtc bus acknowledge signal cpu bus acknowledge signal dmac bus acknowledge signal * dmac bus request signal * cpu bus request signal wait legend: abwcr astcr wcrh wcrl bcrh bcrl note: * supported only by the h8s/2239 group. : bus width control register : access state control register : wait control register h : wait control register l : bus control register h : buscontrol register l figure 7 . 1 block diagram of bus controller
rev. 2.00, 05/03, page 143 of 846 7.2 input/output pins table 7.1 summarizes the pins of the bus controller. table 7.1 pin configuration name symbol i/o function address strove as output strobe signal indicating that address output on address bus is enabled. read rd output strobe signal indicating that external space is being read. high write hwr output strobe signal indicating that external space is to be written, and upper half (d15 to d8) of data bus is enabled. low write lwr output strobe signal indicating that external space is to be written, and lower half (d7 to d0) of data bus is enabled. chip select 0 to 7 cs0 to cs7 output strobe signal indicating that areas 0 to 7 are selected. wait wait input wait request signal when accessing external 3-state access space. bus request breq input request signal that releases bus to external device. bus request acknowledge back output acknowledge signal indicating that bus has been released. 7.3 register descriptions the following shows the registers of the bus controller. ? bus width control register (abwcr) ? access state control register (astcr) ? wait control register h (wcrh) ? wait control register l (wcrl) ? bus control register h (bcrh) ? bus control register l (bcrl ) ? pin function control register (pfcr)
rev. 2.00, 05/03, page 144 of 846 7.3.1 bus width control register (abwcr) abwcr designates each area for either 8-bit access or 16-bit access. abwcr sets the data bus width for the external memory space. the bus width for on-chip memory and internal i/o registers is fixed regardless of the settings in abwcr. bit bit name initial value r/w description 7 6 5 4 3 2 1 0 abw7 abw6 abw5 abw4 abw3 abw2 abw1 abw0 1/0 * 1/0 * 1/0 * 1/0 * 1/0 * 1/0 * 1/0 * 1/0 * r/w r/w r/w r/w r/w r/w r/w r/w area 7 to 0 bus width control: these bits select whether the corresponding area is to be designated for 8-bit access or 16-bit access. 0: area n is designated for 16-bit access 1: area n is designated for 8-bit access legend n = 7 to 0 note: * in modes 5 to 7, initial value of each bit is 1. in mode 4, initial value of each bit is 0. 7.3.2 access state control register (astcr) astcr designates each area as either a 2-state access space or a 3-state access space. astcr sets the number of access states for the external memory space. the number of access states for on-chip memory and internal i/o registers is fixed regardless of the settings in astcr. bit bit name initial value r/w description 7 6 5 4 3 2 1 0 ast7 ast6 ast5 ast4 ast3 ast2 ast1 ast0 1 1 1 1 1 1 1 1 r/w r/w r/w r/w r/w r/w r/w r/w area 7 to 0 access state control: these bits select whether the corresponding area is to be designated as a 2-state access space or a 3-state access space. wait state insertion is enabled or disabled at the same time. 0: area n is designated for 2-state access wait state insertion in area n external space is disabled 1: area n is designated for 3-state access wait state insertion in area n external space is enabled legend n = 7 to 0
rev. 2.00, 05/03, page 145 of 846 7.3.3 wait control registers h and l (wcrh, wcrl) wcrh and wcrl select the number of program wait states for each area. program waits are not inserted in the case of on-chip memory or internal i/o registers. ? wcrh bit bit name initial value r/w description 7 6 w71 w70 1 1 r/w r/w area 7 wait control 1 and 0: these bits select the number of program wait states when area 7 in external space is accessed while the ast7 bit in astcr is set to 1. 00: program wait not inserted when external space area 7 is accessed 01: 1 program wait state inserted when external space area 7 is accessed 10: 2 program wait states inserted when external space area 7 is accessed 11: 3 program wait states inserted when external space area 7 is accessed 5 4 w61 w60 1 1 r/w r/w area 6 wait control 1 and 0: these bits select the number of program wait states when area 6 in external space is accessed while the ast6 bit in astcr is set to 1. 00: program wait not inserted when external space area 6 is accessed 01: 1 program wait state inserted when external space area 6 is accessed 10: 2 program wait states inserted when external space area 6 is accessed 11: 3 program wait states inserted when external space area 6 is accessed
rev. 2.00, 05/03, page 146 of 846 bit bit name initial value r/w description 3 2 w51 w50 1 1 r/w r/w area 5 wait control 1 and 0: these bits select the number of program wait states when area 5 in external space is accessed while the ast5 bit in astcr is set to 1. 00: program wait not inserted when external space area 5 is accessed 01: 1 program wait state inserted when external space area 5 is accessed 10: 2 program wait states inserted when external space area 5 is accessed 11: 3 program wait states inserted when external space area 5 is accessed 1 0 w41 w40 1 1 r/w r/w area 4 wait control 1 and 0: these bits select the number of program wait states when area 4 in external space is accessed while the ast4 bit in astcr is set to 1. 00: program wait not inserted when external space area 4 is accessed 01: 1 program wait state inserted when external space area 4 is accessed 10: 2 program wait states inserted when external space area 4 is accessed 11: 3 program wait states inserted when external space area 4 is accessed ? wcrl bit bit name initial value r/w description 7 6 w31 w30 1 1 r/w r/w area 3 wait control 1 and 0: these bits select the number of program wait states when area 3 in external space is accessed while the ast3 bit in astcr is set to 1. 00: program wait not inserted when external space area 3 is accessed 01: 1 program wait state inserted when external space area 3 is accessed 10: 2 program wait states inserted when external space area 3 is accessed 11: 3 program wait states inserted when external space area 3 is accessed
rev. 2.00, 05/03, page 147 of 846 bit bit name initial value r/w description 5 4 w21 w20 1 1 r/w r/w area 2 wait control 1 and 0: these bits select the number of program wait states when area 2 in external space is accessed while the ast2 bit in astcr is set to 1. 00: program wait not inserted when external space area 2 is accessed 01: 1 program wait state inserted when external space area 2 is accessed 10: 2 program wait states inserted when external space area 2 is accessed 11: 3 program wait states inserted when external space area 2 is accessed 3 2 w11 w10 1 1 r/w r/w area 1 wait control 1 and 0: these bits select the number of program wait states when area 1 in external space is accessed while the ast1 bit in astcr is set to 1. 00: program wait not inserted when external space area 1 is accessed 01: 1 program wait state inserted when external space area 1 is accessed 10: 2 program wait states inserted when external space area 1 is accessed 11: 3 program wait states inserted when external space area 1 is accessed 1 0 w01 w00 1 1 r/w r/w area 0 wait control 1 and 0: these bits select the number of program wait states when area 0 in external space is accessed while the ast0 bit in astcr is set to 1. 00: program wait not inserted when external space area 0 is accessed 01: 1 program wait state inserted when external space area 0 is accessed 10: 2 program wait states inserted when external space area 0 is accessed 11: 3 program wait states inserted when external space area 0 is accessed
rev. 2.00, 05/03, page 148 of 846 7.3.4 bus control register h (bcrh) bcrh selects enabling or disabling of idle cycle insertion, and the memory interface for area 0. bit bit name initial value r/w description 7 icis1 1 r/w idle cycle insert 1: selects whether or not one idle cycle state is to be inserted between bus cycles when successive external read cycles are performed in different areas. 0: idle cycle not inserted in case of successive external read cycles in different areas 1: idle cycle inserted in case of successive external read cycles in different areas 6 icis0 1 r/w idle cycle insert 0: selects whether or not one idle cycle state is to be inserted between bus cycles when successive external read and write cycles are performed. 0: idle cycle not inserted in case of successive external read and write cycles 1: idle cycle inserted in case of successive external read and write cycles 5 brstrm 0 r/w burst rom enable: selects whether area 0 is used as a burst rom interface. 0: area 0 is basic bus interface 1: area 0 is burst rom interface 4 brsts1 1 r/w burst cycle select 1: selects the number of burst cycles for the burst rom interface. 0: burst cycle comprises 1 state 1: burst cycle comprises 2 states 3 brsts0 0 r/w burst cycle select 0: selects the number of words that can be accessed in a burst rom interface burst access. 0: max. 4 words in burst access 1: max. 8 words in burst access 2 to 0 ? all 0 r/w reserved the write value should always be 0.
rev. 2.00, 05/03, page 149 of 846 7.3.5 bus control register l (bcrl) bcrl performs selection of the external bus-released state protocol, and enabling or disabling of wait pin input. bit bit name initial value r/w description 7 brle 0 r/w bus release enable: enables or disables external bus release. 0: external bus release is disabled. breq and back can be used as i/o ports. 1: external bus release is enabled. 6? 0 r/wreserved the write value should always be 0. 5? 0 ? reserved this bit is always read as 0 and cannot be modified. 4? 0 r/wreserved the write value should always be 0. 3? 1 r/wreserved the write value should always be 1. 2 1 ? ? 0 0 r/w r/w reserved the write value should always be 0. 0 waite 0 r/w wait pin enable: selects enabling or disabling of wait input by the wait pin. 0: wait input by wait pin disabled. wait pin can be used as i/o port. 1: wait input by wait pin enabled.
rev. 2.00, 05/03, page 150 of 846 7.3.6 pin function control register (pfcr) pfcr performs address output control in external extended mode. bit bit name initial value r/w description 7 6 ? ? 0 0 r/w r/w reserved the write value should always be 0. 5 buzze 0 r/w buzz output enable: this bit selects enabling or disabling of buzz output from pin pf1. wdt_1 input clock that is selected by pss, and cks2 to cks0 bits is output as buzz signal. 0: pf1 input/output pin 1: buzz output pin 4 ? 0r/wreserved the write value should always be 0. 3 2 1 0 ae3 ae2 ae1 ae0 1/0 * 1/0 * 0 1/0 * r/w r/w r/w r/w address output enable 3 to 0: these bits select enabling or disabling of address outputs a8 to a23 in romless extended mode and modes with rom. when a pin is enabled for address output, the address is output regardless of the corresponding ddr setting. when a pin is disabled for address output, it becomes an output port when the corresponding ddr bit is set to 1. 0000: a8 to a23 output disabled 0001: a8 output enabled; a9 to a23 output disabled 0010: a8, a9 output enabled; a10 to a23 output disabled 0011: a8 to a10 output enabled; a11 to a23 output disabled 0100: a8 to a11 output enabled; a12 to a23 output disabled 0101: a8 to a12 output enabled; a13 to a23 output disabled 0110: a8 to a13 output enabled; a14 to a23 output disabled 0111: a8 to a14 output enabled; a15 to a23 output disabled 1000: a8 t o a15 output enabled; a16 to a23 output disabled 1001: a8 to a16 output enabled; a17 to a23 output disabled 1010: a8 to a17 output enabled; a18 to a23 output disabled 1011: a8 to a18 output enabled; a19 to a23 output disabled 1100: a8 to a19 output enabled; a20 to a23 output disabled 1101: a8 to a20 output enabled; a21 to a23 output disabled 1110: a8 to a21 output enabled; a22, a23 output disabled 1111: a8 to a23 output enabled note: * in modes 4 and 5, initial value of each bit is 1. in modes 6 and 7, initial value of each bit is 0.
rev. 2.00, 05/03, page 151 of 846 7.4 bus control 7.4.1 area divisions in advanced mode, the bus controller partitions the 16 mbytes address space into eight areas, 0 to 7, in 2-mbyte units, and performs bus control for external space in area units. in normal mode * , it controls a 64-kbyte address space comprising part of area 0. figure 7.2 shows an outline of the memory map. chip select signals ( cs0 to cs7 ) can be output for each area. note: * not available in this lsi. area 0 (2 mbytes) h ? 000000 h ? ffffff (1) (2) h ? 0000 h ? 1fffff h ? 200000 area 1 (2 mbytes) h ? 3fffff h ? 400000 area 2 (2 mbytes) h ? 5fffff h ? 600000 area 3 (2 mbytes) h ? 7fffff h ? 800000 area 4 (2 mbytes) h ? 9fffff h ? a00000 area 5 (2 mbytes) h ? bfffff h ? c00000 area 6 (2 mbytes) h ? dfffff h ? e00000 area 7 (2 mbytes) h ? ffff advanced mode normal mode * note: * not available in this lsi. figure 7.2 overview of area divisions
rev. 2.00, 05/03, page 152 of 846 7.4.2 bus specifications the external space bus specifications consist of three elements: bus width, number of access states, and number of program wait states. the bus width and number of access states for on-chip memory and internal i/o registers are fixed, and are not affected by the bus controller. (1) bus width: a bus width of 8 or 16 bits can be selected with abwcr. an area for which an 8- bit bus is selected functions as an 8-bit access space, and an area for which a 16-bit bus is selected functions as a16-bit access space. if all areas are designated for 8-bit access, 8-bit bus mode is set; if any area is designated for 16-bit access, 16-bit bus mode is set. when the burst rom interface is designated, 16-bit bus mode is always set. (2) number of access states: two or three access states can be selected with astcr. an area for which 2-state access is selected functions as a 2-state access space, and an area for which 3-state access is selected functions as a 3-state access space. with the burst rom interface, the number of access states may be determined without regard to astcr. when 2-state access space is designated, wait insertion is disabled. (3)number of program wait states: when 3-state access space is designated by astcr, the number of program wait states to be inserted automatically is selected with wcrh and wcrl. from 0 to 3 program wait states can be selected.
rev. 2.00, 05/03, page 153 of 846 table 7.2 bus specifications for each area (basic bus interface) abwcr astcr wcrh, wcrl bus specifications (basic bus interface) abwn astn wn1 wn0 bus width number of access states number of program wait states 00 ?? 16 2 0 100 3 0 11 10 2 13 10 ?? 82 0 100 3 0 11 10 2 13 7.4.3 bus interface for each area the initial state of each area is basic bus interface, 3-state access space. the initial bus width is selected according to the operating mode. the bus specifications described here cover basic items only, and the sections on each memory interface (7.6, basic bus interface and 7.7, burst rom interface) should be referred to for further details. (1) area 0: area 0 includes on-chip rom, and in rom-disabled extended mode, all of area 0 is external space. in rom-enabled extended mode, the space excluding on-chip rom is external space. when area 0 external space is accessed, the cs0 signal can be output. either basic bus interface or burst rom interface can be selected for area 0. (2) areas 1 to 6: in external extended mode, all of areas 1 to 6 is external space. when area 1 to 6 external space is accessed, the cs1 to cs6 pin signals respectively can be output. only the basic bus interface can be used for areas 1 to 6. (3) area 7: area 7 includes the on-chip ram and internal l/o registers. in external extended mode, the space excluding the on-chip ram and internal l/o registers, is external space. the on-chip ram is enabled when the rame bit in the system control register (syscr) is set to 1; when the rame bit is cleared to 0, the on-chip ram is disabled and the corresponding space becomes external space. when area 7 external space is accessed, the cs7 signal can be output. only the basic bus interface can be used for the area 7.
rev. 2.00, 05/03, page 154 of 846 7.4.4 chip select signals this lsi can output chip select signals ( cs0 to cs7 ) to areas 0 to 7, the signal being driven low when the corresponding external space area is accessed. figure 7.3 shows an example of csn (n = 0 to 7) output timing. enabling or disabling of the csn signal is performed by setting the data direction register (ddr) for the port corresponding to the particular csn pin. in rom-disabled extended mode, the cs0 pin is placed in the output state after a power-on reset. pins cs1 to cs7 are placed in the input state after a power-on reset, and so the corresponding ddr should be set to 1 when outputting signals cs1 to cs7 . in rom-enabled extended mode, pins cs0 to cs7 are all placed in the input state after a power-on reset, and so the corresponding ddr should be set to 1 when outputting signals cs0 to cs7 . for details, see section 10, i/o ports. bus cycle t 1 t 2 t 3 area n external address address bus csn figure 7.3 csn csn csn csn signal output timing (n = 0 to 7)
rev. 2.00, 05/03, page 155 of 846 7.5 basic timing the cpu is driven by a system clock ( 7.5.1 on-chip memory (rom, ram) access timing on-chip memory is accessed in one state. the data bus is 16 bits wide, permitting both byte and word transfer instruction. figure 7.4 shows the on-chip memory access cycle. figure 7.5 shows the pin states. t 1 internal address bus bus cycle address read data write data internal read signal internal data bus internal write signal internal data bus read access write access figure 7.4 on-chip memory access cycle
rev. 2.00, 05/03, page 156 of 846 bus cycle t 1 unchanged address bus as rd hwr , lwr data bus high high high high-impedance state figure 7.5 pin states during on-chip memory access 7.5.2 on-chip peripheral module access timing the on-chip peripheral modules are accessed in two states. the data bus is either 8 bits or 16 bits wide, depending on the particular internal i/o register being accessed. figure 7.6 shows the access timing for the on-chip peripheral modules. figure 7.7 shows the pin states. t 1 t 2 internal address bus bus cycle address read data write data internal read signal internal data bus internal write signal internal data bus read access write access figure 7.6 on-chip peripheral module access cycle
rev. 2.00, 05/03, page 157 of 846 t 1 t 2 bus cycle unchanged address bus as rd hwr , lwr data bus high high high high-impedance state figure 7.7 pin states during on-chip peripheral module access 7.5.3 external address space access timing the external address space is accessed with an 8-bit or 16-bit data bus width in a two-state or three-state bus cycle. in three-state access, wait states can be inserted. for further details, refer to section 7.6.3, basic timing.
rev. 2.00, 05/03, page 158 of 846 7.6 basic bus interface the basic bus interface enables direct connection of rom, sram, and so on. 7.6.1 data size and data alignment data sizes for the cpu and other internal bus masters are byte, word, and longword. the bus controller has a data alignment function, and when accessing external space, controls whether the upper data bus (d15 to d8) or lower data bus (d7 to d0) is used according to the bus specifications for the area being accessed (8-bit access space or 16-bit access space) and the data size. 8-bit access space: figure 7.8 illustrates data alignment control for the 8-bit access space. with the 8-bit access space, the upper data bus (d15 to d8) is always used for accesses. the amount of data that can be accessed at one time is one byte: a word transfer instruction is performed as two- byte accesses, and a longword transfer instruction, as four-byte accesses. upper data bus lower data bus byte size word size 1st bus cycle 2nd bus cycle 1st bus cycle 2nd bus cycle 3rd bus cycle 4th bus cycle longword size even address byte size odd address d15 d8 d7 d0 figure 7.8 access sizes and data alignment control (8-bit access space) 16-bit access space: figure 7.9 illustrates data alignment control for the 16-bit access space. with the 16-bit access space, the upper data bus (d15 to d8) and lower data bus (d7 to d0) are used for accesses. the amount of data that can be accessed at one time is one byte or one word, and a longword transfer instruction is executed as two word transfer instructions. in byte access, whether the upper or lower data bus is used is determined by whether the address is even or odd. the upper data bus is used for an even address, and the lower data bus for an odd address.
rev. 2.00, 05/03, page 159 of 846 d15 d8 d7 d0 upper data bus lower data bus byte size word size 1st bus cycle 2nd bus cycle longword size  even address byte size  odd address figure 7.9 access sizes and data alignment control (16-bit access space) 7.6.2 valid strobes table 7.3 shows the data buses used and valid strobes for the access spaces. in a read, the rd signal is valid without discrimination between the upper and lower halves of the data bus. in a write, the hwr signal is valid for the upper half of the data bus, and the lwr signal for the lower half. table 7.3 data buses used and valid strobes area access size read/ write address valid strobe upper data bus (d15 to d8) lower data bus (d7 to d0) byte read ? rd valid invalid 8-bit access space write ? hwr hi-z byte read even rd valid invalid odd invalid valid write even hwr valid hi-z odd lwr hi-z valid word read ? rd valid valid 16-bit access space write ? hwr , lwr valid valid notes: hi-z: high impedance. invalid: input state: input value is ignored.
rev. 2.00, 05/03, page 160 of 846 7.6.3 basic timing 8-bit 2-state access space: figure 7.10 shows the bus timing for an 8-bit 2-state access space. when an 8-bit access space is accessed , the upper half (d15 to d8) of the data bus is used. wait states cannot be inserted. bus cycle t 1 t 2 address bus csn as rd d15 to d8 valid d7 to d0 invalid read hwr lwr (16-bit bus mode) d15 to d8 valid d7 to d0 high impedance high impedance write high note: n = 0 to 7 lwr (8-bit bus mode) figure 7.10 bus timing for 8-bit 2-state access space
rev. 2.00, 05/03, page 161 of 846 8-bit 3-state access space: figure 7.11 shows the bus timing for an 8-bit 3-state access space. when an 8-bit access space is accessed, the upper half (d15 to d8) of the data bus is used. wait states can be inserted. bus cycle t 1 t 2 address bus csn as rd d15 to d8 valid d7 to d0 invalid read hwr lwr (16-bit bus mode) d15 to d8 valid d7 to d0 write high note: n = 0 to 7 t 3 high impedance high impedance lwr (8-bit bus mode) figure 7.11 bus timing for 8-bit 3-state access space
rev. 2.00, 05/03, page 162 of 846 16-bit 2-state access space: figures 7.12 to 7.14 show bus timings for a 16-bit 2-state access space. when a 16-bit access space is accessed, the upper half (d15 to d8) of the data bus is used for the even address, and the lower half (d7 to d0) for the odd address. wait states cannot be inserted. bus cycle t 1 t 2 address bus csn as rd d15 to d8 valid d7 to d0 invalid read hwr lwr d15 to d8 valid d7 to d0 write high note: n = 0 to 7 high impedance figure 7.12 bus timing for 16-bit 2-state access space (1) (even address byte access)
rev. 2.00, 05/03, page 163 of 846 bus cycle t 1 t 2 address bus csn as rd d15 to d8 invalid d7 to d0 valid read hwr lwr d15 to d8 d7 to d0 valid write note: n = 0 to 7 high high impedance figure 7.13 bus timing for 16-bit 2-state access space (2) (odd address byte access)
rev. 2.00, 05/03, page 164 of 846 bus cycle t 1 t 2 address bus csn as rd d15 to d8 valid d7 to d0 valid read hwr lwr d15 to d8 valid d7 to d0 valid write note: n = 0 to 7 figure 7.14 bus timing for 16-bit 2-state access space (3) (word access)
rev. 2.00, 05/03, page 165 of 846 16-bit 3-state access space: figures 7.15 to 7.17 show bus timings for a 16-bit 3-state access space. when a 16-bit access space is accessed , the upper half (d15 to d8) of the data bus is used for the even address, and the lower half (d7 to d0) for the odd address. wait states can be inserted. bus cycle t 1 t 2 address bus csn as rd d15 to d8 valid d7 to d0 invalid read hwr lwr d15 to d8 valid d7 to d0 write high note: n = 0 to 7 t 3 high impedance figure 7.15 bus timing for 16-bit 3-state access space (1) (even address byte access)
rev. 2.00, 05/03, page 166 of 846 bus cycle t 1 t 2 address bus csn as rd d15 to d8 invalid d7 to d0 valid read hwr lwr d15 to d8 d7 to d0 valid write high note: n = 0 to 7 t 3 high impedance figure 7.16 bus timing for 16-bit 3-state access space (2) (odd address byte access)
rev. 2.00, 05/03, page 167 of 846 bus cycle t 1 t 2 address bus csn as rd d15 to d8 valid d7 to d0 valid read hwr lwr d15 to d8 valid d7 to d0 valid write note: n = 0 to 7 t 3 figure 7.17 bus timing for 16-bit 3-state access space (3) (word access)
rev. 2.00, 05/03, page 168 of 846 7.6.4 wait control when accessing external space, this lsi can extend the bus cycle by inserting one or more wait states (tw). there are two ways of inserting wait states: program wait insertion and pin wait insertion using the wait pin. (1) program wait insertion from 0 to 3 wait states can be inserted automatically between the t 2 state and t 3 state on an individual area basis in 3-state access space, according to the settings of wcrh and wcrl. (2) pin wait insertion setting the waite bit in bcrh to 1 enables wait insertion by means of the wait pin. when external space is accessed in this state, program wait insertion is first carried out according to the settings in wcrh and wcrl. then, if the wait pin is low at the falling edge of wait pin is held low, t w states are inserted until it goes high.
rev. 2.00, 05/03, page 169 of 846 figure 7.18 shows an example of wait state insertion timing. by program wait t 1 address bus as rd data bus read data read hwr , lwr write data write note: indicates the timing of wait pin sampling. wait data bus t 2 t w t w t w t 3 by wait pin figure 7.18 example of wait state insertion timing
rev. 2.00, 05/03, page 170 of 846 7.7 burst rom interface with this lsi, external space area 0 can be designated as burst rom space, and burst rom interfacing can be performed. the burst rom space interface enables 16-bit configuration rom with burst access capability to be accessed at high speed. area 0 can be designated as burst rom space by means of the brstrm bit in bcrh. consecutive burst accesses of a maximum of 4 words or 8 words can be performed for cpu instruction fetches only. one or two states can be selected for burst access. note: when the operating frequency ranges from 16 mhz to 20 mhz, the burst rom interface is not available. 7.7.1 basic timing the number of states in the initial cycle (full access) of the burst rom interface is in accordance with the setting of the ast0 bit in astcr. also, when the ast0 bit is set to 1, wait state insertion is possible. one or two states can be selected for the burst cycle, according to the setting of the brsts1 bit in bcrh. wait states cannot be inserted. when area 0 is designated as burst rom space, it becomes 16-bit access space regardless of the setting of the abw0 bit in abwcr. when the brsts0 bit in bcrh is cleared to 0, burst access of up to 4 words is performed; when the brsts0 bit is set to 1, burst access of up to 8 words is performed. the basic access timing for burst rom space is shown in figures 7.19 and 7.20. the timing shown in figure 7.19 is for the case where the ast0 and brsts1 bits are both set to 1, and that in figure 7.20 is for the case where both these bits are cleared to 0.
rev. 2.00, 05/03, page 171 of 846 t 1 address bus cs0 as data bus t 2 t 3 t 1 t 2 t 1 full access t 2 rd burst access only lower address changed read data read data read data figure 7.19 example of burst rom access timing (when ast0 = brsts1 = 1) t 1 cs0 as t 2 t 1 t 1 rd address bus data bus full access burst access only lower address changed read data read data read data figure 7.20 example of burst rom access timing (when ast0 = brsts1 = 0)
rev. 2.00, 05/03, page 172 of 846 7.7.2 wait control as with the basic bus interface, either program wait insertion or pin wait insertion using the wait pin can be used in the initial cycle (full access) of the burst rom interface. see section 7.6.4, wait control. wait states cannot be inserted in a burst cycle. 7.8 idle cycle when this lsi accesses external space, it can insert a 1-state idle cycle (t i ) between bus cycles in the following two cases: (1) when read accesses between different areas occur consecutively, and (2) when a write cycle occurs immediately after a read cycle. by inserting an idle cycle it is possible, for example, to avoid data collisions between rom, with a long output floating time, and high-speed memory, i/o interfaces, and so on. (1) consecutive reads between different areas if consecutive reads between different areas occur while the icis1 bit in bcrh is set to 1, an idle cycle is inserted at the start of the second read cycle. figure 7.21 shows an example of the operation in this case. in this example, bus cycle a is a read cycle from rom with a long output floating time, and bus cycle b is a read cycle from sram, each being located in a different area. in (a), an idle cycle is not inserted, and a collision occurs in cycle b between the read data from rom and that from sram. in (b), an idle cycle is inserted, and a data collision is prevented. t 1 address bus rd bus cycle a data bus t 2 t 3 t 1 t 2 bus cycle b long output floating time data collision (a) idle cycle not inserted (icis1 = 0) t 1 address bus rd bus cycle a data bus t 2 t 3 t i t 1 bus cycle b (b) idle cycle inserted (initial value icis1 = 1) t 2 cs (area a) cs (area b) cs (area a) cs (area b) figure 7.21 example of idle cycle operation (1)
rev. 2.00, 05/03, page 173 of 846 (2) write after read if an external write occurs after an external read while the icis0 bit in bcrh is set to 1, an idle cycle is inserted at the start of the write cycle. figure 7.22 shows an example of the operation in this case. in this example, bus cycle a is a read cycle from rom with a long output floating time, and bus cycle b is a cpu write cycle. in (a), an idle cycle is not inserted, and a collision occurs in cycle b between the read data from rom and the cpu write data. in (b), an idle cycle is inserted, and a data collision is prevented. t 1 t 2 t 3 t 1 t 2 t 1 t 2 t 3 t i t 1 t 2 address bus ? bus cycle a data bus bus cycle b long output floating time data collision (a) idle cycle not inserted (icis0 = 0) address bus rd bus cycle a data bus bus cycle b (b) idle cycle inserted (initial value icis0 = 1) cs (area a) cs (area b) rd hwr hwr cs (area a) cs (area b) figure 7.22 example of idle cycle operation (2) (3) relationship between chip select ( cs cs cs cs ) signal and read ( rd rd rd rd ) signal depending on the system's load conditions, the rd signal may lag behind the cs signal. an example is shown in figure 7.23. in this case, with the setting for no idle cycle insertion (a), there may be a period of overlap between the bus cycle a rd signal and the bus cycle b cs signal. setting idle cycle insertion, as in (b), however, will prevent any overlap between the rd and cs signals. in the initial state after reset release, idle cycle insertion (b) is set.
rev. 2.00, 05/03, page 174 of 846 t 1 t 2 t 3 t 1 t 2 t 1 t 2 t 3 t i t 1 t 2 address bus ? bus cycle a bus cycle b (a) idle cycle not inserted (icis1 = 0) possibility of overlap between cs (area b) and rd address bus bus cycle a bus cycle b (b) idle cycle inserted (initial value icis1 = 1) cs (area a) cs (area b) rd rd cs (area a) cs (area b) figure 7.23 relationship between chip select ( cs cs cs cs ) and read ( rd rd rd rd ) table 7.4 shows pin states in an idle cycle. table 7.4 pin states in idle cycle pins pin state a23 to a0 contents of next bus cycle d15 to d0 high impedance csn high as high rd high hwr high lwr high
rev. 2.00, 05/03, page 175 of 846 7.9 bus release this lsi can release the external bus in response to a bus request from an external device. in the external bus released state, the internal bus master continues to operate as long as there is no external access. in external extended mode, the bus can be released to an external device by setting the brle bit in bcrl to 1. driving the breq pin low issues an external bus request to this lsi. when the breq pin is sampled, at the prescribed timing the back pin is driven low, and the address bus, data bus, and bus control signals are placed in the high-impedance state, establishing the external bus- released state. in the external bus released state, an internal bus master can perform accesses using the internal bus. when an internal bus master wants to make an external access, it temporarily defers activation of the bus cycle, and waits for the bus request from the external bus master to be dropped. when the breq pin is driven high, the back pin is driven high at the prescribed timing and the external bus released state is terminated. in the event of simultaneous external bus release request and external access request generation, the order of priority is as follows: (high) external bus release > internal bus master external access (low) table 7.5 shows pin states in the external bus released state. table 7.5 pin states in bus released state pins pin state a23 to a0 high impedance d15 to d0 high impedance csn high impedance as high impedance rd high impedance hwr high impedance lwr high impedance
rev. 2.00, 05/03, page 176 of 846 figure 7.24 shows the timing for transition to the bus-released state. cpu cycle address minimum 1 state t 0 t 1 t 2 hwr , lwr breq back high impedance high impedance as csn high impedance high impedance high impedance rd high impedance data bus address bus [1] [2] [3] [4] [5] [1] low level of breq pin is sampled at rise of t 2 state. [2] back pin is driven low at end of cpu read cycle, releasing bus to external bus master. [3] breq pin state is still sampled in external bus released state. [4] high level of breq pin is sampled. [5] back pin is driven high, ending bus release cycle. cpu cycle external bus released state note : n = 0 to 7 figure 7.24 bus-released state transition timing 7.9.1 bus release usage note when mstpcr is set to h'ffffff and transmitted to sleep mode, the external bus release does not function. to activate the external bus release in sleep mode, do not set mstpcr to h'ffffff.
rev. 2.00, 05/03, page 177 of 846 7.10 bus arbitration this lsi has a bus arbiter that arbitrates bus master operations. there are three bus masters, the cpu, dmac * , and dtc, which perform read/write operations when they have possession of the bus. each bus master requests the bus by means of a bus request signal. the bus arbiter determines priorities at the prescribed timing, and permits use of the bus by means of a bus request acknowledge signal. the selected bus master then takes possession of the bus and begins its operation. note: * supported only by the h8s/2239 group. 7.10.1 operation the bus arbiter detects the bus masters' bus request signals, and if the bus is requested, sends a bus request acknowledge signal to the bus master making the request. if there are bus requests from more than one bus master, the bus request acknowledge signal is sent to the one with the highest priority. when a bus master receives the bus request acknowledge signal, it takes possession of the bus until that signal is canceled. the order of priority of the bus masters is as follows: (high) dmac * > dtc > cpu (low) an internal bus access by an internal bus master, and external bus release, can be executed in parallel. in the event of simultaneous external bus release request, and internal bus master external access request generation, the order of priority is as follows: (high) external bus release > internal bus master external access (low) note: * supported only by the h8s/2239 group.
rev. 2.00, 05/03, page 178 of 846 7.10.2 bus transfer timing even if a bus request is received from a bus master with a higher priority than that of the bus master that has acquired the bus and is currently operating, the bus is not necessarily transferred immediately. there are specific times at which each bus master can relinquish the bus. cpu: the cpu is the lowest-priority bus master, and if a bus request is received from the dmac * and dtc, the bus arbiter transfers the bus to the bus master that issued the request. the timing for transfer of the bus is as follows: ? the bus is transferred at a break between bus cycles. however, if a bus cycle is executed in discrete operations, as in the case of a longword-size access, the bus is not transferred between the operations. ? if the cpu is in sleep mode, it transfers the bus immediately. note: * supported only by the h8s/2239 group. dtc: the dtc sends the bus arbiter a request for the bus when an activation request is generated. the dtc can release the bus after a vector read, a register information read (3 states), a single data transfer, or a register information write (3 states). it does not release the bus during a register information read (3 states), a single data transfer, or a register information write (3 states). dmac (only by the h8s/2239 group): the dmac sends the bus arbiter a request for the bus when an activation request is generated. in the case of an external request in short address mode or normal mode, and in cycle steal mode, the dmac releases the bus after a single transfer. in block transfer mode, it releases the bus after transfer of one block, and in burst mode, after completion of the transfer. 7.10.3 external bus release usage note external bus release can be performed on completion of an external bus cycle. the cs signal remains low until the end of the external bus cycle. therefore, when external bus release is performed, the cs signal may change from the low level to the high-impedance state.
rev. 2.00, 05/03, page 179 of 846 7.11 resets and the bus controller in a power-on reset, this lsi, including the bus controller, enters the reset state at that point, and an executing bus cycle is discontinued. in a manual reset, the bus controller's registers and internal state are maintained, and an executing external bus cycle is completed. in this case, wait input is ignored and write data is not guaranteed. when the dmac * is initialized at the manual reset, dack and tend output is disabled. the dmac * operates as i/o port controlled by ddr and dr. note: * supported only by the h8s/2239 group.
rev. 2.00, 05/03, page 180 of 846
dmas260b_000020020700 rev. 2.00, 05/03, page 181 of 846 section 8 dma controller (dmac) the h8s/2239 group has a built-in dma controller (dmac) which can carry out data transfer on up to 4 channels. note: the dmac is supported only by the h8s/2239 group. it is not available in the h8s/2238 group, h8s/2237 group, or h8s/2227 group. 8.1 features ? selectable as short address mode or full address mode short address mode maximum of 4 channels can be used dual address mode or single address mode can be selected in dual address mode, one of the two addresses, transfer source and transfer destination, is specified as 24 bits and the other as 16 bits in single address mode, transfer source or transfer destination address only is specified as 24 bits in single address mode, transfer can be performed in one bus cycle choice of sequential mode, idle mode, or repeat mode for dual address mode and single address mode full address mode maximum of 2 channels can be used transfer source and transfer destination addresses as specified as 24 bits choice of normal mode or block transfer mode ? 16-mbyte address space can be specified directly ? byte or word can be set as the transfer unit ? activation sources: internal interrupt, external request, auto-request (depending on transfer mode) six 16-bit timer-pulse unit (tpu) compare match/input capture interrupts serial communication interface (sci_0, sci_1) transmit-data-empty interrupt, receive-data- full interrupt a/d converter conversion end interrupt external request auto-request ? module stop mode can be set
rev. 2.00, 05/03, page 182 of 846 a block diagram of the dmac is shown in figure 8.1. internal address bus address buffer processor internal interrupts tgi0a tgi1a tgi2a tgi3a tgi4a tgi5a txi0 rxi0 txi1 rxi1 adi external pins dreq0 dreq1 tend0 tend1 dack0 dack1 interrupt signals dend0a dend0b dend1a dend1b control logic dmawer dmacr1b dmacr1a dmacr0b dmacr0a dmatcr dmabcr data buffer internal data bus mar_0ah ioar_0a etcr_0a mar_0bh ioar_0b etcr_0b mar_1ah ioar_1a etcr_1a mar_1bh mar_0al mar_0bl mar_1al mar_1bl ioar_1b etcr_1b legend dmawer : dma write enable register dmatcr : dma terminal control register dmabcr : dma band control register (for all channels) dmacr : dma control register mar : memory address register ioar : i/o address register etcr : execute transfer count register channel 0 channel 1 channel 0a channel 0b channel 1a channel 1b module data bus figure 8.1 block diagram of dmac
rev. 2.00, 05/03, page 183 of 846 8.2 input/output pins table 8.1 shows the pin configuration of the interrupt controller. table 8.1 pin configuration channel pin name symbol i/o function 0 dma request 0 dreq0 input channel 0 external request dma transfer acknowledge 0 dack0 output channel 0 single address transfer acknowledge dma transfer end 0 tend0 output channel 0 transfer end 1 dma request 1 dreq1 input channel 1 external request dma transfer acknowledge 1 dack1 output channel 1 single address transfer acknowledge dma transfer end 1 tend1 output channel 1 transfer end 8.3 register descriptions ? memory address register_0ah (mar_0ah) ? memory address register_0al (mar_0al) ? i/o address register_0a (ioar_0a) ? transfer count register_0a (ectr_0a) ? memory address register_0bh (mar_0bh) ? memory address register_0bl (mar_0bl) ? i/o address register_0b (ioar_0b) ? transfer count register_0b (ectr_0b) ? memory address register_1ah (mar_1ah) ? memory address register_1al (mar_1al) ? i/o address register_1a (ioar_1a) ? transfer count register_1a (etcr_1b) ? memory address register_1bh (mar_1bh) ? memory address register_1bl (mar_1bl) ? i/o address register_1b (ioar_1b) ? transfer count register_1b (etcr_1b) ? dma control register_0a (dmacr_0a) ? dma control register_0b (dmacr_0b) ? dma control register_1a (dmacr_1a) ? dma control register_1b (dmacr_1b)
rev. 2.00, 05/03, page 184 of 846 ? dma band control register h (dmabcrh) ? dma band control register l (dmabcrl) ? dma write enable register (dmawer) ? dma terminal control register (dmatcr) the functions of mar, ioar, etcr, dmacr, and dmabcr differ according to the transfer mode (short address mode or full address mode). the transfer mode can be selected by means of the fae1 and fae0 bits in dmabcrh. the register configurations for short address mode and full address mode of channel 0 are shown in table 8.2. table 8.2 short address mode and full address mode (channel 0) fae0 description 0 short address mode specified (channels 0a and 0b operate independently) channel 0a mar_0ah specifies transfer source/transfer destination address specifies transfer destination/transfer source address specifies number of transfers specifies transfer size, mode, activation source. specifies transfer source/transfer destination address specifies transfer destination/transfer source address specifies number of transfers specifies transfer size, mode, activation source. ioar_0a etcr_0a dmacr_0a channel 0b mar_0bh mar_0al mar_0bl ioar_0b etcr_0b dmacr_0b 1 full address mode specified (channels 0a and 0b operate in combination as channel 0) channel 0 mar_0ah specifies transfer source address specifies transfer destination address not used not used specifies number of transfers specifies number of transfers (used in block transfer mode only) specifies transfer size, mode, activation source, etc. ioar_0a etcr_0a dmacr_0a mar_0bh mar_0al mar_0bl ioar_0b etcr_0b dmacr_0b
rev. 2.00, 05/03, page 185 of 846 8.3.1 memory address registers (mara and marb) mar is a 32-bit readable/writable register that specifies the source address (transfer source address) or destination address (transfer destination address). mar consists of two 16-bit registers marh and marl. the upper 8 bits of marh are reserved: they are always read as 0, and cannot be modified. the dma has four mar registers: mar_0a in channel 0 (channel 0a), mar_0b in channel 0 (channel 0b), mar_1a in channel 1 (channel 1a), and mar_1b in channel 1 (channel 1b). mar is not initialized by a reset or in standby mode. short address mode: in short address mode, mara and marb operate independently. whether mar functions as the source address register or as the destination address register can be selected by means of the dtdir bit in dmacr. mar is incremented or decremented each time a byte or word transfer is executed, so that the address specified by mar is constantly updated. full address mode: in full address mode, mara functions as the source address register, and marb as the destination address register. mar is incremented or decremented each time a byte or word transfer is executed, so that the source or destination address is constantly updated. 8.3.2 i/o address registers (ioara and ioarb) ioar is a 16-bit readable/writable register that specifies the lower 16 bits of the source address (transfer source address) or destination address (transfer destination address). the upper 8 bits of the transfer address are automatically set to h'ff. the dma has four ioar registers: ioar_0a in channel 0 (channel 0a), ioar_0b in channel 0 (channel 0b), ioar_1a in channel 1 (channel 1a), and ioar_1b in channel 1 (channel 1b). whether ioar functions as the source address register or as the destination address register can be selected by means of the dtdir bit in dmacr. ioar is not incremented or decremented each time a data transfer is executed, so the address specified by ioar is fixed. ioar is not initialized by a reset or in standby mode. ioar can be used in short address mode but not in full address mode.
rev. 2.00, 05/03, page 186 of 846 8.3.3 execute transfer count registers (etcra and etcrb) etcr is a 16-bit readable/writable register that specifies the number of transfers. the dma has four etcr registers: etcr_0a in channel 0 (channel 0a), etcr_0b in channel 0 (channel 0b), etcr_1a in channel 1 (channel 1a), and etcr_1b in channel 1 (channel 1b). etcr is not initialized by a reset or in standby mode. short address mode: the function of etcr in sequential mode and idle mode differs from that in repeat mode. in sequential mode and idle mode, etcr functions as a 16-bit transfer counter. etcr is decremented by 1 each time a transfer is performed, and when the count reaches h'00, the dte bit in dmabcrl is cleared, and transfer ends. in repeat mode, etcrl functions as an 8-bit transfer counter and etcrh functions as a transfer count holding register. etcrl is decremented by 1 each time a transfer is performed, and when the count reaches h'00, etcrl is loaded with the value in etcrh. at this point, mar is automatically restored to the value it had when the count was started. the dte bit in dmabcrl is not cleared, and so transfers can be performed repeatedly until the dte bit is cleared by the user. full address mode: the function of etcr in normal mode differs from that in block transfer mode. in normal mode, etcra functions as a 16-bit transfer counter. etcra is decremented by 1 each time a data transfer is performed, and transfer ends when the count reaches h'0000. etcrb is not used in normal mode. in block transfer mode, etcral functions as an 8-bit block size counter and etcrah functions as a block size holding register. etcral is decremented by 1 each time a 1-byte or 1-word transfer is performed, and when the count reaches h'00, etcral is loaded with the value in etcrah. so by setting the block size in etcrah and etcral, it is possible to repeatedly transfer blocks consisting of any desired number of bytes or words. in block transfer mode, etcrb functions as a 16-bit block transfer counter. etcrb is decremented by 1 each time a block is transferred, and transfer ends when the count reaches h'0000.
rev. 2.00, 05/03, page 187 of 846 8.3.4 dma control registers (dmacra and dmacrb) dmacr controls the operation of each dmac channel. the dma has four dmacr registers: dmacr_0a in channel 0 (channel 0a), dmacr_0b in channel 0 (channel 0b), dmacr_1a in channel 1 (channel 1a), and dmacr_1b in channel 1 (channel 1b). in short address mode, channels a and b operate independently, and in full address mode, channels a and b operate together. the bit functions in the dmacr registers differ according to the transfer mode. short address mode: ? dmacr_0a, dmacr_0b, dmacr_1a, and dmarc_1b bit bit name initial value r/w description 7 dtsz 0 r/w data transfer size selects the size of data to be transferred at one time. 0: byte-size transfer 1: word-size transfer 6 dtid 0 r/w data transfer increment/decrement selects incrementing or decrementing of mar after every data transfer in sequential mode or repeat mode. in idle mode, mar is neither incremented nor decremented. 0: mar is incremented after a data transfer (initial value) ? when dtsz = 0, mar is incremented by 1 ? when dtsz = 1, mar is incremented by 2 1: mar is decremented after a data transfer ? when dtsz = 0, mar is decremented by 1 ? when dtsz = 1, mar is decremented by 2
rev. 2.00, 05/03, page 188 of 846 bit bit name initial value r/w description 5 rpe 0 r/w repeat enable used in combination with the dtie bit in dmabcr to select the mode (sequential, idle, or repeat) in which transfer is to be performed. ? when dtie = 0 (no transfer end interrupt) 0: transfer in sequential mode 1: transfer in repeat mode ? when dtie = 1 (with transfer end interrupt) 0: transfer in sequential mode 1: transfer in idle mode 4 dtdir 0 r/w data transfer direction used in combination with the sae bit in dmabcr to specify the data transfer direction (source or destination). the function of this bit is therefore different in dual address mode and single address mode. ? when sae = 0 0: transfer with mar as source address and ioar as destination address 1: transfer with ioar as source address and mar as destination address ? when sae = 1 0: transfer with mar as source address and dack pin as write strobe 1: transfer with dack pin as read strobe and mar as destination address
rev. 2.00, 05/03, page 189 of 846 bit bit name initial value r/w description 3 2 1 0 dtf3 dtf2 dtf1 dtf0 0 0 0 0 r/w r/w r/w r/w data transfer factor 3 to 0 these bits select the data transfer factor (activation source). there are some differences in activation sources for channel a and channel b. ? channel a 0000: setting prohibited 0001: activated by a/d converter conversion end interrupt 0010: setting prohibited 0011: setting prohibited 0100: activated by sci channel 0 transmit- data-empty interrupt 0101: activated by sci channel 0 receive- data-full interrupt 0110: activated by sci channel 1 transmit- data-empty interrupt 0111: activated by sci channel 1 receive- data-full interrupt 1000: activated by tpu channel 0 compare match/input capture a interrupt 1001: activated by tpu channel 1 compare match/input capture a interrupt 1010: activated by tpu channel 2 compare match/input capture a interrupt 1011: activated by tpu channel 3 compare match/input capture a interrupt 1100: activated by tpu channel 4 compare match/input capture a interrupt 1101: activated by tpu channel 5 compare match/input capture a interrupt 1110: setting prohibited 1111: setting prohibited
rev. 2.00, 05/03, page 190 of 846 bit bit name initial value r/w description 3 2 1 0 dtf3 dtf2 dtf1 dtf0 0 0 0 0 r/w r/w r/w r/w ? channel b 0000: setting prohibited 0001: activated by a/d converter conversion end interrupt 0010: activated by dreq pin falling edge input (detected as a low level in the first transfer after transfer is enabled) 0011: activated by dreq pin low-level input 0100: activated by sci channel 0 transmit- data-empty interrupt 0101: activated by sci channel 0 receive- data-full interrupt 0110: activated by sci channel 1 transmit- data-empty interrupt 0111: activated by sci channel 1 receive- data-full interrupt 1000: activated by tpu channel 0 compare match/input capture a interrupt 1001: activated by tpu channel 1 compare match/input capture a interrupt 1010: activated by tpu channel 2 compare match/input capture a interrupt 1011: activated by tpu channel 3 compare match/input capture a interrupt 1100: activated by tpu channel 4 compare match/input capture a interrupt 1101: activated by tpu channel 5 compare match/input capture a interrupt 1110: setting prohibited 1111: setting prohibited the same factor can be selected for more than one channel. in this case, activation starts with the highest-priority channel according to the relative channel priorities. for relative channel priorities, see section 8.5.11, multi-channel operation.
rev. 2.00, 05/03, page 191 of 846 full address mode: ? dmacr_0a and dmacr_1a bit bit name initial value r/w description 15 dtsz 0 r/w data transfer size selects the size of data to be transferred at one time. 0: byte-size transfer 1: word-size transfer 14 13 said saide 0 0 r/w r/w source address increment/decrement source address increment/decrement enable these bits specify whether source address register mara is to be incremented, decremented, or left unchanged, when data transfer is performed. 00: mara is fixed 01: mara is incremented after a data transfer ? when dtsz = 0, mara is incremented by 1 ? when dtsz = 1, mara is incremented by 2 10: mara is fixed 11: mara is decremented after a data transfer ? when dtsz = 0, mara is decremented by 1 ? when dtsz = 1, mara is decremented by 2 12 11 blkdir blke 0 0 r/w r/w block direction block enable these bits specify whether normal mode or block transfer mode is to be used for data transfer. if block transfer mode is specified, the blkdir bit specifies whether the source side or the destination side is to be the block area. x0: transfer in normal mode 01: transfer in block transfer mode (destination side is block area) 11: transfer in block transfer mode (source side is block area)
rev. 2.00, 05/03, page 192 of 846 bit bit name initial value r/w description 10 to 8 ? all 0 r/w reserved these bits can be read from or written to. however, the write value should always be 0. legend x: don't care ? dmacr_0b and dmacr_1b bit bit name initial value r/w description 7 ? 0r/wreserved this bit can be read from or written to. however, the write value should always be 0. 6 5 daid daide 0 0 r/w r/w destination address increment/decrement destination address increment/decrement enable these bits specify whether destination address register marb is to be incremented, decremented, or left unchanged, when data transfer is performed. 00: marb is fixed 01: marb is incremented after a data transfer ? when dtsz = 0, marb is incremented by 1 ? when dtsz = 1, marb is incremented by 2 10: marb is fixed 11: marb is decremented after a data transfer ? when dtsz = 0, marb is decremented by 1 ? when dtsz = 1, marb is decremented by 2 4? 0 r/wreserved this bit can be read from or written to. however, the write value should always be 0.
rev. 2.00, 05/03, page 193 of 846 bit bit name initial value r/w description 3 2 1 0 dtf3 dtf2 dtf1 dtf0 0 0 0 0 r/w r/w r/w r/w data transfer factor 3 to 0 these bits select the data transfer factor (activation source). the factors that can be specified differ between normal mode and block transfer mode. ? normal mode 0000: setting prohibited 0001: setting prohibited 0010: activated by dreq pin falling edge input (detected as a low level in the first transfer after transfer is enabled) 0011: activated by dreq pin low-level input 010x: setting prohibited 0110: auto-request (cycle steal) 0111: auto-request (burst) 1xxx: setting prohibited
rev. 2.00, 05/03, page 194 of 846 bit bit name initial value r/w description 3 2 1 0 dtf3 dtf2 dtf1 dtf0 0 0 0 0 r/w r/w r/w r/w ? block transfer mode 0000: setting prohibited 0001: activated by a/d converter conversion end interrupt 0010: activated by dreq pin falling edge input 0011: activated by dreq pin low-level input 0100: activated by sci channel 0 transmit- data-empty interrupt 0101: activated by sci channel 0 receive-data- full interrupt 0110: activated by sci channel 1 transmit- data-empty interrupt 0111: activated by sci channel 1 receive-data- full interrupt 1000: activated by tpu channel 0 compare match/input capture a interrupt 1001: activated by tpu channel 1 compare match/input capture a interrupt 1010: activated by tpu channel 2 compare match/input capture a interrupt 1011: activated by tpu channel 3 compare match/input capture a interrupt 1100: activated by tpu channel 4 compare match/input capture a interrupt 1101: activated by tpu channel 5 compare match/input capture a interrupt 1110: setting prohibited 1111: setting prohibited the same factor can be selected for more than one channel. in this case, activation starts with the highest-priority channel according to the relative channel priorities. for relative channel priorities, see section 8.5.11, multi-channel operation. legend x: don't care
rev. 2.00, 05/03, page 195 of 846 8.3.5 dma band control registers h and l (dmabcrh and dmabcrl) dmabcr controls the operation of each dmac channel. the bit functions in the dmacr registers differ according to the transfer mode. short address mode: ? dmabcrh bit bit name initial value r/w description 15 fae1 0 r/w full address enable 1 specifies whether channel 1 is to be used in short address mode or full address mode. in short address mode, channels 1a and 1b can be used as independent channels. 0: short address mode 1: full address mode 14 fae0 0 r/w full address enable 0 specifies whether channel 0 is to be used in short address mode or full address mode. in short address mode, channels 0a and 0b can be used as independent channels. 0: short address mode 1: full address mode 13 sae1 0 r/w single address enable 1 specifies whether channel 1b is to be used for transfer in dual address mode or single address mode. this bit is invalid in full address mode. 0: dual address mode 1: single address mode 12 sae0 0 r/w single address enable 0 specifies whether channel 0b is to be used for transfer in dual address mode or single address mode. this bit is invalid in full address mode. 0: dual address mode 1: single address mode
rev. 2.00, 05/03, page 196 of 846 bit bit name initial value r/w description 11 10 9 8 dta1b dta1a dta0b dta0a 0 0 0 0 r/w r/w r/w r/w data transfer acknowledge 1b data transfer acknowledge 1a data transfer acknowledge 0b data transfer acknowledge 0a these bits enable or disable clearing when dma transfer is performed for the internal interrupt source selected by the dtf3 to dtf0 bits in dmacr. it the dta bit is set to 1 when dte = 1, the internal interrupt source is cleared automatically by dma transfer. when dte = 1 and dta = 1, the internal interrupt source does not issue an interrupt request to the cpu or dtc. if the dta bit is cleared to 0 when dte = 1, the internal interrupt source is not cleared when a transfer is performed, and can issue an interrupt request to the cpu or dtc in parallel. in this case, the interrupt source should be cleared by the cpu or dtc transfer. when dte = 0, the internal interrupt source issues an interrupt request to the cpu or dtc regardless of the dta bit setting. 0: clearing is disabled when dma transfer is performed for the selected internal interrupt source. 1: clearing is enabled when dma transfer is performed for the selected internal interrupt source.
rev. 2.00, 05/03, page 197 of 846 ? dmabcrl bit bit name initial value r/w description 7 6 5 4 dte1b dte1a dte0b dte0a 0 0 0 0 r/w r/w r/w r/w data transfer enable 1b data transfer enable 1a data transfer enable 0b data transfer enable 0a if the dte bit is cleared to 0 when dtie = 1, the dmac regards this as indicating the end of a transfer, and issues a transfer end interrupt request to the cpu or dtc. when dte = 0, data transfer is disabled and the dmac ignores the activation source selected by the dtf3 to dtf0 bits in dmacr. when dte = 1, data transfer is enabled and the dmac waits for a request by the activation source selected by the dtf3 to dtf0 bits in dmacr. when a request is issued by the activation source, dma transfer is executed. 0: data transfer is disabled. 1: data transfer is enabled. [clearing conditions] ? when initialization is performed ? when the specified number of transfers have been completed in a transfer mode other than repeat mode ? when 0 is written to the dte bit to forcibly suspend the transfer, or for a similar reason [setting condition] when 1 is written to the dte bit after reading dte = 0
rev. 2.00, 05/03, page 198 of 846 bit bit name initial value r/w description 3 2 1 0 dtie1b dtie1a dtie0b dtie0a 0 0 0 0 r/w r/w r/w r/w data transfer end interrupt enable 1b data transfer end interrupt enable 1a data transfer end interrupt enable 0b data transfer end interrupt enable 0a these bits enable or disable an interrupt to the cpu or dtc when transfer ends. if the dtie bit is set to 1 when dte = 0, the dmac regards this as indicating the end of a transfer, and issues a transfer end interrupt request to the cpu or dtc. a transfer end interrupt can be canceled either by clearing the dtie bit to 0 in the interrupt handling routine, or by performing processing to continue transfer by setting the transfer counter and address register again, and then setting the dte bit to 1. 0: transfer end interrupt is disabled. 1: transfer end interrupt is enabled. full address mode: ? dmabcrh bit bit name initial value r/w description 15 fae1 0 r/w full address enable 1 specifies whether channel 1 is to be used in short address mode or full address mode. in full address mode, channels 1a and 1b are used together as channel 1. 0: short address mode 1: full address mode 14 fae0 0 r/w full address enable 0 specifies whether channel 0 is to be used in short address mode or full address mode. in full address mode, channels 0a and 0b are used together as channel 0. 0: short address mode 1: full address mode 13 12 ? ? 0 0 r/w r/w reserved these bits can be read from or written to. however, the write value should always be 0.
rev. 2.00, 05/03, page 199 of 846 bit bit name initial value r/w description 11 dta1 0 r/w data transfer acknowledge 1 these bits enable or disable clearing when dma transfer is performed for the internal interrupt source selected by the dtf3 to dtf0 bits in dmacr of channel 1. it the dta1 bit is set to 1 when dte1 = 1, the internal interrupt source is cleared automatically by dma transfer. when dte1 = 1 and dta1 = 1, the internal interrupt source does not issue an interrupt request to the cpu or dtc. it the dta1 bit is cleared to 0 when dte1 = 1, the internal interrupt source is not cleared when a transfer is performed, and can issue an interrupt request to the cpu or dtc in parallel. in this case, the interrupt source should be cleared by the cpu or dtc transfer. when dte1 = 0, the internal interrupt source issues an interrupt request to the cpu or dtc regardless of the dta1 bit setting. the state of the dtme1 bit does not affect the above operations. 0: clearing is disabled when dma transfer is performed for the selected internal interrupt source. 1: clearing is enabled when dma transfer is performed for the selected internal interrupt source. 10 ? 0 r/w reserved this bit can be read from or written to. however, the write value should always be 0.
rev. 2.00, 05/03, page 200 of 846 bit bit name initial value r/w description 9 dta0 0 r/w data transfer acknowledge 0 these bits enable or disable clearing when dma transfer is performed for the internal interrupt source selected by the dtf3 to dtf0 bits in dmacr of channel 0. it the dta0 bit is set to 1 when dte0 = 1, the internal interrupt source is cleared automatically by dma transfer. when dte0 = 1 and dta0 = 1, the internal interrupt source does not issue an interrupt request to the cpu or dtc. it the dta0 bit is cleared to 0 when dte0 = 1, the internal interrupt source is not cleared when a transfer is performed, and can issue an interrupt request to the cpu or dtc in parallel. in this case, the interrupt source should be cleared by the cpu or dtc transfer. when dte0 = 0, the internal interrupt source issues an interrupt request to the cpu or dtc regardless of the dta0 bit setting. the state of the dtme0 bit does not affect the above operations. 0: clearing is disabled when dma transfer is performed for the selected internal interrupt source. 1: clearing is enabled when dma transfer is performed for the selected internal interrupt source. 8? 0 r/wreserved this bit can be read from or written to. however, the write value should always be 0.
rev. 2.00, 05/03, page 201 of 846 ? dmabcrl bit bit name initial value r/w description 7 dtme1 0 r/w data transfer master enable 1 together with the dte1 bit, this bit controls enabling or disabling of data transfer on channel 1. when both the dtme1 bit and dte1 bit are set to 1, transfer is enabled for channel 1. if channel 1 is in the middle of a burst mode transfer when an nmi interrupt is generated, the dtme1 bit is cleared, the transfer is interrupted, and bus mastership passes to the cpu. when the dtme1 bit is subsequently set to 1 again, the interrupted transfer is resumed. in block transfer mode, however, the dtme1 bit is not cleared by an nmi interrupt, and transfer is not interrupted. 0: data transfer is disabled. 1: data transfer is enabled. [clearing conditions] ? when initialization is performed ? when nmi is input in burst mode ? when 0 is written to the dtme1 bit [setting condition] when 1 is written to dtme1 after reading dtme1 = 0
rev. 2.00, 05/03, page 202 of 846 bit bit name initial value r/w description 6 dte1 0 r/w data transfer enable 1 enables or disables dma transfer for the activation source selected by the dtf3 to dtf0 bits in dmacr of channel 1. when dte1 = 0, data transfer is disabled and the activation source is ignored. if the activation source is an internal interrupt, an interrupt request is issued to the cpu or dtc. if the dte1 bit is cleared to 0 when dtie1 = 1, the dmac regards this as indicating the end of a transfer, and issues a transfer end interrupt request to the cpu. when dte1 = 1 and dtme1 = 1, data transfer is enabled and the dmac waits for a request by the activation source. when a request is issued by the activation source, dma transfer is executed. 0: data transfer is disabled. 1: data transfer is enabled. [clearing conditions] ? when initialization is performed ? when the specified number of transfers have been completed ? when 0 is written to the dte1 bit to forcibly suspend the transfer, or for a similar reason [setting condition] when 1 is written to the dte1 bit after reading dte1 = 0
rev. 2.00, 05/03, page 203 of 846 bit bit name initial value r/w description 5 dtme0 0 r/w data transfer master enable 0 together with the dte0 bit, this bit controls enabling or disabling of data transfer on channel 0. when both the dtme0 bit and dte0 bit are set to 1, transfer is enabled for channel 0. if channel 0 is in the middle of a burst mode transfer when an nmi interrupt is generated, the dtme0 bit is cleared, the transfer is interrupted, and bus mastership passes to the cpu. when the dtme0 bit is subsequently set to 1 again, the interrupted transfer is resumed. in block transfer mode, however, the dtme0 bit is not cleared by an nmi interrupt, and transfer is not interrupted. 0: data transfer is disabled. 1: data transfer is enabled. [clearing conditions] ? when initialization is performed ? when nmi is input in burst mode ? when 0 is written to the dtme0 bit [setting condition] when 1 is written to dtme0 after reading dtme0 = 0
rev. 2.00, 05/03, page 204 of 846 bit bit name initial value r/w description 4 dte0 0 r/w data transfer enable 0 enables or disables dma transfer for the activation source selected by the dtf3 to dtf0 bits in dmacr of channel 0. when dte0 = 0, data transfer is disabled and the activation source is ignored. if the activation source is an internal interrupt, an interrupt request is issued to the cpu or dtc. if the dte0 bit is cleared to 0 when dtie0 = 1, the dmac regards this as indicating the end of a transfer, and issues a transfer end interrupt request to the cpu. when dte0 = 1 and dtme0 = 1, data transfer is enabled and the dmac waits for a request by the activation source. when a request is issued by the activation source, dma transfer is executed. 0: data transfer is disabled. 1: data transfer is enabled. [clearing conditions] ? when initialization is performed ? when the specified number of transfers have been completed ? when 0 is written to the dte0 bit to forcibly suspend the transfer, or for a similar reason [setting condition] when 1 is written to the dte0 bit after reading dte0 = 0 3 dtie1b 0 r/w data transfer interrupt enable 1b enables or disables an interrupt to the cpu or dtc when transfer on channel 1 is interrupted. if the dtme1 bit is cleared to 0 when dtie1b = 1, the dmac regards this as indicating a break in the transfer, and issues a transfer break interrupt request to the cpu or dtc. a transfer break interrupt can be canceled either by clearing the dtie1b bit to 0 in the interrupt handling routine, or by performing processing to continue transfer by setting the dtme1 bit to 1. 0: data transfer is disabled. 1: data transfer is enabled.
rev. 2.00, 05/03, page 205 of 846 bit bit name initial value r/w description 2 dtie1a 0 r/w data transfer end interrupt enable 1a enables or disables an interrupt to the cpu or dtc when transfer ends. if the dte1 bit is cleared to 1 when dtie1a = 1, the dmac regards this as indicating the end of a transfer, and issues a transfer end interrupt request to the cpu or dtc. a transfer end interrupt can be canceled either by clearing the dtie1a bit to 0 in the interrupt handling routine, or by performing processing to continue transfer by setting the transfer counter and address register again, and then setting the dte1 bit to 1. 0: data transfer is disabled. 1: data transfer is enabled. 1 dtie0b 0 r/w data transfer interrupt enable 0b enables or disables an interrupt to the cpu or dtc when transfer on channel 1 is interrupted. if the dtme0 bit is cleared to 0 when dtie0b = 1, the dmac regards this as indicating a break in the transfer, and issues a transfer break interrupt request to the cpu or dtc. a transfer break interrupt can be canceled either by clearing the dtie0b bit to 0 in the interrupt handling routine, or by performing processing to continue transfer by setting the dtme0 bit to 1. 0: data transfer is disabled. 1: data transfer is enabled. 0 dtie0a 0 r/w data transfer end interrupt enable 0a enables or disables an interrupt to the cpu or dtc when transfer ends. if the dte0 bit is cleared to 0 when dtie0a = 1, the dmac regards this as indicating the end of a transfer, and issues a transfer end interrupt request to the cpu or dtc. a transfer end interrupt can be canceled either by clearing the dtie0a bit to 0 in the interrupt handling routine, or by performing processing to continue transfer by setting the transfer counter and address register again, and then setting the dte0 bit to 1. 0: data transfer is disabled. 1: data transfer is enabled.
rev. 2.00, 05/03, page 206 of 846 8.3.6 dma write enable register (dmawer) the dmac can activate the dtc with a transfer end interrupt, rewrite the channel on which the transfer ended using a dtc chain transfer, and then reactivate the dtc. dmawer applies restrictions for changing all bits of dmacr, and specific bits for dmatcr and dmabcr for the specific channel, to prevent inadvertent rewriting of registers other than those for the channel concerned. the restrictions applied by dmawer are valid for the dtc. bit bit name initial value r/w description 7 to 4 ? all 0 ? reserved these bits are always read as 0 and cannot be modified. 3 we1b 0 r/w write enable 1b enables or disables writes to all bits in dmacr1b, bits 11, 7, and 3 in dmabcr, and bit 5 in dmatcr. 0: writes are disabled 1: writes are enabled 2 we1a 0 r/w write enable 1a enables or disables writes to all bits in dmacr1a, and bits 10, 6, and 2 in dmabcr. 0: writes are disabled 1: writes are enabled 1 we0b 0 r/w write enable 0b enables or disables writes to all bits in dmacr0b, bits 9, 5, and 1 in dmabcr, and bit 4 in dmatcr. 0: writes are disabled 1: writes are enabled 0 we0a 0 r/w write enable 0a enables or disables writes to all bits in dmacr0a, and bits 8, 4, and 0 in dmabcr. 0: writes are disabled 1: writes are enabled
rev. 2.00, 05/03, page 207 of 846 figure 8.2 shows the transfer areas for activating the dtc with a channel 0a transfer end interrupt request, and reactivating channel 0a. the address register and count register areas are set again during the first dtc transfer, then the control register area is set again during the second dtc chain transfer. when re-setting the control register area, perform masking by setting bits in dmawer to prevent modification of the contents of other channels. dtc mar_0a ioar_0a etcr_0a mar_0b ioar_0b etcr_0b mar_1a ioar_1a etcr_1a mar_1b ioar_1b etcr_1b dmatcr dmacr_0b dmacr_1b dmawer dmacr_0a dmacr_1a dmabcr second transfer area using chain transfer first transfer area figure 8.2 areas for register re-setting by dtc (channel 0a) writes by the dtc to bits 15 to 12 (fae and sae) in dmabcr are invalid regardless of the dmawer settings. these bits should be changed, if necessary, by cpu processing. in writes by the dtc to bits 7 to 4 (dte) in dmabcr, 1 can be written without first reading 0. to reactivate a channel set to full address mode, write 1 to both write enable a and write enable b for the channel to be reactivated. mar, ioar, and etcr can always be written to regardless of the dmawer settings. when modifying these registers, the channel to be modified should be halted.
rev. 2.00, 05/03, page 208 of 846 8.3.7 dma terminal control register (dmatcr) dmatcr controls enabling or disabling of output from the dmac transfer end pin. a port can be set for output automatically, and a transfer end signal output, by setting the appropriate bit. the tend pin is available only for channel b in short address mode. except for the block transfer mode, a transfer end signal asserts in the transfer cycle in which the transfer counter contents reaches 0 regardless of the activation source. in the block transfer mode, a transfer end signal asserts in the transfer cycle in which the block counter contents reaches 0. bit bit name initial value r/w description 7 6 ? ? 0 0 ? ? reserved these bits are always read as 0 and cannot be modified. 5 tee1 0 r/w transfer end enable 1 enables or disables transfer end pin 1 ( tend1 ) output. 0: tend1 pin output disabled 1: tend1 pin output enabled 4 tee0 0 r/w transfer end enable 0 enables or disables transfer end pin 0 ( tend0 ) output. 0: tend0 pin output disabled 1: tend0 pin output enabled 3 to 0 ? all 0 ? reserved these bits are always read as 0 and cannot be modified.
rev. 2.00, 05/03, page 209 of 846 8.4 activation sources dmac activation sources consist of internal interrupt requests, external requests, and auto- requests. the dmac activation sources that can be specified depend on the transfer mode and channel, as shown in table 8.3. table 8.3 dmac activation sources short address mode full address mode activation source channels 0a and 1a channels 0b and 1b normal mode block transfer mode adi o o x o txi0 o o x o rxi0 o o x o txi1 o o x o rxi1 o o x o tgi0a o o x o tgi1a o o x o tgi2a o o x o tgi3a o o x o tgi4a o o x o internal interrupts tgi5a o o x o dreq pin falling edge input x o o o external requests dreq pin low-level input x o o o auto-request x x o x legend o: can be specified x: cannot be specified 8.4.1 activation by internal interrupt request an interrupt request selected as a dmac activation source can also simultaneously generate an interrupt request for the cpu or dtc. for details, see section 5, interrupt controller. with activation by an internal interrupt request, the dmac accepts the interrupt request independently of the interrupt controller. consequently, interrupt controller priority settings are irrelevant.
rev. 2.00, 05/03, page 210 of 846 if the dmac is activated by a cpu interrupt source or an interrupt request that is not used as a dtc activation source (dta = 1), the interrupt request flag is cleared automatically by the dma transfer. with adi, txi, and rxi interrupts, however, the interrupt source flag is not cleared unless the relevant register is accessed in a dma transfer. if the same interrupt is used as an activation source for more than one channel, the interrupt request flag is cleared when the highest- priority channel is activated. transfer requests for other channels are held pending in the dmac, and activation is carried out in order of priority. when dte = 0 after completion of a transfer, an interrupt request from the selected activation source is not sent to the dmac, regardless of the dta bit setting. in this case, the relevant interrupt request is sent to the cpu or dtc. when an interrupt request signal for dmac activation is also used for an interrupt request to the cpu or dtc activation (dta = 0), the interrupt request flag is not cleared by the dmac. 8.4.2 activation by external request if an external request ( dreq pin) is specified as a dmac activation source, the relevant port should be set to input mode in advance. level sensing or edge sensing can be used for external requests. external request operation in normal mode of short address mode or full address mode is described below. when edge sensing is selected, a byte or word is transferred each time a high-to-low transition is detected on the dreq pin. the next data transfer may not be performed if the next edge is input before data transfer is completed. when level sensing is selected, the dmac stands by for a transfer request while the dreq pin is held high. while the dreq pin is held low, transfers continue in succession, with the bus being released each time a byte or word is transferred. if the dreq pin goes high in the middle of a transfer, the transfer is interrupted and the dmac stands by for a transfer request. 8.4.3 activation by auto-request auto-request is activated by register setting only, and transfer continues to the end. with auto- request activation, cycle steal mode or burst mode can be selected. in cycle steal mode, the dmac releases the bus to another bus master each time a byte or word is transferred. dma and cpu cycles are usually repeated alternately. in burst mode, the dmac keeps possession of the bus until the end of the transfer so that transfer is performed continuously.
rev. 2.00, 05/03, page 211 of 846 8.5 operation 8.5.1 transfer modes table 8.4 lists the dmac transfer modes. table 8.4 dmac transfer modes transfer mode transfer source remarks short address mode dual address mode ? 1-byte or 1-word transfer for a single transfer request ? specify source and destination addresses to transfer data in two bus cycles. (1) sequential mode ? memory address incremented or decremented by 1 or 2 ? number of transfers: 1 to 65,536 (2) idle mode ? memory address fixed ? number of transfers: 1 to 65,536 (3) repeat mode ? memory address incremented or decremented by 1 or 2 ? continues transfer after sending number of transfers (1 to 256) and restoring the initial value ? tpu channel 0 to 5 compare match/input capture a interrupt ? sci transmit-data- empty interrupt ? sci receive-data-full interrupt ? a/d converter conversion end interrupt ? external request ? up to 4 channels can operate independently ? external request applies to channel b only ? single address mode applies to channel b only
rev. 2.00, 05/03, page 212 of 846 transfer mode transfer source remarks short address mode single address mode ? 1-byte or 1-word transfer for a single transfer request ? 1-bus cycle transfer by means of dack pin instead of using address for specifying i/o ? sequential mode, idle mode, or repeat mode can be specified ? external request normal mode (1) auto-request ? transfer request is internally held ? number of transfers (1 to 65,536) is continuously sent ? burst/cycle steal transfer can be selected ? auto-request full address mode (2) external request ? 1-byte or 1-word transfer for a single transfer request ? number of transfers: 1 to 65,536 ? external request ? max. 2-channel operation, combining channels a and b block transfer mode ? transfer of 1-block, size selected for a single transfer request ? number of transfers: 1 to 65,536 ? source or destination can be selected as block area ? block size: 1 to 256 bytes or word ? tpu channel 0 to 5 compare match/input capture a interrupt ? sci transmit-data- empty interrupt ? sci receive-data-full interrupt ? a/d converter conversion end interrupt ? external request
rev. 2.00, 05/03, page 213 of 846 8.5.2 sequential mode sequential mode can be specified by clearing the rpe bit in dmacr to 0. in sequential mode, mar is updated after each byte or word transfer in response to a single transfer request, and this is executed the number of times specified in etcr. one address is specified by mar, and the other by ioar. the transfer direction can be specified by the dtdir bit in dmacr. table 8.5 summarizes register functions in sequential mode. table 8.5 register functions in sequential mode function register dtdir = 0 dtdir = 1 initial setting operation 23 0 mar source address register destination address register start address of transfer destination or transfer source incremented/ decremented every transfer 23 0 ioar 15 h ? ff destination address register source address register start address of transfer source or transfer destination fixed 0 etcr 15 transfer counter number of transfers decremented every transfer; transfer ends when count reaches h'0000 mar specifies the start address of the transfer source or transfer destination as 24 bits. mar is incremented or decremented by 1 or 2 each time a byte or word is transferred. ioar specifies the lower 16 bits of the other address. the 8 bits above ioar have a value of h'ff. figure 8.3 illustrates operation in sequential mode.
rev. 2.00, 05/03, page 214 of 846 address t address b transfer ioar 1 byte or word transfer performed in response to 1 transfer request legend address t = l address b = l + ( 1) dtid (2 dtsz (n 1)) where : l = value set in mar n = value set in etcr figure 8.3 operation in sequential mode the number of transfers is specified as 16 bits in etcr. etcr is decremented by 1 each time a data transfer is executed, and when its value reaches h'0000, the dte bit is cleared and data transfer ends. if the dtie bit is set to 1 at this time, an interrupt request is sent to the cpu or dtc. the maximum number of transfers, when h'0000 is set in etcr, is 65,536. transfer requests (activation sources) consist of a/d converter conversion end interrupts, external requests, sci transmit-data-empty and receive-data-full interrupts, and tpu channel 0 to 5 compare match/input capture a interrupts. external requests can only be specified for channel b. figure 8.4 shows an example of the setting procedure for sequential mode.
rev. 2.00, 05/03, page 215 of 846 sequential mode setting set dmabcrh set transfer source and transfer destination addresses set number of transfers set dmacr read dmabcrl set dmabcrl sequential mode [1] [2] [3] [4] [5] [6] [1] set each bit in dmabcrh. clear the fae bit to 0 to select short address mode. specify enabling or disabling of internal interrupt clearing with the dta bit. [2] set the transfer source address and transfer destination address in mar and ioar. [3] set the number of transfers in etcr. [4] set each bit in dmacr. set the transfer data size with the dtsz bit. specify whether mar is to be incremented or decremented with the dtid bit. clear the rpe bit to 0 to select sequential mode. specify the transfer direction with the dtdir bit. select the activation source with bits dtf3 to dtf0. [5] read the dte bit in dmabcrl as 0. [6] set each bit in dmabcrl. specify enabling or disabling of transfer end interrupts with the dtie bit. set the dte bit to 1 to enable transfer. figure 8.4 example of sequential mode setting procedure
rev. 2.00, 05/03, page 216 of 846 8.5.3 idle mode idle mode can be specified by setting the rpe bit in dmacr and dtie bit in dmabcrl to 1. in idle mode, one byte or word is transferred in response to a single transfer request, and this is executed the number of times specified in etcr. one address is specified by mar, and the other by ioar. the transfer direction can be specified by the dtdir bit in dmacr. table 8.6 summarizes register functions in idle mode. table 8.6 register functions in idle mode function register dtdir = 0 dtdir = 1 initial setting operation 23 0 mar source address register destination address register start address of transfer destination or transfer source fixed 23 0 ioar 15 h ? ff destination address register source address register start address of transfer source or transfer destination fixed 0 etcr 15 transfer counter number of transfers decremented every transfer; transfer ends when count reaches h'0000 mar specifies the start address of the transfer source or transfer destination as 24 bits. mar is neither incremented nor decremented by a data transfer. ioar specifies the lower 16 bits of the other address. the upper 8 bits of ioar have a value of h'ff. figure 8.5 illustrates operation in idle mode. transfer ioar 1 byte or word transfer performed in response to 1 transfer request mar figure 8.5 operation in idle mode the number of transfers is specified as 16 bits in etcr. etcr is decremented by 1 each time a transfer is executed, and when its value reaches h'0000, the dte bit is cleared and data transfer ends. if the dtie bit is set to 1 at this time, an interrupt request is sent to the cpu or dtc. the maximum number of transfers, when h'0000 is set in etcr, is 65,536.
rev. 2.00, 05/03, page 217 of 846 transfer requests (activation sources) consist of a/d converter conversion end interrupts, external requests, sci transmit-data-empty and receive-data-full interrupts, and tpu channel 0 to 5 compare match/input capture a interrupts. external requests can only be specified for channel b. figure 8.6 shows an example of the setting procedure for idle mode. idle mode setting set dmabcrh set transfer source and transfer destination addresses set number of transfers set dmacr read dmabcrl set dmabcrl idle mode [1] [2] [3] [4] [5] [6] [1] set each bit in dmabcrh. clear the fae bit to 0 to select short address mode. specify enabling or disabling of internal interrupt clearing with the dta bit. [2] set the transfer source address and transfer destination address in mar and ioar. [3] set the number of transfers in etcr. [4] set each bit in dmacr. set the transfer data size with the dtsz bit. specify whether mar is to be incremented or decremented with the dtid bit. set the rpe bit to 1. specify the transfer direction with the dtdir bit. select the activation source with bits dtf3 to dtf0. [5] read the dte bit in dmabcrl as 0. [6] set each bit in dmabcrl. set the dtie bit to 1. set the dte bit to 1 to enable transfer. figure 8.6 example of idle mode setting procedure
rev. 2.00, 05/03, page 218 of 846 8.5.4 repeat mode repeat mode can be specified by setting the rpe bit in dmacr to 1, and clearing the dtie bit in dmabcrl to 0. in repeat mode, mar is updated after each byte or word transfer in response to a single transfer request, and this is executed the number of times specified in etcrl. on completion of the specified number of transfers, mar and etcrl are automatically restored to their original settings and operation continues. one address is specified by mar, and the other by ioar. the transfer direction can be specified by the dtdir bit in dmacr. table 8.7 summarizes register functions in repeat mode. table 8.7 register functions in repeat mode function register dtdir = 0 dtdir = 1 initial setting operation 23 0 mar source address register destination address register start address of transfer destination or transfer source incremented/ decremented every transfer. initial setting is restored when value reaches h'0000 23 0 ioar 15 h'ff destination address register source address register start address of transfer source or transfer destination fixed 0 etcrh 7 holds number of transfers number of transfers fixed 0 etcrl 7 transfer counter number of transfers decremented every transfer. loaded with etcrh value when count reaches h'00
rev. 2.00, 05/03, page 219 of 846 mar specifies the start address of the transfer source or transfer destination as 24 bits. mar is incremented or decremented by 1 or 2 each time a byte or word is transferred. ioar specifies the lower 16 bits of the other address. the upper 8 bits of ioar have a value of h'ff. the number of transfers is specified as 8 bits by etcrh and etcrl. the maximum number of transfers, when h'00 is set in both etcrh and etcrl, is 256. in repeat mode, etcrl functions as the transfer counter, and etcrh is used to hold the number of transfers. etcrl is decremented by 1 each time a data transfer is executed, and when its value reaches h'00, it is loaded with the value in etcrh. at the same time, the value set in mar is restored in accordance with the values of the dtsz and dtid bits in dmacr. the mar restoration operation is as shown below. mar = mar ? (?1) dtid 2 dtsz etcrh the same value should be set in etcrh and etcrl. in repeat mode, operation continues until the dte bit in dmabcrl is cleared. to end the transfer operation, therefore, the dte bit should be cleared to 0. a transfer end interrupt request is not sent to the cpu or dtc. by setting the dte bit to 1 again after it has been cleared, the operation can be restarted from the transfer after that terminated when the dte bit was cleared. figure 8.7 illustrates operation in repeat mode.
rev. 2.00, 05/03, page 220 of 846 address t address b transfer ioa r 1 byte or word transfer performed in response to 1 transfer request legend address t = l address b = l + ( 1) dtid (2 dtsz (n 1)) where : l = value set in mar n = value set in etcr figure 8.7 operation in repeat mode transfer requests (activation sources) consist of a/d converter conversion end interrupts, external requests, sci transmit-data-empty and receive-data-full interrupts, and tpu channel 0 to 5 compare match/input capture a interrupts. external requests can only be specified for channel b. figure 8.8 shows an example of the setting procedure for repeat mode.
rev. 2.00, 05/03, page 221 of 846 repeat mode setting set dmabcrh set transfer source and transfer destination addresses set number of transfers set dmacr read dmabcrl set dmabcrl repeat mode [1] [2] [3] [4] [5] [6] [1] set each bit in dmabcrh. clear the fae bit to 0 to select short address mode. specify enabling or disabling of internal interrupt clearing with the dta bit. [2] set the transfer source address and transfer destination address in mar and ioar. [3] set the number of transfers in both etcrh and etcrl. [4] set each bit in dmacr. set the transfer data size with the dtsz bit. specify whether mar is to be incremented or decremented with the dtid bit. set the rpe bit to 1. specify the transfer direction with the dtdir bit. select the activation source with bits dtf3 to dtf0. [5] read the dte bit in dmabcrl as 0. [6] set each bit in dmabcrl. clear the dtie bit to 0. set the dte bit to 1 to enable transfer. figure 8.8 example of repeat mode setting procedure
rev. 2.00, 05/03, page 222 of 846 8.5.5 single address mode dmac supports the dual address mode, in which two different cycles are used for reading and writing, and the single address mode, in which a single cycle is used for both reading and writing. in dual address mode, the source address and the destination address are specified respectively for transferring data. in single address mode, data is transferred between the external space, in which the transfer source or transfer destination is specified by the address, and the external device that is selected by dack strobe regardless of the address. figure 8.9 shows the data bus in single address mode. rd hwr , lwr a23 to a0 address bus external memory external device (write) (read) data bus d15 to d0 (high impedance) this lsi dack figure 8.9 data bus in single address mode
rev. 2.00, 05/03, page 223 of 846 when the data bus is used for reading in single address mode, data is transferred from the external memory to the external device and the dack pin functions as the write strobe for the external device. when the data bus is used for writing in single address mode, data is transferred from the external device to the external memory and the dack pin functions as the read strobe for the external device. since the direction for the external device cannot be controlled, chose one of directions described above. the setting of the bus controller for the external memory area controls the bus cycle in single address mode. to the external device, dack is output in synchronization with the address strobe. for details on the bus cycle, see section 8.5.10, dma transfer (single address mode) bus cycles. in single address mode, do not specify the internal area for the transfer address. single address mode can only be specified for channel b. this mode can be specified by setting the sae bit in dmabcrh to 1 in short address mode. one address is specified by mar, and the other is set automatically to the data transfer acknowledge pin ( dack ). the transfer direction can be specified by the dtdir bit in dmacr. table 8.8 summarizes register functions in single address mode. table 8.8 register functions in single address mode function register dtdir = 0 dtdir = 1 initial setting operation 23 0 mar source address register destination address register start address of transfer destination or transfer source see sections 8.5.2, sequential mode, 8.5.3, idle mode, and 8.5.4, repeat mode. dack pin write strobe read strobe (set automatically by sae bit; ioar is invalid) strobe for external device 0 etcr 15 transfer counter number of transfers see sections 8.5.2, sequential mode, 8.5.3, idle mode, and 8.5.4, repeat mode. mar specifies the start address of the transfer source or transfer destination as 24 bits. ioar is invalid; in its place the strobe for external devices ( dack ) is output.
rev. 2.00, 05/03, page 224 of 846 figure 8.10 illustrates operation in single address mode (when sequential mode is specified). address t address b transfer dac k 1 byte or word transfer performed in response to 1 transfer request legend address t = l address b = l + ( 1) dtid (2 dtsz (n 1)) where : l = value set in mar n = value set in etcr figure 8.10 operation in single address mode (when sequential mode is specified) figure 8.11 shows an example of the setting procedure for single address mode (when sequential mode is specified).
rev. 2.00, 05/03, page 225 of 846 single address mode setting set dmabcrh set transfer source and transfer destination addresses set number of transfers set dmacr read dmabcrl set dmabcrl single address mode [1] [2] [3] [4] [5] [6] [1] set each bit in dmabcrh. clear the fae bit to 0 to select short address mode. set the sae bit to 1 to select single address mode. specify enabling or disabling of internal interrupt clearing with the dta bit. [2] set the transfer source address/transfer destination address in mar. [3] set the number of transfers in etcr. [4] set each bit in dmacr. set the transfer data size with the dtsz bit. specify whether mar is to be incremented or decremented with the dtid bit. clear the rpe bit to 0 to select sequential mode. specify the transfer direction with the dtdir bit. select the activation source with bits dtf3 to dtf0. [5] read the dte bit in dmabcrl as 0. [6] set each bit in dmabcrl. specify enabling or disabling of transfer end interrupts with the dtie bit. set the dte bit to 1 to enable transfer. figure 8.11 example of single address mode setting procedure (when sequential mode is specified)
rev. 2.00, 05/03, page 226 of 846 8.5.6 normal mode in normal mode, transfer is performed with channels a and b used in combination. normal mode can be specified by setting the fae bit in dmabcrh to 1 and clearing the blke bit in dmacra to 0. in normal mode, mar is updated after data transfer of a byte or word in response to a single transfer request, and this is executed the number of times specified in etcra. the transfer source is specified by mara, and the transfer destination by marb. table 8.9 summarizes register functions in normal mode. table 8.9 register functions in normal mode register function initial setting operation 23 0 mara source address register start address of transfer source incremented/decremented every transfer, or fixed 23 0 marb destination address register start address of transfer destination incremented/decremented every transfer, or fixed 0 etcra 15 transfer counter number of transfers decremented every transfer; transfer ends when count reaches h'0000 mara and marb specify the start addresses of the transfer source and transfer destination, respectively, as 24 bits. mar can be incremented or decremented by 1 or 2 each time a byte or word is transferred, or can be fixed. incrementing, decrementing, or holding a fixed value can be set separately for mara and marb. the number of transfers is specified by etcra as 16 bits. etcra is decremented by 1 each time a transfer is performed, and when its value reaches h'0000 the dte bit in dmabcrl is cleared and transfer ends. if the dtie bit in dmabcrl is set to 1 at this time, an interrupt request is sent to the cpu or dtc. the maximum number of transfers, when h'0000 is set in etcra, is 65,536. figure 8.12 illustrates operation in normal mode.
rev. 2.00, 05/03, page 227 of 846 address t a address b a transfer address t b legend address address address address where : address b b = l a = l b = l a + saide ( 1) said (2 dtsz (n 1)) = l b + daide ( 1) daid (2 dtsz (n 1)) = value set in mara = value set in marb = value set in etcra t a t b b a b b l a l b n figure 8.12 operation in normal mode transfer requests (activation sources) are external requests and auto-requests. with auto-request, the dmac is only activated by register setting, and the specified number of transfers are performed automatically. with auto-request, cycle steal mode or burst mode can be selected. in cycle steal mode, the bus is released to another bus master each time a transfer is performed. in burst mode, the bus is held continuously until transfer ends. figure 8.13 shows an example of the setting procedure for normal mode.
rev. 2.00, 05/03, page 228 of 846 normal mode setting set dmabcrh set transfer source and transfer destination addresses set number of transfers set dmacr read dmabcrl set dmabcrl normal mode [1] [2] [3] [4] [5] [6] [1] set each bit in dmabcrh. set the fae bit to 1 to select full address mode. specify enabling or disabling of internal interrupt clearing with the dta bit. [2] set the transfer source address in mara, and the transfer destination address in marb. [3] set the number of transfers in etcra. [4] set each bit in dmacra and dmacrb. set the transfer data size with the dtsz bit. specify whether mara is to be incremented, decremented, or fixed, with the said and saide bits. clear the blke bit to 0 to select normal mode. specify whether marb is to be incremented, decremented, or fixed, with the daid and daide bits. select the activation source with bits dtf3 to dtf0. [5] read dte = 0 and dtme = 0 in dmabcrl. [6] set each bit in dmabcrl. specify enabling or disabling of transfer end interrupts with the dtie bit. set both the dtme bit and the dte bit to 1 to enable transfer. figure 8.13 example of normal mode setting procedure
rev. 2.00, 05/03, page 229 of 846 8.5.7 block transfer mode in block transfer mode, data transfer is performed with channels a and b used in combination. block transfer mode can be specified by setting the fae bit in dmabcrh and the blke bit in dmacra to 1. in block transfer mode, a data transfer of the specified block size is carried out in response to a single transfer request, and this is executed for the number of times specified in etcrb. the transfer source is specified by mara, and the transfer destination by marb. either the transfer source or the transfer destination can be selected as a block area (an area composed of a number of bytes or words). table 8.10 summarizes register functions in block transfer mode. table 8.10 register functions in block transfer mode register function initial setting operation 23 0 mara source address register start address of transfer source incremented/decremented every transfer, or fixed 23 0 marb destination address register start address of transfer destination incremented/decremented every transfer, or fixed 0 etcrah 7 holds block size block size fixed 0 etcral 7 block size counter block size decremented every transfer; etcrh value copied when count reaches h'00 15 0 etcrb block transfer counter number of block transfers decremented every block transfer; transfer ends when count reaches h'0000 mara and marb specify the start addresses of the transfer source and transfer destination, respectively, as 24 bits. mar can be incremented or decremented by 1 or 2 each time a byte or word is transferred, or can be fixed. incrementing, decrementing, or holding a fixed value can be set separately for mara and marb. whether a block is to be designated for mara or for marb is specified by the blkdir bit in dmacra. to specify the number of transfers, if m is the size of one block (where m = 1 to 256) and n transfers are to be performed (where n = 1 to 65,536), m is set in both etcrah and etcral, and n in etcrb. figure 8.14 illustrates operation in block transfer mode when marb is designated as a block area.
rev. 2.00, 05/03, page 230 of 846 address t a address b a transfer address t b address b b 1st block 2nd block nth block block area consecutive transfer of m bytes or words is performed in response to one request legend address address address address where : = l a = l b = l a + saide ( 1)said (2dtsz (m n 1)) = l b + daide ( 1)daid (2dtsz (n 1)) = value set in mara = value set in marb = value set in etcrb = value set in etcrah and etcral t a t b b a b b l a l b n m figure 8.14 operation in block transfer mode (blkdir = 0) figure 8.15 illustrates operation in block transfer mode when mara is designated as a block area.
rev. 2.00, 05/03, page 231 of 846 address t b address b b transfer address t a address b a 1st block 2nd block nth block block area consecutive transfer of m bytes or words is performed in response to one request legend address address address address where : = l a = l b = l a + saide ( 1) said (2 dtsz (n 1)) = l b + daide ( 1) daid (2 dtsz (m n 1)) = value set in mara = value set in marb = value set in etcrb = value set in etcrah and etcral t a t b b a b b l a l b n m figure 8.15 operation in block transfer mode (blkdir = 1) etcral is decremented by 1 each time a byte or word transfer is performed. in response to a single transfer request, burst transfer is performed until the value in etcral reaches h'00. etcral is then loaded with the value in etcrah. at this time, the value in the mar register for which a block designation has been given by the blkdir bit in dmacra is restored in accordance with the dtsz, said/daid, and saide/daide bits in dmacr. etcrb is decremented by 1 after every block transfer, and when the count reaches h'0000 the dte bit in dmabcrl is cleared and transfer ends. if the dtie bit in dmabcrl is set to 1 at this point, an interrupt request is sent to the cpu or dtc.
rev. 2.00, 05/03, page 232 of 846 figure 8.16 shows the operation flow in block transfer mode. acquire bus etcral = etcral 1 transfer request? etcral = h'00 release bus blkdir = 0 etcral = etcrah etcrb = etcrb 1 etcrb = h'0000 start (dte = dtme = 1) read address specified by mara mara = mara + saide ( 1) said 2 dtsz write to address specified by marb marb = marb + daide ( 1) daid 2 dtsz marb = marb daide ( 1) daid 2 dtsz etcrah mara = mara saide ( 1) said 2 dtsz etcrah no yes no yes no yes no yes clear dte bit to 0 to end transfer figure 8.16 operation flow in block transfer mode
rev. 2.00, 05/03, page 233 of 846 transfer requests (activation sources) consist of a/d converter conversion end interrupts, external requests, sci transmit-data-empty and receive-data-full interrupts, and tpu channel 0 to 5 compare match/input capture a interrupts. figure 8.17 shows an example of the setting procedure for block transfer mode. block transfer mode setting set dmabcrh set transfer source and transfer destination addresses set number of transfers set dmacr read dmabcrl set dmabcrl block transfer mode [1] [2] [3] [4] [5] [6] [1] set each bit in dmabcrh. set the fae bit to 1 to select full address mode. specify enabling or disabling of internal interrupt clearing with the dta bit. [2] set the transfer source address in mara, and the transfer destination address in marb. [3] set the block size in both etcrah and etcral. set the number of transfers in etcrb. [4] set each bit in dmacra and dmacrb. set the transfer data size with the dtsz bit. specify whether mara is to be incremented, decremented, or fixed, with the said and saide bits. set the blke bit to 1 to select block transfer mode. specify whether the transfer source or the transfer destination is a block area with the blkdir bit. specify whether marb is to be incremented, decremented, or fixed, with the daid and daide bits. select the activation source with bits dtf3 to dtf0. [5] read dte = 0 and dtme = 0 in dmabcrl. [6] set each bit in dmabcrl. specify enabling or disabling of transfer end interrupts to the cpu with the dtie bit. set both the dtme bit and the dte bit to 1 to enable transfer. figure 8.17 example of block transfer mode setting procedure
rev. 2.00, 05/03, page 234 of 846 8.5.8 basic bus cycles an example of the basic dmac bus cycle timing is shown in figure 8.18. in this example, word- size transfer is performed from 16-bit, 2-state access space to 8-bit, 3-state access space. when the bus is transferred from the cpu to the dmac, a source address read and destination address write are performed. the bus is not released in response to another bus request, etc., between these read and write operations. as like cpu cycles, dma cycles conform to the bus controller settings. the address is not output to the external address bus in an access to on-chip memory or an internal i/o register. address bus dmac cycle (1-word transfer) rd lwr hwr source address destination address cpu cycle cpu cycle t 1 t 2 t 3 t 1 t 2 t 3 t 1 t 2 figure 8.18 example of dma transfer bus timing
rev. 2.00, 05/03, page 235 of 846 8.5.9 dma transfer (dual address mode) bus cycles short address mode: figure 8.19 shows a transfer example in which tend output is enabled and byte-size short address mode transfer (sequential/idle/repeat mode) is performed from external 8-bit, 2-state access space to internal i/o space. dma read address bus rd lwr tend hwr bus release last transfer cycle dma write dma dead dma read dma write dma read dma write bus release bus release bus release figure 8.19 example of short address mode transfer a byte or word transfer is performed for a single transfer request, and after the transfer, the bus is released. while the bus is released, one or more bus cycles are executed by the cpu or dtc. in the transfer end cycle (the cycle in which the transfer counter reaches 0), a one-state dma dead cycle is inserted after the dma write cycle. in repeat mode, when tend output is enabled, tend output goes low in the transfer end cycle.
rev. 2.00, 05/03, page 236 of 846 full address mode (cycle steal mode): figure 8.20 shows a transfer example in which tend output is enabled and word-size full address mode transfer (cycle steal mode) is performed from external 16-bit, 2-state access space to external 16-bit, 2-state access space. dma read address bus rd lwr tend hwr bus release last transfer cycle dma write dma read dma write dma read dma write dma dead bus release bus release bus release figure 8.20 example of full address mode transfer (cycle steal) a byte or word transfer is performed for a single transfer request, and after the transfer, the bus is released. while the bus is released, one bus cycle is executed by the cpu or dtc. in the transfer end cycle (the cycle in which the transfer counter reaches 0), a one-state dma dead cycle is inserted after the dma write cycle.
rev. 2.00, 05/03, page 237 of 846 full address mode (burst mode): figure 8.21 shows a transfer example in which tend output is enabled and word-size full address mode transfer (burst mode) is performed from external 16- bit, 2-state access space to external 16-bit, 2-state access space. dma read address bus rd lwr tend hwr bus release dma write dma dead dma read dma write dma read dma write bus release burst transfer last transfer cycle figure 8.21 example of full address mode transfer (burst mode) in burst mode, one-byte or one-word transfers are executed consecutively until transfer ends. in the transfer end cycle (the cycle in which the transfer counter reaches 0), a one-state dma dead cycle is inserted after the dma write cycle. if a request from another higher-priority channel is generated after burst transfer starts, that channel has to wait until the burst transfer ends. if an nmi interrupt is generated while a channel designated for burst transfer is in the transfer enabled state, the dtme bit in dmabcrl is cleared and the channel is placed in the transfer disabled state. if burst transfer has already been activated inside the dmac, the bus is released on completion of a one-byte or one-word transfer within the burst transfer, and burst transfer is suspended. if the last transfer cycle of the burst transfer has already been activated inside the dmac, execution continues to the end of the transfer even if the dtme bit is cleared.
rev. 2.00, 05/03, page 238 of 846 full address mode (block transfer mode): figure 8.22 shows a transfer example in which tend output is enabled and word-size full address mode transfer (block transfer mode) is performed from internal 16-bit, 1-state access space to external 16-bit, 2-state access space. dma read address bus rd lwr tend hwr bus release block transfer last block transfer dma write dma read dma write dma dead dma read dma write dma read dma write dma dead bus release bus release figure 8.22 example of full address mode transfer (block transfer mode) a one-block transfer is performed for a single transfer request, and after the transfer the bus is released. while the bus is released, one or more bus cycles are executed by the cpu or dtc. in the transfer end cycle of each block (the cycle in which the transfer counter reaches 0), a one- state dma dead cycle is inserted after the dma write cycle. even if an nmi interrupt is generated during data transfer, block transfer operation is not affected until data transfer for one block has ended.
rev. 2.00, 05/03, page 239 of 846 dreq dreq dreq dreq pin falling edge activation timing: set the dta bit in dmabcrh to 1 for the channel for which the dreq pin is selected. figure 8.23 shows an example of normal mode transfer activated by the dreq pin falling edge. dma read address bus dreq idle write idle bus release dma control channel write idle transfer source request [1] [3] [2] [4] [6] [5] [7] acceptance resumes acceptance resumes dma write bus release dma read dma write bus release request transfer destination transfer source transfer destination read read request clear period request clear period minimum of 2 cycles minimum of 2 cycles [1] acceptance after transfer enabling; the dreq pin low level is sampled on the rising edge of , and the request is held. [2] [5] the request is cleared at the next bus break, and activation is started in the dmac. [3] [6] start of dma cycle; dreq pin high level sampling on the rising edge of starts. [4] [7] when the dreq pin high level has been sampled, acceptance is resumed after the write cycle is completed. (as in [1], the dreq pin low level is sampled on the rising edge of , and the request is held.) note: in write data buffer mode, bus breaks from [2] to [7] may be hidden, and not visible. figure 8.23 example of dreq dreq dreq dreq pin falling edge activated normal mode transfer dreq pin sampling is performed every cycle, with the rising edge of the next dreq pin low level is sampled while acceptance by means of the dreq pin is possible, the request is held in the dmac. then, when activation is initiated in the dmac, the request is cleared, and dreq pin high level sampling for edge detection is started. if dreq pin high level sampling has been completed by the time the dma write cycle ends, acceptance resumes after the end of the write cycle, dreq pin low level sampling is performed again, and this operation is repeated until the transfer ends.
rev. 2.00, 05/03, page 240 of 846 figure 8.24 shows an example of block transfer mode transfer activated by the dreq pin falling edge. dma read address bus dreq idle write bus release dma control channel write transfer source request [1] [3] [2] [4] [6] [5] [7] acceptance resumes dma dead 1 block transfer idle dead dead dma write bus release dma read dma write dma dead bus release transfer source request acceptance resumes 1 block transfer transfer destination transfer destination read idle read minimum of 2 cycles minimum of 2 cycles request clear period request clear period [1] acceptance after transfer enabling; the dreq pin low level is sampled on the rising edge of , and the request is held. [2] [5] the request is cleared at the next bus break, and activation is started in the dmac. [3] [6] start of dma cycle; dreq pin high level sampling on the rising edge of starts. [4] [7] when the dreq pin high level has been sampled, acceptance is resumed after the dead cycle is completed. (as in [1], the dreq pin low level is sampled on the rising edge of , and the request is held.) note: in write data buffer mode, bus breaks from [2] to [7] may be hidden, and not visible. figure 8.24 example of dreq dreq dreq dreq pin falling edge activated block transfer mode transfer dreq pin sampling is performed every cycle, with the rising edge of the next dreq pin low level is sampled while acceptance by means of the dreq pin is possible, the request is held in the dmac. then, when activation is initiated in the dmac, the request is cleared, and dreq pin high level sampling for edge detection is started. if dreq pin high level sampling has been completed by the time the dma dead cycle ends, acceptance resumes after the end of the dead cycle, dreq pin low level sampling is performed again, and this operation is repeated until the transfer ends.
rev. 2.00, 05/03, page 241 of 846 dreq dreq dreq dreq pin low level activation timing (normal mode): set the dta bit in dmabcrh to 1 for the channel for which the dreq pin is selected. figure 8.25 shows an example of normal mode transfer activated by the dreq pin low level. dma read dma write address bus dreq idle write idle bus release dma control channel write idle transfer source bus release dma read dma write bus release request [1] [3] [2] [4] [6] [5] [7] acceptance resumes acceptance resumes transfer destination transfer source transfer destination request request clear period request clear period read read minimum of 2 cycles minimum of 2 cycles [1] acceptance after transfer enabling; the dreq pin low level is sampled on the rising edge of , and the request is held. [2] [5] the request is cleared at the next bus break, and activation is started in the dmac. [3] [6] the dma cycle is started. [4] [7] acceptance is resumed after the write cycle is completed. (as in [1], the dreq pin low level is sampled on the rising edge of , and the request is held.) note: in write data buffer mode, bus breaks from [2] to [7] may be hidden, and not visible. figure 8.25 example of dreq dreq dreq dreq pin low level activated normal mode transfer dreq pin sampling is performed every cycle, with the rising edge of the next dreq pin low level is sampled while acceptance by means of the dreq pin is possible, the request is held in the dmac. then, when activation is initiated in the dmac, the request is cleared. after the end of the write cycle, acceptance resumes, dreq pin low level sampling is performed again, and this operation is repeated until the transfer ends.
rev. 2.00, 05/03, page 242 of 846 figure 8.26 shows an example of block transfer mode transfer activated by dreq pin low level. dma read dma write address bus dreq idle write bus release dma control channel write transfer source request [1] [3] [2] [4] [6] [5] [7] acceptance resumes dma dead bus release dma read dma write dma dead bus release 1 block transfer idle dead dead 1 block transfer acceptance resumes request minimum of 2 cycles minimum of 2 cycles transfer source read request clear period read request clear period transfer destination transfer destination idle [1] acceptance after transfer enabling; the dreq pin low level is sampled on the rising edge of , and the request is held. [2] [5] the request is cleared at the next bus break, and activation is started in the dmac. [3] [6] the dma cycle is started. [4] [7] acceptance is resumed after the dead cycle is completed. (as in [1], the dreq pin low level is sampled on the rising edge of , and the request is held.) note: in write data buffer mode, bus breaks from [2] to [7] may be hidden, and not visible. figure 8.26 example of dreq dreq dreq dreq pin low level activated block transfer mode transfer dreq pin sampling is performed every cycle, with the rising edge of the next dreq pin low level is sampled while acceptance by means of the dreq pin is possible, the request is held in the dmac. then, when activation is initiated in the dmac, the request is cleared. after the end of the dead cycle, acceptance resumes, dreq pin low level sampling is performed again, and this operation is repeated until the transfer ends.
rev. 2.00, 05/03, page 243 of 846 8.5.10 dma transfer (single address mode) bus cycles single address mode (read): figure 8.27 shows a transfer example in which tend output is enabled and byte-size single address mode transfer (read) is performed from external 8-bit, 2-state access space to an external device. dma read address bus dma dead rd dack tend bus release dma read dma read dma read bus release bus release bus release bus release last transfer cycle figure 8.27 example of single address mode transfer (byte read)
rev. 2.00, 05/03, page 244 of 846 figure 8.28 shows a transfer example in which tend output is enabled and word-size single address mode transfer (read) is performed from external 8-bit, 2-state access space to an external device. dma read address bus dma read dma read dma dead rd tend dack bus release bus release bus release bus release last transfer cycle figure 8.28 example of single address mode (word read) transfer a byte or word transfer is performed for a single transfer request, and after the transfer, the bus is released. while the bus is released, one or more bus cycles are executed by the cpu or dtc. in the transfer end cycle (the cycle in which the transfer counter reaches 0), a one-state dma dead cycle is inserted after the dma write cycle.
rev. 2.00, 05/03, page 245 of 846 single address mode (write): figure 8.29 shows a transfer example in which tend output is enabled and byte-size single address mode transfer (write) is performed from an external device to external 8-bit, 2-state access space. dma write address bus dma dead hwr dack tend bus release lwr dma write dma write dma write bus release bus release bus release bus release last transfer cycle figure 8.29 example of single address mode transfer (byte write)
rev. 2.00, 05/03, page 246 of 846 figure 8.30 shows a transfer example in which tend output is enabled and word-size single address mode transfer (write) is performed from an external device to external 8-bit, 2-state access space. dma write address bus dma write dma write dma dead hwr tend dack bus release lwr bus release bus release bus release last transfer cycle figure 8.30 example of single address mode transfer (word write) a byte or word transfer is performed for a single transfer request, and after the transfer, the bus is released. while the bus is released, one or more bus cycles are executed by the cpu or dtc. in the transfer end cycle (the cycle in which the transfer counter reaches 0), a one-state dma dead cycle is inserted after the dma write cycle. dreq dreq dreq dreq pin falling edge activation timing: set the dta bit in dmabcrh to 1 for the channel for which the dreq pin is selected. figure 8.31 shows an example of single address mode transfer activated by the dreq pin falling edge.
rev. 2.00, 05/03, page 247 of 846 dreq bus release dma single dma single address bus dma control channel [2] dack transfer source/ destination idle idle idle [1] [3] [5] [4] [6] [7] acceptance resumes acceptance resumes bus release bus release transfer source/ destination request request request clear period request clear period minimum of 2 cycles minimum of 2 cycles single single [1] acceptance after transfer enabling; the dreq pin low level is sampled on the rising edge of , and the request is held. [2] [5] the request is cleared at the next bus break, and activation is started in the dmac. [3] [6] start of dma cycle; dreq pin high level sampling on the rising edge of starts. [4] [7] when the dreq pin high level has been sampled, acceptance is resumed after the single cycle is completed. (as in [1], the dreq pin low level is sampled on the rising edge of , and the request is held.) note: in write data buffer mode, bus breaks from [2] to [7] may be hidden, and not visible. figure 8.31 example of dreq dreq dreq dreq pin falling edge activated single address mode transfer dreq pin sampling is performed every cycle, with the rising edge of the next dreq pin low level is sampled while acceptance by means of the dreq pin is possible, the request is held in the dmac. then, when activation is initiated in the dmac, the request is cleared, and dreq pin high level sampling for edge detection is started. if dreq pin high level sampling has been completed by the time the dma single cycle ends, acceptance resumes after the end of the single cycle, dreq pin low level sampling is performed again, and this operation is repeated until the transfer ends.
rev. 2.00, 05/03, page 248 of 846 dreq dreq dreq dreq pin low level activation timing: set the dta bit in dmabcrh to 1 for the channel for which the dreq pin is selected. figure 8.32 shows an example of single address mode transfer activated by the dreq pin low level. dreq bus release dma single address bus dma control channel [2] dack transfer source/ destination idle idle idle [1] [3] [5] [4] [6] [7] acceptance resumes acceptance resumes bus release dma single bus release transfer source/ destination request request request clear period request clear period single single minimum of 2 cycles minimum of 2 cycles [1] acceptance after transfer enabling; the dreq pin low level is sampled on the rising edge of , and the request is held. [2] [5] the request is cleared at the next bus break, and activation is started in the dmac. [3] [6] the dmac cycle is started. [4] [7] acceptance is resumed after the single cycle is completed. (as in [1], the dreq pin low level is sampled on the rising edge of , and the request is held.) note: in write data buffer mode, bus breaks from [2] to [7] may be hidden, and not visible. figure 8.32 example of dreq dreq dreq dreq pin low level activated single address mode transfer
rev. 2.00, 05/03, page 249 of 846 dreq pin sampling is performed every cycle, with the rising edge of the next dreq pin low level is sampled while acceptance by means of the dreq pin is possible, the request is held in the dmac. then, when activation is initiated in the dmac, the request is cleared. after the end of the single cycle, acceptance resumes, dreq pin low level sampling is performed again, and this operation is repeated until the transfer ends. 8.5.11 multi-channel operation the dmac channel priority order is: channel 0 > channel 1, and channel a > channel b. table 8.11 summarizes the priority order for dmac channels. table 8.11 dmac channel priority order short address mode full address mode priority channel 0a channel 0 high channel 0b channel 1a channel 1 channel 1b low if transfer requests are issued simultaneously for more than one channel, or if a transfer request for another channel is issued during a transfer, when the bus is released, the dmac selects the highest-priority channel from among those issuing a request according to the priority order shown in table 8.11. during burst transfer, or when one block is being transferred in block transfer, the channel will not be changed until the end of the transfer. figure 8.33 shows a transfer example in which transfer requests are issued simultaneously for channels 0a, 0b, and 1.
rev. 2.00, 05/03, page 250 of 846 dma read dma write dma read dma write dma read dma write dma read address bus rd hwr lwr dma control channel 0a channel 0b channel 1 idle write idle read write idle read write read request hold request hold bus release channel 0a transfer bus release channel 0b transfer channel 1 transfer bus release request hold read selection non- selection selection request clear request clear request clear figure 8.33 example of multi-channel transfer 8.5.12 relation between dmac and external bus requests, and dtc the dma read cycle and write cycle are inseparable, and so the external bus release cycle and dtc cycle do not arise between the dma external read cycle and internal write cycle. when the read cycle and write cycle are set in series as in a burst transfer or block transfer, the external bus release may be inserted after the write cycle. as the dtc has a lower priority than the dmac, it is not executed until the dmac releases the bus. when the dma read cycle or write cycle accesses the on-chip memory or an internal i/o register, the dmac cycle or external bus release may be executed at the same time. 8.5.13 dmac and nmi interrupts when an nmi interrupt is requested, burst mode transfer in full address mode is interrupted. an nmi interrupt does not affect the operation of the dmac in other modes. in full address mode, transfer is enabled for a channel when both the dte bit and dtme bit are set to 1. with burst mode setting, the dtme bit is cleared when an nmi interrupt is requested. if the dtme bit is cleared during burst mode transfer, the dmac discontinues transfer on completion of the 1-byte or 1-word transfer in progress, then releases the bus, which passes to the cpu.
rev. 2.00, 05/03, page 251 of 846 the channel on which transfer was interrupted can be restarted by setting the dtme bit to 1 again. figure 8.34 shows the procedure for continuing transfer when it has been interrupted by an nmi interrupt on a channel designated for burst mode transfer. resumption of transfer on interrupted channel set dtme bit to 1 transfer continues [1] [2] dte = 1 dtme = 0 transfer ends no yes [1] [2] check that dte = 1 and dtme = 0 in dmabcrl. write 1 to the dtme bit. figure 8.34 example of procedure for continuing transfer on channel interrupted by nmi interrupt
rev. 2.00, 05/03, page 252 of 846 8.5.14 forced termination of dmac operation if the dte bit in dmabcrl is cleared to 0 for the channel currently operating, the dmac stops on completion of the 1-byte or 1-word transfer in progress. dmac operation resumes when the dte bit is set to 1 again. in full address mode, the same applies to the dtme bit in dmabcrl. figure 8.35 shows the procedure for forcibly terminating dmac operation by software. forced termination of dmac clear dte bit to 0 forced termination [1] [1] clear the dte bit in dmabcrl to 0. to prevent interrupt generation after forced termination of dmac operation, clear the dtie bit to 0 at the same time. figure 8.35 example of procedure for forcibly terminating dmac operation
rev. 2.00, 05/03, page 253 of 846 8.5.15 clearing full address mode figure 8.36 shows the procedure for releasing and initializing a channel designated for full address mode. after full address mode has been cleared, the channel can be set to another transfer mode using the appropriate setting procedure. clearing full address mode stop the channel initialize dmacr clear fae bit to 0 initialization; operation halted [1] [2] [3] [1] clear both the dte bit and dtme bit in dmabcrl to 0, or wait until the transfer ends and the dte bit is cleared to 0, then clear the dtme bit to 0. also clear the corresponding dtie bit to 0 at the same time. [2] clear all bits in dmacra and dmacrb to 0. [3] clear the fae bit in dmabcrh to 0. figure 8.36 example of procedure for clearing full address mode
rev. 2.00, 05/03, page 254 of 846 8.6 interrupt sources the sources of interrupts generated by the dmac are transfer end and transfer break. table 8.12 shows the interrupt sources and their priority order. table 8.12 interrupt sources and priority order interrupt interrupt source interrupt name short address mode full address mode priority order dend0a interrupt due to end of transfer on channel 0a interrupt due to end of transfer on channel 0 high dend0b interrupt due to end of transfer on channel 0b interrupt due to break in transfer on channel 0 dend1a interrupt due to end of transfer on channel 1a interrupt due to end of transfer on channel 1 dend1b interrupt due to end of transfer on channel 1b interrupt due to break in transfer on channel 1 low enabling or disabling of each interrupt source is set by means of the dtie bit in dmabcrl for the corresponding channel in dmabcrl, and interrupts from each source are sent to the interrupt controller independently. the priority of transfer end interrupts on each channel is decided by the interrupt controller, as shown in table 8.12. figure 8.37 shows a block diagram of a transfer end/transfer break interrupt. an interrupt is always generated when the dtie bit is set to 1 while the dte bit in dmabcrl is cleared to 0. dte/ dtme dtie transfer end/transfer break interrupt figure 8.37 block diagram of transfer end/transfer break interrupt in full address mode, a transfer break interrupt is generated when the dtme bit is cleared to 0 while the dtieb bit is set to 1. in both short address mode and full address mode, dmabcr should be set so as to prevent the occurrence of a combination that constitutes a condition for interrupt generation during setting.
rev. 2.00, 05/03, page 255 of 846 8.7 usage notes 8.7.1 dmac register access during operation except for forced termination of the dmac, the operating (including transfer waiting state) channel setting should not be changed. the operating channel setting should only be changed when transfer is disabled. also, dmac registers should not be written to in a dma transfer. dmac register reads during operation (including the transfer waiting state) are described below. ? dmac control starts one cycle before the bus cycle, with output of the internal address. consequently, mar is updated in the bus cycle before dma transfer. figure 8.38 shows an example of the update timing for dmac registers in dual address transfer mode. [1] transfer source address register mar operation (incremented/decremented/fixed) transfer counter etcr operation (decremented) block size counter etcr operation (decremented in block transfer mode) [2] transfer destination address register mar operation (incremented/decremented/fixed) [2'] transfer destination address register mar operation (incremented/decremented/fixed) block transfer counter etcr operation (decremented, in last transfer cycle of a block in block transfer mode) [3] transfer address register mar restore operation (in block or repeat transfer mode) transfer counter etcr restore (in repeat transfer mode) block size counter etcr restore (in block transfer mode) note: in single address transfer mode, the update timing is the same as [1]. the mar operation is post-incrementing/decrementing of the dma internal address value. [1] dma transfer cycle dma read dma read dma write dma write dma dead dma internal address dma control dma register operation dma last transfer cycle transfer destination transfer destination transfer source transfer source idle idle read read dead write write [2] [1] [2'] [3] figure 8.38 dmac register update timing
rev. 2.00, 05/03, page 256 of 846 ? if a dmac transfer cycle occurs immediately after a dmac register read cycle, the dmac register is read as shown in figure 8.39. [1] [2] note: the lower word of mar is the updated value after the operation in [1]. cpu longword read dma transfer cycle mar upper word read mar lower word read dma read dma write dma internal address dma control dma register operation transfe source transfer destination idle read write idle figure 8.39 contention between dmac register update and cpu read 8.7.2 module stop when the mstpa7 bit in mstpcra is set to 1, the dmac clock stops, and the module stop state is entered. however, 1 cannot be written to the mstpa7 bit if any of the dmac channels is enabled. this setting should therefore be made when dmac operation is stopped. when the dmac clock stops, dmac register accesses can no longer be made. since the following dmac register settings are valid even in the module stop state, they should be invalidated, if necessary, before a module stop. ? transfer end/break interrupt (dte = 0 and dtie = 1) ? tend pin enable (tee = 1) ? dack pin enable (fae = 0 and sae = 1) 8.7.3 medium-speed mode when the dta bit is cleared to 0, the internal interrupt signal that is specified for the dmac transfer source is detected at the edge. in medium-speed mode, the dmac operates by the medium-speed clock and the internal peripheral module operates by the high-speed clock. therefore, when the corresponding interruption source is cleared by the cpu, dtc, or other channels of the dmac and the period until the next interruption is executed is less than one state regarding to the dmac clock (bus master clock), the signal is not detected at the edge and ignored. in medium-speed mode, the dreq pin is sampled at the rising edge of the medium clock.
rev. 2.00, 05/03, page 257 of 846 8.7.4 activation by falling edge on dreq dreq dreq dreq pin dreq pin falling edge detection is performed in synchronization with dmac internal operations. the operation is as follows: [1] activation request wait state: waits for detection of a low level on the dreq pin, and switches to [2]. [2] transfer wait state: waits for dmac data transfer to become possible, and switches to [3]. [3] activation request disabled state: waits for detection of a high level on the dreq pin, and switches to [1]. after dmac transfer is enabled, a transition is made to [1]. thus, initial activation after transfer is enabled is performed on detection of a low level. 8.7.5 activation source acceptance at the start of activation source acceptance, a low level is detected in both dreq pin falling edge sensing and low level sensing. similarly, in the case of an internal interrupt, the interrupt request is detected. therefore, a request is accepted from an internal interrupt or dreq pin low level that occurs before write to dmabcrl to enable transfer. when the dmac is activated, take any necessary steps to prevent an internal interrupt or dreq pin low level remaining from the end of the previous transfer, etc. 8.7.6 internal interrupt after end of transfer when the dte bit in dmabcrl is cleared to 0 at the end of a transfer or by a forcible termination, the selected internal interrupt request will be sent to the cpu or dtc even if the dta bit in dmabcrh is set to 1. also, if internal dmac activation has already been initiated when operation is forcibly terminated, the transfer is executed but flag clearing is not performed for the selected internal interrupt even if the dta bit is set to 1. an internal interrupt request following the end of transfer or a forcible termination should be handled by the cpu as necessary.
rev. 2.00, 05/03, page 258 of 846 8.7.7 channel re-setting to reactivate a number of channels when multiple channels are enabled, use exclusive handling of transfer end interrupts, and perform dmabcr control bit operations exclusively. note, in particular, that in cases where multiple interrupts are generated between reading and writing of dmabcr, and a dmabcr operation is performed during new interrupt handling, the dmabcr write data in the original interrupt handling routine will be incorrect, and the write may invalidate the results of the operations by the multiple interrupts. ensure that overlapping dmabcr operations are not performed by multiple interrupts, and that there is no separation between read and write operations by the use of a bit-manipulation instruction. also, when the dte and dtme bits are cleared by the dmac or are written with 0, they must first be read while cleared to 0 before the cpu can write 1 to them.
dtch808c_000020020700 rev. 2.00, 05/03, page 259 of 846 section 9 data transfer controller (dtc) this lsi includes a data transfer controller (dtc). the dtc can be activated by an interrupt or software, to transfer data. figure 9.1 shows a block diagram of the dtc. the dtc's register information is stored in the on-chip ram. when the dtc is used, the rame bit in syscr must be set to 1. a 32-bit bus connects the dtc to the on-chip ram (1 kbyte), enabling 32-bit/1-state reading and writing of the dtc register information. 9.1 features ? transfer is possible over any number of channels ? three transfer modes ? normal, repeat, and block transfer modes are available ? one activation source can trigger a number of data transfers (chain transfer) ? the direct specification of 16-mbyte address space is possible ? activation by software is possible ? transfer can be set in byte or word units ? a cpu interrupt can be requested for the interrupt that activated the dtc ? module stop mode can be set
rev. 2.00, 05/03, page 260 of 846 internal address bus dtcera to dtcerf and dtceri interrupt controller interrupt request dtc on-chip ram internal data bus cpu interrupt request mra mrb cra crb dar sar mra, mrb cra, crb sar dar dtcera to dtcerf and dtceri dtvecr : dtc mode registers a and b : dtc transfer count registers a and b : dtc source address register : dtc destination address register : dtc enable registers a to f and i : dtc vector register legend dtc service request control logic register information dtvecr figure 9.1 block diagram of dtc
rev. 2.00, 05/03, page 261 of 846 9.2 register descriptions the dtc has the following registers. ? dtc mode register a (mra) ? dtc mode register b (mrb) ? dtc source address register (sar) ? dtc destination address register (dar) ? dtc transfer count register a (cra) ? dtc transfer count register b (crb) these six registers cannot be directly accessed from the cpu. when activated, the dtc reads a set of register information that is stored in on-chip ram to the corresponding dtc registers and transfers data. after the data transfer, it writes a set of updated register information back to the ram. ? dtc enable registers (dtcer) ? dtc vector register (dtvecr)
rev. 2.00, 05/03, page 262 of 846 9.2.1 dtc mode register a (mra) mra selects the dtc operating mode. bit bit name initial value r/w description 7 6 sm1 sm0 undefined undefined ? ? source address mode 1 and 0 these bits specify an sar operation after a data transfer. 0x: sar is fixed 10: sar is incremented after a transfer (by +1 when sz = 0; by +2 when sz = 1) 11: sar is decremented after a transfer (by C1 when sz = 0; by C2 when sz = 1) 5 4 dm1 dm0 undefined undefined ? ? destination address mode 1 and 0 these bits specify a dar operation after a data transfer. 0x: dar is fixed 10: dar is incremented after a transfer (by +1 when sz = 0; by +2 when sz = 1) 11: dar is decremented after a transfer (by C1 when sz = 0; by C2 when sz = 1) 3 2 md1 md0 undefined undefined ? ? dtc mode 1 and 0 these bits specify the dtc transfer mode. 00: normal mode 01: repeat mode 10: block transfer mode 11: setting prohibited 1 dts undefined ? dtc transfer mode select specifies whether the source side or the destination side is set to be a repeat area or block area, in repeat mode or block transfer mode. 0: destination side is repeat area or block area 1: source side is repeat area or block area 0 sz undefined ? dtc data transfer size specifies the size of data to be transferred. 0: byte-size transfer 1: word-size transfer legend: x: don't care
rev. 2.00, 05/03, page 263 of 846 9.2.2 dtc mode register b (mrb) mrb is an 8-bit register that selects the dtc operating mode. bit bit name initial value r/w description 7 chne undefined ? dtc chain transfer enable this bit specifies a chain transfer. for details, refer to section 9.5.4, chain transfer. in data transfer with chne set to 1, determination of the end of the specified number of transfers, clearing of the interrupt source flag, and clearing of dtcer, are not performed. 0: dtc data transfer completed (waiting for start) 1: dtc chain transfer (reads new register information and transfers data) 6 disel undefined ? dtc interrupt select this bit specifies whether cpu interrupt is disabled or enabled after a data transfer. 0: interrupt request is issued to the cpu when the specified data transfer is completed. 1: dtc issues interrupt request to the cpu in every data transfer (dtc does not clear the interrupt request flag that is a cause of the activation). 5 to 0 ? undefined ? reserved these bits have no effect on dtc operation. the write value should always be 0. 9.2.3 dtc source address register (sar) sar is a 24-bit register that designates the source address of data to be transferred by the dtc. for word-size transfer, specify an even source address. 9.2.4 dtc destination address register (dar) dar is a 24-bit register that designates the destination address of data to be transferred by the dtc. for word-size transfer, specify an even destination address.
rev. 2.00, 05/03, page 264 of 846 9.2.5 dtc transfer count register a (cra) cra is a 16-bit register that designates the number of times data is to be transferred by the dtc. in normal mode, the entire cra functions as a 16-bit transfer counter (1 to 65,536). it is decremented by 1 every time data is transferred, and transfer ends when the count reaches h'0000. in repeat mode or block transfer mode, the cra is divided into two parts; the upper 8 bits (crah) and the lower 8 bits (cral). crah holds the number of transfers while cral functions as an 8-bit transfer counter (1 to 256). cral is decremented by 1 every time data is transferred, and the contents of crah are sent when the count reaches h'00. 9.2.6 dtc transfer count register b (crb) crb is a 16-bit register that designates the number of times data is to be transferred by the dtc in block transfer mode. it functions as a 16-bit transfer counter (1 to 65,536) that is decremented by 1 every time data is transferred, and transfer ends when the count reaches h'0000. 9.2.7 dtc enable register (dtcer) dtcer is comprised of seven registers; dtcera to dtcerf and dtceri, and is a register that specifies dtc activation interrupt sources. the correspondence between interrupt sources and dtce bits is shown in table 9.1. for dtce bit setting, use bit manipulation instructions such as bset and bclr for reading and writing. if all interrupts are masked, multiple activation sources can be set at one time (only at the initial setting) by writing data after executing a dummy read on the relevant register. bit bit name initial value r/w description 7 6 5 4 3 2 1 0 dtce7 dtce6 dtce5 dtce4 dtce3 dtce2 dtce1 dtce0 0 0 0 0 0 0 0 0 r/w r/w r/w r/w r/w r/w r/w r/w dtc activation enable setting this bit to 1 specifies a relevant interrupt source as a dtc activation source. [clearing conditions] ? when the disel bit is 1 and the data transfer has ended ? when the specified number of transfers have ended these bits are not cleared when the disel bit is 0 and the specified number of transfers have not been completed
rev. 2.00, 05/03, page 265 of 846 9.2.8 dtc vector register (dtvecr) dtvecr is an 8-bit readable/writable register that enables or disables dtc activation by software, and sets a vector number for the software activation interrupt. bit bit name initial value r/w description 7 swdte 0 r/w dtc software activation enable setting this bit to 1 activates dtc. only a 1 can be written to this bit. [clearing conditions] ? when the disel bit is 0 and the specified number of transfers have not ended ? when 0 s written to the disel bit after a software-activated data transfer end interrupt (swdtend) request has been sent to the cpu. when the disel bit is 1 and data transfer has ended, the specified number of transfers have ended, or software-activated data transfer is in process, this bit will not be cleared. 6 5 4 3 2 1 0 dtvec6 dtvec5 dtvec4 dtvec3 dtvec2 dtvec1 dtvec0 0 0 0 0 0 0 0 r/w r/w r/w r/w r/w r/w r/w dtc software activation vectors 0 to 6 these bits specify a vector number for dtc software activation. the vector address is expressed as h'0400 + (vector number 2). for example, when dtvec6 to dtvec0 = h'10, the vector address is h'0420. these bits are writable when swdte=0.
rev. 2.00, 05/03, page 266 of 846 9.3 activation sources the dtc operates when activated by an interrupt or by a write to dtvecr by software. an interrupt request can be directed to the cpu or dtc, as designated by the corresponding dtcer bit. at the end of a data transfer (or the last consecutive transfer in the case of chain transfer), the activation source or corresponding dtcer bit is cleared. the activation source flag, in the case of rxi0, for example, is the rdrf flag of sci_0. when an interrupt has been designated a dtc activation source, the existing cpu mask level and interrupt controller priorities have no effect. if there is more than one activation source at the same time, the dtc operates in accordance with the default priorities. figure 9.2 shows a block diagram of activation source control. for details, see section 5, interrupt controller. cpu dtc dtcer source flag cleared on-chip peripheral module irq interrupt interrupt request clear clear controller clear request interrupt controller selection circuit interrupt mask select dtvecr figure 9.2 block diagram of dtc activation source control
rev. 2.00, 05/03, page 267 of 846 9.4 location of register information and dtc vector table locate the register information in the on-chip ram (addresses: h'ffebc0 to h'ffefbf). register information should be located at an address that is a multiple of four within the range. locating the register information in address space is shown in figure 9.3. locate the mra, sar, mrb, dar, cra, and crb registers, in that order, from the start address of the register information. in the case of chain transfer, register information should be located in consecutive areas as shown in figure 9.3, and the register information start address should be located at the vector address corresponding to the interrupt source. figure 9.4 shows the correspondence between dtc vector address and register information. the dtc reads the start address of the register information from the vector address set for each activation source, and then reads the register information from that start address. when the dtc is activated by software, the vector address is obtained from: h'0400 + (dtvecr[6:0] 2). for example, if dtvecr is h'10, the vector address is h'0420. the configuration of the vector address is the same in both normal * and advanced modes, a 2-byte unit being used in both cases. these two bytes specify the lower bits of the register information start address. note: * normal mode cannot be used in this lsi. mra 0123 sar mrb dar cra crb mra sar mrb dar cra crb lower address 4 bytes register information register information for 2nd transfer in chain transfer register information start address chain transfer figure 9.3 the location of the dtc register information in the address space
rev. 2.00, 05/03, page 268 of 846 register information start address register information chain transfer dtc vector address figure 9.4 correspondence between dtc vector address and register information table 9.1 interrupt sources, dtc vector addresses, and corresponding dtces interrupt source origin of interrupt source vector number dtc vector address dtce * 1 priority software write to dtvecr dtvecr h'0400 + vector number ? high external pin irq0 16 h'0420 dtcea7 irq1 17 h'0422 dtcea6 irq2 18 h'0424 dtcea5 irq3 19 h'0426 dtcea4 irq4 20 h'0428 dtcea3 irq5 21 h'042a dtcea2 irq6 22 h'042c dtcea1 irq7 23 h'042e dtcea0 a/d converter adi (a/d conversion end) 28 h'0438 dtceb6 tgi0a 32 h'0440 dtceb5 tpu channel 0 tgi0b 33 h'0442 dtceb4 tgi0c 34 h'0444 dtceb3 tgi0d 35 h'0446 dtceb2 tgi1a 40 h'0450 dtceb1 tpu channel 1 tgi1b 41 h'0452 dtceb0 tgi2a 44 h'0458 dtcec7 tpu channel 2 tgi2b 45 h'045a dtcec6 low
rev. 2.00, 05/03, page 269 of 846 interrupt source origin of interrupt source vector number dtc vector address dtce * 1 priority tgi3a 48 h'0460 dtcec5 high tpu channel 3 * 4 tgi3b 49 h'0462 dtcec4 tgi3c 50 h'0464 dtcec3 tgi3d 51 h'0466 dtcec2 tgi4a 56 h'0470 dtcec1 tpu channel 4 * 4 tgi4b 57 h'0472 dtcec0 tgi5a 60 h'0478 dtced5 tpu channel 5 * 4 tgi5b 61 h'047a dtced4 cmia0 64 h'0480 dtced3 8-bit timer channel 0 cmib0 65 h'0482 dtced2 cmia1 68 h'0488 dtced1 8-bot timer channel 1 cmib1 69 h'048a dtced0 dend0a 72 h'0490 dtcee7 dend0a 73 h'0492 dtcee6 dend1a 74 h'0494 dtcee5 dmac * 2 dend1a 75 h'0496 dtcee4 rxi0 81 h'04a2 dtcee3 sci channel 0 txi0 82 h'04a4 dtcee2 rxi1 85 h'04aa dtcee1 sci channel 1 txi1 86 h'04ac dtcee0 rxi2 89 h'04b2 dtcef7 sci channel 2 * 4 txi2 90 h'04b4 dtcef6 cmia2 92 h'04b8 dtcef5 8-bit timer channel 2 * 3 cmib2 93 h'04ba dtcef4 cmia3 96 h'04c0 dtcef3 8-bit timer channel 3 * 3 cmib3 97 h'04c2 dtcef2 iic channel 0 (optional) * 3 iici0 100 h'04c8 dtcef1 iic channel 1 (optional) * 3 iici1 102 h'04cc dtcef0 rxi3 121 h'04f2 dtcei7 sci channel 3 txi3 122 h'04f4 dtcei6 low
rev. 2.00, 05/03, page 270 of 846 notes: * 1 dtce bits with no corresponding interrupt are reserved, and should be written with 0. * 2 supported only by the h8s/2239 group. * 3 these channels are not available in the h8s/2237 group or h8s/2227 group. * 4 these channels are not available in the h8s/2227 group. 9.5 operation register information is stored in on-chip ram. when activated, the dtc reads register information in on-chip ram and transfers data. after the data transfer, the dtc writes updated register information back to the memory. the pre-storage of register information in memory makes it possible to transfer data over any required number of channels. the transfer mode can be specified as normal, repeat, and block transfer mode. setting the chne bit in mrb to 1 makes it possible to perform a number of transfers with a single activation source (chain transfer). the 24-bit sar designates the dtc transfer source address, and the 24-bit dar designates the transfer destination address. after each transfer, sar and dar are independently incremented, decremented, or left fixed depending on its register information. figure 9.5 shows the flowchart of dtc operation.
rev. 2.00, 05/03, page 271 of 846 start end read dtc vector read register infomation data transfer write register information interrupt exception handling clear dtcer clear an activation flag chne = 1 next transfer yes no yes no transfer counter= 0 or disel 1 figure 9.5 flowchart of dtc operation 9.5.1 normal mode in normal mode, one operation transfers one byte or one word of data. from 1 to 65,536 transfers can be specified. once the specified number of transfers have been completed, a cpu interrupt can be requested. table 9.2 lists the register information in normal mode. figure 9.6 shows the memory mapping in normal mode.
rev. 2.00, 05/03, page 272 of 846 table 9.2 register information in normal mode name abbreviation function dtc source address register sar designates source address dtc destination address register dar designates destination address dtc transfer count register a cra designates transfer count dtc transfer count register b crb not used sar dar transfer figure 9.6 memory mapping in normal mode 9.5.2 repeat mode in repeat mode, one operation transfers one byte or one word of data. from 1 to 256 transfers can be specified. once the specified number of transfers have ended, the initial state of the transfer counter and the address register specified as the repeat area is restored, and transfer is repeated. in repeat mode the transfer counter value does not reach h'00, and therefore cpu interrupts cannot be requested when disel = 0. table 9.3 lists the register information in repeat mode. figure 9.7 shows the memory mapping in repeat mode.
rev. 2.00, 05/03, page 273 of 846 table 9.3 register information in repeat mode name abbreviation function dtc source address register sar designates source address dtc destination address register dar designates destination address dtc transfer count register ah crah holds number of transfers dtc transfer count register al cral designates transfer count dtc transfer count register b crb not used sar or dar dar or sar repeat area transfer figure 9.7 memory mapping in repeat mode 9.5.3 block transfer mode in block transfer mode, one operation transfers one block of data. either the transfer source or the transfer destination is designated as a block area. the block size can be between 1 to 256. when the transfer of one block ends, the initial state of the block size counter and the address register specified as the block area is restored. the other address register is then incremented, decremented, or left fixed. from 1 to 65,536 transfers can be specified. once the specified number of transfers have been completed, a cpu interrupt is requested. table 9.4 lists the register information in block transfer mode. figure 9.8 shows the memory mapping in block transfer mode.
rev. 2.00, 05/03, page 274 of 846 table 9.4 register information in block transfer mode name abbreviation function dtc source address register sar designates source address dtc destination address register dar designates destination address dtc transfer count register ah crah holds block size dtc transfer count register al cral designates block size count dtc transfer count register b crb transfer count first block transfer block area nth block dar or sar sar or dar ? ? ? figure 9.8 memory mapping in block transfer mode
rev. 2.00, 05/03, page 275 of 846 9.5.4 chain transfer setting the chne bit in mrb to 1 enables a number of data transfers to be performed consecutively in response to a single transfer request. sar, dar, cra, crb, mra, and mrb, which define data transfers, can be set independently. figure 9.9 shows the memory map for chain transfer. when activated, the dtc reads the register information start address stored at the vector address, and then reads the first register information at that start address. after the data transfer, the chne bit will be tested. when it has been set to 1, dtc reads the next register information located in a consecutive area and performs the data transfer. these sequences are repeated until the chne bit is cleared to 0. in the case of transfer with chne set to 1, an interrupt request to the cpu is not generated at the end of the specified number of transfers or by setting of the disel bit to 1, and the interrupt source flag for the activation source is not affected. dtc vector address register information chne=1 register information chne=0 register information start address source destination source destination figure 9.9 chain transfer operation
rev. 2.00, 05/03, page 276 of 846 9.5.5 interrupts an interrupt request is issued to the cpu when the dtc has completed the specified number of data transfers, or a data transfer for which the disel bit was set to 1. in the case of interrupt activation, the interrupt set as the activation source is generated. these interrupts to the cpu are subject to cpu mask level and interrupt controller priority level control. in the case of software activation, a software-activated data transfer end interrupt (swdtend) is generated. when the disel bit is 1 and one data transfer has been completed, or the specified number of transfers have been completed, after data transfer ends the swdte bit is held at 1 and an swdtend interrupt is generated. the interrupt handling routine will then clear the swdte bit to 0. when the dtc is activated by software, an swdtend interrupt is not generated during a data transfer wait or during data transfer even if the swdte bit is set to 1. 9.5.6 operation timing figures 9.10 to 9.12 show the dtc operation timings. dtc activation request dtc request address vector read readwrite data transfer transfer information write transfer information read figure 9.10 dtc operation timing (example in normal mode or repeat mode)
rev. 2.00, 05/03, page 277 of 846 dtc activation request dtc request address vector read readwrite readwrite data transfer transfer information write transfer information read figure 9.11 dtc operation timing (example of block transfer mode,with block size of 2) dtc activation request dtc request address vector read readwrite readwrite data transfer data transfer transfer information write transfer information write transfer information read transfer information read figure 9.12 dtc operation timing (example of chain transfer) 9.5.7 number of dtc execution states table 9.5 lists execution status for a single dtc data transfer, and table 9.6 shows the number of states required for each execution status. table 9.5 dtc execution status mode vector read i register information read/write j data read k data write l internal operations m normal1 6 113 repeat 1 6 1 1 3 block transfer 1 6 n n 3 legend n: block size (initial setting of crah and cral)
rev. 2.00, 05/03, page 278 of 846 table 9.6 number of states required for each execution status object to be accessed on- chip ram on- chip rom internal i/o registers external devices * bus width 32 16 8 16 8 16 access states 1 1 2 2 2 3 2 3 vector read s i ? 1 ?? 4 6 + 2m 2 3 + m execution status register information read/write s j 1 ????? ?? byte data read s k 1 1 2 2 2 3 + m 2 3 + m word data read s k 1 1 42 46 + 2m2 3 + m byte data write s l 1 1 2 2 2 3 + m 2 3 + m word data write s l 1 1 42 46 + 2m2 3 + m internal operation s m 1 legend: m: the number of wait states for accessing external devices. note: * cannot be used in this lsi. the number of execution states is calculated from using the formula below. note that is the sum of all transfers activated by one activation event (the number in which the chne bit is set to 1, plus 1). number of execution states = i s i + (j s j + k s k + l s l ) + m s m for example, when the dtc vector address table is located in the on-chip rom, normal mode is set, and data is transferred from on-chip rom to an internal i/o register, then the time required for the dtc operation is 13 states. the time from activation to the end of the data write is 10 states.
rev. 2.00, 05/03, page 279 of 846 9.6 procedures for using dtc 9.6.1 activation by interrupt the procedure for using the dtc with interrupt activation is as follows: 1. set the mra, mrb, sar, dar, cra, and crb register information in on-chip ram. 2. set the start address of the register information in the dtc vector address. 3. set the corresponding bit in dtcer to 1. 4. set the enable bits for the interrupt sources to be used as the activation sources to 1. the dtc is activated when an interrupt used as an activation source is generated. 5. after one data transfer has been completed, or after the specified number of data transfers have been completed, the dtce bit is cleared to 0 and a cpu interrupt is requested. if the dtc is to continue transferring data, set the dtce bit to 1. 9.6.2 activation by software the procedure for using the dtc with software activation is as follows: 1. set the mra, mrb, sar, dar, cra, and crb register information in on-chip ram. 2. set the start address of the register information in the dtc vector address. 3. check that the swdte bit is 0. 4. write 1 to swdte bit and the vector number to dtvecr. 5. check the vector number written to dtvecr. 6. after one data transfer has been completed, if the disel bit is 0 and a cpu interrupt is not requested, the swdte bit is cleared to 0. if the dtc is to continue transferring data, set the swdte bit to 1. when the disel bit is 1, or after the specified number of data transfers have been completed, the swdte bit is held at 1 and a cpu interrupt is requested.
rev. 2.00, 05/03, page 280 of 846 9.7 examples of use of the dtc 9.7.1 normal mode an example is shown in which the dtc is used to receive 128 bytes of data via the sci. 1. set mra to a fixed source address (sm1 = sm0 = 0), incrementing destination address (dm1 = 1, dm0 = 0), normal mode (md1 = md0 = 0), and byte size (sz = 0). the dts bit can have any value. set mrb for one data transfer by one interrupt (chne = 0, disel = 0). set the sci rdr address in sar, the start address of the ram area where the data will be received in dar, and 128 (h'0080) in cra. crb can be set to any value. 2. set the start address of the register information at the dtc vector address. 3. set the corresponding bit in dtcer to 1. 4. set the sci to the appropriate receive mode. set the rie bit in scr to 1 to enable the reception complete (rxi) interrupt. since the generation of a receive error during the sci reception operation will disable subsequent reception, the cpu should be enabled to accept receive error interrupts. 5. each time the reception of one byte of data has been completed on the sci, the rdrf flag in ssr is set to 1, an rxi interrupt is generated, and the dtc is activated. the receive data is transferred from rdr to ram by the dtc. dar is incremented and cra is decremented. the rdrf flag is automatically cleared to 0. 6. when cra becomes 0 after the 128 data transfers have been completed, the rdrf flag is held at 1, the dtce bit is cleared to 0, and an rxi interrupt request is sent to the cpu. the interrupt handling routine will perform wrap-up processing. 9.7.2 software activation an example is shown in which the dtc is used to transfer a block of 128 bytes of data by means of software activation. the transfer source address is h'1000 and the destination address is h'2000. the vector number is h'60, so the vector address is h'04c0. 1. set mra to incrementing source address (sm1 = 1, sm0 = 0), incrementing destination address (dm1 = 1, dm0 = 0), block transfer mode (md1 = 1, md0 = 0), and byte size (sz = 0). the dts bit can have any value. set mrb for one block transfer by one interrupt (chne = 0). set the transfer source address (h'1000) in sar, the destination address (h'2000) in dar, and 128 (h'8080) in cra. set 1 (h'0001) in crb. 2. set the start address of the register information at the dtc vector address (h'04c0). 3. check that the swdte bit in dtvecr is 0. check that there is currently no transfer activated by software. 4. write 1 to the swdte bit and the vector number (h'60) to dtvecr. the write data is h'e0.
rev. 2.00, 05/03, page 281 of 846 5. read dtvecr again and check that it is set to the vector number (h'60). if it is not, this indicates that the write failed. this is presumably because an interrupt occurred between steps 3 and 4 and led to a different software activation. to activate this transfer, go back to step 3. 6. if the write was successful, the dtc is activated and a block of 128 bytes of data is transferred. 7. after the transfer, an swdtend interrupt occurs. the interrupt handling routine should clear the swdte bit to 0 and perform other wrap-up processing. 9.8 usage notes 9.8.1 module stop mode setting dtc operation can be disabled or enabled using the module stop control register. the initial setting is for dtc operation to be enabled. register access is disabled by setting module stop mode. module stop mode cannot be set during dtc operation. for details, refer to section 23, power-down modes. 9.8.2 on-chip ram the mra, mrb, sar, dar, cra, and crb registers are all located in on-chip ram. 9.8.3 dtce bit setting for dtce bit setting, use bit manipulation instructions such as bset and bclr. if all interrupts are masked, multiple activation sources can be set at one time (only at the initial setting) by writing data after executing a dummy read on the relevant register.
rev. 2.00, 05/03, page 282 of 846
rev. 2.00, 05/03, page 283 of 846 section 10 i/o ports table 10.1 summarizes the port functions. the pins of each port also have other functions such as input/output or interrupt input pins of on-chip peripheral modules. each i/o port includes a data direction register (ddr) that controls input/output, a data register (dr) that stores output data, and a port register (port) used to read the pin states. the input-only ports do not have dr and ddr registers. ports a to e have a built-in input pull-up mos function and an input pull-up mos control register (pcr) to control the on/off state of input pull-up mos respectively. ports 3 and a include an open-drain control register (odr) that controls the on/off state of the output buffer pmos respectively. all the i/o ports can drive a single ttl load and a 30 pf capacitive load. the p34 and p35 pins on port 3 are nmos push pull outputs. * the irq pin is schmitt-trigger input. note: * supported only by the h8s/2239 group and h8s/2238 group.
rev. 2.00, 05/03, page 284 of 846 table 10.1 port functions port description mode4 mode5 mode 6 mode 7 input/output and output type p17/tiocb2/tclkd p17/tiocb2/tclkd p16/tioca2/ irq1 p16/tioca2/ irq1 p15/tiocb1/tclkc p15/tiocb1/tclkc p14/tioca1/ irq0 p14/tioca1/ irq0 p13/tiocd0/tclkb/a23 p13/tiocd0/tclkb p12/tiocc0/tclka/a22 p12/tiocc0/tclka p11/tiocb0/ dack1 * 3 /a21 p11/tiocb0/ dack1 * 3 port 1 general i/o port also functioning as tpu_2, tpu_1, and tpu_0 i/o pins, interrupt input pins, address output pins, and dmac output pins p10/tioca0/ dack0 * 3 /a20 p10/tioca0/ dack0 * 3 schmitt-trigger input ( irq0 , irq1 ) p36 p35/sck1/scl0 * 1 / irq5 p34/rxd1/sda0 * 1 p33/txd1/sda0 * 1 p32/sck0/sda1 * 1 / irq4 p31/rxd0 port 3 general input port also functioning as i 2 c bus interface * 1 i/o pins, sci_1 and sci_0 i/o pins, and interrupt input pins p30/txd0 specifiable of open drain output schmitt-trigger input ( irq4 , irq5 ) nmos push-pull output * 1 (scl0, sda0) p47/an7 p46/an6 p45/an5 p44/an4 p43/an3 p42/an2 p41/an1 port 4 general input port also functioning as a/d converter analog inputs p40/an0 p77/txd3 p76/rxd3 p75/tmo3 * 1 /sck3 p74/tmo2 * 1 / mres p73/tmo1/ tend1 * 3 / cs7 p73/tmo1/ tend1 * 3 p72/tmo0/ tend0 * 3 / cs6 p72/tmo0/ tend0 * 3 p71/tmri23 * 1 /tmci23 * 1 / dreq1 * 3 / cs5 p71/tmri23 * 1 /tmci23 * 1 / dreq1 * 3 port 7 general input port also functioning as sci_3 i/o pins, tmr_3 * 1 , tmr_2 * 1 , tmr_1, tmr_0 i/o pins, and dmac i/o pins p70/tmri01/tmci01/ dreq0 * 3 / cs4 p70/tmri01/tmci01/ dreq0 * 3
rev. 2.00, 05/03, page 285 of 846 port description mode 4 mode5 mode 6 mode 7 input/output and output type p97/da1 * 2 port 9 general input port also functioning as a/d converter * 2 analog input pins p96/ da0 * 2 pa3/a19/sck2 * 2 pa3/ sck2 * 2 pa2/a18/rxd2 * 2 pa2/ rxd2 * 2 pa1/a17/txd2 * 2 pa1/ txd2 * 2 port a general i/o port also functioning as sci_2 * 2 i/o pins and address output pins pa0/a16 pa0 specifiable of built-in input pull-up mos open drain output pb7/a15/tiocb5 * 2 pb7/ tiocb5 * 2 pb6/a14/tioca5 * 2 pb6/ tioca5 * 2 pb5/a13/tiocb4 * 2 pb5/ tiocb4 * 2 pb4/a12/tioca4 * 2 pb4/ tioca4 * 2 pb3/a11/tiocd3 * 2 pb3/ tiocd3 * 2 pb2/a10/tiocc3 * 2 pb2/ tiocc3 * 2 pb1/a9/tiocb3 * 2 pb1/ tiocb3 * 2 port b general i/o port also functioning as tpu_5 * 2 , tpu_4 * 2 , tpu_3 * 2 i/o pins, and address output pins pb0/a8/tioca3 * 2 pb0/ tioca3 * 2 built-in input pull-up mos a7 pc7/a7 pc7 a6 pc6/a6 pc6 a5 pc5/a5 pc5 a4 pc4/a4 pc4 a3 pc3/a3 pc3 a2 pc2/a2 pc2 a1 pc1/a1 pc1 port c general i/o port also functioning as address output pins a0 pc0/a0 pc0 built-in input pull-up mos d15 pd7 d14 pd6 d13 pd5 d12 pd4 d11 pd3 d10 pd2 d9 pd1 port d general i/o port also functioning as data i/o pins d8 pd0 built-in input pull-up mos
rev. 2.00, 05/03, page 286 of 846 port description mode 4 mode5 mode 6 mode 7 input/output and output type pe7/d7 pe7 pe6/d6 pe6 pe5/d5 pe5 pe4/d4 pe4 pe3/d3 pe3 pe2/d2 pe2 pe1/d1 pe1 port e general i/o port also functioning as data i/o pins pe0/d0 pe0 built-in input pull-up mos pf7/ pf7/ as pf6 rd pf5 hwr pf4 pf3/ lwr / adtrg / irq3 pf3/ adtrg / irq3 pf2/ wait pf2 pf1/ back /buzz pf1/buzz port f general i/o port also functioning as interrupt input pins, bus control i/o pins, an a/d converter input pins and wdt output pins pf0/ breq / irq2 pf0/ irq2 schmit-trigger input ( irq2 , irq3 ) pg4/ cs0 pg4 pg3/ cs1 pg3 pg2/ cs2 pg2 pg1/ cs3 / irq7 pg1/ irq7 port g general i/o port also functioning as interrupt input pins pg0/ irq6 pg0/ irq6 schmit-trigger input ( irq6 , irq7 ) notes: * 1 not available in the h8s/2237 group and h8s/2227 group. * 2 not available in the h8s/2227 group. * 3 supported only by the h8s/2239 group.
rev. 2.00, 05/03, page 287 of 846 10.1 port 1 port 1 is an 8-bit i/o port and has the following registers. ? port 1 data direction register (p1ddr) ? port 1 data register (p1dr) ? port 1 register (port1) 10.1.1 port 1 data direction register (p1ddr) p1ddr specifies input or output of the port 1 pins using the individual bits. p1ddr cannot be read; if it is, an undefined value will be read. bit bit name initial value r/wdescription 7 p17ddr 0 w 6 p16ddr 0 w 5 p15ddr 0 w 4 p14ddr 0 w 3 p13ddr 0 w 2 p12ddr 0 w 1 p11ddr 0 w 0 p10ddr 0 w when a pin is specified as a general purpose i/o port, setting this bit to 1 makes the corresponding port 1 pin an output pin. clearing this bit to 0 makes the pin an input pin.
rev. 2.00, 05/03, page 288 of 846 10.1.2 port 1 data register (p1dr) p1dr stores output data for port 1 pins. bit bit name initial value r/wdescription 7 p17dr 0 r/w 6 p16dr 0 r/w 5 p15dr 0 r/w 4 p14dr 0 r/w 3 p13dr 0 r/w 2 p12dr 0 r/w 1 p11dr 0 r/w 0 p10dr 0 r/w output data for a pin is stored when the pin is specified as a general purpose i/o port. 10.1.3 port 1 register (port1) port1 shows the pin states. this register cannot be modified. bit bit name initial value r/wdescription 7p17 * r 6p16 * r 5p15 * r 4p14 * r 3p13 * r 2p12 * r 1p11 * r 0p10 * r if a port 1 read is performed while p1ddr bits are set to 1, the p1dr values are read. if a port 1 read is performed while p1ddr bits are cleared to 0, the pin states are read. note: * determined by the states of pins p17 to p10.
rev. 2.00, 05/03, page 289 of 846 10.1.4 pin functions port 1 pins also function as tpu i/o pins (tpu_0, tpu_1, and tpu_2), dmac * output pins, interrupt input pins and address output pins. values of the register and pin functions are shown below. note: * supported only by the h8s/2239 group. ? p17/tiocb2/tclkd the pin functions are switched as shown below according to the combination of the tpu channel 2 setting, tpsc2 to tps0 bits in tcr_0 and tcr_5, and the p17ddr bit. tpu channel 2 setting * 1 output input or initial value p17ddr ? 01 p17 input pin p17 output pin tiocb2 output pin tiocb2 input pin * 2 pin functions tclkd input pin * 3 notes: * 1 for the setting of the tpu channel, see section 11, 16-bit timer pulse unit (tpu). * 2 this pin functions as tiocb2 input when tpu channel 2 timer operating mode is set to normal operating or phase counting mode and iob3 in tior_2 is set to 1. * 3 this pin functions as tclkd input when tpsc2 to tpsc0 in tcr_0 or tcr_5 are set to 111 or when channels 2 and 4 are set to phase counting mode. ? p16/tioca2/ irq1 the pin functions are switched as shown below according to the combination of the tpu channel 2 setting and the p16ddr bit. tpu channel 2 setting * 1 output input or initial value p16ddr ? 01 p16 input pin p16 output pin tioca2 output pin tioca2 input pin * 2 pin functions irq1 input pin * 3 notes: * 1 for the setting of the tpu channel, see section 11, 16-bit timer pulse unit (tpu). * 2 this pin functions as tioca2 input when tpu channel 2 timer operating mode is set to normal operating or phase counting mode and ioa3 in tior_2 is 1. * 3 when this pin is used as an external interrupt pin, do not specify other functions.
rev. 2.00, 05/03, page 290 of 846 ? p15/tiocb1/tclkc the pin functions are switched as shown below according to the combination of the tpu channel 1 setting, tpsc2 to tps0 bits in tcr_0, tcr_2, tcr_4, and tcr_5 and the p15ddr bit. tpu channel 1 setting * 1 output input or initial value p15ddr ? 01 p15 input pin p15 output pin tiocb1 output pin tiocb1 input pin * 2 pin functions tclkc input pin * 3 notes: * 1 for the setting of the tpu channel, see section 11, 16-bit timer pulse unit (tpu). * 2 this pin functions as tiocb1 input when tpu channel 1 timer operating mode is set to normal operating or phase counting mode and iob3 to iob0 in tior_1 are set to10xx. * 3 this pin functions as tclkc input when tpsc2 to tpsc0 in tcr_0 or tcr_2 are set to 110 or tpsc2 to tpsc0 in tcr_4 or tcr_0 are 101 or when channels 2 and 4 are set to phase counting mode. ? p14/tioca1/ irq0 the pin functions are switched as shown below according to the combination of the tpu channel 1 setting and the p14ddr bit. tpu channel 1 setting * 1 output input or initial value p14ddr ? 01 p14 input pin p14 output pin tioca1 output pin tioca1 input pin * 2 pin functions irq0 input pin * 3 notes: * 1 for the setting of the tpu channel, see section 11, 16-bit timer pulse unit (tpu). * 2 this pin functions as tioca1 input when tpu channel 1 timer operating mode is set to normal operating or phase counting mode and ioa3 to ioa0 in tior_1 are set to 10xx. * 3 when this pin is used as an external interrupt pin, do not specify other functions.
rev. 2.00, 05/03, page 291 of 846 ? p13/tiocd0/tclkb/a23 the pin functions are switched as shown below according to the combination of operating mode, the tpu channel 0 setting, tpsc2 to tpsc0 bits in tcr_0 to tcr_2, ae3 to ae0 bits in pfcr and the p13ddr bit. operating mode modes 4 to 6 mode 7 ae3 to ae0 b'1111 other than b'1111 ? tpu channel 0 setting * 1 ? output input or initial value output input or initial value p13ddr ?? 01 ? 01 p13 input pin p13 output pin p13 input pin p13 output pin tiocd0 output pin tiocd0 input * 2 tiocd0 output pin tiocd0 input pin * 2 pin functions a23 output pin tclkb input pin * 3 tclkb input pin * 3 notes: * 1 for the setting of the tpu channel, see section 11, 16-bit timer pulse unit (tpu). * 2 this pin functions as tiocd0 input when tpu channel 0 timer operating mode is set to normal operating and iod3 to iod0 in tiorl_0 are set to 10xx. * 3 this pin functions as tclkb input when tpsc2 to tpsc0 in any of tcr_0 to tcr_2 are set to 101 or when channels 1 and 5 are set to phase counting mode. ? p12/tiocc0/tclka/a22 the pin functions are switched as shown below according to the combination of operating mode, the tpu channel 0 setting, tpsc2 to tpsc0 bits in tcr_0 to tcr_5, ae3 to ae0 bits in pfcr, and the p12ddr bit. operating mode modes 4 to 6 mode 7 ae3 to ae0 b'1111 other than b'1111 ? tpu channel 0 setting * 1 ? output input or initial value output input or initial value p12ddr ?? 01 ? 01 p12 input pin p12 output pin p12 input pin p12 output pin tiocc0 output pin tiocc0 input pin * 2 tiocc0 output pin tiocc0 input pin * 2 pin functions a22 output pin tclka input pin * 3 tclka input pin * 3 notes: * 1 for the setting of the tpu channel, see section 11, 16-bit timer pulse unit (tpu). * 2 this pin functions as tiocc0 input when tpu channel 0 timer operating mode is set to normal operating and ioc3 to ioc0 in tiorl_0 are set to 10xx. * 3 this pin functions as tclkb input when tpsc2 to tpsc0 in any of tcr_0 to tcr_5 are set to 100 or when channels 1 and 5 are set to phase counting mode.
rev. 2.00, 05/03, page 292 of 846 ? p11/tiocb0/ dack1 /a21 the pin functions are switched as shown below according to the combination of operating mode, the tpu channel 0 setting, ae3 to ae0 bits in pfcr, the sae1 bit * 3 in dmabcrh, and the p11ddr bit. operating mode modes 4 to 6 mode 7 ae3 to ae0 b'111x other than b'111x ? sae1 * 3 ? 01 ? tpu channel 0 setting * 1 ? output input or initial value ? output input or initial value p11ddr ?? 01 ?? 01 p11 input pin p11 output pin dack1 * 3 output pin p11 input pin p11 output pin pin functions a21 output pin tiocb0 output pin tiocb0 input pin * 2 tiocb0 output pin tiocb0 input pin * 2 notes: * 1 for the setting of the tpu channel, see section 11, 16-bit timer pulse unit (tpu). * 2 this pin functions as tiocb0 input when tpu channel 0 timer operating mode is set to normal operating and iob3 to iob0 in tiorh_0 are set to 10xx. * 3 supported only by the h8s/2239 group. ? p10/tioca0/ dack0 /a20 the pin functions are switched as shown below according to the combination of operating mode, the tpu channel 0 setting, ae3 to ae0 bits in pfcr, the sae0 bit * 3 in dmabcrh, and the p10ddr bit. operating mode modes 4 to 6 mode 7 ae3 to ae0 b'1101 or b'111x other than (b'1101 or b'111x) ? sae0 * 3 ? 01 ? tpu channel 0 setting * 1 ? output input or initial value ? output input or initial value p10ddr ?? 01 ?? 01 p10 input pin p10 output pin dack0 * 3 output pin p10 input pin p10 output pin pin functions a20 output pin tioca0 output pin tioca0 input pin * 2 tioca0 output pin tioca0 input pin * 2 notes: * 1 for the setting of the tpu channel, see section 11, 16-bit timer pulse unit (tpu). * 2 this pin functions as tioca0 input when tpu channel 0 timer operating mode is set to normal operating and ioa3 to ioa0 in tiorh_0 are set to 10xx. * 3 supported only by the h8s/2239 group.
rev. 2.00, 05/03, page 293 of 846 10.2 port 3 port 3 is a general 7-bit i/o port and has the following registers. ? port 3 data direction register (p3ddr) ? port 3 data register (p3dr) ? port 3 register (port3) ? port 3 open drain control register (p3odr) 10.2.1 port 3 data direction register (p3ddr) p3ddr specifies input or output of the port 3 pins using the individual bits. p3ddr cannot be read; if it is, an undefined value will be read. bit bit name initial value r/wdescription 7 undefined reserved these bits are always read as undefined value. 6 p36ddr 0 w 5 p35ddr 0 w 4 p34ddr 0 w 3 p33ddr 0 w 2 p32ddr 0 w 1 p31ddr 0 w 0 p30ddr 0 w when a pin is specified as a general purpose i/o port, setting this bit to 1 makes the corresponding port 3 pin an output port. clearing this bit to 0 makes the pin an input port.
rev. 2.00, 05/03, page 294 of 846 10.2.2 port 3 data register (p3dr) p3dr stores output data for port 3 pins. bit bit name initial value r/wdescription 7 undefined reserved these bits are always read as undefined value. 6 p36dr 0 r/w 5 p35dr 0 r/w 4 p34dr 0 r/w 3 p33dr 0 r/w 2 p32dr 0 r/w 1 p31dr 0 r/w 0 p30dr 0 r/w output data for a pin is stored when the pin is specified as a general purpose i/o port. 10.2.3 port 3 register (port3) port3 shows the pin states. this register cannot be modified. bit bit name initial value r/wdescription 7 undefined reserved these bits are always read as undefined value. 6p36 * r 5p35 * r 4p34 * r 3p33 * r 2p32 * r 1p31 * r 0p30 * r if a port 3 read is performed while p3ddr bits are set to 1, the p3dr values are read. if a port 3 read is performed while p3ddr bits are cleared to 0, the pin states are read. note: * determined by the states of pins p36 to p30.
rev. 2.00, 05/03, page 295 of 846 10.2.4 port 3 open drain control register (p3odr) p3odr controls on/off state of the pmos for port 3 pins. bit bit name initial value r/wdescription 7 undefined reserved these bits are always read as undefined value. 6 p36odr 0 r/w 5 p35odr 0 r/w 4 p34odr 0 r/w 3 p33odr 0 r/w 2 p32odr 0 r/w 1 p31odr 0 r/w 0 p30odr 0 r/w when each of p36odr and p33odr to p30odr bits is set to 1, the corresponding pins p36 and p33 to p30 function as nmos open drain outputs. when cleared to 0, the corresponding pins function as cmos outputs. when each of p35odr and p34odr bits is set to 1, the corresponding pins p35 and p34 function as open drain outputs. when they are cleared to 0, the corresponding pins function as nmos push pull outputs. * note: * when they are cleared to 0, the corresponding pins function as cmos outputs in the h8s/2237 group and h8s/2227 group. 10.2.5 pin functions the port 3 pins also function as sci i/o input pins, i 2 c bus interface * i/o pins, and as external interrupt input pins. as shown in figure 10.1, when the pins p34, p35, scl0 or sda0 type open drain output is used, a bus line is not affected even if the power supply for this lsi fails. use (a) type open drain output when using a bus line having a state in which the power is not supplied to this lsi. note: * the i 2 c bus interface is not available in the h8s/2237 group and h8s/2227 group. output 0 (a) open drain output type for p34, p35, sclo and sda0 pins nmos off output (b) open drain output type for p33 to p30, scl1 and sda1 pins pmos off input 1 input figure 10.1 types of open drain outputs
rev. 2.00, 05/03, page 296 of 846 ? p36 the pin functions are switched as shown below according to the p36ddr bit condition. p36ddr 0 1 pin functions p36 input pin p36 output pin * note: * when p36odr is set to 1, functions as nmos open drain output. ? p35/sck1/scl0/ irq5 the pin functions are switched as shown below according to the combination of the ice bit * 3 in iccr_0 of iic_0, the c/ a bit in smr_1 of sci_1, cke0 and cke1 bits in scr_1 and the p35ddr bit. to use this port as scl0 i/o pin, clear the c/ a bit, cke0 bit, and cke1 bit to 0. the scl0 functions as nmos open drain output and the pin can drive bus directly. when this pin is specified as the p35 output pin or sck1 output pin, it functions as nmos push-pull output. * 4 ice * 3 01 cke1 0 1 0 c/ a 01 ? 0 cke0 0 1 ?? 0 p35ddr 0 1 ???? p35 input pin p35 output pin * 1 sck1 output pin * 1 sck1 output pin * 1 sck1 i/o pin sclo i/o pin pin functions irq5 input pin * 2 notes: * 1 when the p35odr is set to 1, it functions as nmos open drain output. * 2 when this pin is used as an external interrupt pin, do not specify other functions. * 3 not available in the h8s/2237 group and h8s/2227 group. * 4 it functions as cmos output in the h8s/2237 group and h8s/2227 group.
rev. 2.00, 05/03, page 297 of 846 ? p34/rxd1/sda0 the pin functions are switched as shown below according to the combination of the ice bit * 2 in iccr_0 of iic_0, the re bit in scr_1 of sci_1 and the p34ddr bit. when this pin is specified as p34 output pin, it functions as nmos push-pull output. * 3 the sda0 also functions as nmos open drain outputs and can drive bus directly. ice * 2 01 re 01 ? p34ddr 01 ?? pin functions p34 input pin p34 output pin * 1 rxd1 input pin sda0 i/o pin notes: * 1 when p34odr is set to 1, it functions as nmos open drain output. * 2 not available in theh8s/2237 group and h8s/2227 group. * 3 it functions as cmos output in the h8s/2237 group and h8s/2227 group. ? p33/txd1/scl1 the pin functions are switched as shown below according to the combination of the ice bit * 2 in iccr_1 of iic_1, the te bit in scr_1 of sci_1 and the p33ddr bit. scl1 functions as nmos open drain output and can drive bus directly. ice * 2 01 te 01 ? p33ddr 01 ?? pin functions p33 input pin p33 output pin * 1 txd1 output pin * 1 scl1 i/o pin notes: * 1 when p33odr is set to 1, it functions as nmos open drain output. * 2 not available in the h8s/2237 group and h8s/2227 group.
rev. 2.00, 05/03, page 298 of 846 ? p32/sck0/sda1/ irq4 the pin functions are switched as shown below according to the combination of the ice bit * 3 in iccr_1 of iic_1, the c/ a bit in smr_0 of sci_0, cke0 and cke1 bits in scr and the p32ddr bit. to use this port as sda1 input pin, clear the c/ a bit, cke0 bit, and cke1 bit to 0. the sda1 functions as nmos open drain output and can drive bus directly. ice * 3 01 cke1 0 1 0 c/ a 01 ? 0 cke0 0 1 ?? 0 p32ddr 0 1 ???? p32 input pin p32 output pin * 1 sck0 output pin * 1 sck0 output pin * 1 sck0 input pin sda1 i/o pin pin functions irq4 input * 2 notes: * 1 when p32odr is set to 1, it functions as nmos open drain output. * 2 when this pin is used as an external interrupt pin, do not specify other functions. * 3 not available in the h8s/2237 group and h8s/2227 group. ? p31/rxd0 the pin functions are switched as shown below according to the combination of the re bit in scr_0 of sci_0 and the p31ddr bit. re 01 p31ddr 01 ? pin functions p31 input pin p31 output pin * rxd0 input note: * when p31odr is set to 1, it functions as nmos open drain output.
rev. 2.00, 05/03, page 299 of 846 ? p30/txd0 the pin functions are switched as shown below according to the combination of the te bit in scr_0 of sci_0 and the p30ddr bit. te 01 p30ddr 01 ? pin functions p30 input pin p30 output pin * txd0 output * note: * when p30odr is set to 1, it functions as nmos open drain output. 10.3 port 4 port 4 is an 8-bit i/o port and has the following register. ? port 4 register (port4) 10.3.1 port 4 register (port4) port4 shows port 4 pin states. bit bit name initial value r/wdescription 7p47 * r 6p46 * r 5p45 * r 4p44 * r 3p43 * r 2p42 * r 1p41 * r 0p40 * r the pin states are always read when a port 4 read is performed. note: * determined by the states of pins p47 to p40. 10.3.2 pin functions port 4 pins also function as a/d converter analog input pins (an7 to an0).
rev. 2.00, 05/03, page 300 of 846 10.4 port 7 port 7 is an 8-bit i/o port and has the following registers. ? port 7 data direction register (p7ddr) ? port 7 data register (p7dr) ? port 7 register (port7) 10.4.1 port 7 data direction register (p7ddr) p7ddr specifies input or output of the port 7 pins using the individual bits. p7ddr cannot be read; if it is, an undefined value will be read. bit bit name initial value r/wdescription 7 p77ddr 0 w 6 p76ddr 0 w 5 p75ddr 0 w 4 p74ddr 0 w 3 p73ddr 0 w 2 p72ddr 0 w 1 p71ddr 0 w 0 p70ddr 0 w when a pin is specified as a general purpose i/o port, setting this bit to 1 makes the corresponding port 7 pin an output pin. clearing this bit to 0 makes the pin an input pin. 10.4.2 port 7 data register (p7dr) p7dr stores output data for port 7 pins. bit bit name initial value r/wdescription 7 p77dr 0 r/w 6 p76dr 0 r/w 5 p75dr 0 r/w 4 p74dr 0 r/w 3 p73dr 0 r/w 2 p72dr 0 r/w 1 p71dr 0 r/w 0 p70dr 0 r/w output data for a pin is stored when the pin is specified as a general purpose i/o port.
rev. 2.00, 05/03, page 301 of 846 10.4.3 port 7 register (port7) port7 shows the pin states. this register cannot be modified. bit bit name initial value r/wdescription 7p77 * r 6p76 * r 5p75 * r 4p74 * r 3p73 * r 2p72 * r 1p71 * r 0p70 * r if a port 1 read is performed while p7ddr bits are set to 1, the p7dr values are read. if a port 1 read is performed while p7ddr bits are cleared to 0, the pin states are read. note: * determined by the states of pins p77 to p70. 10.4.4 pin functions port 7 pins also function as tmr i/o pins (tmr_0, tmr_1, tmr_2 * 1 , and tmr_3 * 1 ), bus control output pin, sci i/o pins, and dmac * 2 i/o pins. values of the register and pin functions are shown below. notes: *1 not available in the h8s/2237 group and h8s/2227 group. *2 supported only by the h8s/2239 group. ? p77/txd3 the pin functions are switched as shown below according to the combination of the te bit in scr_3 of sci_3 and the p77ddr bit. te 0 1 p77ddr 0 1 ? pin functions p77 input pin p77 output pin txd3 output
rev. 2.00, 05/03, page 302 of 846 ? p76/rxd3 the pin functions are switched as shown below according to the combination of the re bit in scr_3 of sci_3 and the p76ddr bit. re 0 1 p76ddr 0 1 ? pin functions p76 input pin p76 output pin rxd3 input ? p75/tmo3/sck3 the pin functions are switched as shown below according to the combination of os3 to os0 bits in tcsr_3 of tmr_3, cke1 and cke0 bits in scr_3 of sci_3, the c/ a bit in smr_3, and the p75ddr bit. os3 to os0 all bits are 0 any bit is 1 cke1 0 1 ? c/ a 01 ?? cke0 0 1 ??? p75ddr 0 1 ???? pin functions p75 input pin p75 output pin sck3 output pin sck3 output pin sck3 input pin tmo3 output pin ? p74/tmo2/ mres the pin functions are switched as shown below according to the combination of os3 to os0 bits in tcsr_2 of tmr_2, the mrese bit in syscr, and the p74ddr bit. mrese 0 1 os3 to os0 all bits are 0 any bit is 1 ? p74ddr 0 1 ? 0 pin functions p74 input pin p74 output pin tmo2 output mres input
rev. 2.00, 05/03, page 303 of 846 ? p73/tmo1/ tend1 / cs7 the pin functions are switched as shown below according to the combination of operating mode, the tee1 bit in dmatcr of dmac, os3 to os0 bits in tcsr_1 of tmr_1 and the p73ddr bit. operating mode modes 4 to 6 mode 7 tee1 * 0101 os3 to os0 all bits are 0 any bit is 1 ? all bits are 0 any bit is 1 ? p73ddr 0 1 ?? 01 ?? pin functions p73 input pin cs7 output pin tmo1 output pin tend1 * output pin p73 input pin p73 output pin tmo1 output pin tend1 output pin note: * supported only by the h8s/2239 group. ? p72/tmo0/ tend0 / cs6 the pin functions are switched as shown below according to the combination of operating mode the tee0 bit in dmatcr of dmac, os3 to os0 bits in tcsr_0 of tmr_0, and the p72ddr bit. operating mode modes 4 to 6 mode 7 tee0 * 0101 os3 to os0 all bits are 0 any bit is 1 ? all bits are 0 any bit is 1 ? p72ddr 0 1 ??? ?? pin functions p72 input pin cs6 output pin tmo0 output pin tend0 * output pin p72 input pin p72 output pin tmo0 output pin tend0 output pin note: * supported only by the h8s/2239 group. ? p71/tmri23/tmci23/ dreq1 / cs5 the pin functions are switched as shown below according to the combination of operating mode and the p71ddr bit. operating mode modes 4 to 6 mode 7 p71ddr0101 p71 input pin cs5 output pin p71 input pin p71 output pin pin functions tmri23, tmci23, dreq1 * input pin ? tmri23, tmci23, dreq1 input pin note: * supported only by the h8s/2239 group.
rev. 2.00, 05/03, page 304 of 846 ? p70/tmri01/tmci01/ dreq0 / cs4 the pin functions are switched as shown below according to the combination of operating mode and the p70ddr bit. operating mode modes 4 to 6 mode 7 p70ddr0101 p70 input pin cs4 output pin p70 input pin p70 output pin pin functions tmri01,tmci01, dreq0 * input pin ? tmri01,tmci01, dreq0 input pin note: * supported only by the h8s/2239 group. 10.5 port 9 port 9 is a 2-bit input-only port and has the following register. ? port 9 register (port9) 10.5.1 port 9 register (port9) port9 shows port 9 pin states. this register cannot be modified. bit bit name initial value r/wdescription 7p97 ? * r 6p96 ? * r the pin states are always read when these bits are read. 5 to 0 ?? r reserved these bits are always read as undefined value. note: * determined by the states of pins p97 and p96. 10.5.2 pin functions port 9 pins also function as d/a converter analog output pins (da0 and da1) * . note: * not available in the h8s/2227 group.
rev. 2.00, 05/03, page 305 of 846 10.6 port a port a is a 4-bit i/o port and has the following register. ? port a data direction register (paddr) ? port a data register (padr) ? port a register (porta) ? port a pull-up mos control register (papcr) ? port a open drain control register (paodr) 10.6.1 port a data direction register (paddr) paddr specifies input or output the port a pins using the individual bits. paddr cannot be read; if it is, an undefined value will be read. bit bit name initial value r/wdescription 7 to 4 undefined reserved these bits are always read as undefined value. 3 pa3ddr 0 w 2 pa2ddr 0 w 1 pa1ddr 0 w 0 pa0ddr 0w when a pin is specified as a general purpose i/o port, setting this bit to 1 makes the corresponding port a pin an output pin. clearing this bit to 0 makes the pin an input pin. 10.6.2 port a data register (padr) padr stores output data for port a pins. bit bit name initial value r/wdescription 7 to 4 undefined reserved these bits are always read as undefined value. 3 pa3dr 0 r/w 2 pa2dr 0 r/w 1 pa1dr 0 r/w 0 pa0dr 0r/w output data for a pin is stored when the pin is specified as a general purpose i/o port.
rev. 2.00, 05/03, page 306 of 846 10.6.3 port a register (porta) porta shows the pin states. this register cannot be modified. bit bit name initial value r/wdescription 7 to 4 undefined reserved these bits are always read as undefined value. 3 pa3 * r 2 pa2 * r 1 pa1 * r 0 pa0 * r if this bit is read while paddr is set to 1, the padr value is read. if this bit is read while paddr is cleared, the pa3 pin states are read. note: * determined by the states of pa3 to pa0 pins. 10.6.4 port a pull-up mos control register (papcr) papcr controls the on/off state of port a input pull-up mos. bit bit name initial value r/wdescription 7 to 4 undefined reserved these bits are always read as undefined value. 3 pa3pcr 0 r/w 2 pa2pcr 0 r/w 1 pa1pcr 0 r/w 0 pa0pcr 0 r/w when the pin is specified as an input port, setting the corresponding bit to 1 turns on the input pull-up mos for that pin. 10.6.5 port a open drain control register (paodr) paodr selects output state of port a. bit bit name initial value r/wdescription 7 to 4 undefined reserved these bits are always read as undefined value. 3 paodr 0 r/w 2 paodr 0 r/w 1 paodr 0 r/w 0 paodr 0 r/w when this bit is set to 1, the corresponding port a pin functions as open drain output. when this bit is cleared to 0, the corresponding pin functions as cmos output.
rev. 2.00, 05/03, page 307 of 846 10.6.6 pin functions port a pins also function as an address output pin and sci_2 * i/o pins. the relationship between the value of register and pin is shown as below. note: * not available in the h8s/2227 group. ? pa3/a19/sck2 the pin functions are switched as shown below according to the combination of operating mode, ae3 to ae0 bits in pfcr, the c/ a in smr_2 of sci_2, cke0 and cke1 bits in scr_2, and the pa3ddr bit. operating mode modes 4 to 6 ae3 to ae0 b'11xx other than b'11xx cke1 ? 01 c/ a ? 01 cke0 ? 01 pa3ddr ? 01 pin functions a19 output pin pa3 input pin pa3 output pin * sck2 output pin * sck2 output pin * sck2 input pin operating mode mode 7 ae3 to ae0 ? cke1 0 1 c/ a 01 ? cke0 0 1 ?? pa3ddr 0 1 ??? pin functions pa3 input pin pa3 output pin * sck2 output pin * sck2 output pin * sck2 input pin note: * when pa3odr in paodr is set to 1, the corresponding pin functions as nmos open drain output.
rev. 2.00, 05/03, page 308 of 846 ? pa2/a18 /rxd2 the pin functions are switched as shown below according to the combination of operating mode, ae3 to ae0 bits in pfcr, the re bit in scr_2 of sci_2, and the pa2ddr bit. operating mode modes 4 to 6 mode 7 ae3 to ae0 b'1011 or b'11xx other than (b'1011 or b'11xx) ? re ? 0101 pa2ddr ? 01 ? 01 ? pin functions a18 output pin pa2 input pin pa2 output pin * rxd2 input pin pa2 input pin pa2 output pin * rxd2 input pin note: * when pa2odr in paodr is set to 1, the corresponding pin functions as nmos open drain output. ? pa1/a17 /txd2 the pin functions are switched as shown below according to the combination of operating mode, ae3 to ae0 bits in pfcr, the te bit in scr_2 of sci_2, and the pa1ddr bit. operating mode modes 4 to 6 mode 7 ae3 to ae0 b'101x or b'11xx other than (b'101x or b'11xx) ? te ? 01 0 1 pa1ddr ? 01 ? 01 ? pin functions a17 output pin pa1 input pin pa1 output pin * txd2 output pin * pa1 input pin pa1 output pin * txd2 output pin * note: * when pa1odr in paodr is set to 1, the corresponding pin functions as nmos open drain output.
rev. 2.00, 05/03, page 309 of 846 ? pa0/a16 the pin functions are switched as shown below according to the combination of operating mode, ae3 to ae0 bits in pfcr and the pa0ddr bit. operating mode modes 4 to 6 mode 7 ae3 to ae0 other than (b'0xxx or b'1000) b'0xxx or b'1000 ? pa0ddr ? 010 1 pin functions a16 output pin pa0 input pin pa0 output pin * pa0 input pin pa0 output pin * note: * when pa0odr in paodr is set to 1, the corresponding pin functions as nmos open drain output. 10.6.7 input pull-up mos states in port a port a has a built-in input pull-up mos function that can be controlled by software. input pull-up mos can be specified as on or off on an individual bit basis. table 10.2 summarizes the input pull-up mos states. table 10.2 input pull-up mos states in port a pin states power-on reset hardware standby mode manual reset software standby mode in other operations address output, port output, sci output off off off port input, sci input off off on/off on/off on/off legend off : input pull-up mos is always off. on/off : on when paddr = 0 and papcr = 1; otherwise off.
rev. 2.00, 05/03, page 310 of 846 10.7 port b port b is a 8-bit i/o port. port b has the following registers. ? port b data direction register (pbddr) ? port b data register (pbdr) ? port b register (portb) ? port b pull-up mos control register (pbpcr) 10.7.1 port b data direction register (pbddr) pbddr specifies input or output the port b pins using the individual bits. pbddr cannot be read; if it is, an undefined value will be read. bit bit name initial value r/wdescription 7 pb7ddr 0 w 6 pb6ddr 0 w 5 pb5ddr 0 w 4 pb4ddr 0 w 3 pb3ddr 0 w 2 pb2ddr 0 w 1 pb1ddr 0 w 0 pb0ddr 0 w when a pin is specified as a general purpose i/o port, setting the bit to 1 makes the corresponding port b pin an output pin. clearing the bit to 0 makes the pin an input pin.
rev. 2.00, 05/03, page 311 of 846 10.7.2 port b data register (pbdr) pbdr stores output data for port b pins. bit bit name initial value r/wdescription 7 pb7dr 0 r/w 6 pb6dr 0 r/w 5 pb5dr 0 r/w 4 pb4dr 0 r/w 3 pb3dr 0 r/w 2 pb2dr 0 r/w 1 pb1dr 0 r/w 0 pb0dr 0 r/w output data for a pin is stored when the pin is specified as a general purpose i/o port. 10.7.3 port b register (portb) portb shows the pin states and cannot be modified. bit bit name initial value r/wdescription 7 pb7 ? * r 6 pb6 ? * r 5 pb5 ? * r 4 pb4 ? * r 3 pb3 ? * r 2 pb2 ? * r 1 pb1 ? * r 0 pb0 ? * r if these bits are read while the corresponding pbddr bits are set to 1, the pbdr value is read. if these bits are read while pbddr bits are cleared to 0, the pin states are read. note: * determined by the states of pins pb7 to pb0.
rev. 2.00, 05/03, page 312 of 846 10.7.4 port b pull-up mos control register (pbpcr) pbpcr controls the on/off state of port b input pull-up mos. bit bit name initial value r/wdescription 7 pb7pcr 0 r/w 6 pb6pcr 0 r/w 5 pb5pcr 0 r/w 4 pb4pcr 0 r/w 3 pb3pcr 0 r/w 2 pb2pcr 0 r/w 1 pb1pcr 0 r/w 0 pb0pcr 0 r/w when a pin is specified as an input port, setting the corresponding bit to 1 turns on the input pull-up mos for that pin. 10.7.5 pin functions port b pins also function as tpu i/o pins (tpu_3 * , tpu_4 * , and tpu_5 * ) and address output pins. the values of register and pin functions are shown bellow. note: * not available in the h8s/2227 group. ? pb7/a15/tiocb5 the pin functions are switched as shown below according to the combination of operating mode, the tpu channel 5 setting, ae3 to ae0 bits in pfcr, and the pb7ddr bit. operating mode modes 4 to 6 mode 7 ae3 to ae0 b'1xxx other than b'1xxx ? tpu channel 5 setting * 1 ? output input or initial value output input or initial value pb7ddr ?? 01 ? 01 pb7 input pin pb7 output pin pb7 input pin pb7 output pin pin functions a15 output pin tiocb5 output pin tiocb5 input pin * 2 tiocb5 output pin tiocb5 input pin * 2 notes: * 1 for the setting of the tpu channel, see section 11, 16-bit timer pulse unit (tpu). * 2 this pin functions as tiocb5 input when tpu channel 5 timer operating mode is set to normal operating or phase counting mode and iob3 in tior_5 is set to 1.
rev. 2.00, 05/03, page 313 of 846 ? pb6/a14/tioca5 the pin functions are switched as shown below according to the combination of operating mode, the tpu channel 5 setting, ae3 to ae0 bits in pfcr, and the pb6ddr bit. operating mode modes 4 to 6 mode 7 ae3 to ae0 b'0111 or b'1xxx other than (b'0111 or b'1xxx) ? tpu channel 5 setting * 1 ? output input or initial value output input or initial value pb6ddr ?? 01 ? 01 pb6 input pin pb6 output pin pb6 input pin pb6 output pin pin functions a14 output pin tioca5 output pin tioca5 input pin * 2 tioca5 output pin tioca5 input pin * 2 notes: * 1 for the setting of the tpu channel, see section 11, 16-bit timer pulse unit (tpu). * 2 this pin functions as tioca5 input when tpu channel 5 timer operating mode is set to normal operating or phase counting mode and ioa3 in tior_5 is set to 1. ? pb5/a13/tiocb4 the pin functions are switched as shown below according to the combination of operating mode, the tpu channel 4 setting, ae3 to ae0 bits in pfcr, and the pb5ddr bit. operating mode modes 4 to 6 mode 7 ae3 to ae0 b'011x or b'1xxx other than (b'011x or b'1 xxx) ? tpu channel 4 setting * 1 ? output input or initial value output input or initial value pb5ddr ?? 01 ? 01 pb5 input pin pb5 output pin pb5 input pin pb5 output pin pin functions a13 output pin tiocb4 output pin tiocb4 input pin * 2 tiocb4 output pin tiocb4 input pin * 2 notes: * 1 for the setting of the tpu channel, see section 11, 16-bit timer pulse unit (tpu). * 2 this pin functions as tiocb4 input when tpu channel 4 timer operating mode is set to normal operating or phase counting mode and iob3 to iob0 in tior_4 are set to 10xx.
rev. 2.00, 05/03, page 314 of 846 ? pb4/a12/tioca4 the pin functions are switched as shown below according to the combination of operating mode, the tpu channel 4 setting, ae3 to ae0 bits in pfcr, and the pb4ddr bit. operating mode modes 4 to 6 mode 7 ae3 to ae0 other than (b'0100 or b'00xx) b'0100 or b'00xx ? tpu channel 4 setting * 1 ? output input or initial value output input or initial value pb4ddr ?? 01 ? 01 pb4 input pin pb4 output pin pb4 input pin pb4 output pin pin functions a12 output pin tioca4 output pin tioca4 input pin * 2 tioca4 output pin tioca4 input pin * 2 notes: * 1 for the setting of the tpu channel, see section 11, 16-bit timer pulse unit (tpu). * 2 this pin functions as tioca4 input when tpu channel 4 timer operating mode is set to normal operating or phase counting mode and ioa3 to ioa0 in tior_4 are set to 10xx. ? pb3/a11/tiocd3 the pin function is switched as shown below according to combination of the operating mode, the tpu channel 3 setting, ae3 to ae0 bits in pfcr, and the pb3ddr bit. operating mode modes 4 to 6 mode 7 ae3 to ae0 other than b'00xx b'00xx ? tpu channel 3 setting * 1 ? output input or initial value output input or initial value pb3ddr ?? 01 ? 01 pb3 input pin pb3 output pin pb3 input pin pb3 output pin pin functions a11 output pin tiocd3 output pin tiocd3 input pin * 2 tiocd3 output pin tiocd3 input pin * 2 notes: * 1 for the setting of the tpu channel, see section 11, 16-bit timer pulse unit (tpu). * 2 this pin functions as tiocd3 input when tpu channel 3 timer operating mode is set to normal operating and iod3 to iod0 in tiorl_3 are set to 10xx.
rev. 2.00, 05/03, page 315 of 846 ? pb2/a10/tiocc3 the pin functions are switched as shown below according to the combination of operating mode, the tpu channel 3 setting, ae3 to ae0 bits in pfcr, and the pb2ddr bit. operating mode modes 4 to 6 mode 7 ae3 to ae0 other than (b'0010 or b'000x) b'0010 or b'000x ? tpu channel 3 setting * 1 ? output input or initial value output input or initial value pb2ddr ?? 01 ? 01 pb2 input pin pb2 output pin pb2 input pin pb2 output pin pin functions a10 output pin tiocc3 output pin tiocc3 input pin * 2 tiocc3 output pin tiocc3 input pin * 2 notes: * 1 for the setting of the tpu channel, see section 11, 16-bit timer pulse unit (tpu). * 2 this pin functions as tiocc3 input when tpu channel 3 timer operating mode is set to normal operating mode and ioc3 to ioc0 in tiorl_3 are set to 10xx. ? pb1/a9/tiocb3 the pin functions are switched as shown below according to the combination of operating mode, the tpu channel 3 setting, ae3 to ae0 bits in pfcr, and the pb1ddr bit. operating mode modes 4 to 6 mode 7 ae3 to ae0 other than b'000x b'000x ? tpu channel 3 setting * 1 ? output input or initial value output input or initial value pb1ddr ?? 01 ? 01 pb1 input pin pb1 output pin pb1 input pin pb1 output pin pin functions a9 output pin tiocb3 output pin tiocb3 input pin * 2 tiocb3 output pin tiocb3 input pin * 2 notes: * 1 for the setting of the tpu channel, see section 11, 16-bit timer pulse unit (tpu). * 2 this pin functions as tiocb3 input when tpu channel 3 timer operating mode is set to normal operating mode and iob3 to iob0 in tiorh_3 are set to 10xx.
rev. 2.00, 05/03, page 316 of 846 ? pb0/a8/tioca3 the pin functions are switched as shown below according to the combination of the operating mode, tpu channel 3 setting, the ae3 to ae0 bits in pfcr, and the pb0ddr bit. operating mode modes 4 to 6 mode 7 ae3 to ae0 other than b'0000 b'0000 ? tpu channel 3 setting * 1 ? output input or initial value output input or initial value pb0ddr ?? 01 ? 01 pb0 input pin pb0 output pin pb0 input pin pb0 output pin pin functions a8 output pin tioca3 output pin tioca3 input pin * 2 tioca3 output pin tioca3 input pin * 2 notes: * 1 for the setting of the tpu channel, see section 11, 16-bit timer pulse unit (tpu). * 2 this pin functions as tioca3 input when tpu channel 3 timer operating mode is set to normal operating mode and ioa3 to ioa0 in tiorh_3 are set to 10xx. 10.7.6 input pull-up mos states in port b port b has a built-in input pull-up mos function that can be controlled by software. input pull-up mos can be specified as on or off on an individual bit basis. table 10.3 summarizes the input pull-up mos states. table 10.3 input pull-up mos states in port b pin states power- on reset hardware standby mode manual reset software standby mode in other operations address output, port output, tpu output off off off port input, tpu input off off on/off on/off on/off legend off : input pull-up mos is always off. on/off : on when pbddr = 0 and pbpcr = 1; otherwise off.
rev. 2.00, 05/03, page 317 of 846 10.8 port c port c is an 8-bit i/o port and has the following registers. ? port c data direction register (pcddr) ? port c data register (pcdr) ? port c register (portc) ? port c pull-up mos control register (pcpcr) 10.8.1 port c data direction register (pcddr) pcddr specifies input or output the port c pins using the individual bits. pcddr cannot be read; if it is, an undefined value will be read. bit bit name initial value r/wdescription 7 pc7ddr 0 w 6 pc6ddr 0 w 5 pc5ddr 0 w 4 pc4ddr 0 w 3 pc3ddr 0 w 2 pc2ddr 0 w 1 pc1ddr 0 w 0 pc0ddr 0 w when a pin is specified as a general purpose i/o port, setting this bit to 1 makes the corresponding port c pin an output pin. clearing this bit to 0 makes the pin an input pin. 10.8.2 port c data register (pcdr) pcdr stores output data for port c pins. bit bit name initial value r/wdescription 7 pc7dr 0 r/w 6 pc6dr 0 r/w 5 pc5dr 0 r/w 4 pc4dr 0 r/w 3 pc3dr 0 r/w 2 pc2dr 0 r/w 1 pc1dr 0 r/w 0 pc0dr 0 r/w output data for a pin is stored when the pin is specified as a general purpose i/o port.
rev. 2.00, 05/03, page 318 of 846 10.8.3 port c register (portc) portc shows port c pin states. this register cannot be modified. bit bit name initial value r/wdescription 7pc7 ? * r 6pc6 ? * r 5pc5 ? * r 4pc4 ? * r 3pc3 ? * r 2pc2 ? * r 1pc1 ? * r 0pc0 ? * r if a port c read is performed while pcddr bits are set to 1, the pcdr values are read. if a port c read is performed while pcddr bits are cleared to 0, the pin states are read. note: * determined by the states of pins pc7 to pc0. 10.8.4 port c pull-up mos control register (pcpcr) pcpcr controls the input pull-up mos specification as on or off for port c. bit bit name initial value r/wdescription 7 pc7pcr 0 r/w 6 pc6pcr 0 r/w 5 pc5pcr 0 r/w 4 pc4pcr 0 r/w 3 pc3pcr 0 r/w 2 pc2pcr 0 r/w 1 pc1pcr 0 r/w 0 pc0pcr 0 r/w when a pin is specified as an input port, setting the corresponding bit to 1 turns on the input pull-up mos for that pin.
rev. 2.00, 05/03, page 319 of 846 10.8.5 pin functions port c pins also function as address output pin. the values of register and pin functions are shown below. ? pc7/a7, pc6/a6, pc5/a5, pc4/a4, pc3/a3, pc2/a2, pc1/a1, pc0/a0 the pin functions are switched as shown below according to the combination of operating mode and the pcnddr bit. operating mode modes 4 and 5 mode 6 mode 7 pcnddr ? 01 0 1 pin functions address output pin pcn input pin address output pin pcn input pin pcn output pin note: n = 7 to 0 10.8.6 input pull-up mos states in port c port c has a built-in input pull-up mos function that can be controlled by software. input pull-up mos can be used in modes 6 and 7 and specified as on or off on an individual bit basis. table 10.4 summarizes the input pull-up mos states in port c. table 10.4 input pull-up mos states in port c pin states power-on reset hardware standby mode software standby mode in other operations address output (modes 4 and 5) and port output (modes 6 and 7) off off off off port input (modes 6 and 7) on/off on/off legend off : input pull-up mos is always off. on/off : on when pcddr = 0 and pcpcr = 1; otherwise off.
rev. 2.00, 05/03, page 320 of 846 10.9 port d port d is an 8-bit i/o port and has the following registers. ? port d data direction register (pdddr) ? port d data register (pddr) ? port d register (portd) ? port d pull-up mos control register (pdpcr) 10.9.1 port d data direction register (pdddr) pdddr specifies input or output the port d pins using the individual bits. pdddr cannot be read; if it is, an undefined value will be read. bit bit name initial value r/wdescription 7 pd7ddr 0 w 6 pd6ddr 0 w 5 pd5ddr 0 w 4 pd4ddr 0 w 3 pd3ddr 0 w 2 pd2ddr 0 w 1 pd1ddr 0 w 0 pd0ddr 0 w when a pin is specified as a general purpose i/o port, setting this bit to 1 makes the corresponding port d pin an output port. clearing this bit to 0 makes the pin an input port. 10.9.2 port d data register (pddr) pddr stores output data for port d pins. bit bit name initial value r/wdescription 7 pd7dr 0 r/w 6 pd6dr 0 r/w 5 pd5dr 0 r/w 4 pd4dr 0 r/w 3 pd3dr 0 r/w 2 pd2dr 0 r/w 1 pd1dr 0 r/w 0 pd0dr 0 r/w output data for a pin is stored when the pin is specified as a general purpose i/o port.
rev. 2.00, 05/03, page 321 of 846 10.9.3 port d register (portd) portd shows port d pin states. this register cannot be modified. bit bit name initial value r/wdescription 7pd7 ? * r 6pd6 ? * r 5pd5 ? * r 4pd4 ? * r 3pd3 ? * r 2pd2 ? * r 1pd1 ? * r 0pd0 ? * r if a port d read is performed while pdddr bits are set to 1, the pddr values are read. if a port d read is performed while pdddr bits are cleared to 0, the pin states are read. note: * determined by the states of pins pd7 to pd0. 10.9.4 port d pull-up mos control register (pdpcr) pdpcr controls the on/off state of port d input pull-up mos. bit bit name initial value r/wdescription 7 pd7pcr 0 r/w 6 pd6pcr 0 r/w 5 pd5pcr 0 r/w 4 pd4pcr 0 r/w 3 pd3pcr 0 r/w 2 pd2pcr 0 r/w 1 pd1pcr 0 r/w 0 pd0pcr 0 r/w when a pin is specified as an input port, setting the corresponding bit to 1 turns on the input pull-up mos for that pin.
rev. 2.00, 05/03, page 322 of 846 10.9.5 pin functions port d pins also function as data i/o pins. the values of register and pin functions are shown below. ? pd7/d15, pd6/d14, pd5/d13, pd4/d12, pd3/d11, pd2/d10, pd1/d9, pd0/d8 the pin functions are switched as shown below according to the combination of the operating mode and the pdnddr bit. operating mode modes 4 to 6 mode 7 pdnddr ? 01 pin functions data i/o pin pdn input pin pdn output pin note: n = 7 to 0 10.9.6 input pull-up mos states in port d port d has a built-in input pull-up mos function that can be controlled by software. input pull-up mos can be used in mode 7 and specified as on or off on an individual bit basis. table 10.5 summarizes the input pull-up mos states in port d. table 10.5 input pull-up mos states in port d pin states power-on reset hardware standby mode manual reset software standby mode in other operations data i/o (modes 4 and 6) and port output (mode 7) off off off off off port input (modes 6 and 7) on/off on/off on/off legend off : input pull-up mos is always off. on/off : on when pdddr = 0 and pdpcr = 1; otherwise off.
rev. 2.00, 05/03, page 323 of 846 10.10 port e port e is an 8-bit i/o port and has the following registers. ? port e data direction register (peddr) ? port e data register (pedr) ? port e register (porte) ? port e pull-up mos control register (pepcr) 10.10.1 port e data direction register (peddr) peddr specifies input or output of the port e pins using the individual bits. peddr cannot be read; if it is, an undefined value will be read. bit bit name initial value r/wdescription 7 pe7ddr 0 w 6 pe6ddr 0 w 5 pe5ddr 0 w 4 pe4ddr 0 w 3 pe3ddr 0 w 2 pe2ddr 0 w 1 pe1ddr 0 w 0 pe0ddr 0 w when a pin is specified as a general purpose i/o port, setting this bit to 1 makes the corresponding port e pin an output port. clearing this bit to 0 makes the pin an input port.
rev. 2.00, 05/03, page 324 of 846 10.10.2 port e data register (pedr) pedr stores output data for port e pins. bit bit name initial value r/wdescription 7 pe7dr 0 r/w 6 pe6dr 0 r/w 5 pe5dr 0 r/w 4 pe4dr 0 r/w 3 pe3dr 0 r/w 2 pe2dr 0 r/w 1 pe1dr 0 r/w 0 pe0dr 0 r/w output data for a pin is stored when the pin is specified as a general purpose i/o port. 10.10.3 port e register (porte) porte shows port e pin states. this register cannot be modified. bit bit name initial value r/wdescription 7 pe7 ? * r 6 pe6 ? * r 5 pe5 ? * r 4 pe4 ? * r 3 pe3 ? * r 2 pe2 ? * r 1 pe1 ? * r 0 pe0 ? * r if a port e read is performed while peddr bits are set to 1, the pedr values are read. if a port e read is performed while peddr bits are cleared to 0, the pin states are read. note: * determined by the states of pins pe7 to pe0.
rev. 2.00, 05/03, page 325 of 846 10.10.4 port e pull-up mos control register (pepcr) pepcr controls the on/off state of port e input pull-up mos. bit bit name initial value r/wdescription 7 pe7pcr 0 r/w 6 pe6pcr 0 r/w 5 pe5pcr 0 r/w 4 pe4pcr 0 r/w 3 pe3pcr 0 r/w 2 pe2pcr 0 r/w 1 pe1pcr 0 r/w 0 pe0pcr 0 r/w when a pin is specified as an input port, setting the corresponding bit to 1 turns on the input pull-up mos for that pin. 10.10.5 pin functions port e pins also function as data i/o pins. the values of register and pin functions are shown below. ? pe7/d7, pe6/d6, pe5/d5, pe4/d4, pe3/d3, pe2/d2, pe1/d1, pe0/d0 the pin functions are switched as shown below according to the combination of the operating mode, bus mode, and the penddr bit. operating mode modes 4 to 6 mode 7 bus mode 8-bit bus mode 16-bit bus mode ? penddr 0 1 ? 01 pin functions pen input pin pen output pin data i/o pin pen input pin pen output pin note: n = 7 to 0
rev. 2.00, 05/03, page 326 of 846 10.10.6 input pull-up mos states in port e port e has a built-in input pull-up mos function that can be controlled by software. input pull-up mos can be used in modes 4 to 6 and 8-bit bus mode or in mode 7 and specified as on or off on an individual bit basis. table 10.6 summarizes the input pull-up mos states in port e. table 10.6 input pull-up mos states in port e pin states power-on reset hardware standby mode manual reset software standby mode in other operations data i/o (16-bit bus in modes 4 to 6) and port output (8-bit bus in modes 4 to 6 and mode 7) off off off off off port input (8-bit bus in modes 4 to 6 and mode 7) on/off on/off on/off legend off : input pull-up mos is always off. on/off : on when peddr = 0 and pepcr = 1; otherwise off.
rev. 2.00, 05/03, page 327 of 846 10.11 port f port f is an 8-bit i/o port and has the following registers. ? port f data direction register (pfddr) ? port f data register (pfdr) ? port f register (portf) 10.11.1 port f data direction register (pfddr) pfddr specifies input or output of the port f pins using the individual bits. pfddr cannot be read; if it is, an undefined value will be read. bit bit name initial value r/wdescription 7 pf7ddr 0/1 * w 6 pf6ddr 0 w 5 pf5ddr 0 w 4 pf4ddr 0 w 3 pf3ddr 0 w 2 pf2ddr 0 w 1 pf1ddr 0 w 0 pf0ddr 0 w when a pin is specified as a general purpose i/o port, setting this bit to 1 makes the corresponding port f pin an output port. clearing this bit to 0 makes the pin an input port. note: * in modes 4 to 6, initial value is 1. in mode 7, initial value is 0. 10.11.2 port f data register (pfdr) pfdr stores output data for port f pins. bit bit name initial value r/wdescription 7pf7dr 0 r/w 6pf6dr 0 r/w 5pf5dr 0 r/w 4pf4dr 0 r/w 3pf3dr 0 r/w 2pf2dr 0 r/w 1pf1dr 0 r/w 0pf0dr 0 r/w output data for a pin is stored when the pin is specified as a general purpose i/o port.
rev. 2.00, 05/03, page 328 of 846 10.11.3 port f register (portf) portf shows port f pin states. this register cannot be modified. bit bit name initial value r/wdescription 7pf7 ? * r 6pf6 ? * r 5pf5 ? * r 4pf4 ? * r 3pf3 ? * r 2pf2 ? * r 1pf1 ? * r 0pf0 ? * r if a port f read is performed while pfddr bits are set to 1, the pfdr values are read. if a port f read is performed while pfddr bits are cleared to 0, the pin states are read. note: * determined by the states of pins pf7 to pf0. 10.11.4 pin functions port f pins also function as bus control signal input/output pin, interrupt input pin, system clock output pin, a/d trigger input pin, and buzz output pin. the values of register and pin functions are shown below. ? pf7/ the pin functions are switched as shown below according to the pf7ddr bit. pf7ddr 0 1 pin functions pf7 input pin output pin ? pf6/ as the pin functions are switched as shown below according to the combination of operating mode and the pf6ddr bit. operating mode modes 4 to 6 mode 7 pf6ddr ? 01 pin functions as output pin pf6 input pin pf6 output pin
rev. 2.00, 05/03, page 329 of 846 ? pf5/ rd the pin functions are switched as shown below according to the combination of operating mode and the pf5ddr bit. operating mode modes 4 to 6 mode 7 pf5ddr ? 01 pin functions rd output pin pf5 input pin pf5 output pin ? pf4/ hwr the pin functions are switched as shown below according to the combination of operating mode and the pf4ddr bit. operating mode modes 4 to 6 mode 7 pf4ddr ? 01 pin functions hwr output pin pf4 input pin pf4 output pin ? pf3/lwr/adtrg/irq3 the pin functions are switched as shown below according to the combination of operating mode and the pf3ddr bit. operating mode modes 4 to 6 mode 7 bus mode 16-bit bus mode 8-bit bus mode ? pf3ddr ? 0101 pf3 input pin pf3 output pin pf3 input pin pf3 output pin adtrg input pin * 1 pin functions lwr output pin irq3 input pin * 2 notes: * 1 when trgs0 and trgs1 are set to 1, this pin is adtrg input. * 2 when this pin is used as an external interrupt pin, do not specify other functions.
rev. 2.00, 05/03, page 330 of 846 ? pf2/ wait the pin functions are switched as shown below according to the combination of operating mode, the waite bit, and the pf2ddr bit. operating mode modes 4 to 6 mode 7 waite 0 1 ? pf2ddr 0 1 ? 01 pin functions pf2 input pin pf2 output pin wait input pin pf2 input pin pf2 output pin ? pf1/ back /buzz the pin functions are switched as shown below according to the combination of operating mode, the buzz bit in pfcr, and the pf1ddr bit. operating mode modes 4 to 6 mode 7 brle 0 1 ? buzze 0 1 ? 01 pf1ddr 0 1 ?? 01 ? pin functions pf1 input pin pf1 output pin buzz output pin back output pin pf1 input pin pf1 output pin buzz output pin ? pf0/breq/ irq2 the pin functions are switched as shown below according to the combination of operating mode, the brle bit, and the pf0ddr bit. operating mode modes 4 to 6 mode 7 brle 0 1 ? pf0ddr 0 1 ? 01 pin functions pf0 input pin pf0 output pin breq input pin pf0 input pin pf0 output pin irq2 input pin * note: * when this pin is used as an external interrupt pin, do not specify other functions.
rev. 2.00, 05/03, page 331 of 846 10.12 port g port g is a 5-bit i/o port and has the following registers. ? port g data direction register (pgddr) ? port g data register (pgdr) ? port g register (portg) 10.12.1 port g data direction register (pgddr) pgddr specifies input or output of the port g pins using the individual bits. pgddr cannot be read; if it is, an undefined value will be read. bit bit name initial value r/wdescription 7 to 5 ? undefined ? reserved these bits are always read as undefined value. 4 pg4ddr 0/1 * w 3 pg3ddr 0 w 2 pg2ddr 0 w 1 pg1ddr 0 w 0 pg0ddr 0 w when a pin is specified as a general purpose i/o port, setting this bit to 1 makes the corresponding port g pin an output port. clearing this bit to 0 makes the pin an input port. note: * in modes 4 and 5, initial value is 1. in modes 6 and 7, initial value is 0. 10.12.2 port g data register (pgdr) pgdr stores output data for port g pins. bit bit name initial value r/wdescription 7 to 5 ? undefined ? reserved these bits are always read as undefined value. 4pg4dr 0 r/w 3pg3dr 0 r/w 2pg2dr 0 r/w 1pg1dr 0 r/w 0pg0dr 0 r/w output data for a pin is stored when the pin is specified as a general purpose i/o port.
rev. 2.00, 05/03, page 332 of 846 10.12.3 port g register (portg) portg shows port g pin states. this register cannot be modified. bit bit name initial value r/wdescription 7 to 5 ? undefined ? reserved these bits are always read as undefined value. 4pg4 ? * r 3pg3 ? * r 2pg2 ? * r 1pg1 ? * r 0pg0 ? * r if a port g read is performed while pgddr bits are set to 1, the pgdr values are read. if a port g read is performed while pgddr bits are cleared to 0, the pin states are read. note: * determined by the states of pins pg4 to pg0. 10.12.4 pin functions port g pins also function as bus control signal input/output pin and interrupt input pin. the values of registers and pin functions are shown below. ? pg4/ cs0 the pin functions are switched as shown below according to the combination of operating mode and the pg4ddr bit. operating mode modes 4 to 6 mode 7 pg4ddr 0 1 0 1 pin functions pg4 input pin cs0 output pin pg4 input pin pg4 output pin ? pg3/ cs1 the pin functions are switched as shown below according to the combination of operating mode and the pg3ddr bit. operating mode modes 4 to 6 mode 7 pg3ddr 0 1 0 1 pin functions pg3 input pin cs1 output pin pg3 input pin pg3 output pin
rev. 2.00, 05/03, page 333 of 846 ? pg2/ cs2 the pin functions are switched as shown below according to the combination of operating mode and the pg2ddr bit. operating mode modes 4 to 6 mode 7 pg2ddr 0 1 0 1 pin functions pg2 input pin cs2 output pin pg2 input pin pg2 output pin ? pg1/ cs3 / irq7 the pin functions are switched as shown below according to the combination of operating mode and the pg1ddr bit. operating mode modes 4 to 6 mode 7 pg1ddr 0 1 0 1 pg1 input pin cs3 output pin pg1 input pin pg1 output pin pin functions irq7 input pin * note: * when this pin is used as an external interrupt pin, do not specify other functions. ? pg0/ irq6 the pin functions are switched as shown below according to the pg0ddr bit. pg0ddr 0 1 pg0 input pin pg0 output pin pin functions irq6 input pin * note: * when this pin is use as an external interrupt pin, do not specify other functions.
rev. 2.00, 05/03, page 334 of 846
timtpu3a_000020020700 rev. 2.00, 05/03, page 335 of 846 section 11 16-bit timer pulse unit (tpu) this lsi has an on-chip 16-bit timer pulse unit (tpu) that comprises six 16-bit timer channels. the function list of the 16-bit timer unit and its block diagram are shown in table 11.1 and figure 11.1, respectively. 11.1 features ? the number of channels h8s/2239 group, h8s/2238 group, and h8s/2237 group: six channels (channels 0, 1, 2, 3, 4, and 5) h8s/2227 group: three channels (channels 0, 1, and 2) ? pulse input/output h8s/2239 group, h8s/2238 group, and h8s/2237 group: maximum of 16-pulse input/output h8s/2227 group: maximum of eight-pulse input/output ? selection of 8 counter input clocks for each channel ? the following operations can be set for each channel: waveform output at compare match input capture function counter clear operation synchronous operations: multiple timer counters (tcnt) can be written to simultaneously simultaneous clearing by compare match and input capture possible register simultaneous input/output possible by counter synchronous operation maximum of 15-phase pwm output possible by combination with synchronous operation ? buffer operation settable for channels 0 and 3 ? phase counting mode settable independently for each of channels 1, 2, 4, and 5 ? cascaded operation * ? fast access via internal 16-bit bus ? 26 interrupt sources ? automatic transfer of register data ? a/d converter conversion start trigger can be generated ? module stop mode can be set note: * not available in the h8s/2227 group.
rev. 2.00, 05/03, page 336 of 846 table 11.1 tpu functions item channel 0 channel 1 channel 2 channel 3 * 1 channel 4 * 1 channel 5 * 1 count clock /1 /4 /16 /64 tclka tclkb tclkc tclkd /1 /4 /16 /64 /256 tclka tclkb /1 /4 /16 /64 /1024 tclka tclkb tclkc /1 /4 /16 /64 /256 /1024 /4096 tclka /1 /4 /16 /64 /1024 tclka tclkc /1 /4 /16 /64 /256 tclka tclkc tclkd general registers (tgr) tgra_0 tgrb_0 tgra_1 tgrb_1 tgra_2 tgrb_2 tgra_3 tgrb_3 tgra_4 tgrb_4 tgra_5 tgrb_5 general registers/ buffer registers tgrc_0 tgrd_0 ??tgrc_3 tgrd_3 ?? i/o pins tioca0 tiocb0 tiocc0 tiocd0 tioca1 tiocb1 tioca2 tiocb2 tioca3 tiocb3 tiocc3 tiocd3 tioca4 tiocb4 tioca5 tiocb5 counter clear function tgr compare match or input capture tgr compare match or input capture tgr compare match or input capture tgr compare match or input capture tgr compare match or input capture tgr compare match or input capture 0 output o o o o o o 1 output o o o o o o compare match output toggle output oooooo input capture function oooooo synchronous operation oooooo pwm mode oooooo phase counting mode ?oo?oo buffer operation o ? ? o ? ?
rev. 2.00, 05/03, page 337 of 846 item channel 0 channel 1 channel 2 channel 3 channel 4 channel 5 dtc activation tgr compare match or input capture tgr compare match or input capture tgr compare match or input capture tgr compare match or input capture tgr compare match or input capture tgr compare match or input capture dmac * 2 activation tgra_0 compare match or input capture tgra_1 compare match or input capture tgra_2 compare match or input capture tgra_3 compare match or input capture tgra_4 compare match or input capture tgra_5 compare match or input capture a/d converter trigger tgra_0 compare match or input capture tgra_1 compare match or input capture tgra_2 compare match or input capture tgra_3 compare match or input capture tgra_4 compare match or input capture tgra_5 compare match or input capture interrupt sources 5 sources ? compare match or input capture 0a ? compare match or input capture 0b ? compare match or input capture 0c ? compare match or input capture 0d ? overflow 4 sources ? compare match or input capture 1a ? compare match or input capture 1b ? overflow ? underflow 4 sources ? compare match or input capture 2a ? compare match or input capture 2b ? overflow ? underflow 5 sources ? compare match or input capture 3a ? compare match or input capture 3b ? compare match or input capture 3c ? compare match or input capture 3d ? overflow 4 sources ? compare match or input capture 4a ? compare match or input capture 4b ? overflow ? underflow 4 sources ? compare match or input capture 5a ? compare match or input capture 5b ? overflow ? underflow legend o : possible ? : not possible notes: * 1 not available in the h8s/2227 group. * 2 supported only by the h8s/2239 group.
rev. 2.00, 05/03, page 338 of 846 channel 3 tmdr tiorl tsr tcr tiorh tier tgra tcnt tgrb tgrc tgrd channel 4 tmdr tsr tcr tior tier tgra tcnt tgrb control logic tmdr tsr tcr tior tier tgra tcnt tgrb control logic for channels 3 to 5 tmdr tsr tcr tior tier tgra tcnt tgrb tgrc channel 1 tmdr tsr tcr tior tier tgra tcnt tgrb channel 0 tmdr tsr tcr tiorh tier control logic for channels 0 to 2 tgra tcnt tgrb tgrd tsyr tstr input/output pins tioca3 tiocb3 tiocc3 tiocd3 tioca4 tiocb4 tioca5 tiocb5 clock input /1 /4 /16 /64 /256 /1024 /4096 tclka tclkb tclkc tclkd input/output pins tioca0 tiocb0 tiocc0 tiocd0 tioca1 tiocb1 tioca2 tiocb2 interrupt request signals channel 3: channel 4: channel 5: interrupt request signals channel 0: channel 1: channel 2: internal data bus a/d conversion start request signal tiorl module data bus tgi3a tgi3b tgi3c tgi3d tci3v tgi4a tgi4b tci4v tci4u tgi5a tgi5b tci5v tci5u tgi0a tgi0b tgi0c tgi0d tci0v tgi1a tgi1b tci1v tci1u tgi2a tgi2b tci2v tci2u channel 3: channel 4: channel 5: internal clock: external clock: channel 0: channel 1: channel 2: legend tstr : timer start register tsyr : timer synchronous register tcr : timer control register tmdr : timer mode register tior (h, l) : timer i/o control registers (h, l) tier : timer interrupt enable register tsr : timer status register tgr (a, b, c, d) : timer general registers (a, b, c, d) tcnt : timer counter channel 2 common channel 5 bus interface figure 11.1 block diagram of tpu (h8s/2239 group, h8s/2238 group, and h8s/2237 group)
rev. 2.00, 05/03, page 339 of 846 control logic tmdr tsr tcr tior tier tgra tcnt tgrb tgrc channel 1 tmdr tsr tcr tior tier tgra tcnt tgrb channel 0 tmdr tsr tcr tiorh tier control logic for channels 0 to 2 tgra tcnt tgrb tgrd tsyr tstr clock input /1 /4 /16 /64 /256 /1024 tclka tclkb tclkc tclkd input/output pins tioca0 tiocb0 tiocc0 tiocd0 tioca1 tiocb1 tioca2 tiocb2 interrupt request signals channel 0: channel 1: channel 2: internal data bus a/d conversion start request signal tiorl module data bus tgi0a tgi0b tgi0c tgi0d tci0v tgi1a tgi1b tci1v tci1u tgi2a tgi2b tci2v tci2u internal clock: external clock: channel 0: channel 1: channel 2: legend tstr : timer start register tsyr : timer synchronous register tcr : timer control register tmdr : timer mode register tior (h, l) : timer i/o control registers (h, l) tier : timer interrupt enable register tsr : timer status register tgr (a, b, c, d) : timer general registers (a, b, c, d) channel 2 common bus interface figure 11.2 block diagram of tpu (h8s/2227 group)
rev. 2.00, 05/03, page 340 of 846 11.2 input/output pins table 11.2 pin configuration channel symbol i/o function all tclka input external clock a input pin (channels 1 and 5 * phase counting mode a phase input) tclkb input external clock b input pin (channels 1 and 5 * phase counting mode b phase input) tclkc input external clock c input pin (channels 2 and 4 * phase counting mode a phase input) tclkd input external clock d input pin (channels 2 and 4 * phase counting mode b phase input) 0 tioca0 i/o tgra_0 input capture input/output compare output/pwm output pin tiocb0 i/o tgrb_0 input capture input/output compare output/pwm output pin tiocc0 i/o tgrc_0 input capture input/output compare output/pwm output pin tiocd0 i/o tgrd_0 input capture input/output compare output/pwm output pin 1 tioca1 i/o tgra_1 input capture input/output compare output/pwm output pin tiocb1 i/o tgrb_1 input capture input/output compare output/pwm output pin 2 tioca2 i/o tgra_2 input capture input/output compare output/pwm output pin tiocb2 i/o tgrb_2 input capture input/output compare output/pwm output pin 3 * tioca3 i/o tgra_3 input capture input/output compare output/pwm output pin tiocb3 i/o tgrb_3 input capture input/output compare output/pwm output pin tiocc3 i/o tgrc_3 input capture input/output compare output/pwm output pin tiocd3 i/o tgrd_3 input capture input/output compare output/pwm output pin 4 * tioca4 i/o tgra_4 input capture input/output compare output/pwm output pin tiocb4 i/o tgrb_4 input capture input/output compare output/pwm output pin 5 * tioca5 i/o tgra_5 input capture input/output compare output/pwm output pin tiocb5 i/o tgrb_5 input capture input/output compare output/pwm output pin note: * not available in the h8s/2227 group.
rev. 2.00, 05/03, page 341 of 846 11.3 register descriptions the tpu has the following registers in each channel. ? timer control register_0 (tcr_0) ? timer mode register_0 (tmdr_0) ? timer i/o control register h_0 (tiorh_0) ? timer i/o control register l_0 (tiorl_0) ? timer interrupt enable register_0 (tier_0) ? timer status register_0 (tsr_0) ? timer counter_0 (tcnt_0) ? timer general register a_0 (tgra_0) ? timer general register b_0 (tgrb_0) ? timer general register c_0 (tgrc_0) ? timer general register d_0 (tgrd_0) ? timer control register_1 (tcr_1) ? timer mode register_1 (tmdr_1) ? timer i/o control register _1 (tior_1) ? timer interrupt enable register_1 (tier_1) ? timer status register_1 (tsr_1) ? timer counter_1 (tcnt_1) ? timer general register a_1 (tgra_1) ? timer general register b_1 (tgrb_1) ? timer control register_2 (tcr_2) ? timer mode register_2 (tmdr_2) ? timer i/o control register_2 (tior_2) ? timer interrupt enable register_2 (tier_2) ? timer status register_2 (tsr_2) ? timer counter_2 (tcnt_2) ? timer general register a_2 (tgra_2) ? timer general register b_2 (tgrb_2) ? timer control register_3 (tcr_3) * ? timer mode register_3 (tmdr_3) * ? timer i/o control register h_3 (tiorh_3) * ? timer i/o control register l_3 (tiorl_3) * ? timer interrupt enable register_3 (tier_3) * ? timer status register_3 (tsr_3) * ? timer counter_3 (tcnt_3) *
rev. 2.00, 05/03, page 342 of 846 ? timer general register a_3 (tgra_3) * ? timer general register b_3 (tgrb_3) * ? timer general register c_3 (tgrc_3) * ? timer general register d_3 (tgrd_3) * ? timer control register_4 (tcr_4) * ? timer mode register_4 (tmdr_4) * ? timer i/o control register _4 (tior_4) * ? timer interrupt enable register_4 (tier_4) * ? timer status register_4 (tsr_4) * ? timer counter_4 (tcnt_4) * ? timer general register a_4 (tgra_4) * ? timer general register b_4 (tgrb_4) * ? timer control register_5 (tcr_5) * ? timer mode register_5 (tmdr_5) * ? timer i/o control register_5 (tior_5) * ? timer interrupt enable register_5 (tier_5) * ? timer status register_5 (tsr_5) * ? timer counter_5 (tcnt_5) * ? timer general register a_5 (tgra_5) * ? timer general register b_5 (tgrb_5) * common registers ? timer start register (tstr) ? timer synchronous register (tsyr) note: * not available in the h8s/2227 group.
rev. 2.00, 05/03, page 343 of 846 11.3.1 timer control register (tcr) the tcr registers control the tcnt operation for each channel. the tpu has a total of six tcr registers, one for each channel. tcr register settings should be made only when tcnt operation is stopped. bit bit name initial value r/w description 7 6 5 cclr2 cclr1 cclr0 0 0 0 r/w r/w r/w counter clear 2 to 0 these bits select the tcnt counter clearing source. see tables 11.3 and 11.4 for details. 4 3 ckeg1 ckeg0 0 0 r/w r/w clock edge 1 and 0 these bits select the input clock edge. when the input clock is counted using both edges, the input clock period is halved (e.g. /4 both edges = /2 rising edge). if phase counting mode is used on channels 1, 2, 4, and 5, this setting is ignored and the phase counting mode setting has priority. internal clock edge selection is valid when the input clock is /4 or slower. this setting is ignored if the input clock is /1, or when overflow/underflow of another channel is selected. 00: count at rising edge 01: count at falling edge 1x: count at both edges legend: x: don't care 2 1 0 tpsc2 tpsc1 tpsc0 0 0 0 r/w r/w r/w time prescaler 2 to 0 these bits select the tcnt counter clock. the clock source can be selected independently for each channel. see tables 11.5 to 11.10 for details.
rev. 2.00, 05/03, page 344 of 846 table 11.3 cclr2 to cclr0 (channels 0 and 3) channel bit 7 cclr2 bit 6 cclr1 bit 5 cclr0 description 0, 3 0 0 0 tcnt clearing disabled 1 tcnt cleared by tgra compare match/input capture 1 0 tcnt cleared by tgrb compare match/input capture 1 tcnt cleared by counter clearing for another channel performing synchronous clearing/ synchronous operation * 1 1 0 0 tcnt clearing disabled 1 tcnt cleared by tgrc compare match/input capture * 2 1 0 tcnt cleared by tgrd compare match/input capture * 2 1 tcnt cleared by counter clearing for another channel performing synchronous clearing/ synchronous operation * 1 notes: * 1 synchronous operation setting is performed by setting the sync bit in tsyr to 1. * 2 when tgrc or tgrd is used as a buffer register, tcnt is not cleared because the buffer register setting has priority, and compare match/input capture does not occur. table 11.4 cclr2 to cclr0 (channels 1, 2, 4, and 5) channel bit 7 reserved * 2 bit 6 cclr1 bit 5 cclr0 description 1, 2, 4, 5 0 0 0 tcnt clearing disabled 1 tcnt cleared by tgra compare match/input capture 1 0 tcnt cleared by tgrb compare match/input capture 1 tcnt cleared by counter clearing for another channel performing synchronous clearing/ synchronous operation * 1 notes: * 1 synchronous operation setting is performed by setting the sync bit in tsyr to 1. * 2 bit 7 is reserved in channels 1, 2, 4, and 5. it is always read as 0 and cannot be modified.
rev. 2.00, 05/03, page 345 of 846 table 11.5 tpsc2 to tpsc0 (channel 0) channel bit 2 tpsc2 bit 1 tpsc1 bit 0 tpsc0 description 0 0 0 0 internal clock: counts on /1 1 internal clock: counts on /4 1 0 internal clock: counts on /16 1 internal clock: counts on /64 1 0 0 external clock: counts on tclka pin input 1 external clock: counts on tclkb pin input 1 0 external clock: counts on tclkc pin input 1 external clock: counts on tclkd pin input table 11.6 tpsc2 to tpsc0 (channel 1) channel bit 2 tpsc2 bit 1 tpsc1 bit 0 tpsc0 description 1 0 0 0 internal clock: counts on /1 1 internal clock: counts on /4 1 0 internal clock: counts on /16 1 internal clock: counts on /64 1 0 0 external clock: counts on tclka pin input 1 external clock: counts on tclkb pin input 1 0 internal clock: counts on /256 1 counts on tcnt2 overflow/underflow setting is prohibited in the h8s/2227 group. note: this setting is ignored when channel 1 is in phase counting mode.
rev. 2.00, 05/03, page 346 of 846 table 11.7 tpsc2 to tpsc0 (channel 2) channel bit 2 tpsc2 bit 1 tpsc1 bit 0 tpsc0 description 2 0 0 0 internal clock: counts on /1 1 internal clock: counts on /4 1 0 internal clock: counts on /16 1 internal clock: counts on /64 1 0 0 external clock: counts on tclka pin input 1 external clock: counts on tclkb pin input 1 0 external clock: counts on tclkc pin input 1 internal clock: counts on /1024 note: this setting is ignored when channel 2 is in phase counting mode. table 11.8 tpsc2 to tpsc0 (channel 3) channel bit 2 tpsc2 bit 1 tpsc1 bit 0 tpsc0 description 3 * 0 0 0 internal clock: counts on /1 1 internal clock: counts on /4 1 0 internal clock: counts on /16 1 internal clock: counts on /64 1 0 0 external clock: counts on tclka pin input 1 internal clock: counts on /1024 1 0 internal clock: counts on /256 1 internal clock: counts on /4096 note: * not available in the h8s/2227 group.
rev. 2.00, 05/03, page 347 of 846 table 11.9 tpsc2 to tpsc0 (channel 4) channel bit 2 tpsc2 bit 1 tpsc1 bit 0 tpsc0 description 4 * 0 0 0 internal clock: counts on /1 1 internal clock: counts on /4 1 0 internal clock: counts on /16 1 internal clock: counts on /64 1 0 0 external clock: counts on tclka pin input 1 external clock: counts on tclkc pin input 1 0 internal clock: counts on /1024 1 counts on tcnt5 overflow/underflow notes: this setting is ignored when channel 4 is in phase counting mode. * not available in the h8s/2227 group. table 11.10 tpsc2 to tpsc0 (channel 5) channel bit 2 tpsc2 bit 1 tpsc1 bit 0 tpsc0 description 5 * 0 0 0 internal clock: counts on /1 1 internal clock: counts on /4 1 0 internal clock: counts on /16 1 internal clock: counts on /64 1 0 0 external clock: counts on tclka pin input 1 external clock: counts on tclkc pin input 1 0 internal clock: counts on /256 1 external clock: counts on tclkd pin input notes: this setting is ignored when channel 5 is in phase counting mode. * not available in the h8s/2227 group.
rev. 2.00, 05/03, page 348 of 846 11.3.2 timer mode register (tmdr) the tmdr registers are used to set the operating mode for each channel. the tpu has six tmdr registers, one for each channel. tmdr register settings should be made only when tcnt operation is stopped. bit bit name initial value r/w description 7 6 ? ? 1 1 ? ? reserved these bits are always read as 1 and cannot be modified. 5 bfb 0 r/w buffer operation b specifies whether tgrb is to operate in the normal way, or tgrb and tgrd are to be used together for buffer operation. when tgrd is used as a buffer register, tgrd input capture/output compare is not generated. in channels 1, 2, 4, and 5, which have no tgrd, bit 5 is reserved. it is always read as 0 and cannot be modified. 0: tgrb operates normally 1: tgrb and tgrd used together for buffer operation 4 bfa 0 r/w buffer operation a specifies whether tgra is to operate in the normal way, or tgra and tgrc are to be used together for buffer operation. when tgrc is used as a buffer register, tgrc input capture/output compare is not generated. in channels 1, 2, 4, and 5, which have no tgrc, bit 4 is reserved. it is always read as 0 and cannot be modified. 0: tgra operates normally 1: tgra and tgrc used together for buffer operation 3 2 1 0 md3 md2 md1 md0 0 0 0 0 r/w r/w r/w r/w modes 3 to 0 these bits are used to set the timer operating mode. md3 is a reserved bit. the write value should always be 0. see table 11.11 for details.
rev. 2.00, 05/03, page 349 of 846 table 11.11 md3 to md0 bit 3 md3 * 1 bit 2 md2 * 2 bit 1 md1 bit 0 md0 description 0 0 0 0 normal operation 1 reserved 1 0 pwm mode 1 1 pwm mode 2 1 0 0 phase counting mode 1 1 phase counting mode 2 1 0 phase counting mode 3 1 phase counting mode 4 1xxx ? legend: x: don't care notes: * 1 md3 is a reserved bit. in a write, it should always be written with 0. * 2 phase counting mode cannot be set for channels 0 and 3. in this case, 0 should always be written to md2. 11.3.3 timer i/o control register (tior) the tior registers control the tgr registers. the tpu has eight tior registers, two each for channels 0 and 3, and one each for channels 1, 2, 4, and 5. care is required since tior is affected by the tmdr setting. the initial output specified by tior is valid when the counter is stopped (the cst bit in tstr is cleared to 0). note also that, in pwm mode 2, the output at the point at which the counter is cleared to 0 is specified. when tgrc or tgrd is designated for buffer operation, this setting is invalid and the register operates as a buffer register.
rev. 2.00, 05/03, page 350 of 846 tiorh_0, tior_1, tior_2, tiorh_3, tior_4, tior_5 bit bit name initial value r/w description 7 6 5 4 iob3 iob2 iob1 iob0 0 0 0 0 r/w r/w r/w r/w i/o control b3 to b0 specify the function of tgrb. for details, see tables 11.12, 11.14, 11.15, 11.16, 11.18, and 11.19. 3 2 1 0 ioa3 ioa2 ioa1 ioa0 0 0 0 0 r/w r/w r/w r/w i/o control a3 to a0 specify the function of tgra. for details, see tables 11.20, 11.22, 11.23, 11.24, 11.26, and 11.27. tiorl_0, tiorl_3 bit bit name initial value r/w description 7 6 5 4 iod3 iod2 iod1 iod0 0 0 0 0 r/w r/w r/w r/w i/o control d3 to d0 specify the function of tgrd. for details, see tables 11.13, and 11.17. 3 2 1 0 ioc3 ioc2 ioc1 ioc0 0 0 0 0 r/w r/w r/w r/w i/o control c3 to c0 specify the function of tgrc. for details, see tables 11.21, and 11.25
rev. 2.00, 05/03, page 351 of 846 table 11.12 tiorh_0 description bit 7 iob3 bit 6 iob2 bit 5 iob1 bit 4 iob0 tgrb_0 function tiocb0 pin function 0 0 0 0 output disabled 1 output compare register initial output is 0 output 0 output at compare match 1 0 initial output is 0 output 1 output at compare match 1 initial output is 0 output toggle output at compare match 1 0 0 output disabled 1 initial output is 1 output 0 output at compare match 1 0 initial output is 1 output 1 output at compare match 1 initial output is 1 output toggle output at compare match 1 0 0 0 capture input source is tiocb0 pin input capture at rising edge 1 capture input source is tiocb0 pin input capture at falling edge 1x input capture register capture input source is tiocb0 pin input capture at both edges 1 x x capture input source is channel 1/count clock input capture at tcnt_1 count- up/count- down * 1 * 2 legend: x: don't care notes: * 1 when bits tpsc2 to tpsc0 in tcr_1 are set to b'000 and /1 is used as the tcnt_1 count clock, this setting is invalid and input capture is not generated. * 2 not available in the h8s/2227 group.
rev. 2.00, 05/03, page 352 of 846 table 11.13 tiorl_0 description bit 7 iod3 bit 6 iod2 bit 5 iod1 bit 4 iod0 tgrd_0 function tiocd0 pin function 0 0 0 0 output disabled 1 output compare register * 2 initial output is 0 output 0 output at compare match 1 0 initial output is 0 output 1 output at compare match 1 initial output is 0 output toggle output at compare match 1 0 0 output disabled 1 initial output is 1 output 0 output at compare match 1 0 initial output is 1 output 1 output at compare match 1 initial output is 1 output toggle output at compare match 1 0 0 0 capture input source is tiocd0 pin input capture at rising edge 1 capture input source is tiocd0 pin input capture at falling edge 1x input capture register * 2 capture input source is tiocd0 pin input capture at both edges 1 x x capture input source is channel 1/count clock input capture at tcnt_1 count-up/count- down * 1 * 3 legend: x: don't care notes: * 1 when bits tpsc2 to tpsc0 in tcr_1 are set to b'000 and /1 is used as the tcnt_1 count clock, this setting is invalid and input capture is not generated. * 2 when the bfb bit in tmdr_0 is set to 1 and tgrd_0 is used as a buffer register, this setting is invalid and input capture/output compare is not generated. * 3 not available in the h8s/2227 group.
rev. 2.00, 05/03, page 353 of 846 table 11.14 tior_1 description bit 7 iob3 bit 6 iob2 bit 5 iob1 bit 4 iob0 tgrb_1 function tiocb1 pin function 0 0 0 0 output disabled 1 output compare register initial output is 0 output 0 output at compare match 1 0 initial output is 0 output 1 output at compare match 1 initial output is 0 output toggle output at compare match 1 0 0 output disabled 1 initial output is 1 output 0 output at compare match 1 0 initial output is 1 output 1 output at compare match 1 initial output is 1 output toggle output at compare match 1 0 0 0 capture input source is tiocb1 pin input capture at rising edge 1 capture input source is tiocb1 pin input capture at falling edge 1x input capture register capture input source is tiocb1 pin input capture at both edges 1 x x tgrc_0 compare match/input capture input capture at generation of tgrc_0 compare match/input capture * legend: x: don't care note: * not available in the h8s/2227 group.
rev. 2.00, 05/03, page 354 of 846 table 11.15 tior_2 description bit 7 iob3 bit 6 iob2 bit 5 iob1 bit 4 iob0 tgrb_2 function tiocb2 pin function 0 0 0 0 output disabled 1 output compare register initial output is 0 output 0 output at compare match 1 0 initial output is 0 output 1 output at compare match 1 initial output is 0 output toggle output at compare match 1 0 0 output disabled 1 initial output is 1 output 0 output at compare match 1 0 initial output is 1 output 1 output at compare match 1 initial output is 1 output toggle output at compare match 1 x 0 0 capture input source is tiocb2 pin input capture at rising edge 1 capture input source is tiocb2 pin input capture at falling edge 1x input capture register capture input source is tiocb2 pin input capture at both edges legend: x: don't care
rev. 2.00, 05/03, page 355 of 846 table 11.16 tiorh_3 description bit 7 iob3 bit 6 iob2 bit 5 iob1 bit 4 iob0 tgrb_3 function * 2 tiocb3 pin function * 2 0 0 0 0 output disabled 1 output compare register initial output is 0 output 0 output at compare match 1 0 initial output is 0 output 1 output at compare match 1 initial output is 0 output toggle output at compare match 1 0 0 output disabled 1 initial output is 1 output 0 output at compare match 1 0 initial output is 1 output 1 output at compare match 1 initial output is 1 output toggle output at compare match 1 0 0 0 capture input source is tiocb3 pin input capture at rising edge 1 capture input source is tiocb3 pin input capture at falling edge 1x input capture register capture input source is tiocb3 pin input capture at both edges 1 x x capture input source is channel 4/count clock input capture at tcnt_4 count-up/count- down * 1 legend: x: don't care notes: * 1 when bits tpsc2 to tpsc0 in tcr_4 are set to b'000 and /1 is used as the tcnt_4 count clock, this setting is invalid and input capture is not generated. * 2 not available in the h8s/2227 group.
rev. 2.00, 05/03, page 356 of 846 table 11.17 tiorl_3 description bit 7 iod3 bit 6 iod2 bit 5 iod1 bit 4 iod0 tgrd_3 function * 3 tiocd3 pin function * 3 0 0 0 0 output disabled 1 output compare register * 2 initial output is 0 output 0 output at compare match 1 0 initial output is 0 output 1 output at compare match 1 initial output is 0 output toggle output at compare match 1 0 0 output disabled 1 initial output is 1 output 0 output at compare match 1 0 initial output is 1 output 1 output at compare match 1 initial output is 1 output toggle output at compare match 1 0 0 0 capture input source is tiocd3 pin input capture at rising edge 1 capture input source is tiocd3 pin input capture at falling edge 1x input capture register * 2 capture input source is tiocd3 pin input capture at both edges 1 x x capture input source is channel 4/count clock input capture at tcnt_4 count-up/count- down * 1 legend: x: don't care notes: * 1 when bits tpsc2 to tpsc0 in tcr_4 are set to b'000 and /1 is used as the tcnt_4 count clock, this setting is invalid and input capture is not generated. * 2 when the bfb bit in tmdr_3 is set to 1 and tgrd_3 is used as a buffer register, this setting is invalid and input capture/output compare is not generated. * 3 not available in the h8s/2227 group.
rev. 2.00, 05/03, page 357 of 846 table 11.18 tior_4 description bit 7 iob3 bit 6 iob2 bit 5 iob1 bit 4 iob0 tgrb_4 function * tiocb4 pin function * 0 0 0 0 output disabled 1 output compare register initial output is 0 output 0 output at compare match 1 0 initial output is 0 output 1 output at compare match 1 initial output is 0 output toggle output at compare match 1 0 0 output disabled 1 initial output is 1 output 0 output at compare match 1 0 initial output is 1 output 1 output at compare match 1 initial output is 1 output toggle output at compare match 1 0 0 0 capture input source is tiocb4 pin input capture at rising edge 1 capture input source is tiocb4 pin input capture at falling edge 1x input capture register capture input source is tiocb4 pin input capture at both edges 1 x x capture input source is tgrc_3 compare match/input capture input capture at generation of tgrc_3 compare match/input capture legend: x: don't care note: * not available in the h8s/2227 group.
rev. 2.00, 05/03, page 358 of 846 table 11.19 tior_5 description bit 7 iob3 bit 6 iob2 bit 5 iob1 bit 4 iob0 tgrb_5 function * tiocb5 pin function * 0 0 0 0 output disabled 1 output compare register initial output is 0 output 0 output at compare match 1 0 initial output is 0 output 1 output at compare match 1 initial output is 0 output toggle output at compare match 1 0 0 output disabled 1 initial output is 1 output 0 output at compare match 1 0 initial output is 1 output 1 output at compare match 1 initial output is 1 output toggle output at compare match 1 x 0 0 capture input source is tiocb5 pin input capture at rising edge 1 capture input source is tiocb5 pin input capture at falling edge 1x input capture register capture input source is tiocb5 pin input capture at both edges legend: x: don't care note: * not available in the h8s/2227 group.
rev. 2.00, 05/03, page 359 of 846 table 11.20 tiorh_0 description bit 3 ioa3 bit 2 ioa2 bit 1 ioa1 bit 0 ioa0 tgra_0 function tioca0 pin function 0 0 0 0 output disabled 1 output compare register initial output is 0 output 0 output at compare match 1 0 initial output is 0 output 1 output at compare match 1 initial output is 0 output toggle output at compare match 1 0 0 output disabled 1 initial output is 1 output 0 output at compare match 1 0 initial output is 1 output 1 output at compare match 1 initial output is 1 output toggle output at compare match 1 0 0 0 capture input source is tioca0 pin input capture at rising edge 1 capture input source is tioca0 pin input capture at falling edge 1x input capture register capture input source is tioca0 pin input capture at both edges 1 x x capture input source is channel 1/count clock input capture at tcnt_1 count-up/count-down * legend: x: don't care note: * not available in the h8s/2227 group.
rev. 2.00, 05/03, page 360 of 846 table 11.21 tiorl_0 description bit 3 ioc3 bit 2 ioc2 bit 1 ioc1 bit 0 ioc0 tgrc_0 function tiocc0 pin function 0 0 0 0 output disabled 1 output compare register * 1 initial output is 0 output 0 output at compare match 1 0 initial output is 0 output 1 output at compare match 1 initial output is 0 output toggle output at compare match 1 0 0 output disabled 1 initial output is 1 output 0 output at compare match 1 0 initial output is 1 output 1 output at compare match 1 initial output is 1 output toggle output at compare match 1 0 0 0 capture input source is tiocc0 pin input capture at rising edge 1 capture input source is tiocc0 pin input capture at falling edge 1x input capture register * 1 capture input source is tiocc0 pin input capture at both edges 1 x x capture input source is channel 1/count clock input capture at tcnt_1 count-up/count- down * 2 legend: x: don't care notes: * 1 when the bfa bit in tmdr_0 is set to 1 and tgrc_0 is used as a buffer register, this setting is invalid and input capture/output compare is not generated. * 2 not available in the h8s/2227 group.
rev. 2.00, 05/03, page 361 of 846 table 11.22 tior_1 description bit 3 ioa3 bit 2 ioa2 bit 1 ioa1 bit 0 ioa0 tgra_1 function tioca1 pin function 0 0 0 0 output disabled 1 output compare register initial output is 0 output 0 output at compare match 1 0 initial output is 0 output 1 output at compare match 1 initial output is 0 output toggle output at compare match 1 0 0 output disabled 1 initial output is 1 output 0 output at compare match 1 0 initial output is 1 output 1 output at compare match 1 initial output is 1 output toggle output at compare match 1 0 0 0 capture input source is tioca1 pin input capture at rising edge 1 capture input source is tioca1 pin input capture at falling edge 1x input capture register capture input source is tioca1 pin input capture at both edges 1 x x capture input source is tgra_0 compare match/input capture input capture at generation of channel 0/tgra_0 compare match/input capture * legend: x: don't care note: * not available in the h8s/2227 group.
rev. 2.00, 05/03, page 362 of 846 table 11.23 tior_2 description bit 3 ioa3 bit 2 ioa2 bit 1 ioa1 bit 0 ioa0 tgra_2 function tioca2 pin function 0 0 0 0 output disabled 1 output compare register initial output is 0 output 0 output at compare match 1 0 initial output is 0 output 1 output at compare match 1 initial output is 0 output toggle output at compare match 1 0 0 output disabled 1 initial output is 1 output 0 output at compare match 1 0 initial output is 1 output 1 output at compare match 1 initial output is 1 output toggle output at compare match 1 x 0 0 capture input source is tioca2 pin input capture at rising edge 1 capture input source is tioca2 pin input capture at falling edge 1x input capture register capture input source is tioca2 pin input capture at both edges legend: x: don't care
rev. 2.00, 05/03, page 363 of 846 table 11.24 tiorh_3 description bit 3 ioa3 bit 2 ioa2 bit 1 ioa1 bit 0 ioa0 tgra_3 function * tioca3 pin function * 0 0 0 0 output disabled 1 output compare register initial output is 0 output 0 output at compare match 1 0 initial output is 0 output 1 output at compare match 1 initial output is 0 output toggle output at compare match 1 0 0 output disabled 1 initial output is 1 output 0 output at compare match 1 0 initial output is 1 output 1 output at compare match 1 initial output is 1 output toggle output at compare match 1 0 0 0 capture input source is tioca3 pin input capture at rising edge 1 capture input source is tioca3 pin input capture at falling edge 1x input capture register capture input source is tioca3 pin input capture at both edges 1 x x capture input source is channel 4/count clock input capture at tcnt_4 count-up/count-down legend: x: don't care note: * not available in the h8s/2227 group.
rev. 2.00, 05/03, page 364 of 846 table 11.25 tiorl_3 description bit 3 ioc3 bit 2 ioc2 bit 1 ioc1 bit 0 ioc0 tgrc_3 function * 2 tiocc3 pin function * 2 0 0 0 0 output disabled 1 output compare register * 1 initial output is 0 output 0 output at compare match 1 0 initial output is 0 output 1 output at compare match 1 initial output is 0 output toggle output at compare match 1 0 0 output disabled 1 initial output is 1 output 0 output at compare match 1 0 initial output is 1 output 1 output at compare match 1 initial output is 1 output toggle output at compare match 1 0 0 0 capture input source is tiocc3 pin input capture at rising edge 1 capture input source is tiocc3 pin input capture at falling edge 1x input capture register * 1 capture input source is tiocc3 pin input capture at both edges 1 x x capture input source is channel 4/count clock input capture at tcnt_4 count-up/count-down legend: x: don't care notes: * 1 when the bfa bit in tmdr_3 is set to 1 and tgrc_3 is used as a buffer register, this setting is invalid and input capture/output compare is not generated. * 2 not available in the h8s/2227 group.
rev. 2.00, 05/03, page 365 of 846 table 11.26 tior_4 description bit 3 ioa3 bit 2 ioa2 bit 1 ioa1 bit 0 ioa0 tgra_4 function * tioca4 pin function * 0 0 0 0 output disabled 1 output compare register initial output is 0 output 0 output at compare match 1 0 initial output is 0 output 1 output at compare match 1 initial output is 0 output toggle output at compare match 1 0 0 output disabled 1 initial output is 1 output 0 output at compare match 1 0 initial output is 1 output 1 output at compare match 1 initial output is 1 output toggle output at compare match 1 0 0 0 capture input source is tioca4 pin input capture at rising edge 1 capture input source is tioca4 pin input capture at falling edge 1x input capture register capture input source is tioca4 pin input capture at both edges 1 x x capture input source is tgra_3 compare match/input capture input capture at generation of tgra_3 compare match/input capture legend: x: don't care note: * not available in the h8s/2227 group.
rev. 2.00, 05/03, page 366 of 846 table 11.27 tior_5 description bit 3 ioa3 bit 2 ioa2 bit 1 ioa1 bit 0 ioa0 tgra_5 function * tioca5 pin function * 0 0 0 0 output disabled 1 output compare register initial output is 0 output 0 output at compare match 1 0 initial output is 0 output 1 output at compare match 1 initial output is 0 output toggle output at compare match 1 0 0 output disabled 1 initial output is 1 output 0 output at compare match 1 0 initial output is 1 output 1 output at compare match 1 initial output is 1 output toggle output at compare match 1 x 0 0 input capture source is tioca5 pin input capture at rising edge 1 input capture source is tioca5 pin input capture at falling edge 1x input capture register input capture source is tioca5 pin input capture at both edges legend: x: don't care note: * not available in the h8s/2227 group.
rev. 2.00, 05/03, page 367 of 846 11.3.4 timer interrupt enable register (tier) the tier registers control enabling or disabling of interrupt requests for each channel. the tpu has six tier registers, one for each channel. bit bit name initial value r/w description 7 ttge 0 r/w a/d conversion start request enable enables or disables generation of a/d conversion start requests by tgra input capture/compare match. 0: a/d conversion start request generation disabled 1: a/d conversion start request generation enabled 6 ? 1 ? reserved this bit is always read as 1 and cannot be modified. 5 tcieu 0 r/w underflow interrupt enable enables or disables interrupt requests (tciu) by the tcfu flag when the tcfu flag in tsr is set to 1 in channels 1, 2, 4, and 5. in channels 0 and 3, bit 5 is reserved. it is always read as 0 and cannot be modified. 0: interrupt requests (tciu) by tcfu disabled 1: interrupt requests (tciu) by tcfu enabled 4 tciev 0 r/w overflow interrupt enable enables or disables interrupt requests (tciv) by the tcfv flag when the tcfv flag in tsr is set to 1. 0: interrupt requests (tciv) by tcfv disabled 1: interrupt requests (tciv) by tcfv enabled 3 tgied 0 r/w tgr interrupt enable d enables or disables interrupt requests (tgid) by the tgfd bit when the tgfd bit in tsr is set to 1 in channels 0 and 3. in channels 1, 2, 4, and 5, bit 3 is reserved. it is always read as 0 and cannot be modified. 0: interrupt requests (tgid) by tgfd bit disabled 1: interrupt requests (tgid) by tgfd bit enabled
rev. 2.00, 05/03, page 368 of 846 bit bit name initial value r/w description 2 tgiec 0 r/w tgr interrupt enable c enables or disables interrupt requests (tgic) by the tgfc bit when the tgfc bit in tsr is set to 1 in channels 0 and 3. in channels 1, 2, 4, and 5, bit 2 is reserved. it is always read as 0 and cannot be modified. 0: interrupt requests (tgic) by tgfc bit disabled 1: interrupt requests (tgic) by tgfc bit enabled 1 tgieb 0 r/w tgr interrupt enable b enables or disables interrupt requests (tgib) by the tgfb bit when the tgfb bit in tsr is set to 1. 0: interrupt requests (tgib) by tgfb bit disabled 1: interrupt requests (tgib) by tgfb bit enabled 0 tgiea 0 r/w tgr interrupt enable a enables or disables interrupt requests (tgia) by the tgfa bit when the tgfa bit in tsr is set to 1. 0: interrupt requests (tgia) by tgfa bit disabled 1: interrupt requests (tgia) by tgfa bit enabled
rev. 2.00, 05/03, page 369 of 846 11.3.5 timer status register (tsr) the tsr registers indicate the status of each channel. the tpu has six tsr registers, one for each channel. bit bit name initial value r/w description 7 tcfd 1 r count direction flag status flag that shows the direction in which tcnt counts in channels 1, 2, 4, and 5. in channels 0 and 3, bit 7 is reserved. it is always read as 1 and cannot be modified. 0: tcnt counts down 1: tcnt counts up 6 ? 1 ? reserved this bit is always read as 1 and cannot be modified. 5 tcfu 0 r/(w) * 1 underflow flag status flag that indicates that tcnt underflow has occurred when channels 1, 2, 4, and 5 are set to phase counting mode. in channels 0 and 3, bit 5 is reserved. it is always read as 0 and cannot be modified. [setting condition] when the tcnt value underflows (changes from h'0000 to h'ffff) [clearing condition] when 0 is written to tcfu after reading tcfu = 1 4 tcfv 0 r/(w) * 1 overflow flag status flag that indicates that tcnt overflow has occurred. [setting condition] when the tcnt value overflows (changes from h'ffff to h'0000) [clearing condition] when 0 is written to tcfv after reading tcfv = 1
rev. 2.00, 05/03, page 370 of 846 bit bit name initial value r/w description 3tgfd 0 r/(w) * 1 input capture/output compare flag d status flag that indicates the occurrence of tgrd input capture or compare match in channels 0 and 3. in channels 1, 2, 4, and 5, bit 3 is reserved. it is always read as 0 and cannot be modified. [setting conditions] ? when tcnt = tgrd while tgrd is functioning as output compare register ? when tcnt value is transferred to tgrd by input capture signal while tgrd is functioning as input capture register [clearing conditions] ? when dtc is activated by tgid interrupt while disel bit of mrb in dtc is 0 ? when 0 is written to tgfd after reading tgfd = 1 2tgfc 0 r/(w) * 1 input capture/output compare flag c status flag that indicates the occurrence of tgrc input capture or compare match in channels 0 and 3. in channels 1, 2, 4, and 5, bit 2 is reserved. it is always read as 0 and cannot be modified. [setting conditions] ? when tcnt = tgrc while tgrc is functioning as output compare register ? when tcnt value is transferred to tgrc by input capture signal while tgrc is functioning as input capture register [clearing conditions] ? when dtc is activated by tgic interrupt while disel bit of mrb in dtc is 0 ? when 0 is written to tgfc after reading tgfc = 1
rev. 2.00, 05/03, page 371 of 846 bit bit name initial value r/w description 1tgfb 0 r/(w) * 1 input capture/output compare flag b status flag that indicates the occurrence of tgrb input capture or compare match. [setting conditions] ? when tcnt = tgrb while tgrb is functioning as output compare register ? when tcnt value is transferred to tgrb by input capture signal while tgrb is functioning as input capture register [clearing conditions] ? when dtc is activated by tgib interrupt while disel bit of mrb in dtc is 0 ? when 0 is written to tgfb after reading tgfb = 1 0tgfa 0 r/(w) * 1 input capture/output compare flag a status flag that indicates the occurrence of tgra input capture or compare match. [setting conditions] ? when tcnt = tgra while tgra is functioning as output compare register ? when tcnt value is transferred to tgra by input capture signal while tgra is functioning as input capture register [clearing conditions] ? when dtc is activated by tgia interrupt while disel bit of mrb in dtc is 0 ? when dmac is activated by tgia interrupt while dte bit of dmabcr in dmac is 1 * 2 ? when 0 is written to tgfa after reading tgfa = 1 notes: * 1 only 0 can be written, for flag clearing. * 2 supported only by the h8s/2239 group.
rev. 2.00, 05/03, page 372 of 846 11.3.6 timer counter (tcnt) the tcnt registers are 16-bit readable/writable counters. the tpu has six tcnt counters, one for each channel. the tcnt counters are initialized to h'0000 by a reset, or in hardware standby mode. the tcnt counters cannot be accessed in 8-bit units; they must always be accessed as a 16-bit unit. 11.3.7 timer general register (tgr) the tgr registers are 16-bit readable/writable registers with a dual function as output compare and input capture registers. the tpu has 16 tgr registers, four each for channels 0 and 3 and two each for channels 1, 2, 4, and 5. tgrc and tgrd for channels 0 and 3 can also be designated for operation as buffer registers. the tgr registers cannot be accessed in 8-bit units; they must always be accessed as a 16-bit unit. tgr buffer register combinations are tgra?tgrc and tgrb?tgrd. 11.3.8 timer start register (tstr) tstr selects operation/stoppage for channels 0 to 5. when setting the operating mode in tmdr or setting the count clock in tcr, first stop the tcnt counter. bit bit name initial value r/w description 7 6 ? ? 0 0 ? ? reserved the write value should always be 0. 5 4 3 2 1 0 cst5 cst4 cst3 cst2 cst1 cst0 0 0 0 0 0 0 r/w r/w r/w r/w r/w r/w counter start 5 to 0 these bits select operation or stoppage for tcnt. if 0 is written to the cst bit during operation with the tioc pin designated for output, the counter stops but the tioc pin output compare output level is retained. if tior is written to when the cst bit is cleared to 0, the pin output level will be changed to the set initial output value. 0: tcnt_5 to tcnt_0 count operation is stopped 1: tcnt_5 to tcnt_0 performs count operation
rev. 2.00, 05/03, page 373 of 846 11.3.9 timer synchronous register (tsyr) tsyr selects independent operation or synchronous operation for the tcnt counters of channels 0 to 5. a channel performs synchronous operation when the corresponding bit in tsyr is set to 1. bit bit name initial value r/w description 7 6 ? ? 0 0 r/w r/w reserved the write value should always be 0. 5 4 3 2 1 0 sync5 sync4 sync3 sync2 sync1 sync0 0 0 0 0 0 0 r/w r/w r/w r/w r/w r/w timer synchronization 5 to 0 these bits select whether operation is independent of or synchronized with other channels. when synchronous operation is selected, synchronous presetting of multiple channels, and synchronous clearing through counter clearing on another channel are possible. to set synchronous operation, the sync bits for at least two channels must be set to 1. to set synchronous clearing, in addition to the sync bit, the tcnt clearing source must also be set by means of bits cclr2 to cclr0 in tcr. 0: tcnt_5 to tcnt_0 operates independently (tcnt presetting /clearing is unrelated to other channels) 1: tcnt_5 to tcnt_0 performs synchronous operation (tcnt synchronous presetting/ synchronous clearing is possible)
rev. 2.00, 05/03, page 374 of 846 11.4 operation 11.4.1 basic functions each channel has a tcnt and tgr register. tcnt performs up-counting, and is also capable of free-running operation, periodic counting, and external event counting. each tgr can be used as an input capture register or output compare register. counter operation: when one of bits cst0 to cst5 is set to 1 in tstr, the tcnt counter for the corresponding channel starts counting. tcnt can operate as a free-running counter, periodic counter, and so on. 1. example of count operation setting procedure figure 11.3 shows an example of the count operation setting procedure. select counter clock operation selection select counter clearing source periodic counter set period start count [1] [2] [4] [3] [5] free-running counter start count [5] [1] [2] [3] [4] [5] select output compare register select the counter clock with bits tpsc2 to tpsc0 in tcr. at the same time, select the input clock edge with bits ckeg1 and ckeg0 in tcr. for periodic counter operation, select the tgr to be used as the tcnt clearing source with bits cclr2 to cclr0 in tcr. designate the tgr selected in [2] as an output compare register by means of tior. set the periodic counter cycle in the tgr selected in [2]. set the cst bit in tstr to 1 to start the counter operation. figure 11.3 example of counter operation setting procedure
rev. 2.00, 05/03, page 375 of 846 2. free-running count operation and periodic count operation immediately after a reset, the tpu's tcnt counters are all designated as free-running counters. when the relevant bit in tstr is set to 1 the corresponding tcnt counter starts up- count operation as a free-running counter. when tcnt overflows (changes from h'ffff to h'0000), the tcfv bit in tsr is set to 1. if the value of the corresponding tciev bit in tier is 1 at this point, the tpu requests an interrupt. after overflow, tcnt starts counting up again from h'0000. figure 11.4 illustrates free-running counter operation. tcnt value h'ffff h'0000 cst bit tcfv time figure 11.4 free-running counter operation when compare match is selected as the tcnt clearing source, the tcnt counter for the relevant channel performs periodic count operation. the tgr register for setting the period is designated as an output compare register, and counter clearing by compare match is selected by means of bits cclr2 to cclr0 in tcr. after the settings have been made, tcnt starts count-up operation as a periodic counter when the corresponding bit in tstr is set to 1. when the count value matches the value in tgr, the tgf bit in tsr is set to 1 and tcnt is cleared to h'0000. if the value of the corresponding tgie bit in tier is 1 at this point, the tpu requests an interrupt. after a compare match, tcnt starts counting up again from h'0000. figure 11.5 illustrates periodic counter operation.
rev. 2.00, 05/03, page 376 of 846 tcnt value tgr h'0000 cst bit tgf time counter cleared by tgr compare match flag cleared by software, dtc, o r dmac * activation note: * supported only by the h8s/2239 group. figure 11.5 periodic counter operation waveform output by compare match: the tpu can perform 0, 1, or toggle output from the corresponding output pin using a compare match. 1. example of setting procedure for waveform output by compare match figure 11.6 shows an example of the setting procedure for waveform output by a compare match. select waveform output mode output selection set output timing start count [1] [2] [3] [1] select initial value 0 output or 1 output, and compare match output value 0 output, 1 output, or toggle output, by means of tior. the set initial value is output at the tioc pin until the first compare match occurs. [2] set the timing for compare match generation in tgr. [3] set the cst bit in tstr to 1 to start the count operation. figure 11.6 example of setting procedure for waveform output by compare match
rev. 2.00, 05/03, page 377 of 846 2. examples of waveform output operation figure 11.7 shows an example of 0 output/1 output. in this example, tcnt has been designated as a free-running counter, and settings have been made so that 1 is output by compare match a, and 0 is output by compare match b. when the set level and the pin level match, the pin level does not change. tcnt value h'ffff h'0000 tioca tiocb time tgra tgrb no change no change no change no change 1 output 0 output figure 11.7 example of 0 output/1 output operation figure 11.8 shows an example of toggle output. in this example tcnt has been designated as a periodic counter (with counter clearing performed by compare match b), and settings have been made so that output is toggled by both compare match a and compare match b. tcnt value h'ffff h'0000 tiocb tioca time tgrb tgra toggle output toggle output counter cleared by tgrb compare match figure 11.8 example of toggle output operation
rev. 2.00, 05/03, page 378 of 846 input capture function: the tcnt value can be transferred to tgr on detection of the tioc pin input edge. rising edge, falling edge, or both edges can be selected as the detection edge. for channels 0, 1, 3, and 4, it is also possible to specify another channel's counter input clock or compare match signal as the input capture source. note: when another channel's counter input clock is used as the input capture input for channels 0 and 3, /1 should not be selected as the counter input clock used for input capture input. input capture will not be generated if /1 is selected. 1. example of setting procedure for input capture operation figure 11.9 shows an example of the setting procedure for input capture operation. select input capture input input selection start count [1] [2] [1] designate tgr as an input capture register by means of tior, and select the input capture source and input signal edge (rising edge, falling edge, or both edges). [2] set the cst bit in tstr to 1 to start the count operation. figure 11.9 example of setting procedure for input capture operation 2. example of input capture operation figure 11.10 shows an example of input capture operation. in this example both rising and falling edges have been selected as the tioca pin input capture input edge, falling edge has been selected as the tiocb pin input capture input edge, and counter clearing by tgrb input capture has been designated for tcnt.
rev. 2.00, 05/03, page 379 of 846 tcnt value h'0180 h'0000 tioca tgra time h'0010 h'0005 counter cleared by tiocb input (falling edge) h'0160 h'0005 h'0160 h'0010 tgrb h'0180 tiocb figure 11.10 example of input capture operation 11.4.2 synchronous operation in synchronous operation, the values in multiple tcnt counters can be rewritten simultaneously (synchronous presetting). also, multiple of tcnt counters can be cleared simultaneously (synchronous clearing) by making the appropriate setting in tcr. synchronous operation enables tgr to be incremented with respect to a single time base. channels 0 to 5 can all be designated for synchronous operation. example of synchronous operation setting procedure: figure 11.11 shows an example of the synchronous operation setting procedure.
rev. 2.00, 05/03, page 380 of 846 synchronous operation selection set tcnt synchronous presetting [1] [2] synchronous clearing select counter clearing source [3] start count [5] set synchronous counter clearing [4] start count [5] clearing source generation channel? no yes [1] set to 1 the sync bits in tsyr corresponding to the channels to be designated for synchronous operation. [2] when the tcnt counter of any of the channels designated for synchronous operation is written to, the same value is simultaneously written to the other tcnt counters. [3] use bits cclr2 to cclr0 in tcr to specify tcnt clearing by input capture/output compare, etc. [4] use bits cclr2 to cclr0 in tcr to designate synchronous clearing for the counter clearing source. [5] set to 1 the cst bits in tstr for the relevant channels, to start the count operation. set synchronous operation figure 11.11 example of synchronous operation setting procedure example of synchronous operation: figure 11.12 shows an example of synchronous operation. in this example, synchronous operation and pwm mode 1 have been designated for channels 0 to 2, tgrb_0 compare match has been set as the channel 0 counter clearing source, and synchronous clearing has been set for the channel 1 and 2 counter clearing source. three-phase pwm waveforms are output from pins tioca0, tioca1, and tioca2. at this time, synchronous presetting, and synchronous clearing by tgrb_0 compare match, is performed for channel 0 to 2 tcnt counters, and the data set in tgrb_0 is used as the pwm cycle. for details on pwm modes, see section 11.4.5, pwm modes.
rev. 2.00, 05/03, page 381 of 846 tcnt0 to tcnt2 values h ? 0000 tioca_0 tioca_1 tgrb_0 synchronous clearing by tgrb_0 compare match tgra_2 tgra_1 tgrb_2 tgra_0 tgrb_1 tioca_2 time figure 11.12 example of synchronous operation 11.4.3 buffer operation buffer operation, provided for channels 0 and 3, enables tgrc and tgrd to be used as buffer registers. buffer operation differs depending on whether tgr has been designated as an input capture register or a compare match register. table 11.28 shows the register combinations used in buffer operation. table 11.28 register combinations in buffer operation channel timer general register buffer register 0 tgra_0 tgrc_0 tgrb_0 tgrd_0 3 tgra_3 tgrc_3 tgrb_3 tgrd_3 ? when tgr is an output compare register when a compare match occurs, the value in the buffer register for the corresponding channel is transferred to the timer general register. this operation is illustrated in figure 11.13.
rev. 2.00, 05/03, page 382 of 846 buffer register timer general register tcnt comparator compare match signal figure 11.13 compare match buffer operation ? when tgr is an input capture register when input capture occurs, the value in tcnt is transferred to tgr and the value previously held in the timer general register is transferred to the buffer register. this operation is illustrated in figure 11.14. buffer register timer general register tcnt input capture signal figure 11.14 input capture buffer operation example of buffer operation setting procedure: figure 11.15 shows an example of the buffer operation setting procedure. select tgr function buffer operation set buffer operation start count [1] [2] [3] [1] designate tgr as an input capture register or output compare register by means of tior. [2] designate tgr for buffer operation with bits bfa and bfb in tmdr. [3] set the cst bit in tstr to 1 to start the count operation. figure 11.15 example of buffer operation setting procedure
rev. 2.00, 05/03, page 383 of 846 examples of buffer operation: 1. when tgr is an output compare register figure 11.16 shows an operation example in which pwm mode 1 has been designated for channel 0, and buffer operation has been designated for tgra and tgrc. the settings used in this example are tcnt clearing by compare match b, 1 output at compare match a, and 0 output at compare match b. as buffer operation has been set, when compare match a occurs the output changes and the value in buffer register tgrc is simultaneously transferred to timer general register tgra. this operation is repeated each time compare match a occurs. for details on pwm modes, see section 11.4.5, pwm modes. tcnt value tgrb_0 h ? 0000 tgrc_0 tgra_0 h ? 0200 h ? 0520 tioca h ? 0200 h ? 0450 h ? 0520 h ? 0450 tgra_0 h ? 0450 h ? 0200 transfer time figure 11.16 example of buffer operation (1) 2. when tgr is an input capture register figure 11.17 shows an operation example in which tgra has been designated as an input capture register, and buffer operation has been designated for tgra and tgrc. counter clearing by tgra input capture has been set for tcnt, and both rising and falling edges have been selected as the tioca pin input capture input edge. as buffer operation has been set, when the tcnt value is stored in tgra upon occurrence of input capture a, the value previously stored in tgra is simultaneously transferred to tgrc.
rev. 2.00, 05/03, page 384 of 846 tcnt value h ? 09fb h ? 0000 tgrc time h ? 0532 tioca tgra h ? 0f07 h ? 0532 h ? 0f07 h ? 0532 h ? 0f07 h ? 09fb figure 11.17 example of buffer operation (2) 11.4.4 cascaded operation in cascaded operation * , two 16-bit counters for different channels are used together as a 32-bit counter. this function works by counting the channel 1 (channel 4) counter clock at overflow/underflow of tcnt_2 (tcnt_5) as set in bits tpsc2 to tpsc0 in tcr. underflow occurs only when the lower 16-bit tcnt is in phase-counting mode. table 11.29 shows the register combinations used in cascaded operation. notes: when phase counting mode is set for channel 1 or 4, the counter clock setting is invalid and the counter operates independently in phase counting mode. * not available in the h8s/2227 group. table 11.29 cascaded combinations combination upper 16 bits lower 16 bits channels 1 and 2 tcnt_1 tcnt_2 channels 4 and 5 tcnt_4 tcnt_5
rev. 2.00, 05/03, page 385 of 846 example of cascaded operation setting procedure: figure 11.18 shows an example of the setting procedure for cascaded operation. cascaded operation set cascading start count set bits tpsc2 to tpsc0 in the channel 1 (channel 4) tcr to b ? 1111 to select tcnt_2 (tcnt_5) overflow/underflow counting. set the cst bit in tstr for the upper and lower channel to 1 to start the count operation. [1] [2] [1] [2] figure 11.18 cascaded operation setting procedure examples of cascaded operation: figure 11.19 illustrates the operation when counting upon tcnt_2 overflow/underflow has been set for tcnt_1, tgra_1 and tgra_2 have been designated as input capture registers, and the tioc pin rising edge has been selected. when a rising edge is input to the tioca1 and tioca2 pins simultaneously, the upper 16 bits of the 32-bit data are transferred to tgra_1, and the lower 16 bits to tgra_2. tcnt_2 clock tcnt_2 h ? ffff h ? 0000 h ? 0001 tioca1, tioca2 tgra_1 h ? 03a2 tgra_2 h ? 0000 tcnt_1 clock tcnt_1 h ? 03a1 h ? 03a2 figure 11.19 example of cascaded operation (1) figure 11.20 illustrates the operation when counting upon tcnt_2 overflow/underflow has been set for tcnt_1, and phase counting mode has been designated for channel 2. tcnt_1 is incremented by tcnt_2 overflow and decremented by tcnt_2 underflow.
rev. 2.00, 05/03, page 386 of 846 tclkc tcnt_2 fffd tcnt_1 0001 tclkd fffe ffff 0000 0001 0002 0001 0000 ffff 0000 0000 figure 11.20 example of cascaded operation (2) 11.4.5 pwm modes in pwm mode, pwm waveforms are output from the output pins. 0, 1, or toggle output can be selected as the output level in response to compare match of each tgr. settings of tgr registers can output a pwm waveform in the range of 0% to 100% duty cycle. designating tgr compare match as the counter clearing source enables the cycle to be set in that register. all channels can be designated for pwm mode independently. synchronous operation is also possible. there are two pwm modes, as described below. ? pwm mode 1 pwm output is generated from the tioca and tiocc pins by pairing tgra with tgrb and tgrc with tgrd. the outputs specified by bits ioa3 to ioa0 and ioc3 to ioc0 in tior are output from the tioca and tiocc pins at compare matches a and c, respectively. the outputs specified by bits iob3 to iob0 and iod3 to iod0 in tior are output at compare matches b and d, respectively. the initial output value is the value set in tgra or tgrc. if the set values of paired tgrs are identical, the output value does not change when a compare match occurs. in pwm mode 1, a maximum 8-phase pwm output is possible. ? pwm mode 2 pwm output is generated using one tgr as the cycle register and the others as duty cycle registers. the output specified in tior is performed by means of compare matches. upon counter clearing by a synchronization register compare match, the output value of each pin is the initial value set in tior. if the set values of the cycle and duty cycle registers are identical, the output value does not change when a compare match occurs. in pwm mode 2, a maximum 15-phase pwm output is possible by combined use with synchronous operation. the correspondence between pwm output pins and registers is shown in table 11.30.
rev. 2.00, 05/03, page 387 of 846 table 11.30 pwm output registers and output pins output pins channel registers pwm mode 1 pwm mode 2 0 tgra_0 tioca0 tioca0 tgrb_0 tiocb0 tgrc_0 tiocc0 tiocc0 tgrd_0 tiocd0 1 tgra_1 tioca1 tioca1 tgrb_1 tiocb1 2 tgra_2 tioca2 tioca2 tgrb_2 tiocb2 3 * tgra_3 tioca3 tioca3 tgrb_3 tiocb3 tgrc_3 tiocc3 tiocc3 tgrd_3 tiocd3 4 * tgra_4 tioca4 tioca4 tgrb_4 tiocb4 5 * tgra_5 tioca5 tioca5 tgrb_5 tiocb5 notes: in pwm mode 2, pwm output is not possible for the tgr register in which the cycle is set. * not available in the h8s/2227 group.
rev. 2.00, 05/03, page 388 of 846 example of pwm mode setting procedure: figure 11.21 shows an example of the pwm mode setting procedure. select counter clock pwm mode select counter clearing source select waveform output level [1] [2] [3] set tgr [4] set pwm mode [5] start count [6] [1] select the counter clock with bits tpsc2 to tpsc0 in tcr. at the same time, select the input clock edge with bits ckeg1 and ckeg0 in tcr. [2] use bits cclr2 to cclr0 in tcr to select the tgr to be used as the tcnt clearing source. [3] use tior to designate the tgr as an output compare register, and select the initial value and output value. [4] set the cycle in the tgr selected in [2], and set the duty in the other tgrs. [5] select the pwm mode with bits md3 to md0 in tmdr. [6] set the cst bit in tstr to 1 to start the count operation. figure 11.21 example of pwm mode setting procedure examples of pwm mode operation: figure 11.22 shows an example of pwm mode 1 operation. in this example, tgra compare match is set as the tcnt clearing source, 0 is set for the tgra initial output value and output value, and 1 is set as the tgrb output value. in this case, the value set in tgra is used as the cycle, and the values set in tgrb registers as the duty cycle.
rev. 2.00, 05/03, page 389 of 846 tcnt value tgra h ? 0000 tioca time tgrb counter cleared by tgra compare match figure 11.22 example of pwm mode operation (1) figure 11.23 shows an example of pwm mode 2 operation. in this example, synchronous operation is designated for channels 0 and 1, tgrb_1 compare match is set as the tcnt clearing source, and 0 is set for the initial output value and 1 for the output value of the other tgr registers (tgra_0 to tgrd_0, tgra_1), to output a 5-phase pwm waveform. in this case, the value set in tgrb_1 is used as the cycle, and the values set in the other tgrs as the duty cycle. tcnt value tgrb_1 h ? 0000 tioca0 counter cleared by tgrb_1 compare match time tgra_1 tgrd_0 tgrc_0 tgrb_0 tgra_0 tiocb0 tiocc0 tiocd0 tioca1 figure 11.23 example of pwm mode operation (2)
rev. 2.00, 05/03, page 390 of 846 figure 11.24 shows examples of pwm waveform output with 0% duty cycle and 100% duty cycle in pwm mode. tcnt value tgra h ? 0000 tioca time tgrb 0% duty tgrb rewritten tgrb rewritten tgrb rewritten tcnt value tgra h ? 0000 tioca time tgrb 100% duty tgrb rewritten tgrb rewritten tgrb rewritten output does not change when cycle register and duty register compare matches occur simultaneously tcnt value tgra h ? 0000 tioca time tgrb 100% duty tgrb rewritten tgrb rewritten tgrb rewritten output does not change when cycle register and duty register compare matches occur simultaneously 0% duty figure 11.24 example of pwm mode operation (3)
rev. 2.00, 05/03, page 391 of 846 11.4.6 phase counting mode in phase counting mode, the phase difference between two external clock inputs is detected and tcnt is incremented/decremented accordingly. this mode can be set for channels 1, 2, 4, and 5. when phase counting mode is set, an external clock is selected as the counter input clock and tcnt operates as an up/down-counter regardless of the setting of bits tpsc2 to tpsc0 and bits ckeg1 and ckeg0 in tcr. however, the functions of bits cclr1 and cclr0 in tcr, and of tior, tier, and tgr are valid, and input capture/compare match and interrupt functions can be used. this can be used for two-phase encoder pulse input. when overflow occurs while tcnt is counting up, the tcfv flag in tsr is set; when underflow occurs while tcnt is counting down, the tcfu flag is set. the tcfd bit in tsr is the count direction flag. reading the tcfd flag provides an indication of whether tcnt is counting up or down. table 11.31 shows the correspondence between external clock pins and channels. table 11.31 clock input pins in phase counting mode external clock pins channels a-phase b-phase when channel 1 or 5 is set to phase counting mode tclka tclkb when channel 2 or 4 is set to phase counting mode tclkc tclkd example of phase counting mode setting procedure: figure 11.25 shows an example of the phase counting mode setting procedure. phase counting mode select phase counting mode start count select phase counting mode with bits md3 to md0 in tmdr. set the cst bit in tstr to 1 to start the count operation. [1] [2] [1] [2] figure 11.25 example of phase counting mode setting procedure
rev. 2.00, 05/03, page 392 of 846 examples of phase counting mode operation: in phase counting mode, tcnt counts up or down according to the phase difference between two external clocks. there are four modes, according to the count conditions. 1. phase counting mode 1 figure 11.26 shows an example of phase counting mode 1 operation, and table 11.32 summarizes the tcnt up/down-count conditions. tcnt value time down-count up-count tclka (channels 1 and 5) tclkc (channels 2 and 4) tclkb (channels 1 and 5) tclkd (channels 2 and 4) figure 11.26 example of phase counting mode 1 operation table 11.32 up/down-count conditions in phase counting mode 1 tclka (channels 1 and 5) tclkc (channels 2 and 4) tclkb (channels 1 and 5) tclkd (channels 2 and 4) operation high level up-count low level low level high level high level down-count low level high level low level legend : rising edge : falling edge
rev. 2.00, 05/03, page 393 of 846 2. phase counting mode 2 figure 11.27 shows an example of phase counting mode 2 operation, and table 11.33 summarizes the tcnt up/down-count conditions. time down-count up-count tcnt value tclka (channels 1 and 5) tclkc (channels 2 and 4) tclkb (channels 1 and 5) tclkd (channels 2 and 4) figure 11.27 example of phase counting mode 2 operation table 11.33 up/down-count conditions in phase counting mode 2 tclka (channels 1 and 5) tclkc (channels 2 and 4) tclkb (channels 1 and 5) tclkd (channels 2 and 4) operation high level don't care low level don't care low level don't care high level up-count high level don't care low level don't care high level don't care low level down-count legend : rising edge : falling edge
rev. 2.00, 05/03, page 394 of 846 3. phase counting mode 3 figure 11.28 shows an example of phase counting mode 3 operation, and table 11.34 summarizes the tcnt up/down-count conditions. time up-count down-count tcnt value tclka (channels 1 and 5) tclkc (channels 2 and 4) tclkb (channels 1 and 5) tclkd (channels 2 and 4) figure 11.28 example of phase counting mode 3 operation table 11.34 up/down-count conditions in phase counting mode 3 tclka (channels 1 and 5) tclkc (channels 2 and 4) tclkb (channels 1 and 5) tclkd (channels 2 and 4) operation high level don't care low level don't care low level don't care high level up-count high level down-count low level don't care high level don't care low level don't care legend : rising edge : falling edge
rev. 2.00, 05/03, page 395 of 846 4. phase counting mode 4 figure 11.29 shows an example of phase counting mode 4 operation, and table 11.35 summarizes the tcnt up/down-count conditions. time up-count down-count tcnt value tclka (channels 1 and 5) tclkc (channels 2 and 4) tclkb (channels 1 and 5) tclkd (channels 2 and 4) figure 11.29 example of phase counting mode 4 operation table 11.35 up/down-count conditions in phase counting mode 4 tclka (channels 1 and 5) tclkc (channels 2 and 4) tclkb (channels 1 and 5) tclkd (channels 2 and 4) operation high level up-count low level low level don't care high level high level down-count low level high level don't care low level legend : rising edge : falling edge
rev. 2.00, 05/03, page 396 of 846 phase counting mode application example: figure 11.30 shows an example in which phase counting mode is designated for channel 1, and channel 1 is coupled with channel 0 to input servo motor 2-phase encoder pulses in order to detect the position or speed. channel 1 is set to phase counting mode 1, and the encoder pulse a-phase and b-phase are input to tclka and tclkb. channel 0 operates with tcnt counter clearing by tgrc_0 compare match; tgra_0 and tgrc_0 are used for the compare match function, and are set with the speed control cycle and position control cycle. tgrb_0 is used for input capture, with tgrb_0 and tgrd_0 operating in buffer mode. the channel 1 counter input clock is designated as the tgrb_0 input capture source, and detection of the pulse width of 2-phase encoder 4-multiplication pulses is performed. tgra_1 and tgrb_1 for channel 1 are designated for input capture, channel 0 tgra_0 and tgrc_0 compare matches are selected as the input capture source, and the up/down-counter values for the control cycles are stored. this procedure enables accurate position/speed detection to be achieved. tcnt_1 tcnt_0 channel 1 tgra_1 (speed cycle capture) tgra_0 (speed control cycle) tgrb_1 (position cycle capture) tgrc_0 (position control cycle) tgrb_0 (pulse width capture) tgrd_0 (buffer operation) channel 0 tclka tclkb edge detection circuit + - + - figure 11.30 phase counting mode application example
rev. 2.00, 05/03, page 397 of 846 11.5 interrupt sources there are three kinds of tpu interrupt source: tgr input capture/compare match, tcnt overflow, and tcnt underflow. each interrupt source has its own status flag and enable/disable bit, allowing generation of interrupt request signals to be enabled or disabled individually. when an interrupt request is generated, the corresponding status flag in tsr is set to 1. if the corresponding enable/disable bit in tier is set to 1 at this time, an interrupt is requested. the interrupt request is cleared by clearing the status flag to 0. relative channel priorities can be changed by the interrupt controller, but the priority order within a channel is fixed. for details, see section 5, interrupt controller. table 11.36 lists the tpu interrupt sources.
rev. 2.00, 05/03, page 398 of 846 table 11.36 tpu interrupts channel name interrupt source interrupt flag dtc activation dmac activation * 1 0 tgi0a tgra_0 input capture/compare match tgfa_0 possible possible tgi0b tgrb_0 input capture/compare match tgfb_0 possible not possible tgi0c tgrc_0 input capture/compare match tgfc_0 possible not possible tgi0d tgrd_0 input capture/compare match tgfd_0 possible not possible tgi0v tcnt_0 overflow tcfv_0 not possible not possible 1 tgi1a tgra_1 input capture/compare match tgfa_1 possible possible tgi1b tgrb_1 input capture/compare match tgfb_1 possible not possible tci1v tcnt_1 overflow tcfv_1 not possible not possible tci1u tcnt_1 underflow tcfu_1 not possible not possible 2 tgi2a tgra_2 input capture/compare match tgfa_2 possible possible tgi2b tgrb_2 input capture/compare match tgfb_2 possible not possible tci2v tcnt_2 overflow tcfv_2 not possible not possible tci2u tcnt_2 underflow tcfu_2 not possible not possible 3 * 2 tgi3a tgra_3 input capture/compare match tgfa_3 possible possible tgi3b tgrb_3 input capture/compare match tgfb_3 possible not possible tgi3c tgrc_3 input capture/compare match tgfc_3 possible not possible tgi3d tgrd_3 input capture/compare match tgfd_3 possible not possible tci3v tcnt_3 overflow tcfv_3 not possible not possible 4 * 2 tgi4a tgra_4 input capture/compare match tgfa_4 possible possible tgi4b tgrb_4 input capture/compare match tgfb_4 possible not possible tci4v tcnt_4 overflow tcfv_4 not possible not possible tci4u tcnt_4 underflow tcfu_4 not possible not possible 5 * 2 tgi5a tgra_5 input capture/compare match tgfa_5 possible possible tgi5b tgrb_5 input capture/compare match tgfb_5 possible not possible tci5v tcnt_5 overflow tcfv_5 not possible not possible tci5u tcnt_5 underflow tcfu_5 not possible not possible notes: this table shows the initial state immediately after a reset. the relative channel priorities can be changed by the interrupt controller. * 1 supported only by the h8s/2239 group. * 2 not available in the h8s/2227 group.
rev. 2.00, 05/03, page 399 of 846 input capture/compare match interrupt: an interrupt is requested if the tgie bit in tier is set to 1 when the tgf flag in tsr is set to 1 by the occurrence of a tgr input capture/compare match on a particular channel. the interrupt request is cleared by clearing the tgf flag to 0. the tpu has 16 input capture/compare match interrupts, four each for channels 0 and 3, and two each for channels 1, 2, 4, and 5. overflow interrupt: an interrupt is requested if the tciev bit in tier is set to 1 when the tcfv flag in tsr is set to 1 by the occurrence of tcnt overflow on a channel. the interrupt request is cleared by clearing the tcfv flag to 0. the tpu has six overflow interrupts, one for each channel. underflow interrupt: an interrupt is requested if the tcieu bit in tier is set to 1 when the tcfu flag in tsr is set to 1 by the occurrence of tcnt underflow on a channel. the interrupt request is cleared by clearing the tcfu flag to 0. the tpu has four underflow interrupts, one each for channels 1, 2, 4, and 5. 11.6 dtc activation the dtc can be activated by the tgr input capture/compare match interrupt for a channel. for details, see section 9, data transfer controller (dtc). a total of 16 tpu input capture/compare match interrupts can be used as dtc activation sources, four each for channels 0 and 3, and two each for channels 1, 2, 4, and 5. 11.7 dmac activation (h8s/2239 group only) the dmac can be activated by the tgra input capture/compare match interrupt for a channel. for details, see section 8, dma controller (dmac). in the tpu, a total of six tgra input capture/compare match interrupts can be used as dmac activation sources, one for each channel. 11.8 a/d converter activation the a/d converter can be activated by the tgra input capture/compare match for a channel. if the ttge bit in tier is set to 1 when the tgfa flag in tsr is set to 1 by the occurrence of a tgra input capture/compare match on a particular channel, a request to start a/d conversion is sent to the a/d converter. if the tpu conversion start trigger has been selected on the a/d converter side at this time, a/d conversion is started. in the tpu, a total of six tgra input capture/compare match interrupts can be used as a/d converter conversion start sources, one for each channel.
rev. 2.00, 05/03, page 400 of 846 11.9 operation timing 11.9.1 input/output timing tcnt count timing: figure 11.31 shows tcnt count timing in internal clock operation, and figure 11.32 shows tcnt count timing in external clock operation. tcnt tcnt input clock internal clock n ? 1 n n + 1 n + 2 falling edge rising edge figure 11.31 count timing in internal clock operation tcnt tcnt input clock external clock n ? 1 n n + 1 n + 2 falling edge rising edge falling edge figure 11.32 count timing in external clock operation output compare output timing: a compare match signal is generated in the final state in which tcnt and tgr match (the point at which the count value matched by tcnt is updated). when a compare match signal is generated, the output value set in tior is output at the output compare output pin. after a match between tcnt and tgr, the compare match signal is not generated until the (tioc pin) tcnt input clock is generated. figure 11.33 shows output compare output timing.
rev. 2.00, 05/03, page 401 of 846 tgr tcnt tcnt input clock n nn + 1 compare match signal tioc pin figure 11.33 output compare output timing input capture signal timing: figure 11.34 shows input capture signal timing. tcnt input capture input nn + 1 n + 2 n n + 2 tgr input capture signal figure 11.34 input capture input signal timing timing for counter clearing by compare match/input capture: figure 11.35 shows the timing when counter clearing by compare match occurrence is specified, and figure 11.36 shows the timing when counter clearing by input capture occurrence is specified.
rev. 2.00, 05/03, page 402 of 846 tcnt counter clear signal compare match signal tgr n n h'0000 figure 11.35 counter clear timing (compare match) tcnt counter clear signal input capture signal tgr n h'0000 n figure 11.36 counter clear timing (input capture)
rev. 2.00, 05/03, page 403 of 846 buffer operation timing: figures 11.37 and 11.38 show the timings in buffer operation. tgra, tgrb compare match signal tcnt tgrc, tgrd nn n nn + 1 figure 11.37 buffer operation timing (compare match) tgra, tgrb tcnt input capture signal tgrc, tgrd n n nn + 1 n n n + 1 figure 11.38 buffer operation timing (input capture)
rev. 2.00, 05/03, page 404 of 846 11.9.2 interrupt signal timing tgf flag setting timing in case of compare match: figure 11.39 shows the timing for setting of the tgf flag in tsr by compare match occurrence, and the tgi interrupt request signal timing. tgr tcnt tcnt input clock n nn + 1 compare match signal tgf flag tgi interrupt figure 11.39 tgi interrupt timing (compare match) tgf flag setting timing in case of input capture: figure 11.40 shows the timing for setting of the tgf flag in tsr by input capture occurrence, and the tgi interrupt request signal timing.
rev. 2.00, 05/03, page 405 of 846 tgr tcnt input capture signal n n tgf flag tgi interrupt figure 11.40 tgi interrupt timing (input capture) tcfv flag/tcfu flag setting timing: figure 11.41 shows the timing for setting of the tcfv flag in tsr by overflow occurrence, and the tciv interrupt request signal timing. figure 11.42 shows the timing for setting of the tcfu flag in tsr by underflow occurrence, and the tciu interrupt request signal timing. overflow signal tcnt (overflow) tcnt input clock h'ffff h'0000 tcfv flag tciv interrupt figure 11.41 tciv interrupt setting timing
rev. 2.00, 05/03, page 406 of 846 underflow signal tcnt (underflow) tcnt input clock h'0000 h'ffff tcfu flag tciu interrupt figure 11.42 tciu interrupt setting timing status flag clearing timing: after a status flag is read as 1 by the cpu, it is cleared by writing 0 to it. when the dtc or dmac * is activated, the flag is cleared automatically. figure 11.43 shows the timing for status flag clearing by the cpu, and figure 11.44 shows the timing for status flag clearing by the dtc or dmac * . note: * supported only by the h8s/2239 group. status flag write signal address tsr address interrupt request signal tsr write cycle t 1 t 2 figure 11.43 timing for status flag clearing by cpu
rev. 2.00, 05/03, page 407 of 846 interrupt request signal status flag address source address dtc/dmac * read cycle t 1 t 2 destination address t 1 t 2 dtc/dmac * write cycle note: * supported only by the h8s/2239 group. figure 11.44 timing for status flag clearing by dtc/dmac * activation 11.10 usage notes 11.10.1 module stop mode setting tpu operation can be disabled or enabled using the module stop control register. the initial setting is for tpu operation to be halted. register access is enabled by clearing module stop mode. for details, refer to section 23, power-down modes. 11.10.2 input clock restrictions the input clock pulse width must be at least 1.5 states in the case of single-edge detection, and at least 2.5 states in the case of both-edge detection. the tpu will not operate properly with a narrower pulse width. in phase counting mode, the phase difference and overlap between the two input clocks must be at least 1.5 states, and the pulse width must be at least 2.5 states. figure 11.45 shows the input clock conditions in phase counting mode.
rev. 2.00, 05/03, page 408 of 846 overlap phase diffe- rence phase diffe- rence overlap tclka (tclkc) tclkb (tclkd) pulse width pulse width pulse width pulse width notes: phase difference and overlap pulse width : 1.5 states or more : 2.5 states or more figure 11.45 phase difference, overlap, and pulse width in phase counting mode 11.10.3 caution on cycle setting when counter clearing by compare match is set, tcnt is cleared in the final state in which it matches the tgr value (the point at which the count value matched by tcnt is updated). consequently, the actual counter frequency is given by the following formula: f = (n + 1) where f: counter frequency : operating frequency n: tgr set value 11.10.4 contention between tcnt write and clear operations if the counter clearing signal is generated in the t 2 state of a tcnt write cycle, tcnt clearing takes precedence and the tcnt write is not performed. figure 11.46 shows the timing in this case.
rev. 2.00, 05/03, page 409 of 846 counter clearing signal write signal address tcnt address tcnt tcnt write cycle t 1 t 2 n h'0000 figure 11.46 contention between tcnt write and clear operations 11.10.5 contention between tcnt write and increment operations if incrementing occurs in the t 2 state of a tcnt write cycle, the tcnt write takes precedence and tcnt is not incremented. figure 11.47 shows the timing in this case. tcnt input clock write signal address tcnt address tcnt tcnt write cycle t 1 t 2 n m tcnt write data figure 11.47 contention between tcnt write and increment operations 11.10.6 contention between tgr write and compare match if a compare match occurs in the t 2 state of a tgr write cycle, the tgr write takes precedence and the compare match signal is disabled. a compare match also does not occur when the same value as before is written.
rev. 2.00, 05/03, page 410 of 846 figure 11.48 shows the timing in this case. compare match signal write signal address tgr address tcnt tgr write cycle t 1 t 2 n m tgr write data tgr n n + 1 disabled figure 11.48 contention between tgr write and compare match 11.10.7 contention between buffer register write and compare match if a compare match occurs in the t 2 state of a tgr write cycle, the data transferred to tgr by the buffer operation will be the data prior to the write. figure 11.49 shows the timing in this case. compare match signal write signal address buffer register address buffer register tgr write cycle t 1 t 2 n tgr n m buffer register write data figure 11.49 contention between buffer register write and compare match
rev. 2.00, 05/03, page 411 of 846 11.10.8 contention between tgr read and input capture if the input capture signal is generated in the t 1 state of a tgr read cycle, the data that is read will be the data after input capture transfer. figure 11.50 shows the timing in this case. input capture signal read signal address tgr address tgr tgr read cycle t 1 t 2 m internal data bus x m figure 11.50 contention between tgr read and input capture 11.10.9 contention between tgr write and input capture if the input capture signal is generated in the t 2 state of a tgr write cycle, the input capture operation takes precedence and the write to tgr is not performed. figure 11.51 shows the timing in this case.
rev. 2.00, 05/03, page 412 of 846 input capture signal write signal address tcnt tgr write cycle t 1 t 2 m tgr m tgr address figure 11.51 contention between tgr write and input capture 11.10.10 contention between buffer register write and input capture if the input capture signal is generated in the t 2 state of a buffer register write cycle, the buffer operation takes precedence and the write to the buffer register is not performed. figure 11.52 shows the timing in this case. input capture signal write signal address tcnt buffer register write cycle t 1 t 2 n tgr n m m buffer register buffer register address figure 11.52 contention between buffer register write and input capture
rev. 2.00, 05/03, page 413 of 846 11.10.11 contention between overflow/underflow and counter clearing if overflow/underflow and counter clearing occur simultaneously, the tcfv/tcfu flag in tsr is not set and tcnt clearing takes precedence. figure 11.53 shows the operation timing when a tgr compare match is specified as the clearing source, and h ffff is set in tgr. counter clearing signal tcnt input clock tcnt tgf disabled tcfv h'ffff h'0000 figure 11.53 contention between overflow and counter clearing 11.10.12 contention between tcnt write and overflow/underflow if there is an up-count or down-count in the t 2 state of a tcnt write cycle, when overflow/underflow occurs, the tcnt write takes precedence and the tcfv/tcfu flag in tsr is not set. figure 11.54 shows the operation timing when there is contention between tcnt write and overflow.
rev. 2.00, 05/03, page 414 of 846 write signal address tcnt address tcnt tcnt write cycle t 1 t 2 h'ffff m tcnt write data tcfv flag disabled figure 11.54 contention between tcnt write and overflow 11.10.13 multiplexing of i/o pins in this lsi, the tclka input pin is multiplexed with the tiocc0 i/o pin, the tclkb input pin with the tiocd0 i/o pin, the tclkc input pin with the tiocb1 i/o pin, and the tclkd input pin with the tiocb2 i/o pin. when an external clock is input, compare match output should not be performed from a multiplexed pin. 11.10.14 interrupts and module stop mode if module stop mode is entered when an interrupt has been requested, it will not be possible to clear the cpu interrupt source or the dmac or dtc activation source. interrupts should therefore be disabled before entering module stop mode.
timh220c_000020020700 rev. 2.00, 05/03, page 415 of 846 section 12 8-bit timers the h8s/2239 group and h8s/2238 group have an on-chip 8-bit timer module with four channels (tmr_0, tmr_1, tmr_2 and tmr_3) operating on the basis of an 8-bit counter. the h8s/2237 group and h8s/2227 group have an on-chip 8-bit timer module with two channels (tmr_0 and tmr_1) operating on the basis of an 8-bit counter. the 8-bit timer module can be used to count external events and be used as a multifunction timer in a variety of applications, such as generation of counter reset, interrupt requests, and pulse output with an arbitrary duty cycle using a compare-match signal with two registers. 12.1 features ? selection of clock sources selected from three internal clocks ( /8, /64, and /8192) and an external clock. ? selection of three ways to clear the counters the counters can be cleared on compare-match a or b, or by an external reset signal. ? timer output controlled by two compare-match signals the timer output signal in each channel is controlled by two independent compare-match signals, enabling the timer to be used for various applications, such as the generation of pulse output or pwm output with an arbitrary duty cycle. ? cascading of the two channels tmr_0 and tmr_1 cascading the module can operate as a 16-bit timer using tmr_0 as the upper half and channel tmr_1 as the lower half (16-bit count mode). tmr_1 can be used to count tmr_0 compare-match occurrences (compare-match count mode). tmr_2 and tmr_3 cascading the module can operate as a 16-bit timer using tmr_2 as the upper half and channel tmr_3 as the lower half (16-bit count mode). tmr_3 can be used to count tmr_2 compare-match occurrences (compare-match count mode). ? multiple interrupt sources for each channel two compare-match interrupts and one overflow interrupt can be requested independently. ? generation of a/d conversion start trigger channel 0 compare-match signal can be used as the a/d conversion start trigger. ? module stop mode can be set at initialization, the 8-bit timer operation is halted. register access is enabled by canceling the module stop mode.
rev. 2.00, 05/03, page 416 of 846 figure 12.1 shows a block diagram of the 8-bit timer module (tmr_0 and tmr_1). external clock sources internal clock sources /8 /64 /8192 clock 1 clock 0 compare-match a1 compare-match a0 clear 1 cmia0 cmib0 ovi0 cmia1 cmib1 ovi1 interrupt signals tmo tmri01 internal bus tcora_0 comparator a_0 comparator b_0 tcorb_0 tcsr_0 tcr_0 tcora_1 comparator a_1 tcnt_1 comparator b_1 tcorb_1 tcsr_1 tcr_1 tmci01 tcnt_0 overflow 1 overflow 0 compare-match b1 compare-match b0 tmo1 a/d clock select control logic clear 0 legend: : time constant register a_0 : time constant register b_0 : timer counter _0 : timer control / status register _0 : timer control register _0 tcora_0 tcorb_0 tcnt_0 tcsr_0 tcr_0 : time constant register a_1 : time constant register b_1 : timer counter _1 : timer control / status register _1 : timer control register _1 tcora_1 tcorb_1 tcnt_1 tcsr_1 tcr_1 figure 12.1 block diagram of 8-bit timer module
rev. 2.00, 05/03, page 417 of 846 12.2 input/output pins table 12.1 summarizes the input and output pins of the 8-bit timer module. table 12.1 pin configuration channel name symbol i/o function 0 timer output tmo0 output output controlled by compare-match 1 timer output tmo1 output output controlled by compare-match timer clock input tmci01 input external clock input for the counter common to 0 and 1 timer reset input tmri01 input external reset input for the counter 2 timer output tmo2 * output output controlled by compare-match 3 timer output tmo3 * output output controlled by compare-match timer clock input tmci23 * input external clock input for the counter common to 2 and 3 timer reset input tmri23 * input external reset input for the counter note: * supported by the h8s/2239 group and h8s/2238 group. 12.3 register descriptions the 8-bit timer has the following registers. for details on the module stop register, refer to section 23.1.2, module stop registers a to c (mstpcra to mstpcrc). ? timer counter_0 (tcnt_0) ? time constant register a_0 (tcora_0) ? time constant register b_0 (tcorb_0) ? timer control register_0 (tcr_0) ? timer control/status register_0 (tcsr_0) ? timer counter_1 (tcnt_1) ? time constant register a_1 (tcora_1) ? time constant register b_1 (tcorb_1) ? timer control register_1 (tcr_1) ? timer control/status register_1 (tcsr_1) ? timer counter_2 (tcnt_2) * ? time constant register a_2 (tcora_2) * ? time constant register b_2 (tcorb_2) * ? timer control register_2 (tcr_2) * ? timer control/status register_2 (tcsr_2) * ? timer counter_3 (tcnt_3) *
rev. 2.00, 05/03, page 418 of 846 ? time constant register a_3 (tcora_3) * ? time constant register b_3 (tcorb_3) * ? timer control register_3 (tcr_3) * ? timer control/status register_3 (tcsr_3) * note: * supported by the h8s/2239 and h8s/2238 group. 12.3.1 timer counter (tcnt) each tcnt is an 8-bit up-counter. tcnt_0 and tcnt_1 (tcnt_2 and tcnt_3) comprise a single 16-bit register, so they can be accessed together by word access. tcnt increments on pulses generated from an internal or external clock source. this clock source is selected by clock select bits cks2 to cks0 in tcr. tcnt can be cleared by an external reset input signal or compare-match signals a and b. counter clear bits cclr1 and cclr0 in tcr select the method of clearing. when tcnt overflows from h'ff to h'00, the overflow flag (ovf) in tcsr is set to 1. the initial value of tcnt is h'00. 12.3.2 time constant register a (tcora) tcora is an 8-bit readable/writable register. tcora_0 and tcora_1 (tcora_2 and tcora_3) comprise a single 16-bit register, so they can be accessed together by word access. tcora is continually compared with the value in tcnt. when a match is detected, the corresponding compare-match flag a (cmfa) in tcsr is set. note, however, that comparison is disabled during the t 2 state of a tcora write cycle. the timer output from the tmo pin can be freely controlled by the compare-match signal a and the settings of output select bits os1 and os0 in tcsr. the initial value of tcora is h'ff. 12.3.3 time constant register b (tcorb) tcorb is an 8-bit readable/writable register. tcorb_0 and tcorb_1 (tcorb_2 and tcorb_3) comprise a single 16-bit register, so they can be accessed together by word access. tcorb is continually compared with the value in tcnt. when a match is detected, the corresponding compare-match flag b (cmfb) in tcsr is set. note, however, that comparison is disabled during the t 2 state of a tcorb write cycle.
rev. 2.00, 05/03, page 419 of 846 the timer output from the tmo pin can be freely controlled by the compare-match signal b and the settings of output select bits os1 and os0 in tcsr. the initial value of tcorb is h'ff. 12.3.4 timer control register (tcr) tcr selects the tcnt clock source and the time at which tcnt is cleared, and controls interrupt requests. bit bit name initial value r/w description 7 cmieb 0 r/w compare-match interrupt enable b selects whether the cmfb interrupt request (cmib) is enabled or disabled when the cmfb flag in tcsr is set to 1. 0: cmfb interrupt request (cmib) is disabled 1: cmfb interrupt request (cmib) is enabled 6 cmiea 0 r/w compare-match interrupt enable a selects whether the cmfa interrupt request (cmia) is enabled or disabled when the cmfa flag in tcsr is set to 1. 0: cmfa interrupt request (cmia) is disabled 1: cmfa interrupt request (cmia) is enabled 5 ovie 0 r/w timer overflow interrupt enable selects whether the ovf interrupt request (ovi) is enabled or disabled when the ovf flag in tcsr is set to 1. 0: ovf interrupt request (ovi) is disabled 1: ovf interrupt request (ovi) is enabled 4 3 cclr1 cclr0 0 0 r/w r/w counter clear 1 and 0 these bits select the method by which tcnt is cleared. 00: clearing is disabled 01: cleared on compare-match a 10: cleared on compare-match b 11: cleared on rising edge of external reset input
rev. 2.00, 05/03, page 420 of 846 bit bit name initial value r/w description 2 to 0 cks2 cks1 cks0 0 0 0 r/w r/w r/w clock select 2 to 0 the input clock can be selected from three clocks divided from the system clock ( ). when use of an external clock is selected, three types of count can be selected: at the rising edge, the falling edge, and both rising and falling edges. 000: clock input disabled 001: /8 internal clock source, counted on the falling edge 010: /64 internal clock source, counted on the falling edge 011: /8192 internal clock source, counted on the falling edge 100: for channel 0: counted on tcnt1 overflow signal * for channel 1: counted on tcnt0 compare-match a * for channel 2: counted on tcnt3 overflow signal * for channel 3: counted on tcnt2 compare-match a * 101: external clock source, counted at rising edge 110: external clock source, counted at falling edge 111: external clock source, counted at both rising and falling edges note: * if the count input of channel 0 (channel 2) is the tcnt1 (tcnt3) overflow signal and that of channel 1 (channel 3) is the tcnt1 (tcnt3) compare-match signal, no incrementing clock will be generated. do not use this setting.
rev. 2.00, 05/03, page 421 of 846 12.3.5 timer control/status register (tcsr) tcsr indicates status flags and controls compare-match output. ? tcsr_0 bit bit name initial value r/w description 7cmfb 0 r/(w) * compare-match flag b [setting condition] when tcnt = tcorb [clearing conditions] ? read cmfb when cmfb = 1, then write 0 in cmfb. ? the dtc is activated by the cmib interrupt and the disel bit = 0 in mrb of the dtc. 6cmfa 0 r/(w) * compare-match flag a [setting condition] when tcnt = tcora [clearing conditions] ? read cmfa when cmfa = 1, then write 0 in cmfa. ? the dtc is activated by the cmia interrupt and disel bit = 0 in mrb of the dtc. 5ovf 0 r/(w) * timer overflow flag [setting condition] when tcnt overflows from h'ff to h'00 [clearing condition] read ovf when ovf = 1, then write 0 in ovf 4 adte 0 r/w a/d trigger enable enables or disables a/d converter start requests by compare-match a. 0: a/d converter start requests by compare-match a are disabled 1: a/d converter start requests by compare-match a are enabled
rev. 2.00, 05/03, page 422 of 846 bit bit name initial value r/w description 3 2 os3 os2 0 0 r/w r/w output select 3 and 2 these bits specify how the timer output level is to be changed by a compare-match b of tcorb and tcnt. 00: no change when compare-match b occurs 01: 0 is output when compare-match b occurs 10: 1 is output when compare-match b occurs 11: output is inverted when compare-match b occurs (toggle output) 1 0 os1 os0 0 0 r/w r/w output select 1 and 0 these bits specify how the timer output level is to be changed by a compare-match a of tcora and tcnt. 00: no change when compare-match a occurs 01: 0 is output when compare-match a occurs 10: 1 is output when compare-match a occurs 11: output is inverted when compare-match a occurs (toggle output) note: * only 0 can be written to this bit, to clear the flag.
rev. 2.00, 05/03, page 423 of 846 ? tcsr_1 and tcsr_3 bit bit name initial value r/w description 7cmfb 0 r/(w) * compare-match flag b [setting condition] when tcnt = tcorb [clearing conditions] ? read cmfb when cmfb = 1, then write 0 in cmfb ? the dtc is activated by the cmib interrupt and the disel bit = 0 in mrb of the dtc. 6cmfa 0 r/(w) * compare-match flag a [setting condition] when tcnt = tcora [clearing conditions] ? read cmfa when cmfa = 1, then write 0 in cmfa ? the dtc is activated by the cmia interrupt and the disel bit = 0 in mrb of the dtc. 5ovf 0 r/(w) * timer overflow flag [setting condition] when tcnt overflows from h ff to h 00 [clearing condition] read ovf when ovf = 1, then write 0 in ovf 4 ? 1 ? reserved this bit is always read as 1 and cannot be modified. 3 2 os3 os2 0 0 r/w r/w output select 3 and 2 these bits specify how the timer output level is to be changed by a compare-match b of tcorb and tcnt. 00: no change when compare-match b occurs 01: 0 is output when compare-match b occurs 10: 1 is output when compare-match b occurs 11: output is inverted when compare-match b occurs (toggle output)
rev. 2.00, 05/03, page 424 of 846 bit bit name initial value r/w description 1 0 os1 os0 0 0 r/w r/w output select 1 and 0 these bits specify how the timer output level is to be changed by a compare-match a of tcora and tcnt. 00: no change when compare-match a occurs 01: 0 is output when compare-match a occurs 10: 1 is output when compare-match a occurs 11: output is inverted when compare-match a occurs (toggle output) note: * only 0 can be written to this bit, to clear the flag.
rev. 2.00, 05/03, page 425 of 846 ? tcsr_2 bit bit name initial value r/w description 7cmfb 0 r/(w) * compare-match flag b [setting condition] when tcnt = tcorb [clearing conditions] ? read cmfb when cmfb = 1, then write 0 in cmfb ? the dtc is activated by the cmib interrupt and the disel bit = 0 in mrb of the dtc. 6 cmfa 0 r/(w) * compare-match flag a [setting condition] when tcnt = tcora [clearing conditions] ? read cmfa when cmfa = 1, then write 0 in cmfa ? the dtc is activated by the cmia interrupt and the disel bit = 0 in mrb of the dtc. 5ovf 0 r/(w) * timer overflow flag [setting condition] when tcnt overflows from h ff to h 00 [clearing condition] read ovf when ovf = 1, then write 0 in ovf
rev. 2.00, 05/03, page 426 of 846 bit bit name initial value r/w description 4 ? 0r/wreserved this bit is a readable/writable bit, but the write value should always be 0. 3 2 os3 os2 0 0 r/w r/w output select 3 and 2 these bits specify how the timer output level is to be changed by a compare-match b of tcorb and tcnt. 00: no change when compare-match b occurs 01: 0 is output when compare-match b occurs 10: 1 is output when compare-match b occurs 11: output is inverted when compare-match b occurs (toggle output) 1 0 os1 os0 0 0 r/w r/w output select 1 and 0 these bits specify how the timer output level is to be changed by a compare-match a of tcora and tcnt. 00: no change when compare-match a occurs 01: 0 is output when compare-match a occurs 10: 1 is output when compare-match a occurs 11: output is inverted when compare-match a occurs (toggle output) note: * only 0 can be written to this bit, to clear the flag. 12.4 operation 12.4.1 pulse output figure 12.2 shows an example of arbitrary duty pulse output. 1. set tcr in ccr1 to 0 and cclr0 to 1 to clear tcnt by a tcora compare-match. 2. set os3 to os0 bits in tcsr to b'0110 to output 1 by a compare-match a and 0 by compare- match b. by the above settings, waveforms with the cycle of tcora and the pulse width of tcrb can be output without software intervention.
rev. 2.00, 05/03, page 427 of 846 tcnt hff counter clear tcora tcorb h00 tmo figure 12.2 example of pulse output 12.5 operation timing 12.5.1 tcnt incrementation timing figure 12.3 shows the tcnt count timing with internal clock source. figure 12.4 shows the tcnt incrementation timing with external clock source. the pulse width of the external clock for incrementation at signal edge must be at least 1.5 system clock ( ) periods, and at least 2.5 states for incrementation at both edges. the counter will not increment correctly if the pulse width is less than these values. internal clock tcnt input clock tcnt n ? 1 n n + 1 figure 12.3 count timing for internal clock input
rev. 2.00, 05/03, page 428 of 846 external clock input pin tcnt input clock tcnt n ? 1 n n + 1 figure 12.4 count timing for external clock input 12.5.2 timing of cmfa and cmfb setting when a compare-match occurs the cmfa and cmfb flags in tcsr are set to 1 by a compare-match signal generated when the tcor and tcnt values match. the compare-match signal is generated at the last state in which the match is true, just before the timer counter is updated. therefore, when tcor and tcnt match, the compare-match signal is not generated until the next incrementation clock input. figure 12.5 shows the timing of cmf flag setting. tcnt n n + 1 tcor n compare-match signal cmf figure 12.5 timing of cmf setting 12.5.3 timing of timer output when a compare-match occurs when a compare-match occurs, the timer output changes as specified by the output select bits (os3 to os0) in tcsr. figure 12.6 shows the timing when the output is set to toggle at compare- match a.
rev. 2.00, 05/03, page 429 of 846 compare-match a signal timer output pin figure 12.6 timing of timer output 12.5.4 timing of compare-match clear when a compare-match occurs tcnt is cleared when compare-match a or b occurs, depending on the setting of the cclr1 and cclr0 bits in tcr. figure 12.7 shows the timing of this operation. n h'00 compare-match signal tcnt figure 12.7 timing of compare-match clear 12.5.5 tcnt external reset timing tcnt is cleared at the rising edge of an external reset input, depending on the settings of the cclr1 and cclr0 bits in tcr. the width of the clearing pulse must be at least 1.5 states. figure 12.8 shows the timing of this operation. clear signal external reset input pin tcnt n h'00 n ? 1 figure 12.8 timing of clearing by external reset input
rev. 2.00, 05/03, page 430 of 846 12.5.6 timing of overflow flag (ovf) setting ovf in tcsr is set to 1 when the timer count overflows (changes from h ff to h 00). figure 12.9 shows the timing of this operation. ovf overflow signal tcnt h'ff h'00 figure 12.9 timing of ovf setting 12.6 operation with cascaded connection if bits cks2 to cks0 in one of tcr_0 and tcr_1 (tcr_2 and tcr_3) are set to b'100, the 8- bit timers of the two channels are cascaded. with this configuration, a single 16-bit timer can be used (16-bit timer mode) or compare-matches of 8-bit channel 0 (channel 2) can be counted by the timer of channel 1 (channel 3) (compare-match count mode). in the case that channel 0 is connected to channel 1 in cascade, the timer operates as described below. 12.6.1 16-bit count mode when bits cks2 to cks0 in tcr_0 are set to b'100, the timer functions as a single 16-bit timer with channel 0 occupying the upper 8 bits and channel 1 occupying the lower 8 bits. ? setting of compare-match flags ? the cmf flag in tcsr_0 is set to 1 when a 16-bit compare-match occurs. ? the cmf flag in tcsr_1 is set to 1 when a lower 8-bit compare-match occurs. ? counter clear specification ? if the cclr1 and cclr0 bits in tcr_0 have been set for counter clear at compare-match, the 16-bit counter (tcnt_0 and tcnt_1 together) is cleared when a 16-bit compare- match occurs. the 16-bit counter (tcnt_0 and tcnt_1 together) is cleared even if counter clear by the tmri01 pin has also been set. ? the settings of the cclr1 and cclr0 bits in tcr_1 are ignored. the lower 8 bits cannot be cleared independently.
rev. 2.00, 05/03, page 431 of 846 ? pin output ? control of output from the tmo0 pin by bits os3 to os0 in tcsr_0 is in accordance with the 16-bit compare-match conditions. ? control of output from the tmo1 pin by bits os3 to os0 in tcsr_1 is in accordance with the lower 8-bit compare-match conditions. 12.6.2 compare-match count mode when bits cks2 to cks0 in tcr_1 are b'100, tcnt_1 counts compare-match a for channel 0. channels 0 and 1 are controlled independently. conditions such as setting of the cmf flag, generation of interrupts, output from the tmo pin, and counter clearing are in accordance with the settings for each channel. 12.7 interrupt sources 12.7.1 interrupt sources and dtc activation the 8-bit timer can generate three types of interrupt: cmia, cmib, and ovi. table 12.2 shows the interrupt sources and priority. each interrupt source can be enabled or disabled independently by interrupt enable bits in tcr. independent signals are sent to the interrupt controller for each interrupt. it is also possible to activate the dtc by means of cmia and cmib interrupts. table 12.2 8-bit timer interrupt sources interrupt source description flag dtc activation interrupt priority cmia0 tcora_0 compare-match cmfa possible high cmib0 tcorb_0 compare-match cmfb possible ovi0 tcnt_0 overflow ovf not possible low cmia1 tcora_1 compare-match cmfa possible high cmib1 tcorb_1 compare-match cmfb possible ovi1 tcnt_1 overflow ovf not possible low cmia2 tcora_2 compare-match cmfa possible high cmib2 tcorb_2 compare-match cmfb possible ovi2 tcnt_2 overflow ovf not possible low cmia3 tcora_3 compare-match cmfa possible high cmib3 tcorb_3 compare-match cmfb possible ovi3 tcnt_3 overflow ovf not possible low
rev. 2.00, 05/03, page 432 of 846 12.7.2 a/d converter activation the a/d converter can be activated only by channel 0 compare match a. if the adte bit in tcsr0 is set to 1 when the cmfa flag is set to 1 by the occurrence of channel 0 compare match a, a request to start a/d conversion is sent to the a/d converter. if the 8-bit timer conversion start trigger has been selected on the a/d converter side at this time, a/d conversion is started. 12.8 usage notes 12.8.1 contention between tcnt write and clear if a timer counter clock pulse is generated during the t 2 state of a tcnt write cycle, the clear takes priority, so that the counter is cleared and the write is not performed. figure 12.10 shows this operation. a ddress tcnt address internal write signal counter clear signal tcnt n h'00 t 1 t 2 tcnt write cycle by cpu figure 12.10 contention between tcnt write and clear
rev. 2.00, 05/03, page 433 of 846 12.8.2 contention between tcnt write and increment if a timer counter clock pulse is generated during the t 2 state of a tcnt write cycle, the write takes priority and the counter is not incremented. figure 12.11 shows this operation. a ddress tcnt address internal write signal tcnt input clock tcnt nm t 1 t 2 tcnt write cycle by cpu counter write data figure 12.11 contention between tcnt write and increment
rev. 2.00, 05/03, page 434 of 846 12.8.3 contention between tcor write and compare-match during the t 2 state of a tcor write cycle, the tcor write has priority even if a compare-match occurs and the compare-match signal is disabled. figure 12.12 shows this operation. a ddress tcor address internal write signal tcnt tcor nm t 1 t 2 tcor write cycle by cpu tcor write data n n + 1 compare-match signal inhibited figure 12.12 contention between tcor write and compare-match 12.8.4 contention between compare-matches a and b if compare-matches a and b occur at the same time, the 8-bit timer operates in accordance with the priorities for the output states set for compare-match a and compare-match b, as shown in table 12.3. table 12.3 timer output priorities output setting priority toggle output high 1 output 0 output no change low
rev. 2.00, 05/03, page 435 of 846 12.8.5 switching of internal clocks and tcnt operation tcnt may increment erroneously when the internal clock is switched over. table 12.4 shows the relationship between the timing at which the internal clock is switched (by writing to the cks1 and cks0 bits) and the tcnt operation when the tcnt clock is generated from an internal clock, the falling edge of the internal clock pulse is detected. if clock switching causes a change from high to low level, as shown in no. 3 in table 12.4, a tcnt clock pulse is generated on the assumption that the switchover is a falling edge. this increments tcnt. erroneous incrementation can also happen when switching between internal and external clocks. table 12.4 switching of internal clock and tcnt operation no. timing of switchover by means of cks1 and cks0 bits tcnt clock operation 1 switching from low to low * 1 clock before switchover clock after switchover tcnt clock tcnt cks bit rewrite n n + 1 2 switching from low to high * 2 clock before switchover clock after switchover tcnt clock tcnt cks bit rewrite n n + 1 n + 2
rev. 2.00, 05/03, page 436 of 846 no. timing of switchover by means of cks1 and cks0 bits tcnt clock operation 3 switching from high to low * 3 clock before switchover clock after switchover tcnt clock tcnt cks bit rewrite n n + 1 n + 2 * 4 4 switching from high to high clock before switchover clock after switchover tcnt clock tcnt cks bit rewrite n n + 1 n + 2 notes: * 1 includes switching from low to stop, and from stop to low. * 2 includes switching from stop to high. * 3 includes switching from high to stop. * 4 generated on the assumption that the switchover is a falling edge; tcnt is incremented. 12.8.6 contention between interrupts and module stop mode if module stop mode is entered when an interrupt has been requested, it will not be possible to clear the cpu interrupt source or the dtc activation source. interrupts should therefore be disabled before entering module stop mode. 12.8.7 mode setting of cascaded connection when the 16-bit count mode and the compare-match count mode are set at the same time, input clocks for tcnt_0 and tcnt_1 (tcnt_2 and tcnt_3) are not generated and the timer stops incrementation. this setting is prohibited.
wdt0105c_000020020700 rev. 2.00, 05/03, page 437 of 846 section 13 watchdog timer (wdt) the watchdog timer (wdt) is an 8-bit timer that can generate an internal reset signal for this lsi if a system crash prevents the cpu from writing to the timer counter, thus allowing it to overflow. when this watchdog function is not needed, the wdt can be used as an interval timer. in interval timer operation, an interval timer interrupt is generated each time the counter overflows. the block diagram of the wdt is shown in figure 13.1. 13.1 features ? selectable from 8 counter input clocks for wdt_0 selectable from 16 counter input clocks for wdt_1 ? switchable between watchdog timer mode and interval timer mode in watchdog timer mode ? choosable between power-on reset or manual reset as internal reset ? if the counter in wdt_0 overflows, it is possible to select whether this lsi is internally reset or not. ? if the counter in wdt_1 overflows, it is possible to select whether this lsi is internally reset or the internal nmi interrupt is generated. in interval timer mode ? if the counter overflows, the wdt generates an interval timer interrupt (wovi). ? the selected clock can be output from the buzz output pin (wdt_1).
rev. 2.00, 05/03, page 438 of 846 overflow interrupt control wovi (interrupt request signal) internal reset signal * reset control rstcsr tcnt_0 tscr_0 /2 /64 /128 /512 /2048 /8192 /32768 /131072 clock clock select internal clock sources bus interface module bus tcsr_0 tcnt_0 rstcsr note: * the type of internal reset signal depends on a register setting. the power-on reset or manual reset can be selected as the internal reset. : timer control/status register0 : timer counter0 : reset control/status register wdt legend internal bus figure 13.1 block diagram of wdt_0 (1) overflow interrupt control wovi (interrupt request signal) internal nmi (interrupt request signal) internal reset signal * reset control tcnt_1 tscr_1 /2 /64 /128 /512 /2048 /8192 /32768 /131072 sub/2 sub/4 sub/8 sub/16 sub/32 sub/64 sub/128 sub/256 clock clock select internal clock sources bus interface module bus internal bus wdt tcsr_1 tcnt_1 note: * the type of internal reset signal depends on a register setting. caused reset is the power-on reset. : timer control/status register1 : timer counter1 legend buzz figure 13.1 block diagram of wdt_1 (2)
rev. 2.00, 05/03, page 439 of 846 13.2 input/output pins table 13.1 lists wdt pin name symbol i/o function buzzer output buzz output output the clock selected by wdt_1. 13.3 register descriptions the wdt has the following three registers. to prevent accidental overwriting, tcsr, tcnt, and rstcsr have to be written to by a different method to normal registers. for details, refer to section 13.6.1, notes on register access. for details on the system control register and pin function control register, refer to section 3.2.2, system control register (syscr) and section 7.3.6, pin function control register (pfcr), respectively. ? timer counter (tcnt) ? timer control/status register (tcsr) ? reset control/status register (rstcsr) 13.3.1 timer counter (tcnt) tcnt is an 8-bit readable/writable up-counter. tcnt is initialized to h'00 when the tme bit in tcsr is cleared to 0. 13.3.2 timer control/status register (tcsr) tcsr functions include selecting the clock source to be input to tcnt and the timer mode.
rev. 2.00, 05/03, page 440 of 846 ? tcsr_0 bit bit name initial value r/w description 7ovf 0 r/(w) * 1 overflow flag indicates that tcnt has overflowed. only a 0 can be written to this bit, to clear the flag. [setting condition] when tcnt overflows (changes from h'ff to h'00) when internal reset request generation is selected in watchdog timer mode, ovf is cleared automatically by the internal reset. [clearing condition] cleared by reading tcsr * 2 when ovf = 1, then writing 0 to ovf 6wt/ it 0 r/w timer mode select selects whether the wdt is used as a watchdog timer or interval timer. 0: interval timer mode 1: watchdog timer mode 5tme 0 r/w timer enable when this bit is set to 1, tcnt starts counting. when this bit is cleared, tcnt stops counting and is initialized to h'00. 4, 3 ? all 1 ? reserved these bits are always read as 1 and cannot be modified.
rev. 2.00, 05/03, page 441 of 846 bit bit name initial value r/w description 2 1 0 cks2 cks1 cks0 0 0 0 r/w r/w r/w clock select 0 to 2 selects the clock source to be input to tcnt. the overflow frequency * 3 for = 10 mhz is enclosed in parentheses. 000: clock /2 (frequency: 51.2 s) 001: clock /64 (frequency: 1.6 ms) 010: clock /128 (frequency: 3.2 ms) 011: clock /512 (frequency: 13.2 ms) 100: clock /2048 (frequency: 52.4 ms) 101: clock /8192 (frequency: 209.8 ms) 110: clock /32768 (frequency: 838.8 ms) 111: clock /131072 (frequency: 3.36 s) notes: * 1 only 0 can be written, for flag clearing. * 2 when the ovf flag is polled with the interval timer interrupt disabled, read the ovf bit while it is 1 at least twice. * 3 the overflow period is the time from when tcnt starts counting up from h'00 until overflow occurs.
rev. 2.00, 05/03, page 442 of 846 ? tcsr_1 bit bit name initial value r/w description 7ovf 0 r/(w) * 1 overflow flag indicates that tcnt has overflowed. only a 0 can be written to this bit, to clear the flag. [setting condition] when tcnt overflows (changes from h'ff to h'00) when internal reset request generation is selected in watchdog timer mode, ovf is cleared automatically by the internal reset. [clearing condition] cleared by reading tcsr * 2 when ovf = 1, then writing 0 to ovf 6wt/ it 0 r/w timer mode select selects whether the wdt is used as a watchdog timer or interval timer. 0: interval timer mode 1: watchdog timer mode 5tme 0 r/wtimer enable when this bit is set to 1, tcnt starts counting. when this bit is cleared, tcnt stops counting and is initialized to h'00. 4 pss 0 r/w prescaler select selects the clock source input to tcnt of wdt_1 0: tcnt counts divided clock of -base prescaler (psm). 1: tcnt counts divided clock of sub -base prescaler (pss) 3rst /nmi 0 r/w reset or nmi (rst/ nmi ) 0: an nmi interrupt is requested. 1: reset is requested.
rev. 2.00, 05/03, page 443 of 846 bit bit name initial value r/w description 2 1 0 cks2 cks1 cks0 0 0 0 r/w r/w r/w clock select 0 to 2 selects the clock source to be input to tcnt. the overflow frequency * 3 for = 10 mhz is enclosed in parentheses. when pss = 0: 000: clock /2 (frequency: 51.2 s) 001: clock /64 (frequency: 1.6 ms) 010: clock /128 (frequency: 3.2 ms) 011: clock /512 (frequency: 13.2 ms) 100: clock /2048 (frequency: 52.4 ms) 101: clock /8192 (frequency: 209.8 ms) 110: clock /32768 (frequency: 838.8 ms) 111: clock /131072 (frequency: 3.36 s) when pss = 1: 000: clock sub /2 (frequency: 15.6 ms) 001: clock sub /4 (frequency: 31.3 ms) 010: clock sub /8 (frequency: 62.5 ms) 011: clock sub /16 (frequency: 125 ms) 100: clock sub /32 (frequency: 250 ms) 101: clock sub /64 (frequency: 500 ms) 110: clock sub /128 (frequency: 1 s) 111: clock sub /256 (frequency: 2 s) notes: * 1 only 0 can be written, for flag clearing. * 2 when the ovf flag is polled with the interval timer interrupt disabled, read the ovf bit while it is 1 at least twice * 3 the overflow period is the time from when tcnt starts counting up from h'00 until overflow occurs.
rev. 2.00, 05/03, page 444 of 846 13.3.3 reset control/status register (rstcsr) (only wdt_0) rstcsr controls the generation of the internal reset signal when tcnt overflows, and selects the type of internal reset signal. rstcsr is initialized to h'1f by a reset signal from the res pin, and not by the wdt internal reset signal caused by overflows. bit bit name initial value r/w description 7wovf0 r/(w) * watchdog overflow flag this bit is set when tcnt overflows in watchdog timer mode. this bit cannot be set in interval timer mode, and only 0 can be written, to clear the flag. [setting condition] set when tcnt overflows (changed from h'ff to h'00) in watchdog timer mode [clearing condition] cleared by reading rstcsr when wovf = 1, and then writing 0 to wovf 6 rste 0 r/w reset enable specifies whether or not a reset signal is generated in the chip if tcnt overflows during watchdog timer operation. 0: reset signal is not generated even if tcnt overflows (though this lsi is not reset, tcnt and tcsr in wdt are reset) 1: reset signal is generated if tcnt overflows 5 rsts 0 r/w reset select this bit selects the type of the internal reset that is generated by tcnt overflowing in watchdog timer mode. 0: power-on reset 1: manual reset 4 to 0 ? all 1 ? reserved these bits are always read as 1 and cannot be modified. note: * only 0 can be written, to clear the flag.
rev. 2.00, 05/03, page 445 of 846 13.4 operation 13.4.1 watchdog timer mode to use the wdt as a watchdog timer, set the wt/ it bit in tcsr and the tme bit to 1. software must prevent tcnt overflows by rewriting the tcnt value (normally be writing h'00) before overflows occurs. thus, tcnt does not overflow while the system is operating normally. when the wdt is used as a watchdog timer and the rste bit in rstcsr of wdt_0 is set to 1, and if tcnt overflows without being rewritten because of a system malfunction or other error, an internal reset signal for this lsi is output for 518 system clocks. when the rst/ nmi bit in tcsr of wdt_1 is set to 1, and if tcnt overflows, the internal reset signal is output for 516 system clock periods. when the rst/ nmi bit is cleared to 0, an nmi interrupt request is generated (for 515 or 516 system clock periods when the clock source is set to sub (pss = 1)). an internal reset request from the watchdog timer and a reset input from the res pin are both treated as having the same vector. if a wdt internal reset request and the res pin reset occur at the same time, the res pin reset has priority and the wovf bit in rstcsr is cleared to 0. an nmi request from the watchdog timer and an interrupt request from the nmi pin are both treated as having the same vector. so, avoid handling an nmi request from the watchdog timer and an interrupt request from the nmi pin at the same time.
rev. 2.00, 05/03, page 446 of 846 tcnt value h'00 time h'ff wt/ it =1 tme=1 write h'00' to tcnt wt/ it =1 tme=1 write h'00' to tcnt 518 system clock (wdt0) 515/516 system clock (wdt1) internal reset signal * wt/ it tme wovf note: * in the case of wdt_0, the internal reset signal is generated only when the rste bit is set to 1. in the case of wdt_1,either the internal reset or the nmi interrupt is generated. overflow internal reset is generated wovf=1 : timer mode select bit : timer enable bit : overflow flag legend figure 13.2 watchdog timer mode operation 13.4.2 interval timer mode to use the wdt as a watchdog timer, set the wt/ it and tme bits in tcsr to 1. when the wdt is used as an interval timer, an interval timer interrupt (wovi) is generated each time the tcnt overflows. therefore, an interrupt can be generated at intervals. tcnt value h'00 time h'ff wt/ it =0 tme=1 wovi overflow overflow overflow overflow legend wovi: interval timer interrupt request generation wovi wovi wovi figure 13.3 interval timer mode operation
rev. 2.00, 05/03, page 447 of 846 13.4.3 timing of setting overflow flag (ovf) the ovf flag is set to 1 if tcnt overflows during interval timer operation. at the same time, an interval timer interrupt (wovi) is requested. this timing is shown in figure 13.4. when nmi request is chosen in watchdog timer mode for wdt_1, tcnt overflow sets the ovf flog to 1. at the same time, nmi interrupt is requested. tcnt h'ff h'00 ovf 1 1 1 overflow signal (internal signal) figure 13.4 timing of ovf setting
rev. 2.00, 05/03, page 448 of 846 13.4.4 timing of setting watchdog timer overflow flag (wovf) with wdt_0 the wovf bit in rstcsr is set to 1 if tcnt overflows in watchdog timer mode. if tcnt overflows while the rste bit in rstcsr is set to 1, an internal is generated for the entire chip. this timing is illustrated in figure 13.5. tcnt h'ff h'00 overflow signal (internal signal) wovf internal reset signal 518 states (wdt_0) 515/516 states (wdt_1) figure 13.5 timing of wovf setting 13.5 interrupt sources during interval timer mode operation, an overflow generates an interval timer interrupt (wovi). the interval timer interrupt is requested whenever the ovf flag is set to 1 in tcsr. ovf must be cleared to 0 in the interrupt handling routine. if an nmi interrupt request has been chosen in the watchdog timer mode, an nmi interrupt request is generated when a tcnt overflow occurs. table 13.2 wdt interrupt source name interrupt source interrupt flag wovi tcnt overflow (interval timer mode) ovf nmi tcnt overflow (watchdog timer mode) ovf
rev. 2.00, 05/03, page 449 of 846 13.6 usage notes 13.6.1 notes on register access the watchdog timer's tcnt and tcsr registers differ from other registers in being more difficult to write to. the procedures for writing to and reading these registers are given below. writing to tcnt, tcsr, and rstcsr these registers must be written to by a word transfer instruction. they cannot be written to by a byte transfer instruction. tcnt and tcsr both have the same write address. therefore, the relative condition shown in figure 13.6 needs to be satisfied in order to write to tcnt or tcsr. the transfer instruction writes the lower byte data to tcnt or tcsr. the upper byte must be h'5a for writing to tcnt, and h'a5 for writing to tcsr. to write to rstcsr, execute a word transfer instruction for address h'ff76. a byte transfer instruction cannot write to rstcsr. the method of writing 0 to the wovf bit differs from that of writing to the rste and rsts bits. to write 0 to the wovf bit, satisfy the condition shown in figure 13.6. if satisfied, the transfer instruction clears the wovf bit to 0, but has no effect on the rste and rsts bits. to write to the rste and rsts bits, satisfy the condition shown in figure 13.6. if satisfied, the transfer instruction writes the values in bits 6 and 5 of the lower byte into the rste and rsts bits, but has no effect on the wovf bit. tcnt write writing to rste and rsts bits tcsr write writing 0 to wovf bit address: address: 15 8 7 0 h5a hff74 hff76 write data 15 8 7 0 ha5 hff74 hff76 write data or h00 figure 13.6 writing to tcnt and tcsr (example for wdt_0) reading tcnt, tcsr, and rstcsr (wdt _ _ _ _ 0) these registers are read in the same way as other registers. the read addresses are h'ff74 for tcsr and h'ff77 for rstcsr.
rev. 2.00, 05/03, page 450 of 846 13.6.2 contention between timer counter (tcnt) write and increment if a timer counter clock pulse is generated during the t 2 state of a tcnt write cycle, the write takes priority and the timer counter is not incremented. figure 13.7 shows this operation. address internal write signal tcnt input clock tcnt nm t 1 t 2 tcnt write cycle counter write data figure 13.7 contention between tcnt write and increment 13.6.3 changing value of cks2 to cks0 if bits cks0 to cks2 in tcsr are written to while the wdt is operating, errors could occur in the incrementation. software must be used to stop the watchdog timer (by clearing the tme bit to 0) before changing the value of bits cks0 to cks2. 13.6.4 switching between watchdog timer mode and interval timer mode if the mode is switched from watchdog timer to interval timer while the wdt is operating, errors could occur in the incrementation. software must be used to stop the watchdog timer (by clearing the tme bit to 0) before switching the mode.
rev. 2.00, 05/03, page 451 of 846 13.6.5 internal reset in watchdog timer mode this lsi is not reset internally if tcnt overflows while the rste bit is cleared to 0 during watchdog timer operation, however tcnt_0 and tcsr_0 of the wdt_0 are reset. tcnt, tcsr, or rstcr cannot be written to for 132 states following an overflow. during this period, any attempt to read the wovf flag is not acknowledged. accordingly, wait 132 states after overflow to write 0 to the wovf flag for clearing. 13.6.6 ovf flag clearing in interval timer mode when the ovf flag setting conflicts with the ovf flag reading in interval timer mode, writing 0 to the ovf bit may not clear the flag even though the ovf bit has been read while it is 1. if there is a possibility that the ovf flag setting and reading will conflict, such as when the ovf flag is polled with the interval timer interrupt disabled, read the ovf bit while it is 1 at least twice before writing 0 to the ovf bit to clear the flag.
rev. 2.00, 05/03, page 452 of 846
sci0025c_000020020700 rev. 2.00, 05/03, page 453 of 846 section 14 serial communication interface (sci) this lsi has independent serial communication interfaces (scis). the sci can handle both asynchronous and clocked synchronous serial communication. serial data communication can be carried out using standard asynchronous communication chips such as a universal asynchronous receiver/transmitter (uart) or an asynchronous communication interface adapter (acia). a function is also provided for serial communication between processors (multiprocessor communication function). the sci also supports an ic card (smart card) interface conforming to iso/iec 7816-3 (identification card) as a serial communication interface extended function. 14.1 features ? the number of on-chip channels h8s/2239 group, h8s/2238 group, and h8s/2237 group: four channels (channels 0, 1, 2, and 3) h8s/2227 group: three channels (channels 0, 1, and 3) ? choice of asynchronous or clocked synchronous serial communication mode ? full-duplex communication capability the transmitter and receiver are mutually independent, enabling transmission and reception to be executed simultaneously. double-buffering is used in both the transmitter and the receiver, enabling continuous transmission and continuous reception of serial data. ? on-chip baud rate generator allows any bit rate to be selected external clock can be selected as a transfer clock source (except for in smart card interface mode). ? choice of lsb-first or msb-first transfer (except in the case of asynchronous mode 7-bit data) ? four interrupt sources transmit-end, transmit-data-empty, receive-data-full, and receive error ? that can issue requests. the transmit-data-empty interrupt and receive data full interrupts can be used to activate the data transfer controller (dtc) or the direct memory access controller (dmac) (h8s/2239 group only). ? module stop mode can be set asynchronous mode ? data length: 7 or 8 bits ? stop bit length: 1 or 2 bits ? parity: even, odd, or none ? receive error detection: parity, overrun, and framing errors
rev. 2.00, 05/03, page 454 of 846 ? break detection: break can be detected by reading the rxd pin level directly in the case of a framing error ? average transfer rate generator (sci_0): 720 kbps, 460.784 kbps, or 115.192 kbps can be selected at 16 mhz operation (h8s/2239 group only). ? transfer rate clock can be input from the tpu (sci_0) (h8s/2239 group only). ? communications between multi-processors are possible. clocked synchronous mode ? data length: 8 bits ? receive error detection: overrun errors detected ? sci selection (sci_0) : when irq7 = 1, fixed input of txd0 = hiz and sck0 = high can be selected. (h8s/2239 group only) smart card interface ? automatic transmission of error signal (parity error) in receive mode ? error signal detection and automatic data retransmission in transmit mode ? direct convention and inverse convention both supported
rev. 2.00, 05/03, page 455 of 846 figure 14.1 shows a block diagram of the sci (except sci_0 of the h8s/2239 group), and figure 14.2 shows that of the sci_0 of the h8s/2239 group. rxd txd sck clock external clock /4 /16 /64 tei txi rxi eri rsr rdr tsr tdr smr scr ssr scmr brr : receive shift register : receive data register : transmit shift register : transmit data register : serial mode register : serial control register : serial status register : smart card mode register : bit rate register scmr ssr scr smr transmission/ reception control baud rate generator brr module data bus bus interface rdr tsr rsr parity generation parity check legend tdr internal data bus figure 14.1 block diagram of sci
rev. 2.00, 05/03, page 456 of 846 rxd0 txd0 pg1/ irq7 sck0 tei txi rxi eri scmr ssr scr smr semr brr rdr tsr rsr tdr tioca1 tclka tioca2 tpu external clock transmission/ reception control baud rate generator module data bus bus interface parity generation internal data bus clock /4 /16 /64 rsr rdr tsr tdr smr : receive shift register : receive data register : transmit shift register : transmit data register : serial mode register scr ssr scmr brr semr : serial control register : serial status register : smart card mode register : bit rate register : serial expansion mode register legend parity check 10.667mhz operation 115.152kbps 460.606kbps 16mhz operation 115.196kbps 460.784kbps 720kbps average transfer rate generator c/ a cke1 sse figure 14.2 block diagram of sci_0 of h8s/2239 group
rev. 2.00, 05/03, page 457 of 846 14.2 input/output pins table 14.1 shows the pin configuration for each sci channel. table 14.1 pin configuration channel pin name * 1 i/o function sck0 i/o sci0 clock input/output rxd0 input sci0 receive data input 0 txd0 output sci0 transmit data output sck1 i/o sci1 clock input/output rxd1 input sci1 receive data input 1 txd1 output sci1 transmit data output sck2 i/o sci2 clock input/output rxd2 input sci2 receive data input 2 * 2 txd2 output sci2 transmit data output sck3 i/o sci3 clock input/output rxd3 input sci3 receive data input 3 txd3 output sci3 transmit data output notes: * 1 pin names sck, rxd, and txd are used in the text for all channels, omitting the channel designation. * 2 the channel is not provided for the h8s/2227 group. 14.3 register descriptions the sci has the following registers for each channel. for details on register addresses and register states during each process, refer to appendix a, internal i/o register. the serial mode register (smr), serial status register (ssr), and serial control register (scr) are described separately for normal serial communication interface mode and smart card interface mode because their bit functions differ in part. ? receive shift register (rsr) ? receive data register (rdr) ? transmit data register (tdr) ? transmit shift register (tsr) ? serial mode register (smr) ? serial control register (scr) ? serial status register (ssr) ? smart card mode register (scmr)
rev. 2.00, 05/03, page 458 of 846 ? bit rate register (brr) ? serial expansion mode register (semr0) * note: * this register is in the channel 0 of the h8s/2239 group only. 14.3.1 receive shift register (rsr) rsr is a shift register that is used to receive serial data input to the rxd pin and convert it into parallel data. when one byte of data has been received, it is transferred to rdr automatically. rsr cannot be directly accessed by the cpu. 14.3.2 receive data register (rdr) rdr is an 8-bit register that stores received data. when the sci has received one byte of serial data, it transfers the received serial data from rsr to rdr, where it is stored. after this, rsr is receive-enabled. as rsr and rdr function as a double buffer in this way, continuous receive operations are possible. after confirming that the rdrf bit in ssr is set to 1, read rdr only once. rdr cannot be written to by the cpu. rdr is initialized to h'00 by a reset, in standby mode, watch mode, subsleep mode or module stop mode. 14.3.3 transmit data register (tdr) tdr is an 8-bit register that stores data for transmission. when the sci detects that tsr is empty, it transfers the transmit data written in tdr to tsr and starts transmission. the double-buffered structure of tdr and tsr enables continuous serial transmission. if the next transmit data has already been written to tdr during serial transmission, the sci transfers the written data to tsr to continue transmission. although tdr can be read or written to by the cpu at all times, to achieve reliable serial transmission, write transmit data to tdr only once after confirming that the tdre bit in ssr is set to 1. tdr is initialized to h'ff by a reset, in standby mode, watch mode, subactive mode, subsleep mode or module stop mode. 14.3.4 transmit shift register (tsr) tsr is a shift register that transmits serial data. to perform serial data transmission, the sci first transfers transmit data from tdr to tsr, then sends the data to the txd pin. tsr cannot be directly accessed by the cpu.
rev. 2.00, 05/03, page 459 of 846 14.3.5 serial mode register (smr) smr is used to set the sci's serial transfer format and select the baud rate generator clock source. some bit functions of smr differ between normal serial communication interface mode and smart card interface mode. ? normal serial communication interface mode (when smif in scmr is 0) bit bit name initial value r/w description 7c/ a 0 r/w communication mode 0: asynchronous mode 1: clocked synchronous mode 6 chr 0 r/w character length (enabled only in asynchronous mode) 0: selects 8 bits as the data length. 1: selects 7 bits as the data length. lsb-first is fixed and the msb (bit 7) of tdr is not transmitted in transmission. in clocked synchronous mode, a fixed data length of 8 bits is used. 5 pe 0 r/w parity enable (enabled only in asynchronous mode) when this bit is set to 1, the parity bit is added to transmit data before transmission, and the parity bit is checked in reception. for a multiprocessor format, parity bit addition and checking are not performed regardless of the pe bit setting. 4o/ e 0 r/w parity mode (enabled only when the pe bit is 1 in asynchronous mode) 0: selects even parity. when even parity is set, parity bit addition is performed in transmission so that the total number of 1 bits in the transmit character plus the parity bit is even. in reception, a check is performed to see if the total number of 1 bits in the receive character plus parity bit is even. 1: selects odd parity. when odd parity is set, parity bit addition is performed in transmission so that the total number of 1 bits in the transmit character plus the parity bit is odd. in reception, a check is performed to see if the total number of 1 bits in the receive character plus the parity bit is odd.
rev. 2.00, 05/03, page 460 of 846 bit bit name initial value r/w description 3 stop 0 r/w stop bit length (enabled only in asynchronous mode) selects the stop bit length in transmission. 0: 1 stop bit 1: 2 stop bits in reception, only the first stop bit is checked. if the second stop bit is 0, it is treated as the start bit of the next transmit character. 2 mp 0 r/w multiprocessor mode (enabled only in asynchronous mode) when this bit is set to 1, the multiprocessor communication function is enabled. the pe bit and o/ e bit settings are invalid in multiprocessor mode. for details, see section 14.5, multiprocessor communication function. 1 0 cks1 cks0 0 0 r/w r/w clock select 0 and 1 these bits select the clock source for the baud rate generator. 00: clock (n = 0) 01: /4 clock (n = 1) 10: /16 clock (n = 2) 11: /64 clock (n = 3) for the relationship between the bit rate register setting and the baud rate, see section 14.3.9, bit rate register (brr). n is the decimal representation of the value of n in brr (see section 14.3.9, bit rate register (brr)).
rev. 2.00, 05/03, page 461 of 846 ? smart card interface mode (when smif in scmr is 1) bit bit name initial value r/w description 7 gm 0 r/w gsm mode when this bit is set to 1, the sci operates in gsm mode. in gsm mode, the timing of the tend setting is advanced by 11.0 etu (elementary time unit: the time for transfer of 1 bit), and clock output control mode addition is performed. for details, refer to section 14.7.8, clock output control. 6 blk 0 r/w when this bit is set to 1, the sci operates in block transfer mode. for details on block transfer mode, refer to section 14.7.3, block transfer mode. 5 pe 0 r/w parity enable (enabled only in asynchronous mode) when this bit is set to 1, the parity bit is added to transmit data in transmission, and the parity bit is checked in reception. in smart card interface mode, this bit must be set to 1. 4o/ e 0 r/w parity mode (enabled only when the pe bit is 1 in asynchronous mode) 0: selects even parity. 1: selects odd parity. for details on setting this bit in smart card interface mode, refer to section 14.7.2, data format (except for block transfer mode). 3 2 bcp1 bcp0 0 0 r/w r/w base clock pulse 0 and 1 these bits specify the number of base clock periods in a 1-bit transfer interval on the smart card interface. 00: 32 clock (s = 32) 01: 64 clock (s = 64) 10: 372 clock (s = 372) 11: 256 clock (s = 256) for details, refer to section 14.7.4, receive data sampling timing and reception margin in smart card interface mode. s stands for the value of s in brr (see section 14.3.9, bit rate register (brr)).
rev. 2.00, 05/03, page 462 of 846 bit bit name initial value r/w description 1 0 cks1 cks0 0 0 r/w r/w clock select 0 and 1 these bits select the clock source for the baud rate generator. 00: clock (n = 0) 01: /4 clock (n = 1) 10: /16 clock (n = 2) 11: /64 clock (n = 3) for the relationship between the bit rate register setting and the baud rate, see section 14.3.9, bit rate register (brr). n is the decimal representation of the value of n in brr (see section 14.3.9, bit rate register (brr)). note: etu (elementary time unit): time for transfer of 1 bit 14.3.6 serial control register (scr) scr is a register that enables or disables sci transfer operations and interrupt requests, and is also used to selection of the transfer clock source. for details on interrupt requests, refer to section 14.9, interrupt sources. some bit functions of scr differ between normal serial communication interface mode and smart card interface mode. ? normal serial communication interface mode (when smif in scmr is 0) bit bit name initial value r/w description 7 tie 0 r/w transmit interrupt enable when this bit is set to 1, the txi interrupt request is enabled. txi interrupt request cancellation can be performed by reading 1 from the tdre flag in ssr, then clearing it to 0, or clearing the tie bit to 0. 6 rie 0 r/w receive interrupt enable when this bit is set to 1, rxi and eri interrupt requests are enabled. rxi and eri interrupt request cancellation can be performed by reading 1 from the rdrf, fer, per, or orer flag in ssr, then clearing the flag to 0, or clearing the rie bit to 0.
rev. 2.00, 05/03, page 463 of 846 bit bit name initial value r/w description 5 te 0 r/w transmit enable when this bit s set to 1, transmission is enabled. in this state, serial transmission is started when transmit data is written to tdr and the tdre flag in ssr is cleared to 0. smr setting must be performed to decide the transfer format before setting the te bit to 1. when this bit is cleared to 0, the transmission operation is disabled, and the tdre flag is fixed at 1. 4 re 0 r/w receive enable when this bit is set to 1, reception is enabled. serial reception is started in this state when a start bit is detected in asynchronous mode or serial clock input is detected in clocked synchronous mode. smr setting must be performed to decide the reception format before setting the re bit to 1. clearing the re bit to 0 does not affect the rdrf, fer, and orer flags, which retain their states. 3 mpie 0 r/w multiprocessor interrupt enable (enabled only when the mp bit in smr is 1 in asynchronous mode) when this bit is set to 1, receive data in which the multiprocessor bit is 0 is skipped, and setting of the rdrf, fer, and orer status flags in ssr is prohibited. on receiving data in which the multiprocessor bit is 1, this bit is automatically cleared and normal reception is resumed. for details, refer to section 14.5, multiprocessor communication function. when receive data including mpb = 0 is received, receive data transfer from rsr to rdr, receive error detection, and setting of the rerf, fer, and orer flags in ssr, are not performed. when receive data including mpb = 1 is received, the mpb bit in ssr is set to 1, the mpie bit is cleared to 0 automatically, and generation of rxi and eri interrupts (when the tie and rie bits in scr are set to 1) and fer and orer flag setting are enabled.
rev. 2.00, 05/03, page 464 of 846 bit bit name initial value r/w description 2 teie 0 r/w transmit end interrupt enable this bit is set to 1, tei interrupt request is enabled. tei cancellation can be performed by reading 1 from the dre flag in ssr, then clearing it to 0 and clearing the tend flag to 0, or clearing the teie bit to 0. 1 0 cke1 cke0 0 0 r/w r/w clock enable 0 and 1 selects the clock source and sck pin function. asynchronous mode 00: on-chip baud rate generator sck pin functions as i/o port 01: on-chip baud rate generator outputs a clock of the same frequency as the bit rate from the sck pin. 1x: external clock inputs a clock with a frequency 16 times the bit rate from the sck pin. clocked synchronous mode 0x: internal clock (sck pin functions as clock output) 1x: external clock (sck pin functions as clock input) legend x: don't care
rev. 2.00, 05/03, page 465 of 846 ? smart card interface mode (when smif in scmr is 1) bit bit name initial value r/w description 7 tie 0 r/w transmit interrupt enable when this bit is set to 1, txi interrupt request is enabled. txi interrupt request cancellation can be performed by reading 1 from the tdre flag in ssr, then clearing it to 0, or clearing the tie bit to 0. 6 rie 0 r/w receive interrupt enable when this bit is set to 1, rxi and eri interrupt requests are enabled. rxi and eri interrupt request cancellation can be performed by reading 1 from the rdrf, fer, per, or orer flag in ssr, then clearing the flag to 0, or clearing the rie bit to 0. 5 te 0 r/w transmit enable when this bit s set to 1, transmission is enabled. in this state, serial transmission is started when transmit data is written to tdr and the tdre flag in ssr is cleared to 0. smr setting must be performed to decide the transfer format before setting the te bit to 1. when this bit is cleared to 0, the transmission operation is disabled, and the tdre flag is fixed at 1. 4 re 0 r/w receive enable when this bit is set to 1, reception is enabled. serial reception is started in this state when a start bit is detected in asynchronous mode or serial clock input is detected in clocked synchronous mode. smr setting must be performed to decide the reception format before setting the re bit to 1. clearing the re bit to 0 does not affect the rdrf, fer, and orer flags, which retain their states.
rev. 2.00, 05/03, page 466 of 846 bit bit name initial value r/w description 3 mpie 0 r/w multiprocessor interrupt enable (enabled only when the mp bit in smr is 1 in asynchronous mode) write 0 to this bit in smart card interface mode. when receive data including mpb = 0 is received, receive data transfer from rsr to rdr, receive error detection, and setting of the rerf, fer, and orer flags in ssr, are not performed. when receive data including mpb = 1 is received, the mpb bit in ssr is set to 1, the mpie bit is cleared to 0 automatically, and generation of rxi and eri interrupts (when the tie and rie bits in scr are set to 1) and fer and orer flag setting are enabled. 2 teie 0 r/w transmit end interrupt enable write 0 to this bit in smart card interface mode. tei cancellation can be performed by reading 1 from the tdre flag in ssr, then clearing it to 0 and clearing the tend flag to 0, or clearing the teie bit to 0. 1 0 cke1 cke0 0 0 r/w clock enable 0 and 1 enables or disables clock output from the sck pin. the clock output can be dynamically switched in gsm mode. for details, refer to section 14.7.8, clock output control. when the gm bit in smr is 0: 00: output disabled (sck pin can be used as an i/o port pin) 01: clock output 1x: reserved when the gm bit in smr is 1: 00: output fixed low 01: clock output 10: output fixed high 11: clock output legend x: don't care
rev. 2.00, 05/03, page 467 of 846 14.3.7 serial status register (ssr) ssr is a register containing status flags of the sci and multiprocessor bits for transfer. 1 cannot be written to flags tdre, rdrf, orer, per, and fer; they can only be cleared. some bit functions of ssr differ between normal serial communication interface mode and smart card interface mode. ? normal serial communication interface mode (when smif in scmr is 0) bit bit name initial value r/w description 7 tdre 1 r/(w) * 1 transmit data register empty displays whether tdr contains transmit data. [setting conditions] ? when the te bit in scr is 0 ? when data is transferred from tdr to tsr and data can be written to tdr [clearing conditions] ? when 0 is written to tdre after reading tdre = 1 ? when the dmac * 2 or the dtc is activated by a txi interrupt request and writes data to tdr 6 rdrf 0 r/(w) * 1 receive data register full indicates that the received data is stored in rdr. [setting condition] when serial reception ends normally and receive data is transferred from rsr to rdr [clearing conditions] ? when 0 is written to rdrf after reading rdrf = 1 ? when the dmac * 2 or the dtc is activated by an rxi interrupt and transferred data from rdr the rdrf flag is not affected and retains their previous values when the re bit in scr is cleared to 0. if reception of the next data is completed while the rdrf flag is still set to 1, an overrun error will occur and the receive data will be lost.
rev. 2.00, 05/03, page 468 of 846 bit bit name initial value r/w description 5 orer 0 r/(w) * 1 overrun error indicates that an overrun error occurred during reception, causing abnormal termination. [setting condition] when the next serial reception is completed while rdrf = 1 the receive data prior to the overrun error is retained in rdr, and the data received subsequently is lost. also, subsequent serial reception cannot be continued while the orer flag is set to 1. in clocked synchronous mode, serial transmission cannot be continued either. [clearing condition] when 0 is written to orer after reading orer = 1 the orer flag is not affected and retains its previous state when the re bit in scr is cleared to 0. 4fer 0 r/(w) * 1 framing error indicates that a framing error occurred during reception in asynchronous mode, causing abnormal termination. [setting condition] when the stop bit is 0 in 2 stop bit mode, only the first stop bit is checked for a value to 1; the second stop bit is not checked. if a framing error occurs, the receive data is transferred to rdr but the rdrf flag is not set. also, subsequent serial reception cannot be continued while the fer flag is set to 1. in clocked synchronous mode, serial transmission cannot be continued, either. [clearing condition] when 0 is written to fer after reading fer = 1 in 2-stop-bit mode, only the first stop bit is checked. the fer flag is not affected and retains its previous state when the re bit in scr is cleared to 0.
rev. 2.00, 05/03, page 469 of 846 bit bit name initial value r/w description 3 per 0 r/(w) * 1 parity error indicates that a parity error occurred during reception using parity addition in asynchronous mode, causing abnormal termination. [setting condition] when a parity error is detected during reception if a parity error occurs, the receive data is transferred to rdr but the rdrf flag is not set. also, subsequent serial reception cannot be continued while the per flag is set to 1. in clocked synchronous mode, serial transmission cannot be continued, either. [clearing condition] when 0 is written to per after reading per = 1 the per flag is not affected and retains its previous state when the re bit in scr is cleared to 0. 2 tend 1 r transmit end indicates that transmission has been ended. [setting conditions] ? when the te bit in scr is 0 ? when tdre = 1 at transmission of the last bit of a 1-byte serial transmit character [clearing conditions] ? when 0 is written to tdre after reading tdre = 1 ? when the dmac * 2 or the dtc is activated by a txi interrupt request and transfer transmission data to tdr 1 mpb 0 r multiprocessor bit mpb stores the multiprocessor bit in the receive data. when the re bit in scr is cleared to 0 its previous state is retained. 0 mpbt 0 r/w multiprocessor bit transfer mpbt stores the multiprocessor bit to be added to the transmit data. notes: * 1 only a 0 can be written to this bit, to clear the flag. * 2 supported only by the h8s/2239 group.
rev. 2.00, 05/03, page 470 of 846 ? smart card interface mode (when smif in scmr is 1) bit bit name initial value r/w description 7 tdre 1 r/(w) * 1 transmit data register empty indicates whether tdr contains transmit data. [setting conditions] ? when the te bit in scr is 0 ? when data is transferred from tdr to tsr and data can be written to tdr [clearing conditions] ? when 0 is written to tdre after reading tdre = 1 ? when the dmac * 2 or the dtc is activated by a txi interrupt request and writes data to tdr 6 rdrf 0 r/(w) * 1 receive data register full indicates that the received data is stored in rdr. [setting condition] when serial reception ends normally and receive data is transferred from rsr to rdr [clearing conditions] ? when 0 is written to rdrf after reading rdrf = 1 ? when the dtc is activated by an rxi interrupt and transferred data from rdr the rdrf flag is not affected and retains their previous values when the re bit in scr is cleared to 0. if reception of the next data is completed while the rdrf flag is still set to 1, an overrun error will occur and the receive data will be lost.
rev. 2.00, 05/03, page 471 of 846 bit bit name initial value r/w description 5 orer 0 r/(w) * 1 overrun error indicates that an overrun error occurred during reception, causing abnormal termination. [setting condition] when the next serial reception is completed while rdrf = 1 the receive data prior to the overrun error is retained in rdr, and the data received subsequently is lost. also, subsequent serial cannot be continued while the orer flag is set to 1. in clocked synchronous mode, serial transmission cannot be continued, either. [clearing condition] when 0 is written to orer after reading orer = 1 the orer flag is not affected and retains its previous state when the re bit in scr is cleared to 0. 4ers 0 r/(w) * 1 error signal status indicates that the status of an error signal returned from the receiving end at reception [setting condition] when the low level of the error signal is sampled [clearing conditions] when 0 is written to ers after reading ers = 1 the ers flag is not affected and retains its previous state when the te bit in scr is cleared to 0.
rev. 2.00, 05/03, page 472 of 846 bit bit name initial value r/w description 3 per 0 r/(w) * 1 parity error indicates that a parity error occurred during reception using parity addition in asynchronous mode, causing abnormal termination. [setting condition] when a parity error is detected during reception if a parity error occurs, the receive data is transferred to rdr but the rdrf flag is not set. also, subsequent serial reception cannot be continued while the per flag is set to 1. in clocked synchronous mode, serial transmission cannot be continued, either. [clearing condition] when 0 is written to per after reading per = 1 the per flag is not affected and retains its previous state when the re bit in scr is cleared to 0.
rev. 2.00, 05/03, page 473 of 846 bit bit name initial value r/w description 2 tend 1 r transmit end this bit is set to 1 when no error signal has been sent back from the receiving end and the next transmit data is ready to be transferred to tdr. [setting conditions] ? when the te bit in scr is 0 and the ers bit is also 0 ? when the esr bit is 0 and the tdre bit is 1 after the specified interval following transmission of 1-byte data. the timing of bit setting differs according to the register setting as follows: when gm = 0 and blk = 0, 2.5 etu after transmission starts when gm = 0 and blk = 1, 1.0 etu after transmission starts when gm = 1 and blk = 0, 1.5 etu after transmission starts when gm = 1 and blk = 1, 1.0 etu after transmission starts [clearing conditions] ? when 0 is written to tdre after reading tdre = 1 ? when the dmac * 2 or the dtc is activated by a txi interrupt and transfers transmission data to tdr 1 mpb 0 r multiprocessor bit this bit is not used in smart card interface mode. 0 mpbt 0 r/w multiprocessor bit transfer write 0 to this bit in smart card interface mode. notes: * 1 only 0 can be written to this bit, to clear the flag. * 2 supported only by the h8s/2239 group.
rev. 2.00, 05/03, page 474 of 846 14.3.8 smart card mode register (scmr) scmr is a register that selects smart card interface mode and its format. bit bit name initial value r/w description 7 to 4 ? 1 ? reserved these bits are always read as 1, and cannot be modified. 3 sdir 0 r/w smart card data transfer direction selects the serial/parallel conversion format. 0: lsb-first in transfer 1: msb-first in transfer the bit setting is valid only when the transfer data format is 8 bits. for 7-bit data, lsb-first is fixed. 2 sinv 0 r/w smart card data invert specifies inversion of the data logic level. the sinv bit does not affect the logic level of the parity bit. to invert the parity bit, invert the o/ e bit in smr. 0: tdr contents are transmitted as they are. receive data is stored as it is in rdr 1: tdr contents are inverted before being transmitted. receive data is stored in inverted form in rdr 1? 1 ? reserved this bit is always read as 1, and cannot be modified. 0 smif 0 r/w smart card interface mode select this bit is set to 1 to make the sci operate in smart card interface mode. 0: normal asynchronous mode or clocked synchronous mode 1: smart card interface mode
rev. 2.00, 05/03, page 475 of 846 14.3.9 bit rate register (brr) brr is an 8-bit register that adjusts the bit rate. as the sci performs baud rate generator control independently for each channel, different bit rates can be set for each channel. table 14.2 shows the relationships between the n setting in brr and bit rate b for normal asynchronous mode, clocked synchronous mode, and smart card interface mode. the initial value of brr is h'ff, and it can be read or written to by the cpu at all times. table 14.2 the relationships between the n setting in brr and bit rate b communication mode abcs bit * bit rate error 0 b = 64 2 2n ? 1 (n + 1) 10 6 error (%) = { b 64 2 2n ? 1 (n + 1) ? 1 } 100 10 6 asynchronous mode 1 b = 32 2 2n ? 1 (n + 1) 10 6 error (%) = { b 32 2 2n ? 1 (n + 1) ? 1 } 100 10 6 clocked synchronous mode ? b = 8 2 2n ? 1 (n + 1) 10 6 ? smart card interface mode ? b = s 2 2n ? 1 (n + 1) 10 6 error (%) = { b s 2 2n ? 1 (n + 1) ? 1 } 100 10 6 notes: b: bit rate (bit/s) n: brr setting for baud rate generator (0 n 255) : operating frequency (mhz) n and s: determined by the smr settings shown in the following tables. * : if the abcs bit is set to 1, sci_0 on the h8s/2239 is the only valid bit rate. smr setting smr setting cks1 cks0 clock source n bcp1 bcp0 s 00 00032 01 /4 1 0 1 64 10 /16 2 1 0 372 11 /64 3 1 1 256
rev. 2.00, 05/03, page 476 of 846 table 14.3 shows sample n settings in brr in normal asynchronous mode. table 14.4 shows the maximum bit rate for each frequency in normal asynchronous mode. table 14.6 shows sample n settings in brr in clocked synchronous mode. table 14.8 shows sample n settings in brr in smart card interface mode. in smart card interface mode, s (the number of base clock periods in a 1-bit transfer interval) can be selected. for details, refer to section 14.7.4, receive data sampling timing and reception margin. tables 14.5 and 14.7 show the maximum bit rates with external clock input. when the abcs bit in semr_0 of sci_0 is set to 1 in asynchronous mode, the maximum bit rate is twice the value shown in tables 14.4 and 14.5 (valid for h8s/2239 only). table 14.3 brr settings for various bit rates (asynchronous mode) operating frequency (mhz) 2 2.097152 2.4576 3 bit rate (bps) n n error (%) n n error (%) n n error (%) n n error (%) 110 1 141 0.03 1 148 ? 0.04 1 174 ? 0.26 1 212 0.03 150 1 103 0.16 1 108 0.21 1 127 0.00 1 155 0.16 300 0 207 0.16 0 217 0.21 0 255 0.00 1 77 0.16 600 0 103 0.16 0 108 0.21 0 127 0.00 0 155 0.16 1200 0 51 0.16 0 54 ? 0.70 0 63 0.00 0 77 0.16 2400 0 25 0.16 0 26 1.14 0 31 0.00 0 38 0.16 4800 0 12 0.16 0 13 ? 2.48 0 15 0.00 0 19 ? 2.34 9600 ??? 06 ? 2.48 0 7 0.00 0 9 ? 2.34 19200 ??? ??? 0 3 0.00 0 4 ? 2.34 31250 0 1 0.00 ??? ?? ? 0 2 0.00 38400 ??? ??? 0 1 0.00 ?? ?
rev. 2.00, 05/03, page 477 of 846 operating frequency (mhz) 3.6864 4 4.9152 5 bit rate (bps) nn error (%) n n error (%) n n error (%) n n error (%) 110 2 64 0.70 2 70 0.03 2 86 0.31 2 88 ? 0.25 150 1 191 0.00 1 207 0.16 1 255 0.00 2 64 0.16 300 1 95 0.00 1 103 0.16 1 127 0.00 1 129 0.16 600 0 191 0.00 0 207 0.16 0 255 0.00 1 64 0.16 1200 0 95 0.00 0 103 0.16 0 127 0.00 0 129 0.16 2400 0 47 0.00 0 51 0.16 0 63 0.00 0 64 0.16 4800 0 23 0.00 0 25 0.16 0 31 0.00 0 32 ? 1.36 9600 0 11 0.00 0 12 0.16 0 15 0.00 0 15 1.73 19200 0 5 0.00 ?? ? 0 7 0.00 0 7 1.73 31250 ?? ? 0 3 0.00 0 4 ? 1.70 0 4 0.00 38400 0 2 0.00 ?? ? 0 3 0.00 0 3 1.73 operating frequency (mhz) 6 6.144 7.3728 8 bit rate (bps) n n error (%) n n error (%) n n error (%) n n error (%) 110 2 106 ? 0.44 2 108 0.08 2 130 ? 0.07 2 141 0.03 150 2 77 0.16 2 79 0.00 2 95 0.00 2 103 0.16 300 1 155 0.16 1 159 0.00 1 191 0.00 1 207 0.16 600 1 77 0.16 1 79 0.00 1 95 0.00 1 103 0.16 1200 0 155 0.16 0 159 0.00 0 191 0.00 0 207 0.16 2400 0 77 0.16 0 79 0.00 0 95 0.00 0 103 0.16 4800 0 38 0.16 0 39 0.00 0 47 0.00 0 51 0.16 9600 0 19 ? 2.34 0 19 0.00 0 23 0.00 0 25 0.16 19200 0 9 ? 2.34 0 9 0.00 0 11 0.00 0 12 0.16 31250 0 5 0.00 0 5 2.40 ?? ? 0 7 0.00 38400 0 4 ? 2.34 0 4 0.00 0 5 0.00 ?? ?
rev. 2.00, 05/03, page 478 of 846 operating frequency (mhz) 9.8304 10 12 12.288 bit rate (bps) nn error (%) n n error (%) n n error (%) n n error (%) 110 2 174 ? 0.26 2 177 ? 0.25 2 212 0.03 2 217 0.08 150 2 127 0.00 2 129 0.16 2 155 0.16 2 159 0.00 300 1 255 0.00 2 64 0.16 2 77 0.16 2 79 0.00 600 1 127 0.00 1 129 0.16 1 155 0.16 1 159 0.00 1200 0 255 0.00 1 64 0.16 1 77 0.16 1 79 0.00 2400 0 127 0.00 0 129 0.16 0 155 0.16 0 159 0.00 4800 0 63 0.00 0 64 0.16 0 77 0.16 0 79 0.00 9600 0 31 0.00 0 32 ? 1.36 0 38 0.16 0 39 0.00 19200 0 15 0.00 0 15 1.73 0 19 ? 2.34 0 19 0.00 31250 0 9 ? 1.70 0 9 0.00 0 11 0.00 0 11 2.40 38400 0 7 0.00 0 7 1.73 0 9 ? 2.34 0 9 0.00 operating frequency (mhz) 14 * 14.7456 * 16 * 17.2032 * bit rate (bps) n n error (%) n n error (%) n n error (%) n n error (%) 110 2 248 ? 0.17 3 64 0.70 3 70 0.03 3 75 0.48 150 2 181 0.16 2 191 0.00 2 207 0.16 2 223 0.00 300 2 90 0.16 2 95 0.00 2 103 0.16 2 111 0.00 600 1 181 0.16 1 191 0.00 1 207 0.16 1 223 0.00 1200 1 90 0.16 1 95 0.00 1 103 0.16 1 111 0.00 2400 0 181 0.16 0 191 0.00 0 207 0.16 0 223 0.00 4800 0 90 0.16 0 95 0.00 0 103 0.16 0 111 0.00 9600 0 45 ? 0.93 0 47 0.00 0 51 0.16 0 55 0.00 19200 0 22 ? 0.93 0 23 0.00 0 25 0.16 0 27 0.00 31250 0 13 0.00 0 14 ? 1.70 0 15 0.00 0 16 1.20 38400 ?? ? 0 11 0.00 0 12 0.16 0 13 0.00
rev. 2.00, 05/03, page 479 of 846 operating frequency (mhz) 18 * 19.6608 * 20 * bit rate (bps) nn error (%) n n error (%) n n error (%) 110 3 79 ? 0.12 3 86 0.31 3 88 ? 0.25 150 2 233 0.16 2 255 0.00 3 64 0.16 300 2 116 0.16 2 127 0.00 2 129 0.16 600 1 233 0.16 1 255 0.00 2 64 0.16 1200 1 116 0.16 1 127 0.00 1 129 0.16 2400 0 233 0.16 0 255 0.00 1 64 0.16 4800 0 116 0.16 0 127 0.00 0 129 0.16 9600 0 58 ? 0.69 0 63 0.00 0 64 0.16 19200 0 28 1.02 0 31 0.00 0 32 ? 1.36 31250 0 17 0.00 0 19 ? 1.70 0 19 0.00 38400 0 14 ? 2.34 0 15 0.00 0 15 1.73 note: * supported only by the h8s/2239 group.
rev. 2.00, 05/03, page 480 of 846 table 14.4 maximum bit rate for each frequency (asynchronous mode) (mhz) maximum bit rate (kbps) n n (mhz) maximum bit rate (kbps) n n 2 62.5 0 0 9.8304 307.2 0 0 2.097152 65.536 0 0 10 312.5 0 0 2.4576 76.8 0 0 12 375.0 0 0 3 93.75 0 0 12.288 384.0 0 0 3.6864 115.2 0 0 14 * 437.5 0 0 4 125.0 0 0 14.7456 * 460.8 0 0 4.9152 153.6 0 0 16 * 500.0 0 0 5 156.25 0 0 17.2032 * 537.6 0 0 6 187.5 0 0 18 * 562.5 0 0 6.144 192.0 0 0 19.6608 * 614.4 0 0 7.3728 230.4 0 0 20 * 625.0 0 0 8 250.0 0 0 note: * supported only by the h8s/2239 group. table 14.5 maximum bit rate with external clock input (asynchronous mode) (mhz) external input clock (mhz) maximum bit rate (kbps) (mhz) external input clock (mhz) maximum bit rate (kbps) 2 0.5000 31.25 9.8304 2.4576 153.6 2.097152 0.5243 32.768 10 2.5000 156.25 2.4576 0.6144 38.4 12 3.0000 187.5 3 0.7500 46.875 12.288 3.0720 192.0 3.6864 0.9216 57.6 14 * 3.5000 218.75 4 1.0000 62.5 14.7456 * 3.6864 230.4 4.9152 1.2288 76.8 16 * 4.0000 250.0 5 1.2500 78.125 17.2032 * 4.3008 268.8 6 1.5000 93.75 18 * 4.5000 281.3 6.144 1.5360 96.0 19.6608 * 4.9152 307.2 7.3728 1.8432 115.2 20 * 5.0000 312.5 8 2.0000 125.0 note: * supported only by the h8s/2239 group.
rev. 2.00, 05/03, page 481 of 846 table 14.6 brr settings for various bit rates (clocked synchronous mode) operating frequency (mhz) 2481016 * 1 20 * 1 bit rate (bps) nn nn nn nn nn nn 110 3 70 ?? 250 2 124 2 249 3 124 ?? 3 249 500 1 249 2 124 2 249 ?? 3 124 ?? 1 k 1 124 1 249 2 124 ?? 2 249 ?? 2.5 k 0 199 1 99 1 199 1 249 2 99 2 124 5 k 0 99 0 199 1 99 1 124 1 199 1 249 10 k 0 49 0 99 0 199 0 249 1 99 1 124 25 k 0 19 0 39 0 79 0 99 0 159 0 199 50 k 0 9 0 19 0 39 0 49 0 79 0 99 100 k 0 4 0 9 0 19 0 24 0 39 0 49 250 k 0 1 0 3 0 7 0 9 0 15 0 19 500 k 0 0 * 01 03 04 07 09 1 m 0 0 * 01 03 04 2.5 m 0 0 * 01 5 m 00 * legend blank : cannot be set. ? : can be set, but there will be a degree of error. * : continuous transfer is not possible. note: * 1 supported only by the h8s/2239 group. table 14.7 maximum bit rate with external clock input (clocked synchronous mode) (mhz) external input clock (mhz) maximum bit rate (bps) (mhz) external input clock (mhz) maximum bit rate (bps) 2 0.3333 0.333 12 2.0000 2.000 4 0.6667 0.667 14 * 2.3333 2.333 6 1.0000 1.000 16 * 2.6667 3.667 8 1.3333 1.333 18 * 3.0000 3.000 10 1.6667 1.667 20 * 3.3333 3.333 note: * supported only by the h8s/2239 group.
rev. 2.00, 05/03, page 482 of 846 table 14.8 examples of bit rate for various brr settings (smart card interface mode) (when n = 0 and s = 372) operating frequency (mhz) 5.00 7.00 7.1424 10.00 10.7136 bit rate (bps) n error (%) n error (%) n error (%) n error (%) n error (%) 6720 0 0.00 1 30 1 28.75 1 0.01 1 7.14 9600 0 0.00 1 30 1 25 operating frequency (mhz) 13.00 14.2848 * 16.00 * 18.00 * 20.00 * bit rate (bps) n error (%) n error (%) n error (%) n error (%) n error (%) 6720 2 13.33 2 4.76 2 6.67 4 30 4 20 9600 1 8.99 1 0.00 1 12.01 2 19.99 2 6.60 note: * supported only by the h8s/2239 group. table 14.9 maximum bit rate at various frequencies (smart card interface mode) (when s = 372) (mhz) maximum bit rate (bps) n n 5.00 6720 0 0 7.00 9409 0 0 7.1424 9600 0 0 10.00 13441 0 0 10.7136 14400 0 0 13.00 17473 0 0 14.2848 * 19200 0 0 16.00 * 21505 0 0 18.00 * 24194 0 0 20.00 * 26882 0 0 note: * supported only by the h8s/2239 group.
rev. 2.00, 05/03, page 483 of 846 14.3.10 serial expansion mode register (semr_0) semr_0 is an 8-bit register that expands sci_0 functions; such as setting of the base clock, selecting of the clock source, and automatic setting of the transfer rate. note: supported only by the h8s/2239 group only. bit bit name initial value r/w description 7 sse 0 r/w sci_0 select enable this bit enables or disables the sci_0 select function when an external clock is input in clocked synchronous mode. when 1 is set to the pg1/ irq7 pin, while the sci_0 select function is enabled, the txd0 output becomes hi-z and the sck0 input in this lsi is fixed high making the sci_0 data transfer terminated. the sse setting is valid when the external clock input is selected (cke in scr = 0) in clocked synchronous mode (c/ a in smr = 1). 0: sci_0 select is disabled. 1: sci_0 select is enabled. when then pg1/ irq7 pin = 1, the txd0 output becomes hi-z and the sck0 clock input is fixed high. 6 to 4 ? undefined ? reserved these bits are always read as 0, and cannot be modified. 3 abcs 0 r/w asynchronous base clock select selects the 1-bit-interval base clock in asynchronous mode. the abcs setting is valid in asynchronous mode (c/ a in smr = 0). 0: operates on a base clock with a frequency of 16 times the transfer rate. 1: operates on a base clock with a frequency of 8 times the transfer rate.
rev. 2.00, 05/03, page 484 of 846 bit bit name initial value r/w description 2 1 0 acs2 acs1 acs0 0 0 0 r/w r/w r/w asynchronous clock source select when an average transfer rate is selected, the base clock is set automatically regardless of the abcs value. note that average transfer rates are not supported for operating frequencies other than 10.667 mhz and 16 mhz. the acs0 to acs0 settings are valid when the external clock input is selected (cke in scr = 0) in asynchronous mode (c/ a in smr = 0). 000: external clock input 001: selects the average transfer rate 115.152 kbps only for = 10.667 mhz (operates on a base clock with a frequency of 16 times the transfer rate). 001: selects the average transfer rate 460.606 kbps only for = 10.667 mhz (operates on a base clock with a frequency of 8 times the transfer rate). 011: reserved 100: tpu clock input (logical and of tioca1 and tioca2) 101: selects the average transfer rate 115.196 kbps only for = 16 mhz (operates on a base clock with a frequency of 16 times the transfer rate). 110: selects the average transfer rate 460.784 kbps only for = 16 mhz (operates on a base clock with a frequency of 16 times the transfer rate). 111: selects the average transfer rate 720 kbps only for = 16 mhz (operates on a base clock with a frequency of 8 times the transfer rate). figures 14.3 and 14.4 show an example of the internal base clock when the average transfer rate is selected.
rev. 2.00, 05/03, page 485 of 846 1234567891011 12345678 12 13 14 15 16 17 18 19 20 21 23 22 24 25 26 27 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 1 2 3 4 28 29 5.333 mhz 3.6848 mhz 123 123 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 23 22 4 5 6 7 8 9 10 11 12 13 14 15 16 24 25 26 27 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 1 2 3 4 28 29 2.667 mhz 1.8424 mhz 1 bit = base clock x 16 * base clock 10.667 mhz/4 = 2.667 mhz 2.667 mhz x (38/55) = 1.8424 mhz (average) average transfer rate is 115.152 kbps = 10.667 average transfer rate = 1.8424 mhz/16 = 115.152 kbps average error = ? 0.043% 1 bit = base clock x 8 * base clock 10.667 mhz/2 = 5.333 mhz 5.333 mhz x (38/55) = 3.6848 mhz (average) average transfer rate is 460.606 kbps average transfer rate = 3.6848 mhz/8 = 460.606 kbps average error = ? 0.043% note: * the 1-bit length changes according to the base clock synchronization. figure 14.3 example of the internal base clock when the average transfer rate is selected (1)
rev. 2.00, 05/03, page 486 of 846 12345678910 123 45 678 11 12 13 14 15 16 17 18 19 20 21 23 22 2425 1 2 5 6 7 8 9 101112131415 161718 19202122232425 34 8 mhz 7.3725 mhz 1234567891011121314151617 123456789101112 13141516 18 19 20 21 23 22 24 25 26 27 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 28 29 8 mhz 5.76 mhz 123 2 mhz 1.8431 mhz 4567891011121314151617 123456789101112 13141516 18 19 20 21 23 22 24 25 26 27 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 1 2 3 4 5 6 7 8 28 29 1 bit = base clock x 16 * base clock 16 mhz/8 = 2 mhz 2 mhz x (47/51) = 1.8431 mhz (average) average transfer rate when f = 115.196 kbps average transfer rate = 1.8431 mhz/16 = 115.196 kbps average error with 115.2kbps = ? 0.004% 1 bit = base clock x 16 * base clock 16 mhz/2 = 8 mhz 8 mhz x (47/51) = 7.3725 mhz (average) average transfer rate when f = 460.784 kbps average transfer rate = 7.3725 mhz/16 = 460.784 kbps average error with 460.8kbps = ? 0.004% 1 bit = base clock x 16 * base clock 16 mhz/2 = 8 mhz 8 mhz x (18/5) = 5.76 mhz (average) average transfer rate when f = 720 kbps average transfer rate = 5.76 mhz/8 = 720 kbps average error with 720kbps = ? 0% note: * the 1-bit length changes according to the base clock synchronization. = 16 mhz figure 14.4 example of the internal base clock when the average transfer rate is selected (2)
rev. 2.00, 05/03, page 487 of 846 14.4 operation in asynchronous mode figure 14.5 shows the general format for asynchronous serial communication. one frame consists of a start bit (low level), followed by data, a parity bit, and finally stop bits (high level). in asynchronous serial communication, the transmission line is usually held in the mark state (high level). the sci monitors the transmission line, and when it goes to the space state (low level), recognizes a start bit and starts serial communication. inside the sci, the transmitter and receiver are independent units, enabling full-duplex communication. both the transmitter and the receiver also have a double-buffered structure, so that data can be read or written during transmission or reception, enabling continuous data transfer. in asynchronous mode, the sci performs synchronization at the falling edge of the start bit in reception. the sci samples the data on the 8th pulse of a clock with a frequency of 16 times the length of one bit, so that the transfer data is latched at the center of each bit. the sci_0 samples the data on the 4th pulse of a clock with a frequency of 8 times the length of one bit when the abcs bit in semr_0 is 1. lsb start bit msb idle state (mark state) stop bit 0 transmit/receive data d0 d1 d2 d3 d4 d5 d6 d7 0/1 1 1 1 1 serial data parity bit 1 bit 1 or 2 bits 7 or 8 bits 1 bit, or none one unit of transfer data (character or frame) figure 14.5 data format in asynchronous communication (example with 8-bit data, parity, two stop bits) 14.4.1 data transfer format table 14.10 shows the data transfer formats that can be used in asynchronous mode. any of 12 transfer formats can be selected according to the smr setting. for details on the multiprocessor bit, refer to section 14.5, multiprocessor communication function.
rev. 2.00, 05/03, page 488 of 846 table 14.10 serial transfer formats (asynchronous mode) pe 0 0 1 1 0 0 1 1 s 8-bit data stop s 7-bit data stop s 8-bit data stop stop s 8-bit data p stop s 7-bit data stop p s 8-bit data mpb stop s 8-bit data mpb stop stop s 7-bit data stop mpb s 7-bit data stop mpb stop s 7-bit data stop stop chr 0 0 0 0 1 1 1 1 0 0 1 1 mp 0 0 0 0 0 0 0 0 1 1 1 1 stop 0 1 0 1 0 1 0 1 0 1 0 1 smr settings 123456789101112 serial transfer format and frame length stop s 8-bit data p stop s 7-bit data stop p stop legend s : start bit stop : stop bit p : parity bit mpb : multiprocessor bit
rev. 2.00, 05/03, page 489 of 846 14.4.2 receive data sampling timing and reception margin in asynchronous mode in asynchronous mode, the sci operates on a base clock with a frequency of 16 times the transfer rate. in reception, the sci samples the falling edge of the start bit using the base clock, and performs internal synchronization. receive data is latched internally at the rising edge of the 8th pulse of the base clock as shown in figure 14.6. thus, the reception margin in asynchronous mode is given by formula (1) below. m = (0.5 ? ? ? ? + ? internal basic clock 16 clocks 8 clocks receive data (rxd) synchronization sampling timing start bit d0 d1 data sampling timing 15 0 7 15 0 07 note: example with abcs bit in semr0 set to 1. when abcs is set to 1, the clock frequency is 8 times the bit rate and sampling of received data takes place at the fourth rising edge of the basic clock. figure 14.6 receive data sampling timing in asynchronous mode
rev. 2.00, 05/03, page 490 of 846 14.4.3 clock either an internal clock generated by the on-chip baud rate generator or an external clock input at the sck pin can be selected as the sci's serial clock, according to the setting of the c/ a bit in smr and the cke0 and cke1 bits in scr. when an external clock is input at the sck pin, the clock frequency should be 16 times the bit rate used. when the sci is operated on an internal clock, the clock can be output from the sck pin when setting cke1 = 0 and cke0 = 1. the frequency of the clock output in this case is equal to the bit rate, and the phase is such that the rising edge of the clock is in the middle of the transmit data, as shown in figure 14.7. 0 1 frame d0 d1 d2 d3 d4 d5 d6 d7 0/1 11 sck txd figure 14.7 relationship between output clock and transfer data phase (asynchronous mode) 14.4.4 sci initialization (asynchronous mode) before transmitting and receiving data, you should first clear the te and re bits in scr to 0, then initialize the sci as described in figure 14.8. when the operating mode, or transfer format, is changed for example, the te and re bits must be cleared to 0 before making the change using the following procedure. when the te bit is cleared to 0, the tdre flag is set to 1. note that clearing the re bit to 0 does not initialize the contents of the rdrf, per, fer, and orer flags, or the contents of rdr. when the external clock is used in asynchronous mode, the clock must be supplied even during initialization.
rev. 2.00, 05/03, page 491 of 846 wait start initialization set data transfer format in smr and scmr [1] set cke1 and cke0 bits in scr (te, re bits 0) no yes set value in brr clear te and re bits in scr to 0 [2] [3] set te and re bits in scr to 1, and set rie, tie, teie, and mpie bits [4] 1-bit interval elapsed? [1] set the clock selection in scr. be sure to clear bits rie, tie, teie, and mpie, and bits te and re, to 0. when the clock is selected in asynchronous mode, it is output immediately after scr settings are made. [2] set the data transfer format in smr and scmr. [3] write a value corresponding to the bit rate to brr. not necessary if an external clock or an average transfer rate clock by bits ac2 to acs0 in semr_0 is used. [4] wait at least one bit interval, then set the te bit or re bit in scr to 1. also set the rie, tie, teie, and mpie bits. figure 14.8 sample sci initialization flowchart 14.4.5 serial data transmission (asynchronous mode) figure 14.9 shows an example of operation for transmission in asynchronous mode. in transmission, the sci operates as described below. 1. the sci monitors the tdre flag in ssr. if the flag is cleared to 0, the sci recognizes that data has been written to tdr, and transfers the data from tdr to tsr. 2. after transferring data from tdr to tsr, the sci sets the tdre flag to 1 and starts transmission. if the tie bit is set to 1 at this time, a transmit data empty interrupt request (txi) is generated. continuous transmission is possible because the txi interrupt routine writes next transmit data to tdr before transmission of the current transmit data has been completed. 3. data is sent from the txd pin in the following order: start bit, transmit data, parity bit or multiprocessor bit (may be omitted depending on the format), and stop bit. 4. the sci checks the tdre flag at the timing for sending the stop bit. 5. if the tdre flag is 0, the data is transferred from tdr to tsr, the stop bit is sent, and then serial transmission of the next frame is started.
rev. 2.00, 05/03, page 492 of 846 6. if the tdre flag is 1, the tend flag in ssr is set to 1, the stop bit is sent, and then the ? mark state ? is entered, in which 1 is output. if the teie bit in scr is set to 1 at this time, a tei interrupt request is generated. tdre tend 0 1 frame d0 d1 d7 0/1 1 0 d0 d1 d7 0/1 1 1 1 data start bit parity bit stop bit start bit data parity bit stop bit txi interrupt request generated data written to tdr and tdre flag cleared to 0 in txi interrupt service routine tei interrupt request generated idle state (mark state) txi interrupt request generated figure 14.9 example of operation in transmission in asynchronous mode (example with 8-bit data, parity, one stop bit)
rev. 2.00, 05/03, page 493 of 846 figure 14.10 shows a sample flowchart for data transmission. no [1] yes initialization start transmission read tdre flag in ssr [2] write transmit data to tdr and clear tdre flag in ssr to 0 no yes no yes read tend flag in ssr [3] no yes [4] clear dr to 0 and set ddr to 1 clear te bit in scr to 0 tdre = 1 all data transmitted? tend = 1 break output? [1] sci initialization: the txd pin is automatically designated as the transmit data output pin. after the te bit is set to 1, a frame of 1s is output, and transmission is enabled. [2] sci status check and transmit data write: read ssr and check that the tdre flag is set to 1, then write transmit data to tdr and clear the tdre flag to 0. [3] serial transmission continuation procedure: to continue serial transmission, read 1 from the tdre flag to confirm that writing is possible, then write data to tdr, and then clear the tdre flag to 0. checking and clearing of the tdre flag is automatic when the dmac * or the dtc is activated by a transmit-data -empty interrupt (txi) request, and data is written to tdr. [4] break output at the end of serial transmission: to output a break in serial transmission, set dr for the port corresponding to the txd pin to 0, clear ddr to 1, then clear the te bit in scr to 0. note: * supprted only by the h8s/2239 group. figure 14.10 sample serial transmission flowchart
rev. 2.00, 05/03, page 494 of 846 14.4.6 serial data reception (asynchronous mode) figure 14.11 shows an example of operation for reception in asynchronous mode. in serial reception, the sci operates as described below. 1. the sci monitors the communication line. if a start bit is detected, the sci performs internal synchronization, receives receive data in rsr, and checks the parity bit and stop bit. 2. if an overrun error occurs (when reception of the next data is completed while the rdrf flag is still set to 1), the orer bit in ssr is set to 1. if the rie bit in scr is set to 1 at this time, an eri interrupt request is generated. receive data is not transferred to rdr. the rdrf flag remains to be set to 1. 3. if a parity error is detected, the per bit in ssr is set to 1 and receive data is transferred to rdr. if the rie bit in scr is set to 1 at this time, an eri interrupt request is generated. 4. if a framing error is detected (when the stop bit is 0), the fer bit in ssr is set to 1 and receive data is transferred to rdr. if the rie bit in scr is set to 1 at this time, an eri interrupt request is generated. 5. if reception is completed successfully, the rdrf bit in ssr is set to 1, and receive data is transferred to rdr. if the rie bit in scr is set to 1 at this time, an rxi interrupt request is generated. continuous reception is possible because the rxi interrupt routine reads the receive data transferred to rdr before reception of the next receive data has been completed. rdrf fer 0 1 frame d0 d1 d7 0/1 1 0 d0 d1 d7 0/1 0 1 1 data start bit parity bit stop bit start bit data parity bit stop bit eri interrupt request generated by framing error idle state (mark state) rdr data read and rdrf flag cleared to 0 in rxi interrupt service routine rxi interrupt request generated figure 14.11 example of sci operation in reception (example with 8-bit data, parity, one stop bit)
rev. 2.00, 05/03, page 495 of 846 table 14.11 shows the states of the ssr status flags and receive data handling when a receive error is detected. if a receive error is detected, the rdrf flag retains its state before receiving data. reception cannot be resumed while a receive error flag is set to 1. accordingly, clear the orer, fer, per, and rdrf bits to 0 before resuming reception. figure 14.12 shows a sample flow chart for serial data reception. table 14.11 ssr status flags and receive data handling ssr status flag rdrf * orer fer per receive data receive error type 1100lost overrun error 0010transferred to rdrframing error 0001transferred to rdrparity error 1110lost overrun error + framing error 1101lost overrun error + parity error 0011transferred to rdrframing error + parity error 1111lost overrun error + framing error + parity error note: * the rdrf flag retains the state it had before data reception.
rev. 2.00, 05/03, page 496 of 846 yes [1] no initialization start reception [2] no yes read rdrf flag in ssr [4] [5] clear re bit in scr to 0 read orer, per, and fer flags in ssr error processing (continued on next page) [3] read receive data in rdr, and clear rdrf flag in ssr to 0 no yes per fer orer = 1 rdrf = 1 all data received? [1] sci initialization: the rxd pin is automatically designated as the receive data input pin. [2] [3] receive error processing and break detection: if a receive error occurs, read the orer, per, and fer flags in ssr to identify the error. after performing the appropriate error processing, ensure that the orer, per, and fer flags are all cleared to 0. reception cannot be resumed if any of these flags are set to 1. in the case of a framing error, a break can be detected by reading the value of the input port corresponding to the rxd pin. [4] sci status check and receive data read: read ssr and check that rdrf = 1, then read the receive data in rdr and clear the rdrf flag to 0. transition of the rdrf flag from 0 to 1 can also be identified by an rxi interrupt. [5] serial reception continuation procedure: to continue serial reception, before the stop bit for the current frame is received, read the rdrf flag, read rdr, and clear the rdrf flag to 0. the rdrf flag is cleared automatically when the dmac * or the dtc is activated by an rxi interrupt and the rdr value is read. note: * supprted only by the h8s/2239 group. figure 14.12 sample serial reception data flowchart (1)
rev. 2.00, 05/03, page 497 of 846 [3] error processing parity error processing yes no clear orer, per, and fer flags in ssr to 0 no yes no yes framing error processing no yes overrun error processing orer = 1 fer = 1 break? per = 1 clear re bit in scr to 0 figure 14.12 sample serial reception data flowchart (2)
rev. 2.00, 05/03, page 498 of 846 14.5 multiprocessor communication function use of the multiprocessor communication function enables data transfer between a number of processors sharing communication lines by asynchronous serial communication using the multiprocessor format, in which a multiprocessor bit is added to the transfer data. when multiprocessor communication is performed, each receiving station is addressed by a unique id code. the serial communication cycle consists of two component cycles; an id transmission cycle that specifies the receiving station, and a data transmission cycle. the multiprocessor bit is used to differentiate between the id transmission cycle and the data transmission cycle. if the multiprocessor bit is 1, the cycle is an id transmission cycle; if the multiprocessor bit is 0, the cycle is a data transmission cycle. figure 14.13 shows an example of inter-processor communication using the multiprocessor format. the transmitting station first sends the id code of the receiving station with which it wants to perform serial communication as data with a 1 multiprocessor bit added. it then sends transmit data as data with a 0 multiprocessor bit added. when data with a 1 multiprocessor bit is received, the receiving station compares that data with its own id. the station whose id matches then receives the data sent next. stations whose ids do not match continue to skip data until data with a 1 multiprocessor bit is again received. the sci uses the mpie bit in scr to implement this function. when the mpie bit is set to 1, transfer of receive data from rsr to rdr, error flag detection, and setting the ssr status flags, rdrf, fer, and orer to 1, are inhibited until data with a 1 multiprocessor bit is received. on reception of a receive character with a 1 multiprocessor bit, the mpb bit in ssr is set to 1 and the mpie bit is automatically cleared, thus normal reception is resumed. if the rie bit in scr is set to 1 at this time, an rxi interrupt is generated. when the multiprocessor format is selected, the parity bit setting is rendered invalid. all other bit settings are the same as those in normal asynchronous mode. the clock used for multiprocessor communication is the same as that in normal asynchronous mode.
rev. 2.00, 05/03, page 499 of 846 transmitting station receiving station a receiving station b receiving station c receiving station d (id = 01) (id = 02) (id = 03) (id = 04) serial transmission line serial data id transmission cycle = receiving station specification data transmission cycle = data transmission to receiving station specified by id (mpb = 1) (mpb = 0) h ? 01 h ? aa legend mpb: multiprocessor bit figure 14.13 example of communication using multiprocessor format (transmission of data h'aa to receiving station a) 14.5.1 multiprocessor serial data transmission figure 14.14 shows a sample flowchart for multiprocessor serial data transmission. for an id transmission cycle, set the mpbt bit in ssr to 1 before transmission. for a data transmission cycle, clear the mpbt bit in ssr to 0 before transmission. all other sci operations are the same as those in asynchronous mode.
rev. 2.00, 05/03, page 500 of 846 no [1] yes initialization start transmission read tdre flag in ssr [2] write transmit data to tdr and set mpbt bit in ssr no yes no yes read tend flag in ssr [3] no yes [4] clear dr to 0 and set ddr to 1 clear te bit in scr to 0 tdre = 1 all data transmitted? tend = 1 break output? clear tdre flag to 0 [1] sci initialization: the txd pin is automatically designated as the transmit data output pin. after the te bit is set to 1, a frame of 1s is output, and transmission is enabled. [2] sci status check and transmit data write: read ssr and check that the tdre flag is set to 1, then write transmit data to tdr. set the mpbt bit in ssr to 0 or 1. finally, clear the tdre flag to 0. [3] serial transmission continuation procedure: to continue serial transmission, be sure to read 1 from the tdre flag to confirm that writing is possible, then write data to tdr, and then clear the tdre flag to 0. checking and clearing of the tdre flag is automatic when the dmac * or the dtc is activated by a transmit-data-empty interrupt (txi) request, and data is written to tdr. [4] break output at the end of serial transmission: to output a break in serial transmission, set the port dr to 0, clear ddr to 1, then clear the te bit in scr to 0. note: * supprted only by the h8s/2239 group. figure 14.14 sample multiprocessor serial transmission flowchart
rev. 2.00, 05/03, page 501 of 846 14.5.2 multiprocessor serial data reception figure 14.16 shows a sample flowchart for multiprocessor serial data reception. if the mpie bit in scr is set to 1, data is skipped until data with a 1 multiprocessor bit is sent. on receiving data with a 1 multiprocessor bit, the receive data is transferred to rdr. an rxi interrupt request is generated at this time. all other sci operations are the same as in asynchronous mode. figure 14.15 shows an example of sci operation for multiprocessor format reception. mpie rdr value 0 d0 d1 d7 1 1 0 d0 d1 d7 0 1 1 1 data (id1) start bit multi- processor bit multi- processor bit multi- processor bit multi- processor bit stop bit start bit data (data1) stop bit data (id2) start bit stop bit start bit data (data2) stop bit rxi interrupt request (multiprocessor interrupt) generated mark state (idle state) rdrf rdr data read and rdrf flag cleared to 0 in rxi interrupt service routine if not this station s id, mpie bit is set to 1 again rxi interrupt request is not generated, and rdr retains its state id1 (a) data does not match station ? s id mpie rdr value 0 d0 d1 d7 1 1 0 d0 d1 d7 0 1 1 1 rxi interrupt request (multiprocessor interrupt) generated mark state (idle state) rdrf rdr data read and rdrf flag cleared to 0 in rxi interrupt service routine matches this station s id, so reception continues, and data is received in rxi interrupt service routine mpie bit set to 1 again id2 (b) data matches station ? s id data2 id1 mpie = 0 mpie = 0 figure 14.15 example of sci operation in reception (example with 8-bit data, multiprocessor bit, one stop bit)
rev. 2.00, 05/03, page 502 of 846 yes [1] no initialization start reception no yes [4] clear re bit in scr to 0 error processing (continued on next page) [5] no yes fer orer = 1 rdrf = 1 all data received? read mpie bit in scr [2] read orer and fer flags in ssr read rdrf flag in ssr [3] read receive data in rdr no yes this station's id? read orer and fer flags in ssr yes no read rdrf flag in ssr no yes fer orer = 1 read receive data in rdr rdrf = 1 [1] sci initialization: the rxd pin is automatically designated as the receive data input pin. [2] id reception cycle: set the mpie bit in scr to 1. [3] sci status check, id reception and comparison: read ssr and check that the rdrf flag is set to 1, then read the receive data in rdr and compare it with this station ? s id. if the data is not this station's id, set the mpie bit to 1 again, and clear the rdrf flag to 0. if the data is this station's id, clear the rdrf flag to 0. [4] sci status check and data reception: read ssr and check that the rdrf flag is set to 1, then read the data in rdr. [5] receive error processing and break detection: if a receive error occurs, read the orer and fer flags in ssr to identify the error. after performing the appropriate error processing, ensure that the orer and fer flags are all cleared to 0. reception cannot be resumed if either of these flags is set to 1. in the case of a framing error, a break can be detected by reading the rxd pin value. figure 14.16 sample multiprocessor serial reception flowchart (1)
rev. 2.00, 05/03, page 503 of 846 error processing yes no clear orer, per, and fer flags in ssr to 0 no yes no yes framing error processing overrun error processing orer = 1 fer = 1 break? clear re bit in scr to 0 [5] figure 14.16 sample multiprocessor serial reception flowchart (2)
rev. 2.00, 05/03, page 504 of 846 14.6 operation in clocked synchronous mode figure 14.17 shows the general format for clocked synchronous communication. in clocked synchronous mode, data is transmitted or received synchronous with clock pulses. in clocked synchronous serial communication, data on the transmission line is output from one falling edge of the serial clock to the next. in clocked synchronous mode, the sci receives data in synchronous with the rising edge of the serial clock. after 8-bit data is output, the transmission line holds the msb state. in clocked synchronous mode, no parity or multiprocessor bit is added. inside the sci, the transmitter and receiver are independent units, enabling full-duplex communication through the use of a common clock. both the transmitter and the receiver also have a double-buffered structure, so data can be read or written during transmission or reception, enabling continuous data transfer. don ? t care don ? t care one unit of transfer data (character or frame) bit 0 serial data synchronization clock bit 1 bit 3 bit 4 bit 5 lsb msb bit 2 bit 6 bit 7 * * note: * high except in continuous transfer figure 14.17 data format in synchronous communication (for lsb-first) 14.6.1 clock either an internal clock generated by the on-chip baud rate generator or an external synchronization clock input at the sck pin can be selected, according to the setting of cke0 and cke1 bits in scr. when the sci is operated on an internal clock, the serial clock is output from the sck pin. eight serial clock pulses are output in the transfer of one character, and when no transfer is performed the clock is fixed high. 14.6.2 sci initialization (clocked synchronous mode) before transmitting and receiving data, the te and re bits in scr should be cleared to 0, then the sci should be initialized as described in a sample flowchart in figure 14.18. when the operating mode, or transfer format, is changed for example, the te and re bits must be cleared to 0 before making the change using the following procedure. when the te bit is cleared to 0, the tdre flag is set to 1. note that clearing the re bit to 0 does not change the contents of the rdrf, per, fer, and orer flags, or the contents of rdr.
rev. 2.00, 05/03, page 505 of 846 wait start initialization set data transfer format in smr and scmr no yes set value in brr clear te and re bits in scr to 0 [2] [3] set te and re bits in scr to 1, and set rie, tie, teie, and mpie bits [4] 1-bit interval elapsed? set cke1 and cke0 bits in scr (te, re bits 0) [1] [1] set the clock selection in scr. be sure to clear bits rie, tie, teie, and mpie, te and re, to 0. [2] set the data transfer format in smr and scmr. [3] write a value corresponding to the bit rate to brr. not necessary if an external clock is used. [4] wait at least one bit interval, then set the te bit or re bit in scr to 1. also set the rie, tie teie, and mpie bits. setting the te and re bits enables the txd and rxd pins to be used. note: in simultaneous transmit and receive operations, the te and re bits should both be cleared to 0 or set to 1 simultaneously. figure 14.18 sample sci initialization flowchart 14.6.3 serial data transmission (clocked synchronous mode) figure 14.19 shows an example of sci operation for transmission in clocked synchronous mode. in serial transmission, the sci operates as described below. 1. the sci monitors the tdre flag in ssr, and if the flag is 0, the sci recognizes that data has been written to tdr, and transfers the data from tdr to tsr. 2. after transferring data from tdr to tsr, the sci sets the tdre flag to 1 and starts transmission. if the tie bit in scr is set to 1 at this time, a transmit data empty interrupt (txi) is generated. continuous transmission is possible because the txi interrupt routine writes the next transmit data to tdr before transmission of the current transmit data has been completed. 3. 8-bit data is sent from the txd pin synchronized with the output clock when output clock mode has been specified, and synchronized with the input clock when use of an external clock has been specified.
rev. 2.00, 05/03, page 506 of 846 4. the sci checks the tdre flag at the timing for sending the msb (bit 7). 5. if the tdre flag is cleared to 0, data is transferred from tdr to tsr, and serial transmission of the next frame is started. 6. if the tdre flag is set to 1, the tend flag in ssr is set to 1, and the tdre flag maintains the output state of the last bit. if the teie bit in scr is set to 1 at this time, a tei interrupt request is generated. the sck pin is fixed high. figure 14.20 shows a sample flow chart for serial data transmission. even if the tdre flag is cleared to 0, transmission will not start while a receive error flag (orer, fer, or per) is set to 1. make sure that the receive error flags are cleared to 0 before starting transmission. note that clearing the re bit to 0 does not clear the receive error flags. transfer direction bit 0 serial data synchronization clock 1 frame tdre tend data written to tdr and tdre flag cleared to 0 in txi interrupt service routine txi interrupt request generated bit 1 bit 7 bit 0 bit 1 bit 6 bit 7 txi interrupt request generated tei interrupt request generated figure 14.19 sample sci transmission operation in clocked synchronous mode
rev. 2.00, 05/03, page 507 of 846 no [1] yes initialization start transmission read tdre flag in ssr [2] write transmit data to tdr and clear tdre flag in ssr to 0 no yes no yes read tend flag in ssr [3] clear te bit in scr to 0 tdre = 1 all data transmitted? tend = 1 [1] sci initialization: the txd pin is automatically designated as the transmit data output pin. [2] sci status check and transmit data write: read ssr and check that the tdre flag is set to 1, then write transmit data to tdr and clear the tdre flag to 0. [3] serial transmission continuation procedure: to continue serial transmission, be sure to read 1 from the tdre flag to confirm that writing is possible, then write data to tdr, and then clear the tdre flag to 0. checking and clearing of the tdre flag is automatic when the dmac * or the dtc is activated by a transmit data empty interrupt (txi) request and data is written to tdr. note: * supported only by the h8s/2239 group. figure 14.20 sample serial transmission flowchart
rev. 2.00, 05/03, page 508 of 846 14.6.4 serial data reception (clocked synchronous mode) figure 14.21 shows an example of sci operation for reception in clocked synchronous mode. in serial reception, the sci operates as described below. 1. the sci performs internal initialization synchronous with a synchronous clock input or output, starts receiving data, and stores the received data in rsr. 2. if an overrun error occurs (when reception of the next data is completed while the rdrf flag in ssr is still set to 1), the orer bit in ssr is set to 1. if the rie bit in scr is set to 1 at this time, an eri interrupt request is generated, receive data is not transferred to rdr, and the rdrf flag remains to be set to 1. 3. if reception is completed successfully, the rdrf bit in ssr is set to 1, and receive data is transferred to rdr. if the rie bit in scr is set to 1 at this time, an rxi interrupt request is generated. continuous reception is possible because the rxi interrupt routine reads the receive data transferred to rdr before reception of the next receive data has finished. bit 7 serial data synchronization clock 1 frame rdrf orer eri interrupt request generated by overrun error rxi interrupt request generated rdr data read and rdrf flag cleared to 0 in rxi interrupt rxi interrupt request generated bit 0 bit 7 bit 0 bit 1 bit 6 bit 7 figure 14.21 example of sci operation in reception reception cannot be resumed while a receive error flag is set to 1. accordingly, clear the orer, fer, per, and rdrf bits to 0 before resuming reception. figure 14.22 shows a sample flow chart for serial data reception. an overrun error occurs or synchronous clocks are output until the re bit is cleared to 0 when an internal clock is selected and only receive operation is possible. when a transmission and reception will be carried out in a unit of one frame, be sure to carry out a dummy transmission with only one frame by the simultaneous transmit and receive operations at the same time.
rev. 2.00, 05/03, page 509 of 846 yes [1] no initialization start reception [2] no yes read rdrf flag in ssr [4] [5] clear re bit in scr to 0 error processing (continued below) [3] read receive data in rdr, and clear rdrf flag in ssr to 0 no yes orer = 1 rdrf = 1 all data received? read orer flag in ssr error processing overrun error processing clear orer flag in ssr to 0 [3] [1] sci initialization: the rxd pin is automatically designated as the receive data input pin. [2] [3] receive error processing: if a receive error occurs, read the orer flag in ssr, and after performing the appropriate error processing, clear the orer flag to 0. transfer cannot be resumed if the orer flag is set to 1. [4] sci status check and receive data read: read ssr and check that the rdrf flag is set to 1, then read the receive data in rdr and clear the rdrf flag to 0. transition of the rdrf flag from 0 to 1 can also be identified by an rxi interrupt. [5] serial reception continuation procedure: to continue serial reception, before the final bit of the current frame is received, reading the rdrf flag, reading rdr, and clearing the rdrf flag to 0 should be finished. the rdrf flag is cleared automatically when the dmac * or the dtc is activated by a receive data full interrupt (rxi) request and the rdr value is read. note: * supprted only by the h8s/2239 group. figure 14.22 sample serial reception flowchart
rev. 2.00, 05/03, page 510 of 846 14.6.5 simultaneous serial data transmission and reception (clocked synchronous mode) figure 14.23 shows a sample flowchart for simultaneous serial transmit and receive operations. the following procedure should be used for simultaneous serial data transmit and receive operations. to switch from transmit mode to simultaneous transmit and receive mode, after checking that the sci has finished transmission and the tdre and tend flags are set to 1, clear te to 0. then simultaneously set te and re to 1 with a single instruction. to switch from receive mode to simultaneous transmit and receive mode, after checking that the sci has finished reception, clear re to 0. then after checking that the rdrf and receive error flags (orer, fer, and per) are cleared to 0, simultaneously set te and re to 1 with a single instruction.
rev. 2.00, 05/03, page 511 of 846 yes [1] no initialization start transmission/reception [5] error processing [3] read receive data in rdr, and clear rdrf flag in ssr to 0 no yes orer = 1 all data received? [2] read tdre flag in ssr no yes tdre = 1 write transmit data to tdr and clear tdre flag in ssr to 0 no yes rdrf = 1 read orer flag in ssr [4] read rdrf flag in ssr clear te and re bits in scr to 0 [1] sci initialization: the txd pin is designated as the transmit data output pin, and the rxd pin is designated as the receive data input pin, enabling simultaneous transmit and receive operations. [2] sci status check and transmit data write: read ssr and check that the tdre flag is set to 1, then write transmit data to tdr and clear the tdre flag to 0. transition of the tdre flag from 0 to 1 can also be identified by a txi interrupt. [3] receive error processing: if a receive error occurs, read the orer flag in ssr, and after performing the appropriate error processing, clear the orer flag to 0. transmission/reception cannot be resumed if the orer flag is set to 1. [4] sci status check and receive data read: read ssr and check that the rdrf flag is set to 1, then read the receive data in rdr and clear the rdrf flag to 0. transition of the rdrf flag from 0 to 1 can also be identified by an rxi interrupt. [5] serial transmission/reception continuation procedure: to continue serial transmission/ reception, before the final bitof the current frame is received, finish reading the rdrf flag, reading rdr, and clearing the rdrf flag to 0. also, before the final bit of the current frame is transmitted, read 1 from the tdre flag to confirm that writing is possible. then write data to tdr and clear the tdre flag to 0. checking and clearing of the tdre flag is automatic when the dtc is activated by a transmit data empty interrupt (txi) request and data is written to tdr. also, the rdrf flag is cleared automatically when the dmac * or the dtc is activated by a receive data full interrupt (rxi) request and the rdr value is read. notes: when switching from transmit or receive operation to simultaneous transmit and receive operations, first clear the te bit and re bit to 0, then set both these bits to 1 by one instruction simultaneously. * supprted only by the h8s/2239 group. figure 14.23 sample flowchart of simultaneous serial transmit and receive operations
rev. 2.00, 05/03, page 512 of 846 14.7 operation in smart card interface the sci supports an ic card (smart card) interface that conforms to iso/iec 7816-3 (identification card) as a serial communication interface extension function. switching between the normal serial communication interface and the smart card interface mode is carried out by means of a register setting. 14.7.1 pin connection example figure 14.24 shows an example of connection with the smart card. in communication with an ic card, as both transmission and reception are carried out on a single data transmission line, the txd pin and rxd pin should be connected to the lsi pin. the data transmission line should be pulled up to the v cc power supply with a resistor. if an ic card is not connected, and the te and re bits are both set to 1, closed transmission/reception is possible, enabling self-diagnosis to be carried out. when the clock generated on the smart card interface is used by an ic card, the sck pin output is input to the clk pin of the ic card. this lsi port output is used as the reset signal. txd rxd this lsi v cc i/o connected equipment ic card data line clock line reset line clk rst sck rx (port) figure 14.24 schematic diagram of smart card interface pin connections 14.7.2 data format (except for block transfer mode) figure 14.25 shows the transfer data format in smart card interface mode. ? one frame consists of 8-bit data plus a parity bit in asynchronous mode. ? in transmission, a guard time of at least 2 etu (elementary time unit: the time for transfer of 1 bit) is left between the end of the parity bit and the start of the next frame. ? if a parity error is detected during reception, a low error signal level is output for one etu period, 10.5 etu after the start bit. ? if an error signal is sampled during transmission, the same data is retransmitted automatically after a delay of 2 etu or longer.
rev. 2.00, 05/03, page 513 of 846 ds d0 d1 d2 d3 d4 d5 d6 d7 dp when there is no parity error transmitting station output ds d0 d1 d2 d3 d4 d5 d6 d7 dp when a parity error occurs transmitting station output de receiving station output : start bit : data bits : parity bit : error signal legend ds d0 to d7 dp de figure 14.25 normal smart card interface data format data transfer with other types of ic cards (direct convention and inverse convention) are performed as described in the following. ds azzazz z za a (z) (z) state d0 d1 d2 d3 d4 d5 d6 d7 dp figure 14.26 direct convention (sdir = sinv = o/ e e e e = 0) with the direction convention type ic and the above sample start character, the logic 1 level corresponds to state z and the logic 0 level to state a, and transfer is performed in lsb-first order. the start character data above is h'3b. for the direct convention type, clear the sdir and sinv bits in scmr to 0. according to smart card regulations, clear the o/ e bit in smr to 0 to select even parity mode. ds azzaaa z aa a (z) (z) state d7 d6 d5 d4 d3 d2 d1 d0 dp figure 14.27 inverse convention (sdir = sinv = o/ e e e e = 1) with the inverse convention type, the logic 1 level corresponds to state a and the logic 0 level to state z, and transfer is performed in msb-first order. the start character data for the above is h'3f. for the inverse convention type, set the sdir and sinv bits in scmr to 1. according to smart card regulations, even parity mode is the logic 0 level of the parity bit, and corresponds to state z. in this lsi, the sinv bit inverts only data bits d0 to d7. therefore, set the o/ e bit in smr to 1 to invert the parity bit for both transmission and reception.
rev. 2.00, 05/03, page 514 of 846 14.7.3 block transfer mode operation in block transfer mode is the same as that in the normal smart card interface mode, except for the following points. ? in reception, though the parity check is performed, no error signal is output even if an error is detected. however, the per bit in ssr is set to 1 and must be cleared before receiving the parity bit of the next frame. ? in transmission, a guard time of at least 1 etu is left between the end of the parity bit and the start of the next frame. ? in transmission, because retransmission is not performed, the tend flag is set to 1, 11.5 etu after transmission start. ? as with the normal smart card interface, the ers flag indicates the error signal status, but since error signal transfer is not performed, this flag is always cleared to 0. 14.7.4 receive data sampling timing and reception margin in smart card interface mode an internal clock generated by the on-chip baud rate generator can only be used as a transmission/reception clock. in this mode, the sci operates on a base clock with a frequency of 32, 64, 372, or 256 times the transfer rate (fixed to 16 times in normal asynchronous mode) as determined by bits bcp1 and bcp0. in reception, the sci samples the falling edge of the start bit using the base clock, and performs internal synchronization. as shown in figure 14.28, by sampling receive data at the rising-edge of the 16th, 32nd, 186th, or 128th pulse of the base clock, data can be latched at the middle of the bit. the reception margin is given by the following formula. m = | (0.5 ? ? ? ? + ?
rev. 2.00, 05/03, page 515 of 846 internal basic clock 372 clocks 186 clocks receive data (rxd) synchronization sampling timing d0 d1 data sampling timing 185 371 0 371 185 0 0 start bit figure 14.28 receive data sampling timing in smart card mode (using clock of 372 times the transfer rate) 14.7.5 initialization before transmitting and receiving data, initialize the sci as described below. initialization is also necessary when switching from transmit mode to receive mode, or vice versa. 1. clear the te and re bits in scr to 0. 2. clear the error flags ers, per, and orer in ssr to 0. 3. set the gm, blk, o/ e , bcp0, bcp1, cks0, cks1 bits in smr. set the pe bit to 1. 4. set the smif, sdir, and sinv bits in scmr. when the smif bit is set to 1, the txd and rxd pins are both switched from ports to sci pins, and are placed in the high-impedance state. 5. set the value corresponding to the bit rate in brr. 6. set the cke0 and cke1 bits in scr. clear the tie, rie, te, re, mpie, and teie bits to 0. if the cke0 bit is set to 1, the clock is output from the sck pin. 7. wait at least one bit interval, then set the tie, rie, te, and re bits in scr. do not set the te bit and re bit at the same time, except for self-diagnosis. to switch from receive mode to transmit mode, after checking that the sci has finished reception, initialize the sci, and set re to 0 and te to 1. whether sci has finished reception or not can be checked with the rdrf, per, or orer flags. to switch from transmit mode to receive mode, after checking that the sci has finished transmission, initialize the sci, and set te to 0 and re to 1. whether sci has finished transmission or not can be checked with the tend flag.
rev. 2.00, 05/03, page 516 of 846 14.7.6 serial data transmission (except for block transfer mode) as data transmission in smart card interface mode involves error signal sampling and retransmission processing, the operations are different from those in normal serial communication interface mode (except for block transfer mode). figure 14.29 illustrates the retransfer operation when the sci is in transmit mode. 1. if an error signal is sent back from the receiving end after transmission of one frame is complete, the ers bit in ssr is set to 1. if the rie bit in scr is enabled at this time, an eri interrupt request is generated. the ers bit in ssr should be cleared to 0 by the time the next parity bit is sampled. 2. the tend bit in ssr is not set for a frame in which an error signal indicating an abnormality is received. data is retransferred from tdr to tsr, and retransmitted automatically. 3. if an error signal is not sent back from the receiving end, the ers bit in ssr is not set. transmission of one frame, including a retransfer, is judged to have been completed, and the tend bit in ssr is set to 1. if the tie bit in scr is enabled at this time, a txi interrupt request is generated. writing transmit data to tdr transfers the next transmit data. figure 14.31 shows a flowchart for transmission. a sequence of transmit operations can be performed automatically by specifying the dtc to be activated with a txi interrupt source. in a transmit operation, the tdre flag is set to 1 at the same time as the tend flag in ssr is set, and a txi interrupt will be generated if the tie bit in scr has been set to 1. if the txi request is designated beforehand as a dtc activation source, the dtc will be activated by the txi request, and transfer of the transmit data will be carried out. the tdre and tend flags are automatically cleared to 0 when data is transferred by the dtc. in the event of an error, the sci retransmits the same data automatically. during this period, the tend flag remains cleared to 0 and the dtc is not activated. therefore, the sci and dtc will automatically transmit the specified number of bytes in the event of an error, including retransmission. however, the ers flag is not cleared automatically when an error occurs, and so the rie bit should be set to 1 beforehand so that an eri request will be generated in the event of an error, and the ers flag will be cleared. when performing transfer using the dtc, it is essential to set and enable the dtc before carrying out sci setting. for details of the dtc setting procedures, refer to section 9, data transfer controller (dtc).
rev. 2.00, 05/03, page 517 of 846 d0 d1 d2 d3 d4 d5 d6 d7 dp de ds d0 d1 d2 d3 d4 d5 d6 d7 dp (de) ds d0 d1 d2 d3 d4 ds transfer frame n+1 retransferred frame nth transfer frame tdre tend fer/ers transfer to tsr from tdr transfer to tsr from tdr transfer to tsr from tdr figure 14.29 retransfer operation in sci transmit mode the timing for setting the tend flag depends on the value of the gm bit in smr. the tend flag set timing is shown in figure 14.30. ds d0 d1 d2 d3 d4 d5 d6 d7 dp i/o data 12.5etu txi (tend interrupt) 11.0etu de guard time when gm = 0 when gm = 1 : start bit : data bits : parity bit : error signal legend ds d0 to d7 dp de figure 14.30 tend flag generation timing in transmission operation
rev. 2.00, 05/03, page 518 of 846 initialization no yes clear te bit to 0 start transmission start no no no yes yes yes yes no end write data to tdr, and clear tdre flag in ssr to 0 error processing error processing tend = 1? all data transmitted ? tend = 1? ers = 0? ers = 0? figure 14.31 example of transmission processing flow
rev. 2.00, 05/03, page 519 of 846 14.7.7 serial data reception (except for block transfer mode) data reception in smart card interface mode uses the same operation procedure as for normal serial communication interface mode. figure 14.32 illustrates the retransfer operation when the sci is in receive mode. 1. if an error is found when the received parity bit is checked, the per bit in ssr is automatically set to 1. if the rie bit in scr is set at this time, an eri interrupt request is generated. the per bit in ssr should be kept cleared to 0 until the next parity bit is sampled. 2. the rdrf bit in ssr is not set for a frame in which an error has occurred. 3. if no error is found when the received parity bit is checked, the per bit in ssr is not set to 1, the receive operation is judged to have been completed normally, and the rdrf flag in ssr is automatically set to 1. if the rie bit in scr is enabled at this time, an rxi interrupt request is generated. figure 14.33 shows a flowchart for reception. a sequence of receive operations can be performed automatically by specifying the dtc to be activated using an rxi interrupt source. in a receive operation, an rxi interrupt request is generated when the rdrf flag in ssr is set to 1. if the rxi request is designated beforehand as a dtc activation source, the dtc will be activated by the rxi request, and the receive data will be transferred. the rdrf flag is cleared to 0 automatically when data is transferred by the dtc. if an error occurs in receive mode and the orer or per flag is set to 1, a transfer error interrupt (eri) request will be generated. hence, so the error flag must be cleared to 0. in the event of an error, the dtc is not activated and receive data is skipped. therefore, receive data is transferred for only the specified number of bytes in the event of an error. even when a parity error occurs in receive mode and the per flag is set to 1, the data that has been received is transferred to rdr and can be read from there. note: for details on receive operations in block transfer mode, refer to section 14.4, operation in asynchronous mode. d0 d1 d2 d3 d4 d5 d6 d7 dp de ds d0 d1 d2 d3 d4 d5 d6 d7 dp (de) ds d0 d1 d2 d3 d4 ds transfer frame n+1 retransferred frame nth transfer frame rdrf per figure 14.32 retransfer operation in sci receive mode
rev. 2.00, 05/03, page 520 of 846 initialization read rdr and clear rdrf flag in ssr to 0 clear re bit to 0 start reception start error processing no no no yes yes orer = 0 and per = 0 rdrf = 1? all data received? yes figure 14.33 example of reception processing flow 14.7.8 clock output control when the gm bit in smr is set to 1, the clock output level can be fixed with bits cke0 and cke1 in scr. at this time, the minimum clock pulse width can be made the specified width. figure 14.34 shows the timing for fixing the clock output level. in this example, gm is set to 1, cke1 is cleared to 0, and the cke0 bit is controlled. specified pulse width sck cke0 specified pulse width figure 14.34 timing for fixing clock output level
rev. 2.00, 05/03, page 521 of 846 when turning on the power or switching between smart card interface mode and software standby mode, the following procedures should be followed in order to maintain the clock duty. powering on: to secure clock duty from power-on, the following switching procedure should be followed. 1. the initial state is port input and high impedance. use a pull-up resistor or pull-down resistor to fix the potential. 2. fix the sck pin to the specified output level with the cke1 bit in scr. 3. set smr and scmr, and switch to smart card mode operation. 4. set the cke0 bit in scr to 1 to start clock output. when changing from smart card interface mode to software standby mode: 1. set the data register (dr) and data direction register (ddr) corresponding to the sck pin to the value for the fixed output state in software standby mode. 2. write 0 to the te bit and re bit in the serial control register (scr) to halt transmit/receive operation. at the same time, set the cke1 bit to the value for the fixed output state in software standby mode. 3. write 0 to the cke0 bit in scr to halt the clock. 4. wait for one serial clock period. during this interval, clock output is fixed at the specified level, with the duty preserved. 5. make the transition to the software standby state. when returning to smart card interface mode from software standby mode: 1. exit the software standby state. 2. write 1 to the cke0 bit in scr and output the clock. signal generation is started with the normal duty. software standby normal operation normal operation figure 14.35 clock halt and restart procedure
rev. 2.00, 05/03, page 522 of 846 14.8 sci select function (h8s/2239 group only) sci_0 provides the sci select function that enables one-to-one clocked synchronous communication between a master lsi and multiple slave lsis (these lsis). figure 14.36 shows an example of communication using the sci select function and figure 14.37 shows the summary of its operation. the master lsi enables to communicate with the slave lsi_a by setting the sel_a signal to low and the sel_b signal to high. in this case, the txd0_b pin of the slave lsi_b becomes hi-z and that fixes the on-chip sck0_b signal high, causing the communication terminated. to communicate with the slave lsi_b, set the sel_a signal to high and the sel_b signal to low. * the slave lsi detects its being selected by the low input interrupt of irq7 and handles data transferring smoothly. note:* change the select signal of the master lsi ( sel_a or sel_b ) while the serial clock (m_sck) is high after the last bit of the transmit data has been output. in addition, set only one select signal to low at a time. interrupt controller tsr0_a rsr0_a transfer control slave lsi_a (this lsi) master lsi sck0_a c/a=cke1=sse=1 slave lsi_b (this lsi) sel_a irq7 irq7 sel_b m_txd rxd0 txd0 rxd0 txd0 sck0 sck0 m_rxd m_sck figure 14.36 example of communication using sci select function
rev. 2.00, 05/03, page 523 of 846 m_sck [master lsi] [salve lsi_a] m_txd m_rxd sel_a ( sel_a ) ( sel_b ) sel_b irq7 [salve lsi_b] irq7 d0 d0 d1 d1 d7 d7 d0 d1 d7 d0 d0 d1 d1 d7 d7 d0 d1 d7 sck0_a rsr0_a txd0_a sck0_b rsr0_b txd0_b hi-z hi-z hi-z fixed high fixed high hi-z d0 d6 d7 d0 d6 d7 master lsi salve lsi_a communication master lsi salve lsi_b communication figure 14.37 summary of sci select function operation
rev. 2.00, 05/03, page 524 of 846 14.9 interrupt sources 14.9.1 interrupts in normal serial communication interface mode table 14.12 shows the interrupt sources in normal serial communication interface mode. a different interrupt vector is assigned to each interrupt source, and individual interrupt sources can be enabled or disabled using the enable bits in scr. when the tdre flag in ssr is set to 1, a txi interrupt request is generated. when the tend flag in ssr is set to 1, a tei interrupt request is generated. a txi interrupt can activate the dtc to perform data transfer. the tdre flag is cleared to 0 automatically when data is transferred by the dmac * or the dtc. when the rdrf flag in ssr is set to 1, an rxi interrupt request is generated. when the orer, per, or fer flag in ssr is set to 1, an eri interrupt request is generated. an rxi interrupt request can activate the dmac * or the dtc to transfer data. the rdrf flag is cleared to 0 automatically when data is transferred by the dmac * or the dtc. a tei interrupt is requested when the tend flag is set to 1 and the teie bit is set to 1. if a tei interrupt and a txi interrupt are requested simultaneously, the txi interrupt has priority for acceptance. however, if the tdre and tend flags are cleared simultaneously by the txi interrupt routine, the sci cannot branch to the tei interrupt routine later. note: * supported only by the h8s/2239 group.
rev. 2.00, 05/03, page 525 of 846 table 14.12 interrupt sources of serial communication interface mode channel name interrupt source interrupt flag dtc activation dmac activation * 2 priority * 1 eri0 receive error orer, fer, per not possible not possible high rxi0 receive data full rdrf possible possible txi0 transmit data empty tdre possible possible 0 tei0 transmission end tend not possible not possible eri1 receive error orer, fer, per not possible not possible rxi1 receive data full rdrf possible possible txi1 transmit data empty tdre possible possible 1 tei1 transmission end tend not possible not possible eri2 receive error orer, fer, per not possible not possible rxi2 receive data full rdrf possible not possible txi2 transmit data empty tdre possible not possible 2 * 3 tei2 transmission end tend not possible not possible eri3 receive error orer, fer, per not possible not possible rxi3 receive data full rdrf possible not possible txi3 transmit data empty tdre possible not possible 3 tei3 transmission end tend not possible not possible low notes: * 1 indicates the initial state immediately after a reset. priorities in channels can be changed by the interrupt controller. * 2 supported only by the h8s/2239 group. * 3 not available in the h8s/2227 group.
rev. 2.00, 05/03, page 526 of 846 14.9.2 interrupts in smart card interface mode table 14.13 shows the interrupt sources in smart card interface mode. the transmit end interrupt (tei) request cannot be used in this mode. note: in case of block transfer mode, see section 14.9.1, interrupts in normal serial communication interface mode. table 14.13 interrupt sources in smart card interface mode channel name interrupt source interrupt flag dtc activation dmac activation * 2 priority * 1 eri0 receive error, detection orer, per, ers not possible not possible high rxi0 receive data full rdrf possible possible 0 txi0 transmit data empty tend possible possible eri1 receive error, detection orer, per, ers not possible not possible rxi1 receive data full rdrf possible possible 1 txi1 transmit data empty tend possible possible eri2 receive error, detection orer, per, ers not possible not possible rxi2 receive data full rdrf possible not possible 2 * 3 txi2 transmit data empty tend possible not possible eri3 receive error, detection orer, per, ers not possible not possible rxi3 receive data full rdrf possible not possible 3 txi3 transmit data empty tend possible not possible low notes: * 1 indicates the initial state immediately after a reset. priorities in channels can be changed by the interrupt controller. * 2 supported only by the h8s/2239 group. * 3 not available in the h8s/2227 group.
rev. 2.00, 05/03, page 527 of 846 14.10 usage notes 14.10.1 module stop mode setting sci operation can be disabled or enabled using the module stop control register. the initial setting is for sci operation to be halted. register access is enabled by clearing module stop mode. for details, refer to section 23, power-down modes. 14.10.2 break detection and processing (asynchronous mode only) when framing error (fer) detection is performed, a break can be detected by reading the rxd pin value directly. in a break, the input from the rxd pin becomes all 0s, setting the fer flag, and possibly the per flag. note that as the sci continues the receive operation after receiving a break, even if the fer flag is cleared to 0, it will be set to 1 again. 14.10.3 mark state and break detection (asynchronous mode only) when te is 0, the txd pin is used as an i/o port whose direction (input or output) and level are determined by ddr. this can be used to set the txd pin to mark state (high level) or send a break during serial data transmission. to maintain the communication line at mark state until te is set to 1, set both ddr and dr to 1. as te is cleared to 0 at this point, the txd pin becomes an i/o port, and 1 is output from the txd pin. to send a break during serial transmission, first set pdr to 1 and dr to 0, and then clear te to 0. when te is cleared to 0, the transmitter is initialized regardless of the current transmission state, the txd pin becomes an i/o port, and 0 is output from the txd pin. 14.10.4 receive error flags and transmit operations (clocked synchronous mode only) transmission cannot be started when a receive error flag (orer, per, or fer) is set to 1, even if the tdre flag is cleared to 0. be sure to clear the receive error flags to 0 before starting transmission. note also that receive error flags cannot be cleared to 0 even if the re bit is cleared to 0.
rev. 2.00, 05/03, page 528 of 846 14.10.5 restrictions on use of dmac * or dtc ? when an external clock source is used as the serial clock, the transmit clock should not be input until at least 5 ? when rdr is read by the dmac * or the dtc, be sure to set the activation source to the relevant sci reception data full interrupt (rxi). note: * supported only by theh8s/2239 group. t d0 lsb serial data sck d1 d3 d4 d5 d2 d6 d7 note: when operating on an external clock, set t >4 clocks. tdre figure 14.38 example of clocked synchronous transmission by dmac or dtc 14.10.6 operation in case of mode transition ? transmission operation should be stopped (by clearing te, tie, and teie to 0) before making a module stop mode, software standby mode, watch mode, subactive mode, or subsleep mode transition. tsr, tdr, and ssr are reset. the output pin states in module stop mode, software standby mode, watch mode, subactive mode, or subsleep mode depend on the port settings, and becomes high-level output after the relevant mode is cleared. if a transition is made during transmission, the data being transmitted will be undefined. when transmitting without changing the transmit mode after the relevant mode is cleared, transmission can be started by setting te to 1 again, and performing the following sequence: ssr read
rev. 2.00, 05/03, page 529 of 846 read tend flag in ssr te = 0 transition to software standby mode, etc. exit from software standby mode, etc. change operating mode? no all data transmitted? tend = 1 yes yes yes no no [1] [3] [2] te = 1 initialization [1] data being transmitted is interrupted. after exiting software standby mode, etc., normal cpu transmission is possible by setting te to 1, reading ssr, writing tdr, and clearing tdre to 0, but note that if the dtc has been activated, the remaining data in dtcram will be transmitted when te and tie are set to 1. [2] if tie and teie are set to 1, clear them to 0 in the same way. [3] includes module stop mode, watch mode, subactive mode, and subsleep mode. figure 14.39 sample flowchart for mode transition during transmission sck output pin te bit txd output pin port input/output high output port input/output high output start stop start of transmission end of transmission port input/output sci txd output port sci txd output port transition to software standby exit from software standby figure 14.40 asynchronous transmission using internal clock
rev. 2.00, 05/03, page 530 of 846 port input/output last txd bit held high outpu t* port input/output marking output port input/output sci txd output port port note: * initialized by software standby. sck output pin te bit txd output pin sci txd output start of transmission end of transmission transition to software standby exit from software standby figure 14.41 synchronous transmission using internal clock
rev. 2.00, 05/03, page 531 of 846 ? reception receive operation should be stopped (by clearing re to 0) before making a module stop mode, software standby mode, watch mode, subactive mode, or subsleep mode transition. rsr, rdr, and ssr are reset. if a transition is made without stopping operation, the data being received will be invalid. to continue receiving without changing the reception mode after the relevant mode is cleared, set re to 1 before starting reception. to receive with a different receive mode, the procedure must be started again from initialization. figure 14.42 shows a sample flowchart for mode transition during reception. re = 0 transition to software standby mode, etc. read receive data in rdr read rdrf flag in ssr exit from software standby mode, etc. change operating mode? no rdrf = 1 yes yes no [1] [2] re = 1 initialization [1] receive data being received becomes invalid. [2] includes module stop mode, watch mode, subactive mode, and subsleep mode. figure 14.42 sample flowchart for mode transition during reception
rev. 2.00, 05/03, page 532 of 846 14.10.7 switching from sck pin function to port pin function ? problem in operation: when switching the sck pin function to the output port function (high- level output) by making the following settings while ddr = 1, dr = 1, c/ a = 1, cke1 = 0, cke0 = 0, and te = 1 (synchronous mode), low-level output occurs for one half-cycle. 1. end of serial data transmission 2. te bit = 0 3. c/ a bit = 0: switchover to port output 4. occurrence of low-level output sck/port data te c/ a cke1 cke0 bit 7 bit 6 1. end of transmission 4. low-level output 3. c/ a = 0 2. te = 0 half-cycle low-level output figure 14.43 operation when switching from sck pin function to port pin function ? sample procedure for avoiding low-level output: as this sample procedure temporarily places the sck pin in the input state, the sck/port pin should be pulled up beforehand with an external circuit. with ddr = 1, dr = 1, c/ a = 1, cke1 = 0, cke0 = 0, and te = 1, make the following settings in the order shown. 1. end of serial data transmission 2. te bit = 0 3. cke1 bit = 1 4. c/ a bit = 0: switchover to port output 5. cke1 bit = 0
rev. 2.00, 05/03, page 533 of 846 sck/port data te c/ a cke1 cke0 bit 7 bit 6 1. end of transmission 3. cke1 = 1 5. cke1 = 0 4. c/ a = 0 2. te = 0 high-level output figure 14.44 operation when switching from sck pin function to port pin function (example of preventing low-level output) 14.10.8 assignment and selection of registers some serial communication interface registers are assigned to the same address as other registers. register selection is performed by means of the iice bit in the serial control register (scrx). for details on register addresses, see section 25, list of registers.
rev. 2.00, 05/03, page 534 of 846
ifiic05c_000020020700 rev. 2.00, 05/03, page 535 of 846 section 15 i 2 c bus interface (iic) (option) an i 2 c bus interface is available as an option. observe the following notes when using this option. 1. for mask-rom versions, a w is added to the part number in products in which this optional function is used. examples: hd6432239wte 2. the product number is identical for f-ztat versions. however, be sure to inform your renesas technology sales representative if you will be using this option. the h8s/2239 group and the h8s/2238 group have an internal i 2 c bus interface of two channels. the i 2 c bus interface conforms to and provides a subset of the philips i 2 c bus (inter-ic bus) interface functions. the register configuration that controls the i 2 c bus differs partly from the philips configuration, however. the i 2 c bus interface data transfer is performed using a data line (sda) and a clock line (scl) for each channel, which allows efficient use of connectors and the area of the pcb. notes: 1. an i 2 c bus interface is not available in the h8s/2237 group and h8s/2227 group. 2. when the power supply voltage ranges from 2.2 v to 2.7 v, the i 2 c bus interface is not available. 15.1 features ? selection of i 2 c format or clocked synchronous serial format ? i 2 c bus format: addressing format with acknowledge bit, for master/slave operation ? clocked synchronous serial format: non-addressing format without acknowledge bit, for master operation only i 2 c bus format ? two ways of setting slave address ? start and stop conditions generated automatically in master mode ? selection of acknowledge output levels when receiving ? automatic loading of acknowledge bit when transmitting ? wait function in master mode a wait can be inserted by driving the scl pin low after data transfer, excluding acknowledgement. the wait can be cleared by clearing the interrupt flag.
rev. 2.00, 05/03, page 536 of 846 ? wait function in slave mode a wait request can be generated by driving the scl pin low after data transfer, excluding acknowledgement. the wait request is cleared when the next transfer becomes possible. ? three interrupt sources ? data transfer end (including transmission mode transition with i 2 c bus format and address reception after loss of master arbitration) ? address match: when any slave address matches or the general call address is received in slave receive mode ? stop condition detection ? selection of 16 internal clocks (in master mode) ? direct bus drive ? two pins, p35/scl0 and p34/sda0, function as nmos open-drain outputs when the bus drive function is selected. ? two pins C p33/scl1 and p32/sda1 C function as nmos-only outputs when the bus drive function is selected. figure 15.1 shows a block diagram of the i 2 c bus interface. figure 15.2 shows an example of i/o pin connections to external circuits. channel i/o pins are nmos open drains, and it is possible to apply voltages in excess of the power supply (vcc) voltage for this lsi. set the upper limit of voltage applied to the power supply (vcc) power supply range +0.3 v. channel 1 i/o pins are driven solely by nmos, so in terms of appearance they carry out the same operations as an nmos open drain. however, the voltage which can be applied to the i/o pins depends on the voltage of the power supply (vcc) of this lsi.
rev. 2.00, 05/03, page 537 of 846 ps noise canceler noise canceler clock control bus state decision circuit arbitration decision circuit output data control circuit address comparator sar, sarx interrupt generator icdrs icdrr icdrt icsr icmr iccr internal data bus interrupt request scl sda legend: iccr: icmr: icsr: icdr: sar: sarx: ps: i 2 c bus control register i 2 c bus mode register i 2 c bus status register i 2 c bus data register slave address register slave address register x prescaler figure 15.1 block diagram of i 2 c bus interface
rev. 2.00, 05/03, page 538 of 846 scl in scl out sda in sda out (slave 1) scl sda scl in scl out sda in sda out (slave 2) scl sda scl in scl out sda in sda out (master) this lsi scl sda v dd v cc scl sda figure 15.2 i 2 c bus interface connections (example: this lsi as master) 15.2 input/output pins table 15.1 shows the pin configuration for the i 2 c bus interface. table 15.1 pin configuration name abbreviation * i/o function serial clock scl0 i/o iic_0 serial clock input/output serial data sda0 i/o iic_0 serial data input/output serial clock scl1 i/o iic_1 serial clock input/output serial data sda1 i/o iic_1 serial data input/output note: * pin names scl and sda are used in the text for all channels, omitting the channel designation.
rev. 2.00, 05/03, page 539 of 846 15.3 register descriptions the i 2 c bus interface has the following registers. registers icdr and sarx and registers icmr and sar are allocated to the same addresses. accessible addresses differ depending on the ice bit in iccr. sar and sarx are accessed when ice is 0, and icmr and icdr are accessed when ice is 1. for details on the module stop control register, refer to section 23.1.2, module stop control registers a to c (mstpcra to mstpcrc). ? i 2 c bus data register (icdr) ? slave address register (sar) ? second slave address register (sarx) ? i 2 c bus mode register (icmr) ? i 2 c bus control register (iccr) ? i 2 c bus status register (icsr) ? ddc switch register (ddcswr) ? serial control register (scrx) 15.3.1 i 2 c bus data register (icdr) icdr is an 8-bit readable/writable register that is used as a transmit data register when transmitting and a receive data register when receiving. icdr is divided internally into a shift register (icdrs), receive buffer (icdrr), and transmit buffer (icdrt). data transfers among the three registers are performed automatically in coordination with changes in the bus state, and affect the status of internal flags such as tdre and rdrf. when tdre is 1 and the transmit buffer is empty, tdre shows that the next transmit data can be written from the cpu. when rdrf is 1, it shows that the valid receive data is stored in the receive buffer. if i 2 c is in transmit mode and the next data is in icdrt (the tdre flag is 0) following transmission/reception of one frame of data using icdrs, data is transferred automatically from icdrt to icdrs. if i 2 c is in receive mode and no previous data remains in icdrr (the rdrf flag is 0) following transmission/reception of one frame of data using icdrs, data is transferred automatically from icdrs to icdrr. if the number of bits in a frame, excluding the acknowledge bit, is less than 8, transmit data and receive data are stored differently. transmit data should be written justified toward the msb side when mls = 0, and toward the lsb side when mls = 1. receive data bits read from the lsb side should be treated as valid when mls = 0, and bits read from the msb side when mls = 1. icdr can be written and read only when the ice bit is set to 1 in iccr. the value of icdr is undefined after a reset. the tdre and rdrf flags are set and cleared under the conditions shown below. setting the tdre and rdrf flags affects the status of the interrupt flags.
rev. 2.00, 05/03, page 540 of 846 bit bit name initial value r/w description ? tdre ?? transmit data register empty [setting conditions] ? in transmit mode, when a start condition is detected in the bus line state after a start condition is issued in master mode with the i 2 c bus format or serial format selected ? when data is transferred from icdrt to icdrs ? when a switch is made from receive mode to transmit mode after detection of a start condition [clearing conditions] ? when transmit data is written in icdr in transmit mode ? when a stop condition is detected in the bus line state after a stop condition is issued with the i 2 c bus format or serial format selected ? when a stop condition is detected with the i 2 c bus format selected ? in receive mode ? rdrf ?? receive data register full [setting condition] when data is transferred from icdrs to icdrr [clearing condition] when icdr (icdrr) receive data is read in receive mode
rev. 2.00, 05/03, page 541 of 846 15.3.2 slave address register (sar) sar selects the slave address and selects the transfer format. sar can be written and read only when the ice bit is cleared to 0 in iccr. bit bit name initial value r/w description 7 6 5 4 3 2 1 sva6 sva5 sva4 sva3 sva2 sva1 sva0 0 0 0 0 0 0 0 r/w r/w r/w r/w r/w r/w r/w slave address 6 to 0 sets a slave address 0 fs 0 r/w selects the transfer format together with the fsx bit in sarx. refer to table 15.2. 15.3.3 second slave address register (sarx) sarx stores the second slave address and selects the transfer format. sarx can be written and read only when the ice bit is cleared to 0 in iccr. bit bit name initial value r/w description 7 6 5 4 3 2 1 svax6 svax5 svax4 svax3 svax2 svax1 svax0 0 0 0 0 0 0 0 r/w r/w r/w r/w r/w r/w r/w slave address 6 to 0 sets the second slave address 0 fsx 1 r/w selects the transfer format together with the fs bit in sar. refer to table 15.2.
rev. 2.00, 05/03, page 542 of 846 table 15.2 transfer format sar sarx fs fsx i 2 c transfer format 0 0 sar and sarx are used as the slave addresses with the i 2 c bus format. 0 1 only sar is used as the slave address with the i 2 c bus format. 1 0 only sarx is used as the slave address with the i 2 c bus format. 1 1 clock synchronous serial format (sar and sarx are invalid) 15.3.4 i 2 c bus mode register (icmr) icmr sets the transfer format and transfer rate. it can only be accessed when the ice bit in iccr is 1. bit bit name initial value r/w description 7 mls 0 r/w msb-first/lsb-first select 0: msb-first 1: lsb-first set this bit to 0 when the i 2 c bus format is used. 6 wait 0 r/w wait insertion bit this bit is valid only in master mode with the i 2 c bus format. when wait is set to 1, after the fall of the clock for the final data bit, the iric flag is set to 1 in iccr, and a wait state begins (with scl at the low level). when the iric flag is cleared to 0 in iccr, the wait ends and the acknowledge bit is transferred. if wait is cleared to 0, data and acknowledge bits are transferred consecutively with no wait inserted. the iric flag in iccr is set to 1 on completion of the acknowledge bit transfer, regardless of the wait setting. 5 4 3 cks2 cks1 cks0 0 0 0 r/w r/w r/w serial clock select 2 to 0 this bit is valid only in master mode. these bits select the required transfer rate, together with the iicx 1 and iicx0 bit in scrx. refer to table 15.3.
rev. 2.00, 05/03, page 543 of 846 bit bit name initial value r/w description 2 1 0 bc2 bc1 bc0 0 0 0 r/w r/w r/w bit counter 2 to 0 these bits specify the number of bits to be transferred next. with the i 2 c bus format, the data is transferred with one addition acknowledge bit. bit bc2 to bc0 settings should be made during an interval between transfer frames. if bits bc2 to bc0 are set to a value other than 000, the setting should be made while the scl line is low. the value returns to 000 at the end of a data transfer, including the acknowledge bit. i 2 c bus format clocked synchronous mode 000: 9 bits 000: 8 bits 001: 2 bits 001: 1 bits 010: 3 bits 010: 2 bits 011: 4 bits 011: 3 bits 100: 5 bits 100: 4 bits 101: 6 bits 101: 5 bits 110: 7 bits 110: 6 bits 111: 8 bits 111: 7 bits
rev. 2.00, 05/03, page 544 of 846 table 15.3 i 2 c transfer rate scrx icmr bit 5 or 6 bit 5 bit 4 bit 3 transfer rate iicx cks2 cks1 cks0 clock = = = = 5 mhz = = = = 8 mhz = = = = 10 mhz = = = = 16 mhz * 2 = = = = 20 mhz * 2 0000 /28 179 mhz 286 khz 357 khz 571 khz * 1 714 khz 0001 /40 125 khz 200 khz 250 khz 400 khz 500 khz 0010 /48 104 khz 167 khz 208 khz 333 khz 417 khz 0011 /64 78.1 khz 125 khz 156 khz 250 khz 313 khz 0100 /80 62.5 khz 100 khz 125 khz 200 khz 250 khz 0101 /100 50.0 khz 80.0 khz 100 khz 160 khz 200 khz 0110 /112 44.6 khz 71.4 khz 89.3 khz 143 khz 179 khz 0111 /128 39.1 khz 62.5 khz 78.1 khz 125 khz 156 khz 1000 /56 89.3 khz 143 khz 179 khz 286 khz 357 khz 1001 /80 62.5 khz 100 khz 125 khz 200 khz 250 khz 1010 /96 52.1 khz 83.3 khz 104 khz 167 khz 208 khz 1011 /128 39.1 khz 62.5 khz 78.1 khz 125 khz 156 khz 1100 /160 31.3 khz 50.0 khz 62.5 khz 100 khz 125 khz 1101 /200 25.0 khz 40.0 khz 50.0 khz 80.0 khz 100 khz 1110 /224 22.3 khz 35.7 khz 44.6 khz 71.4 khz 89.3 khz 1111 /256 19.5 khz 31.3 khz 39.1 khz 62.5 khz 78.1 khz notes: * 1 out of the range of the i 2 c bus interface specification (normal mode: 100 khz in max. and high-speed mode: 400 khz in max) * 2 supported only by the h8s/2239 group.
rev. 2.00, 05/03, page 545 of 846 15.3.5 serial control registerx (scrx) scrx controls the iic operating modes. bit bit name initial value r/w description 7 ? 0r/wreserved the initial value should not be changed. 6 5 iicx1 iicx0 0 0 r/w r/w i 2 c transfer rate select 1 and 0 selects the transfer rate in master mode, together with bits cks2 to cks0 in icmr. refer to table 15.3. iicx1 controls iic_1 and iicx0 controls iic_0. 4 iice 0 r/w i 2 c master enable controls cpu access to the iic data register and control registers (iccr, icsr, icdr/sarx, and icmr/sar). 0: cpu access to the iic data register and control registers is disabled. 1: cpu access to the iic data register and control registers is enabled. 3 flshe 0 r/w for details on this bit, refer to section 19.5.7, serial control register x (scrx). 2 to 0 ? all 0 r/w reserved the initial value should not be changed.
rev. 2.00, 05/03, page 546 of 846 15.3.6 i 2 c bus control register (iccr) i 2 c bus control register (iccr) consists of the control bits and interrupt request flags of i 2 c bus interface. bit bit name initial value r/w description 7ice 0 r/wi 2 c bus interface enable when this bit is set to 1, the i 2 c bus interface module is enabled to send/receive data and drive the bus since it is connected to the scl and sda pins. icmr and icdr can be accessed. when this bit is cleared, the module is halted and separated from the scl and sda pins. sar and sarx can be accessed. 6ieic 0 r/wi 2 c bus interface interrupt enable when this bit is 1, interrupts are enabled by iric. 5 4 mst trs 0 0 r/w master/slave select transmit/receive select 00: slave receive mode 01: slave transmit mode 10: master receive mode 11: master transmit mode both these bits will be cleared by hardware when they lose in a bus contention in master mode of the i 2 c bus format. in slave receive mode, the r/ w bit in the first frame immediately after the start automatically sets these bits in receive mode or transmit mode by using hardware. the settings can be made again for the bits that were set/cleared by hardware, by reading these bits. when the trs bit is intended to change during a transfer, the bit will not be switched until the frame transfer is completed, including acknowledgement.
rev. 2.00, 05/03, page 547 of 846 bit bit name initial value r/w description 3 acke 0 r/w acknowledge bit judgement selection 0: the value of the acknowledge bit is ignored, and continuous transfer is performed. the value of the received acknowledge bit is not indicated by the ackb bit, which is always 0. 1: if the acknowledge bit is 1, continuous transfer is interrupted. in this lsi, the dtc can be used to perform continuous transfer. the dtc is activated when the irtr interrupt flag is set to 1 (irtr us one of two interrupt flags, the other being iric). when the acke bit is 0, the tdre, iric, and irtr flags are set on completion of data transmission, regardless of the acknowledge bit. when the acke bit is 1, the tdre, iric, and irtr flags are set on completion of data transmission when the acknowledge bit is 0, and the iric flag alone is set on completion of data transmission when the acknowledge bit is 1. when the dtc is activated, the tdre, iric, and irtr flags are cleared to 0 after the specified number of data transfers have been executed. consequently, interrupts are not generated during continuos data transfer, but if data transmission is completed with a 1 acknowledge bit when the acke bit is set to 1, the dtc is not activated and an interrupt is generated, if enabled. depending on the receiving device, the acknowledge bit may be significant, in indicating completion of processing of the received data, for instance, or may be fixed at 1 and have no significance. 2 bbsy 0 r/w bus busy in slave mode, reading the bbsy flag enables to confirm whether the i 2 c bus is occupied or released. the bbsy flag is set to 0 when the sda level changes from high to low under the condition of scl = high, assuming that the start condition has been issued. the bbsy flag is cleared to 0 when the sda level changes from low to high under the condition of scl = high, assuming that the start condition has been issued. writing to the bbsy flag in slave mode is disabled. in master mode, the bbsy flag is used to issue start and stop conditions. write 1 to bbsy and 0 to scp to issue a start condition. follow this procedure when also re-transmitting a start condition. to issue a start/stop condition, use the mov instruction. the i 2 c bus interface must be set in master transmit mode before the issue of a start condition.
rev. 2.00, 05/03, page 548 of 846 bit bit name initial value r/w description 1 iric 0 r/w i 2 c bus interface interrupt request flag also see table 15.4. [setting conditions] in i 2 c bus format master mode ? when a start condition is detected in the bus line state after a start condition is issued (when the tdre flag is set to 1 because of first frame transmission) ? when a wait is inserted between the data and acknowledge bit when wait = 1 ? at the end of data transfer (when the tdre or rdrf flag is set to 1) ? when a slave address is received after bus arbitration is lost (when the al flag is set to1) ? when 1 is received as the acknowledge bit when the acke bit is 1(when the ackb bit is set to 1) in i 2 c bus format slave mode ? when the slave address (sva, svax) matches (when the aas and aasx flags are set to 1) and at the end of data transfer up to the subsequent retransmission start condition or stop condition detection (when the tdre or rdrf flag is set to 1) ? when the general call address is detected (when the adz flag is set to 1) and at the end of data transfer up to the subsequent retransmission start condition or stop condition detection(when the tdre or rdrf flag is set to 1) ? when 1 is received as the acknowledge bit when the acke bit is 1(when the ackb bit is set to 1) ? when a stop condition is detected(when the stop or estp flag is set to 1) with clocked synchronous serial format ? at the end of data transfer (when the tdre or rdrf flag is set to 1) ? when a start condition is detected with serial format selected when a condition occurs in which internal flag of tdre and rdfr is set to 1 except for the above [clearing conditions] ? when 0 is written in iric after reading iric = 1 ? when icdr is read/written by dtc (when tdre or rdrf flag is cleared to 0) (as it might not be a condition to clear, for details, see description of dtc operation below)
rev. 2.00, 05/03, page 549 of 846 bit bit name initial value r/w description 0 scp 1 r/w start condition/stop condition prohibit bit the scp bit controls the issue of start/stop conditions in master mode. to issue a start condition, write 1 in bbsy and 0 in scp. a retransmit start condition is issued in the same way. to issue a stop condition, write 0 in bbsy and 0 in scp. this bit is always read as 1. if 1 is written, the data is not stored. when, with the i 2 c bus format selected, iric is set to 1 and an interrupt is generated, other flags must be checked in order to identify the source that set iric to 1. although each source has a corresponding flag, caution is needed at the end of a transfer. when the tdre or rdrf internal flag is set, the readable irtr flag may or may not be set. even when data transfer is complete, the dtc activation request flag, irtr, is not set until a retransmission start condition or stop condition is detected after a slave address (sva) or general call address matched in the i 2 c bus format slave mode. even when the iric flag and irtr flag are set, the tdre or rdrf internal flag may not be set. for a continuous transfer using the dtc, the iric or irtr flag is not cleared at the completion of the specified number of times of transfers. on the other hand, the tdre and rdrf flags are cleared because the specified number of times of read/write operations have been complete. table 15.4 shows the relationship between the flags and the transfer states.
rev. 2.00, 05/03, page 550 of 846 table 15.4 flags and transfer states mst trs bbsy estp stop irtr aasx al aas adz ackb state 1/01/0000000000idle state (flag clearing r equired) 11000000000start c ondition issuance 11100100000start c ondition established 11/0100000000/1master m ode wait 11/0100100000/1master m ode transmit/receive end 0010001/011/01/00arbitration lost 00100000100sar match by first frame in slave mode 00100000110g eneral call address match 00100010000sarx match 01/0100000000/1slave m ode transmit/receive end(except after sarx match) 0 0 1/0 1 1 1 0 0 0 0 1 0 1 1 0 0 0 0 0 0 0 1 slave mode transmit/receive end(after sarx match) 0 1/0 0 1/0 1/0 0 0 0 0 0 0/1 stop condition detected 15.3.7 i 2 c bus status register (icsr) icsr consists of status flags. bit bit name initial value r/w description 7 estp 0 r/(w) * error stop condition detection flag this bit is valid in i 2 c bus format slave mode. [setting condition] when a stop condition is detected during frame transfer. [clearing conditions] ? when 0 is written in estp after reading the state of 1 ? when the iric flag is cleared to 0 6stop 0 r/(w) * normal stop condition detection flag this bit is valid in i 2 c bus format slave mode. [setting condition] when a stop condition is detected during frame transfer. [clearing conditions] ? when 0 is written in stop after reading stop = 1 ? when the iric flag is cleared to 0
rev. 2.00, 05/03, page 551 of 846 bit bit name initial value r/w description 5 irtr 0 r/(w) * i 2 c bus interface continuous transmission/reception interrupt request flag [setting conditions] in i 2 c bus interface slave mode ? when the tdre or rdrf flag is set to 1 when aasx = 1 in i 2 c bus interface other modes ? when the tdre or rdrf flag is set to 1 [clearing conditions] ? when 0 is written in irtr after reading irtr = 1 ? when the iric flag is cleared to 0 4 aasx 0 r/(w) * second slave address recognition flag [setting condition] when the second slave address is detected in slave receive mode and fsx = 0 [clearing conditions] ? when 0 is written in aasx after reading aasx = 1 ? when a start condition is detected ? in master mode 3al 0 r/(w) * arbitration lost flag indicates that bus arbitration was lost in master mode. [setting conditions] ? when the internal sda and sda pin do not match at the rise of scl. ? when the internal scl is high at the fall of scl. [clearing conditions] ? when 0 is written in al after reading al = 1 ? when icdr data is written (transmit mode) or read (receive mode)
rev. 2.00, 05/03, page 552 of 846 bit bit name initial value r/w description 2 aas 0 r/(w) * slave address recognition flag [setting condition] when the slave address or general call address is detected in slave receive mode and fs = 0. [clearing conditions] ? when icdr data is written (transmit mode) or read (receive mode) ? when 0 is written in aas after reading aas = 1 ? in master mode 1adz 0 r/(w) * general call address recognition flag this bit is valid in i 2 c bus format slave receive mode. [setting condition] when the general call address is detected in slave receive mode and fsx = 0 or fs = 0. [clearing conditions] ? when icdr data is written (transmit mode) or read (receive mode) ? when 0 is written in adz after reading adz = 1 ? in master mode 0 ackb 0 r/(w) * acknowledge bit stores acknowledge bit. 0: at reception, outputs 0 in the acknowledge output timing. at transmission, indicates that acknowledge was sent (0) from the receive device. 1: at reception, outputs 1 in the acknowledge output timing. at transmission, indicates that acknowledge was not sent (1) from the receive device. note: * only a 0 can be written to this bit, to clear the flag.
rev. 2.00, 05/03, page 553 of 846 15.3.8 ddc switch register (ddcswr) ddcswr controls the i 2 c bus interface format automatic switching function and internal latch clear. bit bit name initial value r/w description 7 to 4 ? all 0 r/(w) * reserved the write value should always be 0. 3 2 1 0 clr3 clr2 clr1 clr0 1 1 1 1 w w w w i 2 c bus interface clear 3 to 0: when bits clr3 to clr0 are set, a clear signal is generated for the i 2 c bus interface internal latch circuit, and the internal state is initialized. the write data for these bits is not retained. to perform i 2 c clearance, bits clr3 to clr0 must be written to simultaneously using an mov instruction. do not use a bit manipulation instruction such as bclr. 00xx: setting prohibited 0100: setting prohibited 0101: iic_0 internal latch cleared 0110: iic_1 internal iatch cleared 0111: iic_0, iic_1 internal iatch cleared 1xxx: invalid setting legend x: don't care note: * only 0 can be written to these bits, to clear the flag. 15.4 operation the i 2 c bus interface has serial and i 2 c bus formats. 15.4.1 i 2 c bus data format the i 2 c bus formats are addressing formats and an acknowledge bit is inserted. the first frame following a start condition always consists of 8 bits. the i 2 c bus format is shown in figure 15.3. the serial format is a non-addressing format with no acknowledge bit. this is shown in figure 15.4. figure 15.5 shows the i 2 c bus timing.
rev. 2.00, 05/03, page 554 of 846 s sla r/ w a data a a/ a p 1111 n 7 1 m (a) i 2 c bus format (fs = 0 or fsx = 0) (b) i 2 c bus format (start condition retransmission, fs = 0 or fsx = 0) n: transfer bit count (n = 1 to 8) m: transfer frame count (m 1) s sla r/ w a data 111 n1 7 1 m1 s sla r/ w a data a/ a p 111 n2 7 1 m2 11 1 a/ a n1 and n2: transfer bit count (n1 and n2 = 1 to 8) m1 and m2: transfer frame count (m1 and m2 1) 11 figure 15.3 i 2 c bus data formats (i 2 c bus formats) s data data p 11 n 8 1 m fs = 1 and fsx = 1 n: transfer bit count (n = 1 to 8) m: transfer frame count (m 1) figure 15.4 i 2 c bus data format (serial format) sda scl s 1-7 sla 8 r/ w 9 a 1-7 data 89 1-7 89 a data p a/ a figure 15.5 i 2 c bus timing legend s: start condition. the master device drives sda from high to low while scl is high sla: slave address r/ w : indicates the direction of data transfer: from the slave device to the master device when r/ w is 1, or from the master device to the slave device when r/ w is 0 a: acknowledge. the receiving device drives sda data: transferred data p: stop condition. the master device drives sda from low to high while scl is high
rev. 2.00, 05/03, page 555 of 846 15.4.2 master transmit operation in i 2 c bus format master transmit mode, the master device outputs the transmit clock and transmit data, and the slave device returns an acknowledge signal. the transmission procedure and operations synchronized with the icdr writing are described below. 1. set the ice bit in iccr to 1. set bits mls, wait, and cks2 to cks0 in icmr, and bit iicx in scrx, according to the operating mode. 2. read the bbsy flag in iccr to confirm that the bus is free. 3. set bits mst and trs to 1 in iccr to select master transmit mode. 4. write 1 to bbsy and 0 to scp. this changes sda from high to low when scl is high, and generates the start condition. 5. then iric and irtr flags are set to 1. if the ieic bit in iccr has been set to 1, an interrupt request is sent to the cpu. 6. write the data (slave address + r/ w ) to icdr. with the i 2 c bus format (when the fs bit in sar or the fsx bit in sarx is 0), the first frame data following the start condition indicates the 7-bit slave address and transmit/receive direction. as indicating the end of the transfer, and so the iric flag is cleared to 0. after writing icdr, clear iric continuously not to execute other interrupt handling routine. if one frame of data has been transmitted before the iric clearing, it can not be determine the end of transmission. the master device sequentially sends the transmission clock and the data written to icdr using the timing shown in figure 15.6. the selected slave device (i.e. the slave device with the matching slave address) drives sda low at the 9th transmit clock pulse and returns an acknowledge signal. 7. when one frame of data has been transmitted, the iric flag is set to 1 at the rise of the 9th transmit clock pulse. after one frame has been transmitted scl is automatically fixed low in synchronization with the internal clock until the next transmit data is written. 8. read the ackb bit in icsr to confirm that ackb is cleared to 0. when the slave device has not acknowledged (ackb bit is 1), operate the step [12] to end transmission, and retry the transmit operation. 9. write the transmit data to icdr. as indicating the end of the transfer, and so the iric flag is cleared to 0. perform the icdr write and the iric flag clearing sequentially, just as in point 6 in this flowchart. transmission of the next frame is performed in synchronization with the internal clock. 10. when one frame of data has been transmitted, the iric flag is set to 1 at the rise of the 9th transmit clock pulse. after one frame has been transmitted scl is automatically fixed low in synchronization with the internal clock until the next transmit data is written. 11. read the ackb bit in icsr. confirm that the slave device has been acknowledged (ackb bit is 0). when there is data to be transmitted, go to the step [9] to continue next transmission. when the slave device has not acknowledged (ackb bit is set to 1), operate the step [12] to end transmission.
rev. 2.00, 05/03, page 556 of 846 12. clear the iric flag to 0. and write 0 to bbsy and scp in iccr. this changes sda from low to high when scl is high, and generates the stop condition. sda (master output) sda (slave output) 2 1 2 1 4 36 58 79 bit 7 slave address bit 6 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 iric irtr icdr scl (master output) start condition generation data 1 address + r/w [4] write bbsy = 1 and scp = 0 (start condition issuance) [9] iric clearance [9] icdr write [6] iric clearance user processing slave address data 1 r/ w [7] [5] a [6] icdr write normal operation icdr writing prohibited note: * data write timing in icdr * figure 15.6 master transmit mode operation timing example (mls = wait = 0) 15.4.3 master receive operation in master receive mode, the master device outputs the receive clock, receives data, and returns an acknowledge signal. the slave device transmits data. the reception procedure and operations with the wait function synchronized with the icdr read operation to receive data in sequence are shown below. 1. clear the trs bit in iccr to 0 to switch from transmit mode to receive mode, and set the wait bit in icmr to 1. also clear the bit in icsr to ackb 0 (acknowledge data setting). 2. when icdr is read (dummy data read), reception is started, and the receive clock is output, and data received, in synchronization with the internal clock. in order to detect wait operation, set the iric flag in iccr must be cleared to 0. after reading icdr, clear iric continuously not to execute other interrupt handling routine. if one frame of data has been received before the iric clearing, it cannot be determine the end of reception.
rev. 2.00, 05/03, page 557 of 846 3. the iric flag is set to 1 at the fall of the 8th receive clock pulse. if the ieic bit in iccr has been set to 1, an interrupt request is sent to the cpu. scl is automatically fixed low in synchronization with the internal clock until the iric flag clearing. if the first frame is the last receive data, execute step [10] to halt reception. 4. clear the iric flag to release from the wait state. the master device outputs the 9th clock and drives sda at the 9th receive clock pulse to return an acknowledge signal. 5. when one frame of data has been received, the iric flag in iccr and the irtr flag in icsr are set to 1 at the rise of the 9th receive clock pulse. the master device outputs scl clock to receive next data. 6. read icdr. 7. clear the iric flag to detect next wait operation. data reception process from [5] to [7] should be executed during one byte reception period after iric flag clearing in [4] or [9] to release wait status. 8. the iric flags set to 1 at the fall of 8th receive clock pulse. scl is automatically fixed low in synchronization with the internal clock until the iric flag clearing. if this frame is the last receive data, execute step [10] to halt reception. 9. clear the iric flag in iccr to cancel wait operation. the master device drives sda low at the 9th receive clock pulse and returns an acknowledge signal. data can be received continuously by repeating step [5] to [9]. 10. set the ackb bit in icsr to 1 so as to return no acknowledge data. also set the trs bit in iccr to 1 to switch from receive mode to transmit mode. 11. clear iric flag to 0 to release from the wait state. 12. when one frame of data has been received, the iric flag is set to 1 at the rise of the 9th receive clock pulse. 13. clear the wait bit to 0 to switch from wait mode to no wait mode. read icdr and clear the iric flag to 0. clearing of the iric flag should be after the wait = 0. if the wait bit is cleared to 0 after clearing the iric flag and then an instruction to issue a stop condition is executed, the stop condition cannot be issued because the output level of the sda line is fixed as low. 14. clear the bbsy bit and scp bit to 0. this changes sda from low to high when scl is high, and generates the stop condition.
rev. 2.00, 05/03, page 558 of 846 sda (master output) sda (slave output) 2 1 2 1 4 36 58 79 bit 7 bit 6 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 iric irtr icdr scl (master output) data 1 [1] trs cleared to 0 wait set to 1 ackb cleared to 0 [7] iric clearance [6] icdr read (data 1) [4] iric clearance [2] iric clearance user processing bit 5 bit 4 bit 3 5 4 3 9 data 1 data 2 [3] [5] a [2] icdr read (dummy read) master tansmit mode master receive mode a execute continuously. execute continuously. figure 15.7 (1) master receive mode operation timing example (mls = ackb = 0, wait = 1) sda (master output) sda (slave output) 2 1 2 1 4 36 58 79 bit 7 bit 6 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 iric irtr icdr scl (master output) data 3 [9] iric clearance [7] iric clearance [9] iric clearance [6] icdr read (data 3) [7] iric clearance user processing 9 8 data 3 data 4 [8] [5] [8] [5] a a [6] icdr read (data 2) bit 0 data 2 data 2 data 1 execute continuously. execute continuously. figure 15.7 (2) master receive mode operation timing example (mls = ackb = 0, wait = 1)
rev. 2.00, 05/03, page 559 of 846 15.4.4 slave receive operation in slave receive mode, the master device outputs the transmit clock and transmit data, and the slave device returns an acknowledge signal. the reception procedure and operations in slave receive mode are described below. 1. set the ice bit in iccr to 1. set the mls bit in icmr and the mst and trs bits in iccr according to the operating mode. 2. when the start condition output by the master device is detected, the bbsy flag in iccr is set to 1. 3. when the slave address matches in the first frame following the start condition, the device operates as the slave device specified by the master device. if the 8th data bit (r/ w ) is 0, the trs bit in iccr remains cleared to 0, and slave receive operation is performed. 4. at the 9th clock pulse of the receive frame, the slave device drives sda low and returns an acknowledge signal. at the same time, the iric flag in iccr is set to 1. if the ieic bit in iccr has been set to 1, an interrupt request is sent to the cpu. if the rdrf internal flag has been cleared to 0, it is set to 1, and the receive operation continues. if the rdrf internal flag has been set to 1, the slave device drives scl low from the fall of the receive clock until data is read into icdr. 5. read icdr and clear the iric flag in iccr to 0. the rdrf flag is cleared to 0. receive operations can be performed continuously by repeating steps [4] and [5]. when sda is changed from low to high when scl is high, and the stop condition is detected, the bbsy flag in iccr is cleared to 0.
rev. 2.00, 05/03, page 560 of 846 sda (master output) sda (slave output) 2 1 2 1 4 36 58 79 bit 7 bit 6 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 iric icdrs icdrr rdrf scl (master output) start condition issuance scl (slave output) interrupt request generation address + r/ w address + r/ w [5] icdr read [5] iric clearance user processing slave address data 1 [4] a r/ w figure 15.8 example of slave receive mode operation timing (1) (mls = ackb = 0)
rev. 2.00, 05/03, page 561 of 846 sda (master output) sda (slave output) 2 14 36 58 79 8 79 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 bit 1 bit 0 iric icdrs icdrr rdrf scl (master output) scl (slave output) interrupt request generation interrupt request generation data 2 data 2 data 1 data 1 [5] icdr read [5] iric clearance user processing data 2 data 1 [4] [4] a a figure 15.9 example of slave receive mode operation timing (2) (mls = ackb = 0) 15.4.5 slave transmit operation in slave transmit mode, the slave device outputs the transmit data, while the master device outputs the receive clock and returns an acknowledge signal. the transmission procedure and operations in slave transmit mode are described below. 1. set the ice bit in iccr to 1. set the mls bit in icmr and the mst and trs bits in iccr according to the operating mode. 2. when the slave address matches in the first frame following detection of the start condition, the slave device drives sda low at the 9th clock pulse and returns an acknowledge signal. at the same time, the iric flag in iccr is set to 1. if the ieic bit in iccr has been set to 1, an interrupt request is sent to the cpu. if the 8th data bit (r/ w ) is 1, the trs bit in iccr is set to 1, and the mode changes to slave transmit mode automatically. the tdre internal flag is set to 1. the slave device drives scl low from the fall of the transmit clock until icdr data is written.
rev. 2.00, 05/03, page 562 of 846 3. after clearing the iric flag to 0, write data to icdr. the tdre internal flag is cleared to 0. the written data is transferred to icdrs, and the tdre internal flag and the iric and irtr flags are set to 1 again. after clearing the iric flag to 0, write the next data to icdr. the slave device sequentially sends the data written into icdr in accordance with the clock output by the master device at the timing shown in figure 15.10. 4. when one frame of data has been transmitted, the iric flag in iccr is set to 1 at the rise of the 9th transmit clock pulse. if the tdre internal flag has been set to 1, this slave device drives scl low from the fall of the transmit clock until data is written to icdr. the master device drives sda low at the 9th clock pulse, and returns an acknowledge signal. as this acknowledge signal is stored in the ackb bit in icsr, this bit can be used to determine whether the transfer operation was performed normally. when the tdre internal flag is 0, the data written into icdr is transferred to icdrs, transmission is started, and the tdre internal flag and the iric and irtr flags are set to 1 again. 5. to continue transmission, clear the iric flag to 0, then write the next data to be transmitted into icdr. the tdre flag is cleared to 0. transmit operations can be performed continuously by repeating steps [4] and [5]. to end transmission, write h'ff to icdr. when sda is changed from low to high when scl is high, and the stop condition is detected, the bbsy flag in iccr is cleared to 0.
rev. 2.00, 05/03, page 563 of 846 sda (slave output) sda (master output) scl (slave output) 2 1 2 1 4 36 58 79 9 8 bit 7 bit 6 bit 5 bit 7 bit 6 bit 4 bit 3 bit 2 bit 1 bit 0 iric icdrs icdrt tdre scl (master output) interrupt request generation interrupt request generation interrupt request generation slave receive mode slave transmit mode data 1 data 2 [3] iric clearance [5] iric clearance [3] icdr write [3] icdr write [5] icdr write user processing data 1 data 1 data 2 data 2 a r/ w a [3] [2] figure 15.10 example of slave transmit mode operation timing (mls = 0)
rev. 2.00, 05/03, page 564 of 846 15.4.6 iric setting timing and scl control the interrupt request flag (iric) is set at different times depending on the wait bit in icmr, the fs bit in sar, and the fsx bit in sarx. if the tdre or rdrf internal flag is set to 1, scl is automatically held low after one frame has been transferred; this timing is synchronized with the internal clock. figure 15.11 shows the iric set timing and scl control. (a) when wait = 0, and fs = 0 or fsx = 0 (i 2 c bus format, no wait) scl sda iric user processing write to icdr (transmit) or read icdr (receive) clear iric clear iric clear iric 1 a 8 1 1 a 7 1 2 2 2 2 2 2 89 7 (b) when wait = 1, and fs = 0 or fsx = 0 (i 2 c bus format, wait inserted) scl sda iric user processing clear iric write to icdr (transmit) or read icdr (receive) scl sda iric user processing (c) when fs = 1 and fsx = 1 (synchronous serial format) write to icdr (transmit) or read icdr (receive) 8 89 8 7 1 8 7 1 figure 15.11 iric setting timing and scl control
rev. 2.00, 05/03, page 565 of 846 15.4.7 operation using the dtc the i 2 c bus format provides for selection of the slave device and transfer direction by means of the slave address and the r/ w bit, confirmation of reception with acknowledge bit, indication of the last frame, and so on. therefore, continuous data transfer using the dtc must be carried out in conjunction cpu processing by means of interrupts. table 15.5 shows some example of processing using the dtc. these examples assume that the number of transfer data bytes is know in slave mode. table 15.5 flags and transfer states item master transmit mode master receive mode slave transmit mode slave receive mode slave address + r/w bit transmission/ reception transmission by dtc (icdr rite) transmission by dtc (icdr rite) reception by cpu (icdr read) reception by cpu (icdr read) dummy data read ? processing by dtc (icdr read) ?? actual data transmission/rec eption transmission by dtc (icdr write) reception by cpu (icdr read) transmission by dtc (icdr write) reception by cpu (icdr read) dummy data (h'ff) write ?? processing by dtc (icdr write) ? last frame processing not necessary reception by cpu (icdr read) not necessary reception by cpu (icdr read) transfer request processing after last frame processing 1st time: clearing by cpu 2nd time: end condition issuance by cpu not necessary automatic clearing on detection of end condition during transmission of dummy data (h'ff) not necessary setting of number of dtc transfer data frames transmission: actual data count + 1 (+ 1 equivalent to slave address + r/ w bits) reception: actual data count transmission: actual data count + 1 (+ 1 equivalent to dummy data (h'ff)) reception: actual data count
rev. 2.00, 05/03, page 566 of 846 15.4.8 noise chancellor the logic levels at the scl and sda pins are routed through noise chancellors before being latched internally. figure 15.12 shows a block diagram of the noise cancelled circuit. the noise chancellor consists of two cascaded latches and a match detector. the scl (or sda) input signal is sampled on the system clock, but is not passed forward to the next circuit unless the outputs of both latches agree. if they do not agree, the previous value is held. system clock period sampling clock c dq latch c dq latch scl or sda input signal match detector internal scl or sda signal sampling clock figure 15.12 block diagram of noise chancellor 15.4.9 sample flowcharts figures 15.13 to 15.16 show sample flowcharts for using the i 2 c bus interface in each mode.
rev. 2.00, 05/03, page 567 of 846 start initialize set mst = 1 and trs = 1 in iccr write bbsy =1 and scp = 0 in iccr write transmit data in icdr clear iric in iccr no no yes yes yes yes no no [1] initialization [3] select master transmit mode. [4] start condition issuance [6] set transmit data for the first byte (slave address + r/ ). (after writing icdr, clear iric continuously) [9] set transmit data for the second and subsequent bytes. (after writing icdr, clear iric immediately) [2] test the status of the scl and sda lines. [7] wait for 1 byte to be transmitted. [10] wait for 1 byte to be transmitted. [11] test for end of transfer [12] stop condition issuance [8] test the acknowledge bit, transferred from slave device. [5] wait for a start condition read iric in iccr read ackb in icsr iric = 1? ackb = 0? transmit mode? write transmit data in icdr clear iric in iccr read iric in iccr read ackb in icsr clear iric in iccr end of transmission? or ackb = 1? write bbsy = 0 and scp = 0 in iccr end read bbsy in iccr bbsy = 0? yes no read iric in iccr iric = 1? yes no yes no iric = 1? master receive mode figure 15.13 sample flowchart for master transmit mode
rev. 2.00, 05/03, page 568 of 846 master receive operation clear iric in iccr yes no yes yes no yes no [1] select receive mode. [3] wait for 1 byte to be received. [4] clear iric. (to end the wait insertion) [6] read the receive data. [9] clear iric. (to end the wait insertion) [2] start receiving. the first read is a dummy read. after reading icdr, please clear iric immediately. [7] clear iric. [10] set acknowledge data for the last reception. [11] clear iric. (to end the wait insertion) [12] wait for 1 byte to be received. [13] cancel wait mode. read received data. clear iric. (note: after setting wait = 0, iric should be cleared to 0.) [14] stop condition issuance. [8] wait for the next data to be received. [5] wait for 1 byte to be received. read iric in iccr read icdr clear iric in iccr iric = 1? iric = 1? yes last receive? last receive? set ackb = 1 in icsr set trs = 1 in iccr clear iric = 1 in iccr read iric in iccr set wait = 0 in icmr read icdr clear iric in iccr write bbsy = 0 and scp = 0 in iccr end set trs = 0 in iccr set ackb = 0 in icsr read iric in iccr iric = 1? yes no no read iric in iccr clear iric in iccr no iric = 1? set wait = 1 in icmr clear iric in iccr read icdr figure 15.14 sample flowchart for master receive mode
rev. 2.00, 05/03, page 569 of 846 start initialize set mst = 0 and trs = 0 in iccr set ackb = 0 in icsr read iric in iccr iric = 1? yes no clear iric in iccr read aas and adz in icsr aas = 1 and adz = 0? read trs in iccr trs = 0? no yes no yes yes no yes yes no no [1] [2] [3] [4] [5] [6] [7] [8] last receive? read icdr read iric in iccr iric = 1? clear iric in iccr set ackb = 1 in icsr read icdr read iric in iccr read icdr iric = 1? clear iric in iccr end general call address processing * description omitted slave transmit mode [1] select slave receive mode. [2] wait for the first byte to be received (slave address). [3] start receiving. the first read is a dummy read. [4] wait for the transfer to end. [5] set acknowledge data for the last reception. [6] start the last reception. [7] wait for the transfer to end. [8] read the last receive data. figure 15.15 sample flowchart for slave receive mode
rev. 2.00, 05/03, page 570 of 846 slave transmit mode write transmit data in icdr read iric in iccr iric = 1? clear iric in iccr clear iric in iccr clear iric in iccr read ackb in icsr set trs = 0 in iccr end of transmission (ackb = 1)? yes no no yes end [1] [2] [3] read icdr [5] [4] [1] set transmit data for the second and subsequent bytes. [2] wait for 1 byte to be transmitted. [3] test for end of transfer. [4] set slave receive mode. [5] dummy read (to release the scl line). figure 15.16 sample flowchart for slave transmit mode
rev. 2.00, 05/03, page 571 of 846 15.5 usage notes 1. in master mode, if an instruction to generate a start condition is immediately followed by an instruction to generate a stop condition, neither condition will be output correctly. to output consecutive start and stop conditions, after issuing the instruction that generates the start condition, read the relevant ports, check that scl and sda are both low, then issue the instruction that generates the stop condition. note that scl may not yet have gone low when bbsy is cleared to 0. 2. either of the following two conditions will start the next transfer. pay attention to these conditions when reading or writing to icdr. ? write access to icdr when ice = 1 and trs = 1 (including automatic transfer from icdrt to icdrs) ? read access to icdr when ice = 1 and trs = 0 (including automatic transfer from icdrs to icdrr) 3. table 15.6 shows the timing of scl and sda output in synchronization with the internal clock. timings on the bus are determined by the rise and fall times of signals affected by the bus load capacitance, series resistance, and parallel resistance. table 15.6 i 2 c bus timing (scl and sda output) item symbol output timing unit notes scl output cycle time t sclo 28t cyc to 256t cyc ns scl output high pulse width t sclho 0.5t sclo ns scl output low pulse width t scllo 0.5t sclo ns sda output bus free time t bufo 0.5t sclo C 1t cyc ns start condition output hold time t staho 0.5t sclo C 1t cyc ns retransmission start condition output setup time t staso 1t sclo ns stop condition output setup time t stoso 0.5t sclo + 2t cyc ns data output setup time (master) t sdaso 1t scllo C 3t cyc ns data output setup time (slave) 1t scll C 3t cyc ns data output hold time t sdaho 3t cyc ns figure 25.29 4. scl and sda inputs are sampled in synchronization with the internal clock. the ac timing therefore depends on the system clock cycle t cyc , as shown in table 26.10 (h8s/2239 group) and table 26.22 (h8s/2238 group) in section 26, electrical characteristics. note that the i 2 c bus interface ac timing specifications will not be met with a system clock frequency of less than 5 mhz.
rev. 2.00, 05/03, page 572 of 846 5. the i 2 c bus interface specification for the scl rise time t sr is under 1000 ns (300 ns for high- speed mode). in master mode, the i 2 c bus interface monitors the scl line and synchronizes one bit at a time during communication. if t sr (the time for scl to go from low to v ih ) exceeds the time determined by the input clock of the i 2 c bus interface, the high period of scl is extended. the scl rise time is determined by the pull-up resistance and load capacitance of the scl line. to insure proper operation at the set transfer rate, adjust the pull-up resistance and load capacitance so that the scl rise time does not exceed the values given in the table in table 15.7. table 15.7 permissible scl rise time (t sr ) values time indication iicx t cyc indication i 2 c bus specification (max.) = 5 mhz = 8 mhz = 10 mhz = 16 mhz * = 20 mhz * 07.5t cyc normal mode 1000 ns 1000 ns 937 ns 750 ns 468 ns 375 ns high-speed mode 300 ns 300 ns 300 ns 300 ns 300 ns 300 ns 1 17.5t cyc normal mode 1000 ns 1000 ns 1000 ns 1000 ns 1000 ns 1000 ns high-speed mode 300 ns 300 ns 300 ns 300 ns 300 ns 300 ns note: * supported only by the h8s/2239 group. 6. the i 2 c bus interface specifications for the scl and sda rise and fall times are under 1000 ns and 300 ns. the i 2 c bus interface scl and sda output timing is prescribed by t cyc , as shown in table 15.6. however, because of the rise and fall times, the i 2 c bus interface specifications may not be satisfied at the maximum transfer rate. table 15.8 shows output timing calculations for different operating frequencies, including the worst-case influence of rise and fall times. the values in the above table will vary depending on the settings of the iicx bit and bits cks0 to cks2. depending on the frequency it may not be possible to achieve the maximum transfer rate; therefore, whether or not the i 2 c bus interface specifications are met must be determined in accordance with the actual setting conditions. t bufo fails to meet the i 2 c bus interface specifications at any frequency. the solution is either (a) to provide coding to secure the necessary interval (approximately 1 s) between issuance of a stop condition and issuance of a start condition, or (b) to select devices whose input timing permits this output timing for use as slave devices connected to the i 2 c bus. t scllo in high-speed mode and t staso in standard mode fail to satisfy the i 2 c bus interface specifications for worst-case calculations of t sr /t sf . possible solutions that should be investigated include (a) adjusting the rise and fall times by means of a pull-up resistor and capacitive load, (b) reducing the transfer rate to meet the specifications, or (c) selecting devices whose input timing permits this output timing for use as slave devices connected to the i 2 c bus.
rev. 2.00, 05/03, page 573 of 846 table 15.8 i 2 c bus timing (with maximum influence of t sr /t sf ) time indication (at maximum transfer rate) [ns] item t cyc indication t sr /t sf influence (max) i 2 c bus specifi- cation (min) = 5 mhz = 8 mhz = 10 mhz = 16 mhz * 3 = 20 mhz * 3 t sclho 0.5t sclo (Ct sr ) standard mode C1000 4000 4000 4000 4000 4000 4000 high-speed mode C300 600 950 950 950 950 950 t scllo 0.5t sclo (Ct sf ) standard mode C250 4700 4750 4750 4750 4750 4750 high-speed mode C250 1300 1000 * 1 1000 * 1 1000 * 1 1000 * 1 1000 t bufo standard mode C1000 4700 3800 * 1 3875 * 1 3900 * 1 3938 * 1 3950 0.5t sclo C1t cyc ( Ct sr ) high-speed mode C300 1300 750 * 1 825 * 1 850 * 1 888 * 1 900 t staho standard mode C250 4000 4550 4625 4650 4688 4700 0.5t sclo C1t cyc (Ct sf ) high-speed mode C250 600 800 875 900 938 950 t staso 1t sclo (Ct sr ) standard mode C1000 4700 9000 9000 9000 9000 9000 high-speed mode C300 600 2200 2200 2200 2200 2200 t stoso standard mode C1000 4000 4400 4250 4200 4125 4100 0.5t sclo + 2t cyc (Ct sr ) high-speed mode C300 600 1350 1200 1150 1075 1050 standard mode C1000 250 3100 3325 3400 3513 3550 t sdaso (master) 1t scllo * 2 C3t cyc (Ct sr ) high-speed mode C300 100 400 625 700 813 850 standard mode C1000 250 3100 3325 3400 3513 3550 t sdaso (slave) 1t scll * 2 C3t cyc * 2 (Ct sr ) high-speed mode C300 100 400 625 700 813 850 t sdaho 3t cyc standard mode 0 0 600 375 300 188 150 high-speed mode 0 0 600 375 300 188 150 notes: * 1 does not meet the i 2 c bus interface specification. remedial action such as the following is necessary: (a) secure a start/stop condition issuance interval; (b)adjust the rise and fall times by means of a pull-up resistor and capacitive load; (c) reduce the transfer rate; (d) select slave devices whose input timing permits this output timing. the values in the above table will vary depending on the settings of the iicx bit and bits cks0 to cks2.depending on the frequency it may not be possible to achieve the maximum transfer rate; therefore, whether or not the i 2 c bus interface specifications are met must be determined in accordance with the actual setting conditions. * 2 calculated using the i 2 c bus specification values (standard mode: 4700 ns min; high- speed mode: 1300 ns min). * 3 supported only by the h8s/2239 group.
rev. 2.00, 05/03, page 574 of 846 7. note on icdr read at end of master reception to halt reception after completion of a receive operation in master receive mode, set the trs bit to 1 and write 0 to bbsy and scp in iccr. this changes the sda pin from low to high when the scl pin is high, and generates the stop condition. after this, receive data can be read by means of an icdr read, but if data remains in the buffer the icdrs receive data will not be transferred to icdr, and so it will not be possible to read the second byte of data. if it is necessary to read the second byte of data, issue the stop condition in master receive mode (i.e. with the trs bit cleared to 0). when reading the receive data, first confirm that the bbsy bit in iccr is cleared to 0, the stop condition has been generated, and the bus has been released, then read icdr with trs cleared to 0. note that if the receive data (icdr data) is read in the interval between execution of the instruction for issuance of the stop condition (writing of 0 to bbsy and scp in iccr) and the actual generation of the stop condition, the clock may not be output correctly in subsequent master transmission. clearing of the mst bit after completion of master transmission/reception, or other modifications of iic control bits to change the transmit/receive operating mode or settings, must be carried out during interval (a) in figure 15.17 (after confirming that the bbsy bit has been cleared to 0 in the iccr register). sda scl internal clock bbsy bit master receive mode icdr reading prohibited bit 0 a 8 9 stop condition (a) start condition execution of stop condition issuance instruction (0 written to bbsy and scp) confirmation of stop condition generation (0 read from bbsy) start condition issuance figure 15.17 points for attention concerning reading of master receive data
rev. 2.00, 05/03, page 575 of 846 8. notes on start condition issuance for retransmission depending on the timing combination with the start condition issuance and the subsequently writing data to icdr, it may not be possible to issue the retransmission and the data transmission after retransmission condition issuance. after start condition issuance is done and determined the start condition, write the transmit data to icdr, as shown below. figure 15.18 shows the timing of start condition issuance for retransmission, and the timing for subsequently writing data to icdr, together with the corresponding flowchart.
rev. 2.00, 05/03, page 576 of 846 sda iric scl ack bit 7 data output [3] (restart) start condition instruction issuance [4] iric determination [5] icdr write (next transmit data) [2] detemination of scl = low [1] iric determination start condition (retransmission) iric = 1? yes clear iric in icsr read scl pin write transmit data to icdr write bbsy = 1, scp = 0 (icsr) [1] [1] wait for end of 1-byte transfer [2] determine whether scl0 is low [3] issue restart condition instruction for transmission [4] determine whether start condition is generated or not [5] set transmit data (slave address + r/ ) [2] [3] [4] [5] yes yes no no iric = 1? yes scl = low? start condition issuance? no no other processing note: program so that processing from [3] to [5] is executed continuously. 9 figure 15.18 flowchart and timing of start condition instruction issuance for retransmission
rev. 2.00, 05/03, page 577 of 846 9. notes on i 2 c bus interface stop condition instruction issuance if the rise time of the 9th scl clock exceeds the specification because the bus load capacitance is large, or if there is a slave device of the type that drives scl low to effect a wait, after rising of the 9th scl clock, issue the stop condition after reading scl and determining it to be low, as shown below. stop condition scl iric [1] determination of scl = low 9th clock vih high period secured [2] stop condition instruction issuance sda as waveform rise is late, scl is detected as low figure 15.19 timing of stop condition issuance 10. notes on initialization of internal state the i 2 c has a function for forcible initialization of its internal state if a deadlock occurs during communication. initialization is executed by (1) setting bits clr3 to clr0 in the ddcswr register. for details see section 15.3.8, ddc switch register (ddcswr). ? scope of initialization: the initialization executed by function covers the following items: ? tdre and rdrf internal flags ? transmit/receive sequencer and internal operating clock counter ? internal latches for retaining the output state of the scl and sda pins (wait, clock, data output, etc.) ? the following items are not initialized: ? actual register values (icdr, sar, sarx, icmr, iccr, icsr, ddcswr, stcr) ? internal latches used t retain register read information setting/clearing flags in the icmr,.iccr, icsr, and ddcswr registers ? the value of the icmr register bit counter (bc2 to bc0) ? generated interrupt sources (interrupt sources transferred to the interrupt controller)
rev. 2.00, 05/03, page 578 of 846 ? notes on initialization: interrupt flags and interrupt sources are not cleared, and so flag clearing measures must be taken as necessary. basically, other register flags are not cleared either, and so flag clearing measures must be taken as necessary. when initialization is executed by the ddcswr register, the write data for bits clr3 to clr0 is not retained. to perform iic clearance, bits clr3 to clr0 must be written to simultaneously using an mov instruction. do not use a bit manipulation instruction such as bclr. similarly, when clearing is required again, all the bits must be written to simultaneously in accordance with the setting. if a flag clearing setting is made during transmission/reception, the iic module will stop transmitting/receiving at that point and the scl and sda pins will be released. when transmission/reception is started again, register initialization, etc., must be carried out as necessary to enable correct communication as a system. the value of the bbsy bit cannot be modified directly by this module clear function, but since the stop condition pin waveform is generated according to the state and release timing of the scl and sda pins, the bbsy bit may be cleared as a result. similarly, state switching of other bits and flags may also have an effect. to prevent problems caused by these factors, the following procedure should be used when initializing the iic state. execute initialization of the internal state according to the setting of bits clr3 to clr0. execute a stop condition issuance instruction (write 0 to bbsy and scp) to clear the bbsy bit to 0, and wait for two transfer rate clock cycles. re-execute initialization of the internal state according to the setting of bits clr3 to clr0 or ice bit. initialize (re-set) the iic registers. 11. interrupt during module stop mode when the module is stopped in the state that an interrupt is requested, the interrupt source of the cpu or activation source of the dtc is not cleared. be sure to enter module stop mode by disabling the interrupt beforehand. 12. assignment and selection of register addresses some i 2 c bus interface registers are assigned to the same address as other registers. register selection is performed by means of the iice bit in the serial control register x (scrx). for details on register addresses, see section 25, list of registers.
adcms35c_000020020700 rev. 2.00, 05/03, page 579 of 846 section 16 a/d converter this lsi includes a successive approximation type 10-bit a/d converter that allows up to eight analog input channels to be selected. a block diagram of the a/d converter is shown in figure 16.1. 16.1 features ? 10-bit resolution ? eight input channels ? conversion time: 9.6 s per channel (at 13.5 mhz operation) ? two operating modes single mode: single-channel a/d conversion scan mode: continuous a/d conversion on 1 to 4 channels ? four data registers conversion results are held in a 16-bit data register for each channel ? sample and hold function ? three methods conversion start software 16-bit timer pulse unit (tpu or tnr) conversion start trigger external trigger signal ? interrupt request an a/d conversion end interrupt request (adi) can be generated ? module stop mode can be set
rev. 2.00, 05/03, page 580 of 846 module data bus control circuit internal data bus 10-bit d/a comparator + sample-and- hold circuit adi interrupt bus interface successive approximations register multiplexer a d c s r a d c r a d d r d a d d r c a d d r b a d d r a an0 an1 an2 an3 an4 an5 an6 an7 legend adcr : a/d control register adcsr : a/d control/status register addra : a/d data register a addrb : a/d data register b addrc : a/d data register c addrd : a/d data register d adtrg conversion start trigger from tpu or 8-bit time r an8 an9 an10 an11 /2 /4 /8 /16 av cc av ss vref figure 16.1 block diagram of a/d converter
rev. 2.00, 05/03, page 581 of 846 16.2 input/output pins table 16.1 summarizes the input pins used by the a/d converter. the eight analog input pins are divided into two groups each of which consists of four channels; analog input pins 0 to 3 (an0 to an3) comprising group 0 and analog input pins 4 to 7 (an4 to an7) comprising group 1. the avcc and avss pins are the power supply pins for the analog block in the a/d converter. the vref pin is the a/d conversion reference voltage pin. table 16.1 pin configuration pin name symbol i/o function analog power supply pin av cc input analog block power supply and reference voltage analog ground pin av ss input analog block ground and reference voltage reference voltage pin vref input reference voltage for a/d conversion analog input pin 0 an0 input analog input pin 1 an1 input analog input pin 2 an2 input analog input pin 3 an3 input group 0 analog input pins analog input pin 4 an4 input analog input pin 5 an5 input analog input pin 6 an6 input analog input pin 7 an7 input group 1 analog input pins a/d external trigger input pin adtrg input external trigger input pin for starting a/d conversion
rev. 2.00, 05/03, page 582 of 846 16.3 register descriptions the a/d converter has the following registers. for details on the module stop control register, refer to section 23.1.2, module stop control registers a to c (mstpcra to mstpcrc). ? a/d data register a (addra) ? a/d data register b (addrb) ? a/d data register c (addrc) ? a/d data register d (addrd) ? a/d control/status register (adcsr) ? a/d control register (adcr) 16.3.1 a/d data registers a to d (addra to addrd) there are four 16-bit read-only addr registers; addra to addrd, used to store the results of a/d conversion. the addr registers, which store a conversion result for each channel, are shown in table 16.2. the converted 10-bit data is stored in bits 6 to 15. the lower 6 bits are always read as 0. the data bus between the cpu and the a/d converter is 8 bits wide. the upper byte can be read directly from the cpu, however the lower byte should be read via a temporary register. therefore, when reading the addr, read only the upper byte, or read in word unit. table 16.2 analog input channels and corresponding addr registers analog input channel group 0 (ch2 = 0) group 1 (ch2 = 1) a/d data register to be stored the results of a/d conversion an0 an4 addra an1 an5 addrb an2 an6 addrc an3 an7 addrd
rev. 2.00, 05/03, page 583 of 846 16.3.2 a/d control/status register (adcsr) adcsr controls a/d conversion operations. bit bit name initial value r/w description 7adf 0 r/(w) * a/d end flag a status flag that indicates the end of a/d conversion. [setting conditions] ? when a/d conversion ends in single mode ? when a/d conversion ends on all specified channels in scan mode [clearing conditions] ? when 0 is written after reading adf = 1 ? when the dtc is activated by an adi interrupt and addr is read 6 adie 0 r/w a/d interrupt enable a/d conversion end interrupt (adi) request enabled when 1 is set 5 adst 0 r/w a/d start clearing this bit to 0 stops a/d conversion, and the a/d converter enters the wait state. setting this bit to 1 starts a/d conversion. in single mode, this bit is cleared to 0 automatically when conversion on the specified channel is complete. in scan mode, conversion continues sequentially on the specified channels until this bit is cleared to 0 by software, a reset, software standby mode, hardware standby mode, or module stop mode. the adst bit can be set to 1 by software, a timer conversion start trigger, or the a/d external trigger input pin ( adtrg ).
rev. 2.00, 05/03, page 584 of 846 bit bit name initial value r/w description 4 scan 0 r/w scan mode selects single mode or scan mode as the a/d conversion operating mode. only set the scan bit while conversion is stopped (adst = 0). 0: single mode 1: scan mode 3 ? 0r/wreserved this bit is always read as 0. the write value should always be 0. 2 1 0 ch2 ch1 ch0 0 0 0 r/w r/w r/w channel select 0 to 2 select analog input channels. when scan = 0 when scan = 1 000: an0 000: an0 001: an1 001: an0 and an1 010: an2 010: an0 to an2 011: an3 011: an0 to an3 100: an4 100: an4 101: an5 101: an4 and an5 110: an6 110: an4 to an6 111: an7 111: an4 to an7 note: * only 0 can be written to clear this bit.
rev. 2.00, 05/03, page 585 of 846 16.3.3 a/d control register (adcr) the adcr enables a/d conversion started by an external trigger signal. bit bit name initial value r/w description 7 6 trgs1 trgs0 0 0 r/w r/w timer trigger select 0 and 1 enables the start of a/d conversion by a trigger signal. only set bits trgs0 and trgs1 while conversion is stopped (adst = 0). 00: a/d conversion start by software is enabled 01: a/d conversion start by tpu conversion start trigger is enabled 10: a/d conversion start by 8-bit timer conversion start trigger is enabled 11: a/d conversion start by external trigger pin ( adtrg ) is enabled 5 4 1 1 reserved these bits are always read as 1 and cannot be modified. 3 2 cks1 cks0 0 0 r/w r/w clock select 0 and 1 these bits specify the a/d conversion time. the conversion time should be changed only when adst = 0. specify a setting that gives a value within the range shown in table 26.11 (h8s/2239 group), table 26.23 (h8s/2238 group), or table 26.33 (h8s2237 group) in section 26, electrical characteristics. 00: conversion time = 530 states (max) 01: conversion time = 266 states (max) 10: conversion time = 134 states (max) 11: conversion time = 68 states (max) 1, 0 ? all 1 ? reserved these bits are always read as 1 and cannot be modified.
rev. 2.00, 05/03, page 586 of 846 16.4 operation the a/d converter operates by successive approximation with 10-bit resolution. it has two operating modes; single mode and scan mode. when changing the operating mode or analog input channel, in order to prevent incorrect operation, first clear the bit adst to 0 in adcsr. the adst bit can be set at the same time as the operating mode or analog input channel is changed. 16.4.1 single mode in single mode, a/d conversion is to be performed only once on the specified single channel. the operations are as follows. 1. a/d conversion is started when the adst bit is set to 1, according to software, timer conversion start trigger, or external trigger input. 2. when a/d conversion is completed, the result is transferred to the corresponding a/d data register to the channel. 3. on completion of conversion, the adf bit in adcsr is set to 1. if the adie bit is set to 1 at this time, an adi interrupt request is generated. 4. the adst bit remains set to 1 during a/d conversion. when a/d conversion ends, the adst bit is automatically cleared to 0 and the a/d converter enters the wait state.
rev. 2.00, 05/03, page 587 of 846 adie adst adf state of channel 0 (an0) a/d conversion result 2 a/d conversion start a/d conversion result 1 addra addrb addrc addrd state of channel 1 (an1) state of channel 2 (an2) state of channel 3 (an3) note: * a/d conversion 1 set * set * set * clear * clear * idle idle idle idle a/d conversion 2 idle idle read conversion result * read conversion result * vertical arrows indicate instructions executed by software. figure 16.2 example of a/d converter operation (single mode, channel 1 selected) 16.4.2 scan mode in scan mode, a/d conversion is to be performed sequentially on the specified channels (four channels maximum). the operations are as follows. 1. when the adst bit is set to 1 by software, tpu, timer conversion start trigger, or external trigger, input, a/d conversion starts on the first channel in the group (an0 when ch2 = 0, an4 when ch2 = 1). 2. when a/d conversion for each channel is completed, the result is sequentially transferred to the a/d data register corresponding to each channel. 3. when conversion of all the selected channels is completed, the adf flag is set to 1. if the adie bit is set to 1 at this time, an adi interrupt is requested after a/d conversion ends. conversion of the first channel in the group starts again. 4. steps [2] to [3] are repeated as long as the adst bit remains set to 1. when the adst bit is cleared to 0, a/d conversion stops and the a/d converter enters the wait state.
rev. 2.00, 05/03, page 588 of 846 adst adf addra addrb addrc addrd state of channel 0 (an0) notes: continuous a/d conversion * 2 state of channel 1 (an1) state of channel 3 (an3) state of channel 2 (an2) clear * 1 clear * 1 set * 1 idle idle idle idle idle idle idle idle idle a/d conversion time a/d conversion 1 a/d conversion 2 a/d conversion 4 a/d conversion 3 a/d conversion 5 a/d conversion result 1 a/d conversion result 2 a/d conversion result 2 a/d conversion result 3 * 1 vertical arrows indicate instructions executed by software. * 2 data currently being converted is ignored. figure 16.3 example of a/d converter operation (scan mode, channels an0 to an2 selected) 16.4.3 input sampling and a/d conversion time the a/d converter has a built-in sample-and-hold circuit. the a/d converter samples the analog input when the a/d conversion start delay time (t d ) has passed after the adst bit is set to 1, then starts conversion. figure 16.4 shows the a/d conversion timing. table 16.3 shows the a/d conversion time. as indicated in figure 16.4, the a/d conversion time (t conv ) includes t d and the input sampling time (t spl ). the length of t d varies depending on the timing of the write access to adcsr. the total conversion time therefore varies within the ranges indicated in table 16.3. in scan mode, the values given in table 16.3 apply to the first conversion time. the values given in table 16.4 apply to the second and subsequent conversions.
rev. 2.00, 05/03, page 589 of 846 (1) (2) t d t spl t conv address write signal input sampling timing adf legend (1) : adcsr write cycle (2) : adcsr address t d : a/d conversion start delay t spl : input sampling time t conv : a/d conversion time figure 16.4 a/d conversion timing table 16.3 a/d conversion time (single mode) cks1 = 0 cks1 = 1 cks0 = 0 cks0 = 1 cks0 = 0 cks0 = 1 item symbol min typ max min typ max min typ max min typ max a/d conversion start delay t d 18 33 10 17 6 9 4 5 input sampling time t spl 127 63 31 15 a/d conversion time t conv 515 530 259 266 131 134 67 68 note: all values represent the number of states. table 16.4 a/d conversion time (scan mode) cks1 cks0 conversion time (state) 0 512 (fixed) 0 1 256 (fixed) 0 128 (fixed) 1 1 64 (fixed)
rev. 2.00, 05/03, page 590 of 846 16.4.4 external trigger input timing a/d conversion can be externally triggered. when the trgs0 and trgs1 bits are set to 11 in adcr, external trigger input is enabled at the adtrg pin. a falling edge at the adtrg pin sets the adst bit to 1 in adcsr, starting a/d conversion. other operations, in both single and scan modes, are the same as when the bit adst has been set to 1 by software. figure 16.5 shows the timing. adtrg internal trigger signal adst a/d conversion figure 16.5 external trigger input timing 16.5 interrupt source the a/d converter generates an a/d conversion end interrupt (adi) at the end of a/d conversion. setting the adie bit to 1 enables adi interrupt requests while the bit adf in adcsr is set to 1 after a/d conversion is completed. the dmac * and the dtc can be activated by an adi interrupt. having the converted data read by the dmac * or the dtc in response to an adi interrupt enables continuous conversion without imposing a load on software. note: * supported only by the h8s/2239 group. table 16.5 a/d converter interrupt source name interrupt source interrupt source flag dtc activation dmac * activation adi a/d conversion completed adf possible possible note: * supported only by the h8s/2239 group.
rev. 2.00, 05/03, page 591 of 846 16.6 a/d conversion accuracy definitions this lsi's a/d conversion accuracy definitions are given below. ? resolution the number of a/d converter digital output codes ? quantization error the deviation inherent in the a/d converter, given by 1/2 lsb (see figure 16.6). ? offset error the deviation of the analog input voltage value from the ideal a/d conversion characteristic when the digital output changes from the minimum voltage value b'0000000000 (h'000) to b'0000000001 (h'001) (see figure 16.7). ? full-scale error the deviation of the analog input voltage value from the ideal a/d conversion characteristic when the digital output changes from b'1111111110 (h'3fe) to b'1111111111 (h'3ff) (see figure 16.7). ? nonlinearity error the error with respect to the ideal a/d conversion characteristic between zero voltage and full- scale voltage. does not include offset error, full-scale error, or quantization error (see figure 16.7). ? absolute accuracy the deviation between the digital value and the analog input value. includes offset error, full- scale error, quantization error, and nonlinearity error.
rev. 2.00, 05/03, page 592 of 846 111 110 101 100 011 010 001 000 1 1024 2 1024 1022 1024 1023 1024 fs quantization error digital output ideal a/d conversion characteristic analog input voltage figure 16.6 a/d conversion accuracy definitions fs digital output ideal a/d conversion characteristic nonlinearity error analog input voltage offset error actual a/d conversion characteristic full-scale error figure 16.7 a/d conversion accuracy definitions
rev. 2.00, 05/03, page 593 of 846 16.7 usage notes 16.7.1 module stop mode setting operation of the a/d converter can be disabled or enabled using the module stop control register. the initial setting is for operation of the a/d converter to be halted. register access is enabled by clearing module stop mode. for details, refer to section 23, power-down modes. 16.7.2 permissible signal source impedance this lsi's analog input is designed such that conversion accuracy is guaranteed for an input signal for which the signal source impedance is 5 k ? or less. this specification is provided to enable the a/d converter's sample-and-hold circuit input capacitance to be charged within the sampling time; if the sensor output impedance exceeds 5 k ? , charging may be insufficient and it may not be possible to guarantee a/d conversion accuracy. however, for a/d conversion in single mode with a large capacitance provided externally, the input load will essentially comprise only the internal input resistance of 10 k ? , and the signal source impedance is ignored. however, as a low-pass filter effect is obtained in this case, it may not be possible to follow an analog signal with a large differential coefficient (e.g., 5 mv/ s or greater) (see figure 16.8). when converting a high-speed analog signal, a low-impedance buffer should be inserted. 16.7.3 influences on absolute accuracy adding capacitance results in coupling with gnd, and therefore noise in gnd may adversely affect absolute accuracy. be sure to make the connection to an electrically stable gnd such as avss. care is also required to insure that filter circuits do not communicate with digital signals on the mounting board (i.e., acting as antennas). a/d converter equivalent circuit this lsi 20 pf c in = 15 pf 10 k ? low-pass filter c to 0.1 f sensor output impedance to 5 k ? sensor input figure 16.8 example of analog input circuit
rev. 2.00, 05/03, page 594 of 846 16.7.4 range of analog power supply and other pin settings if the conditions below are not met, the reliability of the device may be adversely affected. ? analog input voltage range the voltage applied to analog input pin ann during a/d conversion should be in the range avss ann avcc. ? relationship between avcc, avss and vcc, vss set avss = vss as the relationship between avcc, avss and vcc, vss. if the a/d converter is not used, the avcc and avss pins must not be left open. ? vref range the reference voltage input from the vref pin should be set to avcc or less. 16.7.5 notes on board design in board design, digital circuitry and analog circuitry should be as mutually isolated as possible, and layout in which digital circuit signal lines and analog circuit signal lines cross or are in close proximity should be avoided as far as possible. failure to do so may result in incorrect operation of the analog circuitry due to inductance, adversely affecting a/d conversion values. also, digital circuitry must be isolated from the analog input signals (an0 to an7), and analog power supply (avcc) by the analog ground (avss). also, the analog ground (avss) should be connected at one point to a stable digital ground (vss) on the board. 16.7.6 notes on noise countermeasures a protection circuit should be connected in order to prevent damage due to abnormal voltage, such as an excessive surge at the analog input pins (an0 to an7), between avcc and avss, as shown in figure 16.9. also, the bypass capacitors connected to avcc and the filter capacitor connected to an0 to an7 must be connected to avss. if a filter capacitor is connected, the input currents at the analog input pins (an0 to an7) are averaged, and so an error may arise. also, when a/d conversion is performed frequently, as in scan mode, if the current charged and discharged by the capacitance of the sample-and-hold circuit in the a/d converter exceeds the current input via the input impedance (r in ), an error will arise in the analog input pin voltage. careful consideration is therefore required when deciding circuit constants.
rev. 2.00, 05/03, page 595 of 846 avcc * 1 an0 to an7 avss r in * 2 100 ? 0.1 f 0.01 f 10 f notes: values are reference values. * 1 * 2 r in : input impedance vref * 1 figure 16.9 example of analog input protection circuit table 16.6 analog pin specifications item min max unit analog input capacitance 20 pf permissible signal source impedance 5 k ? 20 pf an0 to an7 note: values are reference values. 10 k ? to a/d converte r figure 16.10 analog input pin equivalent circuit
rev. 2.00, 05/03, page 596 of 846
dac0004c_000020020700 rev. 2.00, 05/03, page 597 of 846 section 17 d/a converter 17.1 features ? 8-bit resolution ? two output channels ? conversion time: 10 s, maximum (when load capacitance is 20 pf) ? output voltage: 0 v to vref ? d/a output retaining function in software standby mode ? module stop mode can be set note: the d/a converter is not included in the h8s/2227 group. module data bus internal data bus bus interface vref avcc da1 da0 avss 8-bit d/a control circuit d a d r 0 d a d r 1 d a c r legend dacr : d/a control register dadr0: d/a data register 0 dadr1: d/a data register 1 figure 17.1 block diagram of d/a converter
rev. 2.00, 05/03, page 598 of 846 17.2 input/output pins table 17.1 shows the pin configuration for the d/a converter. table 17.1 pin configuration pin name symbol i/o function analog power supply pin av cc input analog block power supply analog ground pin av ss input analog block ground and reference voltage analog output pin 0 da0 output channel 0 analog output pin analog output pin 1 da1 output channel 1 analog output pin reference voltage pin vref input reference voltage for analog block 17.3 register description the d/a converter has the following registers. for details on the module stop control register, refer to section 23.1.2, module stop control registers a to c (mstpcra to mstpcrc). ? d/a data register 0 (dadr0) ? d/a data register 1 (dadr1) ? d/a control register (dacr) 17.3.1 d/a data registers 0 and 1 (dadr0 and dadr1) dadr0 and dadr1 are 8-bit readable/writable registers that store data for d/a conversion. when analog output is permitted, d/a data register contents are converted and output to analog output pins.
rev. 2.00, 05/03, page 599 of 846 17.3.2 d/a control register (dacr) dacr controls d/a converter operation. bit bit name initial value r/w description 7 daoe1 0 r/w d/a output enable 1 controls d/a conversion and analog output 0: analog output da1 is disabled 1: d/a conversion for channel 1 and analog output da1 are enabled 6 daoe0 0 r/w d/a output enable 0 controls d/a conversion and analog output 0: analog output da0 is disabled 1: d/a conversion for channel 0 and analog output da0 are enabled 5 dae 0 r/w d/a enable controls d/a conversion in conjunction with the daoe0 and daoe1 bits. when the dae bit is cleared to 0, d/a conversion for channels 0 and 1 are controlled individually. when dae is set to 1, d/a conversion for channels 0 and 1 are controlled as one. conversion result output is controlled by the daoe0 and daoe1 bits. for details, see table 17.2. 4 to 0 ? all 1 ? reserved these bits are always read as 1 and cannot be modified.
rev. 2.00, 05/03, page 600 of 846 table 17.2 d/a conversion control bit 5 bit 7 bit 6 dae daoe1 daoe0 description 000disables d/a conversion 1 enables d/a conversion for channel 0 1 0 enables d/a conversion for channel 1 1 enables d/a conversion for channels 0 and 1 100disables d/a conversion 1 enables d/a conversion for channels 0 and 1 10 1 17.4 operation two channels of the d/a converter can perform conversion individually. when the daoe bit in dacr is set to 1, d/a conversion is enabled and the conversion results are output. an example of d/a conversion of channel 0 is shown below. the operation timing is shown in figure 17.2. 1. write conversion data to dadr0. 2. when the daoe0 bit in dacr is set to 1, d/a conversion starts. after the interval of t dconv , the conversion results are output from the analog output pin da0. the conversion results are output continuously until dadr0 is modified or daoe0 bit is cleared to 0. the output value is calculated by the following formula: (dadr contents)/256 conversion starts immediately after dadr0 is modified. after the interval of t dconv , conversion results are output. 4. when the daoe bit is cleared to 0, analog output is disabled.
rev. 2.00, 05/03, page 601 of 846 dadr0 write cycle dacr write cycle dadr0 write cycle dacr write cycle address  dadr0 daoe0 da0 conversion data (1) conversion data (2) high impedance state conversion result (1) conversion result (2) t dconv t dconv legend t dconv : d/a conversion time figure 17.2 d/a converter operation example 17.5 usage notes 17.5.1 analog power supply current in software standby mode if this lsi enters software standby mode while d/a conversion is enabled, d/a output is retained and the analog power supply current is equivalent to that during d/a conversion. to reduce analog power supply current in software standby mode, clear the daoe0, daoe1, and dae bits to 0 to disable d/a output. 17.5.2 setting for module stop mode it is possible to enable/disable the d/a converter operation using the module stop control register, the d/a converter does not operate by the initial value of the register. the register can be accessed by releasing the module stop mode. for more details, see section 23, power-down modes.
rev. 2.00, 05/03, page 602 of 846
rev. 2.00, 05/03, page 603 of 846 section 18 ram the h8s/2239 has 32 kbytes of on-chip high-speed static ram. the h8s/2238, h8s/2237, and h8s/2227 have 16 kbytes of on-chip high-speed static ram. the h8s/2236 has 8 kbytes of on- chip high-speed static ram. the h8s/2235, h8s/2233, h8s/2225, h8s/2224, and h8s/2223 have 4 kbytes of on-chip high-speed static ram. the ram is connected to the cpu by a 16-bit data bus, enabling one-state access by the cpu to both byte data and word data.
rev. 2.00, 05/03, page 604 of 846
romf253c_000020020700 rev. 2.00, 05/03, page 605 of 846 section 19 rom the features of the flash memory are summarized below. the block diagram of the flash memory is shown in figure 19.1. 19.1 features ? capacity h8s/2239: 384 kbytes h8s/2238: 256 kbytes h8s/2227: 128 kbytes ? programming/erase methods the flash memory is programmed 128 bytes at a time. erase is performed in single-block units. the flash memory of the h8s/2239 is configured as follows: 64 kbytes ? reprogramming capability the flash memory can be reprogrammed for 100 times. ? two programming modes boot mode user program mode on-board programming/erasing can be done in boot mode, in which the boot program built into the chip is started to erase or program of the entire flash memory. in normal user program mode, individual blocks can be erased or programmed. ? automatic bit rate adjustment for data transfer in boot mode, this lsi's bit rate can be automatically adjusted to match the transfer bit rate of the host. ? programming/erasing protection there are three protect modes, hardware, software, and error protect, which allow protected status to be designated for flash memory program/erase operations. ? programmer mode flash memory can be programmed/erased in programmer mode using a prom programmer, as well as in on-board programming mode. ? emulation function for flash memory in ram
rev. 2.00, 05/03, page 606 of 846 the real-time emulation for programming of flash memory is possible by overlapping the flash memory to a part of ram. module bus bus interface/controller h8s/2239 h8s/2238 h8s/2237 operating mode flmcr2 internal address bus internal data bus (16 bits) fwe pin mode pin ebr1 ebr2 ramer flmcr1 flash memory control register 1 flash memory control register 2 erase block register 1 erase block register 2 ram emulation register legend flmcr1: flmcr2: ebr1: ebr2: ramer: flpwcr: flash memory power control register flpwcr flash memory : 384 kbytes : 256 kbytes : 128 kbytes figure 19.1 block diagram of flash memory 19.2 mode transitions when the mode pins and the fwe pin are set in the reset state and a reset-start is executed, this lsi enters an operating mode as shown in figure 19.2. in user mode, flash memory can be read but not programmed or erased. the boot, user program and programmer modes are provided as modes to write and erase the flash memory. the differences between boot mode and user program mode are shown in table 19.1. figure 19.3 shows the operation flow for boot mode and figure 19.4 shows that for user program mode.
rev. 2.00, 05/03, page 607 of 846 boot mode on-board programming mode user program mode user mode reset state programmer mode res = 0 fwe = 1 fwe = 0 * 1 * 1 * 2 * 3 notes: only make a transition between user mode and user program mode when the cpu is not accessing the flash memory. * 1 ram emulation possible * 2 in the h8s/2239 group and h8s/2238 group, md0 = 0, md1 = 0, md2 = 0, p14 = 0, p16 = 0, pf0 = 1. * 3 in the h8s/2227 group, md0 = 0, md1 = 0, md2 = 0, p14 = 0, p16 = 0, pf0 = 1, pf3 = 1. res = 0 md1 = 1, md2 = 0, fwe = 1 res = 0 res = 0 md1 = 1, md2 = 1, fwe = 0 md1 = 1, md2 = 1, fwe = 1 figure 19.2 flash memory state transitions table 19.1 differences between boot mode and user program mode boot mode user program mode total erase yes yes block erase no yes programming control program * program/program-verify program/program-verify/erase/ erase-verify/emulation note: * to be provided by the user, in accordance with the recommended algorithm.
rev. 2.00, 05/03, page 608 of 846 flash memory this lsi ram host programming control program sci application program (old version) new application program flash memory this lsi ram host sci application program (old version) boot program area new application program flash memory this lsi ram host sci flash memory preprogramming erase boot program new application program flash memory this lsi program execution state ram host sci new application program boot program programming control program 1. initial state the old program version or data remains written in the flash memory. the user should prepare the programming control program and new application program beforehand in the host. 2. programming control program transfer when boot mode is entered, the boot program in this lsi (originally incorporated in the chip) is started and the programming control program in the host is transferred to ram via sci communication. the boot program required for flash memory erasing is automatically transferred to the ram boot program area. 3. flash memory initialization the erase program in the boot program area (in ram) is executed, and the flash memory is initialized (to h?ff). in boot mode, total flash memory erasure is performed, without regard to blocks. 4. writing new application program the programming control program transferred from the host to ram is executed, and the new application program in the host is written into the flash memory. programming control program boot program boot program boot program area boot program area programming control program figure 19.3 boot mode (example)
rev. 2.00, 05/03, page 609 of 846 flash memory this lsi ram host programming/ erase control program sci boot program new application program flash memory this lsi ram host sci new application program flash memory this lsi ram host sci flash memory erase boot program new application program flash memory this lsi program execution state ram host sci boot program boot program fwe assessment program application program (old version) new application program 1. initial state the fwe assessment program that confirms that user program mode has been entered, and the program that will transfer the programming/erase control program from flash memory to on-chip ram should be written into the flash memory by the user beforehand. the programming/erase control program should be prepared in the host or in the flash memory. 2. programming/erase control program transfer when user program mode is entered, user software confirms this fact, executes transfer program in the flash memory, and transfers the programming/erase control program to ram. 3. flash memory initialization the programming/erase program in ram is executed, and the flash memory is initialized (to h ? ff). erasing can be performed in block units, but not in byte units. 4. writing new application program next, the new application program in the host is written into the erased flash memory blocks. do not write to unerased blocks. programming/ erase control program programming/ erase control program programming/ erase control program transfer program application program (old version) transfer program fwe assessment program fwe assessment program transfer program fwe assessment program transfer program figure 19.4 user program mode (example)
rev. 2.00, 05/03, page 610 of 846 19.3 block configuration figure 19.5 shows the block configuration of 384-kbyte flash memory. figure 19.6 shows the block configuration of 256-kbyte flash memory. figure 19.7 shows the block configuration of 128-kbyte flash memory. the thick lines indicate erasing units, the narrow lines indicate programming units, and the values are addresses. the 384-kbyte flash memory is divided into 4 kbytes (8 blocks), 32 kbytes (1 block), and 64 kbytes (5 blocks). the 256-kbyte flash memory is divided into 4 kbytes (8 blocks), 32 kbytes (1 block), and 64 kbytes (3 blocks). the 128-kbyte flash memory is divided into 1 kbyte (4 blocks), 16 kbytes (1 block), 28 kbytes (1 block), 8 kbytes (2 blocks), and 32 kbytes (2 blocks). erasing is performed in these units. programming is performed in 128-byte units starting from an address with lower eight bits h'00 or h'80.
rev. 2.00, 05/03, page 611 of 846 eb0 erase unit 4 kbytes eb1 erase unit 4 kbytes eb2 erase unit 4 kbytes eb3 erase unit 4 kbytes eb4 erase unit 4 kbytes eb5 erase unit 4 kbytes eb6 erase unit 4 kbytes eb7 erase unit 4 kbytes eb8 erase unit 32 kbytes eb9 erase unit 64 kbytes h ? 000000 h ? 000001 h ? 000002 h ? 00007f h ? 000fff h ? 00107f h ? 00207f h ? 00307f h ? 00407f h ? 004fff h ? 00507f h ? 005fff h ? 001fff h ? 002fff h ? 003fff h ? 01ffff h ? 00607f h ? 006fff h ? 00707f h ? 007fff h ? 00807f h ? 00ffff h ? 01007f h ? 001000 h ? 001001 h ? 001002 h ? 002000 h ? 002001 h ? 002002 h ? 003000 h ? 003001 h ? 003002 h ? 004000 h ? 004001 h ? 004002 h ? 005000 h ? 005001 h ? 005002 h ? 006000 h ? 006001 h ? 006002 h ? 007000 h ? 007001 h ? 007002 h ? 008000 h ? 008001 h ? 008002 h ? 010000 h ? 010001 h ? 010002 programming unit: 128 bytes programming unit: 128 bytes eb10 erase unit 64 kbytes h ? 02007f h ? 02ffff h ? 020000 h ? 020001 h ? 020002 programming unit: 128 bytes eb11 erase unit 64 kbytes h ? 03007f h ? 05ffff h ? 030000 h ? 030001 h ? 030002 programming unit: 128 bytes programming unit: 128 bytes programming unit: 128 bytes programming unit: 128 bytes programming unit: 128 bytes programming unit: 128 bytes programming unit: 128 bytes programming unit: 128 bytes programming unit: 128 bytes eb12 erase unit 64 kbytes h ? 04007f h ? 04ffff h ? 040000 h ? 040001 h ? 040002 programming unit: 128 bytes eb13 erase unit 64 kbytes h ? 05007f h ? 03ffff h ? 050000 h ? 050001 h ? 050002 programming unit: 128 bytes figure 19.5 block configuration of 384-kbyte flash memory
rev. 2.00, 05/03, page 612 of 846 eb0 erase unit 4 kbytes eb1 erase unit 4 kbytes eb2 erase unit 4 kbytes eb3 erase unit 4 kbytes eb4 erase unit 4 kbytes eb5 erase unit 4 kbytes eb6 erase unit 4 kbytes eb7 erase unit 4 kbytes eb8 erase unit 32 kbytes eb9 erase unit 64 kbytes h ? 000000 h ? 000001 h ? 000002 h ? 00007f h ? 000fff h ? 00107f h ? 00207f h ? 00307f h ? 00407f h ? 004fff h ? 00507f h ? 005fff h ? 001fff h ? 002fff h ? 003fff h ? 01ffff h ? 00607f h ? 006fff h ? 00707f h ? 007fff h ? 00807f h ? 00ffff h ? 01007f h ? 001000 h ? 001001 h ? 001002 h ? 002000 h ? 002001 h ? 002002 h ? 003000 h ? 003001 h ? 003002 h ? 004000 h ? 004001 h ? 004002 h ? 005000 h ? 005001 h ? 005002 h ? 006000 h ? 006001 h ? 006002 h ? 007000 h ? 007001 h ? 007002 h ? 008000 h ? 008001 h ? 008002 h ? 010000 h ? 010001 h ? 010002 programming unit: 128 bytes programming unit: 128 bytes programming unit: 128 bytes programming unit: 128 bytes programming unit: 128 bytes programming unit: 128 bytes programming unit: 128 bytes programming unit: 128 bytes programming unit: 128 bytes programming unit: 128 bytes eb10 erase unit 32 kbytes eb11 erase unit 64 kbytes h ? 03ffff h ? 02007f h ? 02ffff h ? 03007f h ? 020000 h ? 020001 h ? 020002 h ? 030000 h ? 030001 h ? 030002 programming unit: 128 bytes programming unit: 128 bytes figure 19.6 block configuration of 256-kbyte flash memory
rev. 2.00, 05/03, page 613 of 846 eb0 erase unit 1 kbyte eb1 erase unit 1 kbyte eb2 erase unit 1 kbyte eb3 erase unit 1 kbyte eb4 erase unit 28 kbytes eb5 erase unit 16 kbytes eb6 erase unit 8 kbytes eb7 erase unit 8 kbytes eb8 erase unit 32 kbytes eb9 erase unit 32 kbytes h ? 000000 h ? 000001 h ? 000002 h ? 000380 h ? 000381 h ? 000382 h ? 000780 h ? 000781 h ? 000782 h ? 00007f h ? 0003ff h ? 00047f h ? 00087f h ? 000c7f h ? 00107f h ? 007fff h ? 00807f h ? 00bfff h ? 0007ff h ? 000bff h ? 000fff h ? 01ffff h ? 00c07f h ? 00dfff h ? 00e07f h ? 00ffff h ? 01007f h ? 017fff h ? 01807f h ? 000400 h ? 000401 h ? 000402 h ? 000800 h ? 000801 h ? 000802 h ? 000b80 h ? 000b81 h ? 000b82 h ? 000c00 h ? 000c01 h ? 000c02 h ? 000f80 h ? 000f81 h ? 000f82 h ? 001000 h ? 001001 h ? 001002 h ? 007f80 h ? 007f81 h ? 007f82 h ? 008000 h ? 008001 h ? 008002 h ? 00bf80 h ? 00bf81 h ? 00bf82 h ? 00c000 h ? 00c001 h ? 00c002 h ? 00df80 h ? 00df81 h ? 00df82 h ? 00e000 h ? 00e001 h ? 00e002 h ? 00ff80 h ? 00ff81 h ? 00ff82 h ? 01ff80 h ? 01ff81 h ? 01ff82 h ? 017f80 h ? 017f81 h ? 017f82 h ? 010000 h ? 010001 h ? 010002 h ? 018000 h ? 018001 h ? 018002 programming unit: 128 bytes programming unit: 128 bytes programming unit: 128 bytes programming unit: 128 bytes programming unit: 128 bytes programming unit: 128 bytes programming unit: 128 bytes programming unit: 128 bytes programming unit: 128 bytes programming unit: 128 bytes figure 19.7 block configuration of 128-kbyte flash memory
rev. 2.00, 05/03, page 614 of 846 19.4 input/output pins the flash memory is controlled by means of the pins shown in table 19.2. table 19.2 pin configuration pin name i/o function res input reset fwe input flash program/erase protection by hardware md2 input sets this lsi's operating mode md1 input sets this lsi's operating mode md0 input sets this lsi's operating mode pf0 input sets mcu operating mode in programmer mode p16 input sets mcu operating mode in programmer mode p14 input sets mcu operating mode in programmer mode txd * output serial transmit data output rxd * input serial receive data input note: * sci_2 (txd2, txd2) is used for the h8s/2239 and h8s/2238, and sci_0 (txd0, rxd0) for the h8s/2227. 19.5 register descriptions the flash memory has the following registers. ? flash memory control register 1 (flmcr1) ? flash memory control register 2 (flmcr2) ? erase block register 1 (ebr1) ? erase block register 2 (ebr2) ? ram emulation register (ramer) ? flash memory power control register (flpwcr) ? serial control register x (scrx) the registers described above are not present in the masked rom version. if a register described above is read in the masked rom version, an undefined value will be returned.
rev. 2.00, 05/03, page 615 of 846 19.5.1 flash memory control register 1 (flmcr1) flmcr1 is a register that makes the flash memory change to program mode, program-verify mode, erase mode, or erase-verify mode. for details on register setting, refer to section 19.8, flash memory programming/erasing. bit bit name initial value r/w description 7fwe ? r flash write enable bit reflects the input level at the fwe pin. it is set to 1 when a low level is input to the fwe pin, and cleared to 0 when a high level is input. when this bit is cleared to 0, the flash memory changes to hardware protect mode. 6 swe1 0 r/w software write enable bit when this bit is set to 1, flash memory programming/erasing is enabled. when this bit is cleared to 0, bits 5 to 0 in flmcr1 register and all ebr1 and ebr2 bits cannot be set. [setting condition] when fwe = 1 5 esu1 0 r/w erase setup bit when this bit is set to 1, the flash memory changes to the erase setup state. when it is cleared to 0, the erase setup state is cancelled. set this bit to 1 before setting the e1 bit in flmcr1. [setting condition] when fwe = 1 and swe1 = 1 4 psu1 0 r/w program setup bit when this bit is set to 1, the flash memory changes to the program setup state. when it is cleared to 0, the program setup state is cancelled. set this bit to 1 before setting the p1 bit in flmcr1. [setting condition] when fwe = 1 and swe1 = 1 3 ev1 0 r/w erase-verify when this bit is set to 1, the flash memory changes to erase-verify mode. when it is cleared to 0, erase-verify mode is cancelled. [setting condition] when fwe = 1 and swe1 = 1
rev. 2.00, 05/03, page 616 of 846 bit bit name initial value r/w description 2 pv1 0 r/w program-verify when this bit is set to 1, the flash memory changes to program-verify mode. when it is cleared to 0, program-verify mode is cancelled. [setting condition] when fwe = 1 and swe1 = 1 1e1 0 r/werase when this bit is set to 1, and while the swe1 and esu1 bits are 1, the flash memory changes to erase mode. when it is cleared to 0, erase mode is cancelled. [setting condition] when fwe = 1, swe1 = 1, and esu1 = 1 0 p1 0 r/w program when this bit is set to 1, and while the swe1 and psu1 bits are 1, the flash memory changes to program mode. when it is cleared to 0, program mode is cancelled. when fwe = 1, swe1 = 1, and psu1 = 1 19.5.2 flash memory control register 2 (flmcr2) flmcr2 is a register that displays the state of flash memory programming/erasing. flmcr2 is a read-only register, and should not be written to. bit bit name initial value r/w description 7 fler 0 r indicates that an error has occurred during an operation on flash memory (programming or erasing). when fler is set to 1, flash memory goes to the error-protection state. see section 19.9.3, error protection, for details. 6 to 0 ? all 0 r reserved these bits are always read as 0. 19.5.3 erase block register 1 (ebr1) ebr1 specifies the flash memory erase area block. ebr1 is initialized to h'00 when the swe1 bit in flmcr1 is 0. do not set more than one bit at a time, as this will cause all the bits in ebr1 and ebr2 to be automatically cleared to 0.
rev. 2.00, 05/03, page 617 of 846 ? 384-kbyte or 256-kbyte flash memory bit bit name initial value r/w description 7 eb7 0 r/w when this bit is set to 1, 4 kbytes of eb7 (h'007000 to h'007fff) will be erased. 6 eb6 0 r/w when this bit is set to 1, 4 kbytes of eb6 (h'006000 to h'006fff) will be erased. 5 eb5 0 r/w when this bit is set to 1, 4 kbytes of eb5 (h'005000 to h'005fff) will be erased. 4 eb4 0 r/w when this bit is set to 1, 4 kbytes of eb4 (h'004000 to h'004fff) will be erased. 3 eb3 0 r/w when this bit is set to 1, 4 kbytes of eb3 (h'003000 to h'003fff) will be erased. 2 eb2 0 r/w when this bit is set to 1, 4 kbytes of eb2 (h'002000 to h'002fff) will be erased. 1 eb1 0 r/w when this bit is set to 1, 4 kbytes of eb1 (h'001000 to h'001fff) will be erased. 0 eb0 0 r/w when this bit is set to 1, 4 kbytes of eb0 (h'000000 to h'000fff) will be erased. ? 128-kbyte flash memory bit bit name initial value r/w description 7 eb7 0 r/w when this bit is set to 1, 8 kbytes of eb7 (h'00e000 to h'00ffff) will be erased. 6 eb6 0 r/w when this bit is set to 1, 8 kbytes of eb6 (h'00c000 to h'00dfff) will be erased. 5 eb5 0 r/w when this bit is set to 1, 16 kbytes of eb5 (h'008000 to h'00bfff) will be erased. 4 eb4 0 r/w when this bit is set to 1, 28 kbytes of eb4 (h'001000 to h'007fff) will be erased. 3 eb3 0 r/w when this bit is set to 1, 1 kbyte of eb3 (h'000c00 to h'000fff) will be erased. 2 eb2 0 r/w when this bit is set to 1, 1 kbyte of eb2 (h'000800 to h'000bff) will be erased. 1 eb1 0 r/w when this bit is set to 1, 1 kbyte of eb1 (h'000400 to h'0007ff) will be erased. 0 eb0 0 r/w when this bit is set to 1, 1 kbyte of eb0 (h'000000 to h'0003ff) will be erased.
rev. 2.00, 05/03, page 618 of 846 19.5.4 erase block register 2 (ebr2) ebr2 specifies the flash memory erase area block. ebr1 is initialized to h'00 when the swe1 bit in flmcr1 is 0. do not set more than one bit at a time, as this will cause all the bits in ebr1 and ebr2 to be automatically cleared to 0. ? 384-kbyte flash memory bit bit name initial value r/w description 7 6 ? ? 0 0 r/w r/w reserved these bits are always read as 0. the write value should always be 0. 5 eb13 0 r/w when this bit is set to 1, 64 kbytes of eb13 (h'050000 to h'05ffff) will be erased. 4 eb12 0 r/w when this bit is 1, 64 kbytes of eb12 (h'040000 to h'04ffff) will be erased. 3 eb11 0 r/w when this bit is set to 1, 64 kbytes of eb11 (h'030000 to h'03ffff) will be erased. 2 eb10 0 r/w when this bit is set to 1, 64 kbytes of eb10 (h'020000 to h'02ffff) will be erased. 1 eb9 0 r/w when this bit is set to 1, 64 kbytes of eb9 (h'010000 to h'01ffff) will be erased. 0 eb8 0 r/w when this bit is set to 1, 32 kbytes of eb8 (h'008000 to h'00ffff) will be erased. ? 256-kbyte flash memory bit bit name initial value r/w description 7 to 4 ? all 0 r/(w) reserved initial values should not be changed. 3 eb11 0 r/w when this bit is set to 1, 64 kbytes of eb11 (h'030000 to h'03ffff) will be erased. 2 eb10 0 r/w when this bit is set to 1, 64 kbytes of eb10 (h'020000 to h'02ffff) will be erased. 1 eb9 0 r/w when this bit is set to 1, 64 kbytes of eb9 (h'010000 to h'01ffff) will be erased. 0 eb8 0 r/w when this bit is set to 1, 32 kbytes of eb8 (h'008000 to h'00ffff) will be erased.
rev. 2.00, 05/03, page 619 of 846 ? 128-kbyte flash memory bit bit name initial value r/w description 7 to 2 ? all 0 r/w reserved initial values should not be changed. 1 eb9 0 r/w when this bit is set to 1, 32 kbytes of eb9 (h'018000 to h'01ffff) will be erased. 0 eb8 0 r/w when this bit is set to 1, 32 kbytes of eb8 (h'010000 to h'017fff) will be erased. 19.5.5 ram emulation register (ramer) ramer specifies the area of flash memory to be overlapped with part of ram when emulating real-time flash memory programming. ramer settings should be made in user mode or user program mode. to ensure correct operation of the emulation function, the rom for which ram emulation is performed should not be accessed immediately after this register has been modified. normal execution of an access immediately after register modification is not guaranteed. bit bit name initial value r/w description 7 to 5 ? all 0 r reserved these bits are always read as 0. 4 ? 0r/wreserved only 0 should be written to this bit. 3 rams 0 r/w ram select specifies selection or non-selection of flash memory emulation in ram. when rams = 1, the flash memory is overlapped with part of ram, and all flash memory block are program/erase- protected.
rev. 2.00, 05/03, page 620 of 846 bit bit name initial value r/w description 2 1 0 ram2 ram1 ram0 0 0 0 r/w r/w r/w flash memory area selection when the rams bit is set to 1, one of the following flash memory areas is selected to overlap the ram area. the areas correspond with 4-kbyte erase blocks for the 384-kbyte or 256-kbyte flash memory, 1-kbyte erase block for the 128-kbyte flash memory. 384-kbyte or 256-kbyte flash memory 000: h'000000 to h'000fff (eb0) 001: h'001000 to h'001fff (eb1) 010: h'002000 to h'002fff (eb2) 011: h'003000 to h'003fff (eb3) 100: h'004000 to h'004fff (eb4) 101: h'005000 to h'005fff (eb5) 110: h'006000 to h'006fff (eb6) 111: h'007000 to h'007fff (eb7) 128-kbyte flash memory 000: h'000000 to h'0003ff (eb0) 001: h'000400 to h'0007ff (eb1) 010: h'000800 to h'000bff (eb2) 011: h'000c00 to h'000fff (eb3) 100: setting prohibited 101: setting prohibited 110: setting prohibited 111: setting prohibited
rev. 2.00, 05/03, page 621 of 846 19.5.6 flash memory power control register (flpwcr) flpwcr enables/disables transition to power-down modes for the flash memory when this lsi enters sub-active mode. bit bit name initial value r/w description 7 pdwnd 0 r/w power down disable enables/disables transition to power-down modes for the flash memory when this lsi enters sub- active mode. 0: transition to power-down modes for the flash memory enabled. 1: transition to power-down modes for the flash memory disabled. 6 to 0 ? all 0 r reserved these bits are always read as 0. 19.5.7 serial control register x (scrx) scrx performs register access control. bit bit name initial value r/w description 7 ? 0r/wreserved only 0 should be written to this bit. 6 5 iicx1 iicx0 0 0 r/w r/w i 2 c transfer select 1, 0 for details, see section 15.3.5, serial control register x (scrx). 4 iice 0 r/w i 2 c master enable for details, see section 15.3.5, serial control register x (scrx).
rev. 2.00, 05/03, page 622 of 846 bit bit name initial value r/w description 3 flshe 0 r/w flash memory control register enable controls for the cpu accessing to the control registers (flmcr1, flmcr2, ebr1, ebr2) of the flash memory. when this bit is set to 1, the flash memory control registers can be read/written to. when this bit is cleared to 0, the flash memory control registers are not selected. at this time, the contents of the flash memory control registers are retained. 0: area at h'ffffa8 to h'ffffac not selected for the flash memory control registers. 1: area at h'ffffa8 to h'ffffac selected for the flash memory control registers. 2 to 0 ? all 0 r/w reserved only 0 should be written to these bits.
rev. 2.00, 05/03, page 623 of 846 19.6 on-board programming modes when pins are set to on-board programming mode, program/erase/verify operations can be performed on the on-chip flash memory. there are two on-board programming modes: boot mode and user program mode. the pin settings for transition to each of these modes are shown in table 19.3. for a diagram of the transitions to the various flash memory modes, see figure 19.2. table 19.3 setting on-board programming modes fwe md2 md1 md0 mode setting 1010ext ended mode 1011single-chip mode boot mode 1110ext ended mode 1111single-chip mode user program mode 19.6.1 boot mode table 19.4 shows the boot mode operations between reset end and branching to the programming control program. 1. when boot mode is used, the flash memory programming control program must be prepared in the host beforehand. prepare a programming control program in accordance with the description in section 19.8, flash memory programming/erasing. in boot mode, if any data has been programmed into the flash memory (if all data is not 1), all flash memory blocks are erased. boot mode is for use when user program mode is unavailable, such as the first time on-board programming is performed, or if the program activated in user program mode is accidentally erased. 2. sci should be set to asynchronous mode, and the transfer format as follows: 8-bit data, 1 stop bit, and no parity. 3. when the boot program is initiated, the chip measures the low-level period of asynchronous sci communication data (h'00) transmitted continuously from the host. the chip then calculates the bit rate of transmission from the host, and adjusts the sci bit rate to match that of the host. the reset should end with the rxd pin high. the rxd and txd pins should be pulled up on the board if necessary. after the reset is complete, it takes approximately 100 states before the chip is ready to measure the low-level period.
rev. 2.00, 05/03, page 624 of 846 4. after matching the bit rates, the chip transmits one h'00 byte to the host to indicate the completion of bit rate adjustment. the host should confirm that this adjustment end indication (h'00) has been received normally, and transmit one h'55 byte to the chip. if reception could not be performed normally, initiate boot mode again by a reset. depending on the host's transfer bit rate and system clock frequency of this lsi, there will be a discrepancy between the bit rates of the host and the chip. to operate the sci properly, set the host's transfer bit rate and system clock frequency of this lsi within the ranges listed in table 19.5. 5. in boot mode, a part of the on-chip ram area is used by the boot program. the area h'ffc000 to h'ffdfff is the area to which the programming control program is transferred from the host. the boot program area cannot be used until the execution state in boot mode switches to the programming control program. 6. before branching to the programming control program, the chip terminates transfer operations by sci (by clearing the re and te bits in scr to 0), however the adjusted bit rate value remains set in brr. therefore, the programming control program can still use it for transfer of write data or verify data with the host. the txd pin is high. the contents of the cpu general registers are undefined immediately after branching to the programming control program. these registers must be initialized at the beginning of the programming control program, as the stack pointer (sp), in particular, is used implicitly in subroutine calls, etc. 7. boot mode can be cleared by driving the reset pin low, waiting at least 20 states, then setting the fwe pin and mode pins, and executing reset release * . boot mode is also cleared when a wdt overflow occurs. 8. all interrupts are disabled during programming or erasing of the flash memory. note: * the input signals on the fwe and mode pins must satisfy the mode programming setup time (t mds = 200 ns) at the reset release timing.
rev. 2.00, 05/03, page 625 of 846 table 19.4 boot mode operation item host operation communications contents lsi operation boot mode start branches to boot program at reset-start. processing contents processing contents bit rate adjustment continuously transmits data h ? 00 at specified bit rate. h ? 00, h ? 00 ...... h ? 00 h ? 00 h ? 55  measures low-level period of receive data h ? 00.  calculates bit rate and sets it in brr of sci.  transmits data h ? 00 to host as adjustment end indication. transmits data h ? aa to host when data h ? 55 is received. transmits data h ? 55 when data h ? 00 is received error-free. transmits number of bytes (n) of programming control program to be transferred as 2-byte data (low-order byte following high-order byte) receives data h ? aa. transmits 1-byte of programming control program (repeated for n times) receives data h ? aa. transfer of programming control program flash memory erase boot program initiation echobacks the 2-byte data received. branches to programming control program transferred to on-chip ram and starts execution. echobacks received data to host and also transfers it to ram (repeated for n times) checks flash memory data, erases all flash memory blocks in case of written data existing, and transmits data h ? aa to host. (if erase could not be done, transmits data h ? ff to host and aborts operation.) high-order byte and low-order byte h ? xx h ? aa echoback echoback h ? ff h ? aa boot program erase error table 19.5 system clock frequencies for which automatic adjustment of lsi bit rate is possible system clock frequency range of this lsi host bit rate h8s/2227, h8s/2238 h8s/2239 19,200 bps 8 to 13.5 mhz 8 to 20 mhz 9,600 bps 4 to 13.5 mhz 4 to 20 mhz 4,800 bps 2 to 13.5 mhz 2 to 20 mhz
rev. 2.00, 05/03, page 626 of 846 19.6.2 programming/erasing in user program mode on-board programming/erasing of an individual flash memory block can also be performed in user program mode by branching to a user program/erase control program. the user must prepare on- board means for controlling fwe, on-board means of supplying programming data, and branching conditions. the flash memory must contain the user program/erase control program or a program that provides the user program/erase control program from external memory. as the flash memory itself cannot be read during programming/erasing, transfer the user program/erase control program to on-chip ram, as in boot mode. figure 19.8 shows a sample procedure for programming/erasing in user program mode. prepare a user program/erase control program in accordance with the description in section 19.8, flash memory programming/erasing. yes no program/erase? transfer user program/erase control program to ram reset-start branch to user program/erase control program in ram execute user program/erase control program (flash memory rewrite) branch to flash memory application program branch to flash memory application program figure 19.8 programming/erasing flowchart example in user program mode
rev. 2.00, 05/03, page 627 of 846 19.7 flash memory emulation in ram a setting in the ram emulation register (ramer) enables part of ram to be overlapped onto the flash memory area so that data to be written to flash memory can be emulated in ram in real time. emulation can be performed in user mode or user program mode. figure19.9 shows an example of emulation of real-time flash memory programming. 1. set ramer to overlap part of ram onto the area for which real-time programming is required. 2. emulation is performed using the overlapping ram. 3. after the program data has been confirmed, the rams bit is cleared, thus releasing the ram overlap. 4. the data written in the overlapping ram is written into the flash memory space. start of emulation program set ramer write tuning data to overlap ram execute application program tuning ok? clear ramer write to flash memory emulation block end of emulation program no yes figure 19.9 flowchart for flash memory emulation in ram
rev. 2.00, 05/03, page 628 of 846 an example in which flash memory block area eb1 is overlapped is shown in figure 19.10. 1. the ram area to be overlapped is fixed at a 4-kbyte area in the range h'ffd000 to h'ffdfff in the 384-kbyte or 256-kbyte flash memory . the ram area to be overlapped is fixed at a 1- kbyte area in the range h'ffd000 to h'ffd3ff in the 128-kbyte flash memory. 2. the flash memory area to be overlapped is selected by ramer from a 4-kbyte area of the eb0 to eb7 blocks. 3. the overlapped ram area can be accessed from both the flash memory addresses and ram addresses. 4. when the rams bit in ramer is set to 1, program/erase protection is enabled for all flash memory blocks (emulation protection). in this state, setting the p1 or e1 bit in flmcr1 to 1 does not cause a transition to program mode or erase mode. 5. a ram area cannot be erased by execution of software in accordance with the erase algorithm. 6. block area eb0 contains the vector table. when performing ram emulation, the vector table is needed in the overlap ram. h ? 000000 h ? 001000 h ? 002000 h ? 003000 h ? ffd000 h ? ffdfff flash memory (eb0) flash memory (eb0) (eb1) (eb2) (eb3) on-chip ram (4 kbytes) on-chip ram (shadow of h ? ffe000 to h ? ffdfff) flash memory (eb2) on-chip ram (4 kbytes) (eb3) normal memory map ram overlap memory map figure 19.10 example of ram overlap operation
rev. 2.00, 05/03, page 629 of 846 19.8 flash memory programming/erasing a software method using the cpu is employed to program and erase flash memory in the on- board programming modes. depending on the flmcr1 setting, the flash memory operates in one of the following four modes: program mode, program-verify mode, erase mode, and erase-verify mode. the programming control program in boot mode and the user program/erase control program in user program mode use these operating modes in combination to perform programming/erasing. flash memory programming and erasing should be performed in accordance with the descriptions in section 19.8.1, program/program-verify and section 19.8.2, erase/erase-verify, respectively. 19.8.1 program/program-verify when writing data or programs to the flash memory, the program/program-verify flowchart shown in figure 19.11 should be followed. performing programming operations according to this flowchart will enable data or programs to be written to the flash memory without subjecting the chip to voltage stress or sacrificing program data reliability. 1. programming must be done to an empty address. do not reprogram an address to which programming has already been performed. 2. programming should be carried out 128 bytes at a time. a 128-byte data transfer must be performed even if writing fewer than 128 bytes. in this case, h'ff data must be written to the extra addresses. 3. prepare the following data storage areas in ram: a 128-byte programming data area, a 128- byte reprogramming data area, and a 128-byte additional-programming data area. perform reprogramming data computation and additional programming data computation according to figure 19.11. 4. consecutively transfer 128 bytes of data in byte units from the reprogramming data area or additional-programming data area to the flash memory. the program address and 128-byte data are latched in the flash memory. the lower 8 bits of the start address in the flash memory destination area must be h'00 or h'80. 5. the time during which the p1 bit is set to 1 is the programming time. figure 19.11 shows the allowable programming times. 6. the watchdog timer (wdt) is set to prevent overprogramming due to program runaway, etc. set a value greater than (t spsu + t sp200 + t cp + t cpsu ) s as the wdt overflow period. 7. for a dummy write to a verify address, write 1-byte data h'ff to an address whose lower 2 bits are b'00. verify data can be read in longwords from the address to which a dummy write was performed. 8. the maximum number of repetitions of the program/program-verify sequence of the same bit is (n).
rev. 2.00, 05/03, page 630 of 846 start end of programming set swe1 bit in flmcr1 start of programming write pulse application subroutine wait (t sswe ) 1 s sub-routine write pulse end sub set psu1 bit in flmcr1 wdt enable disable wdt number of writes n 1 2 3 4 5 6 7 8 9 10 11 12 13 998 999 1000 note * 6: write pulse width write time (tsp30/tsp200) s 30 30 30 30 30 30 200 200 200 200 200 200 200 200 200 200 wait (t spsu ) 50 s set p1 bit in flmcr1 wait t sp10 or t sp30 or t sp200 clear p1 bit in flmcr1 wait (t cp ) 5 s clear psu1 bit in flmcr1 wait (t cpsu ) 5 s n= 1 m= 0 no no no no yes yes yes wait (t spv ) 4 s t spvr = wait 2 s * 2 * 4 start of programming end of programming * 5 * 1 wait (t cpv ) s apply write pulse t sp 30 or t sp 200 sub-routine-call set pv1 bit in flmcr1 h'ff dummy write to verify address read verify data write data = verify data? * 4 * 3 * 1 transfer reprogram data to reprogram data area reprogram data computation * 4 transfer additional-programming data to additional-programming data area additional-programming data computation clear pv1 bit in flmcr1 clear swe1 bit in flmcr1 m = 1 reprogram see note * 6 for pulse width m= 0 ? increment address programming failure yes clear swe1 bit in flmcr1 wait (t cswe ) 100 s no yes 6 n? no yes 6 n ? wait (t cswe ) 100 s n 1000? n n + 1 original data (d) verify data (v) reprogram data (x) comments programming completed still in erased state; no action programming incomplete; reprogram note: use a 10 s write pulse for additional programming. write 128-byte data in ram reprogram data area consecutively to flash memory ram program data storage area (128 bytes) reprogram data storage area (128 bytes) additional-programming data storage area (128 bytes) store 128-byte program data in program data area and reprogram data area apply write pulse (additional programming) sub-routine-call 128-byte data verification completed? successively write 128-byte data from additional- programming data area in ram to flash memory reprogram data computation table reprogram data (x') verify data (v) additional- programming data (y) 1 1 1 1 0 1 0 0 0 0 1 1 comments additional programming to be executed additional programming not to be executed additional programming not to be executed additional programming not to be executed 0 1 1 1 0 1 0 1 0 0 1 1 additional-programming data computation table perform programming in the erased state. do not perform additional programming on previously programmed addresses. notes: * 1 data transfer is performed by byte transfer. the lower 8 bits of the first address written to must be h'00 or h'80. a 128-byte data transfer must be performed even if writing fewer than 128 bytes; in this case, h'ff data must be written to t he extra addresses. * 2 verify data is read in 16-bit (word) units. * 3 reprogram data is determined by the operation shown in the table below (comparison between the data stored in the program dat a area and the verify data). bits for which the reprogram data is 0 are programmed in the next reprogramming loop. therefore, even bits for which programming has bee n completed will be subjected to programming once again if the result of the subsequent verify operation is ng. * 4 a 128-byte area for storing program data, a 128-byte area for storing reprogram data, and a 128-byte area for storing additio nal data must be provided in ram. the contents of the reprogram data area and additional data area are modified as programming proceeds. * 5 a write pulse of 30 s or 200 s is applied according to the progress of the programming operation. see note * 6 for details of the pulse widths. when writing of additional-programming data is executed, a 10 s write pulse should be applied. reprogram data x' means reprogram data when the write pulse is applied. figure 19.11 program/program-verify flowchart
rev. 2.00, 05/03, page 631 of 846 19.8.2 erase/erase-verify when erasing flash memory, the erase/erase-verify flowchart shown in figure 19.12 should be followed. 1. prewriting (setting erase block data to all 0) is not necessary. 2. erasing is performed in block units. make only a single-bit specification in the erase block register 1 and 2 (ebr1 and ebr2). to erase multiple blocks, each block must be erased in turn. 3. the time during which the e1 bit is set to 1 is the flash memory erase time. 4. the watchdog timer (wdt) is set to prevent overprogramming due to program runaway, etc. set a value greater than (t sesu + t se + t ce + t cesu ) ms as the wdt overflow period. 5. for a dummy write to a verify address, write 1-byte data h'ff to an address whose lower two bits are b'00. verify data can be read in words from the address to which a dummy write was performed. 6. if the read data is not erased successfully, set erase mode again, and repeat the erase/erase- verify sequence as before. the maximum number of repetitions of the erase/erase-verify sequence is (n).
rev. 2.00, 05/03, page 632 of 846 erase start set ebr1 (2) enable wdt disable wdt read verify data increment address verify data = all 1? last address of block? all erase block erased? set block start address as verify address h'ff dummy write to verify address swe1 bit in flmcr1 1 n = 1 esu1 bit in flmcr1 1 e1 bit in flmcr1 1 start erasing stop erasing tsswe: wait 1 s tsswe: wait 100 s e1 bit in flmcr1 0 ev1 bit in flmcr 1 tse: wait 10 ms esu1 bit in flmcr1 0 tce: wait 10 s tcesu: wait 10 s tsev: wait 20 s ev1 bit in flmcr 0 n n + 1 tcer: wait 4 s swe1 bit in flmcr1 0 tcswe: wait 100 s ev1 bit in flmcr 0 n 100? tcer: wait 4 s swe1 bit in flmcr1 0 tcswe: wait 100 s erase failure end of erasing tsevr: wait 2 s no yes yes no no no yes yes * 1 * 3 * 2 * 4 erasing should be done to a block * 1 pre-writing (all erase block data are cleared to 0) is not necessary. * 2 verify data is read out in 16 bit size (word access). * 3 erasing block register (ebr) can be set about 1 bit at a time. do not specify 2 bits or more. * 4 erasing is performed block by block. when multiple blocks must be erased, erase each lock one by one. notes: figure 19.12 erase/erase-verify flowchart
rev. 2.00, 05/03, page 633 of 846 19.9 program/erase protection there are three kinds of flash memory program/erase protection; hardware protection, software protection, and error protection. 19.9.1 hardware protection hardware protection refers to a state in which programming/erasing of flash memory is forcibly disabled or aborted because of a transition to reset or standby mode. flash memory control register 1 (flmcr1), flash memory control register 2 (flmcr2), erase block register 1 (ebr1), and erase block register 2 (ebr2) are initialized. in a reset via the res pin, the reset state is not entered unless the res pin is held low until oscillation stabilizes after powering on. in the case of a reset during operation, hold the res pin low for the res pulse width specified in the ac characteristics section. 19.9.2 software protection software protection can be implemented against programming/erasing of all flash memory blocks by clearing the swe1 bit in flmcr1. when software protection is in effect, setting the p1 or e1 bit in flmcr1 does not cause a transition to program mode or erase mode. by setting the erase block register 1 and 2 (ebr1 and ebr2), erase protection can be set for individual blocks. when ebr1 and ebr2 are set to h'00, erase protection is set for all blocks. by setting bit rams in ramer, programming/erase protection is set for all blocks. 19.9.3 error protection in error protection, an error is detected when cpu runaway occurs during flash memory programming/erasing, or operation is not performed in accordance with the program/erase algorithm, and the program/erase operation is aborted. aborting the program/erase operation prevents damage to the flash memory due to overprogramming or overerasing. when the following errors are detected during programming/erasing of flash memory, the fler bit in flmcr2 is set to 1, and the error protection state is entered. ? when the flash memory of the relevant address area is read during programming/erasing (including vector read and instruction fetch) ? immediately after exception handling (excluding a reset) during programming/erasing ? when a sleep instruction is executed during programming/erasing ? when the cpu releases the bus to the dmac* or dtc during programming/erasing note: * supported only by h8s/2239 group.
rev. 2.00, 05/03, page 634 of 846 the flmcr1, flmcr2, ebr1, and ebr2 settings are retained, however program mode or erase mode is aborted at the point at which the error occurred. program mode or erase mode cannot be re-entered by re-setting the p1 or e1 bit. however, pv1 and ev1 bit setting is enabled, and a transition can be made to verify mode. error protection can be cleared only by a reset or in hardware standby. 19.10 interrupt handling when programming/erasing flash memory all interrupts, including nmi input, are disabled when flash memory is being programmed or erased (when the p1 or e1 bit is set in flmcr1), and while the boot program is executing in boot mode * 1 , to give priority to the program or erase operation. there are three reasons for this: 1. interrupt during programming or erasing might cause a violation of the programming or erasing algorithm, with the result that normal operation could not be assured. 2. in the interrupt exception handling sequence during programming or erasing, the vector would not be read correctly * 2 , possibly resulting in cpu runaway. 3. if an interrupt occurred during boot program execution, it would not be possible to execute the normal boot mode sequence. notes: *1 interrupt requests must be disabled inside and outside the cpu until the programming control program has completed programming. *2 the vector may not be read correctly in this case for the following two reasons: ? if flash memory is read while being programmed or erased (while the p1 or e1 bit is set in flmcr1), correct read data will not be obtained (undetermined values will be returned).  if the interrupt entry in the vector table has not been programmed yet, interrupt exception handling will not be executed correctly. 19.11 programmer mode in programmer mode, a prom programmer can be used to perform programming/erasing via a socket adapter, just as for a discrete flash memory. use a prom programmer which supports the renesas technology 512-kbyte, 256-kbyte, or 128-kbyte flash memory on-chip microcomputer device type. it requires the 12-mhz input clock. the socket adapter pin correspondence diagram is shown in figure 19.13.
rev. 2.00, 05/03, page 635 of 846 this lsi socket adapter (conversion to 40-pin arrangement) fp-100b,tfp-100b, tfp-100g pin no. pin name a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 a18 d0 d1 d2 d3 d4 d5 d6 d7 ce oe we fwe hn27c4096hg (40-pin) pin no. pin name 21 22 23 24 25 26 27 28 29 31 32 33 34 35 36 37 38 39 10 19 18 17 16 15 14 13 12 2 20 3 4 1, 40 11, 30 5, 6, 7 8 9 a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 a18 i/o0 i/o1 i/o2 i/o3 i/o4 i/o5 i/o6 i/o7 ce oe we fwe v cc v ss nc a20 a19 res xtal extal nc (open) 13 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 4 5 6 7 8 9 10 11 3 1 2 66 59 63 65 other than the above 12, 53, 54, 60, 62, 72 * , 75, 99 14, 38, 40,42, 55, 56, 58, 64, 67, 100 v cc v ss oscillator circuit legend fwe: i/o0 to 7: a20 to 0: oe : ce : we : flash write enable data input/output address input output enable chip enable write enable power-on reset circuit note: * supported only by h8s/2238b and h8s/2227 group. fp-100a * 16 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 7 8 9 10 11 12 13 14 6 4 5 69 62 66 68 other than the above 2, 15, 54, 57, 64, 65, 75, 78 3, 17, 41, 43, 45, 58, 59, 61, 67 figure 19.13 socket adapter pin correspondence diagram
rev. 2.00, 05/03, page 636 of 846 19.12 power-down states for flash memory in user mode, the flash memory will operate in either of the following states: ? normal operating mode the flash memory can be read and written to at high speed. ? power-down state the flash memory can be read when part of the power circuit is halted and the lsi operates by subclocks. ? standby mode all flash memory circuits are halted. table 19.6 shows the correspondence between the operating modes of this lsi and the flash memory. when the flash memory returns to its normal operating state from standby mode, a period to stabilize the power supply circuits that were stopped is needed. when the flash memory returns to its normal operating state, bits sts2 to sts0 in sbycr must be set to provide a wait time of at least 100 s, even when the external clock is being used. table 19.6 flash memory operating states lsi operating state flash memory operating state active mode normal operating mode sleep mode normal operating mode watch mode standby mode standby mode subactive mode subsleep mode pdwnd = 0: power-down mode (read only) pdwnd = 1: normal operating mode (read only)
rev. 2.00, 05/03, page 637 of 846 19.13 flash memory programming and erasing precautions precautions concerning the use of on-board programming mode, the ram emulation function, and programmer mode are summarized below. use the specified voltages and timing for programming and erasing: applied voltages in excess of the rating can permanently damage the device. use a prom programmer that supports the renesas technology flash memory on-chip microcomputer device type (fztat512v3a, fztat256v3a, or fztat128v3a). do not select the hn27c4096 setting for the prom programmer, and only use the specified socket adapter. failure to observe these points may result in damage to the device. powering on and off (see figures 19.14 to 19.16): do not apply a high level to the fwe pin until vcc has stabilized. also, drive the fwe pin low before turning off vcc. when applying or disconnecting vcc power, fix the fwe pin low and place the flash memory in the hardware protection state. the power-on and power-off timing requirements should also be satisfied in the event of a power failure and subsequent recovery. fwe application/disconnection (see figures 19.14 to 19.16): fwe application should be carried out when mcu operation is in a stable condition. if mcu operation is not stable, fix the fwe pin low and set the protection state. the following points must be observed concerning fwe application and disconnection to prevent unintentional programming or erasing of flash memory: ? apply fwe when the vcc voltage has stabilized within its rated voltage range. ? in boot mode, apply and disconnect fwe during a reset. ? in user program mode, fwe can be switched between high and low level regardless of the reset state. fwe input can also be switched during execution of a program in flash memory. ? do not apply fwe if program runaway has occurred. ? disconnect fwe only when the swe1, esu1, psu1, ev1, pv1, p1, and e1 bits in flmcr1 are cleared. make sure that the swe1, esu1, psu1, ev1, pv1, p1, and e1 bits are not set by mistake when applying or disconnecting fwe.
rev. 2.00, 05/03, page 638 of 846 do not apply a constant high level to the fwe pin: apply a high level to the fwe pin only when programming or erasing flash memory. a system configuration in which a high level is constantly applied to the fwe pin should be avoided. also, while a high level is applied to the fwe pin, the watchdog timer should be activated to prevent overprogramming or overerasing due to program runaway, etc. use the recommended algorithm when programming and erasing flash memory: the recommended algorithm enables programming and erasing to be carried out without subjecting the device to voltage stress or sacrificing program data reliability. when setting the p1 or e1 bit in flmcr1, the watchdog timer should be set beforehand as a precaution against program runaway, etc. do not set or clear the swe1 bit during execution of a program in flash memory: wait for at least 100 s after clearing the swe1 bit before executing a program or reading data in flash memory. when the swe1 bit is set, data in flash memory can be rewritten. access flash memory only for verify operations (verification during programming/erasing). also, do not clear the swe1 bit during programming, erasing, or verifying. similarly, when using the ram emulation function while a high level is being input to the fwe pin, the swe1 bit must be cleared before executing a program or reading data in flash memory. however, the ram area overlapping flash memory space can be read and written to regardless of whether the swe1 bit is set or cleared. do not use interrupts while flash memory is being programmed or erased: all interrupt requests, including nmi, should be disabled during fwe application to give priority to program/erase operations. do not perform additional programming. erase the memory before reprogramming: in on- board programming, perform only one programming operation on a 128-byte programming unit block. in programmer mode, too, perform only one programming operation on a 128-byte programming unit block. programming should be carried out with the entire programming unit block erased. before programming, check that the chip is correctly mounted in the prom programmer: overcurrent damage to the device can result if the index marks on the prom programmer socket, socket adapter, and chip are not correctly aligned. do not touch the socket adapter or chip during programming: touching either of these can cause contact faults and write errors. reset the flash memory before turning on the power: to reset the flash memory during oscillation stabilization period, the reset signal must be input for at least 100 s.
rev. 2.00, 05/03, page 639 of 846 apply the reset signal while swe is low to reset the flash memory during its operation: the reset signal is applied at least 100 s after the swe bit has been cleared. * 1 * 2 * 3 except when switching modes, the level of the mode pins (md2 to md0) must be fixed until power-off by pulling the pins up or down. see sections 26.2.6, 26.3.6, and 26.4.6, flash memory characteristics. mode programming setup time t mds (min) = 200ns. period during which flash memory access is prohibited (t sswe : wait time after setting swe1 bit) * 2 period during which flash memory can be programmed (execution of program in flash memory prohibited, and data reads other than verify operations prohibited) notes: v cc fwe t osc1 min 0 s min 0 s t mds * 3 t mds * 3 md2, md1 * 1 res swe1bit swe1 set swe1 cleared t sswe 100 s programming/ erasing possible wait time: wait time: figure 19.14 power-on/off timing (boot mode)
rev. 2.00, 05/03, page 640 of 846 swe1 set swe1 cleared v cc fwe t osc1 min 0 s md2,md1 * 1 res swe1 bit t sswe t mds * 3 100 s * 1 * 2 * 3 except when switching modes, the level of the mode pins (md2 to md0) must be fixed until power-off by pulling the pins up or down. see sections 26.2.6, 26.3.6, and 26.4.6, flash memory characteristics. mode programming setup time t mds (min) = 200ns. period during which flash memory access is prohibited (t sswe : wait time after setting swe1 bit) * 2 period during which flash memory can be programmed (execution of program in flash memory prohibited, and data reads other than verify operations prohibited) notes: programming/ erasing possible wait time: wait time: figure 19.15 power-on/off timing (user program mode)
rev. 2.00, 05/03, page 641 of 846 v cc fwe t osc1 min 0ms t mds t mds t mds t resw md2,md1 res swe1 bit mode change * 1 boot mode mode change * 1 user mode user program mode user mode user program mode swe1 set swe1 cleared t sswe * 4 * 4 * 2 * 4 * 4 * 1 * 2 * 3 * 4 when entering boot mode or making a transition from boot mode to another mode, mode switching must be carried out by means of res input when making a transition from boot mode to another mode, a mode programming setup time t mds (min) of 200 ns is necessary with respect to res clearance timing. see sections 26.2.6, 26.3.6, and 26.4.6, flash memory characteristics. wait time: 100 s. period during which flash memory access is prohibited (t sswe : wait time after setting swe1 bit) * 2 period during which flash memory can be programmed (execution of program in flash memory prohibited, and data reads other than verify operations prohibited) notes: wait time: programming/ erasing possible t sswe wait time: programming/ erasing possible t sswe wait time: programming/ erasing possible t sswe wait time: programming/ erasing possible figure 19.16 mode transition timing (example: boot mode user mode ? ? ? ? user program mode)
rev. 2.00, 05/03, page 642 of 846 19.14 note on switching from f-ztat version to masked rom version the masked rom version does not have the internal registers for flash memory control that are provided in the f-ztat version. table 19.7 lists the registers that are present in the f-ztat version but not in the masked rom version. if a register listed in table 19.7 is read in the masked rom version, an undefined value will be returned. therefore, if application software developed on the f-ztat version is switched to a masked rom version product, it must be modified to ensure that the registers in table 19.7 have no effect. table 19.7 registers present in f-ztat version but absent in masked rom version register abbreviation address flash memory control register 1 flmcr1 h'ffa8 flash memory control register 2 flmcr2 h'ffa9 erase block register 1 ebr1 h'ffaa erase block register 2 ebr2 h'ffab ram emulation register ramer h'fedb flash memory power control register flpwcr h'ffac serial control register x (only bit 3) scrx h'fdb4
rev. 2.00, 05/03, page 643 of 846 section 20 masked rom this lsi incorporates a masked rom which has the following features. 20.1 features ? size: product class rom size rom address (modes 6 and 7) h8s/2239 group hd6432239 384 kbytes h'000000 to h'05ffff h8s/2238 group hd6432238b 256 kbytes h'000000 to h'03ffff hd6432236b 128 kbytes h'000000 to h'01ffff hd6432238r 256 kbytes h'000000 to h'03ffff hd6432236r 128 kbytes h'000000 to h'01ffff h8s/2237 group hd6432237 128 kbytes h'000000 to h'01ffff hd6432235 128 kbytes h'000000 to h'01ffff hd6432233 64 kbytes h'000000 to h'00ffff h8s/2227 group hd6432227 128 kbytes h'000000 to h'01ffff hd6432225 128 kbytes h'000000 to h'01ffff hd6432224 96 kbytes h'000000 to h'017fff hd6432223 64 kbytes h'000000 to h'00ffff ? connected to the bus master through 16-bit data bus, enabling one-state access to both byte data and word data. figure 20.1 shows a block diagram of the on-chip masked rom.
rev. 2.00, 05/03, page 644 of 846 internal data bus (upper 8 bits) internal data bus (lower 8 bits) h000000 h000002 h000001 h000003 h05fffe h05ffff figure 20.1 block diagram of on-chip masked rom (384 kbytes)
rev. 2.00, 05/03, page 645 of 846 section 21 prom the prom version can be set to prom mode and programmed with a prom programmer. 21.1 prom mode setting the prom version (hd6472237) suspends its microcomputer functions when placed in prom mode, enabling the on-chip prom to be programmed. this programming can be done with a prom programmer set up in the same way as for the hn27c101 (v pp = 12.5 v) eprom. use of a socket adapter to convert from 100 pins to 32 pins enables programming with a commercial prom programmer. caution is required when selecting the prom programmer, as this lsi does not support page mode. table 21.1 shows how prom mode is selected. table 21.1 selecting prom mode pin names setting md2, md1, md0 low stby pa2, pa1 high 21.2 socket adapter and memory map programs can be written and verified by attaching a socket adapter to convert from 100 pins to 32 pins to the prom programmer. figure 21.1 shows the wiring of the socket adapter, and table 21.2 gives ordering information for the socket adapter. figure 21.2 shows the memory map in prom mode.
rev. 2.00, 05/03, page 646 of 846 pin no. 59 4 5 6 7 8 9 10 11 13 15 16 17 18 19 20 21 22 60 24 25 26 27 28 29 30 73 23 74 12,62 54 53 31 32 14,64 42 61 55 56 67 pin function res pd0 pd1 pd2 pd3 pd4 pd5 pd6 pd7 pc0 pc1 pc2 pc3 pc4 pc5 pc6 pc7 pb0 nmi pb2 pb3 pb4 pb5 pb6 pb7 pa0 pf2 pb1 pf1 vcc avcc vref pa1 pa2 vss avss stby md0 md1 md2 hn27c101(dip-32) pin no. 1 13 14 15 17 18 19 20 21 12 11 10 9 8 7 6 5 27 26 23 25 4 28 29 3 2 22 24 31 32 16 pin function vpp eo0 eo1 eo2 eo3 eo4 eo5 eo6 eo7 ea0 ea1 ea2 ea3 ea4 ea5 ea6 ea7 ea8 ea9 ea10 ea11 ea12 ea13 ea14 ea15 ea16 ce oe pgm v cc v ss hd6472237 (fp-100b, tfp-100b, tfp-100g) eprom socket note: pins not shown in this figure should be open. vpp eo7toeo0 ea16toea0 oe ce pgm : programing power supply (12.5v) : data input/outout : address input : output enable : chip enable : program legend: figure 21.1 hd6472237 socket adapter pin correspondence diagram (fp-100b, tfp-100b, tfp-100g)
rev. 2.00, 05/03, page 647 of 846 pin no. 62 7 8 9 10 11 12 13 14 16 18 19 20 21 22 23 24 25 63 27 28 29 30 31 32 33 76 26 77 15,65 57 56 34 35 17,67 45 64 58 59 70 pin function res pd0 pd1 pd2 pd3 pd4 pd5 pd6 pd7 pc0 pc1 pc2 pc3 pc4 pc5 pc6 pc7 pb0 nmi pb2 pb3 pb4 pb5 pb6 pb7 pa0 pf2 pb1 pf1 vcc avcc vref pa1 pa2 vss avss stby md0 md1 md2 hn27c101(dip-32) pin no. 1 13 14 15 17 18 19 20 21 12 11 10 9 8 7 6 5 27 26 23 25 4 28 29 3 2 22 24 31 32 16 pin function vpp eo0 eo1 eo2 eo3 eo4 eo5 eo6 eo7 ea0 ea1 ea2 ea3 ea4 ea5 ea6 ea7 ea8 ea9 ea10 ea11 ea12 ea13 ea14 ea15 ea16 ce oe pgm v cc v ss hd6472237 (fp-100a) eprom socket note: pins not shown in this figure should be open. vpp eo7toeo0 ea16toea0 oe ce pgm : programing power supply (12.5v) : data input/outout : address input : output enable : chip enable : program legend: figure 21.2 hd6472237 socket adapter pin correspondence diagram (fp-100a)
rev. 2.00, 05/03, page 648 of 846 table 21.2 socket adapters socket adapter product name package minato electronics data io japan h8s/2237 100-pin tqfp (tfp-100b) me2237esns1h h7223bt100d3201 100-pin tqfp (tfp-100g) me2237esms1h h7223gt100d3201 100-pin qfp (fp-100a) me2237esfs1h h7223aq100d3201 100-pin qfp (fp-100b) me2237eshs1h h7223bq100d3201 on-chip prom address in mcu mode address in prom mode h000000 h01ffff h00000 h1ffff figure 21.3 memory map in prom mode
rev. 2.00, 05/03, page 649 of 846 21.3 programming table 21.3 shows how to select the program, verify, and other modes in prom mode. table 21.3 mode selection in prom mode pins mode ce ce ce ce oe oe oe oe pgm pgm pgm pgm vpp vcc eo7 to eo0 ea16 to ea0 program l h l v pp v cc data input address input verify llhv pp v cc data output address input programming prohibitedlllv pp v cc high impedance address input lhh hl l hhh legend l : low voltage level h : high voltage level v pp : v pp voltage level v cc : v cc voltage level programming and verification should be carried out using the same specifications as for the standard hn27c101 eprom. however, do not set the prom programmer to page mode does not support page programming. a prom programmer that only supports page programming cannot be used. when choosing a prom programmer, check that it supports high-speed programming in byte units. always set addresses within the range h 00000 to h 1ffff. 21.3.1 programming and verification an efficient, high-speed programming procedure can be used to program and verify prom data. this procedure writes data quickly without subjecting the chip to voltage stress or sacrificing data reliability. it leaves the data h ff in unused addresses. figure 21.4 shows the basic high-speed programming flowchart. tables 21.4 and 21.5 list the electrical characteristics of the chip during programming. figure 21.5 shows a timing chart.
rev. 2.00, 05/03, page 650 of 846 start set program/verification mode address = 0 verification? yes no n = 0 n + 1 n program width tpw = 0.2ms 5% last address? all address read? v cc =6.0v 0.25v, v pp =12.5 v 0.3v yes no no yes go address + 1 address n < 25 end fail no go set read mode v cc = 5.0v 0.25v, vpp = v cc program width tpw = 0.2ms figure 21.4 high-speed programming flowchart
rev. 2.00, 05/03, page 651 of 846 table 21.4 dc characteristics in prom mode (conditions: v cc = 6.0 v 0.25 v, v pp = 12.5 v 0.3 v, v ss = 0 v, t a = 25c 5c) item symbol min typ max unit test conditions input high voltage eo7 to eo0, ea16 to ea0, oe, ce, pgm v ih 2.4 v cc + 0.3 v input low voltage eo7 to eo0, ea16 to ea0, oe , ce , pgm v il C0.3 0.8 v output high voltage eo7 to eo0 v oh 2.4 v i oh = C200 a output low voltage eo7 to eo0 v ol 0.45 v i ol = 1.6 ma input leakage current eo7 to eo0, ea16 to ea0, oe , ce , pgm | i li | 2 a v in = 5.25 v/0.5 v v cc current i cc 40 ma v pp current i pp 40 ma
rev. 2.00, 05/03, page 652 of 846 table 21.5 ac characteristics in prom mode (conditions: v cc = 6.0 v 0.25 v, v pp = 12.5 v 0.3 v, t a = 25c 5c) item symbol min typ max unit test conditions address setup time t as 2 s figure 21.5 * 1 oe setup time t oes 2 s data setup time t ds 2 s address hold time t ah 0 s data hold time t dh 2 s data output disable time t df * 2 130 ns v pp setup time t vps 2 s programming pulse width t pw 0.190.20 0.21 ms pgm pulse width for overwrite programming t opw * 3 0.19 5.25 ms v cc setup time t vcs 2 s ce setup time t ces 2 s data output delay time t oe 0 150 ns notes: * 1 input pulse level: 0.8 v to 2.2 v input rise time/fall time 20 ns timing reference levels: input: 1.0 v, 2.0 v output: 0.8 v, 2.0 v * 2t df is defined to be when output has reached the open state, and the output level can no longer be referenced. * 3t opw is defined by the value shown in the flowchart.
rev. 2.00, 05/03, page 653 of 846 program verification input data output data t as t ah t df t dh t ds t vps t vcs t ces t pw t opw * t oes t oe address data vpp vcc ce pgm oe v pp v cc v cc +1 v cc note: * tpow is defined by the value shown in the flowchart. figure 21.5 prom programming/verification timing
rev. 2.00, 05/03, page 654 of 846 21.3.2 programming precautions ? program using the specified voltages and timing. the programming voltage (v pp ) in prom mode is 12.5 v. applied voltages in excess of the specified values can permanently destroy the mcu. be particularly careful about the prom programmer's overshoot characteristics. if the prom programmer is set to renesas technology hn27c101 specifications, v pp will be 12.5 v. ? before programming, check that the mcu is correctly mounted in the prom programmer. overcurrent damage to the mcu can result if the index marks on the prom programmer, socket adapter, and mcu are not correctly aligned. ? do not touch the socket adapter or mcu while programming. touching either of these can cause contact faults and programming errors. ? the mcu cannot be programmed in page programming mode. select the programming mode carefully. ? the size of the prom is 128 kbytes. always set addresses within the range h 00000 to h 1ffff. during programming, write h ff to unused addresses to avoid verification errors. 21.3.3 reliability of programmed data an effective way to assure the data retention characteristics of the programmed chips is to bake them at 150c, then screen them for data errors. this procedure quickly eliminates chips with prom memory cells prone to early failure. figure 21.6 shows the recommended screening procedure. mount programing the chip and verify programed data bake chip for 24 to 48 hours at 125 c to 150 c with power off read and check program figure 21.6 recommended screening procedure
rev. 2.00, 05/03, page 655 of 846 if a series of programming errors occurs while the same prom programmer is being used, stop programming and check the prom programmer and socket adapter for defects. please inform renesas technology of any abnormal conditions noted during or after programming or in screening of program data after high-temperature baking.
rev. 2.00, 05/03, page 656 of 846
cpg0501c_000020020700 rev. 2.00, 05/03, page 657 of 846 section 22 clock pulse generator this lsi has an on-chip clock pulse generator that generates the system clock ( ), the bus master clock, and internal clocks. the clock pulse generator consists of an oscillator, duty adjustment circuit, clock selection circuit, medium-speed clock divider, bus master clock selection circuit, subclock oscillator, and wave formation circuit. a block diagram of the clock pulse generator is shown in figure 22.1. legend: lpwrcr: sckcr: low-power control register system clock control register extal xtal duty adjustment circuit medium- speed clock divider system clock oscillator clock selection circuit sub wdt_1 count clock internal clock to peripheral modules system clock pin bus master clock to cpu and dtc and dmac * /2 to /32 sck2 to sck0 sckcr rfcut osc1 osc2 waveform generation circuit subclock oscillator lpwrcr bus master clock selection circuit note: * supported only by the h8s/2239 group. figure 22.1 block diagram of clock pulse generator frequency changes are performed by software by settings in the low-power control register (lpwrcr) and system clock control register (sckcr).
rev. 2.00, 05/03, page 658 of 846 22.1 register descriptions the on-chip clock pulse generator has the following registers. ? system clock control register (sckcr) ? low-power control register (lpwrcr) 22.1.1 system clock control register (sckcr) sckcr performs medium-speed mode control. bit bit name initial value r/w description 7 pstop 0 r/w clock output prohibited controls output. ? high-speed mode, medium-speed mode, subactive mode, sleep mode, and subsleep mode 0: output 1: fixed to high ? software standby mode, watch mode, and direct transition 0: fixed to high 1: fixed to high ? hardware standby mode 0: high impedance 1: high impedance 6 0 r/wreserved this bit is readable/writable, but the write value should always be 0. 5 4 0 0 reserved these bits are always read as 0, and cannot be modified. 3 0 r/wreserved this bit is readable/writable, but the write value should always be 0.
rev. 2.00, 05/03, page 659 of 846 bit bit name initial value r/w description 2 1 0 sck2 sck1 sck0 0 0 0 r/w r/w r/w system clock select 2 to 0 these bits select the bus master clock. 000: high-speed mode 001: medium-speed clock /2 010: medium-speed clock /4 011: medium-speed clock /8 100: medium-speed clock /16 101: medium-speed clock /32 11x: setting prohibited legend x: don't care 22.1.2 low-power control register (lpwrcr) lpwrcr performs down-mode control, selects sampling frequency for eliminating noise, performs subclock generation control, and specifies multiplication factor.
rev. 2.00, 05/03, page 660 of 846 bit bit name initial value r/w description 7 dton 0 r/w direct transition on flag 0: when the sleep instruction is executed in high- speed mode or medium-speed mode, operation shifts to sleep mode, software standby mode, or watch mode * . when the sleep instruction is executed in sub- active mode, operation shifts to sub-sleep mode or watch mode. 1: when the sleep instruction is executed in high- speed mode or medium-speed mode, operation shifts directly to sub-active mode * , or shifts to sleep mode or software standby mode. when the sleep instruction is executed in sub- active mode, operation shifts directly to high- speed mode, or shifts to sub-sleep mode. 6 lson 0 r/w low speed on fag 0: when the sleep instruction is executed in high- speed mode or medium-speed mode, operation shifts to sleep mode, software standby mode, or watch mode * . when the sleep instruction is executed in sub- active mode, operation shifts to watch mode * or shifts directly to high-speed mode. operation shifts to high-speed mode when watch mode is cancelled. 1: when the sleep instruction is executed in high- speed mode, operation shifts to watch mode or sub-active mode. when the sleep instruction is executed in sub- active mode, operation shifts to sub-sleep mode or watch mode. operation shifts to sub-active mode when watch mode is cancelled.
rev. 2.00, 05/03, page 661 of 846 bit bit name initial value r/w description 5 nesel 0 r/w noise elimination sampling frequency select this bit selects the sampling frequency of the subclock ( sub ) generated by the subclock oscillator is sampled by the clock ( ) generated by the system clock oscillator set 0 when is 5 mhz or higher. set 1 when is 2.1 mhz or lower. any value can be set when is 2.1 to 5 mhz. 0: sampling using 1/32 x 1: sampling using 1/4 x 4 substp 0 r/w subclock enable this bit enables/disables subclock generation. this bit should be set to 1 when subclock is not used. 0: enables subclock generation. 1: disables subclock generation. 3 rfcut 0 r/w oscillation circuit feedback resistance control bit selects whether or not built-in feedback resistance and duty adjustment circuit of the system clock generator are used when an external clock is input. do not access when the crystal resonator is used. after setting this bit in the external clock input state, enter software standby mode, watch mode, or subactive mode. when software standby mode, watch mode, or subactive mode is entered, switch whether or not built-in feedback resistance and duty adjustment circuit are used. 0: built-in feedback resistance and duty adjustment circuit of the system clock generator used. 1: built-in feedback resistance and duty adjustment circuit of the system clock generator not used. 2 0 r/wreserved this bit is readable/writable, but the write value should always be 0.
rev. 2.00, 05/03, page 662 of 846 bit bit name initial value r/w description 1 0 stc1 stc0 0 0 r/w r/w multiplication factor setting specifies multiplication factor of the pll circuit built in the evaluation chip. the specified multiplication factor becomes valid software standby mode, watch mode, or subactive mode is entered. these bits should be set to 11 in this lsi. since the value becomes stc1 = stc0 = 0 after a reset, set stc1 = stc0 = 1. 00: x 1 01: x 2 (setting prohibited) 10: x 4 (setting prohibited) 11: pll is bypass note: * when watch mode or subactive mode is entered, set high-speed mode. 22.2 system clock oscillator system clock pulses can be supplied by connecting a crystal resonator, or by input of an external clock. 22.2.1 connecting a crystal resonator a crystal resonator can be connected as shown in the example in figure 22.2. select the damping resistance r d according to table 22.1. an at-cut parallel-resonance crystal should be used. extal xtal r d c l2 c l1 c l1 = c l2 = 10 to 22pf note: c l1 and c l2 are reference values including the floating capacitance of the board. figure 22.2 connection of crystal resonator (example)
rev. 2.00, 05/03, page 663 of 846 table 22.1 damping resistance value frequency (mhz) 2 46 8 10 12 16 20 r d ( ? ) 1 k 500 300 200 100 0 0 0 figure 22.3 shows the equivalent circuit of the crystal resonator. use a crystal resonator that has the characteristics shown in table 22.2. xtal c l at-cut parallel-resonance type extal c 0 lr s figure 22.3 crystal resonator equivalent circuit table 22.2 crystal resonator characteristics frequency (mhz) 2 46 8 10 12 16 20 r s max ( ? ) 500 120 100 80 60 60 50 40 c 0 max (pf) 77777777 22.2.2 external clock input an external clock signal can be input as shown in the examples in figure 22.4. if the xtal pin is left open, ensure that stray capacitance does not exceed 10 pf. when complementary clock is input to the xtal pin, the external clock input should be fixed high in standby mode, subactive mode, subsleep mode, or watch mode.
rev. 2.00, 05/03, page 664 of 846 extal xtal extal xtal external clock input open external clock input (a) xtal pin left open (b) complementary clock input at xtal pin figure 22.4 external clock input (examples) table 22.3 shows the input conditions for the external clock. table 22.4 shows the input conditions for the external clock when duty adjustment circuit is not used. table 22.3 external clock input conditions (1) (h8s/2238 group, h8s/2237 group, h8s/2227 group) v cc = 2.7 v to 5.0 v v cc = 2.2 v to 3.6 v item symbol min max min max unit test conditions external clock input low pulse width t exl 30 65 ns external clock input high pulse width t exh 30 65 ns external clock rise time t exr 7 15ns external clock fall time t exf 7 15ns figure 22.5 0.4 0.6 0.35 0.65 t cyc 5 mhz clock low pulse width t cl 80 70 ns < 5 mhz figure 26.7 t ch 0.4 0.6 0.35 0.65 t cyc 5 mhz clock high pulse width 80 70 ns < 5 mhz
rev. 2.00, 05/03, page 665 of 846 table 22.3 external clock input conditions (2) (h8s/2239 group) f-ztat and masked rom masked rom v cc = 3.0 v to 3.6 v v cc = 2.7 v to 3.6 v v cc = 2.2 v to 3.6 v item symbol min max min max min max unit test conditions external clock input low pulse width t exl 20 25 65 ns external clock input high pulse width t exh 20 25 65 ns external clock rise time t exr 5 6.25 15 ns external clock fall time t exf 5 6.25 15 ns figure 22.5 0.4 0.6 0.4 0.6 0.35 0.65 t cyc 5 mhz clock low pulse width t cl 80 70 ns < 5 mhz figure 26.7 t ch 0.4 0.6 0.4 0.6 0.35 0.65 t cyc 5 mhz clock high pulse width 80 70 ns < 5 mhz table 22.4 external clock input conditions (duty adjustment circuit unused) (1) (h8s/2238 group, h8s/2237 group, h8s/2227 group) v cc = 2.7 v to 5.5 v v cc = 2.2 v to 3.6 v item symbol min max min max unit test conditions external clock input low pulse width t exl 37 80 ns external clock input high pulse width t exh 37 80 ns external clock rise time t exr 7 15ns external clock fall time t exf 7 15ns figure 22.5 note: when a duty adjustment circuit is not used, maximum operating frequency is lowered according to the input waveform. (example: when t exl = t exh = 50 ns, t exr = t exf = 10 ns, clock cycle time = 120 ns, and maximum operating frequency = 8.3 mhz)
rev. 2.00, 05/03, page 666 of 846 table 22.4 external clock input conditions (duty adjustment circuit unused) (2) (h8s/2239 group) f-ztat and masked rom masked rom v cc = 3.0 v to 3.6 v v cc = 2.7 v to 3.6 v v cc = 2.2 v to 3.6 v item symbol min max min max min max unit test conditions external clock input low pulse width t exl 25 31.25 80 ns external clock input high pulse width t exh 25 31.25 80 ns external clock rise time t exr 5 6.25 15 ns external clock fall time t exf 5 6.25 15 ns figure 22.5 note: when a duty adjustment circuit is not used, maximum operating frequency is lowered according to the input waveform. (example: when t exl = t exh = 50 ns, t exr = t exf = 10 ns, clock cycle time = 120 ns, and maximum operating frequency = 8.3 mhz) t exh t exl t exr t exf v cc 0.5 extal figure 22.5 external clock input timing 22.2.3 notes on switching external clock when two or more external clocks (e.g.: 10 mhz and 2 mhz) are used as the system clock, input clock should be switched in software standby mode. an example of external clock switching circuit is shown in figure 22.6. an example of external clock switching timing is shown in figure 22.7.
rev. 2.00, 05/03, page 667 of 846 this lsi port output external interrupt extal external clock 1 external clock 2 selector control circuit external clock switch request external interrupt signal external clock switch signal figure 22.6 external clock switching circuit (example) 200ns or more (2) (1) port output (clock switching) (2) transition to software standby mode (3) external clock switching (4) external interrupt generation (an interrupt should be input 200 ns or more after transition to software standby mode.) (5) interrupt exception handling (5) sleep instruction execution interrupt exception handling operation external clock 1 external clock 2 (1) port output (3) external clock switching circuit extal internal clock (4) standby mode external interrupt active (external clock 1) active (external clock 1) software standby mode clock switching request figure 22.7 external clock switching timing (example)
rev. 2.00, 05/03, page 668 of 846 22.3 duty adjustment circuit the duty adjustment circuit is valid when oscillation frequency is more than 5 mhz. the duty adjustment circuit adjusts clock output fr/m the system clock oscillator to generate the system clock ( ). 22.4 medium-speed clock divider the medium-speed clock divider divides the system clock to generate /2, /4, /8, /16, and /32. 22.5 bus master clock selection circuit the bus master clock selection circuit selects the clock supplied to the bus master by setting the bits sck2 to sck0 in sckcr. the bus master clock can be selected from system clock ( ), or medium-speed clocks ( /2, /4, /8, /16, /32). 22.6 subclock oscillator 22.6.1 connecting 32.768 khz crystal resonator to supply a clock to the subclock divider, connect a 32.768-khz crystal resonator, as shown in figure 22.8. figure 22.9 shows the equivalence circuit for a 32.768-khz oscillator. osc1 osc2 c 1 c 2 c 1 = c 2 = 15pf (typ) note: cl1 and cl2 are reference values including the floating capacitance of the board. figure 22.8 connection example of 32.768-khz quartz oscillator
rev. 2.00, 05/03, page 669 of 846 osc1 osc2 c s l s r s c o co = 1.5pf (typ) rs = 14 ? (typ) fw = 32.768 khz type name = c001r (seiko epson) figure 22.9 equivalence circuit for 32.768-khz oscillator 22.6.2 handling pins when subclock not required if no subclock is required, connect the osc1 pin to vss and leave osc2 open, as shown in figure 22.10. the substp bit in lpwrcr must be set to 1. on the h8s/2237 and h8s/2227 group, the osc1 pin should be connected to v cc . osc1 osc2 open figure 22.10 pin handling when subclock not required
rev. 2.00, 05/03, page 670 of 846 22.7 subclock waveform generation circuit to eliminate noise from the subclock input to osci, the subclock is sampled using the dividing clock . the sampling frequency is set using the nesel bit of lpwrcr. for details, see section 22.1.2, low power control register (lpwrcr). no sampling is performed in sub-active mode, sub-sleep mode, or watch mode. 22.8 usage notes 22.8.1 note on crystal resonator as various characteristics related to the crystal resonator are closely linked to the user's board design, thorough evaluation is necessary on the user's part, using the resonator connection examples shown in this section as a guide. as the resonator circuit ratings will depend on the floating capacitance of the resonator and the mounting circuit, the ratings should be determined in consultation with the resonator manufacturer. the design must ensure that a voltage exceeding the maximum rating is not applied to the oscillator pin. 22.8.2 note on board design when designing the board, place the crystal resonator and its load capacitors as close as possible to the extal, xtal, osc1, and osc2 pins. make wires as short as possible. other signal lines should be routed away from the oscillator circuit, as shown in figure 22.11. this is to prevent induction from interfering with correct oscillation. c2 avoid signal a signal b c1 this lsi extal, osc1 xtal, osc2 figure 22.11 note on board design of oscillator circuit
rev. 2.00, 05/03, page 671 of 846 section 23 power-down modes in addition to the normal program execution state, this lsi has nine power-down modes in which operation of the cpu and oscillator is halted and power dissipation is reduced. low-power operation can be achieved by individually controlling the cpu, on-chip peripheral modules, and so on. this lsi operating modes are as follows: 1. high-speed mode 2. medium-speed mode 3. subactive mode 4. sleep mode 5. subsleep mode 6. watch mode 7. module stop mode 8. software standby mode 9. hardware standby mode 2. to 9. are low power dissipation states. sleep mode and subsleep mode are cpu states, medium- speed mode is a cpu and bus master state, subactive mode is a cpu and bus master and internal peripheral function state, and module stop mode is an internal peripheral function (including bus masters other than the cpu) state. some of these states can be combined. after a reset, the lsi is in high-speed mode with modules other than the dtc in module stop mode. table 23.1 shows the internal state of the lsi in the respective modes. table 23.2 shows the conditions for shifting between the low power dissipation modes. figure 23.1 is a mode transition diagram.
rev. 2.00, 05/03, page 672 of 846 table 23.1 lsi internal states in each mode function high- speed medium- speed sleep module stop watch sub active subsleep software standby hardware standby system clock pulse generator function- ing function- ing function- ing function- ing halted halted halted halted halted subclock pulse generator function- ing/halted function- ing/halted function- ing/halted function- ing/halted function- ing function- ing function- ing function- ing/halted halted cpu instruc- tions halted halted halted halted halted registers function- ing medium- speed operation retained function- ing retained subclock operation retained retained undefined ram function- ing function- ing function- ing (dtc) function- ing retained function- ing retained retained retained i/o function- ing function- ing function- ing function- ing retained function- ing function- ing retained high impedance nmi external interrupts irqn function- ing function- ing function- ing function- ing function- ing function- ing function- ing function- ing halted peripheral functions pbc function- ing medium- speed operation function- ing function- ing/halted (retained) halted (retained) subclock operation halted (retained) halted (retained) halted (reset) dtc dmac * 1 function- ing medium- speed operation function- ing function- ing/halted (retained) halted (retained) halted (retained) halted (retained) halted (retained) halted (reset) wdt_1 function- ing function- ing function- ing function- ing subclock operation subclock operation subclock operation halted (retained) halted (reset) wdt_0 function- ing function- ing function- ing function- ing halted (retained) subclock operation subclock operation halted (retained) halted (reset) tmr function- ing function- ing function- ing function- ing/halted (retained) halted (retained) subclock operation subclock operation halted (retained) halted (reset) tpu sci i 2 c * 2 d/a * 3 function- ing function- ing function- ing function- ing/halted (retained) halted (retained) halted (retained) halted (retained) halted (retained) halted (reset) a/d function- ing function- ing function- ing function- ing/halted (reset) halted (reset) halted (reset) halted (reset) halted (reset) halted (reset) notes: "halted (retained) " means that internal register values are retained. the internal state is "operation suspended. " "halted (reset) " means that internal register values and internal states are initialized. in module stop mode, only modules for which a stop setting has been made are halted (reset or retained). * 1 supported only by the h8s/2239 group. * 2 not available in the h8s/2237 group and h8s/2227 group. * 3 not available in the h8s/2227 group.
rev. 2.00, 05/03, page 673 of 846 program-halted state program execution state sck2 to sck0= 0 sck2 to sck0 0 sleep instruction ssby = 1, pss = 1 dton = 1, lson = 1 clock switching exception processing sleep instruction ssby = 1, pss = 1 dton = 1, lson = 0 after the oscillation settling time (sts2 to 0), clock switching exception processing sleep instruction sleep instruction external interrupt * 3 all interrupt sleep instruction sleep instruction sleep instruction interrupt * 1 lson bit = 0 interrupt * 2 interrupt * 1 lson bit = 1 stby pin = high res pin = low stby pin = low ssby= 0, lson= 0 ssby= 1, pss= 0, lson= 0 ssby= 0, pss= 1, lson= 1 ssby= 1, pss= 1, dton= 0 res pin = high mres pin = high : transition after exception processing : low power dissipation mode power on reset state manual reset state reset state high-speed mode (main clock) medium-speed mode (main clock) sub-active mode (subclock) sub-sleep mode (subclock) hardware standby mode software standby mode sleep mode (main clock) watch mode (subclock) notes: * 1 * 2 * 3 nmi, irq0 to irq7, and wdt interrupts. nmi, irq0 to irq7, and wdt0, wdt1 and tmr0 to tmr3 interrupts. nmi, irq0 to irq7 when a transition is made between modes by means of an interrupt, the transition cannot be made on interrupt source generation alone. ensure that interrupt handling is performed after accepting the interrupt request. from any state except hardware standby mode, a transition to the reset state occurs when res is driven low. at any state except hardware standby mode and power-on reset state, a transition to the manual reset state occurs when the mres pin is driven low. from any state, a transition to hardware standby mode occurs when stby is driven low. always select high-speed mode before making a transition to watch mode or sub-active mode. figure 23.1 mode transition diagram
rev. 2.00, 05/03, page 674 of 846 table 23.2 low power dissipation mode transition conditions status of control bit at transition pre- transition state ssby pss lson dton state after transition invoked by sleep instruction state after transition back from low power mode invoked by interrupt 0 x 0 x sleep high-speed/medium- speed high-speed/ medium-speed 0x1x 1 0 0 x software standby high-speed/medium- speed 101x 1 1 0 0 watch high-speed 1 1 1 0 watch subactive 1101 1 1 1 1 subactive subactive 0 0 x x 010x 0 1 1 x subsleep subactive 10xx 1 1 0 0 watch high-speed 1 1 1 0 watch subactive 1 1 0 1 high-speed 1111 legend: x : don't care : do not set.
rev. 2.00, 05/03, page 675 of 846 23.1 register description the following registers relates to the power-down modes. for details on system clock control register (sckcr), refer to section 22.1.1, system clock control register (sckcr). for details on low power control register (lpwrcr), refer to section 22.1.2, low power control register (lpwrcr). for details on timer control status register (tcsr_1), refer to section 13.3.2, timer control/status register (tcsr_1). ? standby control register (sbycr) ? module stop control register a (mstpcra) ? module stop control register b (mstpcrb) ? module stop control register c (mstpcrc) ? low power control register (lpwrcr) ? system clock control register (sckcr) ? timer control status register (tcsr_1) 23.1.1 standby control register (sbycr) sbycr performs power-down mode control. bit bit name initial value r/w description 7 ssby 0 r/w software standby specifies transition destination when the sleep instruction is executed. 0: shifts to sleep mode when the sleep instruction is executed in high-speed mode or medium-speed mode. shifts to subsleep mode when the sleep instruction is executed in subactive mode. 1: shifts to software standby mode, subactive mode, and watch mode when the sleep instruction is executed in high-speed mode or medium-speed mode. shifts to watch mode or high-speed mode when the sleep instruction is executed in subactive mode. note that the value of the ssby bit does not change even when software standby mode is canceled and making normal operation mode transition by executing an external interrupt. to clear this bit, 0 should be written to.
rev. 2.00, 05/03, page 676 of 846 bit bit name initial value r/w description 6 5 4 sts2 sts1 sts0 0 0 0 r/w r/w r/w standby timer select 2 to 0 these bits select the mcu wait time for clock settling to cancel software standby mode, watch mode, or subactive mode. with a crystal resonator (table 23.3), select a wait time of 8 ms (oscillation settling time) or more, depending on the operating frequency. with an external clock, there are no specific wait requirements. 000: standby time = 8192 states 001: standby time = 16384 states 010: standby time = 32768 states 011: standby time = 65536 states 100: standby time = 131072 states 101: standby time = 262144 states 110: reserved 111: standby time = 16 states * 3 ope 1 r/w output port enable specifies whether the output of the address bus and bus control signals ( cs0 to cs7 , as , rd , hwr , and lwr ) should be retained or driven to the high impedance state, when shifting to software standby mode, watch mode, or direct transition. 0: high impedance 1: output is retained. 2 to 0 all 0 reserved these bits are always read as 0 and cannot be modified. note: * do not set 16 states for standby time in the f-ztat version. 8192 states or more should be set.
rev. 2.00, 05/03, page 677 of 846 23.1.2 module stop control registers a to c (mstpcra to mstpcrc) mstpcr performs module stop mode control. when bits in mstpcr registers are set to 1, module stop mode is set. when cleared to 0, module stop mode is cleared. ? mstpcra bit bit name initial value r/w target module 7 mstpa7 0 r/w dma controller (dmac) * 2 6 mstpa6 0 r/w data transfer controller (dtc) 5 mstpa5 1 r/w 16-bit timer pulse unit (tpu) 4 mstpa4 1 r/w 8-bit timer (tmr_0, tmr_1) 3 mstpa3 * 1 1r/w 2 mstpa2 * 1 1r/w 1 mstpa1 1 r/w a/d converter 0 mstpa0 1 r/w 8-bit timer (tmr_2, tmr_3) * 3 ? mstpcrb bit bit name initial value r/w target module 7 mstpb7 1 r/w serial communication interface 0 (sci_0) 6 mstpb6 1 r/w serial communication interface 1 (sci_1) 5 mstpb5 1 r/w serial communication interface 1 (sci_2) 4 mstpb4 1 r/w i 2 c bus interface 0 (iic_0) (optional) * 3 3 mstpb3 1 r/w i 2 c bus interface 1 (iic_1) (optional) * 3 2 mstpb2 * 1 1r/w 1 mstpb1 * 1 1r/w 0 mstpb0 * 1 1r/w
rev. 2.00, 05/03, page 678 of 846 ? mstpcrc bit bit name initial value r/w target module 7 mstpc7 1 r/w serial communication interface 3 (sci_3) 6mstpc6 * 1 1r/w 5 mstpc5 1 r/w d/a converter * 4 4 mstpc4 1 r/w pc break controller (pbc) 3mstpc3 * 1 1r/w 2mstpc2 * 1 1r/w 1mstpc1 * 1 1r/w 0mstpc0 * 1 1r/w notes: * 1 bits mstpa3, mstpa2, mstpb5, mstpb2 to mstpb0, mstpc6, mstpc3 to rmstpc0 are readable/writable. the initial value of them is 1. the write value should always be 1. * 2 h8s/2239 group only. * 3 not implemented on h8s/2237 and h8s/2227 group. * 4 not implemented on h8s/2237 group. 23.2 medium-speed mode in high-speed mode, when the sck2 to sck0 bits in sckcr are set to 1, the operating mode changes to medium-speed mode as soon as the current bus cycle ends. in medium-speed mode, the cpu operates on the operating clock ( /2, /4, /8, /16, or /32) specified by the sck2 to sck0 bits. the bus masters other than the cpu (dmac and dtc) also operate in medium-speed mode. on-chip peripheral modules other than the bus masters always operate on the high-speed clock ( ). in medium-speed mode, a bus access is executed in the specified number of states with respect to the bus master operating clock. for example, if /4 is selected as the operating clock, on-chip memory is accessed in 4 states, and internal i/o registers in 8 states. medium-speed mode is cleared by clearing all of bits sck2 to sck0 to 0. a transition is made to high-speed mode and medium-speed mode is cleared at the end of the current bus cycle. if a sleep instruction is executed when the ssby bit in sbycr is cleared to 0, and lson bit in lpwrcr is cleared to 0, a transition is made to sleep mode. when sleep mode is cleared by an interrupt, medium-speed mode is restored. when the sleep instruction is executed with the ssby bit = 1, the lson bit in lpwrcr = 0, and the pss bit in tcsr_1 (wdt_1) = 0, operation shifts to the software standby mode. when software standby mode is cleared by an external interrupt, medium-speed mode is restored.
rev. 2.00, 05/03, page 679 of 846 when the res or mres pin is set low and medium-speed mode is cancelled, operation shifts to the reset state. the same applies in the case of a reset caused by overflow of the watchdog timer. when the stby pin is driven low, a transition is made to hardware standby mode. figure 23.2 shows the timing for transition to and clearance of medium-speed mode. , peripheral module clock bus master clock internal address bus internal write signal medium-speed mode sckcr sckcr figure 23.2 medium-speed mode transition and clearance timing 23.3 sleep mode 23.3.1 sleep mode when the sleep instruction is executed while the ssby bit in sbycr = 0 and the lson bit in lpwrcr = 0, the cpu enters the sleep mode. in sleep mode, cpu operation stops but the contents of the cpu's internal registers are retained. other peripheral modules do not stop. 23.3.2 exiting sleep mode sleep mode is exited by any interrupt, or signals at the res pin, mres pin, or stby pin. ? exiting sleep mode by interrupts when an interrupt occurs, sleep mode is exited and interrupt exception processing starts. sleep mode is not exited if the interrupt is disabled, or interrupts other than nmi are masked by the cpu. ? exiting sleep mode by res pin or mres pin setting the res pin or mres pin level low selects the reset state. after the stipulated reset input duration, driving the res pin or mres pin high starts the cpu performing reset exception processing. ? exiting sleep mode by stby pin
rev. 2.00, 05/03, page 680 of 846 when the stby pin level is driven low, a transition is made to hardware standby mode. 23.4 software standby mode 23.4.1 software standby mode a transition is made to software standby mode when the sleep instruction is executed while the ssby bit in sbycr = 1 and the lson bit in lpwrcr = 0, and the pss bit in tcsr_1 (wdt_1) = 0. in this mode, the cpu, on-chip peripheral modules, and system clock oscillator all stop. however, the contents of the cpu's internal registers, ram data, and the states of on-chip peripheral modules other than sci and the a/d converter, and the states of i/o ports are retained. in this mode the oscillator stops, and therefore power dissipation is significantly reduced. 23.4.2 clearing software standby mode software standby mode is cleared by an external interrupt (nmi pin, or pins irq0 to irq7 ), or by means of the mres pin or stby pin. ? clearing with an interrupt when an nmi, or irq0 to irq7 interrupt request signal is input, clock oscillation starts, and after the elapse of the time set in bits sts2 to sts0 in syscr, stable clocks are supplied to the entire this lsi chip, software standby mode is cleared, and interrupt exception handling is started. when clearing software standby mode with an irq0 to irq7 interrupt, set the corresponding enable bit/pin function switching bit to 1 and ensure that no interrupt with a higher priority than interrupts irq0 to irq7 is generated. software standby mode cannot be cleared if the interrupt has been masked on the cpu side or has been designated as a dtc activation source. ? clearing with the res pin or mres pin when the res pin or mres pin is driven low, clock oscillation is started. at the same time as clock oscillation starts, clocks are supplied to the entire this lsi chip. note that the res pin or mres pin must be held low until clock oscillation settles. when the res pin or mres pin goes high, the cpu begins reset exception handling. ? clearing with the stby pin when the stby pin is driven low, a transition is made to hardware standby mode.
rev. 2.00, 05/03, page 681 of 846 23.4.3 oscillation settling time after clearing software standby mode bits sts2 to sts0 in sbycr should be set as described below. ? using a crystal oscillator set bits sts2 to sts0 so that the standby time is at least 8 ms (the oscillation settling time). table 23.3 shows the standby times for different operating frequencies and settings of bits sts2 to sts0. ? using an external clock any value can be set. normally, minimum time is recommended. note: do not set 16 states for standby time in the f-ztat version. 8192 states or more should be set. table 23.3 oscillation settling time settings sts2 sts1 sts0 standby time 20 mhz 16 mhz 13 mhz 10 mhz 8 mhz 6 mhz 4 mhz 2 mhz unit 0 0 0 8192 states 0.41 0.51 0.6 0.8 1.0 1.4 2.0 4.1 ms 1 16384 states 0.82 1.0 1.3 1.6 2.0 2.7 4.1 8.2 1 0 32768 states 1.6 2.0 2.5 3.3 4.1 5.5 8.2 16.4 1 65536 states 3.3 4.1 5.0 6.6 8.2 10.9 16.4 32.8 1 0 0 131072 states 6.6 8.2 10.1 13.1 16.4 21.8 32.8 65.5 1 262144 states 13.1 16.4 20.2 26.2 32.8 43.7 65.5 131.1 10reserved ? ? ? ? ????? 1 16 states 0.8 1.0 1.2 1.6 2.0 1.7 4.0 8.0 s : recommended time setting 23.4.4 software standby mode application example figure 23.3 shows an example in which a transition is made to software standby mode at the falling edge on the nmi pin, and software standby mode is cleared at the rising edge on the nmi pin. in this example, an nmi interrupt is accepted with the nmieg bit in syscr cleared to 0 (falling edge specification), then the nmieg bit is set to 1 (rising edge specification), the ssby bit is set to 1, and a sleep instruction is executed, causing a transition to software standby mode. software standby mode is then cleared at the rising edge on the nmi pin.
rev. 2.00, 05/03, page 682 of 846 oscillator nmi nmieg ssby nmi exception handling nmieg=1 ssby=1 sleep instruction software standby mode (power-down mode) oscillation settling time t osc2 nmi exception handling figure 23.3 software standby mode application example 23.5 hardware standby mode 23.5.1 hardware standby mode when the stby pin is driven low, a transition is made to hardware standby mode from any mode. in hardware standby mode, all functions enter the reset state and stop operation, resulting in a significant reduction in power dissipation. as long as the prescribed voltage is supplied, on-chip ram data is retained. i/o ports are set to the high-impedance state. do not change the state of the mode pins (md2 to md0) while this lsi is in hardware standby mode. 23.5.2 clearing hardware standby mode hardware standby mode is cleared by means of the stby pin and the res pin. when the stby pin is driven high while the res pin is low, the reset state is set and clock oscillation is started. ensure that the res pin is held low until the clock oscillator settles (at least t osc1 msthe oscillation settling timewhen using a crystal oscillator). when the res pin is subsequently driven high, a transition is made to the program execution state via the reset exception handling state.
rev. 2.00, 05/03, page 683 of 846 23.5.3 hardware standby mode timing figure 23.4 shows an example of hardware standby mode timing. when the stby pin is driven low after the res pin has been driven low, a transition is made to hardware standby mode. hardware standby mode is cleared by driving the stby pin high, waiting for the oscillation settling time, then changing the res pin from low to high. oscillator res stby oscillation settling time t osc1 reset exception handling figure 23.4 hardware standby mode timing 23.6 module stop mode module stop mode can be set for individual on-chip peripheral modules. when the corresponding mstp bit in mstpcr is set to 1, module operation stops at the end of the bus cycle and a transition is made to module stop mode. the cpu continues operating independently. when the corresponding mstp bit is cleared to 0, module stop mode is cleared and the module starts operating at the end of the bus cycle. in module stop mode, the internal states of modules other than sci and the a/d converter are retained. after reset clearance, all modules other than dmac and dtc are in module stop mode. when an on-chip peripheral module is in module stop mode, read/write access to its registers is disabled. since the operations of the bus controller and i/o port are stopped when sleep mode is entered at the all-module stop state (mstpcr=h'ffffffff), power consumption can further be reduced.
rev. 2.00, 05/03, page 684 of 846 23.7 watch mode 23.7.1 transition to watch mode cpu operation makes a transition to watch mode when the sleep instruction is executed in high- speed mode or subactive mode with ssby in sbycr =1, dton in lpwrcr = 0, and pss in tcsr_1 (wdt_1) = 1. in watch mode, the cpu is stopped and peripheral modules other than wdt_1 and system clock oscillator are also stopped. the contents of the cpu's internal registers, the data in internal ram, and the statuses of the internal peripheral modules (excluding sci and the a/d converter) and i/o ports are retained. to make a transition to watch mode, bits sck2 to sck0 in sckcr must be set to 0. 23.7.2 exiting watch mode watch mode is exited by any interrupt (wovi_1 interrupt, nmi pin, or irq0 to irq7 ), or signals at the res , mres , or stby pin. ? exiting watch mode by interrupts when an interrupt occurs, watch mode is exited and a transition is made to high-speed mode or medium-speed mode when the lpwrcr lson bit = 0 or to subactive mode when the lson bit = 1. when a transition is made to high-speed mode, a stable clock is supplied to all lsi circuits and interrupt exception processing starts after the time set in sbycr sts2 to sts0 has elapsed. in the case of irq0 to irq7 interrupts, no transition is made from watch mode if the corresponding enable bit/pin function switching bit has been cleared to 0, and, in the case of interrupts from the internal peripheral modules, the interrupt enable register has been set to disable the reception of that interrupt, or is masked by the cpu. see section 23.4.3, oscillation settling time after clearing software standby mode, for how to set the oscillation settling time when making a transition from watch mode to high-speed mode. ? exiting watch mode by res pin or mres pin for exiting watch mode by the res or mres pin, see section 23.4.2, clearing software standby mode. ? exiting watch mode by stby pin when the stby pin level is driven low, a transition is made to hardware standby mode.
rev. 2.00, 05/03, page 685 of 846 23.8 subsleep mode 23.8.1 transition to subsleep mode when the sleep instruction is executed with the ssby bit in sbycr = 0, the lson bit in lpwrcr = 1, and the pss bit in tcsr_1 (wdt_1) = 1 in subactive mode, cpu operation shifts to subsleep mode. in subsleep mode, the cpu is stopped. peripheral modules other than tmr_0 to tmr3, wdt_0, and wdt_1 and system clock oscillator are also stopped. the contents of the cpu's internal registers, the data in internal ram, and the statuses of the internal peripheral modules (excluding the sci and the a/d converter) and i/o ports are retained. 23.8.2 exiting subsleep mode subsleep mode is exited by an interrupt (interrupts from internal peripheral modules, nmi pin, or irq0 to irq7 ), or signals at the res or stby pin. ? exiting subsleep mode by interrupts when an interrupt occurs, subsleep mode is exited and interrupt exception processing starts. in the case of irq0 to irq7 interrupts, subsleep mode is not cancelled if the corresponding enable bit/pin function switching bit has been cleared to 0, and, in the case of interrupts from the internal peripheral modules, the interrupt enable register has been set to disable the reception of that interrupt, or is masked by the cpu. ? exiting subsleep mode by res pin or mres pin for exiting subsleep mode by the res or mres pin, see section 23.4.2, clearing software standby mode. ? exiting subsleep mode by stby pin when the stby pin or mres pin level is driven low, a transition is made to hardware standby mode.
rev. 2.00, 05/03, page 686 of 846 23.9 subactive mode 23.9.1 transition to subactive mode when the sleep instruction is executed in high-speed mode with the ssby bit in sbycr = 1, the dton bit in lpwrcr = 1, the lson bit = 1, and the pss bit in tcsr_1 (wdt_1) = 1, cpu operation shifts to subactive mode. when an interrupt occurs in watch mode, and if the lson bit of lpwrcr is 1, a transition is made to subactive mode. and if an interrupt occurs in subsleep mode, a transition is made to subactive mode. in subactive mode, the cpu operates at low speed on the subclock, and the program is executed step by step. peripheral modules other than pbc, tmr_0 to tmr_3, wdt_0, and wdt_1, and system clock oscillator are also stopped. when operating the cpu in subactive mode, the sckcr sck2 to sck0 bits must be set to 0. 23.9.2 exiting subactive mode subactive mode is exited by the sleep instruction or the res , mres or stby pin. ? exiting subactive mode by sleep instruction when the sleep instruction is executed with the ssby bit in sbycr = 1, the dton bit in lpwrcr = 0, and the pss bit in tcsr_1 (wdt_1) = 1, the cpu exits subactive mode and a transition is made to watch mode. when the sleep instruction is executed with the ssby bit in sbycr = 0, the lson bit in lpwrcr = 1, and the pss bit in tcsr_1 (wdt_1) = 1, a transition is made to subsleep mode. finally, when the sleep instruction is executed with the ssby bit in sbycr = 1, the dton bit in lpwrcr = 1, the lson bit = 0, and the pss bit in tcsr_1 (wdt_1) = 1, a direct transition is made to high-speed mode (sck0 to sck2 all 0). ? exiting subactive mode by res pin or mres pin for exiting subactive mode by the res or mres pin, see section 23.4.2, clearing software standby mode. ? exiting subactive mode by stby pin when the stby pin level is driven low, a transition is made to hardware standby mode.
rev. 2.00, 05/03, page 687 of 846 23.10 direct transitions there are three modes, high-speed, medium-speed, and subactive, in which the cpu executes programs. when a direct transition is made, there is no interruption of program execution when shifting between high-speed and subactive modes. direct transitions are enabled by setting the lpwrcr dton bit to 1, then executing the sleep instruction. after a transition, direct transition interrupt exception processing starts. 23.10.1 direct transitions from high-speed mode to subactive mode execute the sleep instruction in high-speed mode when the ssby bit in sbycr = 1, the lson bit in lpwrcr = 1, and the dton bit = 1, and the pss bit in tscr_1 (wdt_1) = 1 to make a transition to subactive mode. 23.10.2 direct transitions from subactive mode to high-speed mode execute the sleep instruction in subactive mode when the ssby bit in sbycr = 1, the lson bit in lpwrcr = 0, and the dton bit = 1, and the pss bit in tscr_1 (wdt_1) = 1 to make a direct transition to high-speed mode after the time set in sts2 to sts0 bits in sbycr has elapsed. 23.11 clock output enable the pstop bit in sckcr and the ddr of the corresponding port control the clock output. when the pstop bit is set to 1, clock stops at the end of the bus cycle and the clock output is fixed high. when the pstop bit is cleared to 0, the clock output is enabled. when the ddr of the corresponding port is cleared to 0, the clock output is disabled and it functions as an input port. table 23.4 lists the pin states in respective process.
rev. 2.00, 05/03, page 688 of 846 table 23.4 pin states in respective processes ddr 0 1 pstop ? 01 hardware standby mode high impedance high impedance high impedance software standby mode, watch mode, direct transition high impedance fixed to high fixed high sleep mode, subsleep mode high impedance output fixed high high-speed mode, medium-speed mode, subactive mode high impedance output fixed high 23.12 usage notes 23.12.1 i/o port status in software standby mode and watch mode, i/o port states are retained. therefore, there is no reduction in current dissipation for the output current when a high-level signal is output. 23.12.2 current dissipation during oscillation settling wait period current dissipation increases during the oscillation settling wait period. 23.12.3 dtc and dmac module stop depending on the operating status of the dtc and dmac * , the mstpa6 bit and mstpa7 bit may not be set to 1. setting of the dtc and dmac * module stop mode should be carried out only when the respective module is not activated. for details, refer to section 8, dma controller (dmac) and section 9, data transfer controller (dtc). note: * supported only by the h8s/2239 group.
rev. 2.00, 05/03, page 689 of 846 23.12.4 on-chip peripheral module interrupt ? module stop mode relevant interrupt operations cannot be performed in module stop mode. consequently, if module stop mode is entered when an interrupt has been requested, it will not be possible to clear the cpu interrupt source or the dmac * or dtc activation source. interrupts should therefore be disabled before entering module stop mode. ? subactive mode/watch mode on-chip peripheral modules (dmac * , dtc, tpu, iic) that stop operation in subactive mode cannot clear interrupts in subactive mode. therefore, if subactive mode is entered when an interrupt is requested, cpu interrupt factors cannot be cleared. interrupts should therefore before executing the sleep instruction and entering subactive or watch mode. note: * supported only by the h8s/2239 group. 23.12.5 writing to mstpcr mstpcr should only be written to by the cpu. 23.12.6 entering subactive/watch mode and dmac and dtc module stop to enter subactive or watch mode, set dmac * and dtc to module stop (write 1 to the mstpa6 bit and mstpa7 bit) and reading the mstpa6 bit and mstpa7 bit as 1 before transiting mode. after transiting from subactive mode to active mode, clear module stop. when dmac * or dtc activation factor occurs in subactive mode, dmac * or dtc is activated when module stop is cleared after active mode is entered. note: * supported only by the h8s/2239 group.
rev. 2.00, 05/03, page 690 of 846
rev. 2.00, 05/03, page 691 of 846 section 24 power supply circuit 24.1 overview the h8s/2238b group incorporates an internal power supply step-down circuit. use of this circuit enables the internal power supply to be fixed at a constant level of approximately 3.0 v, independently of the voltage of the power supply connected to the external v cc pin. as a result, the current consumed when an external power supply is used at 3.0 v or above can be held down to virtually the same low level as when used at approximately 3.0 v. if the external power supply is 3.0 v or below, the internal voltage will be practically the same as the external voltage. the h8s/2239, h8s/2238r, h8s/2237, and h8s/2227 do not have an on-chip internal power supply voltage step-down circuit. an external power supply should be connected to the v cc and cv cc pins. 24.2 power supply connection for h8s/2238b (on-chip internal power supply step-down circuit) connect the external power supply to the v cc pin, and connect a capacitance of approximately 0.1 f between cv cc and v ss , as shown in figure 24.1. the internal step-down circuit is made effective simply by adding this external circuit. permanent damage on the chip may result if the absolute maximum rating of cv cc 4.3v is exceeded. must not connect the external power supply to the cv cc pin. notes: 1. in the external circuit interface, the external power supply voltage connected to v cc and the gnd potential connected to v ss are the reference levels. for example, for port input/output levels, the v cc level is the reference for the high level, and the v ss level is that for the low level. 2. the a/d converter and d/a converter analog power supply are not affected by internal step-down processing.
rev. 2.00, 05/03, page 692 of 846 cv cc v ss internal logic step-down circuit internal power supply stabilization capacitance (approx. 0.1 f) v cc v cc = 2.7 v to 5.5 v (in the f-ztat version, v cc = 3.0 v to 5.5 v) figure 24.1 power supply connection for h8s/2238b (on-chip internal power supply step-down circuit) 24.3 power supply connection for h8s/2239, h8s/2238r, h8s/2237, and h8s/2227 (no internal power supply step-down circuit) the h8s/2239, h8s/2238r, h8s/2237, and h8s/2227 do not have an on-chip internal power supply voltage step-down circuit. connect the external power supply to the v cc pin and cv cc pin, as shown in figure 24.2. the external power supply is then input directly to the internal power supply. note: the permissible range for the power supply voltage is 2.2 v to 3.6 v (in the f-ztat version, 2.7 v to 3.6 v). operation cannot be guaranteed if a voltage outside this range (less than 2.2 v or more than 3.6 v) is input. cv cc v ss internal logic internal power supply v cc v cc = 2.2 v to 3.6 v (in the f-ztat version, v cc = 2.7 v to 3.6 v) figure 24.2 power supply connection for h8s/2239, h8s/2238r, h8s/2237, and h8s/2227 (no internal power supply step-down circuit)
rev. 2.00, 05/03, page 693 of 846 24.4 note on bypass capacitor a laminated ceramic capacitor of 0.01
rev. 2.00, 05/03, page 694 of 846
rev. 2.00, 05/03, page 695 of 846 section 25 list of registers this section gives information on the on-chip i/o registers and is configured as described below. 1.register addresses (in address order) ? descriptions by functional module, in ascending order of addresses ? descriptions by functional module ? the number of access states are given. 2.register bits ? bit configurations of the registers are described in the same order as the register addresses (in address order). ? reserved bits are indicated by ? in the bit name. ? a blank in the bit name indicates that the corresponding whole register is allocated to the counter or data. 3.register states in each operating mode ? register states are described in the same order as the register addresses (in address order). ? the register states described are for the basic operating modes. if there is a specific reset for an on-chip module, refer to the section on that on-chip module. 25.1 register addresses (in address order) the data bus width indicates the number of bits by which the register is accessed. the number of access states indicates the number of states based on the specified reference clock. register name abbrevia- tion bit no. address * 1 module data bus width access state dtc mode register a mra 8 h'ebc0 to dtc 16/32 * 2 2 dtc mode register b mrb 8 h'efbf dtc 16/32 * 2 2 dtc source address register sar 24 dtc 16/32 * 2 2 dtc destination address register dar 24 dtc 16/32 * 2 2 dtc transfer count register a cra 16 dtc 16/32 * 2 2 dtc transfer count register b crb 16 dtc 16/32 * 2 2 d/a data register_0 dadr_0 8 h'fdac d/a converter 82 d/a data register_1 dadr_1 8 h'fdad d/a converter 82
rev. 2.00, 05/03, page 696 of 846 register name abbrevia- tion bit no. address * 1 module data bus width access state d/a control register dacr 8 h'fdae d/a converter 82 serial control register x scrx 8 h'fdb4 iic, flash 82 ddc switch register ddcswr 8 h'fdb5 iic 8 2 timer control register_2 tcr_2 8 h'fdc0 tmr_2 8 2 timer control register_3 tcr_3 8 h'fdc1 tmr_3 8 2 timer control/status register_2 tcsr_2 8 h'fdc2 tmr_2 8 2 timer control/status register_3 tcsr_3 8 h'fdc3 tmr_3 8 2 time constant register a_2 tcora_2 8 h'fdc4 tmr_2 8/16 2 time constant register a_3 tcora_3 8 h'fdc5 tmr_3 8/16 2 time constant register b_2 tcorb_2 8 h'fdc6 tmr_2 8/16 2 time constant register b_3 tcorb_3 8 h'fdc7 tmr_3 8/16 2 timer counter_2 tcnt_2 8 h'fdc8 tmr_2 8/16 2 timer counter_3 tcnt_3 8 h'fdc9 tmr_3 8/16 2 serial mode register_3 smr_3 8 h'fdd0 sci_3 8 2 bit rate register_3 brr_3 8 h'fdd1 sci_3 8 2 serial control register_3 scr_3 8 h'fdd2 sci_3 8 2 transmit data register_3 tdr_3 8 h'fdd3 sci_3 8 2 serial status register_3 ssr_3 8 h'fdd4 sci_3 8 2 receive data register_3 rdr_3 8 h'fdd5 sci_3 8 2 smart card mode register_3 scmr_3 8 h'fdd6 sci_3 8 2 standby control register sbycr 8 h'fde4 system 8 2 system control register syscr 8 h'fde5 system 8 2 system clock control register sckcr 8 h'fde6 system 8 2 mode control register mdcr 8 h'fde7 system 8 2 module stop control register a mstpcra 8 h'fde8 system 8 2 module stop control register b mstpcrb 8 h'fde9 system 8 2 module stop control register c mstpcrc 8 h'fdea system 8 2 pin function control register pfcr 8 h'fdeb bsc 8 2 low power control register lpwrcr 8 h'fdec system 8 2 serial expansion mode register 0 semr_0 8 h'fdf8 sci_0 8 2
rev. 2.00, 05/03, page 697 of 846 register name abbrevia- tion bit no. address * 1 module data bus width access state break address register a bara 32 h'fe00 pbc 8/16 2 break address register b barb 32 h'fe04 pbc 8/16 2 break control register a bcra 8 h'fe08 pbc 8/16 2 break control register b bcrb 8 h'fe09 pbc 8/16 2 irq sense control register hiscrh8 h'fe12 int 8 2 irq sense control register l iscrl 8 h'fe13 int 8 2 irq enable register ier 8 h'fe14 int 8 2 irq status register isr 8 h'fe15 int 8 2 dtc enable register a dtcera 8 h'fe16 dtc 8 2 dtc enable register b dtcerb 8 h'fe17 dtc 8 2 dtc enable register c dtcerc 8 h'fe18 dtc 8 2 dtc enable register d dtcerd 8 h'fe19 dtc 8 2 dtc enable register e dtcere 8 h'fe1a dtc 8 2 dtc enable register f dtcerf 8 h'fe1b dtc 8 2 dtc enable register i dtceri 8 h'fe1e dtc 8 2 dtc vector register dtvecr 8 h'fe1f dtc 8 2 port 1 data direction register p1ddr 8 h'fe30 port 8 2 port 3 data direction register p3ddr 8 h'fe32 port 8 2 port 7 data direction register p7ddr 8 h'fe36 port 8 2 port a data direction register paddr 8 h'fe39 port 8 2 port b data direction register pbddr 8 h'fe3a port 8 2 port c data direction register pcddr 8 h'fe3b port 8 2 port d data direction register pdddr 8 h'fe3c port 8 2 port e data direction register peddr 8 h'fe3d port 8 2 port f data direction register pfddr 8 h'fe3e port 8 2 port g data direction register pgddr 8 h'fe3f port 8 2 port a pull-up mos control register papcr 8 h'fe40 port 8 2 port b pull-up mos control register pbpcr 8 h'fe41 port 8 2 port c pull-up mos control register pcpcr 8 h'fe42 port 8 2
rev. 2.00, 05/03, page 698 of 846 register name abbrevia- tion bit no. address * 1 module data bus width access state port d pull-up mos control register pdpcr 8 h'fe43 port 8 2 port e pull-up mos control register pepcr 8 h'fe44 port 8 2 port 3 open drain control register p3odr 8 h'fe46 port 8 2 port a open drain control register paodr 8 h'fe47 port 8 2 timer control register_3 tcr_3 8 h'fe80 tpu_3 8 2 timer mode register_3 tmdr_3 8 h'fe81 tpu_3 8 2 timer i/o control register h_3 tiorh_3 8 h'fe82 tpu_3 8 2 timer i/o control register l_3 tiorl_3 8 h'fe83 tpu_3 8 2 timer interrupt enable register_3 tier_3 8 h'fe84 tpu_3 8 2 timer status register_3 tsr_3 8 h'fe85 tpu_3 8 2 timer counter_3 tcnt_3 16 h'fe86 tpu_3 16 2 timer general register a_3 tgra_3 16 h'fe88 tpu_3 16 2 timer general register b_3 tgrb_3 16 h'fe8a tpu_3 16 2 timer general register c_3 tgrc_3 16 h'fe8c tpu_3 16 2 timer general register d_3 tgrd_3 16 h'fe8e tpu_3 16 2 timer control register_4 tcr_4 8 h'fe90 tpu_4 8 2 timer mode register_4 tmdr_4 8 h'fe91 tpu_4 8 2 timer i/o control register_4 tior_4 8 h'fe92 tpu_4 8 2 timer interrupt enable register_4 tier_4 8 h'fe94 tpu_4 8 2 timer status register_4 tsr_4 8 h'fe95 tpu_4 8 2 timer counter_4 tcnt_4 16 h'fe96 tpu_4 16 2 timer general register a_4 tgra_4 16 h'fe98 tpu_4 16 2 timer general register b_4 tgrb_4 16 h'fe9a tpu_4 16 2 timer control register_5 tcr_5 8 h'fea0 tpu_5 8 2 timer mode register_5 tmdr_5 8 h'fea1 tpu_5 8 2 timer i/o control register_5 tior_5 8 h'fea2 tpu_5 8 2 timer interrupt enable register_5 tier_5 8 h'fea4 tpu_5 8 2 timer status register_5 tsr_5 8 h'fea5 tpu_5 8 2 timer counter_5 tcnt_5 16 h'fea6 tpu_5 16 2 timer general register a_5 tgra_5 16 h'fea8 tpu_5 16 2 timer general register b_5 tgrb_5 16 h'feaa tpu_5 16 2
rev. 2.00, 05/03, page 699 of 846 register name abbrevia- tion bit no. address * 1 module data bus width access state timer start register tstr 8 h'feb0 tpu 8 2 timer synchro register tsyr 8 h'feb1 tpu 8 2 interrupt priority register a ipra 8 h'fec0 int 8 2 interrupt priority register b iprb 8 h'fec1 int 8 2 interrupt priority register c iprc 8 h'fec2 int 8 2 interrupt priority register d iprd 8 h'fec3 int 8 2 interrupt priority register e ipre 8 h'fec4 int 8 2 interrupt priority register f iprf 8 h'fec5 int 8 2 interrupt priority register g iprg 8 h'fec6 int 8 2 interrupt priority register hiprh8 h'fec7 int 8 2 interrupt priority register i ipri 8 h'fec8 int 8 2 interrupt priority register j iprj 8 h'fec9 int 8 2 interrupt priority register k iprk 8 h'feca int 8 2 interrupt priority register l iprl 8 h'fecb int 8 2 interrupt priority register o ipro 8 h'fece int 8 2 bus width control register abwcr 8 h'fed0 bsc 8 2 access state control register astcr 8 h'fed1 bsc 8 2 wait control register hwcrh8 h'fed2 bsc 8 2 wait control register l wcrl 8 h'fed3 bsc 8 2 bus control register hbcrh8 h'fed4 bsc 8 2 bus control register l bcrl 8 h'fed5 bsc 8 2 ram emulation register ramer 8 h'fedb flash 8 2 memory address register_0ahmar_0ah16 h'fee0 dmac 16 2 memory address register_0al mar_0al 16 h'fee2 dmac 16 2 i/o address register_0a ioar_0a 16 h'fee4 dmac 16 2 execute transfer count register_0a etcr_0a 16 h'fee6 dmac 16 2 memory address register_0bhmar_0bh16 h'fee8 dmac 16 2 memory address register_0bl mar_0bl 16 h'feea dmac 16 2 i/o address eegister_0b ioar_0b 16 h'feec dmac 16 2 execute transfer count register_0b etcr_0b 16 h'feee dmac 16 2 memory address register_1ahmar_1ah16 h'fef0 dmac 16 2 memory address register_1al mar_1al 16 h'fef2 dmac 16 2
rev. 2.00, 05/03, page 700 of 846 register name abbrevia- tion bit no. address * 1 module data bus width access state i/o address register_1a ioar_1a 16 h'fef4 dmac 16 2 execute transfer count register_1a etcr1a 16 h'fef6 dmac 16 2 memory address register_1bhmar_1bh16 h'fef8 dmac 16 2 memory address register_1bl mar_1bl 16 h'fefa dmac 16 2 i/o address register_1b ioar_1b 16 h'fefc dmac 16 2 execute transfer count register_1b etcr_1b 16 h'fefe dmac 16 2 port 1 data register p1dr 8 h'ff00 port 8 2 port 3 data register p3dr 8 h'ff02 port 8 2 port 7 data register p7dr 8 h'ff06 port 8 2 port a data register padr 8 h'ff09 port 8 2 port b data register pbdr 8 h'ff0a port 8 2 port c data register pcdr 8 h'ff0b port 8 2 port d data register pddr 8 h'ff0c port 8 2 port e data register pedr 8 h'ff0d port 8 2 port f data register pfdr 8 h'ff0e port 8 2 port g data register pgdr 8 h'ff0f port 8 2 timer control register_0 tcr_0 8 h'ff10 tpu_0 8 2 timer mode register_0 tmdr_0 8 h'ff11 tpu_0 8 2 timer i/o control register h_0 tiorh_0 8 h'ff12 tpu_0 8 2 timer i/o control register l_0 tiorl_0 8 h'ff13 tpu_0 8 2 timer interrupt enable register_0 tier_0 8 h'ff14 tpu_0 8 2 timer status register_0 tsr_0 8 h'ff15 tpu_0 8 2 timer counter_0 tcnt_0 16 h'ff16 tpu_0 16 2 timer general register a_0 tgra_0 16 h'ff18 tpu_0 16 2 timer general register b_0 tgrb_0 16 h'ff1a tpu_0 16 2 timer general register c_0 tgrc_0 16 h'ff1c tpu_0 16 2 timer general register d_0 tgrd_0 16 h'ff1e tpu_0 16 2
rev. 2.00, 05/03, page 701 of 846 register name abbrevia- tion bit no. address * 1 module data bus width access state timer control register_1 tcr_1 8 h'ff20 tpu_1 8 2 timer mode register_1 tmdr_1 8 h'ff21 tpu_1 8 2 timer i/o control register_1 tior_1 8 h'ff22 tpu_1 8 2 timer interrupt enable register_1 tier_1 8 h'ff24 tpu_1 8 2 timer status register_1 tsr_1 8 h'ff25 tpu_1 8 2 timer counter_1 tcnt_1 16 h'ff26 tpu_1 16 2 timer general register a_1 tgra_1 16 h'ff28 tpu_1 16 2 timer general register b_1 tgrb_1 16 h'ff2a tpu_1 16 2 timer control register_2 tcr_2 8 h'ff30 tpu_2 8 2 timer mode register_2 tmdr_2 8 h'ff31 tpu_2 8 2 timer i/o control register_2 tior_2 8 h'ff32 tpu_2 8 2 timer interrupt enable register_2 tier_2 8 h'ff34 tpu_2 8 2 timer status register_2 tsr_2 8 h'ff35 tpu_2 8 2 timer counter_2 tcnt_2 16 h'ff36 tpu_2 16 2 timer general register a_2 tgra_2 16 h'ff38 tpu_2 16 2 timer general register b_2 tgrb_2 16 h'ff3a tpu_2 16 2 dma write enable register dmawer 8 h'ff60 dmac 8 2 dma terminal control register dmatcr 8 h'ff61 dmac 8 2 dma control register_0a dmacr_0 a 8 h'ff62 dmac 16 2 dma control register_0b dmacr_0 b 8 h'ff63 dmac 16 2 dma control register_1a dmacr_1 a 8 h'ff64 dmac 16 2 dma control register_1b dmacr_1 b 8 h'ff65 dmac 16 2 dma band control register hdmabcrh8 h'ff66 dmac 16 2 dma band control register l dmabcrl 8 h'ff67 dmac 16 2 timer control register_0 tcr_0 8 h'ff68 tmr_0 8 2 timer control register_1 tcr_1 8 h'ff69 tmr_1 8 2 timer control/status register_0 tcsr_0 8 h'ff6a tmr_0 8 2 timer control/status register_1 tcsr_1 8 h'ff6b tmr_1 8 2
rev. 2.00, 05/03, page 702 of 846 register name abbrevia- tion bit no. address * 1 module data bus width access state time constant register a_0 tcora_0 8 h'ff6c tmr_0 8/16 2 time constant register a_1 tcora_1 8 h'ff6d tmr_1 8/16 2 time constant register b_0 tcorb_0 8 h'ff6e tmr_0 8/16 2 time constant register b_1 tcorb_1 8 h'ff6f tmr_1 8/16 2 timer counter_0 tcnt_0 8 h'ff70 tmr_0 8/16 2 timer counter_1 tcnt_1 8 h'ff71 tmr_1 8/16 2 timer control/status register_0 tcsr_0 8 h'ff74 wdt_0 16 2 timer counter_0 tcnt_0 8 h'ff74 (write) wdt_0 16 2 timer counter_0 tcnt_0 8 h'ff75 (read) wdt_0 16 2 reset control/status register rstcsr 8 h'ff76 (write) wdt_0 16 2 reset control/status register rstcsr 8 h'ff77 (read) wdt_0 16 2 serial mode register_0 smr_0 8 h'ff78 * 3 sci_0 8 2 i 2 c bus control register_0 iccr_0 8 h'ff78 * 3 iic_0 8 2 bit rate register_0 brr_0 8 h'ff79 * 3 sci_0 8 2 i 2 c bus status register_0 icsr_0 8 h'ff79 * 3 iic_0 8 2 serial control register_0 scr_0 8 h'ff7a sci_0 8 2 transmit data register_0 tdr_0 8 h'ff7b sci_0 8 2 serial status register_0 ssr_0 8 h'ff7c sci_0 8 2 receive data register_0 rdr_0 8 h'ff7d sci_0 8 2 smart card mode register_0 scmr_0 8 h'ff7e * 3 sci_0 8 2 i 2 c bus data register_0 icdr_0 8 h'ff7e * 3 iic_0 8 2 second slave address register_0 sarx_0 8 h'ff7e * 3 iic_0 8 2 i 2 c bus mode register_0 icmr_0 8 h'ff7f iic_0 8 2 slave address register_0 sar_0 8 h'ff7f iic_0 8 2
rev. 2.00, 05/03, page 703 of 846 register name abbrevia- tion bit no. address * 1 module data bus width access state serial mode register_1 smr_1 8 h'ff80 * 3 sci_1 8 2 i 2 c bus control register_1 iccr_1 8 h'ff80 * 3 iic_1 8 2 bit rate register_1 brr_1 8 h'ff81 * 3 sci_1 8 2 i 2 c bus status register_1 icsr_1 8 h'ff81 * 3 iic_1 8 2 serial control register_1 scr_1 8 h'ff82 sci_1 8 2 transmit data register_1 tdr_1 8 h'ff83 sci_1 8 2 serial status register_1 ssr_1 8 h'ff84 sci_1 8 2 receive data register_1 rdr_1 8 h'ff85 sci_1 8 2 smart card mode register_1 scmr_1 8 h'ff86 * 3 sci_1 8 2 i 2 c bus data register_1 icdr_1 8 h'ff86 * 3 iic_1 8 2 second slave address register_1 sarx_1 8 h'ff86 * 3 iic_1 8 2 i 2 c bus mode register_1 icmr_1 8 h'ff87 iic_1 8 2 slave address register_1 sar_1 8 h'ff87 iic_1 8 2 serial mode register_2 smr_2 8 h'ff88 sci_2 8 2 bit rate register_2 brr_2 8 h'ff89 sci_2 8 2 serial control register_2 scr_2 8 h'ff8a sci_2 8 2 transmit data register_2 tdr_2 8 h'ff8b sci_2 8 2 serial status register_2 ssr_2 8 h'ff8c sci_2 8 2 receive data register_2 rdr_2 8 h'ff8d sci_2 8 2 smart card mode register_2 scmr_2 8 h'ff8e sci_2 8 2 a/d data register ahaddrah8 h'ff90 a/d 8 2 a/d data register al addral 8 h'ff91 a/d 8 2 a/d data register bhaddrbh8 h'ff92 a/d 8 2 a/d data register bl addrbl 8 h'ff93 a/d 8 2 a/d data register chaddrch8 h'ff94 a/d 8 2 a/d data register cl addrcl 8 h'ff95 a/d 8 2 a/d data register dhaddrdh8 h'ff96 a/d 8 2 a/d data register dl addrdl 8 h'ff97 a/d 8 2 a/d control/status register adcsr 8 h'ff98 a/d 8 2 a/d control register adcr 8 h'ff99 a/d 8 2
rev. 2.00, 05/03, page 704 of 846 register name abbrevia- tion bit no. address * 1 module data bus width access state timer control/status register_1 tcsr_1 8 h'ffa2 wdt_1 16 2 timer counter_1 tcnt_1 8 h'ffa2 (write) wdt_1 16 2 timer counter_1 tcnt_1 8 h'ffa3 (read) wdt_1 16 2 flash memory control register 1 flmcr1 8 h'ffa8 flash 8 2 flash memory control register 2 flmcr2 8 h'ffa9 flash 8 2 erase block register 1 ebr1 8 h'ffaa flash 8 2 erase block register 2 ebr2 8 h'ffab flash 8 2 flash memory power control register flpwcr 8 h'ffac flash 8 2 port 1 register port1 8 h'ffb0 port 8 2 port 3 register port3 8 h'ffb2 port 8 2 port 4 register port4 8 h'ffb3 port 8 2 port 7 register port7 8 h'ffb6 port 8 2 port 9 register port9 8 h'ffb8 port 8 2 port a register porta 8 h'ffb9 port 8 2 port b register portb 8 h'ffba port 8 2 port c register portc 8 h'ffbb port 8 2 port d register portd 8 h'ffbc port 8 2 port e register porte 8 h'ffbd port 8 2 port f register portf 8 h'ffbe port 8 2 port g register portg 8 h'ffbf port 8 2 notes: * 1 lower 16 bits of the address. * 2 allocated on the on-chip ram. 32-bit bus when dtc accesses as register information, and 16-bit in other cases. * 3 part of registers sci_0 and sci_1 and part of registers iic_0 and iic_1 are allocated to the same address. use the iice bit of the serial control register x (scrx) to select the register.
rev. 2.00, 05/03, page 705 of 846 25.2 register bits register addresses and bit names of the on-chip peripheral modules are described below. each line covers eight bits, and 16-bit register is shown as 2 lines. register name bit 7 bit 6 bit 5bit 4 bit 3 bit 2 bit 1 bit 0 module mra sm1 sm0 dm1 dm0 md1 md0 dts sz dtc sar bit 23 bit 22 bit 21 bit 20 bit 19 bit 18 bit 17 bit 16 bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 mrb chne disel ?????? dar bit 23 bit 22 bit 21 bit 20 bit 19 bit 18 bit 17 bit 16 bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 cra bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 crb bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 dadr_0 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 d/a converter dadr_1 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 dacr daoe1 daoe0 dae ????? scrx ? iicx1 iicx0 iice flshe ??? iic, flash ddcswr ???? clr3 clr2 clr1 clr0 iic tcr_2 cmieb cmiea ovie cclr1 cclr0 cks2 cks1 cks0 tmr_2 tcr_3 cmieb cmiea ovie cclr1 cclr0 cks2 cks1 cks0 tmr_3 tcsr_2 cmfb cmfa ovf ? os3 os2 os1 os0 tmr_2 tcsr_3 cmfb cmfa ovf ? os3 os2 os1 os0 tmr_3 tcora_2 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 tmr_2 tcora_3 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 tmr_3 tcorb_2 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 tmr_2 tcorb_3 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 tmr_3 tcnt_2 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 tmr_2 tcnt_3 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 tmr_3
rev. 2.00, 05/03, page 706 of 846 register name bit 7 bit 6 bit 5bit 4 bit 3 bit 2 bit 1 bit 0 module smr_3 * 1 c/ a chr pe o/ e stop mp cks1 cks0 sci_3 (gm) (blk) (pe) (o/ e) (bcp1) (bcp0) (cks1) (cks0) brr_3 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 scr_3 tie rie te re mpie teie cke1 cke0 tdr_3 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 ssr_3 * 1 tdre rdrf orer fer per tend mpb mpbt (tdre) (rdrf) (orer) (ers) (per) (tend) (mpb) (mpbt) rdr_3 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 scmr_3 ???? sdir sinv ? smif sbycr ssby sts2 sts1 sts0 ope ??? system syscr ?? intm1 intm0 nmieg mrese ? rame sckcr pstop ???? sck2 sck1 sck0 mdcr ????? mds2 mds1 mds0 mstpcra mstpa7 mstpa6 mstpa5 mstpa4 mstpa3 mstpa2 mstpa1 mstpa0 mstpcrb mstpb7 mstpb6 mstpb5 mstpb4 mstpb3 mstpb2 mstpb1 mstpb0 mstpcrc mstpc7 mstpc6 mstpc5 mstpc4 mstpc3 mstpc2 mstpc1 mstpc0 pfcr ?? buzze ? ae3 ae2 ae1 ae0 bsc lpwrcr dton lson nesel substp rfcut ? stc1 stc0 system semr_0 sse ??? abcs acs2 acs1 acs0 sci_0 bara ???????? pbc baa23 baa22 baa21 baa20 baa19 baa18 baa17 baa16 baa15 baa14 baa13 baa12 baa11 baa10 baa9 baa8 baa7 baa6 baa5 baa4 baa3 baa2 baa1 baa0 barb ???????? bab23 bab22 bab21 bab20 bab19 bab18 bab17 bab16 bab15 bab14 bab13 bab12 bab11 bab10 bab9 bab8 bab7 bab6 bab5 bab4 bab3 bab2 bab1 bab0 bcra cmfa cda bamra2 bamra1 bamra0 csela1 csela0 biea bcrb cmfb cdb bamrb2 bamrb1 bamrb0 cselb1 cselb0 bieb
rev. 2.00, 05/03, page 707 of 846 register name bit 7 bit 6 bit 5bit 4 bit 3 bit 2 bit 1 bit 0 module iscrhirq7scb irq7sca irq6scb irq6sca irq5scb irq5sca irq4scb irq4sca int iscrl irq3scb irq3sca irq2scb irq2sca irq1scb irq1sca irq0scb irq0sca ier irq7e irq6e irq5e irq4e irq3e irq2e irq1e irq0e isr irq7f irq6f irq5f irq4f irq3f irq2f irq1f irq0f dtcera dtcea7 dtcea6 dtcea5 dtcea4 dtcea3 dtcea2 dtcea1 dtcea0 dtc dtcerb ? dtceb6 dtceb5 dtceb4 dtceb3 dtceb2 dtceb1 dtceb0 dtcerc dtcec7 dtcec6 dtcec5 dtcec4 dtcec3 dtcec2 dtcec1 dtcec0 dtcerd ?? dtced5 dtced4 dtced3 dtced2 dtced1 dtced0 dtcere dtcee7 dtcee6 dtcee5 dtcee4 dtcee3 dtcee2 dtcee1 dtcee0 dtcerf dtcef7 dtcef6 dtcef5 dtcef4 dtcef3 dtcef2 dtcef1 dtcef0 dtceri dtcei7 dtcei6 ?????? dtvecr swdte dtvec6 dtvec5 dtvec4 dtvec3 dtvec2 dtvec1 dtvec0 p1ddr p17ddr p16ddr p15ddr p14ddr p13ddr p12ddr p11ddr p10ddr port p3ddr ? p36ddr p35ddr p34ddr p33ddr p32ddr p31ddr p30ddr p7ddr p77ddr p76ddr p75ddr p74ddr p73ddr p72ddr p71ddr p70ddr paddr ???? pa3ddr pa2ddr pa1ddr pa0ddr pbddr pb7ddr pb6ddr pb5ddr pb4ddr pb3ddr pb2ddr pb1ddr pb0ddr pcddr pc7ddr pc6ddr pc5ddr pc4ddr pc3ddr pc2ddr pc1ddr pc0ddr pdddr pd7ddr pd6ddr pd5ddr pd4ddr pd3ddr pd2ddr pd1ddr pd0ddr peddr pe7ddr pe6ddr pe5ddr pe4ddr pe3ddr pe2ddr pe1ddr pe0ddr pfddr pf7ddr pf6ddr pf5ddr pf4ddr pf3ddr pf2ddr pf1ddr pf0ddr pgddr ??? pg4ddr pg3ddr pg2ddr pg1ddr pg0ddr papcr ???? pa3pcr pa2pcr pa1pcr pa0pcr pbpcr pb7pcr pb6pcr pb5pcr pb4pcr pb3pcr pb2pcr pb1pcr pb0pcr pcpcr pc7pcr pc6pcr pc5pcr pc4pcr pc3pcr pc2pcr pc1pcr pc0pcr pdpcr pd7pcr pd6pcr pd5pcr pd4pcr pd3pcr pd2pcr pd1pcr pd0pcr pepcr pe7pcr pe6pcr pe5pcr pe4pcr pe3pcr pe2pcr pe1pcr pe0pcr p3odr ? p36odr p35odr p34odr p33odr p32odr p31odr p30odr paodr ???? pa3odr pa2odr pa1odr pa0odr
rev. 2.00, 05/03, page 708 of 846 register name bit 7 bit 6 bit 5bit 4 bit 3 bit 2 bit 1 bit 0 module tcr_3 cclr2 cclr1 cclr0 ckeg1 ckeg0 tpsc2 tpsc1 tpsc0 tpu_3 tmdr_3 ?? bfb bfa md3 md2 md1 md0 tiorh_3 iob3 iob2 iob1 iob0 ioa3 ioa2 ioa1 ioa0 tiorl_3 iod3 iod2 iod1 iod0 ioc3 ioc2 ioc1 ioc0 tier_3 ttge ?? tciev tgied tgiec tgieb tgiea tsr_3 ??? tcfv tgfd tgfc tgfb tgfa tcnt_3 bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 tgra_3 bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 tgrb_3 bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 tgrc_3 bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 tgrd_3 bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 tcr_4 ? cclr1 cclr0 ckeg1 ckeg0 tpsc2 tpsc1 tpsc0 tpu_4 tmdr_4 ???? md3 md2 md1 md0 tior_4 iob3 iob2 iob1 iob0 ioa3 ioa2 ioa1 ioa0 tier_4 ttge ? tcieu tciev ?? tgieb tgiea tsr_4 tcfd ? tcfu tcfv ?? tgfb tgfa tcnt_4 bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 tgra_4 bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 tgrb_4 bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0
rev. 2.00, 05/03, page 709 of 846 register name bit 7 bit 6 bit 5bit 4 bit 3 bit 2 bit 1 bit 0 module tcr_5 ? cclr1 cclr0 ckeg1 ckeg0 tpsc2 tpsc1 tpsc0 tpu_5 tmdr_5 ???? md3 md2 md1 md0 tior_5 iob3 iob2 iob1 iob0 ioa3 ioa2 ioa1 ioa0 tier_5 ttge ? tcieu tciev ?? tgieb tgiea tsr_5 tcfd ? tcfu tcfv ?? tgfb tgfa tcnt_5 bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 tgra_5 bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 tgrb_5 bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 tstr ?? cst5 cst4 cst3 cst2 cst1 cst0 tpu tsyr ?? sync5 sync4 sync3 sync2 sync1 sync0 ipra ? ipr6 ipr5 ipr4 ? ipr2 ipr1 ipr0 int iprb ? ipr6 ipr5 ipr4 ? ipr2 ipr1 ipr0 iprc ? ipr6 ipr5 ipr4 ? ipr2 ipr1 ipr0 iprd ? ipr6 ipr5 ipr4 ? ipr2 ipr1 ipr0 ipre ? ipr6 ipr5 ipr4 ? ipr2 ipr1 ipr0 iprf ? ipr6 ipr5 ipr4 ? ipr2 ipr1 ipr0 iprg ? ipr6 ipr5 ipr4 ? ipr2 ipr1 ipr0 iprh ? ipr6 ipr5 ipr4 ? ipr2 ipr1 ipr0 ipri ? ipr6 ipr5 ipr4 ? ipr2 ipr1 ipr0 iprj ? ipr6 ipr5 ipr4 ? ipr2 ipr1 ipr0 iprk ? ipr6 ipr5 ipr4 ? ipr2 ipr1 ipr0 iprl ? ipr6 ipr5 ipr4 ? ipr2 ipr1 ipr0 ipro ? ipr6 ipr5 ipr4 ? ipr2 ipr1 ipr0 abwcr abw7 abw6 abw5 abw4 abw3 abw2 abw1 abw0 bsc astcr ast7 ast6 ast5 ast4 ast3 ast2 ast1 ast0 wcrhw71 w70 w61 w60 w51 w50 w41 w40 wcrl w31 w30 w21 w20 w11 w10 w01 w00 bcrhicis1 icis0 brstrm brsts1 brsts0 ??? bcrl brle ?????? waite
rev. 2.00, 05/03, page 710 of 846 register name bit 7 bit 6 bit 5bit 4 bit 3 bit 2 bit 1 bit 0 module ramer ???? rams ram2 ram1 ram0 flash mar_0a ???????? dmac bit 23 bit 22 bit 21 bit 20 bit 19 bit 18 bit 17 bit 16 bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 ioar_0a bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 etcr_0a bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 mar_0b ???????? bit 23 bit 22 bit 21 bit 20 bit 19 bit 18 bit 17 bit 16 bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 ioar_0b bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 etcr_0b bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 mar_1a ???????? bit 23 bit 22 bit 21 bit 20 bit 19 bit 18 bit 17 bit 16 bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 ioar_1a bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 etcr_1a bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 mar_1b ???????? bit 23 bit 22 bit 21 bit 20 bit 19 bit 18 bit 17 bit 16 bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 ioar_1b bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 etcr_1b bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0
rev. 2.00, 05/03, page 711 of 846 register name bit 7 bit 6 bit 5bit 4 bit 3 bit 2 bit 1 bit 0 module p1dr p17dr p16dr p15dr p14dr p13dr p12dr p11dr p10dr port p3dr ? p36dr p35dr p34dr p33dr p32dr p31dr p30dr p7dr p77dr p76dr p75dr p74dr p73dr p72dr p71dr p70dr padr ???? pa3dr pa2dr pa1dr pa0dr pbdr pb7dr pb6dr pb5dr pb4dr pb3dr pb2dr pb1dr pb0dr pcdr pc7dr pc6dr pc5dr pc4dr pc3dr pc2dr pc1dr pc0dr pddr pd7dr pd6dr pd5dr pd4dr pd3dr pd2dr pd1dr pd0dr pedr pe7dr pe6dr pe5dr pe4dr pe3dr pe2dr pe1dr pe0dr pfdr pf7dr pf6dr pf5dr pf4dr pf3dr pf2dr pf1dr pf0dr pgdr ??? pg4dr pg3dr pg2dr pg1dr pg0dr tcr_0 cclr2 cclr1 cclr0 ckeg1 ckeg0 tpsc2 tpsc1 tpsc0 tpu_0 tmdr_0 ?? bfb bfa md3 md2 md1 md0 tiorh_0 iob3 iob2 iob1 iob0 ioa3 ioa2 ioa1 ioa0 tiorl_0 iod3 iod2 iod1 iod0 ioc3 ioc2 ioc1 ioc0 tier_0 ttge ?? tciev tgied tgiec tgieb tgiea tsr_0 ??? tcfv tgfd tgfc tgfb tgfa tcnt_0 bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 tgra_0 bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 tgrb_0 bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 tgrc_0 bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 tgrd_0 bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0
rev. 2.00, 05/03, page 712 of 846 register name bit 7 bit 6 bit 5bit 4 bit 3 bit 2 bit 1 bit 0 module tcr_1 ? cclr1 cclr0 ckeg1 ckeg0 tpsc2 tpsc1 tpsc0 tpu_1 tmdr_1 ???? md3 md2 md1 md0 tior_1 iob3 iob2 iob1 iob0 ioa3 ioa2 ioa1 ioa0 tier_1 ttge ? tcieu tciev ?? tgieb tgiea tsr_1 tcfd ? tcfu tcfv ?? tgfb tgfa tcnt_1 bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 tgra_1 bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 tgrb_1 bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 tcr_2 ? cclr1 cclr0 ckeg1 ckeg0 tpsc2 tpsc1 tpsc0 tpu_2 tmdr_2 ???? md3 md2 md1 md0 tior_2 iob3 iob2 iob1 iob0 ioa3 ioa2 ioa1 ioa0 tier_2 ttge ? tcieu tciev ?? tgieb tgiea tsr_2 tcfd ? tcfu tcfv ?? tgfb tgfa tcnt_2 bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 tgra_2 bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 tgrb_2 bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0
rev. 2.00, 05/03, page 713 of 846 register name bit 7 bit 6 bit 5bit 4 bit 3 bit 2 bit 1 bit 0 module dmawer ???? we1b we1a we0b we0a dmac dmatcr ?? tee1 tee0 ???? dmacr_0a * 2 dtsz dtid rpe dtdir dtf3 dtf2 dtf1 dtf0 dmacr_0a * 3 dtsz said saide blkdir blke ??? dmacr_0b * 2 dtsz dtid rpe dtdir dtf3 dtf2 dtf1 dtf0 dmacr_0b * 3 ? daid daide ? dtf3 dtf2 dtf1 dtf0 dmacr_1a * 2 dtsz dtid rpe dtdir dtf3 dtf2 dtf1 dtf0 dmacr_1a * 3 dtsz said saide blkdir blke ??? dmacr_1b * 2 dtsz dtid rpe dtdir dtf3 dtf2 dtf1 dtf0 dmacr_1b * 3 ? daid daide ? dtf3 dtf2 dtf1 dtf0 dmabcrh * 2 fae1 fae0 sae1 sae0 dta1b dta1a dta0b dta0a dmabcrh * 3 fae1 fae0 ?? dta1 ? dta0 ? dmabcrl * 2 dte1b dte1a dte0b dte0a dtie1b dtie1a dtie0b dtie0a dmabcrl * 3 dtme1 dte1 dtme0 dte0 dtie1b dtie1a dtie0b dtie0a tcr_0 cmieb cmiea ovie cclr1 cclr0 cks2 cks1 cks0 tmr_0 tcr_1 cmieb cmiea ovie cclr1 cclr0 cks2 cks1 cks0 tmr_1 tcsr_0 cmfb cmfa ovf adte os3 os2 os1 os0 tmr_0 tcsr_1 cmfb cmfa ovf ? os3 os2 os1 os0 tmr_1 tcora_0 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 tmr_0 tcora_1 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 tmr_1 tcorb_0 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 tmr_0 tcorb_1 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 tmr_1 tcnt_0 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 tmr_0 tcnt_1 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 tmr_1 tcsr_0 ovf wt/ it tme ?? cks2 cks1 cks0 wdt_0 tcnt_0 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 rstcsr wovf rste rsts ????? smr_0 * 1 c/a (gm) chr (blk) pe (pe) o/ e (o/ e ) stop (bcp1) mp (bcp0) cks1 (cks1) cks0 (cks0) sci_0 iccr_0 ice ieic mst trs acke bbsy iric scp iic_0 brr_0 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 sci_0 icsr_0 estp stop irtr aasx al aas adz ackb iic_0
rev. 2.00, 05/03, page 714 of 846 register name bit 7 bit 6 bit 5bit 4 bit 3 bit 2 bit 1 bit 0 module scr_0 tie rie te re mpie teie cke1 cke0 sci_0 tdr_0 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 ssr_0 * 1 tdre (tdre) rdrf (rdrf) orer (orer) fer (ers) per (per) tend (tend) mpb (mpb) mpbt (mpbt) rdr_0 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 scmr_0 ???? sdir sinv ? smif icdr_0 icdr7 icdr6 icdr5 icdr4 icdr3 icdr2 icdr1 icdr0 iic_0 sarx_0 svax6 svax5 svax4 svax3 svax2 svax1 svax0 fsx icmr_0 mls wait cks2 cks1 cks0 bc2 bc1 bc0 sar_0 sva6 sva5 sva4 sva3 sva2 sva1 sva0 fs smr_1 * 1 c/a (gm) chr (blk) pe (pe) o/ e (o/ e ) stop (bcp1) mp (bcp0) cks1 (cks1) cks0 (cks0) sci_1 iccr_1 ice ieic mst trs acke bbsy iric scp iic_1 brr_1 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 sci_1 icsr_1 estp stop irtr aasx al aas adz ackb iic_1 scr_1 tie rie te re mpie teie cke1 cke0 sci_1 tdr_1 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 ssr_1 * 1 tdre (tdre) rdrf (rdrf) orer (orer) fer (ers) per (per) tend (tend) mpb (mpb) mpbt (mpbt) rdr_1 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 scmr_1 ???? sdir sinv ? smif icdr_1 icdr7 icdr6 icdr5 icdr4 icdr3 icdr2 icdr1 icdr0 iic_1 sarx_1 svax6 svax5 svax4 svax3 svax2 svax1 svax0 fsx icmr_1 mls wait cks2 cks1 cks0 bc2 bc1 bc0 sar_1 sva6 sva5 sva4 sva3 sva2 sva1 sva0 fs smr_2 * 1 c/a (gm) chr (blk) pe (pe) o/ e (o/ e ) stop (bcp1) mp (bcp0) cks1 (cks1) cks0 (cks0) sci_2 brr_2 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 scr_2 tie rie te re mpie teie cke1 cke0 tdr_2 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 ssr_2 * 1 tdre (tdre) rdrf (rdrf) orer (orer) fer (ers) per (per) tend (tend) mpb (mpb) mpbt (mpbt) rdr_2 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 scmr_2 ???? sdir sinv ? smif
rev. 2.00, 05/03, page 715 of 846 register name bit 7 bit 6 bit 5bit 4 bit 3 bit 2 bit 1 bit 0 module addrahad9 ad8 ad7 ad6 ad5 ad4 ad3 ad2 a/d converter addral ad1 ad0 ?????? addrbhad9 ad8 ad7 ad6 ad5 ad4 ad3 ad2 addrbl ad1 ad0 ?????? addrchad9 ad8 ad7 ad6 ad5 ad4 ad3 ad2 addrcl ad1 ad0 ?????? addrdhad9 ad8 ad7 ad6 ad5 ad4 ad3 ad2 addrdl ad1 ad0 ?????? adcsr adf adie adst scan ? ch2ch1ch0 adcr trgs1 trgs0 ?? cks1 cks0 ?? tcsr_1 ovf wt/ it tme pss rst/ nmi cks2 cks1 cks0 wdt_1 tcnt_1 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 flmcr1 fwe swe1 esu1 psu1 ev1 pv1 e1 p1 flash flmcr2 fler ??????? ebr1 eb7 eb6 eb5 eb4 eb3 eb2 eb1 eb0 ebr2 ?? eb13 eb12 eb11 eb10 eb9 eb8 flpwcr pdwnd ??????? port1 p17 p16 p15 p14 p13 p12 p11 p10 port port3 ? p36 p35 p34 p33 p32 p31 p30 port4 p47 p46 p45 p44 p43 p42 p41 p40 port7 p77 p76 p75 p74 p73 p72 p71 p70 port9 p97 p96 ?????? porta ???? pa3 pa2 pa1 pa0 portb pb7 pb6 pb5 pb4 pb3 pb2 pb1 pb0 portc pc7 pc6 pc5 pc4 pc3 pc2 pc1 pc0 portd pd7 pd6 pd5 pd4 pd3 pd2 pd1 pd0 porte pe7 pe6 pe5 pe4 pe3 pe2 pe1 pe0 portf pf7 pf6 pf5 pf4 pf3 pf2 pf1 pf0 portg ??? pg4 pg3 pg2 pg1 pg0 notes: * 1 some bit names differ depending on whether used in normal mode and smart card interface mode. the name in ( ) indicates the name in smart card interface mode. * 2 short address mode * 3 full address mode
rev. 2.00, 05/03, page 716 of 846 25.3 register states in each operating mode register name reset manual reset high- speed medium- speed sleep module stop watch sub- active sub- sleep software standby hardware standby module mra initialized initialized ???????? initialized dtc sar initialized initialized ???????? initialized mrb initialized initialized ???????? initialized dar initialized initialized ???????? initialized cra initialized initialized ???????? initialized crb initialized initialized ???????? initialized dadr_0 initialized initialized ???????? initialized d/a dadr_1 initialized initialized ???????? initialized dacr initialized initialized ???????? initialized scrx initialized initialized ???????? initialized iic ddcswr initialized initialized ???????? initialized tcr_2 initialized initialized ???????? initialized tmr_2 tcr_3 initialized initialized ???????? initialized tmr_3 tcsr_2 initialized initialized ???????? initialized tmr_2 tcsr_3 initialized initialized ???????? initialized tmr_3 tcora_2 initialized initialized ???????? initialized tmr_2 tcora_3 initialized initialized ???????? initialized tmr_3 tcorb_2 initialized initialized ???????? initialized tmr_2 tcorb_3 initialized initialized ???????? initialized tmr_3 tcnt_2 initialized initialized ???????? initialized tmr_2 tcnt_3 initialized initialized ???????? initialized tmr_3 smr_3 initialized initialized ???????? initialized sci_3 brr_3 initialized initialized ???????? initialized scr_3 initialized initialized ???????? initialized tdr_3 initialized initialized ??? initialized initialized initialized initialized initialized initialized ssr_3 initialized initialized ??? initialized initialized initialized initialized initialized initialized rdr_3 initialized initialized ??? initialized initialized initialized initialized initialized initialized scmr_3 initialized initialized ???????? initialized
rev. 2.00, 05/03, page 717 of 846 register name reset manual reset high- speed medium- speed sleep module stop watch sub- active sub- sleep software standby hardware standby module sbycr initialized initialized ???????? initialized system syscr initialized ????????? initialized sckcr initialized initialized ???????? initialized mdcr initialized ????????? initialized mstpcra initialized initialized ???????? initialized mstpcrb initialized initialized ???????? initialized mstpcrc initialized initialized ???????? initialized pfcr initialized ????????? initialized bsc lpwrcr initialized ????????? initialized system semr_0 initialized initialized ???????? initialized sci_0 bara initialized initialized ???????? initialized pbc barb initialized initialized ???????? initialized bcra initialized initialized ???????? initialized bcrb initialized initialized ???????? initialized iscrhinitialized initialized ???????? initialized int iscrl initialized initialized ???????? initialized ier initialized initialized ???????? initialized isr initialized initialized ???????? initialized dtcera initialized initialized ???????? initialized dtc dtcerb initialized initialized ???????? initialized dtcerc initialized initialized ???????? initialized dtcerd initialized initialized ???????? initialized dtcere initialized initialized ???????? initialized dtcerf initialized initialized ???????? initialized dtceri initialized initialized ???????? initialized dtvecr initialized initialized ???????? initialized
rev. 2.00, 05/03, page 718 of 846 register name reset manual reset high- speed medium- speed sleep module stop watch sub- active sub- sleep software standby hardware standby module p1ddr initialized ????????? initialized port p3ddr initialized ????????? initialized p7ddr initialized ????????? initialized paddr initialized ????????? initialized pbddr initialized ????????? initialized pcddr initialized ????????? initialized pdddr initialized ????????? initialized peddr initialized ????????? initialized pfddr initialized ????????? initialized pgddr initialized ????????? initialized papcr initialized ????????? initialized pbpcr initialized ????????? initialized pcpcr initialized ????????? initialized pdpcr initialized ????????? initialized pepcr initialized ????????? initialized p3odr initialized ????????? initialized paodr initialized ????????? initialized tcr_3 initialized initialized ???????? initialized tpu_3 tmdr_3 initialized initialized ???????? initialized tiorh_3 initialized initialized ???????? initialized tiorl_3 initialized initialized ???????? initialized tier_3 initialized initialized ???????? initialized tsr_3 initialized initialized ???????? initialized tcnt_3 initialized initialized ???????? initialized tgra_3 initialized initialized ???????? initialized tgrb_3 initialized initialized ???????? initialized tgrc_3 initialized initialized ???????? initialized tgrd_3 initialized initialized ???????? initialized
rev. 2.00, 05/03, page 719 of 846 register name reset manual reset high- speed medium- speed sleep module stop watch sub- active sub- sleep software standby hardware standby module tcr_4 initialized initialized ???????? initialized tpu_4 tmdr_4 initialized initialized ???????? initialized tior_4 initialized initialized ???????? initialized tier_4 initialized initialized ???????? initialized tsr_4 initialized initialized ???????? initialized tcnt_4 initialized initialized ???????? initialized tgra_4 initialized initialized ???????? initialized tgrb_4 initialized initialized ???????? initialized tcr_5 initialized initialized ???????? initialized tpu_5 tmdr_5 initialized initialized ???????? initialized tior_5 initialized initialized ???????? initialized tier_5 initialized initialized ???????? initialized tsr_5 initialized initialized ???????? initialized tcnt_5 initialized initialized ???????? initialized tgra_5 initialized initialized ???????? initialized tgrb_5 initialized initialized ???????? initialized tstr initialized initialized ???????? initialized tpu tsyr initialized initialized ???????? initialized ipra initialized initialized ???????? initialized int iprb initialized initialized ???????? initialized iprc initialized initialized ???????? initialized iprd initialized initialized ???????? initialized ipre initialized initialized ???????? initialized iprf initialized initialized ???????? initialized iprg initialized initialized ???????? initialized iprhinitialized initialized ???????? initialized ipri initialized initialized ???????? initialized iprj initialized initialized ???????? initialized iprk initialized initialized ???????? initialized iprl initialized initialized ???????? initialized ipro initialized initialized ???????? initialized
rev. 2.00, 05/03, page 720 of 846 register name reset manual reset high- speed medium- speed sleep module stop watch sub- active sub- sleep software standby hardware standby module abwcr initialized ????????? initialized bsc astcr initialized ????????? initialized wcrhinitialized ????????? initialized wcrl initialized ????????? initialized bcrhinitialized ????????? initialized bcrl initialized ????????? initialized ramer initialized ????????? initialized flash mar_0a ??????????? dmac ioar_0a ??????????? etcr_0a ??????????? mar_0b ??????????? ioar_0b ??????????? etcr_0b ??????????? mar_1a ??????????? ioar_1a ??????????? etcr_1a ??????????? mar_1b ??????????? ioar_1b ??????????? etcr_1b ??????????? p1dr initialized ????????? initialized port p3dr initialized ????????? initialized p7dr initialized ????????? initialized padr initialized ????????? initialized pbdr initialized ????????? initialized pcdr initialized ????????? initialized pddr initialized ????????? initialized pedr initialized ????????? initialized pfdr initialized ????????? initialized pgdr initialized ????????? initialized
rev. 2.00, 05/03, page 721 of 846 register name reset manual reset high- speed medium- speed sleep module stop watch sub- active sub- sleep software standby hardware standby module tcr_0 initialized initialized ???????? initialized tpu_0 tmdr_0 initialized initialized ???????? initialized tiorh_0 initialized initialized ???????? initialized tiorl_0 initialized initialized ???????? initialized tier_0 initialized initialized ???????? initialized tsr_0 initialized initialized ???????? initialized tcnt_0 initialized initialized ???????? initialized tgra_0 initialized initialized ???????? initialized tgrb_0 initialized initialized ???????? initialized tgrc_0 initialized initialized ???????? initialized tgrd_0 initialized initialized ???????? initialized tcr_1 initialized initialized ???????? initialized tpu_1 tmdr_1 initialized initialized ???????? initialized tior_1 initialized initialized ???????? initialized tier_1 initialized initialized ???????? initialized tsr_1 initialized initialized ???????? initialized tcnt_1 initialized initialized ???????? initialized tgra_1 initialized initialized ???????? initialized tgrb_1 initialized initialized ???????? initialized tcr_2 initialized initialized ???????? initialized tpu_2 tmdr_2 initialized initialized ???????? initialized tior_2 initialized initialized ???????? initialized tier_2 initialized initialized ???????? initialized tsr_2 initialized initialized ???????? initialized tcnt_2 initialized initialized ???????? initialized tgra_2 initialized initialized ???????? initialized tgrb_2 initialized initialized ???????? initialized
rev. 2.00, 05/03, page 722 of 846 register name reset manual reset high- speed medium- speed sleep module stop watch sub- active sub- sleep software standby hardware standby module dmawer initialized initialized ???????? initialized dmac dmatcr initialized initialized ???????? initialized dmacr_0a initialized initialized ???????? initialized dmacr_0b initialized initialized ???????? initialized dmacr_1a initialized initialized ???????? initialized dmacr_1b initialized initialized ???????? initialized dmabcrhinitialized initialized ???????? initialized dmabcrl initialized initialized ???????? initialized tcr_0 initialized initialized ???????? initialized tmr_0 tcr_1 initialized initialized ???????? initialized tmr_1 tcsr_0 initialized initialized ???????? initialized tmr_0 tcsr_1 initialized initialized ???????? initialized tmr_1 tcora_0 initialized initialized ???????? initialized tmr_0 tcora_1 initialized initialized ???????? initialized tmr_1 tcorb_0 initialized initialized ???????? initialized tmr_0 tcorb_1 initialized initialized ???????? initialized tmr_1 tcnt_0 initialized initialized ???????? initialized tmr_0 tcnt_1 initialized initialized ???????? initialized tmr_1 tcsr_0 initialized initialized ???????? initialized wdt_0 tcnt_0 initialized initialized ???????? initialized rstcsr initialized initialized ???????? initialized smr_0 initialized initialized ???????? initialized sci_0 iccr_0 initialized initialized ???????? initialized iic_0 brr_0 initialized initialized ???????? initialized sci_0 icsr_0 initialized initialized ???????? initialized iic_0 scr_0 initialized initialized ???????? initialized sci_0 tdr_0 initialized initialized ??? initialized initialized initialized initialized initialized initialized sci_0 ssr_0 initialized initialized ??? initialized initialized initialized initialized initialized initialized rdr_0 initialized initialized ??? initialized initialized initialized initialized initialized initialized scmr_0 initialized initialized ???????? initialized icdr_0 initialized initialized ???????? initialized iic_0 sarx_0 initialized initialized ???????? initialized icmr_0 initialized initialized ???????? initialized sar_0 initialized initialized ???????? initialized
rev. 2.00, 05/03, page 723 of 846 register name reset manual reset high- speed medium- speed sleep module stop watch sub- active sub- sleep software standby hardware standby module smr_1 initialized initialized ???????? initialized sci_1 iccr_1 initialized initialized ???????? initialized iic_1 brr_1 initialized initialized ???????? initialized sci_1 icsr_1 initialized initialized ???????? initialized iic_1 scr_1 initialized initialized ???????? initialized sci_1 tdr_1 initialized initialized ??? initialized initialized initialized initialized initialized initialized ssr_1 initialized initialized ??? initialized initialized initialized initialized initialized initialized rdr_1 initialized initialized ??? initialized initialized initialized initialized initialized initialized scmr_1 initialized initialized ???????? initialized icdr_1 initialized initialized ???????? initialized iic_1 sarx_1 initialized initialized ???????? initialized icmr_1 initialized initialized ???????? initialized sar_1 initialized initialized ???????? initialized smr_2 initialized initialized ???????? initialized sci_2 brr_2 initialized initialized ???????? initialized scr_2 initialized initialized ???????? initialized tdr_2 initialized initialized ??? initialized initialized initialized initialized initialized initialized ssr_2 initialized initialized ??? initialized initialized initialized initialized initialized initialized rdr_2 initialized initialized ??? initialized initialized initialized initialized initialized initialized scmr_2 initialized initialized ???????? initialized addrahinitialized initialized ??? initialized initialized initialized initialized initialized initialized a/d addral initialized initialized ??? initialized initialized initialized initialized initialized initialized addrbhinitialized initialized ??? initialized initialized initialized initialized initialized initialized addrbl initialized initialized ??? initialized initialized initialized initialized initialized initialized addrchinitialized initialized ??? initialized initialized initialized initialized initialized initialized addrcl initialized initialized ??? initialized initialized initialized initialized initialized initialized addrdhinitialized initialized ??? initialized initialized initialized initialized initialized initialized addrdl initialized initialized ??? initialized initialized initialized initialized initialized initialized adcsr initialized initialized ??? initialized initialized initialized initialized initialized initialized adcr initialized initialized ??? initialized initialized initialized initialized initialized initialized tcsr_1 initialized initialized ???????? initialized wdt_1 tcnt_1 initialized initialized ???????? initialized
rev. 2.00, 05/03, page 724 of 846 register name reset manual reset high- speed medium- speed sleep module stop watch sub- active sub- sleep software standby hardware standby module flmcr1 initialized ???????? initialized initialized flash flmcr2 initialized ???????? initialized initialized ebr1 initialized ???????? initialized initialized ebr2 initialized ???????? initialized initialized flpwcr initialized ???????? initialized initialized port1 initialized ????????? initialized port port3 initialized ????????? initialized port4 initialized ????????? initialized port7 initialized ????????? initialized port9 initialized ????????? initialized porta initialized ????????? initialized portb initialized ????????? initialized portc initialized ????????? initialized portd initialized ????????? initialized porte initialized ????????? initialized portf initialized ????????? initialized portg initialized ????????? initialized note: ? is not initialized.
rev. 2.00, 05/03, page 725 of 846 section 26 electrical characteristics 26.1 power supply voltage and operating frequency range figures 26.1, 26.2, 26.3, and 26.4 show power supply voltage and operating frequency ranges (shaded areas) of the h8s/2239 group, h8s/2238b group, h8s/2238r group, and h8s/2237 group and h8s/2227 group respectively. system clock (2) power supply voltage/analog power supply voltage and oscilllation frequency range (masked rom version) (1) power supply voltage/analog power supply voltage and oscilllation frequency range (f-ztat version) (4) power supply voltageand instruction executing range (masked rom version) (3) power supply voltage and instruction executing range (f-ztat version) active (high/medium speed) mode sleep mode f (mhz) 20.0 16.0 6.25 2.0 0 2.2 2.7 3.0 3.6 5.5 vcc (v) avcc f (khz) 32.768 0 2.2 2.7 3.6 5.5 vcc (v) vcc (v) vcc (v) vcc (v) subclock system clock t (ns) 50.0 62.5 160 500 0 2.2 2.7 3.0 3.6 5.5 vcc (v) t (ms) 30.5 0 2.2 2.7 3.6 5.5 3.6 5.5 subclock system clock f (mhz) 20.0 16.0 6.25 2.0 0 2.2 2.7 3.0 3.6 5.5 vcc (v) avcc f (khz) 32.768 0 2.2 2.7 3.6 5.5 subclock system clock t (ns) 50.0 62.5 160 500 0 2.2 2.7 3.0 3.6 5.5 vcc (v) t (ms) 30.5 0 2.2 2.7 subclock all operating mode all operating mode subactive mode subactive mode active (high/medium speed) mode sleep mode active (high/medium speed) mode active (high/medium speed) mode figure 26.1 power supply voltage and operating ranges (h8s/2239 group)
rev. 2.00, 05/03, page 726 of 846 system clock (1) power supply voltage and oscillation frequency range (f-ztat version) active (high-speed/medium-speed) mode sleep mode f (mhz) 13.5 6.25 2.0 0 2.2 2.7 3.0 3.6 5.5 vcc (v) all operating modes f (khz) 32.768 0 2.2 3.0 2.7 3.6 5.5 system clock (3) power supply voltage and instruction execution time range (f-ztat version) active (high-speed/medium-speed) mode t (ns) 74 160 500 0 2.2 2.7 3.0 3.6 5.5 vcc (v) subactive mode t ( s) 30.5 0 2.2 3.0 2.7 3.6 5.5 3.6 5.5 system clock (2) power supply voltage and oscillation frequency range (masked rom version) active (high-speed/medium-speed) mode sleep mode f (mhz) 13.5 6.25 2.0 0 2.2 2.7 3.6 5.5 vcc (v) all operating modes f (khz) 32.768 0 2.2 2.7 3.0 3.6 5.5 system clock (4) power supply voltage and instruction execution time range (masked rom version) active (high-speed/medium-speed) mode t (ns) 74 160 6.25 500 0 (5) analog power supply voltage and oscillation frequency range (f-ztat version, masked rom version) 2.2 2.7 2.2 2.7 3.6 5.5 vcc (v) subactive mode t ( s) 30.5 0 2.2 2.7 3.0 subclock subclock subclock subclock vcc (v) vcc (v) vcc (v) vcc (v) system clock active (high-speed/medium-speed) mode sleep mode f (mhz) 13.5 2.0 0 3.6 5.5 avcc (v) note: see sections 26.3.4 and 26.3.5 for the operation range of avcc. figure 26.2 power supply voltage and operating ranges (5-v version h8s/2238b)
rev. 2.00, 05/03, page 727 of 846 13.5 6.25 2.0 0 2.2 2.7 3.6 5.5 32.768 0 2.2 2.7 3.6 5.5 74 160 500 0 2.2 2.7 3.6 5.5 30.5 0 2.2 2.7 3.6 5.5 3.6 5.5 13.5 6.25 2.0 0 2.2 2.7 3.6 5.5 32.768 0 2.2 2.7 3.6 5.5 74 160 500 0 2.2 2.7 3.6 5.5 30.5 0 2.2 2.7 system clock (2) power supply voltage/analog power supply voltage and oscilllation frequency range (f-ztat-version regular specifications/masked rom version) (1) power supply voltage/analog power supply voltage and oscilllation frequency range (f-ztat-version wide-range specifications ) (4) power supply voltageand instruction executing range (f-ztat-version regular specifications/masked rom version) (3) power supply voltage and instruction executing range (f-ztat-version wide-range specifications) ? active (high/medium speed) mode ? sleep mode f (mhz) vcc (v) avcc f (khz) f (khz) vcc (v) vcc (v) vcc (v) vcc (v) subclock system clock t (ns) vcc (v) t (ms) subclock system clock f (mhz) vcc (v) avcc 32.768 subclock system clock t (ns) vcc (v) t (ms) subclock ? all operating mode ? all operating mode ? subactive mode ? subactive mode ? active (high/medium speed) mode ? sleep mode ? active (high/medium speed) mode ? active (high/medium speed) mode figure 26.3 power supply voltage and operating ranges (h8s/2238r group)
rev. 2.00, 05/03, page 728 of 846 13.5 10.0 6.25 2.0 2.2 2.7 3.0 3.6 32.768 0 2.2 2.7 3.0 3.6 74 100 160 500 0 2.2 2.7 3.0 3.6 30.5 0 2.2 2.7 3.0 3.6 3.0 3.6 13.5 10.0 6.25 2.0 0 2.2 2.7 3.0 3.6 32.768 0 2.2 2.7 3.0 3.6 74 100 160 500 0 2.2 2.7 3.0 3.6 30.5 0 2.2 2.7 13.5 6.25 2.0 0 2.2 2.7 3.0 3.6 32.768 0 2.2 2.7 3.0 3.6 74 160 500 0 2.2 2.7 3.0 3.6 30.5 0 2.2 2.7 3.0 3.6 system clock (3) power supply voltage and oscilllation frequency range (masked rom version) (4) power supply voltage and instruction executing range (ztat version) (1) power supply voltage oscilllation frequency range (ztat version) (2) power supply voltage/analog power supply voltage and oscilllation frequency range (f-ztat version) (6) power supply voltageand and instruction executing range (masked rom version) (5) power supply voltage and instruction executing range (f-ztat version) f (mhz) vcc (v) avcc f (khz) vcc (v) vcc (v) vcc (v) vcc (v) subclock system clock vcc (v) system clock f (mhz) vcc (v) avcc f (khz) f (mhz) f (khz) system clock t (ns) vcc (v) t (ms) system clock subclock subclock subclock subclock system clock subclock ? active (high/medium speed) mode ? sleep mode ? all operating mode ? all operating mode ? active (high/medium speed) mode ? sleep mode ? all operating mode ? active (high/medium speed) mode ? sleep mode ? all operating mode ? active (high/medium speed) mode ? sleep mode ? subactive mode ? subactive mode ? active (high/medium speed) mode ? active (high/medium speed) mode figure 26.4 power supply voltage and operating ranges (h8s/2237 group and h8s/2227 group)
rev. 2.00, 05/03, page 729 of 846 26.2 electrical characteristics of h8s/2239 group 26.2.1 absolute maximum ratings table 26.1 lists the absolute maximum ratings. table 26.1 absolute maximum ratings item symbol value unit v cc C0.3 to +4.3 v power supply voltage cv cc C0.3 to +4.3 v input voltage (except ports 4 and 9) v in C0.3 to v cc +0.3 v input voltage (ports 4 and 9) v in C0.3 to av cc +0.3 v reference power supply voltage v ref C0.3 to av cc +0.3 v analog power supply voltage av cc C0.3 to +4.3 v analog input voltage v an C0.3 to av cc +0.3 v operating temperature t opr regular specifications: C20 to +75 * wide-range specifications: C40 to +85 * c storage temperature t stg C55 to +125 c caution: permanent damage to the chip may result if absolute maximum rating are exceeded. note: * the operating temperature ranges for flash memory programming/erasing are t a = C20 c to +50 c (regular specifications).
rev. 2.00, 05/03, page 730 of 846 26.2.2 dc characteristics table 26.2 lists the dc characteristics. table 26.3 lists the permissible output currents. table 26.4 lists the bus driving characteristics. table 26.2 dc characteristics (1) condition a (f-ztat version): v cc = 2.7 v to 3.6 v, av cc = 2.7 v to 3.6 v, v ref = 2.7 v to av cc , v ss =av ss = 0 v, t a = C20 c to +75 c (regular specifications) * 1 condition b (masked rom version): v cc = 2.2 v to 3.6 v, av cc = 2.2 v to 3.6 v, v ref = 2.2 v to av cc , v ss = av ss = 0 v, t a = C20 c to +75 c (regular specifications), t a = C40 c to +85 c (wide- range specifications) * 1 condition c (f-ztat version and masked rom version): v cc = 3.0 v to 3.6 v, av cc = 3.0 v to 3.6 v, v ref = 3.0 v to av cc , v ss = av ss = 0 v, t a = C20 c to +75 c (regular specifications), t a = C40 c to +85 c (wide- range specifications) item symbol min typ max unit test conditions irq0 to irq7 vt C v cc 0.2 ?? v vt + ?? v cc 0.8 v schmitt trigger input voltage vt + C vt C v cc 0.05 ?? v input high voltage res , stby , nmi, fwe, md2 to md0 v ih v cc 0.9 ? v cc + 0.3 v extal, ports 1, 3, 7, and a to g v cc 0.8 ? v cc + 0.3 v ports 4 and 9 v cc 0.8 ? av cc + 0.3 v input low voltage res , stby , fwe, md2 to md0 v il C0.3 ? v cc 0.1 v nmi, extal, ports 1, 3, 4, 7, 9, and a to g C0.3 ? v cc 0.2 v
rev. 2.00, 05/03, page 731 of 846 item symbol min typ max unit test conditions v oh v cc C 0.5 ?? vi oh = C200 a output high voltage all output pins * 4 except p34 and p35 v cc C 1.0 ?? vi oh = C1 ma * 2 p34 and p35 * 3 v cc C 2.0 ?? v i oh = C100 a (reference value) ?? 0.4 v i ol = 0.4 ma output low voltage all output pins * 4 v ol ?? 0.4 v i ol = 0.8 ma * 2 res ?? 1.0 a input leakage current stby , nmi, fwe, md2 to md0 ?? 1.0 a v in = 0.2 to v cc C 0.2 v ports 4, 9 | i in | ?? 1.0 a v in = 0.2 to av cc C 0.2 v three states leakage current (off) ports 1, 3, 7, and a to g | i tsi | ?? 1.0 a v in = 0.2 to v cc C 0.2 v input pull-up mos current ports a to e Ci p 10 ? 300 a v in = 0v notes: * 1 if the a/d or d/a converter is not used, the av cc , v ref , and av ss pins should not be open. even if the a/d or d/a converter is not used, connect the av cc and v ref pins to v cc and supply 2.0 v to 3.6 v. in this case, v ref av cc . * 2v cc = 2.7 v to 3.6 v * 3 p35/sck1/scl0 and p34/sda0 function as nmos push-pull output. to output the high voltage from scl0 and sda0 (ice = 1), connect an external pull-up resistor. nmos controls p35/sck1 and p34 to output the high voltage. to output the high voltage from p35/sck1 and p34, connect an external pull-up resistor. * 4 in the case when ice = 0. low voltage output with bus driving function is specified in table 26.4.
rev. 2.00, 05/03, page 732 of 846 table 26.2 dc characteristics (2) condition a (f-ztat version): v cc = 2.7 v to 3.6 v, av cc = 2.7 v to 3.6 v, v ref = 2.7 v to av cc , v ss =av ss = 0 v, t a = C20 c to +75 c (regular specifications) * 1 condition c (f-ztat version): v cc = 3.0 v to 3.6 v, av cc = 3.0 v to 3.6 v, v ref = 3.0 v to av cc , v ss = av ss = 0 v, t a = C20 c to +75 c (regular specifications), t a = C40 c to +85 c (wide-range specifications) item symbol min typ max unit test conditions res ?? 30 pf input capacitance nmi ?? 30 pf p32 to p35 ?? 20 pf all input pins other than above ones c in ?? 15 pf v in = 0 v f = 1 mhz t a = 25 c current consumption * 2 normal operation i cc * 4 ? 29 v cc = 3.0 v 55 v cc = 3.6 v ma f = 20.0 mhz ? 25 v cc = 3.0 v 42 v cc = 3.6 v ma f = 16.0 mhz sleep mode ? 19 v cc = 3.0 v 43 v cc = 3.6 v ma f = 20.0 mhz ? 17 v cc = 3.0 v 32 v cc = 3.6 v ma f = 16.0 mhz all modules stopped ? 16 ? ma f = 20.0 mhz, v cc = 3.0 v (reference value) ? 15 ? ma f = 16.0 mhz, v cc = 3.0 v (reference value) medium- speed mode ( /32) ? 15 ? ma f = 20.0 mhz, v cc = 3.0 v (reference value) ? 13 ? ma f = 16.0 mhz, v cc = 3.0 v (reference value)
rev. 2.00, 05/03, page 733 of 846 item symbol min typ max unit test conditions current consumption * 2 subactive mode i cc * 4 ? 70 180 a v cc = 3.0 v when 32.768 khz crystal resonator is used subsleep mode ? 50 130 a v cc = 3.0 v when 32.768 khz crystal resonator is used watch mode ? 840av cc = 3.0 v when 32.768 khz crystal resonator is used ? 1.0 v cc = 3.0 v 10 v cc = 3.6 v a t a 50 c when 32.768 khz crystal resonator is not used standby mode * 3 ?? 50 v cc = 3.6 v a 50 c < t a when 32.768 khz crystal resonator is not used during a/d conversion ? 0.5 1.5 ma analog power supply current idle al cc ? 0.01 5.0 a during a/d conversion al cc ? 1.3 2.5 ma reference power supply current idle ? 0.01 5.0 a ram standby voltage v ram 2.0 ?? v notes: * 1 if the a/d or d/a converter is not used, the av cc , v ref , and av ss pins should not be open. even if the a/d or d/a converter is not used, connect the av cc and v ref pins to v cc and supply 2.0 v to 3.6 v. in this case, v ref av cc . * 2 current consumption values are for v ih min = v cc C 0.2 v and v il max = 0.2 v, with all output pins unloaded and the on-chip mos pull-up transistors in the off state. * 3 the values are for v ram v cc < 2.2 v, v ih min = v cc C 0.2, and v il max = 0.2 v. * 4i cc depends on v cc and f as follows: i cc max = 1.0 (ma) + 0.74 (ma/(mhz x v)) v cc f (normal operation) i cc max = 1.0 (ma) + 0.58 (ma/(mhz x v)) v cc f (sleep mode)
rev. 2.00, 05/03, page 734 of 846 table 26.2 dc characteristics (3) condition b (masked rom version): v cc = 2.2 v to 3.6 v, av cc = 2.2 v to 3.6 v, v ref = 2.2 v to av cc , v ss = av ss = 0 v, t a = C20 c to +75 c (regular specifications), t a = C40 c to +85 c (wide- range specifications) * 1 condition c (f-ztat version): v cc = 3.0 v to 3.6 v, av cc = 3.0 v to 3.6 v, v ref = 3.0 v to av cc , v ss = av ss = 0 v, t a = C20 c to +75 c (regular specifications), t a = C40 c to +85 c (wide- range specifications) item symbol min typ max unit test conditions res ?? 30 pf nmi ?? 30 pf p32 to p35 ?? 20 pf input capacitance all input pins other than above ones c in ?? 15 pf v in = 0 v f = 1 mhz t a = 25 c normal operation i cc * 4 ? 29 v cc = 3.0 v 55 v cc = 3.6 v ma f = 20.0 mhz current consumption * 2 ? 25 v cc = 3.0 v 42 v cc = 3.6 v ma f = 16.0 mhz ? 10 v cc = 3.0 v 18 v cc = 3.6 v ma f = 6.25 mhz sleep mode ? 19 v cc = 3.0 v 43 v cc = 3.6 v ma f = 20.0 mhz ? 17 v cc = 3.0 v 32 v cc = 3.6 v ma f = 16.0 mhz ? 7.5 v cc = 3.0 v 14 v cc = 3.6 v ma f = 6.25 mhz all modules stopped ? 16 ? ma f = 20.0 mhz, v cc = 3.0 v (reference value) ? 15 ? ma f = 16.0 mhz, v cc = 3.0 v (reference value)
rev. 2.00, 05/03, page 735 of 846 item symbol min typ max unit test conditions current consumption * 2 medium- speed mode ( /32) i cc * 4 ? 15 ? ma f = 20.0 mhz, v cc = 3.0 v (reference value) ? 13 ? ma f = 16.0 mhz, v cc = 3.0 v (reference value) subactive mode ? 45 180 a v cc = 3.0 v when 32.768 khz crystal resonator is used subsleep mode ? 30 100 a v cc = 3.0 v when 32.768 khz crystal resonator is used watch mode ? 840av cc = 3.0 v when 32.768 khz crystal resonator is used ? 0.5 v cc = 3.0 v 10 v cc = 3.6 v a t a 50c when 32.768 khz crystal resonator is not used standby mode * 3 ?? 50 v cc = 3.6 v a 50c < t a when 32.768 khz crystal resonator is not used during a/d conversion al cc ? 0.5 1.5 ma analog power supply current idle ? 0.01 5.0 a during a/d conversion al cc ? 1.3 2.5 ma reference power supply current idle ? 0.01 5.0 a ram standby voltage v ram 2.0 ?? v notes: * 1 if the a/d or d/a converter is not used, the av cc , v ref , and av ss pins should not be open. even if the a/d or d/a converter is not used, connect the av cc and v ref pins to v cc and supply 2.0 v to 3.6 v. in this case, v ref av cc .
rev. 2.00, 05/03, page 736 of 846 * 2 current consumption values are for v ih min = v cc C 0.2 v and v il max = 0.2 v, with all output pins unloaded and the on-chip mos pull-up transistors in the off state. * 3 the values are for v ram v cc < 2.7 v, v ih min = v cc C 0.2, and v il max = 0.2 v. * 4i cc depends on v cc and f as follows: i cc max = 1.0 (ma) + 0.74 (ma/(mhz x v)) v cc f (normal operation) i cc max = 1.0 (ma) + 0.58 (ma/(mhz x v)) v cc f (sleep mode) table 26.3 permissible output currents condition a (f-ztat version): v cc = 2.7 v to 3.6 v, av cc = 2.7 v to 3.6 v, v ref = 2.7 v to av cc , v ss = av ss = 0 v, t a = C20 c to +75 c (regular specifications) condition b (masked rom version): v cc = 2.2 v to 3.6 v, av cc = 2.2 v to 3.6 v, v ref = 2.2 v to av cc , v ss = av ss = 0 v, t a = C20 c to +75 c (regular specifications) t a = C40 c to +85 c (wide-range specifications) condition c (f-ztat version): v cc = 3.0 v to 3.6 v, av cc = 3.0 v to 3.6 v, v ref = 3.0 v to av cc , v ss = av ss = 0 v, t a = C20 c to +75 c (regular specifications), t a = C40 c to +85 c (wide- range specifications) item symbol min typ max unit scl1 to scl0, sda1 to sda0 v cc = 2.7 v to 3.6 v i ol ?? 10 v cc = 2.2 v to 3.6 v ?? 0.5 permissible output low current (per pin) output pins other than above ones v cc = 2.7 v to 3.6 v i ol ?? 1.0 ma v cc = 2.2 v to 3.6 v ?? 30 permissible output low current (total) total of all output pins v cc = 2.7 v to 3.6 v i ol ?? 60 ma v cc = 2.2 v to 3.6 v ?? 0.5 permissible output high current (per pin) all output pins v cc = 2.7 v to 3.6 v Ci oh ?? 1.0 ma v cc = 2.2 v to 3.6 v ?? 15 permissible output high current (total) total of all output pins v cc = 2.7 v to 3.6 v Ci oh ?? 30 ma note: to protect chip reliability, do not exceed the output current values in table 26.3.
rev. 2.00, 05/03, page 737 of 846 table 26.4 bus driving characteristics conditions: v cc = 2.7 v to 3.6 v, av cc = 2.7 v to 3.6 v, v ref = 2.7 v to av cc , v ss = av ss = 0 v, t a = C20 c to +75 c (regular specifications), t a = C40 c to +85 c (wide-range specifications) * , objective pins: scl1 to 0 and sda1 to 0 item symbol min typ max unit test conditions vt C v cc 0.3 ?? vv cc = 2.7 v to 3.6 v vt + ?? v cc 0.7 v v cc = 2.7 v to 3.6 v schmitt trigger input voltage vt + C vt C v cc 0.05 ?? vv cc = 2.7 v to 3.6 v input high voltage v ih v cc 0.7 ? v cc + 0.5 v v cc = 2.7 v to 3.6 v input low voltage v il C0.5 ? v cc 0.3 v v cc = 2.7 v to 3.6 v v ol ?? 0.5 v i ol = 6 ma, v cc = 3.0 v to 3.6 v output low voltage ?? 0.4 v i ol = 3 ma input capacitance c in ?? 20 pf v in = 0 v f = 1 mhz t a = 25 c three states leakage current (off) | i tsi | ?? 1.0 a v in = 0.5 v to v cc C 0.5 v scl, sda output falling time t of 20 + 0.1cb ? 250 ns v cc = 2.7 v to 3.6 v note: * if the a/d or d/a converter is not used, the av cc , v ref , and av ss pins should not be open. even if the a/d or d/a converter is not used, connect the av cc and v ref pins to v cc and supply 2.0 v to 3.6 v. in this case, v ref av cc .
rev. 2.00, 05/03, page 738 of 846 26.2.3 ac characteristics figure 26.5 shows the test conditions for the ac characteristics. 3v r l r h c lsi output pin c=30pf r l = 2.4k ? r h =12 ? input/output timing measurement levels low level: 0.8v high level: 2.0v (vcc = 2.7 to 3.6v) 1.5v (vcc = 2.2 to 2.7v) figure 26.5 output load circuit
rev. 2.00, 05/03, page 739 of 846 (1) clock timing table 26.5 lists the clock timing. table 26.5 clock timing condition a (f-ztat version and masked rom version): v cc = 2.7 v to 3.6 v, av cc = 2.7 v to 3.6 v, v ref = 2.7 v to av cc , v ss = av ss = 0 v, = 32.768 khz, 2 to 16.0 mhz, t a = C20 c to +75 c (regular specifications) condition b (masked rom version): v cc = 2.2 v to 3.6 v, av cc = 2.2 v to 3.6 v, v ref = 2.2 v to av cc , v ss = av ss = 0 v, = 32.768 khz, 2 to 6.25 mhz, t a = C20 c to +75 c (regular specifications), t a = C40 c to +85 c (wide-range specifications) condition c (f-ztat version and masked rom version): v cc = 3.0 v to 3.6 v, av cc = 3.0 v to 3.6 v, v ref = 3.0 v to av cc , v ss = av ss = 0 v, = 32.768 khz, 10.0 to 20.0 mhz, t a = C20 c to +75 c (regular specifications), t a = C40 c to +85 c (wide-range specifications) condition a condition b condition c item symbol min typ max min typ max min typ max unit test conditions clock cycle time t cyc 62.5 ? 500 160 ? 500 50 100 ns clock high pulse width t ch 20 ?? 50 ?? 17 ns clock low pulse width t cl 20 ?? 50 ?? 17 ns clock rise time t cr ?? 10 ?? 25 10 ns clock fall time t cf ?? 10 ?? 25 10 ns figure 26.7 oscillation stabilization time at reset (crystal) t osc1 20 ?? 40 ?? 20 ms figure 26.8
rev. 2.00, 05/03, page 740 of 846 condition a condition b condition c item symbol min typ max min typ max min typ max unit test conditions oscillation stabilization time in software standby (crystal) t osc2 8 ?? 16 ?? 8 ms figure 23.3 external clock output stabilization delay time t dext 500 ?? 1000 ?? 500 s figure 26.8 subclock oscillation stabilization time t osc3 ?? 2 ?? 4 2s subclock oscillator frequency f sub ? 32.768 ?? 32.768 ? 32.768 khz subclock ( sub ) cycle time t sub ? 30.5 ?? 30.5 ? 30.5 s
rev. 2.00, 05/03, page 741 of 846 (2) control signal timing table 26.6 lists the control signal timing. table 26.6 control signal timing condition a (f-ztat version and masked rom version): v cc = 2.7 v to 3.6 v, av cc = 2.7 v to 3.6 v, v ref = 2.7 v to av cc , v ss = av ss = 0 v, = 32.768 khz, 2 to 16.0 mhz, t a = C20 c to +75 c (regular specifications) condition b (masked rom version): v cc = 2.2 v to 3.6 v, av cc = 2.2 v to 3.6 v, v ref = 2.2 v to av cc , v ss = av ss = 0 v, = 32.768 khz, 2 to 6.25 mhz, t a = C20 c to +75 c (regular specifications), t a = C40 c to +85 c (wide-range specifications) condition c (f-ztat version and masked rom version): v cc = 3.0 v to 3.6 v, av cc = 3.0 v to 3.6 v, v ref = 3.0 v to av cc , v ss = av ss = 0 v, = 32.768 khz, 10.0 to 20.0 mhz, t a = C20 c to +75 c (regular specifications), t a = C40 c to +85 c (wide-range specifications) conditions a, c condition b item symbol min max min max unit test conditions res setup time t ress 250 ? 350 ? ns figure 26.9 res pulse width t resw 20 ? 20 ? t cyc mres setup time t mress 250 ? 350 ? ns mres pulse width t mresw 20 ? 20 ? t cyc nmi setup time t nmis 250 ? 350 ? ns figure 26.10 nmi hold time t nmih 10 ? 10 ? ns nmi pulse width (exiting software standby mode) t nmiw 200 ? 300 ? ns irq setup time t irqs 250 ? 350 ? ns irq hold time t irqh 10 ? 10 ? ns irq pulse width (exiting software standby mode) t irqw 200 ? 300 ? ns
rev. 2.00, 05/03, page 742 of 846 (3) bus timing table 26.7 lists the bus timing. table 26.7 bus timing condition a (f-ztat version and masked rom version): v cc = 2.7 v to 3.6 v, av cc = 2.7 v to 3.6 v, v ref = 2.7 v to av cc , v ss = av ss = 0 v, = 2 to 16.0 mhz, t a = C20 c to +75 c (regular specifications) condition b (masked rom version): v cc = 2.2 v to 3.6 v, av cc = 2.2 v to 3.6 v, v ref = 2.2 v to av cc , v ss = av ss = 0 v, = 2 to 6.25 mhz, t a = C20 c to +75 c (regular specifications), t a = C40 c to +85 c (wide-range specifications) condition c (f-ztat version and masked rom version): v cc = 3.0 v to 3.6 v, av cc = 3.0 v to 3.6 v, v ref = 3.0 v to av cc , v ss = av ss = 0 v, = 10.0 mhz to 20.0 mhz, t a = ? 20c to +75c (regular specifications), t a = ? 40c to +85c (wide-range specifications) condition a condition b condition c item symbol min max min max min max unit test conditions address delay time t ad ? 40 ? 90 ? 35 ns address setup time t as 0.5 t cyc ? 42 ? 0.5 t cyc ? 60 ? 0.5 t cyc ? 35 ? ns address hold time t ah 0.5 t cyc ? 10 ? 0.5 t cyc ? 30 ? 0.5 t cyc ? 5 ? ns figures 26.11 to 26.15 cs delay time t csd ? 40 ? 90 ? 35 ns as delay time t asd ? 40 ? 90 ? 25 ns rd delay time 1 t rsd1 ? 40 ? 90 ? 25 ns rd delay time 2 t rsd2 ? 40 ? 90 ? 25 ns read data setup time t rds 30 ? 50 ? 15 ? ns
rev. 2.00, 05/03, page 743 of 846 condition a condition b condition c item symbol min max min max min max unit test conditions read data hold time t rdh 0 ? 0 ? 0 ? ns read data access time 1 t acc1 ? 1.0 t cyc ? 55 ? 1.0 t cyc ? 90 ?? ns figures 26.11 to 26.15 read data access time 2 t acc2 ? 1.5 t cyc ? 50 ? 1.5 t cyc ? 90 ? 1.5 t cyc ? 40 ns read data access time 3 t acc3 ? 2.0 t cyc ? 55 ? 2.0 t cyc ? 90 ? 2.0 t cyc ? 50 ns read data access time 4 t acc4 ? 2.5 t cyc ? 50 ? 2.5 t cyc ? 90 ? 2.5 t cyc ? 40 ns read data access time 5 t acc5 ? 3.0 t cyc ? 55 ? 3.0 t cyc ? 90 ? 3.0 t cyc ? 50 ns wr delay time 1 t wrd1 ? 40 ? 90 ? 25 ns wr delay time 2 t wrd2 ? 40 ? 90 ? 25 ns wr pulse width 1 t wsw1 1.0 t cyc ? 20 ? 1.0 t cyc ? 60 ? 1.0 t cyc ? 20 ? ns wr pulse width 2 t wsw2 1.5 t cyc ? 20 ? 1.5 t cyc ? 60 ? 1.5 t cyc ? 20 ? ns write data delay time t wdd ? 60 ? 100 ? 40 ns write data setup time t wds 0.5 t cyc ? 57 ? 0.5 t cyc ? 80 ? 0.5 t cyc ? 65 ? ns write data hold time t wdh 0.5 t cyc ? 27 ? 0.5 t cyc ? 60 ? 0.5 t cyc ? 20 ? ns wait setup time t wts 40 ? 90 ? 25 ? ns figure 26.13 wait hold time t wth 10 ? 10 ? 10 ? ns breq setup time t brqs 40 ? 90 ? 25 ? ns back delay time t bacd ? 40 ? 90 ? 40 ns bus-floating time t bzd ? 60 ? 160 ? 50 ns figure 26.16
rev. 2.00, 05/03, page 744 of 846 (4) dmac timing table 26.8 lists the dmac timing. table 26.8 dmac timing condition a (f-ztat version and masked rom version): v cc = 2.7 v to 3.6 v, av cc = 2.7 v to 3.6 v, v ref = 2.7 v to av cc , v ss = av ss = 0 v, = 2 to 16.0 mhz, t a = C20 c to +75 c (regular specifications) condition b (masked rom version): v cc = 2.2 v to 3.6 v, av cc = 2.2 v to 3.6 v, v ref = 2.2 v to av cc , v ss = av ss = 0 v, = 2 to 6.25 mhz, t a = C20 c to +75 c (regular specifications), t a = C40 c to +85 c (wide-range specifications) condition c (f-ztat version and masked rom version): v cc = 3.0 v to 3.6 v, av cc = 3.0 v to 3.6 v, v ref = 3.0 v to av cc , v ss = av ss = 0 v, = 10.0 mhz to 20.0 mhz, t a = ? 20c to +75c (regular specifications), t a = ? 40c to +85c (wide-range specifications) condition a condition b condition c item symbol min max min max min max unit test conditions dreq setup time t drqs 40 ? 60 ? 30 ? ns dreq hold time t drqh 10 ? 20 ? 10 ? ns figure 26.20 tend delay time t ted ? 30 ? 50 ? 30 ns figure 26.19 dack delay time 1 t dacd1 ? 30 ? 50 ? 30 ns figure 26.17 dack delay time 2 t dacd2 ? 30 ? 50 ? 30 ns figure 26.18
rev. 2.00, 05/03, page 745 of 846 (5) timing of on-chip peripheral modules table 26.9 lists the timing of on-chip peripheral modules. table 26.10 lists the i 2 c bus timing. table 26.9 timing of on-chip peripheral modules condition a (f-ztat version and masked rom version): v cc = 2.7 v to 3.6 v, av cc = 2.7 v to 3.6 v, v ref = 2.7 v to av cc , v ss = av ss = 0 v, = 32.768 khz, 2 to 16.0 mhz, t a = C20 c to +75 c (regular specifications) condition b (masked rom version): v cc = 2.2 v to 3.6 v, av cc = 2.2 v to 3.6 v, v ref = 2.2 v to av cc , v ss = av ss = 0 v, = 32.768 khz, 2 to 6.25 mhz, t a = C20 c to +75 c (regular specifications), t a = C40 c to +85 c (wide-range specifications) condition c (f-ztat version and masked rom version): v cc = 3.0 v to 3.6 v, av cc = 3.0 v to 3.6 v, v ref = 3.0 v to av cc , v ss = av ss = 0 v, = 32.768 khz, 10.0 mhz to 20.0 mhz, t a = ? 20c to +75c (regular specifications), t a = ? 40c to +85c (wide-range specifications) condition a condition b condition c item symbol min max min max min max unit test conditions i/o port * output data delay time t pwd ? 70 ? 150 50 ns figure 26.21 input data setup time t prs 50 ? 80 ? 30 input data hold time t prh 50 ? 80 ? 30 tpu timer output delay time t tocd ? 70 ? 150 50 ns figure 26.22 timer input setup time t tics 40 ? 60 ? 30 timer clock input setup time t tcks 40 ? 60 ? 30 ns figure 26.23 single edge t tckwh 1.5 ? 1.5 ? 1.5 t cyc timer clock pulse width both edges t tckwl 2.5 ? 2.5 ? 2.5
rev. 2.00, 05/03, page 746 of 846 condition a condition b condition c item symbol min max min max min max unit test conditions tmr timer output delay time t tmod ? 70 ? 150 50 ns figure 26.24 timer reset input setup time t tmrs 50 ? 80 ? 30 ns figure 26.26 timer clock input setup time t tmcs 50 ? 80 ? 30 ns figure 26.25 single edge t tmcwh 1.5 ? 1.5 ? 1.5 t cyc timer clock pulse width both edges t tmcwl 2.5 ? 2.5 ? 2.5 wdt_1 buzz output delay time t buzd ? 70 ? 150 50 ns figure 26.27 sci * asynchro- nous t scyc 4 ? 4 ? 4t cyc figure 26.28 input clock cycle synchro- nous 6 ? 6 ? 6 input clock pulse width t sckw 0.4 0.6 0.4 0.6 0.4 0.6 t scyc input clock rise time t sckr ? 1.5 ? 1.5 1.5 t cyc input clock fall time t sckf ? 1.5 ? 1.5 1.5 transmit data delay time t txd ? 75 ? 150 50 ns figure 26.29 receive data setup time (synchronous) t rxs 75 ? 150 ? 50 ns receive data hold time (synchronous) t rxh 75 ? 150 ? 50 ns a/d converter trigger input setup time t trgs 40 ? 60 ? 30 ns figure 26.30 note: * nmos controls p35/sck1 and p34 to output the high voltage. to output the high voltage from p35/sck1 and p34, connect an external pull-up resistor.
rev. 2.00, 05/03, page 747 of 846 table 26.10 i 2 c bus timing conditions: v cc = 2.7 v to 3.6 v, v ss = 0 v, = 5 mhz to maximum operating frequency, t a = C20 c to +75 c item symbol min typ max unit test conditions remarks scl input cycle time t scl 12 t cyc ?? ns scl input high pulse width t sclh 3 t cyc ?? ns figure 26.31 scl input low pulse width t scll 5 t cyc ?? ns scl, sda input rise time t sr ?? 7.5 t cyc * ns scl, sda input fall time t sf ?? 300 ns scl, sda input spike pulse delete time t sp ?? 1 t cyc ns sda input bus free time t buf 5 t cyc ?? ns operating condition input hold time t stah 3 t cyc ?? ns retransmitting operating condition input setup time t stas 3 t cyc ?? ns stop condition input setup time t stos 3 t cyc ?? ns data input setup time t sdas 0.5 t cyc ?? ns data input hold time t sdah 0 ?? ns scl, sda capacitor load c b ?? 400 pf note: * maximum scl and sda input rise time 7.5 t cyc or 17.5 t cyc can be selected depending on the clock that is used in the i 2 c module. for detail see section 15.5, usage note.
rev. 2.00, 05/03, page 748 of 846 26.2.4 a/d conversion characteristics table 26.11 lists the a/d conversion characteristics. table 26.11 a/d conversion characteristics condition a (f-ztat version and masked rom version): v cc = 2.7 v to 3.6 v, av cc = 2.7 v to 3.6 v, v ref = 2.7 v to av cc , v ss = av ss = 0 v, = 2 to 16.0 mhz, t a = C20 c to +75 c (regular specifications) condition b (masked rom version): v cc = 2.2 v to 3.6 v, av cc = 2.2 v to 3.6 v, v ref = 2.2 v to av cc , v ss = av ss = 0 v, = 2 to 6.25 mhz, t a = C20 c to +75 c (regular specifications), t a = C40 c to +85 c (wide-range specifications) condition c (f-ztat version and masked rom version): v cc = 3.0 v to 3.6 v, av cc = 3.0 v to 3.6 v, v ref = 3.0 v to av cc , v ss = av ss = 0 v, = 10.0 to 20.0 mhz, t a = C20 c to +75 c (regular specifications), t a = C40 c to +85 c (wide-range specifications) conditions a, c condition b item min typ max min typ max unit resolution 10 10 10 10 10 10 bits conversion time 8.1 ?? 20.9 ?? s analog input capacitance ?? 20 ?? 20 pf permissible signal-source impedance ?? 5 ?? 5k ? nonlinearity error ?? 6.0 ?? 6.0 lsb offset error ?? 4.0 ?? 4.0 lsb full-scale error ?? 4.0 ?? 4.0 lsb quantization error ?? 0.5 ?? 0.5 lsb absolute accuracy ?? 8.0 ?? 8.0 lsb
rev. 2.00, 05/03, page 749 of 846 26.2.5 d/a conversion characteristics table 26.12 lists the d/a conversion characteristics. table 26.12 d/a conversion characteristics condition a (f-ztat version and masked rom version): v cc = 2.7 v to 3.6 v, av cc = 2.7 v to 3.6 v, v ref = 2.7 v to av cc , v ss = av ss = 0 v, = 2 to 16.0 mhz, t a = C20 c to +75 c (regular specifications) condition b (masked rom version): v cc = 2.2 v to 3.6 v, av cc = 2.2 v to 3.6 v, v ref = 2.2 v to av cc , v ss = av ss = 0 v, = 2 to 6.25 mhz, t a = C20 c to +75 c (regular specifications), t a = C40 c to +85 c (wide-range specifications) condition c (f-ztat version and masked rom version): v cc = 3.0 v to 3.6 v, av cc = 3.0 v to 3.6 v, v ref = 3.0 v to av cc , v ss = av ss = 0 v, = 10.0 to 20.0 mhz, t a = C20 c to +75 c (regular specifications), t a = C40 c to +85 c (wide-range specifications) conditions a, c condition b item min typ max min typ max unit test condition resolution 888888bits conversion time ?? 10 ?? 10 s load capacitance = 20 pf ? 2.0 3.0 ? 3.0 4.0 lsb load resistance = 2 m ? absolute accuracy ?? 2.0 ?? 3.0 lsb load resistance = 4 m ?
rev. 2.00, 05/03, page 750 of 846 26.2.6 flash memory characteristics table 26.13 lists the flash memory characteristics. table 26.13 flash memory characteristics conditions: v cc = 2.7 v to 3.6 v, av cc = 2.7 v to 3.6 v, v ref = 2.7 v to av cc , v ss = av ss = 0 v, v cc = 3.0 v to 3.6 v (programming/erasing operating voltage range), t a = C20 c to +50 c (programming/erasing operating temperature range; regular specifications) item symbol min typ max unit test conditions programming time * 1 * 2 * 4 t p ? 10 200 ms/128 bytes erase time * 1 * 3 * 5 t e ? 100 1200 ms/block reprogramming count n wec * 6 100 10000 * 7 ? times data hold time t drp 10 ?? year programming wait time after swe1 bit setting * 1 t sswe 11 ? s wait time after psu1 bit setting * 1 t spsu 50 50 ? s t sp10 8 1012s t sp30 28 30 32 s 1 n 6 wait time after p1 bit setting * 1 * 4 t sp200 198 200 202 s 7 n 1000 wait time after p1 bit clear * 1 t cp 55 ? s wait time after psu1 bit clear * 1 t cpsu 55 ? s wait time after pv1 bit setting * 1 t spv 44 ? s wait time after h'ff dummy write * 1 t spvr 22 ? s wait time after pv1 bit clear * 1 t cpv 22 ? s wait time after swe1 bit clear t cswe 100 100 ? s n1 ?? 6 * 4 times maximum programming count * 1 * 4 n2 ?? 994 * 4
rev. 2.00, 05/03, page 751 of 846 item symbol min typ max unit test conditions erase wait time after swe1 bit setting * 1 t sswe 11 ? s wait time after esu1 bit setting * 1 t sesu 100 100 ? s wait time after e1 bit setting * 1 * 5 t se 10 10 100 ms wait time after e1 bit clear * 1 t ce 10 10 ? s wait time after esu1 bit clear * 1 t cesu 10 10 ? s wait time after ev1 bit setting * 1 t sev 20 20 ? s wait time after h'ff dummy write * 1 t sevr 22 ? s wait time after ev1 bit clear * 1 t cev 44 ? s wait time after swe1 bit clear t cswe 100 100 ? s maximum erase count * 1 * 5 n ?? 100 times notes: * 1 make each time setting in accordance with the program/program-verify flowchart or erase/erase-verify flowchart. * 2 programming time per 128 bytes (shows the total period for which the p1 bit in the flash memory control register 1 (flmcr1) is set. it does not include the program verification time.) * 3 block erase time (shows the total period for which the e1 bit in flmcr1 is set. it does not include the erase verification time.) * 4 maximum programming time value t p (max) = wait time after p1 bit setting (t sp ) maximum program count (n) (t sp30 + t sp10 ) 6 + (t sp200 ) 994 * 5 relationship among the maximum erase time (t e (max)), the wait time after e1 bit setting (t se ), and the maximum erase count (n) is shown below. t e (max) = wait time after e1 bit setting (t se ) maximum erase count (n) * 6 the guaranteed value of reprogramming is less than minimum count. * 7 typical value at 25 c
rev. 2.00, 05/03, page 752 of 846 26.3 electrical characteristics of 5 v version h8s/2238b 26.3.1 absolute maximum ratings table 26.14 lists the absolute maximum ratings. table 26.14 absolute maximum ratings item symbol value unit power supply voltage v cc C0.3 to +7.0 v cv cc C0.3 to +4.3 v input voltage (except ports 4 and 9) v in C0.3 to v cc +0.3 v input voltage (ports 4 and 9) v in C0.3 to av cc +0.3 v reference voltage v ref C0.3 to av cc +0.3 v analog power supply voltage av cc C0.3 to +7.0 v analog input voltage v an C0.3 to av cc +0.3 v operating temperature t opr regular specifications: C20 to +75 * c wide-range specifications: C40 to +85 * c storage temperature t stg C55 to +125 c caution: permanent damage to the chip may result if absolute maximum rating are exceeded. note: * the operating temperature ranges for flash memory programming/erasing are t a = -20c to +75c.
rev. 2.00, 05/03, page 753 of 846 26.3.2 dc characteristics table 26.15 lists the dc characteristics. table 26.16 lists the permissible output currents. table 26.17 lists the bus drive characteristics. table 26.15 dc characteristics (1) condition a (f-ztat version): v cc = 3.0 v to 5.5 v, av cc = 3.6 v to 5.5 v, v ref = 3.6 v to av cc , v ss = av ss = 0 v, t a = C20c to +75c (regular specifications), t a = C40c to +85c (wide-range specifications) * 1 condition b (masked rom version): v cc = 2.7 v to 5.5 v, av cc = 3.6 v to 5.5 v, v ref = 3.6 v to av cc , v ss = av ss = 0 v, t a = C20c to +75c (regular specifications), t a = C40c to +85c (wide-range specifications) * 1 item symbol min typ max unit test conditions irq7 to irq0 v t C v cc 0.2 v v t + v cc 0.8 v v t + C v t C v cc 0.05 v v cc = 4.0 v to 5.5 v schmitt trigger input voltage v cc 0.04 v v cc = 2.7 v to 4.0 v input high voltage res , stby , nmi, md2 to md0, fwe v ih v cc 0.9 v cc + 0.3 v extal v cc 0.8 v cc + 0.3 v ports 1, 3, 7, a to g ports 4 and 9 v cc 0.8 av cc + 0.3 v input low voltage res , stby , md2 to md0, fwe v il C0.3 v cc 0.1 v nmi, extal, ports 1, 3, 4, 7, 9, a to g C0.3 v cc 0.2 v output high voltage v oh v cc C 0.5 v i oh = C200 a all output pins except p34 and p35 * 3 v cc C 1.0 v i oh = C1 ma p34 to p35 * 2 v cc C 2.7 v i oh = C100 a, v cc = 4.5 v to 5.5 v v ol 0.4vi ol = 0.4 ma output low voltage all output pins * 3 0.4vi ol = 0.8 ma
rev. 2.00, 05/03, page 754 of 846 item symbol min typ max unit test conditions res | i in | 1.0 a input leakage current stby , nmi, md2 to md0, fwe 1.0 a vin = 0.5 to v cc C 0.5 v ports 4, 9 1.0 a v in = 0.5 to av cc C 0.5 v three-state leakage current (off state) ports 1, 3, 7, a to g ? i tsi ? 1.0 av in = 0.5 to v cc C 0.5 v input pull-up mos current ports a to e Ci p 10 300 a v in = 0 v notes: * 1 if the a/d and d/a converters are not used, do not leave the av cc , v ref , and av ss pins open. apply a voltage between 2.0 v and 5.5 v to the av cc and v ref pins by connecting them to v cc , for instance. set v ref av cc . * 2 p35/sck1/scl0 and p34/sda0 are nmos push-pull outputs. in order to output a high level from scl0 and sda0 (ice = 1), a pull-up resistance must be connected externally. the high level of p35/sck1 and p34 (ice = 0) is driven by nmos. in order to output a high level at v cc = 4.5 v or below, a pull-up resistance must be connected externally. * 3 this is the case when iics = 0 and ice = 0. low-level output when the bus drive function is selected will be determined in table 26.17.
rev. 2.00, 05/03, page 755 of 846 table 26.15 dc characteristics (2) condition a (f-ztat version): v cc = 3.0 v to 5.5 v, av cc = 3.6 v to 5.5 v, v ref = 3.6 v to av cc , v ss = av ss = 0 v, t a = C20c to +75c (regular specifications), t a = C40c to +85c (wide-range specifications) * 1 item symbol min typ max unit test conditions res c in 30 pf input capacitance nmi 30 pf p32 to p35 20 pf all input pins except the above 15 pf vin = 0 v f = 1 mhz ta = 25c current dissipation * 2 normal operation i cc * 4 23 v cc = 3.0 v 40 v cc = 5.5 v ma f = 13.5 mhz sleep mode 18 v cc = 3.0 v 30 v cc = 5.5 v ma f = 13.5 mhz all modules stopped 13 ma f = 13.5 mhz, v cc = 3.0 v (reference values) medium- speed mode ( /32) 13 ma f = 13.5 mhz, v cc = 3.0 v (reference values) subactive mode 80 180 a using 32.768 khz crystal resonator v cc = 3.0 v subsleep mode 60 130 a using 32.768 khz crystal resonator v cc = 3.0 v watch mode 8 40 a using 32.768 khz crystal resonator v cc = 3.0 v standby mode * 3 1.0 v cc = 3.0 v 10 v cc = 5.5 v a t a 50c not using 32.768 khz 50 v cc = 5.5 v 50c < t a not using 32.768 khz analog power supply current during a/d and d/a conversion al cc 0.3 1.5 ma idle 0.01 5.0 a
rev. 2.00, 05/03, page 756 of 846 item symbol min typ max unit test conditions reference current during a/d and d/a conversion al cc 1.3 3.5 ma idle 0.01 5.0 a ram standby voltage v ram 2.0 v notes: * 1 if the a/d and d/a converters are not used, do not leave the av cc , v ref , and av ss pins open. apply a voltage between 2.0 v and 5.5 v to the av cc and v ref pins by connecting them to v cc , for instance. set v ref av cc . * 2 current dissipation values are for v ih min = v cc C 0.5 v, v il max = 0.5 v with all output pins unloaded and the on-chip pull-up resistors in the off state. * 3 the values are for v ram v cc < 3.0 v, v ih min = v cc 0.9, and v il max = 0.3 v. * 4i cc depends on v cc and f as follows: i cc max = 2.0 (ma) + 0.7 (ma/v) v cc + 1.4 (ma/mhz) f +0.20 (ma/(mhz v)) v cc f (normal operation) i cc max = 1.5 (ma) + 0.6 (ma/v) v cc + 1.1 (ma/mhz) f +0.15 (ma/(mhz v)) v cc f (sleep mode)
rev. 2.00, 05/03, page 757 of 846 table 26.15 dc characteristics (3) condition b (masked rom version): v cc = 2.7 v to 5.5 v, av cc = 3.6 v to 5.5 v, v ref = 3.6 v to av cc , v ss = av ss = 0 v, t a = C20c to +75c (regular specifications), t a = C40c to +85c (wide-range specifications) * 1 item symbol min typ max unit test conditions res c in 30 pf input capacitance nmi 30 pf p32 to p35 20 pf all input pins except the above 15 pf vin = 0 v f = 1 mhz ta = 25c current dissipation * 2 normal operation i cc * 4 22 v cc = 3.0 v 40 v cc = 5.5 v ma f = 13.5 mhz sleep mode 16 v cc = 3.0 v 30 v cc = 5.5 v ma f = 13.5 mhz all modules stopped 13 ma f = 13.5 mhz, v cc = 3.0 v (reference values) medium- speed mode ( /32) 13 ma f = 13.5 mhz, v cc = 3.0 v (reference values) subactive mode 60 180 a using 32.768 khz crystal resonator v cc = 3.0 v subsleep mode 35 100 a using 32.768 khz crystal resonator v cc = 3.0 v watch mode 8 40 a using 32.768 khz crystal resonator v cc = 3.0 v standby mode * 3 0.5 v cc = 3.0 v 10 v cc = 5.5 v a t a 50c not using 32.768 khz 50 v cc = 5.5 v 50c < t a not using 32.768 khz analog power supply current during a/d and d/a conversion al cc 0.3 1.5 ma idle 0.01 5.0 a
rev. 2.00, 05/03, page 758 of 846 item symbol min typ max unit test conditions reference current during a/d and d/a conversion al cc 1.3 3.5 ma idle 0.01 5.0 a ram standby voltage v ram 2.0 v notes: * 1 if the a/d and d/a converters are not used, do not leave the av cc , v ref , and av ss pins open. apply a voltage between 2.0 v and 5.5 v to the av cc and v ref pins by connecting them to v cc , for instance. set v ref av cc . * 2 current dissipation values are for v ih min = v cc C 0.5 v, v il max = 0.5 v with all output pins unloaded and the on-chip pull-up resistors in the off state. * 3 the values are for v ram v cc < 2.7 v, v ih min = v cc 0.9, and v il max = 0.3 v. * 4i cc depends on v cc and f as follows: i cc max = 2.0 (ma) + 0.7 (ma/v) v cc + 1.4 (ma/mhz) f + 0.20 (ma/(mhz v)) v cc f (normal mode) i cc max = 1.5 (ma) + 0.6 (ma/v) v cc + 1.1 (ma/mhz) f + 0.15 (ma/(mhz v)) v cc f (sleep mode)
rev. 2.00, 05/03, page 759 of 846 table 26.16 permissible output currents condition a (f-ztat version): v cc = 3.0 v to 5.5 v, av cc = 3.6 v to 5.5 v, v ref = 3.6 v to av cc , v ss = av ss = 0 v, t a = C20c to +75c (regular specifications), t a = C40c to +85c (wide-range specifications) condition b (masked rom version): v cc = 2.7 v to 5.5 v, av cc = 3.6 v to 5.5 v, v ref = 3.6 v to av cc , v ss = av ss = 0 v, t a = C20c to +75c (regular specifications), t a = C40c to +85c (wide-range specifications) item symbol min typ max unit permissible output low current (per pin) scl1 and scl0, sda1 and sda0 i ol 10ma all output pins except the above 1.0 permissible output low current (total) total of all output pins i ol 60ma permissible output high current (per pin) all output pins Ci oh 1.0ma permissible output high current (total) total of all output pins Ci oh 30ma note: to protect chip reliability, do not exceed the output current values in table 26.16.
rev. 2.00, 05/03, page 760 of 846 table 26.17 bus drive characteristics condition a (f-ztat version): v cc = 3.0 v to 5.5 v, av cc = 3.6 v to 5.5 v, v ref = 3.6 v to av cc , v ss = av ss = 0 v, t a = C20c to +75c (regular specifications), t a = C40c to +85c (wide-range specifications) * condition b (masked rom version): v cc = 2.7 v to 5.5 v, av cc = 3.6 v to 5.5 v, v ref = 3.6 v to av cc , v ss = av ss = 0 v, t a = C20c to +75c (regular specifications), t a = C40c to +85c (wide-range specifications) * applicable pins: scl1 and scl0, sda1 and sda0 item symbol min typ max unit test conditions v t C v cc 0.3 v cc = 2.7 v to 5.5 v v t + v cc 0.7 v cc = 2.7 v to 5.5 v 0.4 v cc = 4.0 v to 5.5 v schmitt trigger input voltage v t + C v t C v cc 0.05 v v cc = 2.7 v to 4.0 v input high voltage v ih v cc 0.7 v cc + 0.5 v v cc = 2.7 v to 5.5 v input low voltage v il C0.5 v cc 0.3 v v cc = 2.7 v to 5.5 v 0.5 i ol = 8 ma, v cc = 4.0 v to 5.5 v output low voltage v ol 0.4 v i ol = 3 ma input capacitance c in 20 pf v in = 0 v, f = 1 mhz, t a = 25 c three-state leakage current (off state) ? i tsi ? 1.0av in = 0.5 to v cc C 0.5 v scl, sda output fall time t of 20 + 0.1 cb 250 ns v cc = 2.7 v to 5.5 v note: * if the a/d and d/a converters are not used, do not leave the av cc , v ref , and av ss pins open. apply a voltage between 2.0 v and 5.5 v to the av cc and v ref pins by connecting them to v cc , for instance. set v ref av cc .
rev. 2.00, 05/03, page 761 of 846 26.3.3 ac characteristics figure 26.6 shows the test conditions for the ac characteristics. 3 v r l r h c lsi output pin c =30 pf: r l = 2.4 k ? r h = 12 k ? i/o timing test levels low level: 0.8 v high level: 2.0 v figure 26.6 output load circuit
rev. 2.00, 05/03, page 762 of 846 (1) clock timing table 26.18 lists the clock timing table 26.18 clock timing condition a (f-ztat version): v cc = 3.0 v to 5.5 v, av cc = 3.6 v to 5.5 v, v ref = 3.6 v to av cc , v ss = av ss = 0 v, = 32.768 khz, 2 mhz to 13.5 mhz, t a = C20c to +75c (regular specifications), t a = C40c to +85c (wide-range specifications) condition b (masked rom version): v cc = 2.7 v to 5.5 v, av cc = 3.6 v to 5.5 v, v ref = 3.6 v to av cc , v ss = av ss = 0 v, = 32.768 khz, 2 mhz to 13.5 mhz, t a = C20c to +75c (regular specifications), t a = C40c to +85c (wide-range specifications) conditions a and b item symbol min typ max unit test conditions clock cycle time t cyc 74 500 ns figure 26.7 clock high pulse width t ch 25 ns clock low pulse width t cl 25 ns clock rise time t cr 10ns clock fall time t cf 10ns reset oscillation stabilization time (crystal) t osc1 20 ms figure 26.8 software standby oscillation stabilization time (crystal) t osc2 8 ms figure 23.3 external clock output stabilization delay time t dext 500 s figure 26.8 subclock oscillation stabilization time t osc3 2 s subclock oscillator frequency f sub 32.768 khz subclock ( sub ) cycle time t sub 30.5 s
rev. 2.00, 05/03, page 763 of 846 (2) control signal timing table 26.19 lists the control signal timing. table 26.19 control signal timing condition a (f-ztat version): v cc = 3.0 v to 5.5 v, av cc = 3.6 v to 5.5 v, v ref = 3.6 v to av cc , v ss = av ss = 0 v, = 32.768 khz, 2 mhz to 13.5 mhz, t a = C20c to +75c (regular specifications), t a = C40c to +85c (wide-range specifications) condition b (masked rom version): v cc = 2.7 v to 5.5 v, av cc = 3.6 v to 5.5 v, v ref = 3.6 v to av cc , v ss = av ss = 0 v, = 32.768 khz, 2 mhz to 13.5 mhz, t a = C20c to +75c (regular specifications), t a = C40c to +85c (wide-range specifications) conditions a and b item symbol min max unit test conditions res setup time t ress 250 ns figure 26.9 res pulse width t resw 20 t cyc mres setup time t mress 250 ns mres pulse width t mresw 20 t cyc nmi setup time t nmis 250 ns figure 26.10 nmi hold time t nmih 10 nmi pulse width (exiting software standby mode) t nmiw 200 ns irq setup time t irqs 250 ns irq hold time t irqh 10 ns irq pulse width (exiting software standby mode) t irqw 200 ns
rev. 2.00, 05/03, page 764 of 846 (3) bus timing table 26.20 lists the bus timing. table 26.20 bus timing condition a (f-ztat version): v cc = 3.0 v to 5.5 v, av cc = 3.6 v to 5.5 v, v ref = 3.6 v to av cc , v ss = av ss = 0 v, = 2 mhz to 13.5 mhz, t a = C20c to +75c (regular specifications), t a = C40c to +85c (wide-range specifications) condition b (masked rom version): v cc = 2.7 v to 5.5 v, av cc = 3.6 v to 5.5 v, v ref = 3.6 v to av cc , v ss = av ss = 0 v, = 2 mhz to 13.5 mhz, t a = C20c to +75c (regular specifications), t a = C40c to +85c (wide-range specifications) conditions a and b item symbol min max unit test conditions address delay time t ad 50ns address setup time t as 0.5 t cyc C 30 ns address hold time t ah 0.5 t cyc C 15 ns cs delay time t csd 50ns figures 26.11 to 26.15 as delay time t asd 50ns rd delay time 1 t rsd1 50ns rd delay time 2 t rsd2 50ns read data setup time t rds 30 ns read data hold time t rdh 0ns read data access time 1 t acc1 1.0 t cyc C 65 ns read data access time 2 t acc2 1.5 t cyc C 65 ns read data access time 3 t acc3 2.0 t cyc C 65 ns read data access time 4 t acc4 2.5 t cyc C 65 ns read data access time 5 t acc5 3.0 t cyc C 65 ns
rev. 2.00, 05/03, page 765 of 846 conditions a and b item symbol min max unit test conditions wr delay time 1 t wrd1 50ns wr delay time 2 t wrd2 50ns wr pulse width 1 t wsw1 1.0 t cyc C 30 ns wr pulse width 2 t wsw2 1.5 t cyc C 30 ns write data delay time t wdd 70ns write data setup time t wds 0.5 t cyc C 37 ns write data hold time t wdh 0.5 t cyc C 15 ns figures 26.11 to 26.15 wait setup time t wts 50 ns wait hold time t wth 10 ns figure 26.13 breq setup time t brqs 50 ns figure 26.16 back delay time t bacd 50ns bus-floating time t bzd 80ns
rev. 2.00, 05/03, page 766 of 846 (4) timing of on-chip peripheral modules table 26.21 shows the timing of on-chip peripheral modules, and table 26.22 shows the i 2 c bus timing. table 26.21 timing of on-chip peripheral modules condition a (f-ztat version): v cc = 3.0 v to 5.5 v, av cc = 3.6 v to 5.5 v, v ref = 3.6 v to av cc , v ss = av ss = 0 v, = 32.768 khz, 2 mhz to 13.5 mhz, t a = C20c to +75c (regular specifications), t a = C40c to +85c (wide-range specifications) condition b (masked rom version): v cc = 2.7 v to 5.5 v, av cc = 3.6 v to 5.5 v, v ref = 3.6 v to av cc , v ss = av ss = 0 v, = 32.768 khz, 2 mhz to 13.5 mhz, t a = C20c to +75c (regular specifications), t a = C40c to +85c (wide-range specifications) conditions a and b item symbol min max unit test conditions i/o port * output data delay time t pwd 100 ns figure 26.17 input data setup time t prs 50 input data hold time t prh 50 tpu timer output delay time t tocd 100 ns figure 26.18 timer input setup time t tics 40 timer clock input setup time t tcks 40 ns figure 26.19 single edge t tckwh 1.5 t cyc timer clock pulse width both edges t tckwl 2.5 tmr timer output delay time t tmod 100 ns figure 26.20 timer reset input setup time t tmrs 50 ns figure 26.22 timer clock input setup time t tmcs 50 ns figure 26.21 single edge t tmcwh 1.5 t cyc timer clock pulse width both edges t tmcwl 2.5
rev. 2.00, 05/03, page 767 of 846 conditions a and b item symbol min max unit test conditions wdt1 buzz output delay time t buzd 100 ns figure 26.23 sci * asynchronous t scyc 4t cyc figure 26.24 input clock cycle synchronous 6 input clock pulse width t sckw 0.4 0.6 t scyc input clock rise time t sckr 1.5t cyc input clock fall time t sckf 1.5 transmit data delay time t txd 100 ns figure 26.25 receive data setup time (synchronous) t rxs 75 ns receive data hold time (synchronous) t rxh 75 ns a/d converter trigger input setup time t trgs 40 ns figure 26.26 note: * the high level of p35/sck1 and p34 is driven by nmos. in order to output a high level at v cc = 4.5 v or below, a pull-up resistance must be connected externally.
rev. 2.00, 05/03, page 768 of 846 table 26.22 i 2 c bus timing condition a (f-ztat version): v cc = 3.0 v to 5.5 v, v ss = 0 v, = 5 mhz to maximum operating frequency, t a = C20c to +75c condition b (masked rom version): v cc = 2.7 v to 5.5 v, v ss = 0 v, = 5 mhz to maximum operating frequency, t a = C20c to +75c conditions a and b item symbol min typ max unit test conditions notes scl input cycle time t scl 12t cyc ns figure 26.27 scl input high pulse width t sclh 3t cyc ns scl input low pulse width t scll 5t cyc ns scl, sda input rise time t sr 7.5t cyc * ns scl, sda input fall time t sf 300 ns scl, sda input spike pulse elimination time t sp 1t cyc ns sda input bus free time t buf 5t cyc ns start condition input hold time t stah 3t cyc ns retransmission start condition input setup time t stas 3t cyc ns stop condition input setup time t stos 3t cyc ns data input setup time t sdas 0.5t cyc ns data input hold time t sdah 0ns scl, sda capacitive load c b 400 pf note: * 7.5t cyc and 17.5t cyc can be set according to the clock selected for use by the i 2 c module. for details, see section 15.5, usage notes.
rev. 2.00, 05/03, page 769 of 846 26.3.4 a/d conversion characteristics a/d converter characteristics for the f-ztat and masked rom versions are shown in table 26.23. table 26.23 a/d conversion characteristics (f-ztat and masked rom versions) condition: v cc = 3.0 v to 5.5 v, av cc = 3.6 v to 5.5 v, v ref = 3.6 v to av cc , v ss = av ss = 0 v, = 2 mhz to 13.5 mhz, t a = C20c to +75c (regular specifications), t a = C40c to +85c (wide-range specifications) condition item min typ max unit resolution 10 10 10 bit conversion time 9.6 s analog input capacitance 20 pf permissible signal-source impedance 5 k ? nonlinearity error 6.0 lsb offset error 4.0 lsb full-scale error 4.0 lsb quantization 0.5 lsb absolute accuracy 8.0 lsb 26.3.5 d/a convervion characteristics table 26.24 lists the d/a conversion characteristics. table 26.24 d/a conversion characteristics (f-ztat and masked rom versions) condition: v cc = 4.0 v to 5.5 v, av cc = 3.6 v to 5.5 v, v ref = 3.6 v to av cc , v ss = av ss = 0 v, = 2 mhz to 13.5 mhz, t a = C20c to +75c (regular specifications), t a = C40c to +85c (wide-range specifications) condition item min typ max unit test conditions resolution 888bit conversion time 10 s 20-pf capacitive load absolute accuracy 2.0 3.0 lsb 2-m ? resistive load 2.0lsb4-m ? resistive load
rev. 2.00, 05/03, page 770 of 846 26.3.6 flash memory characteristics table 26.25 lists the flash memory characteristics. table 26.25 flash memory characteristics conditions: v cc = 3.0 v to 5.5 v, av cc = 3.0 v to 5.5 v, v ref = 3.0 v to av cc , v ss = av ss = 0 v, t a = -20c to +75c (program/erase operating temperature range; regular specifications), t a = C20c to +75c (program/erase operating temperature range; wide-range specifications) item symbol min typ max unit test conditions programming time * 1 * 2 * 4 t p 10 200 ms/ 128 bytes erase time * 1 * 3 * 5 t e 100 1200 ms/block rewrite times n wec * 6 100 10000 * 7 times data holding time t drp 10 year programming wait time after swe1 bit setting * 1 t sswe 11 s wait time after psu1 bit setting * 1 t spsu 50 50 s wait time after p1 bit setting * 1 * 4 t sp10 81012s t sp30 28 30 32 s1 n 6 t sp200 198 200 202 s7 n 1000 wait time after p1 bit clearing * 1 t cp 55 s wait time after psu1 bit clearing * 1 t cpsu 55 s wait time after pv1 bit setting * 1 t spv 44 s wait time after h'ff dummy write * 1 t spvr 22 s wait time after pv1 bit clearing * 1 t cpv 22 s wait time after swe1 bit clearing t cswe 100 100 s n1 6 * 4 times maximum number of programming operations * 1 * 4 n2 994 * 4 erasing wait time after swe1 bit setting * 1 t sswe 11 s wait time after esu1 bit setting * 1 t sesu 100 100 s wait time after e1 bit setting * 1 * 5 t se 10 10 100 ms wait time after e1 bit clearing * 1 t ce 10 10 s wait time after esu1 bit clearing * 1 t cesu 10 10 s wait time after ev1 bit setting * 1 t sev 20 20 s wait time after h'ff dummy write * 1 t sevr 22 s wait time after ev1 bit clearing * 1 t cev 44 s wait time after swe1 bit clearing t cswe 100 100 s maximum number of erases * 1 * 5 n 100 times
rev. 2.00, 05/03, page 771 of 846 notes: * 1 follow the program/erase algorithms when making the time settings. * 2 programming time per 128 bytes. (indicates the total time during which the p1 bit is set in flash memory control register 1 (flmcr1). does not include the program-verify time.) * 3 time to erase one block. (indicates the time during which the e1 bit is set in flmcr1. does not include the erase-verify time.) * 4 maximum programming time (t p (max) = wait time after p1 bit setting (t sp ) x maximum number of writes (n)) (t sp30 + t sp10 ) 6 + (t sp200 ) 994 * 5 for the maximum erase time (t e (max)), the following relationship applies between the wait time after e1 bit setting (z) and the maximum number of erases (n): t e (max) = wait time after e1 bit setting (t se ) maximum number of erases (n) * 6 the guaranteed value of reprogramming is less than minimum count. * 7 typical value at 25 c.
rev. 2.00, 05/03, page 772 of 846 26.4 electrical characteristics of 3-v version h8s/2238r 26.4.1 absolute maximum ratings table 26.26 lists the absolute maximum ratings. table 26.26 absolute maximum ratings item symbol value unit v cc C0.3 to +4.3 v power supply voltage cv cc C0.3 to +4.3 v input voltage (except ports 4 and 9) v in C0.3 to v cc +0.3 v input voltage (ports 4 and 9) v in C0.3 to av cc +0.3 v reference power supply voltage v ref C0.3 to av cc +0.3 v analog power supply voltage av cc C0.3 to +4.3 v analog input voltage v an C0.3 to av cc +0.3 v operating temperature t opr regular specifications: C20 to +75 * 1 wide-range specifications: C40 to +85 * 2 c storage temperature t stg C55 to +125 c caution: permanent damage to the chip may result if absolute maximum rating are exceeded. notes: * 1 when the operating voltage in read is v cc = 2.7 v to 3.6 v, the operating temperature ranges for flash memory programming/erasing are t a = C20 c to +75 c. when the operating voltage in read is v cc = 2.2 v to 3.6 v, the operating temperature ranges for flash memory programming/erasing are t a = C20 c to +50 c. * 2 the operating temperature ranges for flash memory programming/erasing are t a = C40 c to +80 c (regular specifications).
rev. 2.00, 05/03, page 773 of 846 26.4.2 dc characteristics table 26.27 lists the dc characteristics. table 26.28 lists the permissible output currents. table 26.29 lists the bus driving characteristics. table 26.27 dc characteristics (1) condition a (f-ztat version): v cc = 2.7 v to 3.6 v, av cc = 2.7 v to 3.6 v, v ref = 2.7 v to av cc , v ss =av ss = 0 v, t a = C20 c to +75 c (regular specifications) t a = C40 c to +85 c (wide-range specifications) * 1 condition b (f-ztat version): v cc = 2.2 v to 3.6 v, av cc = 2.7 v to 3.6 v, v ref = 2.7 v to av cc , v ss =av ss = 0 v, t a = C20 c to +75 c (regular specifications) condition c (masked rom version): v cc = 2.2 v to 3.6 v, av cc = 2.2 v to 3.6 v, v ref =2.2 v to av cc , v ss = av ss = 0 v, t a = C20 c to +75 c (regular specifications), t a = C40 c to +85 c (wide-range specifications) * 1 item symbol min typ max unit test conditions irq0 to irq7 vt C v cc 0.2 ?? v vt + ?? v cc 0.8 v schmitt trigger input voltage vt + C vt C v cc 0.05 ?? v input high voltage res , stby , nmi, fwe, md2 to md0 v ih v cc 0.9 ? v cc + 0.3 v extal, ports 1, 3, 7, and a to g v cc 0.8 ? v cc + 0.3 v ports 4 and 9 v cc 0.8 ? av cc + 0.3 v input low voltage res , stby , fwe, md2 to md0 v il C0.3 ? v cc 0.1 v nmi, extal, ports 1, 3, 4, 7, 9, and a to g C0.3 ? v cc 0.2 v
rev. 2.00, 05/03, page 774 of 846 item symbol min typ max unit test conditions v oh v cc C 0.5 ?? vi oh = C200 a output high voltage all output pins * 4 except p34 and p35 v cc C 1.0 ?? vi oh = C1 ma * 2 p34 and p35 * 3 v cc C 2.0 ?? v i oh = C100 a (reference value) all output pins * 4 v ol ?? 0.4 v i ol = 0.4 ma output low voltage ?? 0.4 v i ol = 0.8 ma * 2 res ?? 1.0 a input leakage current stby , nmi, fwe, md2 to md0 ?? 1.0 a v in = 0.2 to v cc C 0.2 v ports 4, 9 | i in | ?? 1.0 a v in = 0.2 to av cc C 0.2 v three states leakage current (off) ports 1, 3, 7, and a to g | i tsi | ?? 1.0 a v in = 0.2 to v cc C 0.2 v input pull-up mos current ports a to e Ci p 10 ? 300 a v in = 0v notes: * 1 if the a/d or d/a converter is not used, the av cc , v ref , and av ss pins should not be open. even if the a/d or d/a converter is not used, connect the av cc and v ref pins to v cc and supply 2.0 v to 3.6 v. in this case, v ref av cc . * 2v cc = 2.7 v to 3.6 v * 3 p35/sck1/scl0 and p34/sda0 function as nmos push-pull output. to output the high voltage from scl0 and sda0 (ice = 1), connect an external pull-up resistor. nmos controls p35/sck1 and p34 to output the high voltage. to output the high voltage from p35/sck1 and p34, connect an external pull-up resistor. * 4 in the case when ice = 0. low voltage output with bus driving function is specified in table 26.29.
rev. 2.00, 05/03, page 775 of 846 table 26.27 dc characteristics (2) condition a (f-ztat version): v cc = 2.7 v to 3.6 v, av cc = 2.7 v to 3.6 v, v ref = 2.7 v to av cc , v ss =av ss = 0 v, t a = C20 c to +75 c (regular specifications) t a = C40 c to +85 c (wide-range specifications) * 1 condition b (f-ztat version): v cc = 2.2 v to 3.6 v, av cc = 2.2 v to 3.6 v, v ref = 2.2 v to av cc , v ss =av ss = 0 v, t a = C20 c to +75 c (regular specifications) item symbol min typ max unit test conditions res ?? 30 pf nmi ?? 30 pf p32 to p35 ?? 20 pf input capacitance all input pins other than above ones c in ?? 15 pf v in = 0 v f = 1 mhz t a = 25 c current consumption * 2 normal operation i cc * 4 ? 20 v cc = 3.0 v 37 v cc = 3.6 v ma f = 13.5 mhz ? 10 v cc = 3.0 v 18 v cc = 3.6 v ma f = 6.25 mhz sleep mode ? 15 v cc = 3.0 v 29 v cc = 3.6 v ma f = 13.5 mhz ? 7.5 v cc = 3.0 v 14 v cc = 3.6 v ma f = 6.25 mhz all modules stopped ? 15 ? ma f = 13.5 mhz, v cc = 3.0 v (reference value) medium- speed mode ( /32) ? 13 ? ma f = 13.5 mhz, v cc = 3.0 v (reference value) subactive mode ? 70 180 a v cc = 3.0 v when 32.768 khz crystal resonator is used subsleep mode ? 50 130 a v cc = 3.0 v when 32.768 khz crystal resonator is used
rev. 2.00, 05/03, page 776 of 846 item symbol min typ max unit test conditions current consumption * 2 watch mode ? 840av cc = 3.0 v when 32.768 khz crystal resonator is used ? 1.0 v cc = 3.0 v 10 v cc = 3.6 v a t a 50 c when 32.768 khz crystal resonator is not used standby mode * 3 ?? 50 v cc = 3.6 v a 50 c < t a when 32.768 khz crystal resonator is not used during a/d conversion al cc ? 0.5 1.5 ma analog power supply current idle ? 0.01 5.0 a during a/d conversion al cc ? 1.3 2.5 ma reference power supply current idle ? 0.01 5.0 a ram standby voltage v ram 2.0 ?? v notes: * 1 if the a/d or d/a converter is not used, the av cc , v ref , and av ss pins should not be open. even if the a/d or d/a converter is not used, connect the av cc and v ref pins to v cc and supply 2.0 v to 3.6 v. in this case, v ref av cc . * 2 current consumption values are for v ih min = v cc C 0.2 v and v il max = 0.2 v, with all output pins unloaded and the on-chip mos pull-up transistors in the off state. * 3 the values are for v ram v cc < 2.2 v, v ih min = v cc C 0.2, and v il max = 0.2 v. * 4i cc depends on v cc and f as follows: i cc max = 1.0 (ma) + 0.74 (ma/(mhz x v)) v cc f (normal operation) i cc max = 1.0 (ma) + 0.58 (ma/(mhz x v)) v cc f (sleep mode)
rev. 2.00, 05/03, page 777 of 846 table 26.27 dc characteristics (3) condition c (masked rom version): v cc = 2.2 v to 3.6 v, av cc = 2.2 v to 3.6 v, v ref =2.2 v to av cc , v ss = av ss = 0 v, t a = C20 c to +75 c (regular specifications), t a = C40 c to +85 c (wide-range specifications) * 1 item symbol min typ max unit test conditions res ?? 30 pf nmi ?? 30 pf p32 to p35 ?? 20 pf input capacitance all input pins other than above ones c in ?? 15 pf v in = 0 v f = 1 mhz t a = 25 c ? 20 v cc = 3.0 v 37 v cc = 3.6 v ma f = 13.5 mhz current consumption * 2 normal operation i cc * 4 ? 10 v cc = 3.0 v 18 v cc = 3.6 v ma f = 6.25 mhz ? 15 v cc = 3.0 v 29 v cc = 3.6 v ma f = 13.5 mhz sleep mode ? 7.5 v cc = 3.0 v 14 v cc = 3.6 v ma f = 6.25 mhz all modules stopped ? 15 ? ma f = 13.5 mhz, v cc = 3.0 v (reference value) medium- speed mode ( /32) ? 13 ? ma f = 13.5 mhz, v cc = 3.0 v (reference value)
rev. 2.00, 05/03, page 778 of 846 item symbol min typ max unit test conditions current consumption * 2 subactive mode ? 45 180 a v cc = 3.0 v when 32.768 khz crystal resonator is used subsleep mode ? 30 100 a v cc = 3.0 v when 32.768 khz crystal resonator is used watch mode ? 840av cc = 3.0 v when 32.768 khz crystal resonator is used ? 0.5 v cc = 3.0 v 10 v cc = 3.6 v a t a 50c when 32.768 khz crystal resonator is not used standby mode * 3 ?? 50 v cc = 3.6 v a 50c < t a when 32.768 khz crystal resonator is not used during a/d conversion al cc ? 0.5 1.5 ma analog power supply current idle ? 0.01 5.0 a during a/d conversion al cc ? 1.3 2.5 ma reference power supply current idle ? 0.01 5.0 a ram standby voltage v ram 2.0 ?? v notes: * 1 if the a/d or d/a converter is not used, the av cc , v ref , and av ss pins should not be open. even if the a/d or d/a converter is not used, connect the av cc and v ref pins to v cc and supply 2.0 v to 3.6 v. in this case, v ref av cc . * 2 current consumption values are for v ih min = v cc C 0.2 v and v il max = 0.2 v, with all output pins unloaded and the on-chip mos pull-up transistors in the off state. * 3 the values are for v ram v cc < 2.2 v, v ih min = v cc C 0.2, and v il max = 0.2 v. * 4i cc depends on v cc and f as follows: i cc max = 1.0 (ma) + 0.74 (ma/(mhz x v)) v cc f (normal operation) i cc max = 1.0 (ma) + 0.58 (ma/(mhz x v)) v cc f (sleep mode)
rev. 2.00, 05/03, page 779 of 846 table 26.28 permissible output currents condition a (f-ztat version): v cc = 2.7 v to 3.6 v, av cc = 2.7 v to 3.6 v, v ref = 2.7 v to av cc , v ss =av ss = 0 v, t a = C20 c to +75 c (regular specifications) t a = C40 c to +85 c (wide-range specifications) condition b (f-ztat version): v cc = 2.2 v to 3.6 v, av cc = 2.2 v to 3.6 v, v ref = 2.2 v to av cc , v ss =av ss = 0 v, t a = C20 c to +75 c (regular specifications) condition c (masked rom version): v cc = 2.2 v to 3.6 v, av cc = 2.2 v to 3.6 v, v ref =2.2 v to av cc , v ss = av ss = 0 v, t a = C20 c to +75 c (regular specifications), t a = C40 c to +85 c (wide-range specifications) item symbol min typ max unit scl1 to scl0, sda1 to sda0 v cc = 2.7 v to 3.6 v i ol ?? 10 v cc = 2.2 v to 3.6 v ?? 0.5 permissible output low current (per pin) output pins other than above ones v cc = 2.7 v to 3.6 v i ol ?? 1.0 ma v cc = 2.2 v to 3.6 v ?? 30 permissible output low current (total) total of all output pins v cc = 2.7 v to 3.6 v i ol ?? 60 ma v cc = 2.2 v to 3.6 v ?? 0.5 permissible output high current (per pin) all output pins v cc = 2.7 v to 3.6 v Ci oh ?? 1.0 ma v cc = 2.2 v to 3.6 v ?? 15 permissible output high current (total) total of all output pins v cc = 2.7 v to 3.6 v Ci oh ?? 30 ma note: to protect chip reliability, do not exceed the output current values in table 26.28.
rev. 2.00, 05/03, page 780 of 846 table 26.29 bus driving characteristics conditions: v cc = 2.7 v to 3.6 v, av cc = 2.7 v to 3.6 v, v ref = 2.7 v to av cc , v ss = av ss = 0 v, t a = C20 c to +75 c (regular specifications), t a = C40 c to +85 c (wide-range specifications) * , objective pins: scl1 and 0 and sda1 and 0 item symbol min typ max unit test conditions vt C v cc 0.3 ?? vv cc = 2.7 v to 3.6 v vt + ?? v cc 0.7 v v cc = 2.7 v to 3.6 v schmitt trigger input voltage vt + C vt C v cc 0.05 ?? vv cc = 2.7 v to 3.6 v input high voltage v ih v cc 0.7 ? v cc + 0.5 v v cc = 2.7 v to 3.6 v input low voltage v il C0.5 ? v cc 0.3 v v cc = 2.7 v to 3.6 v v ol ?? 0.5 v i ol = 6 ma, v cc = 3.0 v to 3.6 v output low voltage ?? 0.4 v i ol = 3 ma input capacitance c in ?? 20 pf v in = 0 v f = 1 mhz t a = 25 c three states leakage current (off) | i tsi | ?? 1.0 a v in = 0.5 v to v cc C 0.5 v scl, sda output falling time t of 20 + 0.1cb ? 250 ns v cc = 2.7 v to 3.6 v note: * if the a/d or d/a converter is not used, the av cc , v ref , and av ss pins should not be open. even if the a/d or d/a converter is not used, connect the av cc and v ref pins to v cc and supply 2.0 v to 3.6 v. in this case, v ref av cc . 26.4.3 ac characteristics figure 26.5 shows the test conditions for the ac characteristics. (1) clock timing table 26.30 lists the clock timing.
rev. 2.00, 05/03, page 781 of 846 table 26.30 clock timing condition a (f-ztat version and masked rom version): v cc = 2.7 v to 3.6 v, av cc = 2.7 v to 3.6 v, v ref = 2.7 v to av cc , v ss =av ss = 0 v, = 32.768 khz, 2 to 13.5 mhz, t a = C20 c to +75 c (regular specifications) t a = C40 c to +85 c (wide-range specifications) condition b (f-ztat version): v cc = 2.2 v to 3.6 v, av cc = 2.2 v to 3.6 v, v ref = 2.2 v to av cc , v ss =av ss = 0 v, = 32.768 khz, 2 to 6.25 mhz, t a = C20 c to +75 c (regular specifications) condition c (masked rom version): v cc = 2.2 v to 3.6 v, av cc = 2.2 v to 3.6 v, v ref =2.2 v to av cc , v ss = av ss = 0 v, = 32.768 khz, 2 to 6.25 mhz t a = C20 c to +75 c (regular specifications), t a = C40 c to +85 c (wide-range specifications) condition a conditions b and c item symbol min typ max min typ max unit test conditions clock cycle time t cyc 74 ? 500 160 ? 500 ns clock high pulse width t ch 25 ?? 50 ?? ns clock low pulse width t cl 25 ?? 50 ?? ns clock rise time t cr ?? 10 ?? 25 ns clock fall time t cf ?? 10 ?? 25 ns figure 26.7 oscillation stabilization time at reset (crystal) t osc1 20 ?? 40 ?? ms figure 26.8 oscillation stabilization time in software standby (crystal) t osc2 8 ?? 16 ?? ms figure 23.3 external clock output stabilization delay time t dext 500 ?? 1000 ?? s figure 26.8 subclock oscillation stabilization time t osc3 ?? 2 ?? 4s subclock oscillator frequency f sub ? 32.768 ?? 32.768 ? khz subclock ( sub ) cycle time t sub ? 30.5 ?? 30.5 ? s
rev. 2.00, 05/03, page 782 of 846 (2) control signal timing table 26.31 lists the control signal timing. table 26.31 control signal timing condition a (f-ztat version and masked rom version): v cc = 2.7 v to 3.6 v, av cc = 2.7 v to 3.6 v, v ref = 2.7 v to av cc , v ss =av ss = 0 v, = 32.768 khz, 2 to 13.5 mhz, t a = C20 c to +75 c (regular specifications) t a = C40 c to +85 c (wide-range specifications) condition b (f-ztat version): v cc = 2.2 v to 3.6 v, av cc = 2.2 v to 3.6 v, v ref = 2.2 v to av cc , v ss =av ss = 0 v, = 32.768 khz, 2 to 6.25 mhz, t a = C20 c to +75 c (regular specifications) condition c (masked rom version): v cc = 2.2 v to 3.6 v, av cc = 2.2 v to 3.6 v, v ref =2.2 v to av cc , v ss = av ss = 0 v, = 32.768 khz, 2 to 6.25 mhz t a = C20 c to +75 c (regular specifications), t a = C40 c to +85 c (wide-range specifications) condition a conditions b and c item symbol min max min max unit test conditions res setup time t ress 250 ? 350 ? ns figure 26.9 res pulse width t resw 20 ? 20 ? t cyc mres setup time t mress 250 ? 350 ? ns mres pulse width t mresw 20 ? 20 ? t cyc nmi setup time t nmis 250 ? 350 ? ns figure 26.10 nmi hold time t nmih 10 ? 10 ? ns nmi pulse width (exiting software standby mode) t nmiw 200 ? 300 ? ns irq setup time t irqs 250 ? 350 ? ns irq hold time t irqh 10 ? 10 ? ns irq pulse width (exiting software standby mode) t irqw 200 ? 300 ? ns
rev. 2.00, 05/03, page 783 of 846 (3) bus timing table 26.32 lists the bus timing. table 26.32 bus timing condition a (f-ztat version and masked rom version): v cc = 2.7 v to 3.6 v, av cc = 2.7 v to 3.6 v, v ref = 2.7 v to av cc , v ss =av ss = 0 v, = 2 to 13.5 mhz, t a = C20 c to +75 c (regular specifications) t a = C40 c to +85 c (wide-range specifications) condition b (f-ztat version): v cc = 2.2 v to 3.6 v, av cc = 2.2 v to 3.6 v, v ref = 2.2 v to av cc , v ss =av ss = 0 v, = 2 to 6.25 mhz, t a = C20 c to +75 c (regular specifications) condition c (masked rom version): v cc = 2.2 v to 3.6 v, av cc = 2.2 v to 3.6 v, v ref =2.2 v to av cc , v ss = av ss = 0 v, = 2 to 6.25 mhz t a = C20 c to +75 c (regular specifications), t a = C40 c to +85 c (wide-range specifications) condition a conditions b and c item symbol min max min max unit test conditions address delay time t ad ? 50 ? 90 ns address setup time t as 0.5 t cyc ? 30 ? 0.5 t cyc ? 60 ? ns address hold time t ah 0.5 t cyc ? 15 ? 0.5 t cyc ? 30 ? ns figures 26.11 to 26.15 cs delay time t csd ? 50 ? 90 ns as delay time t asd ? 50 ? 90 ns rd delay time 1 t rsd1 ? 50 ? 90 ns rd delay time 2 t rsd2 ? 50 ? 90 ns read data setup time t rds 30 ? 50 ? ns read data hold time t rdh 0 ? 0 ? ns read data access time 1 t acc1 ? 1.0 t cyc ? 65 ? 1.0 t cyc ? 90 ns read data access time 2 t acc2 ? 1.5 t cyc ? 65 ? 1.5 t cyc ? 90 ns
rev. 2.00, 05/03, page 784 of 846 condition a conditions b and c item symbol min max min max unit test conditions read data access time 3 t acc3 ? 2.0 t cyc ? 65 ? 2.0 t cyc ? 90 ns read data access time 4 t acc4 ? 2.5 t cyc ? 65 ? 2.5 t cyc ? 90 ns figures 26.11 to 26.15 read data access time 5 t acc5 ? 3.0 t cyc ? 65 ? 3.0 t cyc ? 90 ns wr delay time 1 t wrd1 ? 50 ? 90 ns wr delay time 2 t wrd2 ? 50 ? 90 ns wr pulse width 1 t wsw1 1.0 t cyc ? 30 ? 1.0 t cyc ? 60 ? ns wr pulse width 2 t wsw2 1.5 t cyc ? 30 ? 1.5 t cyc ? 60 ? ns write data delay time t wdd ? 70 ? 100 ns write data setup time t wds 0.5 t cyc ? 37 ? 0.5 t cyc ? 80 ? ns write data hold time t wdh 0.5 t cyc ? 15 ? 0.5 t cyc ? 60 ? ns wait setup time t wts 50 ? 90 ? ns figure 26.13 wait hold time t wth 10 ? 10 ? ns breq setup time t brqs 50 ? 90 ? ns back delay time t bacd ? 50 ? 90 ns bus-floating time t bzd ? 80 ? 160 ns figure 26.16
rev. 2.00, 05/03, page 785 of 846 (4) timing of on-chip peripheral modules table 26.33 lists the timing of on-chip peripheral modules. table 26.34 lists the i 2 c bus timing. table 26.33 timing of on-chip peripheral modules condition a (f-ztat version and masked rom version): v cc = 2.7 v to 3.6 v, av cc = 2.7 v to 3.6 v, v ref = 2.7 v to av cc , v ss =av ss = 0 v, = 32.768 khz, 2 to 13.5 mhz, t a = C20 c to +75 c (regular specifications) t a = C40 c to +85 c (wide-range specifications) condition b (f-ztat version): v cc = 2.2 v to 3.6 v, av cc = 2.2 v to 3.6 v, v ref = 2.2 v to av cc , v ss =av ss = 0 v, = 32.768 khz, 2 to 6.25 mhz, t a = C20 c to +75 c (regular specifications) condition c (masked rom version): v cc = 2.2 v to 3.6 v, av cc = 2.2 v to 3.6 v, v ref =2.2 v to av cc , v ss = av ss = 0 v, = 32.768 khz, 2 to 6.25 mhz t a = C20 c to +75 c (regular specifications), t a = C40 c to +85 c (wide-range specifications) condition a conditions b and c item symbol min max min max unit test conditions i/o port * output data delay time t pwd ? 100 ? 150 ns figure 26.21 input data setup time t prs 50 ? 80 ? input data hold time t prh 50 ? 80 ? tpu timer output delay time t tocd ? 100 ? 150 ns figure 26.22 timer input setup time t tics 40 ? 60 ? timer clock input setup time t tcks 40 ? 60 ? ns figure 26.23 single edge t tckwh 1.5 ? 1.5 ? t cyc timer clock pulse width both edges t tckwl 2.5 ? 2.5 ? tmr timer output delay time t tmod ? 100 ? 150 ns figure 26.24 timer reset input setup time t tmrs 50 ? 80 ? ns figure 26.26 timer clock input setup time t tmcs 50 ? 80 ? ns figure 26.25 single edge t tmcwh 1.5 ? 1.5 ? t cyc timer clock pulse width both edges t tmcwl 2.5 ? 2.5 ?
rev. 2.00, 05/03, page 786 of 846 condition a conditions b and c item symbol min max min max unit test conditions wdt_1 buzz output delay time t buzd ? 100 ? 150 ns figure 26.27 sci * asynchro- nous t scyc 4 ? 4 ? t cyc figure 26.28 input clock cycle synchronous 6 ? 6 ? input clock pulse width t sckw 0.4 0.6 0.4 0.6 t scyc input clock rise time t sckr ? 1.5 ? 1.5 t cyc input clock fall time t sckf ? 1.5 ? 1.5 transmit data delay time t txd ? 100 ? 150 ns figure 26.29 receive data setup time (synchronous) t rxs 75 ? 150 ? ns receive data hold time (synchronous) t rxh 75 ? 150 ? ns a/d converter trigger input setup time t trgs 40 ? 60 ? ns figure 26.30 note: * nmos controls p35/sck1 and p34 to output the high voltage. to output the high voltage from p35/sck1 and p34, connect an external pull-up resistor.
rev. 2.00, 05/03, page 787 of 846 table 26.34 i 2 c bus timing conditions: v cc = 2.7 v to 3.6 v, v ss = 0 v, = 5 mhz to maximum operating frequency, t a = C20 c to +75 c item symbol min typ max unit test conditions remarks scl input cycle time t scl 12 t cyc ?? ns scl input high pulse width t sclh 3 t cyc ?? ns figure 26.31 scl input low pulse width t scll 5 t cyc ?? ns scl, sda input rise time t sr ?? 7.5 t cyc * ns scl, sda input fall time t sf ?? 300 ns scl, sda input spike pulse delete time t sp ?? 1 t cyc ns sda input bus free time t buf 5 t cyc ?? ns operating condition input hold time t stah 3 t cyc ?? ns retransmitting operating condition input setup time t stas 3 t cyc ?? ns stop condition input setup time t stos 3 t cyc ?? ns data input setup time t sdas 0.5 t cyc ?? ns data input hold time t sdah 0 ?? ns scl, sda capacitor load c b ?? 400 pf note: * maximum scl and sda input rise time 7.5 t cyc or 17.5 t cyc can be selected depending on the clock that is used in the i 2 c module. for detail see section 15.5, usage note.
rev. 2.00, 05/03, page 788 of 846 26.4.4 a/d conversion characteristics table 26.35 lists the a/d conversion characteristics. table 26.35 a/d conversion characteristics condition a (f-ztat version and masked rom version): v cc = 2.7 v to 3.6 v, av cc = 2.7 v to 3.6 v, v ref = 2.7 v to av cc , v ss =av ss = 0 v, = 2 to 13.5 mhz, t a = C20 c to +75 c (regular specifications) t a = C40 c to +85 c (wide-range specifications) condition b (f-ztat version): v cc = 2.2 v to 3.6 v, av cc = 2.2 v to 3.6 v, v ref = 2.2 v to av cc , v ss =av ss = 0 v, = 2 to 6.25 mhz, t a = C20 c to +75 c (regular specifications) condition c (masked rom version): v cc = 2.2 v to 3.6 v, av cc = 2.2 v to 3.6 v, v ref =2.2 v to av cc , v ss = av ss = 0 v, = 2 to 6.25 mhz t a = C20 c to +75 c (regular specifications), t a = C40 c to +85 c (wide-range specifications) condition a conditions b, c item min typ max min typ max unit resolution 10 10 10 10 10 10 bits conversion time 9.6 ?? 20.9 ?? s analog input capacitance ?? 20 ?? 20 pf permissible signal-source impedance ?? 5 ?? 5k ? nonlinearity error ?? 6.0 ?? 6.0 lsb offset error ?? 4.0 ?? 4.0 lsb full-scale error ?? 4.0 ?? 4.0 lsb quantization error ?? 0.5 ?? 0.5 lsb absolute accuracy ?? 8.0 ?? 8.0 lsb
rev. 2.00, 05/03, page 789 of 846 26.4.5 d/a conversion characteristics table 26.36 lists the d/a conversion characteristics. table 26.36 d/a conversion characteristics condition a (f-ztat version and masked rom version): v cc = 2.7 v to 3.6 v, av cc = 2.7 v to 3.6 v, v ref = 2.7 v to av cc , v ss =av ss = 0 v, = 2 to 13.5 mhz, t a = C20 c to +75 c (regular specifications) t a = C40 c to +85 c (wide-range specifications) condition b (f-ztat version): v cc = 2.2 v to 3.6 v, av cc = 2.2 v to 3.6 v, v ref = 2.2 v to av cc , v ss =av ss = 0 v, = 2 to 6.25 mhz, t a = C20 c to +75 c (regular specifications) condition c (masked rom version): v cc = 2.2 v to 3.6 v, av cc = 2.2 v to 3.6 v, v ref =2.2 v to av cc , v ss = av ss = 0 v, = 2 to 6.25 mhz t a = C20 c to +75 c (regular specifications), t a = C40 c to +85 c (wide-range specifications) condition a conditions b, c item min typ max min typ max unit test condition resolution 888888bits conversion time ?? 10 ?? 10 s load capacitance = 20 pf ? 2.0 3.0 ? 3.0 4.0 lsb load resistance = 2 m ? absolute accuracy ?? 2.0 ?? 3.0 lsb load resistance = 4 m ?
rev. 2.00, 05/03, page 790 of 846 26.4.6 flash memory characteristics table 26.37 lists the flash memory characteristics. table 26.37 flash memory characteristics condition a: v cc = 2.7 v to 3.6 v, av cc = 2.7 v to 3.6 v, v ref = 2.7 v to av cc , v ss = av ss = 0 v, v cc = 3.0 v to 3.6 v (programming/erasing operating voltage range), t a = C20 c to +75 c (programming/erasing operating temperature range; regular specifications), t a = C40 c to +85 c (programming/erasing operating temperature range; wide-range specifications) condition b: v cc = 2.2 v to 3.6 v, av cc = 2.2 v to 3.6 v, v ref = 2.2 v to av cc , v ss = av ss = 0 v, v cc = 3.0 v to 3.6 v (programming/erasing operating voltage range), t a = C20 c to +50 c (programming/erasing operating temperature range; regular specifications) item symbol min typ max unit test conditions programming time * 1 * 2 * 4 t p ? 10 200 ms/128 bytes erase time * 1 * 3 * 5 t e ? 100 1200 ms/block reprogramming count n wec * 6 100 10000 * 7 ? times data holding time t drp 10 ?? year programming wait time after swe1 bit setting * 1 t sswe 11 ? s wait time after psu1 bit setting * 1 t spsu 50 50 ? s t sp10 81012s t sp30 28 30 32 s 1 n 6 wait time after p1 bit setting * 1 * 4 t sp200 198 200 202 s 7 n 1000 wait time after p1 bit clear * 1 t cp 55 ? s wait time after psu1 bit clear * 1 t cpsu 55 ? s wait time after pv1 bit setting * 1 t spv 44 ? s wait time after h'ff dummy write * 1 t spvr 22 ? s
rev. 2.00, 05/03, page 791 of 846 item symbol min typ max unit test conditions programming wait time after pv1 bit clear * 1 t cpv 22 ? s wait time after swe1 bit clear t cswe 100 100 ? s n1 ?? 6 * 4 times maximum programming count * 1 * 4 n2 ?? 994 * 4 erase wait time after swe1 bit setting * 1 t sswe 11 ? s wait time after esu1 bit setting * 1 t sesu 100 100 ? s wait time after e1 bit setting * 1 * 5 t se 10 10 100 ms wait time after e1 bit clear * 1 t ce 10 10 ? s wait time after esu1 bit clear * 1 t cesu 10 10 ? s wait time after ev1 bit setting * 1 t sev 20 20 ? s wait time after h'ff dummy write * 1 t sevr 22 ? s wait time after ev1 bit clear * 1 t cev 44 ? s wait time after swe1 bit clear t cswe 100 100 ? s maximum erase count * 1 * 5 n ?? 100 times notes: * 1 make each time setting in accordance with the program/program-verify flowchart or erase/erase-verify flowchart. * 2 programming time per 128 bytes (shows the total period for which the p1 bit in the flash memory control register 1 (flmcr1) is set. it does not include the program verification time.) * 3 block erase time (shows the total period for which the e1 bit in flmcr1 is set. it does not include the erase verification time.) * 4 maximum programming time value t p (max) = wait time after p1 bit setting (t sp ) maximum program count (n) (t sp30 + t sp10 ) 6 + (t sp200 ) 994 * 5 relationship among the maximum erase time (t e (max)), the wait time after e1 bit setting (t se ), and the maximum erase count (n) is shown below. t e (max) = wait time after e1 bit setting (t se ) maximum erase count (n) * 6 the guaranteed value of reprogramming is less than minimum count. * 7 typical value at 25 c
rev. 2.00, 05/03, page 792 of 846 26.5 electrical characteristics of h8s/2237 group and h8s/2227 group 26.5.1 absolute maximum ratings table 26.38 lists the absolute maximum ratings. table 26.38 absolute maximum ratings item symbol value unit power supply voltage v cc C0.3 to +4.3 v program voltage v pp C0.3 to +13.5 v input voltage (except ports4 and 9)v in C0.3 to v cc +0.3 v input voltage (ports 4 and 9) v in C0.3 to av cc +0.3 v reference power supply voltage v ref C0.3 to av cc +0.3 v analog power supply voltage av cc C0.3 to +4.6 v analog input voltage v an C0.3 to av cc +0.3 v operating temperature t opr regular specifications: C20 to +75 wide-range specifications: C40 to +85 c storage temperature t stg C55 to +125 c caution: permanent damage to the chip may result if absolute maximum rating are exceeded. note: the operating temperature ranges for flash memory programming/erasing are t a = C20 c to +75 c (regular specifications) and t a = C40 c to +85 c (wide-range specifications).
rev. 2.00, 05/03, page 793 of 846 26.5.2 dc characteristics table 26.39 lists the dc characteristics. table 26.40 lists the permissible output currents. table 26.39 dc characteristics (1) conditions (ztat version and f-ztat version): v cc = 2.7 v to 3.6 v, av cc = 2.7 v to 3.6 v, v ref = 2.7 v to av cc , v ss =av ss = 0 v, t a = C20 c to +75 c (regular specifications), t a = C40 c to +85 c (wide-range specifications) * 1 conditions (masked rom version): v cc = 2.2 v to 3.6 v, av cc = 2.2 v to 3.6 v, v ref =2.2 v to av cc , v ss = av ss = 0 v, t a = C20 c to +75 c (regular specifications), t a = C40 c to +85 c (wide-range specifications) * 1 item symbol min typ max unit test conditions irq0 to irq7 vt C v cc 0.2 ?? v vt + ?? v cc 0.8 v vt + C vt C v cc 0.07 ?? v ztat version, masked rom version schmitt trigger input voltage vt + C vt C v cc 0.05 ?? v f-ztat version input high voltage res , stby , nmi, md2 to md0, fwe v ih v cc 0.9 ? v cc + 0.3 v extal, ports 1, 3, 7, and a to g v cc 0.8 ? v cc + 0.3 v ports 4 and 9 v cc 0.8 ? av cc + 0.3 v input low voltage res , stby , fwe, md2 to md0 v il C0.3 ? v cc 0.1 v nmi, extal, ports 1, 3, 4, 7, 9, and a to g C0.3 ? v cc 0.2 v v oh v cc C 0.5 ?? vi oh = C200 a output high voltage all output pins v cc C 1.0 ?? vi oh = C1 ma * 2 all output pins v ol ?? 0.4 v i ol = 0.4 ma output low voltage ?? 0.4 v i ol = 0.8 ma * 2
rev. 2.00, 05/03, page 794 of 846 item symbol min typ max unit test conditions res ?? 1.0 a input leakage current stby , nmi, fwe, md2 to md0 ?? 1.0 a v in = 0.5 to v cc C 0.5 v * 3 v in = 0.2 to v cc C 0.2 v * 4 ports 4, 9 | i in | ?? 1.0 a v in = 0.5 to av cc C 0.5 v * 3 v in = 0.2 to av cc C 0.2 v * 4 three states leakage current (off) ports 1, 3, 7, and a to g | i tsi | ?? 1.0 a v in = 0.5 to v cc C 0.5 v * 3 v in = 0.2 to v cc C 0.2 v * 4 input pull-up mos current ports a to e Ci p 10 ? 300 a v in = 0v notes: * 1 if the a/d or d/a converter is not used, the av cc , v ref , and av ss pins should not be open. even if the a/d or d/a converter is not used, connect the av cc and v ref pins to v cc and supply 2.0 v to 3.6 v. in this case, v ref av cc . * 2v cc = 2.7 v to 3.6 v * 3 for ztat version and masked rom version * 4 for f-ztat version
rev. 2.00, 05/03, page 795 of 846 table 26.39 dc characteristics (2) conditions (f-ztat version): v cc = 2.7 v to 3.6 v, av cc = 2.7 v to 3.6 v, v ref = 2.7 v to av cc , v ss =av ss = 0 v, t a = C20 c to +75 c (regular specifications), t a = C40 c to +85 c (wide-range specifications) * 1 item symbol min typ max unit test conditions res ?? 30 pf nmi ?? 30 pf input capacitance all input pins other than above ones c in ?? 15 pf v in = 0 v f = 1 mhz t a = 25 c current consumption * 2 normal operation i cc * 4 ? 20 v cc = 3.0 v 37 v cc = 3.6 v ma f = 13.5 mhz sleep mode ? 15 v cc = 3.0 v 29 v cc = 3.6 v ma f = 13.5 mhz all modules stopped ? 15 ? ma f = 13.5 mhz, v cc = 3.0 v (reference value) medium- speed mode ( /32) ? 11 ? ma f = 13.5 mhz, v cc = 3.0 v (reference value) subactive mode ? 60 160 a v cc = 3.0 v when 32.768 khz crystal resonator is used subsleep mode ? 35 90 a v cc = 3.0 v when 32.768 khz crystal resonator is used watch mode ? 840av cc = 3.0 v when 32.768 khz crystal resonator is used
rev. 2.00, 05/03, page 796 of 846 item symbol min typ max unit test conditions current consumption * 2 ? 1.0 v cc = 3.0 v 10 v cc = 3.6 v a t a 50 c when 32.768 khz crystal resonator is not used standby mode * 3 ?? 50 v cc = 3.6 v a 50 c < t a when 32.768 khz crystal resonator is not used during a/d conversion al cc ? 0.8 1.5 ma av cc = 3.0 v analog power supply current idle ? 0.01 5.0 a during a/d conversion al cc ? 1.3 2.5 ma v ref = 3.0 v reference power supply current idle ? 0.01 5.0 a ram standby voltage v ram 2.0 ?? v notes: * 1 if the a/d or d/a converter is not used, the av cc , v ref , and av ss pins should not be open. even if the a/d or d/a converter is not used, connect the av cc and v ref pins to v cc and supply 2.0 v to 3.6 v. in this case, v ref av cc . * 2 current consumption values are for v ih min = v cc C 0.2 v and v il max = 0.2 v, with all output pins unloaded and the on-chip mos pull-up transistors in the off state. * 3 the values are for v ram v cc < 2.7 v, v ih min = v cc 0.9, and v il max = 0.3 v. * 4i cc depends on v cc and f as follows: i cc max = 1.0 (ma) + 0.74 (ma/(mhz x v)) v cc f (normal operation) i cc max = 1.0 (ma) + 0.58 (ma/(mhz x v)) v cc f (sleep mode)
rev. 2.00, 05/03, page 797 of 846 table 26.39 dc characteristics (3) conditions (ztat version): v cc = 2.7 v to 3.6 v, av cc = 2.7 v to 3.6 v, v ref = 2.7 v to av cc , v ss =av ss = 0 v, t a = C20 c to +75 c (regular specifications), t a = C40 c to +85 c (wide-range specifications) * 1 item symbol min typ max unit test conditions res ?? 80 pf nmi ?? 50 pf input capacitance all input pins other than above ones c in ?? 15 pf v in = 0 v f = 1 mhz t a = 25 c current consumption * 2 normal operation i cc * 4 ? 16 v cc = 3.0 v 28 v cc = 3.6 v ma f = 10 mhz sleep mode ? 12 v cc = 3.0 v 22 v cc = 3.6 v ma f = 10 mhz all modules stopped ? 12 ? ma f = 10 mhz, v cc = 3.0 v (reference value) medium- speed mode ( /32) ? 8.5 ? ma f = 10 mhz, v cc = 3.0 v (reference value) subactive mode ? 80 120 a v cc = 3.0 v when 32.768 khz crystal resonator is used subsleep mode ? 60 90 a v cc = 3.0 v when 32.768 khz crystal resonator is used watch mode ? 812av cc = 3.0 v when 32.768 khz crystal resonator is used
rev. 2.00, 05/03, page 798 of 846 item symbol min typ max unit test conditions current consumption * 2 ? 0.01 5.0 a t a 50c when 32.768 khz crystal resonator is not used standby mode * 3 ?? 20.0 a 50c < t a when 32.768 khz crystal resonator is not used during a/d conversion al cc ? 0.2 1.0 ma av cc = 3.0 v analog power supply current idle ? 0.01 5.0 a during a/d conversion al cc ? 1.3 2.5 ma v ref = 3.0 v reference power supply current idle ? 0.01 5.0 a ram standby voltage v ram 2.0 ?? v notes: * 1 if the a/d or d/a converter is not used, the av cc , v ref , and av ss pins should not be open. even if the a/d or d/a converter is not used, connect the av cc and v ref pins to v cc and supply 2.0 v to 3.6 v. in this case, v ref av cc . * 2 current consumption values are for v ih min = v cc C 0.5 v and v il max = 0.5 v, with all output pins unloaded and the on-chip mos pull-up transistors in the off state. * 3 the values are for v ram v cc < 2.7 v, v ih min = v cc 0.9, and v il max = 0.3 v. * 4i cc depends on v cc and f as follows: i cc max = 1.0 (ma) + 0.74 (ma/(mhz x v)) v cc f (normal operation) i cc max = 1.0 (ma) + 0.58 (ma/(mhz x v)) v cc f (sleep mode)
rev. 2.00, 05/03, page 799 of 846 table 26.39 dc characteristics (4) conditions (masked rom version): v cc = 2.2 v to 3.6 v, av cc = 2.2 v to 3.6 v, v ref =2.2 v to av cc , v ss = av ss = 0 v, t a = C20 c to +75 c (regular specifications), t a = C40 c to +85 c (wide-range specifications) * 1 item symbol min typ max unit test conditions res ?? 80 pf nmi ?? 50 pf input capacitance all input pins other than above ones c in ?? 15 pf v in = 0 v f = 1 mhz t a = 25 c ? 20 v cc = 3.0 v 37 v cc = 3.6 v ma f = 13.5 mhz current consumption * 2 normal operation i cc * 4 ? 10 v cc = 3.0 v 18 v cc = 3.6 v ma f = 6.25 mhz ? 15 v cc = 3.0 v 29 v cc = 3.6 v ma f = 13.5 mhz sleep mode ? 7.5 v cc = 3.0 v 14 v cc = 3.6 v ma f = 6.25 mhz all modules stopped ? 15 ? ma f = 13.5 mhz, v cc = 3.0 v (reference value) medium- speed mode ( /32) ? 11 ? ma f = 13.5 mhz, v cc = 3.0 v (reference value) subactive mode ? 60 160 a v cc = 3.0 v when 32.768 khz crystal resonator is used
rev. 2.00, 05/03, page 800 of 846 item symbol min typ max unit test conditions current consumption * 2 subsleep mode ? 35 90 a v cc = 3.0 v when 32.768 khz crystal resonator is used watch mode ? 840av cc = 3.0 v when 32.768 khz crystal resonator is used ? 0.01 v cc = 3.0 v 10 v cc = 3.6 v a t a 50c when 32.768 khz crystal resonator is not used standby mode * 3 ?? 50 v cc = 3.6 v a 50c < t a when 32.768 khz crystal resonator is not used during a/d conversion al cc ? 0.8 1.5 ma av cc = 3.0 v analog power supply current idle ? 0.01 5.0 a during a/d conversion al cc ? 1.3 2.5 ma v ref = 3.0 v reference power supply current idle ? 0.01 5.0 a ram standby voltage v ram 2.0 ?? v notes: * 1 if the a/d or d/a converter is not used, the av cc , v ref , and av ss pins should not be open. even if the a/d or d/a converter is not used, connect the av cc and v ref pins to v cc and supply 2.0 v to 3.6 v. in this case, v ref av cc . * 2 current consumption values are for v ih min = v cc C 0.5 v and v il max = 0.5 v, with all output pins unloaded and the on-chip mos pull-up transistors in the off state. * 3 the values are for v ram v cc < 2.2 v, v ih min = v cc 0.9, and v il max = 0.3 v. * 4i cc depends on v cc and f as follows: i cc max = 1.0 (ma) + 0.74 (ma/(mhz x v)) v cc f (normal operation) i cc max = 1.0 (ma) + 0.58 (ma/(mhz x v)) v cc f (sleep mode)
rev. 2.00, 05/03, page 801 of 846 table 26.40 permissible output currents conditions (f-ztat version): v cc = 2.7 v to 3.6 v, av cc = 2.7 v to 3.6 v, v ref = 2.7 v to av cc , v ss =av ss = 0 v, t a = C20 c to +75 c (regular specifications), t a = C40 c to +85 c (wide-range specifications) conditions (masked rom version): v cc = 2.2 v to 3.6 v, av cc = 2.2 v to 3.6 v, v ref =2.2 v to av cc , v ss = av ss = 0 v, t a = C20 c to +75 c (regular specifications), t a = C40 c to +85 c (wide-range specifications) item symbol min typ max unit v cc = 2.2 v to 3.6 v ?? 0.5 permissible output low current (per pin) output pins v cc = 2.7 v to 3.6 v i ol ?? 1.0 ma v cc = 2.2 v to 3.6 v ?? 30 permissible output low current (total) total of all output pins v cc = 2.7 v to 3.6 v i ol ?? 60 ma v cc = 2.2 v to 3.6 v ?? 0.5 permissible output high current (per pin) all output pins v cc = 2.7 v to 3.6 v Ci oh ?? 1.0 ma v cc = 2.2 v to 3.6 v ?? 15 permissible output high current (total) total of all output pins v cc = 2.7 v to 3.6 v Ci oh ?? 30 ma note: to protect chip reliability, do not exceed the output current values in table 26.40.
rev. 2.00, 05/03, page 802 of 846 26.5.3 ac characteristics figure 26.6 shows the test conditions for the ac characteristics. (1) clock timing table 26.41 lists the clock timing. table 26.41 clock timing condition a (ztat version): v cc = 2.7 v to 3.6 v, av cc = 2.7 v to 3.6 v, v ref = 2.7 v to av cc , v ss = av ss = 0 v, = 32.768 khz, 2 to 10 mhz, t a = C20 c to +75 c (regular specifications) t a = C40 c to +85 c (wide-range specifications) condition b (f-ztat version, masked rom version): v cc = 2.7 v to 3.6 v, av cc = 2.7 v to 3.6 v, v ref = 2.7 v to av cc , v ss = av ss = 0 v, = 32.768 khz, 2 to 13.5mhz, t a = C20 c to +75 c (regular specifications) t a = C40 c to +85 c (wide-range specifications) condition c (masked rom version): v cc = 2.2 v to 3.6 v, av cc = 2.2 v to 3.6 v, v ref = 2.2 v to av cc , v ss = av ss = 0 v, = 32.768 khz, 2 to 6.25 mhz t a = C20 c to +75 c (regular specifications), t a = C40 c to +85 c (wide-range specifications) condition a condition b condition c item symbol min max min max min max unit test conditions clock cycle time t cyc 100 500 74 500 160 500 ns clock high pulse width t ch 35 ? 25 ? 50 ? ns clock low pulse width t cl 35 ? 25 ? 50 ? ns clock rise time t cr ? 15 ? 10 ? 25 ns clock fall time t cf ? 15 ? 10 ? 25 ns figure 26.7 oscillation stabilization time at reset (crystal) t osc1 20 ? 20 ? 40 ? ms figure 26.8 oscillation stabilization time in software standby (crystal) t osc2 8 ? 8 ? 16 ? ms figure 23.3
rev. 2.00, 05/03, page 803 of 846 condition a condition b condition c item symbol min max min max min max unit test conditions external clock output stabilization delay time t dext 500 ? 500 ? 1000 ? s figure 26.8 subclock oscillation stabilization time t osc3 ? 2 ? 2 ? 3s subclock oscillator frequency f sub 32.768 32.768 32.768 32.768 32.768 32.768 khz subclock ( sub ) cycle time t sub 30.5 30.5 30.5 30.5 30.5 30.5 s
rev. 2.00, 05/03, page 804 of 846 (2) control signal timing table 26.42 lists the control signal timing. table 26.42 control signal timing condition a (ztat version): v cc = 2.7 v to 3.6 v, av cc = 2.7 v to 3.6 v, v ref = 2.7 v to av cc , v ss = av ss = 0 v, = 32.768 khz, 2 to 10 mhz, t a = C20 c to +75 c (regular specifications) t a = C40 c to +85 c (wide-range specifications) condition b (f-ztat version, masked rom version): v cc = 2.7 v to 3.6 v, av cc = 2.7 v to 3.6 v, v ref = 2.7 v to av cc , v ss = av ss = 0 v, = 32.768 khz, 2 to 13.5mhz, t a = C20 c to +75 c (regular specifications) t a = C40 c to +85 c (wide-range specifications) condition c (masked rom version): v cc = 2.2 v to 3.6 v, av cc = 2.2 v to 3.6 v, v ref = 2.2 v to av cc , v ss = av ss = 0 v, = 32.768 khz, 2 to 6.25 mhz t a = C20 c to +75 c (regular specifications), t a = C40 c to +85 c (wide-range specifications) condition a condition b condition c item symbol min max min max min max unit test conditions res setup time t ress 250 ? 250 ? 350 ? ns figure 26.9 res pulse width t resw 20 ? 20 ? 20 ? t cyc mres setup time t mress 250 ? 250 ? 350 ? ns mres pulse width t mresw 20 ? 20 ? 20 ? t cyc nmi setup time t nmis 250 ? 250 ? 350 ? ns figure 26.10 nmi hold time t nmih 10 ? 10 ? 10 ? ns nmi pulse width (exiting software standby mode) t nmiw 200 ? 200 ? 300 ? ns irq setup time t irqs 250 ? 250 ? 350 ? ns irq hold time t irqh 10 ? 10 ? 10 ? ns irq pulse width (exiting software standby mode) t irqw 200 ? 200 ? 300 ? ns
rev. 2.00, 05/03, page 805 of 846 (3) bus timing table 26.43 lists the bus timing. table 26.43 bus timing condition a (ztat version): v cc = 2.7 v to 3.6 v, av cc = 2.7 v to 3.6 v, v ref = 2.7 v to av cc , v ss = av ss = 0 v, = 2 to 10 mhz, t a = C20 c to +75 c (regular specifications) t a = C40 c to +85 c (wide-range specifications) condition b (f-ztat version, masked rom version): v cc = 2.7 v to 3.6 v, av cc = 2.7 v to 3.6 v, v ref = 2.7 v to av cc , v ss = av ss = 0 v, = 2 to 13.5mhz, t a = C20 c to +75 c (regular specifications) t a = C40 c to +85 c (wide-range specifications) condition c (masked rom version): v cc = 2.2 v to 3.6 v, av cc = 2.2 v to 3.6 v, v ref = 2.2 v to av cc , v ss = av ss = 0 v, = 2 to 6.25 mhz t a = C20 c to +75 c (regular specifications), t a = C40 c to +85 c (wide-range specifications) condition a condition b condition c item symbol min max min max min max unit test conditions address delay time t ad ? 60 ? 50 ? 90 ns address setup time t as 0.5 t cyc ? 40 ? 0.5 t cyc ? 30 ? 0.5 t cyc ? 60 ? ns figures 26.11 to 26.15 address hold time t ah 0.5 t cyc ? 20 ? 0.5 t cyc ? 15 ? 0.5 t cyc ? 30 ? ns cs delay time t csd ? 60 ? 50 ? 90 ns as delay time t asd ? 60 ? 50 ? 90 ns rd delay time 1 t rsd1 ? 60 ? 50 ? 90 ns rd delay time 2 t rsd2 ? 60 ? 50 ? 90 ns read data setup time t rds 30 ? 30 ? 50 ? ns read data hold time t rdh 0 ? 0 ? 0 ? ns read data access time 1 t acc1 ? 1.0 t cyc ? 65 ? 1.0 t cyc ? 65 ? 1.0 t cyc ? 90 ns
rev. 2.00, 05/03, page 806 of 846 condition a condition b condition c item symbol min max min max min max unit test conditions read data access time 2 t acc2 ? 1.5 t cyc ? 65 ? 1.5 t cyc ? 65 ? 1.5 t cyc ? 90 ns read data access time 3 t acc3 ? 2.0 t cyc ? 65 ? 2.0 t cyc ? 65 ? 2.0 t cyc ? 90 ns read data access time 4 t acc4 ? 2.5 t cyc ? 65 ? 2.5 t cyc ? 65 ? 2.5 t cyc ? 90 ns figures 26.11 to 26.15 read data access time 5 t acc5 ? 3.0 t cyc ? 65 ? 3.0 t cyc ? 65 ? 3.0 t cyc ? 90 ns wr delay time 1 t wrd1 ? 60 ? 50 ? 90 ns wr delay time 2 t wrd2 ? 60 ? 50 ? 90 ns wr pulse width 1 t wsw1 1.0 t cyc ? 40 ? 1.0 t cyc ? 30 ? 1.0 t cyc ? 60 ? ns wr pulse width 2 t wsw2 1.5 t cyc ? 40 ? 1.5 t cyc ? 30 ? 1.5 t cyc ? 60 ? ns write data delay time t wdd ? 80 ? 70 ? 100 ns write data setup time t wds 0.5 t cyc ? 50 ? 0.5 t cyc ? 37 ? 0.5 t cyc ? 80 ? ns write data hold time t wdh 0.5 t cyc ? 30 ? 0.5 t cyc ? 15 ? 0.5 t cyc ? 60 ? ns wait setup time t wts 60 ? 50 ? 90 ? ns figure 26.13 wait hold time t wth 10 ? 10 ? 10 ? ns breq setup time t brqs 60 ? 50 ? 90 ? ns back delay time t bacd ? 60 ? 50 ? 90 ns bus-floating time t bzd ? 100 ? 80 ? 160 ns figure 26.16
rev. 2.00, 05/03, page 807 of 846 (4) timing of on-chip peripheral modules table 26.44 lists the timing of on-chip peripheral modules. table 26.44 timing of on-chip peripheral modules condition a (ztat version): v cc = 2.7 v to 3.6 v, av cc = 2.7 v to 3.6 v, v ref = 2.7 v to av cc , v ss = av ss = 0 v, = 32.768 khz, 2 to 10 mhz, t a = C20 c to +75 c (regular specifications) t a = C40 c to +85 c (wide-range specifications) condition b (f-ztat version, masked rom version): v cc = 2.7 v to 3.6 v, av cc = 2.7 v to 3.6 v, v ref = 2.7 v to av cc , v ss = av ss = 0 v, = 32.768 khz, 2 to 13.5mhz, t a = C20 c to +75 c (regular specifications) t a = C40 c to +85 c (wide-range specifications) condition c (masked rom version): v cc = 2.2 v to 3.6 v, av cc = 2.2 v to 3.6 v, v ref = 2.2 v to av cc , v ss = av ss = 0 v, = 32.768 khz, 2 to 6.25 mhz t a = C20 c to +75 c (regular specifications), t a = C40 c to +85 c (wide-range specifications) condition a condition b condition c item symbol min max min max min max unit test conditions i/o port output data delay time t pwd ? 100 ? 100 ? 150 ns figure 26.21 input data setup time t prs 50 ? 50 ? 80 ? input data hold time t prh 50 ? 50 ? 80 ? tpu timer output delay time t tocd ? 100 ? 100 ? 150 ns figure 26.22 timer input setup time t tics 50 ? 40 ? 60 ? timer clock input setup time t tcks 50 ? 40 ? 60 ? ns figure 26.23 timer clock single edge t tckwh 1.5 ? 1.5 ? 1.5 ? t cyc pulse width both edges t tckwl 2.5 ? 2.5 ? 2.5 ?
rev. 2.00, 05/03, page 808 of 846 condition a condition b condition c item symbol min max min max min max unit test conditions tmr timer output delay time t tmod ? 100 ? 100 ? 150 ns figure 26.24 timer reset input setup time t tmrs 50 ? 50 ? 80 ? ns figure 26.26 timer clock input setup time t tmcs 50 ? 50 ? 80 ? ns figure 26.25 timer clock single edge t tmcwh 1.5 ? 1.5 ? 1.5 ? t cyc pulse width both edges t tmcwl 2.5 ? 2.5 ? 2.5 ? wdt_1 buzz output delay time t buzd ? 100 ? 100 ? 150 ns figure 26.27 sci * input clock asynchr onous t scyc 4 ? 4 ? 4 ? t cyc figure 26.28 cycle synchro nous 6 ? 6 ? 6 ? input clock pulse width t sckw 0.4 0.6 0.4 0.6 0.4 0.6 t scyc input clock rise time t sckr ? 1.5 ? 1.5 ? 1.5 t cyc input clock fall time t sckf ? 1.5 ? 1.5 ? 1.5 transmit data delay time t txd ? 100 ? 100 ? 150 ns figure 26.29 receive data setup time (synchronous) t rxs 100 ? 75 ? 150 ? ns receive data hold time (synchronous) t rxh 100 ? 75 ? 150 ? ns a/d converter trigger input setup time t trgs 50 ? 40 ? 60 ? ns figure 26.30
rev. 2.00, 05/03, page 809 of 846 26.5.4 a/d conversion characteristics table 26.45 lists the a/d conversion characteristics. table 26.45 a/d conversion characteristics condition a (ztat version): v cc = 2.7 v to 3.6 v, av cc = 2.7 v to 3.6 v, v ref = 2.7 v to av cc , v ss = av ss = 0 v, = 2 to 10 mhz, t a = C20 c to +75 c (regular specifications) t a = C40 c to +85 c (wide-range specifications) condition b (f-ztat version, masked rom version): v cc = 2.7 v to 3.6 v, av cc = 2.7 v to 3.6 v, v ref = 2.7 v to av cc , v ss = av ss = 0 v, = 2 to 13.5mhz, t a = C20 c to +75 c (regular specifications) t a = C40 c to +85 c (wide-range specifications) condition c (masked rom version): v cc = 2.2 v to 3.6 v, av cc = 2.2 v to 3.6 v, v ref = 2.2 v to av cc , v ss = av ss = 0 v, = 2 to 6.25 mhz t a = C20 c to +75 c (regular specifications), t a = C40 c to +85 c (wide-range specifications) condition a condition b condition c item min typ max min typ max min typ max unit resolution 10 10 10 10 10 10 10 10 10 bits conversion time 13.1 ?? 9.6 ?? 20.9 ?? s analog input capacitance ?? 20 ?? 20 ?? 20 pf permissible signal-source impedance ?? 5 ?? 5 ?? 5k ? nonlinearity error ?? 6.0 ?? 6.0 ?? 6.0 lsb offset error ?? 4.0 ?? 4.0 ?? 4.0 lsb full-scale error ?? 4.0 ?? 4.0 ?? 4.0 lsb quantization error ?? 0.5 ?? 0.5 ?? 0.5 lsb absolute accuracy ?? 8.0 ?? 8.0 ?? 8.0 lsb
rev. 2.00, 05/03, page 810 of 846 26.5.5 d/a conversion characteristics table 26.46 lists the d/a conversion characteristics. table 26.46 d/a conversion characteristics condition a (ztat version): v cc = 2.7 v to 3.6 v, av cc = 2.7 v to 3.6 v, v ref = 2.7 v to av cc , v ss = av ss = 0 v, = 2 to 10 mhz, t a = C20 c to +75 c (regular specifications) t a = C40 c to +85 c (wide-range specifications) condition b (masked rom version): v cc = 2.7 v to 3.6 v, av cc = 2.7 v to 3.6 v, v ref = 2.7 v to av cc , v ss = av ss = 0 v, = 2 to 13.5mhz, t a = C20 c to +75 c (regular specifications) condition c (masked rom version): v cc = 2.2 v to 3.6 v, av cc = 2.2 v to 3.6 v, v ref = 2.2 v to av cc , v ss = av ss = 0 v, = 2 to 6.25 mhz t a = C20 c to +75 c (regular specifications), t a = C40 c to +85 c (wide-range specifications) condition a condition b condition c item min typ max min typ max min typ max unit test condition resolution888888888bits conversion time ?? 10 ?? 10 ?? 10 s load capacitance = 20 pf ? 2.0 3.0 ? 2.0 3.0 ? 3.0 4.0 lsb load resistance = 2 m ? absolute accuracy ?? 2.0 ?? 2.0 ?? 3.0 lsb load resistance = 4 m ?
rev. 2.00, 05/03, page 811 of 846 26.5.6 flash memory characteristics table 26.47 lists the flash memory characteristics. table 26.47 flash memory characteristics conditions: v cc = 2.7 v to 3.6 v, av cc = 2.7 v to 3.6 v, v ref = 2.7 v to av cc , v ss = av ss = 0 v, v cc = 3.0 v to 3.6 v (programming/erasing operating voltage range) t a = C20 c to +50 c (programming/erasing operating temperature range; regular specifications) item symbol min typ max unit test conditions programming time * 1 * 2 * 4 t p ? 10 200 ms/128 bytes erase time * 1 * 3 * 5 t e ? 100 1200 ms/block reprogramming count n wec * 6 100 10000 * 7 ? times data holding time t drp 10 ?? year programming wait time after swe1 bit setting * 1 t sswe 11 ? s wait time after psu1 bit setting * 1 t spsu 50 50 ? s wait time after p1 bit setting * 1 * 4 t sp10 8 1012s t sp30 28 30 32 s 1 n 6 t sp200 198 200 202 s 7 n 1000 wait time after p1 bit clear * 1 t cp 55 ? s wait time after psu1 bit clear * 1 t cpsu 55 ? s wait time after pv1 bit setting * 1 t spv 44 ? s wait time after h'ff dummy write * 1 t spvr 22 ? s wait time after pv1 bit clear * 1 t cpv 22 ? s wait time after swe1 bit clear t cswe 100 100 ? s maximum programming count * 1 * 4 n1 ?? 6 * 4 times n2 ?? 994 * 4
rev. 2.00, 05/03, page 812 of 846 item symbol min typ max unit test conditions erase wait time after swe1 bit setting * 1 t sswe 11 ? s wait time after esu1 bit setting * 1 t sesu 100 100 ? s wait time after e1 bit setting * 1 * 5 t se 10 10 100 ms wait time after e1 bit clear * 1 t ce 10 10 ? s wait time after esu1 bit clear * 1 t cesu 10 10 ? s wait time after ev1 bit setting * 1 t sev 20 20 ? s wait time after h'ff dummy write * 1 t sevr 22 ? s wait time after ev1 bit clear * 1 t cev 44 ? s wait time after swe1 bit clear t cswe 100 100 ? s maximum erase count * 1 * 5 n ?? 100 times notes: * 1 make each time setting in accordance with the program/program-verify flowchart or erase/erase-verify flowchart. * 2 programming time per 128 bytes (shows the total period for which the p1 bit in the flash memory control register 1 (flmcr1) is set. it does not include the program verification time.) * 3 block erase time (shows the total period for which the e1 bit in flmcr1 is set. it does not include the erase verification time.) * 4 maximum programming time value t p (max) = wait time after p1 bit setting (t sp ) maximum program count (n) (t sp30 + t sp10 ) 6 + (t sp200 ) 994 * 5 relationship among the maximum erase time (t e (max)), the wait time after e1 bit setting (t se ), and the maximum erase count (n) is shown below. t e (max) = wait time after e1 bit setting (t se ) maximum erase count (n) * 6 the guaranteed value of reprogramming is less than minimum count. * 7 typical value at 25 c
rev. 2.00, 05/03, page 813 of 846 26.6 operating timing 26.6.1 clock timing the clock timing is shown below. t cr t cl t cf t ch t cyc figure 26.7 system clock timing t osc1 t osc1 extal v cc stby res t dext t dext figure 26.8 oscillation stabilization timing
rev. 2.00, 05/03, page 814 of 846 26.6.2 control signal timing the control signal timing is shown below. t resw t ress t mress t mress t mresw t ress res mres figure 26.9 reset input timing t irqs irq edge input t irqh t nmis t nmih t irqs irq level input nmi irq t nmiw t irqw figure 26.10 interrupt input timing
rev. 2.00, 05/03, page 815 of 846 26.6.3 bus timing figures 26.11 to 26.16 show the bus timing. t rsd2 t as t ah t csd t acc2 t rsd1 t asd t asd t ad t acc3 t wrd2 t wrd2 t wsw1 t wdd t wdh t 1 t 2 t rds t ah t as t as t rdh as a23 to a0 rd (read) cs7 to cs0 d15 to d0 (read) hwr , lwr (write) d15 to d0 (write) figure 26.11 basic bus timing (two-state access)
rev. 2.00, 05/03, page 816 of 846 t rsd2 t as t ah t csd t acc4 t rsd1 t asd t asd t ad t acc5 t wrd2 t wrd1 t wsw2 t wdd t wdh t 1 t 3 t wds t 2 t rds t as t ah t rdh as a23 to a0 rd (read) cs7 to cs0 d15 to d0 (read) hwr , lwr (write) d15 to d0 (write) figure 26.12 basic bus timing (three-state access)
rev. 2.00, 05/03, page 817 of 846 t wth t 1 t 2 wait t w t 3 t wts t wth t wts as a23 to a0 rd (read) cs7 to cs0 d15 to d0 (read) hwr , lwr (write) d15 to d0 (write) figure 26.13 basic bus timing (three-state access with one wait state)
rev. 2.00, 05/03, page 818 of 846 t rsd2 t as t ah t asd t asd t ad t acc3 t rds t rdh t 1 t 2 t 2 or t 3 t 1 cs0 as a23 to a0 rd (read) d15 to d0 (read) figure 26.14 burst rom access timing (two-state access)
rev. 2.00, 05/03, page 819 of 846 t ad t acc1 t rds t rdh t 1 t 2 or t 3 t 1 t rsd2 cs0 as a23 to a0 rd (read) d15 to d0 (read) figure 26.15 burst rom access timing (one-state access) breq back t bacd t bzd a23 to a0, cs7 to cs0 , as , rd , hwr , lwr t bacd t bzd t brqs t brqs figure 26.16 external bus release timing
rev. 2.00, 05/03, page 820 of 846 t dacd1 t 1 t 2 dack0 , dack1 t dacd2 as a23 to a0 rd (read) cs7 to cs0 d15 to d0 (read) hwr , lwr (write) d15 to d0 (write) figure 26.17 dmac single address transfer timing (two-state access)
rev. 2.00, 05/03, page 821 of 846 t dacd1 t 1 t 2 t dacd2 t 3 dack0 , dack1 as a23 to a0 rd (read) cs7 to cs0 d15 to d0 (read) hwr , lwr (write) d15 to d0 (write) figure 26.18 dmac single address transfer timing (three-state access) t ted t 2 or t 3 t 1 tend0 , tend1 t ted figure 26.19 dmac tend tend tend tend output timing
rev. 2.00, 05/03, page 822 of 846 t drqh t drqs dreq0 , dreq1 figure 26.20 dmac dreq dreq dreq dreq input timing 26.6.4 timing of on-chip peripheral modules figures 26.21 to 26.31 show the timing of on-chip peripheral modules. t prs t 1 t 2 t pwd t prh ports 1, 3, 4, 7, 9, a to g (read) ports 1, 3, 7, a to g (write) figure 26.21 i/o port input/output timing t tics t tocd output compare output * input capture input * note: * tioca0 to tioca5, tiocb0 to tiocb5, tiocc0, tiocc3, tiocd0, tiocd3 tioca3 to tioca5, tiocb3 to tiocb5, tiocc3 and tiocd3 are not available in the h8s/2227 group. figure 26.22 tpu input/output timing
rev. 2.00, 05/03, page 823 of 846 t tcks t tcks tclka to tclkd t tckwh t tckwl figure 26.23 tpu clock input timing t tmod tmo0 to tmo3 * note: * tmo0 and tmo1 for the h8s/2237 group and h8s/2227 group. figure 26.24 8-bit timer output timing t tmcs t tmcs tmci01, tmci23 * t tmcwh t tmcwl note: * not available in the h8s/2237 group and h8s/2227 group. figure 26.25 8-bit timer clock input timing t tmrs tmci01, tmci23 * note: * not available in the h8s/2237 group and h8s/2227 group figure 26.26 8-bit timer reset input timing
rev. 2.00, 05/03, page 824 of 846 t buzd buzz t buzd figure 26.27 wdt_1 output timing t scyc t sckr t sckw sck0 to sck3 * t sckf note: * sck2 is not aveilable in the h8s/2227 group. figure 26.28 sck clock input timing sck0 to sck3 * txd0 to txd3 * (transmit data) rxd0 to rxd3 * (receive data) t txd t rxh t rxs note: * sck2, txd2, and rxd2 are not available in the h8s/2227 group. figure 26.29 sci input/output timing (clocked synchronous mode) t trgs adtrg figure 26.30 a/d converter external trigger input timing
rev. 2.00, 05/03, page 825 of 846 t buf t stah t stas t sp t stos t sclh t scll t sf t sr t scl t sdah t sdas p * s * s r * v ih v il sda0 to sda1 scl0 to scl1 legend: * s, p, and sr indicate the coditions listed below. : start condition : stop condition : retransmitting (start) condition s p sr figure 26.31 i 2 c bus interface input/output timing (optional) 26.7 usage note though the f-ztat version and the masked rom version satisfy electrical characteristics described in this manual, the actual value of electrical characteristics, operating margin, and noise margin may differ due to the differences of production process, on-chip rom, and layout patterning. when the system has been evaluated with the f-ztat version, the equivalent evaluation should be implemented to the masked rom version when shifted to the masked rom version.
rev. 2.00, 05/03, page 826 of 846
rev. 2.00, 05/03, page 827 of 846 appendix a i/o port states in each pin state a.1 i/o port state in each pin state port name pin name mcu operating mode power-on reset manual reset hardware standby mode software standby mode, watch mode bus mastership release state program execution state, sleep mode, subsleep mode p17 to p14 4 to 7 t keep t keep keep i/o port p13/tiocd0/ tclkb/a23 p12/tiocc0/ tclka/a22 p11/tiocb0/ a21 7 t keep t keep keep i/o port when the address output is selected by the aen bit 4 to 6 t keep t [ope = 0] t [ope = 1] keep t address output when a port is selected 4 to 6 t keep t keep keep i/o port p10/tioca0/ dack0 * 3 /a20 7 t keep t keep keep i/o port 4, 5 l when the address output is selected by the aen bit 6t keep t [ope = 0] t [ope = 1] keep t address output when a port is selected 4 to 6 t * 1 keep t keep keep i/o port
rev. 2.00, 05/03, page 828 of 846 port name pin name mcu operating mode power-on reset manual reset hardware standby mode software standby mode, watch mode bus mastership release state program execution state, sleep mode, subsleep mode port 3 4 to 7 t keep t keep keep i/o port port 4 4 to 7 t t t t t input port p77 to p74 4 to 7 t keep t keep keep i/o port 7 t keep t keep keep i/o port p73/tmo1/ tend1 * 3 / cs7 p72/tmo0/ tend0 * 3 / cs6 p71/tmri23 * 2 / tmci23 * 2 / dreq1 * 3 / cs5 p70/tmri01/ tmci01/ dreq0 * 3 / cs4 4 to 6 t keep t [ddr ? ope = 0] t [ddr ? ope = 1] h t [ddr = 0] input port [ddr = 1] cs7 to cs4 p97/da1 * 4 p96/da0 * 4 4 to 7 t t t [daoen = 1] keep [daoen = 0] t keep input port 7 t keep t keep keep i/o port 4, 5 l when the address output is selected by the aen bit 6t keep t [ope = 0] t [ope = 1] keep t address output port a when a port is selected 4 to 6 t * 1 keep t keep keep i/o port
rev. 2.00, 05/03, page 829 of 846 port name pin name mcu operating mode power-on reset manual reset hardware standby mode software standby mode, watch mode bus mastership release state program execution state, sleep mode, subsleep mode 7 t keep t keep keep i/o port 4, 5 l when the address output is selected by the aen bit 6t keep t [ope = 0] t [ope = 1] keep t address output port b when a port is selected 4 to 6 t * 1 keep t keep keep i/o port 4, 5 l keep t [ope = 0] t [ope = 1] keep t address output 6 t keep t [ddr ? ope = 0] t [ddr ? ope = 1] keep t [ddr = 0] input port [ddr = 1] address output port c 7 t keep t keep keep i/o port 4 to 6 t t t t t data bus port d 7 t keep t keep keep i/o port 8-bit bus 4 to 6 t keep t keep keep i/o port 4 to 6 t t t t t data bus port e 16-bit bus 7 t keep t keep keep i/o port
rev. 2.00, 05/03, page 830 of 846 port name pin name mcu operating mode power-on reset manual reset hardware standby mode software standby mode, watch mode bus mastership release state program execution state, sleep mode, subsleep mode 4 to 6 clock output [ddr = 0] input port [ddr = 1] clock output t [ddr = 0] input port [ddr = 1] h [ddr = 0] input port [ddr = 1] clock output [ddr = 0] input port [ddr = 1] clock output pf7/ 7 t keep t [ddr = 0] input port [ddr = 1] h [ddr = 0] input port [ddr = 1] clock output [ddr = 0] input port [ddr = 1] clock output 4 to 6 h h t [ope= 0] t [ope= 1] h t as , rd , hwr pf6/ as pf5/ rd pf4/ hwr 7 t keep t keep keep i/o port pf3/ lwr / adtrg / irq3 7 t keep t keep keep i/o port 8-bit bus 4 to 6 keep t keep keep i/o port 16-bit bus 4 to 6 (mode 4) h (mode 5, 6) t h t [ope = 0] t [ope = 1] h t lwr 4 to 6 t keep t [waite = 0] keep [waite = 1] t [waite= 0] keep [waite= 1] t [waite= 0] i/o port [waite= 1] wait pf2/ wait 7 t keep t keep keep i/o port 4 to 6 t keep t [brle = 0] keep [brle = 1] h l [brle = 0] i/o port [brle = 1] back pf1/ back / buzz 7 t keep t keep keep i/o port
rev. 2.00, 05/03, page 831 of 846 port name pin name mcu operating mode power-on reset manual reset hardware standby mode software standby mode, watch mode bus mastership release state program execution state, sleep mode, subsleep mode 4 to 6 t keep t [brle = 0] keep [brle = 1] t t [brle = 0] i/o port [brle = 1] breq pf0/ breq / irq2 7 t keep t keep keep i/o port 4, 5 h 6t keep t [ddr ? ope = 0] t [ddr ? ope = 1] h t [ddr = 0] i/o port [ddr = 1] cs0 (h in sleep mode and subsleep mode.) pg4/ cs0 7 t keep t keep keep i/o port 4 to 6 t keep t [ddr ? ope = 0] t [ddr ? ope = 1] h t [ddr = 0] input port [ddr = 1] cs1 to cs3 pg3/ cs1 pg2/ cs2 pg1/ cs3 / irq7 7 t keep t keep keep i/o port pg0/ irq6 4 to 7 t keep t keep keep i/o port legend h: high level l: low level t: high-impedance keep: the input port becomes high-impedance, and the output port retains its state ddr: data direction register ope: output port enable waite: wait input enable brle: bus release enable notes: * 1 the port state is l (address input) in modes 4 and 5. * 2 supported only by the h8s/2239 group and h8s/2238r group. * 3 supported only by the h8s/2239 group. * 4 not available in the h8s/2227 group.
rev. 2.00, 05/03, page 832 of 846 appendix b product codes table b.1 product codes of h8s/2239 group product type product code mark code package (package code) h8s/2239 hd6432239( *** )te 100-pin tqfp (tfp-100b) hd6432239( *** )tf 100-pin tqfp (tfp-100g) standard product hd6432239 hd6432239( *** )fa 100-pin qfp (fp-100b) hd6432239w hd6432239w( *** )te 100-pin tqfp (tfp-100b) hd6432239w( *** )tf 100-pin tqfp (tfp-100g) masked- rom version on-chip i 2 c bus interface product hd6432239w( *** )fa 100-pin qfp (fp-100b) hd64f2239 hd64f2239te20 100-pin tqfp (tfp-100b) hd64f2239tf20 100-pin tqfp (tfp-100g) f-ztat version standard product hd64f2239fa20 100-pin qfp (fp-100b) hd64f2239te16 100-pin tqfp (tfp-100b) hd64f2239tf16 100-pin tqfp (tfp-100g) hd64f2239fa16 100-pin qfp (fp-100b) legend ( *** ): rom code note: a standard product of f-ztat version includes an i 2 c bus interface. some products above are in the developing or planning stage. please contact renesas technology agency to confirm the current status of each product.
rev. 2.00, 05/03, page 833 of 846 table b.2 product codes of h8s/2238r group product type product code mark code package (package code) h8s/2238 5-v version hd64f2238b hd64f2238bte13 100-pin tqfp (tfp-100b) hd64f2238btf13 100-pin tqfp (tfp-100g) flash memory version hd64f2238bf13 100-pin qfp (fp-100a) hd64f2238bfa13 100-pin qfp (fp-100b) 3-v version hd64f2238r hd64f2238rte13 100-pin tqfp (tfp-100b) hd64f2238rtf13 100-pin tqfp (tfp-100g) hd64f2238rfa13 100-pin qfp (fp-100b) hd64f2238rbr13 112-pin tfbga (bp-112) 2.2-v version hd64f2238r hd64f2238rte6 100-pin tqfp (tfp-100b) hd64f2238rtf6 100-pin tqfp (tfp-100g) hd64f2238rfa6 100-pin qfp (fp-100b) hd64f2238rbr6 112-pin tfbga (bp-112) 5-v version hd6432238b hd6432238b( *** )te 100-pin tqfp (tfp-100b) hd6432238b( *** )tf 100-pin tqfp (tfp-100g) masked rom version hd6432238b( *** )f 100-pin qfp (fp-100a) hd6432238b( *** )fa 100-pin qfp (fp-100b) hd6432238r hd6432238r( *** )te 100-pin tqfp (tfp-100b) 3-v version, 2.2-v version hd6432238r( *** )tf 100-pin tqfp (tfp-100g) hd6432238r( *** )fa 100-pin qfp (fp-100b) hd6432238bw hd6432238bw( *** )te 100-pin tqfp (tfp-100b) hd6432238bw( *** )tf 100-pin tqfp (tfp-100g) on-chip i 2 c bus interface product (5-v version) hd6432238bw( *** )f 100-pin qfp (fp-100a) hd6432238bw( *** )fa 100-pin qfp (fp-100b) hd6432238rw hd6432238rw( *** )te 100-pin tqfp (tfp-100b) hd6432238rw( *** )tf 100-pin tqfp (tfp-100g) on-chip i 2 c bus interface product (3-v version, 2.2-v version) hd6432238rw( *** )fa 100-pin qfp (fp-100b)
rev. 2.00, 05/03, page 834 of 846 product type product code mark code package (package code) h8s/2236 5-v version hd6432236b hd6432236b( *** )te 100-pin tqfp (tfp-100b) hd6432236b( *** )tf 100-pin tqfp (tfp-100g) masked rom version hd6432236b( *** )f 100-pin qfp (fp-100a) hd6432236b( *** )fa 100-pin qfp (fp-100b) hd6432236r hd6432236r( *** )te 100-pin tqfp (tfp-100b) 3-v version, 2.2-v version hd6432236r( *** )tf 100-pin tqfp (tfp-100g) hd6432236r( *** )fa 100-pin qfp (fp-100b) hd6432236bw hd6432236bw( *** )te 100-pin tqfp (tfp-100b) hd6432236bw( *** )tf 100-pin tqfp (tfp-100g) on-chip i 2 c bus interface product (5-v version) hd6432236bw( *** )f 100-pin qfp (fp-100a) hd6432236bw( *** )fa 100-pin qfp (fp-100b) hd6432236rw hd6432236rw( *** )te 100-pin tqfp (tfp-100b) hd6432236rw( *** )tf 100-pin tqfp (tfp-100g) on-chip i 2 c bus interface product (3-v version) hd6432236rw( *** )fa 100-pin qfp (fp-100b) legend ( *** ): rom code note: some products above are in the developing or planning stage. please contact renesas technology agency to confirm the current status of each product.
rev. 2.00, 05/03, page 835 of 846 table b.3 product codes of h8s/2237 group and h8s/2227 group product type product code mark code package (package code) h8s/2237 flash memory version hd6472237 hd6472237te10 100-pin tqfp (tfp-100b) hd6472237tf10 100-pin tqfp (tfp-100g) hd6472237f10 100-pin qfp (fp-100a) hd6472237fa10 100-pin qfp (fp-100b) masked rom version hd6432237 hd6432237( *** )te 100-pin tqfp (tfp-100b) hd6432237( *** )tf 100-pin tqfp (tfp-100g) hd6432237( *** )f 100-pin qfp (fp-100a) hd6432237( *** )fa 100-pin qfp (fp-100b) h8s/2235 masked rom version hd6432235 hd6432235( *** )te 100-pin tqfp (tfp-100b) hd6432235( *** )tf 100-pin tqfp (tfp-100g) hd6432235( *** )f 100-pin qfp (fp-100a) hd6432235( *** )fa 100-pin qfp (fp-100b) h8s/2233 masked rom version hd6432233 hd6432233( *** )te 100-pin tqfp (tfp-100b) hd6432233( *** )tf 100-pin tqfp (tfp-100g) hd6432233( *** )f 100-pin qfp (fp-100a) hd6432233( *** )fa 100-pin qfp (fp-100b) h8s/2227 flash memory version hd6472227 hd64f2227te13 100-pin tqfp (tfp-100b) hd64f2227tf13 100-pin tqfp (tfp-100g) masked rom version hd6432227 hd6432227( *** )te 100-pin tqfp (tfp-100b) hd6432227( *** )tf 100-pin tqfp (tfp-100g) hd6432227( *** )f 100-pin qfp (fp-100a) hd6432227( *** )fa 100-pin qfp (fp-100b) h8s/2225 * masked rom version hd6432225 hd6432225( *** )te 100-pin tqfp (tfp-100b) hd6432225( *** )tf 100-pin tqfp (tfp-100g) hd6432225( *** )fa 100-pin qfp (fp-100b) h8s/2224 * masked rom version hd6432224 hd6432224( *** )te 100-pin tqfp (tfp-100b) hd6432224( *** )tf 100-pin tqfp (tfp-100g) hd6432224( *** )fa 100-pin qfp (fp-100b) h8s/2223 * masked rom version hd6432223 hd6432223( *** )te 100-pin tqfp (tfp-100b) hd6432223( *** )tf 100-pin tqfp (tfp-100g) hd6432223( *** )fa 100-pin qfp (fp-100b) legend ( *** ): rom code note: * the 100-pin qfp (fp-100a) is not available for the hd6432225, hd6432224, and hd6432223. when the 100-pin qfp (fp-100a) is necessary, choose hd6432235( *** )tf, hd6432233( *** )f, or hd6432227( *** )f.
rev. 2.00, 05/03, page 836 of 846 appendix c package dimensions package code jedec jeita mass (reference value) tfp-100b ? conforms 0.5 g * dimension including the plating thickness base material dimension 16.0 0.2 14 0.08 0.10 0.5 0.1 16.0 0.2 0.5 0.10 0.10 1.20 max * 0.17 0.05 0 ? 8 75 51 125 76 100 26 50 m * 0.22 0.05 1.0 1.00 1.0 0.20 0.04 0.15 0.04 unit: mm figure c.1 tfp-100b package dimensions
rev. 2.00, 05/03, page 837 of 846 package code jedec jeita mass (reference value) tfp-100g ? conforms 0.4 g * dimension including the plating thickness base material dimension 14.0 0.2 12 0.07 0.10 0.5 0.1 14.0 0.2 0.4 1.20 max * 0.17 0.05 0 ? 8 75 51 125 76 100 26 50 m * 0.18 0.05 1.0 1.2 0.16 0.04 0.15 0.04 1.00 0.10 0.10 figure c.2 tfp-100g package dimensions
rev. 2.00, 05/03, page 838 of 846 package code jedec eiaj mass (reference value) fp-100a ? ? 1.7 g unit: mm * dimension including the plating thickness base material dimension 0.13 m 0 ? 10 0.32 0.08 * 0.17 0.05 3.10 max 1.2 0.2 24.8 0.4 20 80 51 50 31 30 1 100 81 18.8 0.4 14 0.15 0.65 2.70 2.4 0.20 + 0.10 ? 0.20 0.58 0.83 0.30 0.06 0.15 0.04 figure c.3 fp-100a package dimensions
rev. 2.00, 05/03, page 839 of 846 package code jedec eiaj weight (reference value) fp-100b ? conforms 1.2 g unit: mm * dimension including the plating thickness base material dimension 0.10 16.0 0.3 1.0 0.5 0.2 16.0 0.3 3.05 max 75 51 50 26 1 25 76 100 14 0 ? 8 0.5 0.08 m * 0.22 0.05 2.70 * 0.17 0.05 0.12 + 0.13 ? 0.12 1.0 0.20 0.04 0.15 0.04 figure c.4 fp-100b package dimensions
rev. 2.00, 05/03, page 840 of 846 preliminary 10.00 0.40 0.05 0.2 0.10 10.00 c c 1.40 max 0.20 c a 0.20 c b 0.80 0.80 1.00 1.00 b c 0.15 a b c d e f g h j k l 1110987654321 a 112 0.50 0.05 c 0.08 ab m 4 package code jedec jeita mass (reference value) bp-112 ? ? 0.3 g figure c.5 bp-112 package dimensions
rev. 2.00, 05/03, page 841 of 846 index 16-bit access space ................................................... 158 16-bit count mode ........................................................ 430 16-bit timer pulse unit................................................. 335 8-bit access space ..................................................... 158 8-bit timers................................................................... 415 a/d conversion time.................................................... 588 a/d converter ............................................................... 579 a/d converter activation .............................................. 399 absolute address............................................................ 76 abwcr................................................. 144, 699, 709, 720 activation by auto-request .......................................... 210 activation by external request..................................... 210 activation by software .................................................. 279 adcr .................................................... 585, 703, 715, 723 adcsr ................................................. 583, 703, 715, 723 addr .................................................... 582, 703, 715, 723 address space................................................................ 54 addressing modes .......................................................... 74 adi ................................................................................ 590 advanced mode .............................................................. 51 analog input channel ................................................... 582 arithmetic operations instructions.................................. 66 astcr.................................................. 144, 699, 709, 720 asynchronous mode ..................................................... 487 bara .................................................... 134, 697, 706, 717 barb .................................................... 135, 697, 706, 717 basic bus interface....................................................... 158 bcc .................................................................................. 71 bcra .................................................... 135, 697, 706, 717 bcrb .................................................... 136, 697, 706, 717 bcrh .................................................... 148, 699, 709, 720 bcrl..................................................... 149, 699, 709, 720 bit manipulation instructions........................................... 69 bit rate ........................................................................... 475 bit rate ......................................................................... 475 block data transfer instructions .................................... 73 block transfer mode ...................................................... 273 block transfer mode..................................................... 229 boot mode..................................................................... 623 branch instructions..........................................................71 break .............................................................................527 break address........................................................133, 136 break conditions ............................................................136 brr ...................................................... 475, 702, 713, 722 buffer operation ............................................................381 burst mode ...................................................................237 burst rom interface......................................................170 bus arbitration...............................................................177 bus control....................................................................151 bus cycle........................................................................155 cascaded connection ...................................................430 cascaded operation .....................................................384 chain transfer...............................................................275 clock pulse generator ..................................................657 cmia..............................................................................431 cmib..............................................................................431 compare-match count mode........................................431 condition field ................................................................73 condition-code register.................................................58 controller .......................................................................141 cpu .................................................................................47 cra ...................................................... 264, 695, 705, 716 crb ...................................................... 264, 695, 705, 716 cycle steal mode .........................................................236 d/a converter................................................................597 dacr ................................................... 599, 696, 705, 716 dadr ................................................... 598, 695, 705, 716 dar ...................................................... 263, 695, 705, 716 data direction register....................................................283 data register...................................................................283 data transfer controller................................................259 data transfer instructions...............................................65 ddcswr ............................................. 553, 696, 705, 716 dend0a ........................................................................254 dend0b ........................................................................254 dend1a ........................................................................254 dend1b ........................................................................254 direct transitions ..........................................................687
rev. 2.00, 05/03, page 842 of 846 dma controller (dmac)................................................181 dmabcr .............................................. 195, 701, 713, 722 dmacr................................................. 187, 701, 713, 722 dmatcr .............................................. 208, 701, 713, 722 dmawer ............................................. 206, 701, 713, 722 dtc vector table..........................................................267 dtcer ................................................. 264, 697, 707, 717 dtvecr............................................... 265, 697, 707, 717 dual address mode .......................................................235 ebr1 .................................................... 616, 704, 715, 724 ebr2 .................................................... 618, 704, 715, 724 effective address.............................................................78 effective address extension............................................73 emulation.......................................................................627 erase/erase-verify ........................................................631 erasing units ..................................................................610 eri.................................................................................525 error protection .............................................................633 etcr .................................................... 186, 699, 710, 720 exception handling .........................................................97 exception handling vector table....................................98 extended control register ..............................................57 external trigger input timing ........................................590 flash memory .................................................................605 flmcr1 ............................................... 615, 704, 715, 724 flmcr2 ............................................... 616, 704, 715, 724 flpwcr .............................................. 621, 704, 715, 724 framing error ..................................................................494 free-running count operation ........................................375 general registers............................................................56 hardware protection......................................................633 hardware standby mode...............................................682 i 2 c bus format................................................................553 i 2 c bus interface ...........................................................535 iccr ..................................................... 546, 702, 713, 722 icdr ..................................................... 539, 702, 714, 722 icmr............................................................. 542, 714, 722 icmr/sar .....................................................................702 icsr ..................................................... 550, 702, 713, 722 idle cycle .......................................................................172 idle mode .......................................................................216 ier........................................................ 109, 697, 707, 717 immediate ...................................................................... 76 input capture function .............................................. 378 input pull-up mos ......................................................... 283 instruction set ................................................................. 63 internal block diagram ..................................................... 4 internal bus masters...................................................... 141 interrupt control modes ................................................ 120 interrupt controller ........................................................ 105 interrupt exception handling sequence ....................... 126 interrupt exception handling vector table................... 114 interrupt mask bit............................................................ 58 interrupts ....................................................................... 102 interval timer mode ...................................................... 446 ioar .....................................................185, 699, 710, 720 ipr ........................................................108, 699, 709, 719 iscr......................................................109, 697, 707, 717 isr ........................................................112, 697, 707, 717 list of registers ............................................................ 695 logic operations instructions ......................................... 68 lpwrcr ..............................................659, 696, 706, 717 mar ......................................................185, 699, 710, 720 mark state..................................................................... 527 mask rom .................................................................... 643 master receive operation ............................................ 556 master transmit operation ........................................... 555 mdcr ..................................................... 84, 696, 706, 717 medium-speed mode.................................................... 678 memory cycle ................................................................ 155 memory indirect .............................................................. 77 memory map ................................................................... 89 module stop mode........................................................ 683 mra ......................................................262, 695, 705, 716 mrb ......................................................263, 695, 705, 716 mstpcr ...............................................677, 696, 706, 717 multi-channel operation ............................................... 249 multiprocessor communication function ..................... 498 nmi interrupt ................................................................ 113 nmi interrupt request .................................................... 448 noise chancellor........................................................... 566 normal mode........................................... 50, 226, 271, 280 on-board programming................................................ 623 open-drain control register............................................ 283
rev. 2.00, 05/03, page 843 of 846 operating mode selection .............................................. 83 operation field ............................................................... 73 overflow......................................................................... 446 overrun error ................................................................. 494 ovi ................................................................................ 431 p1ddr .................................................. 287, 697, 707, 718 p1dr..................................................... 288, 700, 711, 720 p3ddr .................................................. 293, 697, 707, 718 p3dr..................................................... 294, 700, 711, 720 p3odr.................................................. 295, 698, 707, 718 p7ddr .................................................. 300, 697, 707, 718 p7dr..................................................... 300, 700, 711, 720 paddr ................................................. 305, 697, 707, 718 padr .................................................... 305, 700, 711, 720 paodr ................................................. 306, 698, 707, 718 papcr.................................................. 306, 697, 707, 718 parity error..................................................................... 494 pbddr ................................................. 310, 697, 707, 718 pbdr .................................................... 311, 700, 711, 720 pbpcr.................................................. 312, 697, 707, 718 pc break controller...................................................... 133 pcddr ................................................. 317, 697, 707, 718 pcdr .................................................... 317, 700, 711, 720 pcpcr ................................................. 318, 697, 707, 718 pdddr ................................................. 320, 697, 707, 718 pddr .................................................... 320, 700, 711, 720 pdpcr ................................................. 321, 698, 707, 718 peddr ................................................. 323, 697, 707, 718 pedr .................................................... 324, 700, 711, 720 pepcr.................................................. 325, 698, 707, 718 periodic count operation ............................................... 375 pfcr .................................................... 150, 696, 706, 717 pfddr.................................................. 327, 697, 707, 718 pfdr .................................................... 327, 700, 711, 720 pgddr ................................................. 331, 697, 707, 718 pgdr.................................................... 331, 700, 711, 720 phase counting mode .................................................. 391 pin arrangements in each mode.................................... 16 pin functions .................................................................. 36 pointer (sp)..................................................................... 56 port register................................................................... 283 port1 .................................................. 288, 704, 715, 724 port3.................................................. 294, 704, 715, 724 port4.................................................. 299, 704, 715, 724 port7.................................................. 301, 704, 715, 724 port9.................................................. 304, 704, 715, 724 porta ................................................. 306, 704, 715, 724 portb ................................................. 311, 704, 715, 724 portc ................................................. 318, 704, 715, 724 portd ................................................. 321, 704, 715, 724 porte ................................................. 324, 704, 715, 724 portf ................................................. 328, 704, 715, 724 portg................................................. 332, 704, 715, 724 power-down modes ......................................................671 program counter.............................................................57 program/erase protection.............................................633 program/program-verify ...............................................629 program-counter relative ..............................................77 programmer mode ........................................................634 prom............................................................................645 pulse output..................................................................426 pwm modes ..................................................................386 ram...............................................................................603 ramer................................................. 619, 699, 710, 720 rdr...................................................... 458, 702, 714, 722 register addresses (in address order) .........................695 register bits ..................................................................705 register configuration.....................................................55 register direct.................................................................75 register field ..................................................................73 register indirect ..............................................................75 register indirect with displacement................................75 register indirect with post-increment .............................75 register indirect with pre-decrement .............................75 register information ......................................................267 register states in each operating mode......................716 repeat mode ..................................................................272 repeat mode .................................................................218 reset ...............................................................................99 reset exception handling.............................................100 rom ..............................................................................605 rsr ...............................................................................458 rstcsr............................................... 444, 702, 713, 722 rxi.................................................................................525
rev. 2.00, 05/03, page 844 of 846 sar ...................... 263, 541, 695, 702, 705, 714, 716, 722 sarx.................................................... 541, 702, 714, 722 sbycr ................................................. 675, 696, 706, 717 scan mode ....................................................................587 sckcr ................................................. 658, 696, 706, 717 scmr ................................................... 474, 702, 714, 722 scr ...................................................... 462, 702, 714, 722 scrx.................................................... 545, 696, 705, 716 semr ................................................... 483, 696, 706, 717 sequential mode............................................................213 serial communication interface ....................................453 serial format...................................................................553 shift instructions ..............................................................68 single address mode ............................................222, 243 single mode...................................................................586 slave receive operation...............................................559 slave transmit operation..............................................561 sleep mode ...................................................................679 smart card ....................................................................453 smart card interface .....................................................512 smr...................................................... 459, 702, 713, 722 software activation.................................................276, 280 software protection .......................................................633 software standby mode ................................................680 ssr ...................................................... 467, 702, 714, 722 stack status ..................................................................103 stack structure ..........................................................50, 52 sub-active mode ...........................................................686 sub-sleep mode............................................................685 swdtend ....................................................................276 synchronous mode .......................................................504 synchronous operation.................................................379 syscr ................................................... 85, 696, 706, 717 system control instructions ............................................72 tci1u ............................................................................398 tci1v.............................................................................398 tci2u ............................................................................398 tci2v.............................................................................398 tci3v.............................................................................398 tci4u ............................................................................398 tci4v.............................................................................398 tci5u ............................................................................398 tci5v ............................................................................ 398 tcnt............ 372, 418, 439, 700, 702, 711, 713, 721, 722 tcnt incrementation timing........................................ 427 tcora..................................................418, 702, 713, 722 tcorb..................................................418, 702, 713, 722 tcr...................... 343, 419, 700, 701, 711, 713, 721, 722 tcsr ....................................421, 439, 701, 702, 713, 722 tdr.......................................................458, 702, 714, 722 tei................................................................................. 525 tgi0a............................................................................ 398 tgi0b............................................................................ 398 tgi0c............................................................................ 398 tgi0d............................................................................ 398 tgi0v............................................................................ 398 tgi1a............................................................................ 398 tgi1b............................................................................ 398 tgi2a............................................................................ 398 tgi2b............................................................................ 398 tgi3a............................................................................ 398 tgi3b............................................................................ 398 tgi3c............................................................................ 398 tgi3d............................................................................ 398 tgi4a............................................................................ 398 tgi4b............................................................................ 398 tgi5a............................................................................ 398 tgi5b............................................................................ 398 tgr.......................................................372, 700, 711, 721 tier ......................................................367, 700, 711, 721 tior......................................................349, 700, 711, 721 tmdr ....................................................348, 700, 711, 721 toggle output ........................................................ 377, 434 traces ........................................................................... 101 transfer mode............................................................... 211 trap instruction ............................................................. 102 tsr ...............................................369, 458, 700, 711, 721 tstr.....................................................372, 699, 709, 719 tsyr.....................................................373, 699, 709, 719 txi................................................................................. 525 user program mode...................................................... 626 valid strobes................................................................. 159 vector number for the software activation interrupt ...... 265 wait control .......................................................... 168, 172
rev. 2.00, 05/03, page 845 of 846 watch mode.................................................................. 684 watchdog timer............................................................ 437 watchdog timer mode ................................................. 445 waveform output by compare match ...................... 376 wcrh .................................................. 145, 699, 709, 720 wcrl ................................................... 145, 699, 709, 720 wovi .............................................................................448
rev. 2.00, 05/03, page 846 of 846
h8s/2239, h8s/2238, h8s/2237, h8s/2227 group hardware manual publication date: 1st edition, september 2002 rev.2.00, may 30, 2003 published by: sales strategic planning div. renesas technology corp. edited by: technical documentation & information department renesas kodaira semiconductor co., ltd. ?2002, 2003 renesas technology corp. all rights reserved. printed in japan.
colophon 0.0 http://www.renesas.com sales strategic planning div. nippon bldg., 2-6-2, ohte-machi, chiyoda-ku, tokyo 100-0004, japan
h8s/2239, h8s/2238, h8s/2237, h8s/2227 group hardware manual rej09b0054-0200o (ade-602-300a)


▲Up To Search▲   

 
Price & Availability of HD6432223XXXFA

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

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


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