![]() |
|
If you can't view the Datasheet, Please click here to try to view without PDF Reader . |
|
Datasheet File OCR Text: |
description the 7643 group is the 8-bit microcomputer based on the 7600 series core (740 family core compatible) technology. the 7643 group is designed for pc peripheral devices, including the usb, dmac, serial i/o, uart, timer and so on. features rev.1.00 jul 30, 2003 page 2 of 119 7643 group pin configuration (top view) fig. 1 m37643m8-xxxfp, m37643f8fp pin configuration p7 4 1 2 3 4 7 8 9 10 11 12 13 14 15 16 17 18 19 20 5 6 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 p6 1 p5 6 p5 5 p5 3 p5 2 cnv ss /v pp reset av cc av ss p4 4 p8 7 /rts p8 6 /cts v cc p5 0 /x cin v ss x in x out p5 1 /t out /x cout lpf p8 5 /urxd p8 4 /utxd p3 2 p3 1 m37643m8-xxxfp m37643f8fp p6 0 p5 7 p5 4 21 22 23 24 p4 3 p4 2 /int 1 p4 1 /int 0 p4 0 /edma 61 62 63 64 p8 3 /stxd p8 2 /srxd p8 1 /sclk p8 0 /srdy p3 7 /rd p3 6 /wr p3 5 /sync out p3 4 / out p3 3 /dma out p3 0 /rdy p1 7 /ab 15 p1 6 /ab 14 p1 5 /ab 13 p1 4 /ab 12 p1 3 /ab 11 p1 2 /ab 10 p1 1 /ab 9 p1 0 /ab 8 p0 7 /ab 7 p0 6 /ab 6 p0 5 /ab 5 p0 4 /ab 4 p0 3 /ab 3 p0 2 /ab 2 p0 1 /ab 1 p0 0 /ab 0 p2 7 /db 7 p2 6 /db 6 p2 5 /db 5 p2 4 /db 4 p2 3 /db 3 p2 2 /db 2 p2 1 /db 1 p2 0 /db 0 p 7 3 /hlda p7 2 p 7 1 /hold p7 0 usb d+ usb d- ext.cap v ss v cc p6 7 p6 6 p6 5 p6 4 p6 3 p6 2 p7 4 1 2 3 4 7 8 9 10 11 12 13 14 15 16 17 18 19 20 5 6 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 p6 1 p5 6 p5 5 p5 3 p5 2 cnv ss /v pp reset av cc av ss p4 4 p8 7 /rts p8 6 /cts v cc p5 0 /x cin v ss x in x out p5 1 /t out /x cout lpf p8 5 /urxd p8 4 /utxd p3 2 p3 1 m37643m8-xxxhp m37643f8hp p6 0 p5 4 21 22 23 24 p4 3 p4 2 /int 1 p4 1 /int 0 61 62 63 64 p8 3 /stxd p8 2 /srxd p8 1 /sclk p8 0 /srdy p3 7 /rd p3 6 /wr p3 5 /sync out p3 4 / out p3 3 /dma out p3 0 /rdy p1 7 /ab 15 p1 6 /ab 14 p1 5 /ab 13 p1 4 /ab 12 p1 3 /ab 11 p1 2 /ab 10 p1 1 /ab 9 p1 0 /ab 8 p0 7 /ab 7 p0 6 /ab 6 p0 5 /ab 5 p0 4 /ab 4 p0 3 /ab 3 p0 2 /ab 2 p0 1 /ab 1 p0 0 /ab 0 p2 7 /db 7 p2 6 /db 6 p2 5 /db 5 p2 4 /db 4 p2 3 /db 3 p2 2 /db 2 p2 1 /db 1 p2 0 /db 0 usb d+ usb d- ext.cap v ss v cc p6 7 p6 6 p6 5 p6 4 p6 3 p6 2 p4 0 /edma p7 1 /hold p7 0 p5 7 p7 2 p7 3 /hlda package type : 80p6n-a package type : 80p6q-a fig. 2 m37643m8-xxxhp, m37643f8hp pin configuration rev.1.00 jul 30, 2003 page 3 of 119 7643 group functional block diagram (package: 80p6n-a) fig. 3 functional block diagram t out c p u a x y s pc h pc l ps reset v cc v ss r o m r a m 10 16 13 p2(8) i/o port p0 p0(8) p1(8) p3(8) p5(8) 49 50 51 52 53 54 55 56 41 42 43 44 45 46 47 48 57 58 59 60 61 62 63 64 33 34 35 36 37 38 39 40 p6(8) 20 21 22 23 24 x in x out timer 1 (8) timer 2 (8) timer 3 (8) 14 15 75 76 77 78 79 80 12 p7(5) 65 66 67 69 68 p8(8) 25 26 27 28 29 30 31 32 d+ d- usb v cc 74 v ss 73 cnv ss 9 uart (8) 70 71 3456781112 int 1 , int 0 p4(5) dma [dma out ] ext.cap 72 lpf 18 av ss 19 t out 3 6 [ out ] 35 40 24 33 34 [edma] [rd] [wr] [sync out ][rdy] 66 [hlda] 68 [hold] 17 avcc main clock input main clock output clock generating circuit reset input x c in x cout serial i/o (8) x c in key input i/o port p1 i/o port p2 i/o port p3 i/o port p4 i/o port p5 i/o port p6 i/o port p7 i/o port p8 reset rev.1.00 jul 30, 2003 page 4 of 119 7643 group p5 0 /x cin , p5 1 /t out / x cout , p5 2 ,p5 3 ,p5 4 , p5 5 ,p5 6 ,p5 7 ?apply 4.15 v ?5.25 v for 5 v version or 3.00 v ?3.60 v for 3 v version to the vcc pin. apply 0 v to the vss pin. ?this controls the mcu operating mode. connect this pin to vss. if connecting this pin to vcc, the internal rom is inhibited. in the flash memory version this pin functions as a v pp power supply input pin. ?these pins are the power supply inputs for analog circuitry. ?reset input pin for active ?. ?connect a ceramic resonator or a quartz-crystal oscillator between the x in and x out pins to set the oscillation frequency. ?if an external clock is used, connect the clock source to the x in pin and leave the x out pin open. ?loop filter for the frequency synthesizer. ?it is a capacitor connection pin for built-in dc-dc converter. at vcc=5 v, use built-in dc-dc converter by permitting a usb line driver and connect a capacitor. refer to "notes on use" for details. built-in dc- dc converter cannot be used at vcc = 3.3 v. supply 3.3v power supply to this pin from the externals. ?usb d+ voltage signal port. connect a 27 to 33 ? (recommended) resistor in series. ?usb d- voltage signal port. connect a 27 to 33 ? (recommended) resistor in series. ?8-bit i/o port. ?cmos compatible input level. ?cmos 3-state output structure. ?i/o direction register allows each pin to be individually programmed as either input or output. ?when connecting an external memory, these function as the address bus. ?8-bit i/o port. ?cmos compatible input level. ?cmos 3-state output structure. ?i/o direction register allows each pin to be individually programmed as either input or output. ?when connecting an external memory, these function as the address bus. ?key-on wake-up interrupt input pin v cc , v ss cnvss/v pp avss/avcc reset x in x out lpf ext. cap. usb d+ usb d- p0 0 /ab 0 p0 7 /ab 7 name power source cnvss analog power supply reset input clock input clock output lpf 3.3 v line power supply usb d+ usb d- function except a port function pin description table 1 pin description (1) function p1 0 /ab 8 p1 7 /ab 15 p2 0 /db 0 p2 7 /db 7 ?8-bit i/o port. ?cmos compatible input level or vihl input level. ?cmos 3-state output structure. ?i/o direction register allows each pin to be individually programmed as either input or output. ?when connecting an external memory, these function as the data bus. ?8-bit i/o port. ?cmos compatible input level. ?cmos 3-state output structure. ?i/o direction register allows each pin to be individually programmed as either input or output. ?when connecting an external memory, these function as the control bus. p3 0 /rdy, p3 1 , p3 2 , p3 3 /dma out , p3 4 / out , p3 5 /sync out , p3 6 /wr, ?8-bit i/o port. ?cmos compatible input level. ?cmos 3-state output structure. ?i/o direction register allows each pin to be individually programmed as either input or output. ?when connecting an external memory, these function as the control bus. ?8-bit i/o port. ?cmos compatible input level. ?cmos 3-state output structure. ?i/o direction register allows each pin to be individually programmed as either input or output. i/o port p0 i/o port p1 i/o port p2 i/o port p3 (see remarks.) ?external memory control pin p3 7 /rd p4 0 /edma, p4 1 /int 0 , p4 2 /int 1 , p4 3 ,p4 4 ?external memory control pin ?external interrupt pin ?sub-clock generating input pin ?timers 1, 2 pulse output pins ?sub-clock generating output pin pin i/o port p4 i/o port p5 rev.1.00 jul 30, 2003 page 5 of 119 7643 group pin name function except a port function function table 2 pin description (2) p6 0 ?6 7 ?8-bit i/o port. ?cmos compatible input level. ?cmos 3-state output structure. ?i/o direction register allows each pin to be individually programmed as either input or output. ?5-bit i/o port. ?cmos compatible input level. ?cmos 3-state output structure. ?i/o direction register allows each pin to be individually programmed as either input or output. ?8-bit i/o port. ?cmos compatible input level. ?cmos 3-state output structure. ?i/o direction register allows each pin to be individually pro- grammed as either input or output. p7 0 , __________ p7 1 /hold, p7 2 , __________ p7 3 /hlda, p7 4 __________ p8 0 /srdy, p8 1 /sclk, p8 2 /srxd, p8 3 /stxd, p8 4 /utxd, p8 5 /urxd, ________ p8 6 /cts, ________ p8 7 /rts ?serial i/o pin remarks ?ma out pin if externally detecting the timing of dma execution, use the signal from this pin. it is ??level during dma transferring. thi s signal is valid in the memory expansion and microprocessor modes. ?ync out pin if externally detecting the timing of op code fetch, use the signal from this pin. this signal is valid in the memory expansion and microprocessor modes. i/o port p6 i/o port p7 ?uart pin i/o port p8 rev.1.00 jul 30, 2003 page 6 of 119 7643 group part numbering fig. 4 part numbering m37643 m 8 xxx fp product rom size/ 8: 32768 bytes the first 128 bytes and the last 4 bytes of rom are reserved areas; they cannot be used. in the flash memory version, these areas can be used for program and erase. memory type m: mask rom version f: flash memory version ram size m37643m8 : 1024 bytes m37643f8 : 2560 bytes package type fp: 80p6n-a package hp: 80p6q-a package rom number omitted in flash memory version. ? standard omitted in flash memory version. flash memory size rev.1.00 jul 30, 2003 page 7 of 119 7643 group group expansion renesas plans to expand the 7643 group as follows. memory type supports for mask rom and flash memory versions. memory size rom size ......................................................................... 32 kbytes ram size ........................................................... 1024 to 2560 bytes memory expansion plan fig. 5 memory expansion plan currently planning products are listed below. as of jan. 2003 package 80p6n-a 80p6q-a 80p6n-a 80p6q-a part number m37643m8-xxxfp m37643m8-xxxhp m37643f8fp m37643f8hp rom size (bytes) rom size for user in ( ) 32768 (32636) ram size (bytes) 1024 table 3 support products mask rom version remarks packages 80p6n-a ..................................... 0.8 mm-pitch plastic molded qfp 80p6q-a ................................... 0.5 mm-pitch plastic molded lqfp rom external 60 k 48 k 32 k 28 k 24 k 20 k 16 k 12 k 8 k 384 512 640 768 896 1024 1152 1280 1408 1536 2048 3072 403 2 rom size (bytes) ram size (bytes) m37643m8 m37643f8 32768 2560 flash memory version rev.1.00 jul 30, 2003 page 8 of 119 7643 group functional description central processing unit (cpu) the 7643 group uses the standard 7600 series instruction set. refer to the 7600 series software manual for details on the instruction set. the 7600 series has an upward compatible instruction set, of which instruction execution cycles are shortened, for 740 series. [accumulator (a)] the accumulator is an 8-bit register. data operations such as data transfer, etc., are executed mainly through the accumulator. [index register x (x)] the index register x is an 8-bit register. in the index addressing modes, the value of the operand is added to the contents of register x and specifies the real address. [index register y (y)] the index register y is an 8-bit register. in partial instruction, the value of the operand is added to the contents of register y and specifies the real address. [stack pointer (s)] the stack pointer is an 8-bit register used during subroutine calls and interrupts. this register indicates start address of stored area (stack) for storing registers during subroutine calls and interrupts. the low-order 8 bits of the stack address are determined by the con- tents of the stack pointer. the high-order 8 bits of the stack address are determined by the stack page selection bit. if the stack page selection bit is ??, the high-order 8 bits becomes ?0 16 ? if the stack page selection bit is ?? the high-order 8 bits becomes ?1 16 ? the operations of pushing register contents onto the stack and pop- ping them from the stack are shown in figure 7. store registers other than those described in figure 7 with program when the user needs them during interrupts or subroutine calls. [program counter (pc)] the program counter is a 16-bit counter consisting of two 8-bit regis- ters pc h and pc l . it is used to indicate the address of the next in- struction to be executed. fig. 6 7600 series cpu register structure a accumulator b7 b7 b7 b7 b0 b7 b8 b 15 b0 b7 b0 b0 b0 b0 x index register x y index register y s stack pointer pc l program counter pc h n v t b d i z c processor status register (ps ) carry flag zero flag interrupt disable flag decimal mode flag break flag index x mode flag overflow flag negative flag rev.1.00 jul 30, 2003 page 9 of 119 7643 group table 4 push and pop instructions of accumulator or processor status register accumulator processor status register push instruction to stack pha php pop instruction from stack pla plp fig. 7 register push and pop at interrupt generation and subroutine call n o t e : c o n d i t i o n f o r a c c e p t a n c e o f a n i n t e r r u p t i n t e r r u p t e n a b l e f l a g i s 1 e x e c u t e j s r o n - g o i n g r o u t i n e m ( s )( p c h ) ( s ) ( s ) 1 m ( s )( p c l ) e x e c u t e r t s ( p c l )m ( s ) ( s ) ( s ) 1 ( s ) ( s ) + 1 ( s ) ( s ) + 1 ( p c h )m ( s ) s u b r o u t i n e p o p re t u r n a d d r e s s f r o m s t a c k p u s h r e t u r n a d d r e s s o n s t a c k m ( s )( p s ) e x e c u t e r t i ( p s )m ( s ) ( s ) ( s ) 1 ( s ) ( s ) + 1 i n t e r r u p t s e r v i c e r o u t i n e p o p c o n t e n t s o f p r o c e s s o r s t a t u s r e g i s t e r f r o m s t a c k m ( s )( p c h ) ( s ) ( s ) 1 m ( s )( p c l ) ( s ) ( s ) 1 ( p c l )m ( s ) ( s ) ( s ) + 1 ( s ) ( s ) + 1 ( p c h )m ( s ) p o p r e t u r n a d d r e s s f r o m s t a c k i f l a g i s s e t f r o m 0 t o 1 f e t c h t h e j u m p v e c t o r p u s h r e t u r n a d d r e s s o n s t a c k p u s h c o n t e n t s o f p r o c e s s o r s t a t u s r e g i s t e r o n s t a c k i n t e r r u p t r e q u e s t ( n o t e ) i n t e r r u p t d i s a b l e f l a g i s 0 rev.1.00 jul 30, 2003 page 10 of 119 7643 group [processor status register (ps)] the processor status register is an 8-bit register consisting of 5 flags which indicate the status of the processor after an arithmetic opera- tion and 3 flags which decide mcu operation. branch operations can be performed by testing the carry (c) flag , zero (z) flag, overflow (v) flag, or the negative (n) flag. in decimal mode, the z, v, n flags are not valid. ?it 0: carry flag (c) the c flag contains a carry or borrow generated by the arithmetic logic unit (alu) immediately after an arithmetic operation. it can also be changed by a shift or rotate instruction. ?it 1: zero flag (z) the z flag is set if the result of an immediate arithmetic operation or a data transfer is ?? and cleared if the result is anything other than ?? ?it 2: interrupt disable flag (i) the i flag disables all interrupts except for the interrupt generated by the brk instruction. interrupts are disabled when the i flag is ?? ?it 3: decimal mode flag (d) the d flag determines whether additions and subtractions are executed in binary or decimal. binary arithmetic is executed when this flag is ?? decimal arithmetic is executed when it is ?? decimal correction is automatic in decimal mode. only the adc and sbc instructions can execute decimal arithmetic. ?it 4: break flag (b) the b flag is used to indicate that the current interrupt was generated by the brk instruction. the brk flag in the processor status register is always ?? when the brk instruction is used to generate an interrupt, the processor status register is pushed onto the stack with the break flag set to ?? ?it 5: index x mode flag (t) when the t flag is ?? arithmetic operations are performed between accumulator and memory. when the t flag is ?? direct arithmetic operations and direct data transfers are enabled between memory locations. ?it 6: overflow flag (v) the v flag is used during the addition or subtraction of one byte of signed data. it is set if the result exceeds +127 to -128. when the bit instruction is executed, bit 6 of the memory location operated on by the bit instruction is stored in the overflow flag. ?it 7: negative flag (n) the n flag is set if the result of an arithmetic operation or data transfer is negative. when the bit instruction is executed, bit 7 of the memory location operated on by the bit instruction is stored in the negative flag. table 5 set and clear instructions of each bit of processor status register set instruction clear instruction c flag sec clc z flag i flag sei cli d flag sed cld b flag t flag set clt v flag clv n flag rev.1.00 jul 30, 2003 page 11 of 119 7643 group [cpu mode registers a, b (cpuma, cpumb)] 0000 16 , 0001 16 the cpu mode register contains the stack page select bit and the cpu operating mode select bit and so on. the cpu mode registers are allocated at address 0000 16 , 0001 16 . fig. 8 structure of cpu mode register notes do not use the microprocessor mode in the flash memory version. cpu mode register b (address 0001 16 ) cpmb reserved bit (??at read/write) b0 b7 1 0 slow memory wait select bits b1b0 0 0: no wait 0 1: one-time wait 1 0: two-time wait 1 1: three-time wait slow memory wait mode select bits b3b2 0 0: software wait 0 1: not available 1 0: rdy wait 1 1: software wait plus rdy input anytime wait expanded data memory access bit 0: edma output disabled 1: edma output enabled hold function enable bit 0: hold function disabled 1: hold function enabled fix to ?? cpu mode register a (address 0000 16 ) cpma processor mode bits b1b0 0 0: single-chip mode 0 1: memory expansion mode 1 0: microprocessor mode ( note 1 ) 1 1: not available stack page select bit 0: page 0 1: page 1 fix to ?? sub-clock (x cin -x cout ) control bit 0: stopped 1: oscillating main clock (x in -x out ) control bit 0: oscillating 1: stopped internal system clock select bit ( note 2 ) 0: external clock (x in -x out or x cin -x cout ) 1: f syn external clock select bit 0: x in -x out 1: x cin -x cout b0 b7 1 notes 1: this is not available in the flash memory version. 2: when (cpma 6, 7) = (0, 0), the internal system clock can be selected between f(x in ) or f(x in )/2 by ccr7. the internal clock is the internal system clock divided by 2. rev.1.00 jul 30, 2003 page 12 of 119 7643 group memory special function register (sfr) area the special function register area in the zero page contains control registers such as i/o ports and timers. ram ram is used for data storage and for stack area of subroutine calls and interrupts. rom the first 128 bytes and the last 4 bytes of rom are reserved for device testing and the rest is user area for storing programs. in the flash memory version, program and erase can be performed in the reserved area. interrupt vector area the interrupt vector area contains reset and interrupt vectors. zero page access to this area with only 2 bytes is possible in the zero page addressing mode. special page access to this area with only 2 bytes is possible in the special page addressing mode. refer to page 74 for the memory map of memory expansion and microprocessor modes. fig. 9 memory map diagram 1024 2560 046f 16 0a6f 16 ram area ram size (bytes) address xxxx 16 0000 16 0070 16 ff00 16 ffca 16 fffc 16 ffff 16 xxxx 16 8000 16 8080 16 ram rom size: 32768 bytes sfr area not used interrupt vector area reserved rom area (128 bytes) zero page special page reserved rom area 0100 16 1000 16 reserved area ( note 1 ) sfr area ( note 2 ) ffc9 16 m37643m8 m37643f8 notes 1 : reserved area in m37643f8. 2 : sfr area in m37643f8. rev.1.00 jul 30, 2003 page 13 of 119 7643 group fig. 10 memory map of special function register (sfr) cpu mode register a (cpua) cpu mode register b (cpub) interrupt request register a (ireqa) interrupt request register b (ireqb) interrupt request register c (ireqc) interrupt control register a (icona) interrupt control register b (iconb) interrupt control register c (iconc) port p0 (p0) port p0 direction register (p0d) port p1 (p1) port p1 direction register (p1d) port p2 (p2) port p2 direction register (p2d) port p3 (p3) port p3 direction register (p3d) port control register (ptc) interrupt polarity select register (ipol) port p2 pull-up control register (pup2) usb control register (usbc) port p6 (p6) port p6 direction register (p6d) port p5 (p5) port p5 direction register (p5d) port p4 (p4) port p4 direction register (p4d) port p7 (p7) port p7 direction register (p7d) port p8 (p8) port p8 direction register (p8d) reserved ( note 1 ) clock control register (ccr) reserved ( note 1 ) reserved ( note 1 ) reserved ( note 1 ) reserved ( note 1 ) timer 1 (t1) timer 2 (t2) timer 3 (t3) reserved ( note 1 ) reserved ( note 1 ) timer 123 mode register (t123m) serial i/o shift register (siosht) serial i/o control register 1 (siocon1) serial i/o control register 2 (siocon2) reserved ( note 1 ) reserved ( note 1 ) reserved ( note 1 ) uart mode register (umod) uart baud rate generator (ubrg) uart status register (usts) uart control register (ucon) uart transmit/receive buffer register 1 (utrb1) uart transmit/receive buffer register 2 (utrb2) uart rts control register (urtsc) reserved ( note 1 ) 0000 16 0001 16 0003 16 0004 16 0002 16 0005 16 0006 16 0007 16 0008 16 0009 16 000a 16 000b 16 000c 16 000d 16 000e 16 000f 16 0010 16 0011 16 0012 16 0013 16 0014 16 0015 16 0016 16 0017 16 0018 16 0019 16 001a 16 001b 16 001c 16 001d 16 001e 16 001f 16 0020 16 0021 16 0022 16 0023 16 0024 16 0025 16 0026 16 0027 16 0028 16 0029 16 002a 16 002b 16 002c 16 002d 16 002e 16 002f 16 0030 16 0031 16 0032 16 0033 16 0034 16 0035 16 0036 16 0037 16 reserved ( note 1 ) reserved ( note 1 ) reserved ( note 1 ) reserved ( note 1 ) reserved ( note 1 ) reserved ( note 1 ) reserved ( note 1 ) dmac index and status register (dmais) dmac channel x mode register 1 (dmax1) dmac channel x mode register 2 (dmax2) dmac channel x source register low (dmaxsl) dmac channel x source register high (dmaxsh) dmac channel x destination register low (dmaxdl) dmac channel x destination register high (dmaxdh) dmac channel x transfer count register low (dmaxcl) dmac channel x transfer count register high (dmaxch) reserved ( note 1 ) reserved ( note 1 ) reserved ( note 1 ) reserved ( note 1 ) reserved ( note 1 ) reserved ( note 1 ) reserved ( note 1 ) reserved ( note 1 ) usb address register (usba) usb power management register (usbpm) usb interrupt status register 1 (usbis1) usb interrupt status register 2 (usbis2) usb interrupt enable register 1 (usbie1) usb interrupt enable register 2 (usbie2) reserved ( note 1 ) reserved ( note 1 ) usb endpoint index register (usbindex) usb endpoint x in control register (in_csr) usb endpoint x out control register (out_csr) usb endpoint x in max. packet size register (in_maxp) usb endpoint x out max. packet size register (out_maxp) usb endpoint x out write count register (wrt_cnt) reserved ( note 1 ) usb endpoint fifo mode register (usbfifomr) usb endpoint 0 fifo (usbfifo0) usb endpoint 1 fifo (usbfifo1) usb endpoint 2 fifo (usbfifo2) reserved ( note 1 ) reserved ( note 1 ) reserved ( note 1 ) reserved ( note 1 ) reserved ( note 1 ) reserved ( note 1 ) reserved ( note 1 ) flash memory control register (fmcr) ( note 2 ) reserved ( note 1 ) frequency synthesizer control register (fsc) frequency synthesizer multiply register 1 (fsm1) frequency synthesizer multiply register 2 (fsm2) frequency synthesizer divide register (fsd) 0038 16 0039 16 003b 16 003c 16 003a 16 003d 16 003e 16 003f 16 0040 16 0041 16 0042 16 0043 16 0044 16 0045 16 0046 16 0047 16 0048 16 0049 16 004a 16 004b 16 004c 16 004d 16 004e 16 004f 16 0050 16 0051 16 0052 16 0053 16 0054 16 0055 16 0056 16 0057 16 0058 16 0059 16 005a 16 005b 16 005c 16 005d 16 005e 16 005f 16 0060 16 0061 16 0062 16 0063 16 0064 16 0065 16 0066 16 0067 16 0068 16 0069 16 006a 16 006b 16 006c 16 006d 16 006e 16 006f 16 ffc9 16 rom code protect control register (romcp) ( note 3 ) notes 1 : do not write any data to this addresses, because these areas are reserved. 2 : this area is reserved in the mask rom version. 3 : this area is on the rom in the mask rom version. rev.1.00 jul 30, 2003 page 14 of 119 7643 group i/o ports direction registers the i/o ports p0?8 have direction registers which determine the input/output direction of each individual pin. each bit in a direction register corresponds to one pin, each pin can be set to be input port or output port. when ??is written to the bit corresponding to a pin, that pin be- comes an input pin. when ??is written to that bit, that pin becomes an output pin. if data is read from a pin set to output, the value of the port output latch is read, not the value of the pin itself. pins set to input are float- ing. if a pin set to input is written to, only the port output latch is written to and the pin remains floating. slew rate control by setting bits 0 to 5 of the port control register (address 0010 16 ) to ?? slew rate control is enabled. vihl or cmos level can be used as a port p2 input level. pull-up control by setting the port p2 pull-up control register (address 0012 16 ), pull- up of each pin of port p2 can be controlled with a program. however, the contents of port p2 pull-up control register do not affect ports programmed as the output ports but as the input ports. fig. 11 structure of port control and port p2 pull-up control registers port control register (address 0010 16 ) ptc port p0 to p3 slew rate control bit ( note 1 ) 0: disabled 1: enabled port p4 slew rate control bit ( note 1 ) 0: disabled 1: enabled port p5 slew rate control bit ( note 1 ) 0: disabled 1: enabled port p6 slew rate control bit ( note 1 ) 0: disabled 1: enabled port p7 slew rate control bit ( note 1 ) 0: disabled 1: enabled port p8 slew rate control bit ( note 1 ) 0: disabled 1: enabled port p2 input level select bit 0: reduced vihl level input ( note 2 ) 1: cmos level input reserved bit (??at read/write) n otes 1 : the slew rate function can reduce di/dt by modifying an internal buffer structure. 2 : the characteristics of vihl level is basically the same as that of ttl level. but, its switching center point is a little higher than ttl?. refer to section ?ecommended operating conditions? b0 b7 port p2 pull-up control register (address 0012 16 ) pup2 b0 b7 port p2 0 pull-up control bit 0: disabled 1: enabled port p2 1 pull-up control bit 0: disabled 1: enabled port p2 2 pull-up control bit 0: disabled 1: enabled port p2 3 pull-up control bit 0: disabled 1: enabled port p2 4 pull-up control bit 0: disabled 1: enabled port p2 5 pull-up control bit 0: disabled 1: enabled port p2 6 pull-up control bit 0: disabled 1: enabled port p2 7 pull-up control bit 0: disabled 1: enabled 0 rev.1.00 jul 30, 2003 page 15 of 119 7643 group table 6 list of i/o port function name port p0 port p1 port p2 input/output input/output, individual bits i/o format cmos input level cmos 3-state output non-port function lower address output higher address output data bus i/o related sfrs cpu mode register a port control register ref. no. (1) p0 0 /ab 0 p0 7 /ab 7 p1 0 /ab 8 p1 7 /ab 15 p2 0 /db 0 p2 7 /db 7 p6 0 ?6 7 p7 0 , __________ p7 1 /hold, p7 2 , __________ p7 3 /hlda, p7 4 __________ p8 0 /srdy, p8 1 /sclk, p8 2 /srxd, p8 3 /stxd, p8 4 /utxd, p8 5 /urxd, _______ p8 6 /cts, _______ p8 7 /rts pin (2) cpu mode register a port control register port p2 pull-up control register cpu mode register a cpu mode register b port control register cpu mode register a cpu mode register b port control register interrupt polarity select register cpu mode register a port control register clock control register timer 123 mode register port control register control signal i/o cmos input level/vihl input level cmos 3-state output port p3 (1) (3) (4) (5) cmos input level cmos 3-state output p3 0 /rdy p3 7 /rd p4 0 /edma, port p4 p4 1 /int 0 , p4 2 /int 1 , p4 3 ,p4 4 control signal i/o external interrupt p5 0 /x cin , p5 1 /t out / x cout cmos input level cmos 3-state output (6) (7) timer 1, timer 2 output pin sub-clock generat- ing input pin p5 2 ?5 7 port p5 cmos input level cmos 3-state output (8) cmos input level/ttl input level cmos 3-state output cmos input level cmos 3-state output cmos input level cmos 3-state output cmos input level cmos 3-state output (9) port control register port control register port control register cpu mode register b uart control registers serial i/o control register 1 serial i/o control register 2 port control register port p6 port p7 (10) (11) (12) (13) (14) control signal i/o serial i/o i/o pin uart i/o pin (15) (16) (17) (18) (19) (20) (21) (22) port p8 notes 1 : for details of the ports functions in modes other than single-chip mode, and how to use double-function ports as function i/o ports, refer to the applicable sections. 2 : make sure that the input level at each pin is either 0 v or v cc during execution of the stp instruction. when an input level is at an intermediate potential, a rush current will flow from v cc to v ss through the input-stage gate. rev.1.00 jul 30, 2003 page 16 of 119 7643 group fig. 12 port block diagram (1) ( 1 ) p o r t s p 0 , p 1 , p 3 d a t a b u s d i r e c t i o n r e g i s t e r p o r t l a t c h ( 3 ) p o r t p 4 0 d a t a b u s d i r e c t i o n r e g i s t e r p o r t l a t c h e x p a n d e d d a t a m e m o r y a c c e s s b i t e d m a s i g n a l ( 5 ) p o r t s p 4 3 , p 4 4 ( 2 ) p o r t p 2 d a t a b u s d i r e c t i o n r e g i s t e r p o r t l a t c h p 2 p u l l - u p k e y i n t e r r u p t i n p u t ( 4 ) p o r t s p 4 1 , p 4 2 d a t a b u s d i r e c t i o n r e g i s t e r p o r t l a t c h s u b - c l o c k ( x c i n - x c o u t ) s t o p b i t i n t 0 , i n t 1 i n t e r r u p t i n p u t ( 6 ) p o r t p 5 0 d a t a b u s d i r e c t i o n r e g i s t e r p o r t l a t c h x c i n i n p u t d a t a b u s d i r e c t i o n r e g i s t e r p o r t l a t c h rev.1.00 jul 30, 2003 page 17 of 119 7643 group fig. 13 port block diagram (2) (7) port p5 1 data bus direction register port latch t out output control bit timer 1, 2 output (9) port p6 (8) port p5 2 to p5 7 (10) port p7 0 x cout output x cout oscillation drive disable bit sub-clock (x cin -x cout ) stop bit d ata bus direction register port latch data bus direction register port latch data bus direction register port latch rev.1.00 jul 30, 2003 page 18 of 119 7643 group fig. 14 port block diagram (3) hold hlda (11) port p7 1 data bus direction register port latch hold function enable bit hold function enable bit (13) port p7 3 hold function enable bit (15) port p8 0 direction register port latch d ata bus srdy output select bit (serial i/o) spi mode select bit (serial i/o) spi mode select bit control for spi compatible mode (12) port p7 2 (14) port p7 4 (16) port p8 1 data bus direction register port latch (serial i/o) internal synchronous clock select bits serial i/o port select bit (serial i/o) internal synchronous clock select bits serial i/o clock input serial i/o clock output data bus direction register port latch data bus direction register port latch data bus direction register port latch srdy output rev.1.00 jul 30, 2003 page 19 of 119 7643 group fig. 15 port block diagram (4) (17) port p8 2 d ata bus direction register port latch (serial i/o) srxd input enable bit port latch (serial i/o) srxd input (19) port p8 4 data bus port latch direction register (uart) transmit enable bit (uart) utxd output (21) port p8 6 data bus direction register (uart) cts function enable bit port latch (uart) cts input (18) port p8 3 data bus direction register port latch transmit completed signal serial i/o port select bit stxd output channel control bit (serial i/o) stxd output (20) port p8 5 data bus direction register port latch (uart) receive enable bit (uart) urxd input (22) port p8 7 data bus direction register (uart) rts function enable bit port latch (uart) rts output rev.1.00 jul 30, 2003 page 20 of 119 7643 group interrupts there are fourteen interrupt sources: three externals, ten internals, and one software. interrupt control each interrupt except the brk instruction interrupt has both an inter- rupt request bit and an interrupt enable bit, and is controlled by the interrupt disable flag (i). an interrupt occurs if the corresponding interrupt request and enable bits are ??and the interrupt disable flag is ?? interrupt enable bits can be set or cleared by software. interrupt re- quest bits can be cleared by software, but cannot be set by software. additionally, an active edge of int 0 and int 1 can be selected by using the interrupt polarity select register (address 0011 16 ). the brk instruction interrupt and reset cannot be disabled with any flag or bit. the i flag disables all interrupts except the brk instruc- tion interrupt and reset. if several interrupts requests occur at the same time, the interrupt with the highest priority is accepted first. interrupt operation when an interrupt request occurs, the following operations are auto- matically performed: 1. the processing being executed is stopped. 2. the contents of the program counter and processor status reg- ister are automatically pushed onto the stack. 3. the interrupt disable flag is set and the corresponding in- terrupt request bit is cleared. 4. the interrupt jump destination address is read from the vector table into the program counter. notes when setting the followings, the interrupt request bit may be set to ?? ?hen setting external interrupt active edge related register: interrupt polarity select register (address 0011 16 ) when not requiring for the interrupt occurrence synchronized with these setting, take the following sequence. ? set the corresponding interrupt enable bit to ??(disabled). ? set the interrupt polarity select bit (active edge switch bit). ? set the corresponding interrupt request bit to ??after 1 or more instructions have been executed. ? set the corresponding interrupt enable bit to ??(enabled). fig. 16 interrupt control i n t e r r u p t r e q u e s t b i t i n t e r r u p t e n a b l e b i t i n t e r r u p t d i s a b l e f l a g ( i ) b r k i n s t r u c t i o n r e s e t i n t e r r u p t r e q u e s t rev.1.00 jul 30, 2003 page 21 of 119 7643 group interrupt source reset (note 3) usb function reserved area int 0 int 1 dmac0 dmac1 uart receive buffer full uart transmit uart summing error reserved area reserved area reserved area reserved area reserved area timer 1 timer 2 timer 3 reserved area reserved area serial i/o reserved area reserved area key input (key- on wake-up) brk instruction priority 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 vector addresses (note 1) high fffb 16 fff9 16 fff7 16 fff5 16 fff3 16 fff1 16 ffef 16 ffed 16 ffeb 16 ffe9 16 ffe7 16 ffe5 16 ffe3 16 ffe1 16 ffdf 16 ffdd 16 ffdb 16 ffd9 16 ffd7 16 ffd5 16 ffd3 16 ffd1 16 ffcf 16 ffcd 16 ffcb 16 interrupt request generating conditions at reset ( note 2 ) not used at detection of either rising or falling edge of int 0 intput at detection of either rising or falling edge of int 1 input at completion of dmac0 transfer at completion of dmac1 transfer at completion of uart reception at completion of uart transmission at detection of uart summing error not used not used not used not used not used at timer 1 underflow at timer 2 underflow at timer 3 underflow not used not used at completion of serial i/o transmission/reception not used not used at falling of port p2 input logical level and at brk instruction execution remarks non-maskable external interrupt (active edge selectable) external interrupt (active edge selectable) low fffa 16 fff8 16 fff6 16 fff4 16 fff2 16 fff0 16 ffee 16 ffec 16 ffea 16 ffe8 16 ffe6 16 ffe4 16 ffe2 16 ffe0 16 ffde 16 ffdc 16 ffda 16 ffd8 16 ffd6 16 ffd4 16 ffd2 16 ffd0 16 ffce 16 ffcc 16 ffca 16 notes 1 : vector addresses contain interrupt jump destination addresses. 2 : usb function interrupt occurs owing to an interrupt request of the endpoint x (x = 0 to 2) in, endpoint x (x = 1, 2) out, usb reset or suspend/resume. 3 : reset functions in the same way as an interrupt with the highest priority. table 7 interrupt vector addresses and priority external interrupt (falling valid) non-maskable software interrupt rev.1.00 jul 30, 2003 page 22 of 119 7643 group fig. 17 structure of interrupt-related registers interrupt request register a (address 0002 16 ) ireqa usb function interrupt request bit reserved bit (undefined at read, ??at write) int 0 interrupt request bit int 1 interrupt request bit dmac0 interrupt request bit dmac1 interrupt request bit uart receive buffer full interrupt request bit uart transmit interrupt request bit b7 b0 interrupt polarity select register (address 0011 16 ) ipol int 0 interrupt edge select bit int 1 interrupt edge select bit reserved bits (??at read/write) 0 : falling edge active 1 : rising edge active b7 b0 0 : interrupts disabled 1 : interrupts enabled 0 : no interrupt request issued 1 : interrupt request issued interrupt request register b address (address 0003 16 ) ireqb uart summing error interrupt request bit reserved bit (undefined at read, ??at write) reserved bit (undefined at read, ??at write) reserved bit (undefined at read, ??at write) reserved bit (undefined at read, ??at write) reserved bit (undefined at read, ??at write) timer 1 interrupt request bit timer 2 interrupt request bit b7 b0 0 : no interrupt request issued 1 : interrupt request issued interrupt control register a (address 0005 16 ) icona usb function interrupt enable bit reserved bit (??at read/write) int 0 interrupt enable bit int 1 interrupt enable bit dmac0 interrupt enable bit dmac1 interrupt enable bit uart receive buffer full interrupt enable bit uart transmit interrupt enable bit b7 b0 interrupt request register c (address 0004 16 ) ireqc timer 3 interrupt request bit reserved bit (undefined at read, ??at write) reserved bit (undefined at read, ??at write) serial i/o interrupt request bit reserved bit (undefined at read, ??at write) reserved bit (undefined at read, ??at write) key input interrupt request bit reserved bit (??at read/write) b7 b0 0 : no interrupt request issued 1 : interrupt request issued interrupt control register b (address 0006 16 ) iconb uart summing error interrupt enable bit reserved bit (??at read/write) timer 1 interrupt enable bit timer 2 interrupt enable bit b7 b0 0 : interrupts disabled 1 : interrupts enabled interrupt control register c (address 0007 16 ) iconc timer 3 interrupt enable bit reserved bit (??at read/write) reserved bit (??at read/write) serial i/o interrupt enable bit reserved bit (??at read/write) reserved bit (??at read/write) key input interrupt enable bit reserved bit (??at read/write) b7 b0 0 : interrupts disabled 1 : interrupts enabled 0 000000 0 0 00 00 00 00 0 rev.1.00 jul 30, 2003 page 23 of 119 7643 group key input interrupt (key-on wake-up) a key input interrupt request is generated by applying ??level to any pin of port p2 that have been set to input mode. in other words, it is generated when and of input level goes from ??to ?? an example of using a key input interrupt is shown in figure 18, where an inter- rupt request is generated by pressing one of the keys consisted as an active-low key matrix which inputs to ports p2 0 ?2 4 . fig. 18 connection example when using key input interrupt and port p2 block diagram ?? ? p o r t p 2 7 l a t c h p o r t p 2 7 d i r e c t i o n r e g i s t e r = 1 p 2 7 o u t p u t p o r t p 2 p u l l - u p c o n t r o l r e g i s t e r b i t 7 = 0 p o r t p x x l l e v e l o u t p u t k e y i n p u t i n t e r r u p t r e q u e s t f a l l i n g e d g e d e t e c t o r p 2 6 o u t p u t p 2 5 o u t p u t p 2 4 i n p u t p 2 3 i n p u t p 2 2 i n p u t p 2 1 i n p u t p 2 0 i n p u t ?? ? p o r t p 2 6 l a t c h p o r t p 2 6 d i r e c t i o n r e g i s t e r = 1 p o r t p 2 p u l l - u p c o n t r o l r e g i s t e r b i t 6 = 0 f a l l i n g e d g e d e t e c t o r ??? p o r t p 2 5 l a t c h p o r t p 2 5 d i r e c t i o n r e g i s t e r = 1 p o r t p 2 p u l l - u p c o n t r o l r e g i s t e r b i t 5 = 0 f a l l i n g e d g e d e t e c t o r ??? p o r t p 2 4 l a t c h p o r t p 2 4 d i r e c t i o n r e g i s t e r = 0 p o r t p 2 p u l l - u p c o n t r o l r e g i s t e r b i t 4 = 0 f a l l i n g e d g e d e t e c t o r ?? ? p o r t p 2 3 l a t c h p o r t p 2 3 d i r e c t i o n r e g i s t e r = 0 p o r t p 2 p u l l - u p c o n t r o l r e g i s t e r b i t 3 = 0 f a l l i n g e d g e d e t e c t o r ?? ? p o r t p 2 2 l a t c h p o r t p 2 2 d i r e c t i o n r e g i s t e r = 0 p o r t p 2 p u l l - u p c o n t r o l r e g i s t e r b i t 2 = 0 f a l l i n g e d g e d e t e c t o r ?? ? p o r t p 2 1 l a t c h p o r t p 2 1 d i r e c t i o n r e g i s t e r = 0 p o r t p 2 p u l l - u p c o n t r o l r e g i s t e r b i t 1 = 0 f a l l i n g e d g e d e t e c t o r ?? ? p o r t p 2 0 l a t c h p o r t p 2 p u l l - u p c o n t r o l r e g i s t e r b i t 0 = 0 f a l l i n g e d g e d e t e c t o r p o r t p 2 0 d i r e c t i o n r e g i s t e r = 0 p o r t p 2 i n p u t r e a d i n g c i r c u i t ? p - c h a n n e l t r a n s i s t o r f o r p u l l - u p c m o s o u t p u t b u f f e r rev.1.00 jul 30, 2003 page 24 of 119 7643 group timers the 7643 group has three 8-bit timers: timer 1, timer 2, and timer 3. all timers are down count timers. when the timer reaches ?0 16 ? an underflow occurs at the next count pulse and the correspond- ing timer latch is reloaded into the timer and the count is continued. when a timer underflows, the interrupt request bit cor- responding to that timer is set to ?? fig. 19 timer block diagram p 5 1 /t out /x cout timer 1 interrup t request timer 2 interrup t request timer 3 interrup t request timer 1 count source select bit ? ? / 8 f(x cin ) / 2 timer 1 count stop bit timer 1 latch (8) timer 1 (8) timers 1, 2 write control bit timers 1, 2 write control bit ? ? timer 2 count source select bit timer 2 latch (8) timer 2 (8) t out output control bit ? ? t out output active edge switch bit t out output control bit t out source select bit q t q q t q q t q q t q t out output control bit ? ? t out output active edge switch bit / 8 timer 3 count source select bit timer 3 latch (8) timer 3 (8) ? ? data bus rev.1.00 jul 30, 2003 page 25 of 119 7643 group timer 1, timer 2, timer 3 timer 1, timer 2, and timer 3 are 8-bit timers. the count source for each timer can be selected by timer 123 mode register. timers 1, 2 write control when the timers 1, 2 write control bit is ??and the values are written in the address of timers 1 and 2, the values are loaded only in their latches. the values in the latches are loaded in timers 1 and 2 after timers 1 and 2 underflow. when the timers 1, 2 write control bit is ??and the values are written in the address of timers 1 and 2, the values are loaded in the timers 1 and 2 and their latches at the same time. timers 1, 2 output control a signal of which polarity is inverted each time the timer selected by the t out factor select bit underflows is output from the t out pin. this is enabled by setting the t out output control bit to ?? when the t out output active edge switch bit is ?? the t out pin starts pulses output beginning at ?? when this bit is ?? the t out pin starts pulses output beginning at ?? when using a timer in this mode, set the port p5 1 direction regis- ter to output mode. notes timer 1 to timer 3 switching of the count sources of timers 1 to 3 does not affect the values of reload latches. however, that may make count operation started. therefore, write values again in the order of timers 1, 2 and then timer 3 after their count sources have been switched. timers 1, 2 write control when the value is to be written in latch only, unexpected value may be set in the timer if the writing in the latch and the timer un- derflow are performed at the same timing. fig. 20 structure of timer 123 mode register t i m e r 1 2 3 m o d e r e g i s t e r ( a d d r e s s 0 0 2 9 1 6 ) t 1 2 3 m t o u t f a c t o r s e l e c t b i t 0 : t i m e r 1 o u t p u t 1 : t i m e r 2 o u t p u t t i m e r 1 c o u n t s t o p b i t 0 : c o u n t s t a r t 1 : c o u n t s t o p t i m e r 1 c o u n t s o u r c e s e l e c t b i t 0 : / 8 1 : f ( x c i n ) / 2 t i m e r 2 c o u n t s o u r c e s e l e c t b i t 0 : t i m e r 1 o u t p u t 1 : t i m e r 3 c o u n t s o u r c e s e l e c t b i t 0 : t i m e r 1 o u t p u t 1 : / 8 t o u t o u t p u t a c t i v e e d g e s w i t c h b i t 0 : s t a r t a t h o u t p u t 1 : s t a r t a t l o u t p u t t o u t o u t p u t c o n t r o l b i t 0 : t o u t o u t p u t d i s a b l e d 1 : t o u t o u t p u t e n a b l e d t i m e r s 1 , 2 w r i t e c o n t r o l b i t 0 : w r i t e v a l u e i n l a t c h a n d c o u n t e r 1 : w r i t e v a l u e i n l a t c h o n l y b 0 b 7 rev.1.00 jul 30, 2003 page 26 of 119 7643 group serial i/o the serial i/o can be used only for clock synchronous serial i/o. the transmitter and the receiver must use the same clock. if the internal clock is used, transfer is started by a write signal to the serial i/o shift register. [serial i/o control register 1 (siocon1)] 002b 16 [serial i/o control register 2 (siocon2)] 002c 16 each of the serial i/o control registers 1 and 2 contains eight bits which control various serial i/o functions. fig. 21 structure of serial i/o control registers 1, 2 serial i/o control register 1 (address 002b 16 ) siocon1 internal synchronous clock select bits ( note 1 ) b2b1b0 0 0 0: internal clock divided by 2 0 0 1: internal clock divided by 4 0 1 0: internal clock divided by 8 0 1 1: internal clock divided by 16 1 0 0: internal clock divided by 32 1 0 1: internal clock divided by 64 1 1 0: internal clock divided by 128 1 1 1: internal clock divided by 256 serial i/o port select bit 0: i/o port 1: stxd, sclk signal output srdy output select bit 0: i/o port 1: srdy signal output transfer direction select bit 0: lsb first 1: msb first synchronous clock select bit 0: external clock 1: internal clock stxd output channel control bit 0: cmos output 1: n-channel open drain output n otes 1 : the source of serial i/o internal synchronous clock can be selected by bit 1 of serial i/o control register 2. 2 : to set the slave mode, also set bit 4 of serial i/o control register 1 to ?? b0 b7 serial i/o control register 2 (address 002c 16 ) siocon2 spi mode select bit 0: normal serial i/o mode 1: spi compatible mode ( note 2 ) reserved bit (??at read/write) srxd input enable bit 0: srxd input disabed 1: srxd input enabed clock polarity select bit (cpol) 0: sclk starting at ? 1: sclk starting at ? clock phase select bit (cpha) 0: serial transfer starting at falling edge of srdy 1: serial transfer starting afer a half cycle of sclk passed at falling edge of srdy reserved bits (??at read/write) b0 b7 000 0 rev.1.00 jul 30, 2003 page 27 of 119 7643 group fig. 22 block diagram of serial i/o 1/2 1/4 1/8 1/16 1/32 1/64 1/128 1/256 p8 1 /sclk p8 3 /stxd p8 2 /srxd p8 0 /srdy data bus internal synchronous clock selection bits ? ? serial i/o interrupt request synchronization circuit synchronous clock select bit srdy output select bit external clock p8 0 latch ? ? serial i/o counter (3) serial i/o shift register (8) spi mode select bit p8 1 latch ? ? serial i/o port select bit p8 3 latch ? ? serial i/o port select bit ? ? srxd input enable bit divider rev.1.00 jul 30, 2003 page 28 of 119 7643 group serial i/o normal operation the serial i/o counter is set to ??by writing operation to the serial i/o shift register (address 002a 16 ). when the srdy output select bit is ?? the srdy pin goes ??after that writing. on the negative edge of the transfer clock the srdy pin returns ??and the data of the first bit is transmitted from the stxd pin. the remaining data are done from the stxd pin bit by bit on each falling edge of the transfer clock. additionally, the data is latched from the srxd pin on each rising edge of the transfer clock and then the contents of the serial i/o shift register are shifted by one bit. when the internal system clock is selected as the transfer clock, the followings occur at counting eight transfer clocks: ?he serial i/o counter reaches ? ?he transfer clock halts at ? ?he serial i/o interrupt request bit is set to ? ?he stxd pin goes a high-impedance state after an 8-bit transfer is completed. when the external clock is selected as the transfer clock, the fol- lowings occur at counting eight transfer clocks: ?he serial i/o counter reaches ? ?he serial i/o interrupt request bit is set to ? in this case, the transfer clock needs to be controlled by the exter- nal source because the transfer clock does not halt. additionally, the stxd pin does not go a high-impedance state after an 8-bit transfer is completed. figure 23 shows serial i/o timing. fig. 23 serial i/o timing d 1 d 0 d 2 d 3 d 4 d 5 d 6 d 7 first last stxd/srxd synchronizing clock sclk (cpol = 1, cpha =1 ) sclk (cpol = 0, cpha = 1) sclk (cpol = 1, cpha = 0) sclk (cpol = 0, cpha = 0) normal mode timing (lsb first) transfer clock synchronizing clock serial i/o shift register write signal srdy signal serial i/o output stxd serial i/o input srxd (note) interrupt request bit is set to ?? note : when the internal clock is selected as the transfer clock, the stxd pin goes to a high-impedance state after transfer complet ion. spi compatible mode timing srdy signal rev.1.00 jul 30, 2003 page 29 of 119 7643 group spi compatible mode operation setting the spi mode select bit (bit 0 of siocon2) puts the serial i/o in spi compatible mode. the synchronous clock select bit (bit 6 of siocon1) determines whether the serial i/o is an spi master or slave. when the external clock is selected (??, the se- rial i/o is in slave mode; when the internal clock is selected (??, the serial i/o is in master mode. in spi compatible mode the srxd pin functions as a miso (mas- ter in/slave out) pin and the stxd pin functions as a mosi (master out/slave in) pin. in slave mode the transmit data is output from the miso pin and the receive data is input from the miso pin. the srdy pin func- tions as the chip-select signal input pin from an external. in master mode the transmit data is output from the mosi pin and the receive data is input from the miso pin. the srdy pin func- tions as the chip-select signal output pin to an external. slave mode operation in slave mode of spi compatible mode 4 types of clock polarity and clock phase can be usable by bits 3 and 4 of serial i/o control register 2. if the srdy pin is held ?? the shift clock is inhibited, the serial i/ o counter is set to ?? if the srdy pin is held ?? then the shift clock will start. make sure during transfer to maintain the srdy input at ??and not to write data to the serial i/o counter. figure 23 shows the serial i/o timing. rev.1.00 jul 30, 2003 page 30 of 119 7643 group uart twelve serial data transfer formats can be selected, and the trans- fer formats used by a transmitter and receiver must be identical. the transmit and receive shift registers each have a buffer, but the two buffers have the same address in a memory. since the shift register cannot be written to or read from directly, transmit data is written to the transmit buffer register, and receive data is read from the receive buffer register. the transmit buffer register can also hold the next data to be transmitted, and the receive buffer register can hold a character while the next character is being received. the transfer speed (baud rate) is expression as follows: transfer speed (baud rate) = fi / {(n + 1) ? 16 } n: the contents of uart baud rate generator fi: using uart clock prescaling select bits, select any one of , /8, /32, /256 oer per fer 0034 16 0035 16 receive buffer register 1 receive buffer register 2 receive shift register 1 receive shift register 2 address 0030 16 uart mode register uart control register address 0033 16 receive buffer full flag (rbf) receive buffer full interrupt request (urbf) receive summing error interrupt request (ues) spdetector uart character length select bits 7 bits 8 bits 9 bits st detector p8 5 /u rxd p8 4 /utxd prescaler 1/1 1/8 1/32 1/256 baud rate generator st/sp/pa generator clock control circuit 1/16 p8 6 /cts rts control register p8 7 /rts frequency division ratio 1/(n+1) addresses 0036 16 addresses 0031 16 character length select bit transmit shift register 1 transmit shift register 2 transmit buffer register 1 transmit buffer register 2 transmit comple flag (tcm) transmit interrupt source select bit transmit interrupt request (utx) transmit buffer empty flag (tbe) uart status register data bus data bus uart clock prescaling select bits 0034 16 0035 16 address 0032 16 fig. 24 uart block diagram rev.1.00 jul 30, 2003 page 31 of 119 7643 group cts (clear-to-send) function as a transmitter, the uart can be configured to recognize the _______ clear-to-send (cts) input as a handshaking signal. this is en- abled by setting the cts function enable bit (bit 5 of ucon) to ?? if cts function is enabled, even when transmission is enabled and the uart transmit buffer register is filled with the data, the transmission never starts; but it will start when inputting ??to the _______ cts pin. figures 25 and 26 show the uart transmit timings. utxd output (p8 4 /utxd) d 0 d 1 sp st d 2 d 3 d 4 d 5 d 6 d 7 p st sp d 0 d 1 d 2 d 3 d 4 d 5 d 6 d 7 p cts pin (p8 6 /cts) transfer clock tranmit enable bit transmit buffer empty flag transmit complete flag data set into uart transmit buffer register 1 data transferring from uart transmit buffer register 1 to transmit shift register 1 halt due to cts = ? halt due to tranmit enable bit = ? this timing applying to the conditions: ?haracter length = 8 bits ?arity enabled ? stop bit uart receive operation reception is enabled when the receive enable bit is ?? detec- tion of the start bit makes transfer clocks generated and the data reception starts in the lsb first. when using 9-bit character length, read the received data from the uart receive buffer register 2 (high-order byte) first before the uart receive buffer register 1 (low-order byte). reception requires the following setup: (1) define a baud rate by setting a value n (n = 0 to 255) into uart baud rate generator (addresses 0031 16 ). (2) set the receive initialization bit (bit 3 of ucon) to ?? (3) configure the data format and clock selection by setting the uart mode register. (4) set the rts function enable bit (bit 5 of ucon) if rts func- tion will be used. (5) set the receive enable bit (bit 1 of ucon) to ?? _______ fig. 25 uart transmit timing (cts function enabled) uart transmit operation transmission starts when the transmit enable bit is ??and the transmit buffer empty flag is ?? additionally, when cts function enabled, the cts pin must be ??to be started. the data in which start bit and stop bit or parity bit are also added is transmitted from the low-order byte sequentially. when using 9-bit character length, set the data into the uart transmit buffer register 2 (high- order byte) first before the uart transmit buffer register 1 (low-order byte). once the transmission starts, the transmit enable bit, the trans- _______ mit buffer empty flag and the cts pin state (when this is enabled) could not be checked until the transmission in progress has ended. transmission requires the following setup: (1) define a baud rate by setting a value n (n = 0 to 255) into uart baud rate generator (addresses 0031 16 ). (2) set the transmit initialization bit (bit 2 of ucon) to ?? this will set the uart status register to ?3 16 ? (3) select the interrupt source with the transmit interrupt source select bit (bit 4 of ucon). (4) configure the data format and clock selection by setting the uart mode register. (5) set the cts function enable bit (bit 5 of ucon) if cts func- tion will be used. (6) set the transmit enable bit (bit 0 of ucon) to ?? if updating a value of uart baud rate generator while the data is being transmitted, be sure to disable the transmission before up- dating. if the former data remains in the uart transmit buffer registers 1 and 2 at retransmission, an undefined data might be output. rev.1.00 jul 30, 2003 page 32 of 119 7643 group utxd output (p8 4 /utxd) d 0 d 1 sp st d 2 d 3 d 4 d 5 d 6 d 7 p sp transfer clock tranmit enable bit transmit buffer empty flag transmit complete flag d 0 d 1 d 2 d 3 d 4 d 5 d 6 d 7 st p d 0 d 1 st data set into uart transmit buffer register 1 data transferring from uart transmit buffer register 1 to transmit shift register 1 this timing applies to the conditions: ?haracter length = 8 bits ?arity enabled ? stop bit rts (request-to-send) function as a receiver, the uart can be configured to generate the re- _______ quest-to-send (rts) handshaking signal. this is enabled by setting the rts function enable bit (bit 6 of ucon) to ?? when reception is enabled, that is the receive enable bit is ?? the rts pin goes ??to inform a transmitter that reception is pos- _______ sible. the rts pin goes ??at reception starting and does ??at receiving of the last bit. the delay time from the reception of the last stop bit to the asser- _______ tion of rts is selectable using the rts assertion delay count select bits. brg count source d 0 urxd (p8 5 /urxd) st sp d 1 d 7 rts pin (p8 7 /rts) receive enable bit receive buffer empty flag transfer clock transfer clock generated at falling edge of start bit and receive started receive data latched data transferring from uart receive register 1 to receive buffer register 1 ( note ) note: when no rts assertion delay, the rts pin goes ?? the rts assertion delay counts are selected by bits 4 to 7 of uart rts control register. this timing applies to the conditions: ?haracter length = 8 bits ?arity enabled ? stop bit _______ fig. 26 uart transmit timing (cts function disbled) when the receive enable bit is set to ??or the receive initializa- _______ tion bit is set to ?? the rts pin goes ?? even when the receive _______ enable bit is set to ?? the rts pin goes ??if detecting an invalid start bit. figure 27 shows the uart receive timing. _______ fig. 27 uart receiving timing (rts function enabled) rev.1.00 jul 30, 2003 page 33 of 119 7643 group uart address mode the uart address mode is intended for use to communicate be- tween the specified mcus in a multi-mcu environment. the uart address mode can be used in either an 8-bit or 9-bit char- acter length. an address is identified by the msb of the incoming data being ?? the bit is ??for non-address data. when the msb of the incoming data is ??in the uart address mode, the receive buffer full flag is set to ?? but the receive buffer full interrupt request bit is not set to ?? when the msb of the incoming data is ?? normal receive operation is performed. in the uart address mode an overrun error is not detected for re- ception of the 2nd and onward bytes. an occurrence of framing error or parity error sets the summing error interrupt request bit to ??and the data is not received independent of its msb con- tents. usage of uart address mode is explained as follows: (1) set the uart address mode enable bit to ?? (2) sends the address data of a slave mcu first from a host mcu to all slave mcus. the msb of address data must be ??and the remaining 7 bits specify the address. (3) the all slave mcus automatically check for the received data whether its stop bit is valid or not, and whether the parity error occurs or not (when the parity enabled). if these errors occur, the framing error flag or parity error flag and the summing error flag are set to ?? then, the summing error interrupt request bit is also set to ?? (4) when received data has no error, the all slave mcus must judge whether the address of the received address data matches with their own addresses by a program. after the msb being ??is received, the uart address mode enable bit is automatically set to ??(disabled). (5) the uart address mode enable bit of the slave mcus which have be judged that the address does not match with them must be set to ??(enabled) again by a program to disable re- ception of the following data. (6) transmit the data of which msb is ??from the host mcu. the slave mcus disabling the uart address mode receive the data, and their receive buffer full flags and the receive buffer full interrupt request bits are set to ?? for the other slave mcus enabling the uart address mode, their receive buffer full flag are set to ?? but their receive buffer full in- terrupt request bits are not set to ?? (7) an overrun error cannot be detected after the first data has been received in uart address mode. accordingly, even if the slave mcus does not read the received data and the next data has been received, an overrun error does not occur. thus, a communication between a host mcu and the specified mcu can be realized. [uart mode register (umod)] 0030 16 the uart mode register consists of 8 bits which set a transfer data format and an used clock. [uart baud rate generator (ubrg)] 0031 16 the uart baud rate generator determines the baud rate for trans- fer. the baud rate generator divides the frequency of the count source by 1/(n + 1), where n is the value written to the baud rate genera- tor. the reset cannot affect the contents of baud rate generator. [uart status register (usts)] 0032 16 the read-only uart status register consists of seven flags (bits 0 to 6) which indicate the uart operating status and various errors. when the uart address mode is enabled , the setting and clear- ing conditions of each flag differ from the following explanations. these differences are explained in section uart address mode ? transmit complete flag (tcm) in the case where no data is contained in the transmit buffer reg- ister, the transmit complete flag (tcm) is set to ??when the last bit in the transmit shift register is transmitted. the tcm flag is also set to ??at reset or initialization by setting the transmit initialization bit (bit 2 of ucon). it is set to ??when transmission starts, and it is kept during the transmission. transmit buffer empty flag (tbe) the transmit buffer empty flag (tbe) is set to ??when the con- tents of the transmit buffer register are loaded into the transmit shift register. the tbe flag is also set ??at the hardware reset or initialization by setting the transmit initialization bit. it is set to ? when a write operation is performed to the low-order byte of the transmit buffer register. receive buffer full flag (rbf) the receive buffer full flag (rbf) is set to ??when the last stop bit of the data is received. the rbf flag is set to ??when the low- order byte of the receive buffer register is read, at the hardware reset or initialization by setting the transmit initialization bit. receive errors if there is an error, it is detected at the same time that data is transferred from the receive shift register to the receive buffer reg- ister, and the receive buffer full flag is set to ?? the all error flags per, fer, oer and ser are cleared to ??when the uart status register is read, at the hardware reset or initialization by setting the transmit initialization bit. the summing error flag (ser) is set to ??when any one of the per, fer and oer is set to ?? the parity error flag (per) is set to ??when the sum total of 1s of received data and the parity does not correspond with the se- lection with the parity select bit (pmd). it is enabled only if the parity enable bit (bit 5 of umod) is set to ?? rev.1.00 jul 30, 2003 page 34 of 119 7643 group the framing error flag (fer) is set to ??when the number of stop bit of the received data does not correspond with the selec- tion with the stop bit length select bit (stb). the overrun flag flag (oer) is set to ??if the previous data in the low-order byte of the receive buffer register 1 (addresses 0034 16 ) is not read before the current receive operation is com- pleted. it is also set ??if any one of error flags is ??for the previous data and the current receive operation is completed. be sure to read uart status register to clear the error flags before the next reception has been completed. [uart control register (ucon)] 0033 16 the uart control register consists of eight control bits for the uart function. this register can enable the cts, rts and uart address mode. if the transmit enable bit (ten) is set to ??(disabled) while a data is being transmitted, the transmitting operation will stop after the data has been transmitted. if the receive enable bit (ren) is set to ??(diabled) while a data is being received, the receiving operation will stop after the data has been received. when setting the transmit initialization bit (tin) to ?? the ten bit is set to ??and the uart status register will be set to ?3 16 ?after the data has been transmitted. to retransmit, set the ten to ? and set a data to the transmit buffer register again. the tin bit will be cleared to ??one cycle later after the tin bit has been set to ?? setting the receive initialization bit (rin) to ??sets all of the ren, rbf and the receive error flags (per, fer, oer, ser) to ?? the rin bit will be cleared to ??one cycle later after the rin bit has been set to ?? _______ _______ _______ _______ when cts or rts function is disabled, pins cts and rts can be used as ordinary i/o ports, correspondingly. [uart transmit/receive buffer registers 1, 2 (utrb1/ utrb2)] 0034 16 , 0035 16 the transmit buffer register and the receive buffer register are lo- cated at the same address. the transmit buffer register is write-only and the receive buffer register is read-only. if a charac- ter bit length is 7 bits, the msb of received data is invalid. if a character bit length is 7 or 8 bits, the received contents of utrb2 are also invalid. if a character bit length is 9 bits, the received high-order 7 bits of utrb2 are ?? [uart rts control register (urts)] 0036 16 the delay time from the reception of the last stop bit to the asser- _______ _______ tion of rts is selectable using the rts assertion delay count _______ select bits. if the stop bit is detected before rts assertion delay _______ _______ time has expired, the rts pin is kept ?? the rts assertion de- lay count starts after the last data reception is completed. setting the rin bit to ??resets the urts. after setting the rin bit to ?? set this urts. rev.1.00 jul 30, 2003 page 35 of 119 7643 group fig. 28 structure of uart related registers uart mode register (addresses 0030 16 ) umod reserved bit (??at read/write) uart clock prescaling select bits (ps) b2b1 0 0: uart clock divided by 1 0 1: uart clock divided by 8 1 0: uart clock divided by 32 1 1: uart clock divided by 256 stop bit length select bit (stb) 0: 1 stop bit 1: 2 stop bits parity select bit (pmd) 0: even parity 1: odd parity parity enable bit (pen) 0: parity checking disabled 1: parity checking enabled uart character length select bit b7b6 0 0: 7 bits 0 1: 8 bits 1 0: 9 bits 1 1: not available b0 b7 uart control register (addresses 0033 16 ) ucon transmit enable bit (ten) 0: transmit disabled 1: transmit enabled receive enable bit (ren) 0: receive disabled 1: receive enabled transmit initialization bit (tin) 0: no action. 1: initializing receive initialization bit (rin) 0: no action. 1: initializing transmit interrupt source select bit (tis) 0: interrupt when transmit buffer has emptied 1: interrupt when transmit shift operation is completed cts function enable bit (cts_sel) 0: cts function disabled 1: cts function enabled rts function enable bit (rts_sel) 0: rts function disabled 1: rts function enabled uart address mode enable bit (ame) 0: address mode disabled 1: address mode enabled b0 b7 uart status register (addresses 0032 16 ) usts transmit complete flag (tcm) 0: transmit shift in progress 1: transmit shift completed transmit buffer empty flag (tbe) 0: buffer full 1: buffer empty receive buffer full flag (rbf) 0: buffer empty 1: buffer full parity error flag (per) 0: no error 1: parity error framing error flag (fer) 0: no error 1: framing error overrun error flag (oer) 0: no error 1: overrun error summing error flag (ser) 0: (fer) u (oer) u (ser) = 0 1: (fer) u (oer) u (ser) = 1 reserved bits (??at read/write) b0 b7 uart rts control register (addresses 0036 16 ) urtsc reserved bits (??at read/write) rts assertion delay count select bits b7 b6 b5 b4 0 0 0 0 : no delay; assertion immediately 0 0 0 1 : 8-bit term assertion at ? 0 0 1 0 : 16-bit term assertion at ? 0 0 1 1 : 24-bit term assertion at ? 0 1 0 0 : 32-bit term assertion at ? 0 1 0 1 : 40-bit term assertion at ? 0 1 1 0 : 48-bit term assertion at ? 0 1 1 1 : 56-bit term assertion at ? 1 0 0 0 : 64-bit term assertion at ? 1 0 0 1 : 72-bit term assertion at ? 1 0 1 0 : 80-bit term assertion at ? 1 0 1 1 : 88-bit term assertion at ? 1 1 0 0 : 96-bit term assertion at ? 1 1 0 1 : 104-bit term assertion at ? 1 1 1 0 : 112-bit term assertion at ? 1 1 1 1 : 120-bit term assertion at ? b0 b7 0 0 0 0 0 rev.1.00 jul 30, 2003 page 36 of 119 7643 group fig. 29 dmacx (x = 0, 1) block diagram dmac the 7643 group is equipped with 2 channels of dmac (direct memory access controller) which enable high speed data transfer from a memory to a memory without use of the cpu. the dmac initiates the data transfer with an interrupt factor speci- fied by the dmac channel x (x = 0, 1) hardware transfer request source bit (dxcen), or with a software trigger. the dxtms [dma channel x (x = 0, 1) transfer mode selection bit] selects one of two transfer modes; cycle steal mode or burst transfer mode. in the cycle steal mode, the dmac transfers one byte of data for each request. in the burst transfer mode, the dmac transfers the number of bytes data specified by the transfer count register for each request. the count register is a 16-bit counter; the maximum number of data is 65,536 bytes per one re- quest. figure 29 shows the dma control block diagram and figure 30 shows the structure of dmac related registers. [dmac index and status register] dmais the dmac index and status register consists of various control bits for the dmac and its status flags. the dma channel index bit (dci) selects which channel ( 0 or 1) will be accessed, since the mode registers, source registers, des- tination registers and transfer count register of both dmac channels share the same sfr addresses, respectively. [dmac channel x (x = 0, 1) mode registers 1, 2] dmaxm1, dmaxm2 the 16 bits of dmac channel x mode registers 1 and 2 control each operation of dmac channels 0 and 1. when the dmac channel x (x = 0, 1) write bit (dxdwc) is ?? data is simultaneously written into each latch and register of the source registers, destination register, and transfer count reg- isters. when this bit is ?? data is written only into their latches. when data is read from each register, it must be read from the higher bytes first, then the lower bytes. when writing data, write to the lower bytes first, then the higher bytes. interrupt : uart receive, uart transmit, serial i/o, int 0 signal : ep (endpoint) 1 receive/transmit ep (endpoint) 2 receive/transmit ep1out fifo data existing interrupt : int 1 , timer 1 signal : ep (endpoint) 1 receive/transmit ep (endpoint) 2 receive/transmit ep1out fifo data existing case of dmac channel 0 case of dmac channel 1 dmac channel x channel x timing generator channel x transfer source register channel x transfer destination register channel x transfer count register interrupt generator dmacx interrupt request address bus dxcen dxcrr dxswt dxhrs2 dxhrs1 dxhrs0 dxsrce dxsrid dxrld drldd dxdrce dxdrid dxrld drldd interrupt disable flag (i flag) temporary register index status register dxuf dxdaue mode 1 register dxtms dtsc mode 2 register channel x transfer source latch channel x transfer destination latch channel x transfer count latch dxdwc dxdwc dxdwc data bus data bus dxuf dxsfi 15 0 15 0 15 0 rev.1.00 jul 30, 2003 page 37 of 119 7643 group dmac index and status register (address 003f 16 ) dmais dmac channel 0 count register underflow flag (d0uf) 0: no underflow 1: underflow generated dmac channel 0 suspend flag (d0sfi) 0: not suspended 1: suspended dmac channel 1 count register underflow flag (d1uf) 0: no underflow 1: underflow generated dmac channel 1 suspend flag (d1sfi) 0: not suspended 1: suspended dmac transfer suspend control bit (dtsc) 0: suspending only burst transfers during interrupt process 1: suspending both burst and cycle steal transfers during interrupt process dmac register reload disable bit (drldd) 0: enabling reload of source and destination registers of both channels 1: disabling reload of source and destination registers of both channels reserved bit (??at read/write) channel index bit (dci) 0: channel 0 accessible 1: channel 1 accessible dmac channel x mode register 1 (address 0040 16 ) dmaxm1 dmac channel x source register increment/decrement selection bit (dxsrid) 0: increment after transfer 1: decrement after transfer dmac channel x source register increment/decrement enable bit (dxsrce) 0: increment/decrement disabled (no change after transfer) 1: increment/decrement enabled dmac channel x destination register increment/decrement selection bit (dxdrid) 0: increment after transfer 1: decrement after transfer dmac channel x destination register increment/decrement enable bit (dxdrce) 0: increment/decrement disabled (no change after transfer) 1: increment/decrement enabled dmac channel x data write control bit (dxdwc) 0: writing data in reload latches and registers 1: writing data in reload latches only dmac channel x disable after count register underflow enable bit (dxdaue) 0: channel x enabled after count register underflow 1: channel x disabled after count register underflow dmac channel x register reload bit (dxrld) 0: not reloaded (bit is always read as ?? 1: source, destination, and transfer count registers contents of channel x to be reloaded dmac channel x transfer mode selection bit (dxtms) 0: cycle steal transfer mode 1: burst transfer mode dmac channel 0 hardware transfer request source bits (d0hr) b3b2b1b0 0 0 0 0: not used 0 0 0 1: uart receive interrupt 0 0 1 0: uart transmit interrupt 0 0 1 1: not used 0 1 0 0: int 0 interrupt 0 1 0 1: usb endpoint 1 in_pkt_rdy signal (falling edge active) 0 1 1 0: usb endpoint 2 in_pkt_rdy signal (falling edge active) 0 1 1 1: not used 1 0 0 0: usb endpoint 1 out_pkt_rdy signal (rising edge active) 1 0 0 1: usb endpoint 1 out_fifo_not_empty signal (rising edge active) 1 0 1 0: usb endpoint 2 out_pkt_rdy signal (rising edge active) 1 0 1 1: not used 1 1 0 0: not used 1 1 0 1: not used 1 1 1 0: serial i/o trasmit/receive interrupt 1 1 1 1: not used dmac channel 0 software transfer trigger (d0swt) 0: no action (bit is always read as ?? 1: request of channel 0 transfer by writing ??( note 1 ) reserved bit (??at read/write) dmac channel 0 transfer initiation source capture register reset bit (d0crr) 0: no action (bit is always read as ?? 1: reset of channel 0 capture register by writing ??( note 1 ) dmac channel 0 enable bit (d0cen) 0: channel 0 disabled 1: channel 0 enabled ( note 2 ) dmac channel 0 mode register 2 (address 0041 16 ) dma0m2 dmac channel 1 hardware transfer request source bits (d1hr) b3b2b1b0 0 0 0 0: not used 0 0 0 1: not used 0 0 1 0: not used 0 0 1 1: not used 0 1 0 0: int 1 interrupt 0 1 0 1: usb endpoint 1 in_pkt_rdy signal (falling edge active) 0 1 1 0: usb endpoint 2 in_pkt_rdy signal (falling edge active) 0 1 1 1: not used 1 0 0 0: usb endpoint 1 out_pkt_rdy signal (rising edge active) 1 0 0 1: usb endpoint 1 out_fifo_not_empty signal (rising edge active) 1 0 1 0: usb endpoint 2 out_pkt_rdy signal (rising edge active) 1 0 1 1: not used 1 1 0 0: not used 1 1 0 1: not used 1 1 1 0: timer 1 trasmit/receive interrupt 1 1 1 1: not used dmac channel 1 software transfer trigger (d1swt) 0: no action (bit is always read as ?? 1: request of channel 0 transfer by writing ??( note 1 ) reserved bit (??at read/write) dmac channel 1 transfer initiation source capture register reset bit (d1crr) 0: no action (bit is always read as ?? 1: reset of channel 1 capture register by writing ??( note 1 ) dmac channel 1 enable bit (d1cen) 0: channel 0 disabled 1: channel 0 enabled ( note 2 ) dmac channel 1 mode register 2 (address 0041 16 ) dma1m2 b0 b7 b0 b7 b0 b7 b0 b7 notes 1 : this bit is automatically cleared to ??after writing ?? 2 : when setting this bit to ?? simultaneously set the dmac channel x transfer initiation source capture register reset bit (bi t 6 of dmaxm2) to ?? 0 0 0 fig. 30 structure of dmacx related register rev.1.00 jul 30, 2003 page 38 of 119 7643 group (1) cycle steal transfer mode when the dmac channel x (x = 0, 1) transfer mode selection bit (dxtms) is set to ?? the respective dmac channel x operates in the cycle steal transfer mode. when a request of the specified transfer factor is generated, the selected channel transfers one byte of data from the address indi- cated by the source register into the address indicated by the destination register. there are two kinds of dma transfer triggers supported: hardware transfer factor and software trigger. hardware transfer factors can be selected by the dmacx (x = 0, 1) hardware transfer request factor bit (dxhr). to only use the interrupt request bit, the inter- rupt can be disabled by setting its interrupt enable bit of interrupt control register to ?? the dma transfer request as a software trigger can be generated by setting the dma channel x (x = 0, 1) software transfer trigger bit (dxswt) to ?? the source registers and transfer destination registers can be either decreased or increased by 1 after transfer completion by setting bits 0 to 3 in the dmac channel x (x = 0, 1) mode regis- ter. when the transfer count register underflows, the source registers and destination registers are reloaded from their latches if the dmac register reload disable bit (drldd) is ?? the transfer count register value is reloaded after an underflow regardless of drldd setting. at the same time, the dmac inter- rupt request bit and the dma channel x (x = 0, 1) count register underflow flag are set to ?? the dmac channel x disable after count register underflow en- able bit (dxdaue) is ?? the dmac channel x enable bit (dxcen) goes to ??at an under flows of transfer count register. by setting the dmac channel x (x = 0, 1) register reload bit (dxrld) to ?? the source registers, destination registers, and transfer count registers can be updated to the values in their re- spective latches. rev.1.00 jul 30, 2003 page 39 of 119 7643 group o u t s y n c o u t r d w r a 5 a d l 1 8 5 d m a d a t a a d l 2 a d l 2, 0 0 d m a d e s t i - n a t i o n a d d . d m a s o u r c e a d d . p c + 2 a d l 1 , 0 0 p c + 1 p c p c + 3 p c + 4 l d a $ z z s t a $ z z d m a t r a n s f e r s t a $ z z ( l a s t 2 c y c l e s ) d a t a d m a o u t ( p o r t p 3 3 ) a d d r e s s d a t a t r a n s f e r r e q u e s t s o u r c e ( l a c t i v e ) t r a n s f e r r e q u e s t s o u r c e s a m p l i n g r e s e t o f t r a n s f e r r e q u e s t s o u r c e s a m p l i n g n e x t i n s t r u c t i o n o p c o d e 3 d a t a d m a d a t a fig. 31 timing chart for cycle steal transfer caused by hardware-related transfer request 3 c 1 8 4 1 9 0 4 2 , 0 0 p c + 2 p c + 1 p c p c + 3 p c + 4 l d m # $ 9 0 , $ 4 1 p c + 6 p c + 5 o u t s y n c o u t r d w r d m a o u t ( p o r t p 3 3 ) a d d r e s s d a t a t r a n s f e r r e q u e s t s o u r c e ( l a c t i v e ) t r a n s f e r r e q u e s t s o u r c e s a m p l i n g r e s e t o f t r a n s f e r r e q u e s t s o u r c e s a m p l i n g n e x t i n s t r u c t i o n 1 c y c l e i n s t r u c t i o n 1 c y c l e i n s t r u c t i o n 1 c y c l e i n s t r u c t i o n d m a t r a n s f e r d m a d a t a d m a d e s t i - n a t i o n a d d . d m a s o u r c e a d d . o p c o d e 2 d m a d a t a o p c o d e 3 o p c o d e 4 o p c o d e 6 fig. 32 timing chart for cycle steal transfer caused by software trigger transfer request rev.1.00 jul 30, 2003 page 40 of 119 7643 group fig. 33 timing chart for burst transfer caused by hardware-related transfer request a5 ad l 1 85 pc + 2 ad l 1, 00 pc + 1 pc pc + 3 lda $zz sta $zz (first cycle) sta $zz (second cycle) out sync out rd wr dma out (port p3 3 ) address data transfer request source (??active) transfer request source sampling reset of transfer request source sampling dma transfer data dma destina- tion add. 1 dma source add. 1 dma destina- tion add. 2 dma source add. 2 dma data 1 dma data 1 dma data 2 dma data 2 ad l 2 (2) burst transfer mode when the dmac channel x transfer mode selection bit (dxtms) is set to ?? the respective dmac channel operates in the burst transfer mode. in the burst transfer mode, the dmac continually transfers the number of bytes of data specified by the transfer count register for one transfer request. other than this, the burst transfer mode operation is the same as the cycle steal mode operation. priority the dmac places a higher priority on channel-0 transfer requests than on channel-1 transfer requests. if a channel-0 transfer request occurs during a channel-1 burst transfer operation, the dmac completes the next transfer source and destination read/write operation first, and then starts the channel-0 transfer operation. as soon as the channel-0 transfer is completed, the dmac resumes the channel-1 transfer operation. when an interrupt request occurs during any dma operation, the transfer operation is suspended and the interrupt process routine is initiated. during the interrupt operation, the dmac automatically sets the corresponding dmac channel x (x = 0, 1) suspend flag (dxsfi) to ?? as soon as the cpu completes the interrupt opera- tion, the dmac clears the flag to ??and resumes the original operation from the point where it was suspended. the suspended transfer due to the interrupt can also be resumed during its interrupt process routine by writing ??to the dmac channel x (x = 0,1) enable bit (dxcen). the timing charts for a burst transfer caused by a hardware-re- lated transfer request are shown in figure 33. rev.1.00 jul 30, 2003 page 41 of 119 7643 group usb function the 7643 group mcu is equipped with a usb function control unit (usb fcu). this usb fcu allows the mcu to communicate with a host pc using a minimum amount of the mcu power. this built-in usb fcu complies with full-speed usb2.0 specification that supports four transfer types: control transfer, isochronous transfer, interrupt transfer, and bulk transfer. however, the 7643 group can use three of control trasnfer, interrupt transfer and bulk transfer. this built-in usb fcu performs the data transfer error detection and transfer retry operation by hardware. the de- fault transfer mode of the usb fcu is bulk transfer mode at reset. the user must set the usb fcu for the required transfer mode by software. the usb fcu has three endpoints (endpoint 0 to endpoint 2). the epindex bit selects one of these five endpoints for the usb fcu to use. each endpoint has in (transmit) fifo and out (re- ceive) fifo. to use the usb fcu, the usb enable bit (usbc7) must be set to ?? the usb function interrupt is supported for this mcu. figure 34 shows the usb fcu (usb function control unit) block diagram. the usb fcu consists of the sie (serial interface en- gine) performing the usb data transfer, gfi (generic function interface) performing usb protocol handing, siu (serial engine interface unit) performing a received address and endpoint de- coding, mci (microcontroller interface) handling the mcu interface or performing address decoding and synchronization of control signals, and the usb transceiver. m i c r o c o n t r o l l e r i n t e r f a c e u n i t ( m c i ) s e r i a l e n g i n e i n t e r f a c e u n i t ( s i u ) g e n e r i c f u n c t i o n i n t e r f a c e ( g f i ) f i f o s s e r i a l i n t e r f a c e e n g i n e ( s i e ) t r a n s c e i v e r u s b d + u s b d - c p u fig. 34 usb fcu (usb function control unit) block rev.1.00 jul 30, 2003 page 42 of 119 7643 group usb transmission endpoint 0 to endpoint 2 have in (transmit) fifos individually. each endpoint s fifo is configured in following way: endpoint 0: 16-byte endpoint 1: 128-byte endpoint 2: mode 0: 32-byte mode 1: 128-byte when endpoint 2 is used for data transmit, the in fifo size can be selected. endpoint 2 have 2 modes programmable in-fifo. each mode can be selected by the usb endpoint fifo mode se- lection register (address 005f 16 ). when writing data to the usb endpoint-x fifo (addresses 0060 16 to 0062 16 ) in the sfr area, the internal write pointer for the in fifo is automatically increased by 1. when the auto_set bit is ??and if the stored data reaches to the max. packet value set in usb endpoint x in max. packet size register (address 005b 16 ), the usb fcu sets the in_pkt_rdy bit to ?? when the auto_set bit is ?? the in_pkt_rdy bit will not be automati- cally set to ?? it must be set to ??by software. (the auto_set bit function is not applicable to endpoint 0.) the usb fcu transmits the data when it receives the next in to- ken. the in_pkt_rdy bit automatically goes to ??when the data transfer is complete. interrupt transfer mode endpoints 1 to 2 can be used in interrupt transfer mode. during a regular interrupt transfer, an interrupt transaction is similar to the bulk transfer. therefore, there is no special setting required. when in-endpoint is used for a rate feedback interrupt transfer, intpt bit of the in_csr register must be set to ?? the following steps show how to configure the in-endpoint for the rate feedback inter- rupt transfer. 1. set a value which is larger than 1/2 of the usb endpoint-x fifo size to the usb endpoint x in max. package size register. 2. set intpt bit to ?? 3. flush the old data in the fifo. 4. store transmission data to the in fifo and set the in_pkt_rdy bit to ?? 5. repeat steps 3 and 4. in a real application, the function-side always has transfer data when the function sends an endpoint in a rate feedback interrupt. accordingly, the usb fcu never returns a nak against the host in token for the rate feedback interrupt. the usb fcu always transmits data in the fifo in response to an in token, regardless of in_pkt_rdy. however, this premises that there is always an ack response from host pc after the 7643 group has transmitted data to in token. when maxp size (a half of in fifo size), the in fifo can store two packets (called double buffer). at this time, the in fifo sta- tus can be checked by monitoring the in_pkt_rdy bit and the tx_not_ept flag. the tx_not_ept flag is a read-only flag which shows the fifo state. when in_pky_rdy = 0 and tx_not_ept = 0, in fifo is empty. when in_pky_rdy = 0 and tx_not_ept = 1, in fifo has one packet. in double buffer mode, as long as the in fifo is not filled with double packets, in_pkt_rdy will not be set to ?? even if it is set to ??by software, but tx_not_ept flag will be set to ?? in single buffer mode, if maxp > (a half of in fifo), this condition never occurs. when in_pkt_rdy = ??and tx_not_ept = ?? in fifo holds two packets in double buffer mode and one packet in single packet mode. in single packet mode, when the in_pkt_rdy bit is set to ??by software, the tx_not_ept flag is set to ??as well. during double buffer mode, if you want to load two packets se- quentially, you must set the in_pkt_rdy bit to ?? each time a packet is loaded. rev.1.00 jul 30, 2003 page 43 of 119 7643 group usb reception endpoint 0 to endpoint 2 have out (receive) fifos individually. each endpoint s fifo is configured in following way: endpoint 0: 16-byte endpoint 1: 128-byte endpoint 2: mode 0: 32-byte mode 1: 128-byte when endpoint 2 is used for data receive, the out fifo size can be selected. endpoint 2 have 2 modes programmable in-fifo. each mode can be selected by the usb endpoint fifo mode se- lection register (address 005f 16 ). data transmitted from the host-pc is stored in endpoint x fifo (0060 16 to 0062 16 ). every time the data is stored in the fifo, the internal out fifo write pointer is increased by 1. when one com- plete data packet is stored, the out_pkt_rdy flag is set to ? and the number of received data packets is stored in usb end- point x out write count register. when the auto_clr bit is ? and the received data is read out from the out fifo, the out_pkt_rdy flag is cleared to ?? when the auto_clr bit is ?? the out_pkt_rdy flag will not be cleared automatically by the fifo read; it must be cleared by software. (the auto-clr bit function is not applicable in endpoint 0.) when maxp size (a half of out fifo size), the out_fifo can receive 2 packets (double buffer). at this time, the out_ fifo sta- tus can be checked by the out_pkt_rdy flag. when the fifo holds two packets and one packet is read from the fifo, the out_pkt_rdy flag is not cleared even if it is set to ?? (the flag returns from ??to ??in one cycle after the read-out). during double buffer mode, the usb endpoint x out write count register holds the number of previously received packets. this count regis- ter is updated after reading out one of packets in the out fifo and clearing the out_pkt_rdy flag to ?? toggle initialization in order to initialize the data toggle sequence bit of the endpoint, in other words, resetting the next data packet to data0; set the toggle_int bit to ??and then clear back to ?? rev.1.00 jul 30, 2003 page 44 of 119 7643 group usb interrupts the usb fcu has usb function interrupt. usb function interrupt (usbf-int) the usbf-int is usable for the usb data flow control and power management. the usbf-int request occurs at data transmit/re- ceive completion, overrun/underrun, reset, or receiving suspend/ resume signal. to enable this interrupt, the usb function interrupt enable bit in the interrupt control register a (address 0005 16 ) and the respective bit in the usb interrupt enable registers 1 and 2 (addresses 00054 16 and 00055 16 ) must be set to ?? when set- ting bit 7 in usb interrupt enable register 2 to ?? the suspend interrupt and the resume interrupt are enabled. endpoint x (x = 0 to 2) in interrupt request occurs when the usb endpoint x in interrupt status flag (intst 0, 2, 4) of usb interrupt status registers 1 and 2 (addresses 0052 16 and 0053 16 ) is ?? the usb endpoint x in interrupt status flag is set to ??when the re- spective endpoint in_pkt_rdy bit is ?? endpoint x (x = 0 to 2) out interrupt request occurs when the usb endpoint x out interrupt status flag (intst3, 5) in usb in- terrupt status registers 1 and 2 is set to ?? the usb endpoint x out interrupt status flag is set to ??when the respective endpoint out_pkt_rdy flag is ?? the usb reset interrupt request occurs when the usb reset inter- rupt status flag (intst13) in usb interrupt status register 2 is set to ?? this flag is set when the se0 is detected on the d+/d- line for at least 2.5 s. when this situation happens, all usb internal registers (addresses 0050 16 to 005f 16 ), except this flag, are ini- tialized to the default state at reset. the usb reset interrupt is always enabled. the suspend/resume interrupt request occurs when either the usb resume signal interrupt status flag (intst14) or the usb suspend signal interrupt status flag (intst15) in usb interrupt status register 2 is set to ?? the bits in both interrupt status registers 1 and 2 can be cleared by writing ??to each bit. suspend/resume functions if no bus activity is detected on the d+/d- line for at least 3 ms, the usb suspend signal detect flag (suspend) of the usb power control register (address 0051 16 ) and the usb suspend signal in- terrupt status flag of usb interrupt status register 2 are set to ? and the suspend interrupt request occurs. the following procedure must be executed after pushing the internal registers (a, x, y ) to memories during the suspend interrupt process routine. (1) clear all bits of usb interrupt status register 1 (address 0052 16 ) and usb interrupt status register 2 (address 0053 16 ) to ?? (2) set the usb clock enable bit to ?? (after disabling the usb clock, do not write to any of the usb internal registers (ad- dresses 0050 16 to 0062 16 ), except for the usb control register (address 0013 16 ), clock control register (address 001f 16 ), and frequency synthesizer control register (address 006c 16 ). (3) set the frequency synthesizer enable bit to ?? (4) set the usb line driver current control bit to ?? (always keep the usb line driver current control bit set to ??during usb function operations. when operating at vcc = 3.3 v, this bit does not need to be set.) (5) keep total drive current at 500 a or less. (6) disable the timer 1 interrupt. (7) disable the timer 2 interrupt. (disable all the other external in- terrupts.) (8) set the timer 1 interrupt request bit to ?? (9) set the timer 2 interrupt request bit to ?? (10) set the interrupt disable flag (i) to ?? (11) execute the stp instruction. at this point, the mcu will be in stop mode (suspend mode). be- fore executing the stp instruction, make sure to set the usb function interrupt request bit (bit 0 at address 0002 16 ) to ??and the usb function interrupt enable bit (bit 0 at address 0005 16 ) to ?? the usb suspend detect signal flag goes to ??when the usb re- sume signal detect flag (resume) is set to ?? during suspend mode, if the clock operation is started up with a process (remote wake-up) other than the resume interrupt process (for example; reset or timer), make sure to clear the usb suspend detect signal flag to ??when you set the usb remote wake-up bit to ?? when the usb fcu is in suspend mode and detects a non-idle signal on the d+/d- line, the usb resume detect flag and the usb resume signal interrupt status flag both go to ??and a resume interrupt request occurs. at this point, pull the internal registers (a, x, y) in this interrupt process routine. take the following procedure in the usb resume interrupt process. (1) set the usb line driver current control bit to ?? (when operat- ing at vcc = 3.3 v, this bit does not need to be set.) (2) set the frequency synthesizer enable bit to ??and set a 2 ms wait or more . (3) check the frequency synthesizer lock status bit. if ?? it must be checked again after a 0.1 ms wait. (4) set the usb clock enable bit to ?? rev.1.00 jul 30, 2003 page 45 of 119 7643 group set the usb resume signal interrupt status flag to ??after the wake-up sequence process. the usb resume detect flag goes to ??at the same time. when the clock operation is started up with a remote wake-up, set the usb remote wake-up bit to ??after the wake-up sequence process. (keep it set to ??for a minimum of 10 ms and maximum of 15 ms). by doing this, the mcu will send a resume signal to the host cpu and let it know that the suspend state has been released. after that, set the usb remote wake-up bit and the usb suspend detection flag to ?? because the usb suspend detection flag is not automatically cleared to ??with a remote wake-up. [usb control register] usbc when using the usb function, the usb enable bit must be set to ?? the usb line driver supply bit must be set to ??(dc-dc con- verter is disabled) when operating at vcc = 3.3v. in this condition, the setting of the usb line driver current control bit has no effect on usb operations. fig. 35 structure of usb control register usb control register (address 0013 16 ) usbc reserved bit (??at read/write) usb default state selection bit (usbc1) 0: in default state after power-on/reset 1: in default state after usb reset signal received reserved bit (??at read/write) usb line driver current control bit (usbc3) 0: high current mode 1: low current mode usb line driver supply enable bit (usbc4) ( note 1 ) 0: line driver disabled 1: line driver enabled usb clock enable bit (usbc5) 0: 48 mhz clock to the usb block disabled 1: 48 mhz clock to the usb block enabled reserved bit (??at read/write) usb enable bit (usbc7) 0: usb block disabled ( note 2 ) 1: usb block enabled n otes 1 : when using the mcu in vcc = 3.3 v, set this bit to ??and disable the built-in dc-dc converter 2 : setting this bit to 0?causes the contents of all usb registers to have the values at reset. b0 b7 0 0 0 rev.1.00 jul 30, 2003 page 46 of 119 7643 group [usb address register] usba the usb address register maintains the usb function control unit address assigned by the host computer. when receiving the set_address, keep it in this register. the values of this register are ??when the device is not yet configured. the values of this register are also set to ??when the usb block is disabled (bit 7 of usb control register is set to ??. in addition, no matter what value is written to this register, it will have no effect on the set value. [usb power management register] usbpm the usb power management register is used for power manage- ment in the usb fcu. this register needs to be set only when using the remote wake-up to resume the mcu from suspend mode. u s b a d d r e s s r e g i s t e r ( a d d r e s s 0 0 5 0 1 6 ) u s b a p r o g r a m m a b l e f u n c t i o n a d d r e s s ( f u n a d 0 t o 6 ) ) t h i s r e g i s t e r m a i n t a i n s t h e 7 - b i t u s b f u n c t i o n c o n t r o l u n i t a d d r e s s a s s i g n e d b y t h e h o s t c p u . r e s e r v e d b i t ( 0 a t r e a d / w r i t e ) b 0 b 7 0 u s b p o w e r m a n a g e m e n t r e g i s t e r ( a d d r e s s 0 0 5 1 1 6 ) u s b p m u s b s u s p e n d d e t e c t i o n f l a g ( s u s p e n d ) ( r e a d o n l y ) 0 : n o u s b s u s p e n d d e t e c t e d 1 : u s b s u s p e n d d e t e c t e d u s b r e s u m e d e t e c t i o n f l a g ( r e s u m e ) ( r e a d o n l y ) 0 : n o u s b r e s u m e s i g n a d e t e c t e d 1 : u s b r e s u m e s i g n a l d e t e c t e d u s b r e m o t e w a k e - u p b i t ( w a k e u p ) 0 : e n d o f r e m o t e r e s u m e s i g n a l 1 : t r a n s m i t t i n g o f r e m o t e r e s u m e s i g n a l ( o n l y w h e n s u s p e n d = 1 ) r e s e r v e d b i t ( 0 a t r e a d / w r i t e ) b 0 b 7 0 0 0 0 0 fig. 36 structure of usb address register fig. 37 structure of usb power management register rev.1.00 jul 30, 2003 page 47 of 119 7643 group [usb interrupt status registers 1 and 2] usbis1, usbis2 the usb interrupt status registers are used to indicate the condi- tion that caused a usb function interrupt to be generated. each status flag and bit can be cleared to ??by writing ??to the corre- sponding bit. make sure to write to/read from the usb interrupt status register 1 first and then usb interrupt status register 2. usb interrupt status register 1 (address 0052 16 ) usbis1 usb endpoint 0 interrupt status flag (intst0) 0: except the following conditions 1: set at any one of the following conditions: ?a packet data of endpoint 0 is successfully received ?a packet data of endpoint 0 is successfully sent ?data_end bit of endpoint 0 is cleared to ? ?force_stall bit of endpoint 0 is set to ? ?setup_end bit of endpoint 0 is set to ?? reserved bit (??at read/write) usb endpoint 1 in interrupt status flag (intst2) 0: except the following condition 1: set at which of the following condition: ?a packet data of endpoint 1 is successfully sent usb endpoint 1 out interrupt status flag (intst3) 0: except the following conditions 1: set at any one of the following conditions: ?a packet data of endpoint 1 is successfully received ?force_stall bit of endpoint 1 is set to ?? usb endpoint 2 in interrupt status flag (intst4) 0: except the following condition 1: set at which of the following condition: ?a packet data of endpoint 2 is successfully sent usb endpoint 2 out interrupt status flag (intst5) 0: except the following conditions 1: set at any one of the following conditions: ?a packet data of endpoint 2 is successfully received ?force_stall bit of endpoint 2 is set to ?? reserved bit (??at read/write) reserved bit (??at read/write) b0 b7 0 0 0 fig. 38 structure of usb interrupt status register 1 rev.1.00 jul 30, 2003 page 48 of 119 7643 group fig. 39 structure of usb interrupt status register 2 usb interrupt status register 2 (address 0053 16 ) usbis2 reserved bit (??at read/write) usb reset interrupt status flag (intst13) 0: except the following condition 1: set at receiving of usb reset signal usb resume signal interrupt status flag (intst14) 0: except the following condition 1: set at receiving of resume signal usb suspend signal interrupt status flag (intst15) 0: except the following condition 1: set at receiving of suspend signal b0 b7 0000 0 [usb interrupt enable registers 1 and 2] usbie1, usbie2 the usb interrupt enable registers are used to enable the usb usb interrupt enable register 1 (address 0054 16 ) usbie1 usb endpoint 0 interrupt enable bit (inten0) 0: disabled 1: enabled reserved bit (??at read/write) usb endpoint 1 in interrupt enable bit (inten2) 0: disabled 1: enabled usb endpoint 1 out interrupt enable bit (inten3) 0: disabled 1: enabled usb endpoint 2 in interrupt enable bit (inten4) 0: disabled 1: enabled usb endpoint 2 out interrupt enable bit (inten5) 0: disabled 1: enabled reserved bit (undefined at read/??at write) b0 b7 0 ?? function interrupt. upon reset, all usb interrupts except the usb suspend and usb resume interrupts are enabled. fig. 40 structure of usb interrupt enable register 1 rev.1.00 jul 30, 2003 page 49 of 119 7643 group usb interrupt enable register 2 (address 0055 16 ) usbie2 reserved bit (undefined at read/??at write) reserved bit (??at read/write) reserved bit (undefined at read/??at write) reserved bit (??at read/write) reserved bit (??at read/write) usb suspend/resume interrupt enable bit (inten15) 0: disabled 1: enabled b0 b7 00 01 ?? ? fig. 41 structure of usb interrupt enable register 2 [usb endpoint index register] usbindex this register specifies the accessible endpoint. it serves as an in- dex to endpoint-specific usb endpoint x in control register, usb endpoint x out control register, usb endpoint x in max. packet size register, usb endpoint x out max. packet size register, usb endpoint x out write count register, and usb fifo mode selection register (x = 0 to 2). u s b e n d p o i n t i n d e x r e g i s t e r ( a d d r e s s 0 0 5 8 1 6 ) u s b i n d e x e n d p o i n t i n d e x b i t ( e p i n d e x ) ( n o t e ) b 2 b 1 b 0 0 0 0 : e n d p o i n t 0 0 0 1 : e n d p o i n t 1 0 1 0 : e n d p o i n t 2 0 1 1 : n o t u s e d 1 0 0 : n o t u s e d 1 0 1 : n o t u s e d 1 1 0 : n o t u s e d 1 1 1 : n o t u s e d r e s e r v e d b i t ( 0 a t r e a d / w r i t e ) b 0 b 7 000 00 n o t e : d o n o t s e t e n d p o i n t e x c e p t e n d p o i n t 0 , 1 a n d 2 . fig. 42 structure of usb frame number registers rev.1.00 jul 30, 2003 page 50 of 119 7643 group [usb endpoint 0 in control register ] in_csr this register contains the control and status information of the endpoint 0. this usb fcu sets the out_pkt_rdy flag to ?1? upon having received a data packet in the out fifo. when read- ing its one data packet from the out fifo, be sure to set this flag to ?0?. after a setup token is received, the mcu is in the ?decode wait state? until the out_pkt_rdy flag is cleared. if the out_pkt_rdy flag is not cleared (indicating that the host re- quest has not been successfully decoded), the usb fcu keep returning a nak to the host for all in/out tokens. set the in_pkt_rdy bit to ?1? after the data packet has been written to the in fifo. if this bit is set to ?1? even though nothing has been written to the in fifo, a ?0? length data (null packet) is sent to the host. the send_stall bit is for sending a stall to the host if an unsupported request is received by the usb fcu. this bit must be set to ?1?. when the out_pkt_rdy flag is set to ?0? for request reception, the usb fcu transmits a stall signal to the host cpu. perform the following three processes simulta- neously: ? set send_stall bit to ?1? ? set data_end bit to ?1? ? set out_pkt_rdy flag to ?0? by setting serviced_out _pkt_rdy bit to ?1?. note that if ?0? is written to the send_stall bit before the clear_feature (endpoint stall) request has been received, the next stall will not be generated. the data_end bit informs the usb fcu of the completion of the process indicated in the setup packet. set this bit to ?1? when the process requested in the setup packet is completed. (con- trol read transfer: set this bit after writing all of the requested data to the fifo; control write transfer: set this bit to ?1? after reading all of the requested data from the fifo.) when this bit is ?1?, the host request is ignored and a stall is returned. after the status phase process is completed, the usb fcu automatically clears it to ?0?. u s b e n d p o i n t 0 i n c o n t r o l r e g i s t e r ( a d d r e s s 0 0 5 9 1 6 ) i n _ c s r o u t _ p k t _ r d y f l a g ( i n 0 c s r 0 ) 0 : e x c e p t t h e f o l l o w i n g c o n d i t i o n ( c l e a r e d t o ? 0 ? b y w r i t i n g ? 1 ? i n t o s e r v i c e d _ o u t _ p k t _ r d y b i t ) 1 : e n d o f a d a t a p a c k e t r e c e p t i o n i n _ p k t _ r d y b i t ( i n 0 c s r 1 ) 0 : e n d o f a d a t a p a c k e t t r a n s m i s s i o n 1 : w r i t e ? 1 ? a t c o m p l e t i o n o f w r i t i n g a d a t a p a c k e t i n t o i n f i f o . s e n d _ s t a l l b i t ( i n 0 c s r 2 ) 0 : e x c e p t t h e f o l l o w i n g c o n d i t i o n 1 : t r a n s m i t t i n g s t a l l h a n d s h a k e s i g n a l d a t a _ e n d b i t ( i n 0 c s r 3 ) 0 : e x c e p t t h e f o l l o w i n g c o n d i t i o n ( c l e a r e d t o ? 0 ? a f t e r c o m p l e t i o n o f s t a t u s p h a s e ) 1 : w r i t e ? 1 ? a t c o m p l e t i o n o f w r i t i n g o r r e a d i n g t h e l a s t d a t a p a c k e t t o / f r o m f i f o . f o r c e _ s t a l l f l a g ( i n 0 c s r 4 ) 0 : e x c e p t t h e f o l l o w i n g c o n d i t i o n 1 : p r o t o c o l e r r o r d e t e c t e d s e t u p _ e n d f l a g ( i n 0 c s r 5 ) ( n o t e ) 0 : e x c e p t t h e f o l l o w i n g c o n d i t i o n ( c l e a r e d t o ? 0 ? b y w r i t i n g ? 1 ? i n t o s e r v i c e d _ s e t u p _ e n d b i t ) 1 : c o n t r o l t r a n s f e r e n d s b e f o r e t h e s p e c i f i c l e n g t h o f d a t a i s t r a n s f e r r e d d u r i n g t h e d a t a p h a s e . s e r v i c e d _ o u t _ p k t _ r d y b i t ( i n 0 c s r 6 ) w r i t i n g ? 1 ? t o t h i s b i t c l e a r s o u t _ p k t _ r d y f l a g t o ? 0 ? . s e r v i c e d _ s e t u p _ e n d b i t ( i n 0 c s r 7 ) w r i t i n g ? 1 ? t o t h i s b i t c l e a r s s e t u p _ e n d f l a g t o ? 0 ? . b 0 b 7 n o t e : i f t h i s b i t i s s e t t o ? 0 ? , s t o p a c c e s s i n g t h e f i f o t o s e r v e t h e p r e v i o u s s e t u p t r a n s a c t i o n . fig. 43 structure of usb endpoint 0 in control register rev.1.00 jul 30, 2003 page 51 of 119 7643 group [usb endpoint x (x = 1, 2) in control register] in_csr this register contains the control and status information of the re- spective in endpoints 1, 2. set the in_pkt_rdy bit to ??after the data packet has been written to the in fifo. this bit is cleared to ??when the data transfer is completed. in a bulk in transfer, this bit is cleared when an ack signal is received from the host. if an ack signal is not re- ceived, this bit (and the tx_not_empty bit) remains as ?? this same data packet is sent after the next in token is received. the flush bit is for flushing the data in the in fifo. fig. 44 structure of usb endpoint x (x = 1, 2) in control register u s b e n d p o i n t x i n c o n t r o l r e g i s t e r ( a d d r e s s 0 0 5 9 1 6 ) i n _ c s r i n t _ p k t _ r d y b i t ( i n x c s r 0 ) 0 : e n d o f a d a t a p a c k e t t r a n s m i s s i o n ( n o t e 1 ) 1 : w r i t e 1 a t c o m p l e t i o n o f w r i t i n g a d a t a p a c k e t i n t o i n f i f o . ( n o t e 3 ) r e s e r v e d b i t ( 0 a t r e a d / w r i t e ) s e n d _ s t a l l b i t ( i n x c s r 2 ) ( n o t e 2 ) 0 : e x c e p t t h e f o l l o w i n g c o n d i t i o n 1 : t r a n s m i t t i n g s t a l l h a n d s h a k e s i g n a l t o g g l e _ i n i t b i t ( i n x c s r 3 ) ( n o t e 2 ) 0 : e x c e p t t h e f o l l o w i n g c o n d i t i o n 1 : i n i t i a l i z i n g t h e d a t a t o g g l e s e q u e n c e b i t i n t p t b i t ( i n x c s r 4 ) ( n o t e 2 ) 0 : e x c e p t t h e f o l l o w i n g c o n d i t i o n 1 : i n i t i a l i z i n g t o e n d p o i n t u s e d f o r i n t e r r u p t t r a n s f e r , r a t e f e e d b a c k t x _ n o t _ e p t f l a g ( i n x c s r 5 ) ( n o t e 1 ) 0 : e m p t y i n i n f i f o 1 : f u l l i n i n f i f o f l u s h b i t ( i n x c s r 6 ) 0 : e x c e p t t h e f o l l o w i n g c o n d i t i o n ( n o t e 4 ) 1 : f l u s h f i f o . ( n o t e 4 ) a u t o _ s e t b i t ( i n x c s r 7 ) ( n o t e 2 ) 0 : a u t o _ s e t d i s a b l e d 1 : a u t o _ s e t e n a b l e d b 0 b 7 n o t e s 1 : t h i s b i t i s a u t o m a t i c a l l y s e t t o 1 o r c l e a r e d t o 0 . 2 : t h e u s e r m u s t p r o g r a m t o 1 o r 0 . 3 : w h e n a u t o _ s e t b i t i s 0 , t h e u s e r m u s t s e t t o 1 . w h e n a u t o _ s e t b i t i s 1 , t h i s b i t i s a u t o m a t i c a l l y s e t t o 1 . 4 : t h i s b i t i s a u t o m a t i c a l l y c l e a r e d t o 0 a f t e r s e t t i n g 1 . 0 rev.1.00 jul 30, 2003 page 52 of 119 7643 group [usb endpoint x (x = 1, 2) out control register] out_csr this register contains the information and status of the respective out endpoints 1, 2. in the endpoint 0, all bits are reserved and cannot be used (they will all be read out as ??. the usb fcu sets the out_pkt_rdy flag to ??after a data packet has been received into the out fifo. after reading the data packet in the out fifo, clear this flag to ?? however, if there is still data in the out fifo, the flag cannot be cleared even by writing ??by soft- ware. fig. 45 structure of usb endpoint x (x = 1, 2) out control register u s b e n d p o i n t x o u t c o n t r o l r e g i s t e r ( a d d r e s s 0 0 5 a 1 6 ) o u t _ c s r o u t_ p k t _ r d y f l a g ( o u t x c s r 0 ) 0 : e x c e p t t h e f o l l o w i n g c o n d i t i o n ( n o t e 3 ) 1 : e n d o f a d a t a p a c k e t r e c e p t i o n ( n o t e 2 ) r e s e r v e d b i t ( 0 a t r e a d / w r i t e ) s e n d _ s t a l l b i t ( o u t x c s r 2 ) ( n o t e 2 ) 0 : e x c e p t t h e f o l l o w i n g c o n d i t i o n 1 : t r a n s m i t t i n g s t a l l h a n d s h a k e s i g n a l t o g g l e _ i n i t b i t ( o u t x c s r 3 ) ( n o t e 2 ) 0 : e x c e p t t h e f o l l o w i n g c o n d i t i o n 1 : i n i t i a l i z i n g t h e d a t a t o g g l e s e q u e n c e b i t f o r c e _ s t a l l f l a g ( o u t x c s r 4 ) 0 : e x c e p t t h e f o l l o w i n g c o n d i t i o n ( n o t e 2 ) 1 : p r o t o c o l e r r o r d e t e c t e d ( n o t e 1 ) r e s e r v e d b i t ( 0 a t r e a d / w r i t e ) f l u s h b i t ( o u t x c s r 6 ) 0 : e x c e p t t h e f o l l o w i n g c o n d i t i o n ( n o t e 4 ) 1 : f l u s h f i f o . ( n o t e 4 ) a u t o _ c l r b i t ( o u t x c s r 7 ) ( n o t e 2 ) 0 : a u t o _ c l r d i s a b l e d 1 : a u t o _ c l r e n a b l e d b 0 b 7 0 0 n otes 1 : this bit is automatically se t to ??or cleared to 0? 2 : the user must program to ? or 0? 3 : when auto_set bit is ? , the user must set to 1? when auto_set bit is ?? this bit is automatically set to 1 . 4: this bit is automatically cleared to 0 after setting 1 . rev.1.00 jul 30, 2003 page 53 of 119 7643 group [usb endpoint x (x = 0 to 2) in max. packet size register] in_maxp this register specifies the maximum packet size (maxp) of an endpoint x in packet. the value set for endpoint 1 is the number of transmitted bytes divided by 8, and the value set for endpoints 0 and 2 is the actual number of transmitted bytes. the cpu can change these values using the set_descriptor command. the initial value for endpoints 0 and 2 is 8, and the initial value for endpoint 1 is 1. [usb endpoint x (x = 0 to 2) out max. packet size register] out_maxp this register specifies the maximum packet size (maxp) of an endpoint x out packet. the value set for endpoint 1 is the num- ber of received bytes divided by 8, and the value set for endpoints 0 and 2 is the actual number of received bytes. the cpu can change these values using the set_descriptor command. the initial value for endpoints 0 and 2 is 8, and the initial value for endpoint 1 is 1. when using the endpoint 0, both usb endpoint x in max. packet size register (in _maxp) and usb endpoint x out max. packet size register (out_maxp) are set to the same value. changing one register s value effectively changes the value of the other register as well. notes only flash memory version acknowledges in/out token input to the endpoints 3 and 4. for its countermeasure program the follow- ing in the initial settings or other routines. [usbindex] = 03h ; usbindex=58h [in_maxp]=00h ; in_maxp=5bh [out_maxp]=00h ; out_maxp=5ch [usbindex]=04h ; usbindex=58h [in_maxp]=00h ; in_maxp=5bh [out_maxp]=00h ; out_maxp=5ch (this program does not affect the operation of mask rom ver- sion.) t h e m a x i m u m p a c k e t s i z e ( m a x p ) o f e n d p o i n t x i n i s c o n t a i n e d . m a x p = n f o r e n d p o i n t s 0 , 2 m a x p = n ? 8 f o r e n d p o i n t 1 n i s a w r i t t e n v a l u e i n t o t h i s r e g i s t e r . u s b e n d p o i n t x i n m a x . p a c k e t s i z e r e g i s t e r ( a d d r e s s 0 0 5 b 1 6 ) i n _ m a x p b 0 b 7 t h e m a x i m u m p a c k e t s i z e ( m a x p ) o f e n d p o i n t x o u t i s c o n t a i n e d . m a x p = n f o r e n d p o i n t s 0 , 2 m a x p = n ? 8 f o r e n d p o i n t 1 n i s a w r i t t e n v a l u e i n t o t h i s r e g i s t e r . u s b e n d p o i n t x o u t m a x . p a c k e t s i z e r e g i s t e r ( a d d r e s s 0 0 5 c 1 6 ) o u t _ m a x p b 0 b 7 fig. 46 structure of usb endpoint x in max. packet size register fig. 47 structure of usb endpoint x out max. packet size register rev.1.00 jul 30, 2003 page 54 of 119 7643 group [usb endpoint x (x = 0 to 2) out write count registers] wrt_cntr this register contain the number of bytes in the endpoint x out fifo. this is read-only register. this register must be read after the usb fcu has received a packet of data from the host. when the out fif0 is in double buffer mode, the cpu first reads the received number of bytes of the former data packet. the next cpu read can obtain that of the new data packet. fig. 48 structure of usb endpoint x (x = 0 to 2) out write count registers low-order 8 bits of the number of bytes in endpoint x out fifo usb endpoint x out write count register (address 005d 16 ) wrt_cnt b0 b7 [usb endpoint x (x = 0 to 2) fifo register] usbfifox these registers are the usb in (transmit) and out (receive) fifo data registers. write data to the corresponding register, and read data from the corresponding register. when the maximum packet size is equal to or less than half the fifo size, these registers function in double buffer mode and can hold two packets of data. when the in_pkt_rdy bit is ??and the tx_not_empty bit is ?? these bits indicate that one packet of data is stored in the in fifo. when the out fifo is in double buffer mode, the out_pkt_rdy flag remains as ??after the first packet of data is read out (it actually goes to ??and returns to ? after one cycle). en d p o i n t x i n / o u t f i f o u s b e n d p o i n t x f i f o r e g i s t e r ( a d d r e s s e s 0 0 6 0 1 6 , 0 0 6 1 1 6 , 0 0 6 2 1 6 ) u s b f i f o x b 0 b 7 fig. 49 structure of usb endpoint x (x = 0 to 2) fifo register rev.1.00 jul 30, 2003 page 55 of 119 7643 group [usb endpoint fifo mode selection register] usbfifomr this register determines in/out fifo size mode for endpoint 1 or endpoint 2. usb endpoint fifo mode register (address 005f 16 ) usbfifomr fifo size selection bit ( note ) for endpoint 1 b3b2b1b0 x 0 0 0: in 128-byte, out 128-byte for endpoint 2 0 x x x : in 32-byte, out 32-byte 1 x x x : in 128-byte, out 128-byte reserved bit b0 b7 note : the value set into ??is invalid. fig. 50 structure of usb endpoint fifo mode register rev.1.00 jul 30, 2003 page 56 of 119 7643 group frequency synthesizer (pll) the frequency synthesizer generates the 48 mhz clock required by f usb and f syn , which are multiples of the external input refer- ence f(x in ). figure 51 shows the block diagram for the frequency synthesizer circuit. the frequency synthesizer input bit selects either f(x in ) or f(x cin ) as an input clock f in for the frequency synthesizer. the frequency synthesizer multiply register 2 (fsm2: address 006e 16 ) divides f in to generate f pin , where f pin = f in / 2(n + 1), n: value set to fsm2. when the value of frequency synthesizer multiply register 2 is set to 255, the division is not performed and f pin will equal f in . f vco is generated according to the contents of frequency synthe- sizer multiply register 1 (fsm1: address 006d 16 ), where f vco = f pin ? {2(n + 1)}, n: value set to fsm1. set the value of fsm1 so that the value of f vco is 48 mhz. f syn is generated according to the contents of the frequency syn- thesizer divide register (fsd: address 006f 16 ), where f syn = f vco / 2(m + 1), m: value set to fsd. when the value of the frequency synthesizer divide register is set to 255, the division is not performed and f syn becomes invalid. [frequency synthesizer control register] fsc setting the frequency synthesizer enable bit (fse) to ??enables the frequency synthesizer. when the frequency synthesizer lock status bit (ls) is ??in the frequency synthesizer enabled, this in- dicates that f syn and f vco have correct frequencies. notes make sure to connect a low-pulse filter to the lpf pin when using the frequency synthesizer. in addition, please refer to ?rogram- ming notes: frequency synthesizer?when recovering from a hardware reset. f s m 2 d a t a b u s f s m 1 f s c p r e s c a l e r f i n f p i n f v c o f s y n f u s b ( a d d r e s s 0 0 6 e 1 6 ) ( a d d r e s s 0 0 6 d 1 6 ) ( a d d r e s s 0 0 6 c 1 6 ) ( a d d r e s s 0 0 6 f 1 6 ) f s d f r e q u e n c y m u l t i p l i e r f r e q u e n c y d i v i d e r f r e q u e n c y s y n t h e s i z e r l o c k s t a t u s b i t fig. 51 frequency synthesizer block diagram rev.1.00 jul 30, 2003 page 57 of 119 7643 group fig. 52 structure of frequency synthesizer control register f r e q u e n c y s y n t h e s i z e r c o n t r o l r e g i s t e r ( a d d r e s s 0 0 6 c 1 6 ) f s c f r e q u e n c y s y n t h e s i z e r e n a b l e b i t ( f s e ) 0 : d i s a b l e d 1 : e n a b l e d f i x t o 0 0 . f r e q u e n c y s y n t h e s i z e r i n p u t b i t ( f i n ) 0 : f ( x i n ) 1 : f ( x ci n ) r e s e r v e d b i t ( 0 a t r e a d / w r i t e ) l p f c u r r e n t c o n t r o l ( c h g 1 , c h g 0 ) ( n o t e ) b 6 b 5 0 0 : n o t a v a i l a b l e 0 1 : l o w c u r r e n t 1 0 : i n t e r m e d i a t e c u r r e n t ( r e c o m m e n d e d ) 1 1 : h i g h c u r r e n t f r e q u e n c y s y n t h e s i z e r l o c k s t a t u s b i t 0 : u n l o c k e d 1 : l o c k e d 0 0 0 n o t e : b i t s 6 a n d 5 a r e s e t t o ( b i t 6 , b i t 5 ) = ( 1 , 1 ) a t r e s e t . w h e n u s i n g t h e f r e q u e n c y s y n t h e s i z e r , w e r e c o m m e n d t o s e t t o ( b i t 6 , b i t 5 ) = ( 1 , 0 ) a f t e r l o c k i n g t h e f r e q u e n c y s y n t h e s i z e r . b 0 b 7 rev.1.00 jul 30, 2003 page 58 of 119 7643 group reset circuit to reset the microcomputer, reset pin should be held at an ? level for 20 cycles or more of . then the reset pin is returned to an ??level, and reset is released. they must be performed when the power source voltages are between 3.00 v and 3.60 v or 4.15 v and 5.25 v. after the reset is completed, the program starts from the address contained in address fffa 16 (high-order byte) and address fffb 16 (low-order byte). after oscillation has restarted, the timers 1 and 2 secures waiting time for the internal clock oscillation stabilized automatically by setting the timer 1 to ?f 16 ?and timer 2 to ?1 16 ? the internal clock retains ??level until timer 2 s underflow and it cannot be supplied until the underflow. the pins state during reset are follows: ?hen cnvss = ? ports p0, p1, p3 3 to p3 7 : outputting pins other than above mentioned ports : inputting ?hen cnvss = ? all pins : inputting. fig. 54 reset sequence fig. 53 reset circuit example (note) 0.2v cc 0v 0v poweron v cc reset v cc reset power source voltage detection circuit power source voltage reset input voltage note : reset release voltage ; vcc = 3.00 or 4.15 v r eset i nternal r eset data a ddress sync x in : 512 clock cycles ? ? ? ? fffa fffb ad h , l ? ? ? ? ad l ad h reset address from the vector table. notes: the question marks (?) indicate an undefined state that depends on the previous state. rev.1.00 jul 30, 2003 page 59 of 119 7643 group x : n o t f i x e d n o t e s1 : w h e n u s i n g t h e e n d p o i n t 1 , t h i s c o n t e n t s a r e 0 1 1 6 . ( 1 ) ( 2 ) ( 3 ) ( 4 ) ( 5 ) ( 6 ) ( 7 ) ( 8 ) ( 9 ) ( 1 0 ) ( 1 1 ) ( 1 2 ) ( 1 3 ) ( 1 4 ) ( 1 5 ) ( 1 6 ) ( 1 7 ) ( 1 8 ) ( 1 9 ) ( 2 0 ) ( 2 1 ) ( 2 2 ) ( 2 3 ) ( 2 4 ) ( 2 5 ) ( 2 6 ) ( 2 7 ) ( 2 8 ) ( 2 9 ) ( 3 0 ) ( 3 1 ) ( 3 2 ) ( 3 3 ) ( 3 4 ) ( 3 5 ) ( 3 6 ) ( 3 7 ) ( 3 8 ) ( 3 9 ) ( 4 0 ) ( 4 1 ) ( 4 2 ) ( 4 3 ) ( 4 4 ) ( 4 5 ) ( 4 6 ) ( 4 7 ) ( 4 8 ) ( 4 9 ) ( 5 0 ) ( 5 1 ) ( 5 2 ) ( 5 3 ) ( 5 4 ) ( 5 5 ) ( 5 6 ) ( 5 7 ) ( 5 8 ) ( 5 9 ) ( 6 0 ) ( 6 1 ) ( 6 2 ) ( 6 3 ) ( 6 4 ) ( 6 5 ) ( 6 6 ) ( 6 7 ) ( 6 8 ) ( 6 9 ) ( 7 0 ) ( 7 1 ) r e g i s t e r c o n t e n t s 0 0 3 2 1 6 0 0 3 3 1 6 0 0 3 6 1 6 0 0 3 f 1 6 0 0 4 0 1 6 0 0 4 1 1 6 0 0 4 2 1 6 0 0 4 3 1 6 0 0 4 4 1 6 0 0 4 5 1 6 0 0 4 6 1 6 0 0 4 7 1 6 0 0 5 0 1 6 0 0 5 1 1 6 0 0 5 2 1 6 0 0 5 3 1 6 0 0 5 4 1 6 0 0 5 5 1 6 0 0 5 8 1 6 0 0 5 9 1 6 0 0 5 a 1 6 0 0 5 b 1 6 0 0 5 c 1 6 0 0 5 d 1 6 0 0 5 f 1 6 0 0 6 a 1 6 0 0 6 c 1 6 0 0 6 d 1 6 0 0 6 e 1 6 0 0 6 f 1 6 f f c 9 1 6 ( p s ) ( p c h ) ( p c l ) a d d r e s s 0 0 1 6 0 0 1 6 0 0 1 6 0 0 1 6 0 0 1 6 0 0 1 6 0 0 1 6 0 0 1 6 0 0 1 6 0 0 1 6 0 0 1 6 0 0 1 6 0 0 1 6 0 0 1 6 0 0 1 6 0 0 1 6 0 0 1 6 0 0 1 6 0 0 1 6 f f 1 6 f f 1 6 f f 1 6 f f 1 6 a d d r e s s r e g i s t e r c o n t e n t s 0 0 1 6 0 0 1 6 0 0 1 6 0 0 1 6 0 0 1 6 0 0 1 6 0 0 1 6 0 0 1 6 0 0 1 6 0 0 1 6 0 0 1 6 0 0 1 6 0 0 1 6 0 0 1 6 0 0 1 6 0 0 1 6 0 0 1 6 0 0 1 6 0 0 1 6 0 0 1 6 0 0 1 6 0 0 1 6 0 0 1 6 0 0 1 6 0 0 1 6 0 0 1 6 0 0 1 6 0 0 1 6 0 0 1 6 f f 1 6 f f 1 6 0 0 1 6 0 0 1 6 f f f b 1 6 c o n t e n t s f f f a 1 6 c o n t e n t s c p u m o d e r e g i s t e r a ( c p u a ) c p u m o d e r e g i s t e r b ( c p u b ) i n t e r r u p t r e q u e s t r e g i s t e r a ( i r e q a ) i n t e r r u p t r e q u e s t r e g i s t e r b ( i r e q b ) i n t e r r u p t r e q u e s t r e g i s t e r c ( i r e q c ) i n t e r r u p t c o n t r o l r e g i s t e r a ( i c o n a ) i n t e r r u p t c o n t r o l r e g i s t e r b ( i c o n b ) i n t e r r u p t c o n t r o l r e g i s t e r c ( i c o n c ) p o r t p 0 ( p 0 ) p o r t p 0 d i r e c t i o n r e g i s t e r ( p 0 d ) p o r t p 1 ( p 1 ) p o r t p 1 d i r e c t i o n r e g i s t e r ( p 1 d ) p o r t p 2 ( p 2 ) p o r t p 2 d i r e c t i o n r e g i s t e r ( p 2 d ) p o r t p 3 ( p 3 ) p o r t p 3 d i r e c t i o n r e g i s t e r ( p 3 d ) p o r t c o n t r o l r e g i s t e r ( p t c ) i n t e r r u p t p o l a r i t y s e l e c t r e g i s t e r ( i p o l ) p o r t p 2 p u l l - u p c o n t r o l r e g i s t e r ( p u p 2 ) u s b c o n t r o l r e g i s t e r ( u s b c ) p o r t p 6 ( p 6 ) p o r t p 6 d i r e c t i o n r e g i s t e r ( p 6 d ) p o r t p 5 ( p 5 ) p o r t p 5 d i r e c t i o n r e g i s t e r ( p 5 d ) p o r t p 4 ( p 4 ) p o r t p 4 d i r e c t i o n r e g i s t e r ( p 4 d ) p o r t p 7 ( p 7 ) p o r t p 7 d i r e c t i o n r e g i s t e r ( p 7 d ) p o r t p 8 ( p 8 ) p o r t p 8 d i r e c t i o n r e g i s t e r ( p 8 d ) c l o c k c o n t r o l r e g i s t e r ( c c r ) t i m e r 1 ( t 1 ) t i m e r 2 ( t 2 ) t i m e r 3 ( t 3 ) t i m e r 1 2 3 m o d e r e g i s t e r ( t 1 2 3 m ) s e r i a l i / o c o n t r o l r e g i s t e r 1 ( s i o c o n 1 ) s e r i a l i / o c o n t r o l r e g i s t e r 2 ( s i o c o n 2 ) u a r t m o d e r e g i s t e r ( u m o d ) 0 0 0 0 1 6 0 0 0 1 1 6 0 0 0 2 1 6 0 0 0 3 1 6 0 0 0 4 1 6 0 0 0 5 1 6 0 0 0 6 1 6 0 0 0 7 1 6 0 0 0 8 1 6 0 0 0 9 1 6 0 0 0 a 1 6 0 0 0 b 1 6 0 0 0 c 1 6 0 0 0 d 1 6 0 0 0 e 1 6 0 0 0 f 1 6 0 0 1 0 1 6 0 0 1 1 1 6 0 0 1 2 1 6 0 0 1 3 1 6 0 0 1 4 1 6 0 0 1 5 1 6 0 0 1 6 1 6 0 0 1 7 1 6 0 0 1 8 1 6 0 0 1 9 1 6 0 0 1 a 1 6 0 0 1 b 1 6 0 0 1 c 1 6 0 0 1 d 1 6 0 0 1 f 1 6 0 0 2 4 1 6 0 0 2 5 1 6 0 0 2 6 1 6 0 0 2 9 1 6 0 0 2 b 1 6 0 0 2 c 1 6 0 0 3 0 1 6 1 0 0 0 0 0 0 u a r t s t a t u s r e g i s t e r ( u s t s ) u a r t c o n t r o l r e g i s t e r ( u c o n ) u a r t r t s c o n t r o l r e g i s t e r ( u r t s c ) d m a c i n d e x a n d s t a t u s r e g i s t e r ( d m a i s ) d m a c c h a n n e l x m o d e r e g i s t e r 1 ( d m a x 1 ) d m a c c h a n n e l x m o d e r e g i s t e r 2 ( d m a x 2 ) d m a c c h a n n e l x s o u r c e r e g i s t e r l o w ( d m a x s l ) d m a c c h a n n e l x s o u r c e r e g i s t e r h i g h ( d m a x s h ) d m a c c h a n n e l x d e s t i n a t i o n r e g i s t e r l o w ( d m a x d l ) d m a c c h a n n e l x d e s t i n a t i o n r e g i s t e r h i g h ( d m a x d h ) d m a c c h a n n e l x t r a n s f e r c o u n t r e g i s t e r l o w ( d m a x c l ) d m a c c h a n n e l x t r a n s f e r c o u n t r e g i s t e r h i g h ( d m a x c h ) u s b a d d r e s s r e g i s t e r ( u s b a ) u s b p o w e r m a n a g e m e n t r e g i s t e r ( u s b p m ) u s b i n t e r r u p t s t a t u s r e g i s t e r 1 ( u s b i s 1 ) u s b i n t e r r u p t s t a t u s r e g i s t e r 2 ( u s b i s 2 ) u s b i n t e r r u p t e n a b l e r e g i s t e r 1 ( u s b i e 1 ) u s b i n t e r r u p t e n a b l e r e g i s t e r 2 ( u s b i e 2 ) u s b e n d p o i n t i n d e x r e g i s t e r ( u s b i n d e x ) u s b e n d p o i n t x i n c o n t r o l r e g i s t e r ( i n _ c s r ) u s b e n d p o i n t x o u t c o n t r o l r e g i s t e r ( o u t _ c s r ) u s b e n d p o i n t x i n m a x . p a c k e t s i z e r e g i s t e r ( i n _ m a x p ) u s b e n d p o i n t x o u t m a x . p a c k e t s i z e r e g i s t e r ( o u t _ m a x p ) u s b e n d p o i n t x o u t w r i t e c o u n t r e g i s t e r ( w r t _ c n t ) u s b e n d p o i n t f i f o m o d e r e g i s t e r ( u s b f i f o m r ) f l a s h m e m o r y c o n t r o l r e g i s t e r ( f m c r ) f r e q u e n c y s y n t h e s i z e r c o n t r o l r e g i s t e r ( f s c ) f r e q u e n c y s y n t h e s i z e r m u l t i p l y r e g i s t e r 1 ( f s m 1 ) f r e q u e n c y s y n t h e s i z e r m u l t i p l y r e g i s t e r 2 ( f s m 2 ) f r e q u e n c y s y n t h e s i z e r d i v i d e r e g i s t e r ( f s m 2 ) r o m c o d e p r o t e c t c o n t r o l r e g i s t e r ( r o m c p ) p r o c e s s o r s t a t u s r e g i s t e r p r o g r a m c o u n t e r 0 0 0 0 1 1 0 0 0 1 1 0 0 1 0 0 1 1 0 0 0 0 0 0 0 ? 0 1 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 1 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 1 ( n o t e 1 ) ( n o t e 1 ) ( n o t e 3 ) ( n o t e 3 ) 3 : t h e f l a s h m e m o r y c o n t r o l r e g i s t e r a n d t h e r o m c o d e p r o t e c t c o n t r o l r e g i s t e r e x i s t s i n t h e f l a s h m e m o r y v e r s i o n o n l y . 2 : s i n c e t h e i n i t i a l v a l u e s f o r o t h e r t h a n a b o v e m e n t i o n e d r e g i s t e r s a n d r a m c o n t e n t s a r e i n d e f i n i t e a t r e s e t , t h e y m u s t b e s e t . 0 0 0 0 0 1 0 0 1 1 1 1 1 1 fig. 55 internal status at reset rev.1.00 jul 30, 2003 page 60 of 119 7643 group clock generating circuit the 7643 group has two built-in oscillation circuits. an oscillation circuit can be formed by connecting a resonator between x in and x out (x cin and x cout ). use the circuit constants in accordance with the resonator manufacturer s recommended values. no exter- nal resistor is needed between x in and x out since a feed-back resistor exists on-chip. however, an external feed-back resistor is needed between x cin and x cout . when using an external clock, input the clocks to the x in or x cin pin and leave the x out or x cout pin open. immediately after power on, only the x in oscillation circuit starts oscillating, and x cin and x cout pins function as i/o ports. frequency control the internal system clock can be selected among f syn , f(x in ), f(x in )/2, and f(x cin ). the internal clock is half the frequency of internal system clock. (1) f syn clock this is made by the frequency synthesizer. f(x in ) or f(x cin ) can be selected as its input clock. see also section ?requency syn- thesizer? (2) f(x in ) clock the frequency of internal system clock is the frequency of x in pin. (3) f(x in )/2 clock the frequency of internal system clock is half the frequency of x in pin. (4) f(x cin ) clock the frequency of internal system clock is the frequency of x cin pin. note if you switch the oscillation between x in - x out and x cin - x cout , stabilize both x in and x cin oscillations. the sufficient time is re- quired for the x cin oscillation to stabilize, especially immediately after power on and at returning from the stop mode. fig. 56 ceramic resonator or quartz-crystal oscillator exter- nal circuit fig. 57 external clock input circuit x cin x cout x in x out c in c ou t c cin c cout rf rd v cc v ss x cin x cout x in x out open open external oscillation circuit external oscillation circuit v cc v ss rev.1.00 jul 30, 2003 page 61 of 119 7643 group (5) low power dissipation mode ?the low power dissipation operation can be realized by stopping the main clock x in when using f(x cin ) as the internal system clock. to stop the main clock, set the main clock (x in -x out ) stop bit of the cpu mode register a to ?? ?the low power dissipation operation can be realized by disabling the reversed amplifier when inputting external clocks to the x in pin or x cin pin. to disable the reversed amplifier, set the x cout oscillation drive disable bit (ccr5) or x out oscillation drive disable bit (ccr6) of the clock control register to ?? oscillation control (1) stop mode if the stp instruction is executed, the internal clock stops at ? level, and x in and x cin oscillators stop. then the timer 1 is set to ?f 16 ?and the internal clock divided by 8 is automatically se- lected as its count source. additionally, the timer 2 is set to ?1 16 and the timer 1 s output is automatically selected as its count source. set the timer 1 and timer 2 interrupt enable bits to disabled (?? before executing the stp instruction. when using an external in- terrupt to release the stop mode, set the interrupt enable bit to be used to enabled (?? and the interrupt disable flag (i) to ?? oscillator restarts at reset or when an external interrupt including usb resume interrupts is received, but the internal clock re- mains at ??until the timer 2 underflows. the internal clock is supplied for the first time when the timer 2 underflows. therefore make sure not to set the timer 1 interrupt request bit and timer 2 interrupt request bit to ??before the stp instruction stops the oscillator. (2) wait mode if the wit instruction is executed, the internal clock stops at ? level, but the oscillator does not stop. the internal clock restarts at reset or when an interrupt is received. since the oscillator does not stop, normal operation can be started immediately after the in- ternal clock is restarted. set the interrupt enable bit to be used to release the wait mode to enabled (?? and the interrupt disable flag (i) to ?? fig. 58 structure of clock control register c l o c k c o n t r o l r e g i s t e r ( a d d r e s s 0 0 1 f 1 6 ) c c r r e s e r v e d b i t s ( 0 a t r e a d / w r i t e ) f i x t o 0 . x c o u t o s c i l l a t i o n d r i v e d i s a b l e b i t ( c c r 5 ) 0 : x c o u t o s c i l l a t i o n d r i v e i s e n a b l e d . ( w h e n x c i n o s c i l l a t i o n i s e n a b l e d . ) 1 : x c o u t o s c i l l a t i o n d r i v e i s d i s a b l e d . x o u t o s c i l l a t i o n d r i v e d i s a b l e b i t ( c c r 6 ) 0 : x o u t o s c i l l a t i o n d r i v e i s e n a b l e d . ( w h e n x i n o s c i l l a t i o n i s e n a b l e d . ) 1 : x o u t o s c i l l a t i o n d r i v e i s d i s a b l e d . x i n d i v i d e r s e l e c t b i t ( c c r 7 ) v a l i d w h e n c p m a 6 , c p m a 7 = 0 0 0 : f ( x i n ) / 2 i s u s e d f o r t h e s y s t e m c l o c k . 1 : f ( x i n ) i s u s e d f o r t h e s y s t e m c l o c k . b 0 b 7 0 0 0 0 0 rev.1.00 jul 30, 2003 page 62 of 119 7643 group fig. 59 clock generating circuit block diagram w i t i n s t r u c t i o n in t e r n a l c l o c k s t p i n s t r u c t i o n i n t e r r u p t r e q u e s t i n t e r r u p t d i s a b l e f l a g l d r q t p i n 1 d r q t p i n 2 d r q t p i n 1 d r q t p 2 + r q s d q t p i n 1 d q t p 2 + o s c i l l a t o r c o u n t - d o w n t i m e r 1 t o 2 r q s r q s r q s d q t d q t s q r s q b r d e l a y s l o w m e m o r y w a i t l p f l p f 1 / 2 f r e q u e n c y s y n t h e s i z e r f r e q u e n c y s y n t h e s i z e r e n a b l e b i t l p f 1 / 2 p 2 p e r i p h e r a l p 1 p e r i p h e r a l s t p i n s t r u c t i o n s t p i n s t r u c t i o n r e s e t s t p i n s t r u c t i o n p 2 l a t r s t b p 1 h a t r s t b p 2 p e r i p h e r a l p 1 p e r i p h e r a l p 2 o u t p 1 o u t p 2 l a t r s t b p 1 h a t r s t b p 2 p 1 d q t p i n 2 p 2 + m a i n c l o c k ( x i n - x o u t ) s t o p b i t o s c s t p r e s e t x c o s c s t p x o s c s t p x d o s c s t p x o d x c d o s c s t p x c o d s u b - c l o c k ( x ci n - x co u t ) s t o p b i t s l o w m e m o r y w a i t s e l e c t b i t s l o w m e m o r y w a i t m o d e s e l e c t b i t r d y x i n x o u t m a i n c l o c k ( x i n - x o u t ) s t o p b i t x o s c s t p x c i n s u b - c l o c k ( x ci n - x co u t ) s t o p b i t x co u t f r e q u e n c y s y n t h e s i z e r i n p u t b i t f i n u s b 4 8 m h z c l o c k o u t p u t f s y n f e x t i n t e r n a l s y s t e m c l o c k s e l e c t b i t f ( x i n ) f ( x ci n ) x i n d r i v e s e l e c t b i t p 1 + , p 2 + p i n 1 , p i n 2 p 1 h a t r s t b p 2 l a t r s t b r e s e t x c o s c s t p e x t e r n a l c l o c k s e l e c t b i t rev.1.00 jul 30, 2003 page 63 of 119 7643 group n o t e s r e s e t c p m a 4 1 0 f s c 0 0 1 x i n c l o c k o s c i l l a t i n g , x c i n c l o c k s t o p p e d , f r e q u e n c y s y n t h e s i z e r c l o c k s t o p p e d , c p m a = 0 c , f s c = 6 0 = f ( x i n / 4 ) 1 : s w i t c h t h e m o d e b y t h e a l l o w s s h o w n b e t w e e n t h e m o d e b l o c k s . ( d o n o t s w i t c h b e t w e e n t h e m o d e s d i r e c t l y w i t h o u t a n a l l o w . ) 2 : i n s t o p m o d e , t h o u g h t h e f r e q u e n c y s y n t h e s i z e r i s n o t a u t o m a t i c a l l y d i s a b l e d , t h e o s c i l l a t o r w h i c h s e n d s c l o c k s t o t h e f r e q u e n c y s y n t h e s i z e r s t o p s . s e t t h e s y s t e m c l o c k a n d d i s a b l e t h e f r e q u e n c y s y n t h e s i z e r b e f o r e e x e c u t i o n o f t h e s t p i n s t r u c t i o n . 3 : = f ( x i n ) / 2 c a n b e a l s o u s e d b y s e t t i n g t h e x i n d i v i d e r s e l e c t b i t ( c c r 7 ) t o 1 . t h e n t h i s d i a g r a m a l s o a p p l i e s t o t h a t c a s e . 4 : t h e f r e q u e n c y s y n t h e s i z e r s i n p u t c a n b e s e l e c t e d b e t w e e n x i n i n p u t a n d x ci n i n p u t r e g a r d l e s s o f t h e s y s t e m c l o c k . t h i s d i a g r a m a s s u m e s t h e f r e q u e n c y s y n t h e s i z e r s i n p u t t o b e t h e s y s t e m c l o c k . e n a b l e t h e o s c i l l a t o r t o b e u s e d f o r t h e f r e q u e n c y s y n t h e s i z e r s i n p u t b e f o r e e n a b l i n g t h e f r e q u e n c y s y n t h e s i z e r . 5 : s e l e c t t h e x ci n i n p u t a s t h e f r e q u e n c y s y n t h e s i z e r s i n p u t b y s e t t i n g t h e f r e q u e n c y s y n t h e s i z e r i n p u t b i t ( f s c 3 ) t o 1 b e f o r e s t o p p i n g x i n o s c i l l a t i o n . ( n o t e 3 ) x i n c l o c k o s c i l l a t i n g , x c i n c l o c k s t o p p e d , f r e q u e n c y s y n t h e s i z e r c l o c k o s c i l l a t i n g , c p m a = 0 c , f s c = 4 1 = f ( x i n / 4 ) c p m a 6 0 1 x i n c l o c k o s c i l l a t i n g , x c i n c l o c k s t o p p e d , f r e q u e n c y s y n t h e s i z e r c l o c k o s c i l l a t i n g , c p m a = 4 c , f s c = 4 1 = f ( p l l ) / 2 ( n o t e 3 ) ( n o t e 4 ) w a i t s t o p ( n o t e 2 ) w a i t f s c 0 0 1 x i n c l o c k o s c i l l a t i n g , x c i n c l o c k o s c i l l a t i n g , f r e q u e n c y s y n t h e s i z e r c l o c k s t o p p e d , c p m a = 1 c , f s c = 6 0 = f ( x i n / 4 ) ( n o t e 3 ) x i n c l o c k o s c i l l a t i n g , x c i n c l o c k o s c i l l a t i n g , f r e q u e n c y s y n t h e s i z e r c l o c k o s c i l l a t i n g , c p m a = 1 c , f s c = 4 1 = f ( x i n / 4 ) c p m a 6 0 1 x i n c l o c k o s c i l l a t i n g , x c i n c l o c k o s c i l l a t i n g , f r e q u e n c y s y n t h e s i z e r c l o c k o s c i l l a t i n g , c p m a = 5 c , f s c = 4 1 = f ( p l l ) / 2 ( n o t e 3 ) ( n o t e 4 ) ( n o t e 2 ) w a i t s t o p w a i t c p m a 7 1 0 f s c 0 0 1 x i n c l o c k o s c i l l a t i n g , x c i n c l o c k o s c i l l a t i n g , f r e q u e n c y s y n t h e s i z e r c l o c k s t o p p e d , c p m a = 9 c , f s c = 6 0 = f ( x ci n / 2 ) x i n c l o c k o s c i l l a t i n g , x c i n c l o c k o s c i l l a t i n g , f r e q u e n c y s y n t h e s i z e r c l o c k o s c i l l a t i n g , c p m a = 9 c , f s c = 4 1 = f ( x ci n / 2 ) c p m a 6 0 1 x i n c l o c k o s c i l l a t i n g , x c i n c l o c k o s c i l l a t i n g , f r e q u e n c y s y n t h e s i z e r c l o c k o s c i l l a t i n g , c p m a = d c , f s c = 4 1 = f ( p l l ) / 2 ( n o t e 4 ) ( n o t e 2 ) w a i t s t o p w a i t c p m a 5 1 0 f s c 0 0 1 x i n c l o c k s t o p p e d , x c i n c l o c k o s c i l l a t i n g , f r e q u e n c y s y n t h e s i z e r c l o c k s t o p p e d , c p m a = b c , f s c = 6 8 = f ( x ci n / 2 ) x i n c l o c k s t o p p e d , x c i n c l o c k o s c i l l a t i n g , f r e q u e n c y s y n t h e s i z e r c l o c k o s c i l l a t i n g , c p m a = b c , f s c = 4 9 = f ( x ci n / 2 ) c p m a 6 0 1 x i n c l o c k s t o p p e d , x c i n c l o c k o s c i l l a t i n g , f r e q u e n c y s y n t h e s i z e r c l o c k o s c i l l a t i n g , c p m a = f c , f s c = 4 9 = f ( p l l ) / 2 ( n o t e 2 ) w a i t s t o p w a i t ( n o t e 5 ) ( n o t e 4 ) r e m a r k s : t h i s d i a g r a m a s s u m e s t h a t : s t a c k p a g e i s p a g e 1 i n s i n g l e - c h i p m o d e ( d e p e n d i n g o n t h e c p u m o d e r e g i s t e r a ) e x p r e s s e s t h e i n t e r n a l c l o c k . fig. 60 state transitions of clock rev.1.00 jul 30, 2003 page 64 of 119 7643 group processor mode single-chip mode, memory expansion mode, and microprocessor mode which is only in the mask rom version can be selected by using the processor mode bits of cpu mode register a (bits 0 and 1 of address 0000 16 ). in the memory expansion mode and micro- processor mode, a memory can be expanded externally via ports p0 to p3. in these modes, ports p0 to p3 lose their i/o port func- tions and become bus pins. the port direction registers corresponding to those ports become external memory areas. fig. 61 memory maps in processor modes other than single- chip mode (1) single-chip mode select this mode by resetting the mcu with cnv ss connected to v ss . (2) memory expansion mode select this mode by setting the processor mode bits (b1, b0) to ?1?in software with cnv ss connected to v ss . this mode enables external memory expansion while maintaining the validity of the in- ternal rom. (3) microprocessor mode select this mode by resetting the mcu with cnv ss connected to v cc , or by setting the processor mode bits (b1, b0) to ?0?in soft- ware with cnv ss connected to v ss . in the microprocessor mode, the internal rom is no longer valid and an external memory must be used. do not set this mode in the flash memory version. port name port p0 port p1 port p2 port p3 function outputs low-order 8 bits of address. outputs high-order 8 bits of address. operates as i/o pins for data d 7 to d 0 (including instruction code). p3 0 is the rdy input pin. p3 1 and p3 2 function only as output pins p3 3 is the dma out output pin. p3 4 is the out output pin. p3 5 is the sync out output pin. p3 6 is the wr output pin, and p3 7 is the rd out- put pin. p4 0 is the edma pin. table 8 port functions in memory expansion mode and microprocessor mode port p4 8000 16 0470 16 0000 16 ffff 16 0008 16 0010 16 internal ram sfr area 0070 16 internal rom m37643m8 sfr area memory expansion mode microprocessor mode the shaded areas are external areas. internal ram sfr area sfr area 0470 16 0000 16 ffff 16 0008 16 0010 16 0070 16 8000 16 0a70 16 0000 16 ffff 16 0008 16 0010 16 0070 16 1000 16 reserved area m37643f8 internal ram internal rom sfr area memory expansion mode the shaded areas are external areas. sfr area rev.1.00 jul 30, 2003 page 65 of 119 7643 group fig. 62 structure of cpu mode register a c p u m o d e r e g i s t e r a ( a d d r e s s 0 0 0 0 1 6 ) c p m a p r o c e s s o r m o d e b i t s b 1 b 0 0 0 : s i n g l e - c h i p m o d e 0 1 : m e m o r y e x p a n s i o n m o d e 1 0 : m i c r o p r o c e s s o r m o d e ( n o t e 1 ) 1 1 : n o t a v a i l a b l e s t a c k p a g e s e l e c t b i t 0 : p a g e 0 1 : p a g e 1 f i x t o 1 . s u b - c l o c k ( x c i n - x c o u t ) c o n t r o l b i t 0 : s t o p p e d 1 : o s c i l l a t i n g m a i n c l o c k ( x i n - x o u t ) c o n t r o l b i t 0 : o s c i l l a t i n g 1 : s t o p p e d i n t e r n a l s y s t e m c l o c k s e l e c t b i t ( n o t e 2 ) 0 : e x t e r n a l c l o c k ( x i n - x o u t o r x c i n - x c o u t ) 1 : f s y n e x t e r n a l c l o c k s e l e c t b i t 0 : x i n - x o u t 1 : x c i n - x c o u t b 0 b 7 1 n o t e s1 : t h i s i s n o t a v a i l a b l e i n t h e f l a s h m e m o r y v e r s i o n . 2 : w h e n ( c p m a 6 , 7 ) = ( 0 , 0 ) , t h e i n t e r n a l s y s t e m c l o c k c a n b e s e l e c t e d b e t w e e n f ( x i n ) o r f ( x i n ) / 2 b y c c r 7 . t h e i n t e r n a l c l o c k i s t h e i n t e r n a l s y s t e m c l o c k d i v i d e d b y 2 . cpu mode register b (address 0001 16 ) cpmb reserved bit (??at read/write) b0 b7 1 0 slow memory wait select bits b1b0 0 0: no wait 0 1: one-time wait 1 0: two-time wait 1 1: three-time wait slow memory wait mode select bits b3b2 0 0: software wait 0 1: not available 1 0: rdy wait 1 1: software wait plus rdy input anytime wait expanded data memory access bit 0: edma output disabled 1: edma output enabled hold function enable bit 0: hold function disabled 1: hold function enabled fix to ?? fig. 63 structure of cpu mode register b rev.1.00 jul 30, 2003 page 66 of 119 7643 group slow memory wait the 7643 group is equipped with the slow memory wait function (software wait, rdy wait, and extended rdy wait: software wait plus rdy input anytime wait) for easier interfacing with external devices that have long access times. the slow memory wait func- tion can be enabled in the memory expansion mode and microprocessor mode. the appropriate wait mode is selected by setting bits 0 to 3 of cpu mode register b (address 0001 16 ). this function can extend the read cycle or write cycle only for access to an external memory. however, this wait function cannot be en- abled for access to addresses 0008 16 to 000f 16 . (1) software wait the software wait is selected by setting ?0?to the slow memory wait mode select bits of cpu mode register b (address 0001 16 ). read/write cycles (??width of rd pin/wr pin) can be extended by one to three cycles. the number of cycles to be extended can be selected with the slow memory wait select bits. when the software wait function is selected, the rdy pin status becomes in- valid. (2) rdy wait rdy wait is selected by setting ?0?to the slow memory wait mode select bits of cpu mode register b (address 0001 16 ). when a fixed time of ??is input to the rdy pin at the beginning of a read/write cycle (before cycle falls), the mcu goes to the rdy state. the read/write cycle can then be extended by one to three cycles. the number of cycles to be added can be selected by the slow memory wait bits. (3) software wait + extended rdy wait extended rdy wait is selected by setting ?1?to the slow memory wait mode select bits of cpu mode register b (address 0001 16 ). the read/write cycle can be extended when a fixed time of ??is input to the rdy pin at the beginning of a read/write cycle (before cycle falls). the rdy pin state is checked continually at each fall of cycle until the rdy pin goes to ?? when ??is in- put to the rdy pin, the wait is released within 1, 2, or 3 cycles (as selected with the slow memory wait bits). fig. 64 software wait timing diagram x i n o u t a d o u t r d w r c p m b = 0 0 1 6 c p m b = 0 1 1 6 1 - c y c l e s o f t w a r e w a i t n o w a i t c p m b = 0 2 1 6 2-c y c l e s o f t w a r e w a i t c p m b = 0 3 1 6 3- c y c l e s o f t w a r e w a i t n o t e : t h i s d i a g r a m a s s u m e s = x i n / 2 . fig. 65 rdy wait timing diagram x in out a d out r d w r cpmb = 08 16 cpmb = 09 16 cpmb = 0a 16 cpmb = 0b 16 r dy t su 1-cycle rdy wait no wait 2-cycle rdy wait 3-cycle rdy wait t su t su t su t su t su note : this diagram assumes = x in /2. rev.1.00 jul 30, 2003 page 67 of 119 7643 group fig. 66 extended rdy wait (software wait plus rdy input anytime wait) timing diagram x in out a d out r d w r cpmb = 0c 16 cpmb = 0d 16 cpmb = 0e 16 r dy t su cpmb = 0f 16 cpmb = 0e 16 1-cycle extended rdy wait no wait 2-cycle extended rdy wait t su t su t su t su t su t su t su t su t su t su t su t su x in out a d out r d w r r dy 2-cycle extended rdy wait 3-cycle extended rdy wait t su t su t su t su t su t su t su t su t su t su t su t su t su t su t su note : this diagram assumes = x in /2. rev.1.00 jul 30, 2003 page 68 of 119 7643 group hold function the hold function is used for systems that consist of external cir- cuits that access mcu buses without use of the cpu (central processing unit). the hold function is used to generate the tim- ing in which the mcu will relinquish the bus from the cpu to the external circuits. to use the hold function, set the hold function enable bit of cpu mode register b (address 0001 16 ) to ?? this function can be used with both the hold pin and the hlda pin. the hold signal is a signal from an external circuit requesting the mcu to relinquish use of the bus. when ??level is input, the mcu goes to the hold state and remains so while the pin is at ?? the oscillator does not stop oscillating during the hold state, there- fore allowing the internal peripheral functions to operate during this time. when the mcu relinquishes use of the bus, ??level is output from the hlda pin. the mcu makes ports p0 and p1 (address buses) and port p2 (data bus) tri-state outputs and holds port p3 7 (rd pin) and port p3 6 (wr pin) ??level. port p3 4 ( out pin) contin- ues to oscillate. this function is not valid when the mcu is using the ibf 1 function with the hlda pin. expanded data memory access in expanded data memory access mode, the mcu can access a data area larger than 64 kbytes with the lda ($zz), y (indirect y) instruction and the sta ($zz), y (indirect y) instruction. to use this mode, set the expanded data memory access bit of cpu mode register b (address 0001 16 ) to ?? in this case, port p4 0 (edma pin) goes ??level during the read/write cycle of the lda or sta instruction. the determination of which bank to access is done by using an i/ o port to represent expanded addresses exceeding address bus ab 15 . for example, when accessing 4 banks, use two i/o ports to represent address buses ab 16 and ab 17 . fig. 67 hold function timing diagram x i n r d , w r a d d r o u t d a t a i n / o u t h o l d h l d a o u t t s u ( h o l d - ) t h ( - h o l d ) t d ( - h l d a l ) t d ( - h l d a h ) n o t e : t h i s d i a g r a m a s s u m e s = x i n / 2 . rev.1.00 jul 30, 2003 page 69 of 119 7643 group fig. 68 sta ($ zz), y instruction sequence when edma enabled s y n c o u t r d w r a d d r e s s d a t a p c + 1 p c p c + 2 o p c o d e e d m a b a l b a l , 0 0 b a l + 1 , 0 0 a d l + y , a d h a d l + y , a d h + c a d l a d h i n v a l i d d a t a n e x t o p c o d e s y n c o u t r d w r a d d r e s s d a t a p c + 1 p c p c + 2 o p c o d e e d m a b a l b a l , 0 0 b a l + 1 , 0 0 a d l + y , a d h a d l + y , a d h + c a d l a d h i n v a l i d d a t a n e x t o p c o d e fig. 69 lda ($ zz), y instruction sequence when edma enabled and t flag = ? fig. 70 lda ($ zz), y instruction sequence when edma enabled and t flag = ? s y n c o u t r d w r a d d r e s s d a t a p c + 1 p c x , 0 0 o p c o d e e d m a b a l b a l , 0 0 b a l + 1 , 0 0 a d l + y , a d h a d l + y , a d h + c a d l a d h i n v a l i d d a t a n e x t o p c o d e p c + 2 i n v a l i d d a t a rev.1.00 jul 30, 2003 page 70 of 119 7643 group parameter power source voltage analog power source voltage avcc, ext.cap input voltage p0 0 ?0 7 , p1 0 ?1 7 , p2 0 ?2 7, p3 0 ?3 7, p4 0 ?4 4, p5 0 ?5 7, p6 0 ?6 7, p7 0 ?7 4, p8 0 ?8 7 input voltage reset, x in , x cin input voltage cnv ss mask rom version flash memory version input voltage usb d+, usb d output voltage p0 0 ?0 7 , p1 0 ?1 7 , p2 0 ?2 7, p3 0 ?3 7, p4 0 ?4 4, p5 0 ?5 7, p6 0 ?6 7, p7 0 ?7 4, p8 0 ?8 7, x out , x cout, lpf output voltage usb d+, usb d? ext. cap power dissipation ( note ) operating temperature storage temperature symbol v cc av cc v i v i v i v i v o v o p d t opr t stg electrical characteristics conditions ratings ?.3 to 6.5 ?.3 to v cc +0.3 ?.3 to v cc +0.3 ?.3 to v cc +0.3 ?.3 to vcc + 0.3 ?.3 to 6.5 ?.5 to 3.8 ?.3 to v cc +0.3 unit v v v v v v v v all voltages are based on vss. output transistors are cut off. ta = 25? ?.5 to 3.8 750 ?0 to 70 ?0 to 125 v mw ? ? note: the maximum power dissipation depends on the mcu s power dissipation and the specific heat consumption of the package. absolute maximum ratings table 9 absolute maximum ratings rev.1.00 jul 30, 2003 page 71 of 119 7643 group table 10 recommended operating conditions (vcc = 4.15 to 5.25 v, vss = 0 v, ta = ?0 to 70?, unless otherwise noted) power source voltage analog reference voltage power source voltage analog reference voltage ??input voltage p0 0 ?0 7 , p1 0 ?1 7 , p2 0 ?2 7, p3 0 ?3 7, p4 0 ?4 4, p5 0 ?5 7, p6 0 ?6 7, p7 0 ?7 4, p8 0 ?8 7 ??input voltage (selecting vihl level input) p2 0 ?2 7 ??input voltage reset, x in , x cin , cnvss ??input voltage usb d+, usb d ??input voltage p0 0 ?0 7 , p1 0 ?1 7 , p2 0 ?2 7, p3 0 ?3 7, p4 0 ?4 4, p5 0 ?5 7, p6 0 ?6 7, p7 0 ?7 4, p8 0 ?8 7 ??input voltage (selecting vihl level input) p2 0 ?2 7 ??input voltage reset, x in , x cin , cnvss ??input voltage usb d+, usb d ??total peak output current p0 0 ?0 7 , p1 0 ?1 7 , p2 0 ?2 7, ( note 1 )p3 0 ?3 7, p4 0 ?4 4, p5 0 ?5 7, p6 0 ?6 7, p7 0 ?7 4, p8 0 ?8 7 ??total peak output current p0 0 ?0 7 , p1 0 ?1 7 , p2 0 ?2 7, ( note 1 )p3 0 ?3 7, p4 0 ?4 4, p5 0 ?5 7, p6 0 ?6 7, p7 0 ?7 4, p8 0 ?8 7 ??total average output current p0 0 ?0 7 , p1 0 ?1 7 , p2 0 ?2 7, ( note 1 )p3 0 ?3 7, p4 0 ?4 4, p5 0 ?5 7, p6 0 ?6 7, p7 0 ?7 4, p8 0 ?8 7 ??total average output current p0 0 ?0 7 , p1 0 ?1 7 , p2 0 ?2 7, ( note 1 )p3 0 ?3 7, p4 0 ?4 4, p5 0 ?5 7, p6 0 ?6 7, p7 0 ?7 4, p8 0 ?8 7 ??peak output current p0 0 ?0 7 , p1 0 ?1 7 , p2 0 ?2 7, ( note 2 )p3 0 ?3 7, p4 0 ?4 4, p5 0 ?5 7, p6 0 ?6 7, p7 0 ?7 4, p8 0 ?8 7 ??peak output current p0 0 ?0 7 , p1 0 ?1 7 , p2 0 ?2 7, ( note 2 )p3 0 ?3 7, p4 0 ?4 4, p5 0 ?5 7, p6 0 ?6 7, p7 0 ?7 4, p8 0 ?8 7 ??average output current p0 0 ?0 7 , p1 0 ?1 7 , p2 0 ?2 7, ( note 3 )p3 0 ?3 7, p4 0 ?4 4, p5 0 ?5 7, p6 0 ?6 7, p7 0 ?7 4, p8 0 ?8 7 ??average output current p0 0 ?0 7 , p1 0 ?1 7 , p2 0 ?2 7, ( note 3 )p3 0 ?3 7, p4 0 ?4 4, p5 0 ?5 7, p6 0 ?6 7, p7 0 ?7 4, p8 0 ?8 7 main clock input frequency ( notes 4, 5 ) sub-clock input frequency ( notes 4, 6 ) v cc avcc v ss av ss v ih v ih v ih v ih v il v il v il v il i oh(peak) i ol(peak) i oh(avg) i ol(avg) i oh(peak) i ol(peak) i oh(avg) i ol(avg) f(x in ) f(x cin ) limits v v v v v parameter min. 4.15 4.15 0.8v cc 0.5v cc 0.8v cc 2.0 0 typ. 5.0 5.0 0 0 max. 5.25 v cc symbol unit 32.768 v cc v cc v cc 3.8 0.2v cc 0.16v cc 0.2v cc 0.8 ?0 80 v v v v v v v ma recommended operating conditions in vcc = 5 v 0 0 1 24 50/5.0 5.0 ?.0 10 ?0 40 ?0 ma mhz khz/mhz ma ma ma ma ma ma notes 1: the total peak output current is the peak value of the peak currents flowing through all the applicable ports. the total avera ge output current is the average value measured over 100 ms flowing through all the applicable ports. 2: the peak output current is the peak current flowing in each port. 3: the average output current is an average value measured over 100 ms. 4: the duty of oscillation frequency is 50 %. 5: connect a ceramic resonator or a quartz-crystal oscillator between the x in and x out pins. its maximum oscillation frequency must be 24 mhz. however, make sure to set to 12 mhz or slower. more faster clocks are required as the f(x in ) when using the frequency synthesizer as possible. 6: connect a ceramic resonator or a quartz-crystal oscillator between the x cin and x cout pins. its maximum oscillation frequency must be 50 khz. input an external clock having 5 mhz frequency (max.) from the x cin pin. rev.1.00 jul 30, 2003 page 72 of 119 7643 group i oh = ?0 ma ??output voltage p0 0 ?0 7 , p1 0 ?1 7 , p2 0 ?2 7, p3 0 ?3 7, p4 0 ?4 4, p5 0 ?5 7, p6 0 ?6 7, p7 0 ?7 4, p8 0 ?8 7 ??output voltage usb d+, usb d- limits v parameter min. v cc ?.0 typ. max. symbol unit test conditions v oh v oh table 11 electrical characteristics (1) (vcc = 4.15 to 5.25 v, vss = 0 v, ta = ?0 to 70?, unless otherwise noted) electrical characteristics in vcc = 5 v usb+, and usb- pins pull-down via a resistor of 15 k ? 5 % usb+ pin pull-up to ext. cap. pin via a resistor of 1.5 k ? 5 % i ol = 10 ma v ol ??output voltage p0 0 ?0 7 , p1 0 ?1 7 , p2 0 ?2 7, p3 0 ?3 7, p4 0 ?4 4, p5 0 ?5 7, p6 0 ?6 7, p7 0 ?7 4, p8 0 ?8 7 ??output voltage usb d+, usb d- usb+, and usb- pins pull-down via a resistor of 15 k ? 5 % usb+ pin pull-up to ext. cap. pin via a resistor of 1.5 k ? 5 % v t+ ? t- hysteresis int 0 , int 1 , rdy, hold, p2 0 ?2 7 (note 1) hysteresis urxd, sclk, srxd, srdy, cts hysteresis reset ??input current p0 0 ?0 7 , p1 0 ?1 7 , p2 0 ?2 7, p3 0 ?3 7, p4 0 ?4 4, p5 0 ?5 7, p6 0 ?6 7, p7 0 ?7 4, p8 0 ?8 7 ??input current reset, cnv ss ??input current x in ??input current x cin ??input current p0 0 ?0 7 , p1 0 ?1 7 , p3 0 ?3 7, p4 0 ?4 4, p5 0 ?5 7, p6 0 ?6 7, p7 0 ?7 4, p8 0 ?8 7 ??input current reset ??input current cnv ss ??input current x in ??input current x cin ??input current p2 0 ?2 7 ram hold voltage v t+ ? t- v t+ ? t- i ih i ih i ih i ih i il i il i il i il i il i il v i = v cc v i = v ss v i = v ss pull-ups ?ff v cc = 5.0 v, v i = v ss pull-ups ?n when clock is stopped 2.8 ?0 2.0 0.5 0.5 0.5 9.0 ?.0 ?5 3.6 2.0 0.3 5.0 5.0 20 5.0 ?.0 ?.0 ?0 ?0 ?.0 ?.0 v v v v v v a a a a a a a a a a a v ol ?40 5.25 v v ram note 1: this spec is hysteresis of key input interrupt. rev.1.00 jul 30, 2003 page 73 of 119 7643 group power source current (output transistor is isolated.) limits parameter min. typ. 40 max. 90 symbol unit test conditions i cc ma table 12 electrical characteristics (2) (vcc = 4.15 to 5.25 v, vss = 0 v, ta = ?0 to 70?, unless otherwise noted) in vcc = 5 v normal mode ( note 1 ) f(x in ) = 24 mhz, = 12 mhz usb operating frequency synthesizer on wait mode ( note 2 ) f(x in ) = 24 mhz, = 12 mhz usb block enabled, usb clock stopped, frequency synthesizer on wait mode ( note 3 ) f(x cin ) = 32 khz, = 16 khz usb block disabled frequency synthesizer off usb transceiver dc-dc converter off stop mode usb transceiver dc-dc converter on low current mode (usbc3 = ?? stop mode usb transceiver dc-dc converter off ta = 25 ? stop mode usb transceiver dc-dc converter off ta = 70 ? 5.0 100 11 10 250 1.0 10 ma a a a a rev.1.00 jul 30, 2003 page 74 of 119 7643 group reset input ??pulse width main clock input cycle time ( note ) main clock input ??pulse width main clock input ??pulse width sub-clock input cycle time sub-clock input ??pulse width sub-clock input ??pulse width int 0 , int 1 input cycle time int 0 , int 1 input ??pulse width int 0 , int 1 input ??pulse width timer t out delay time serial i/o external clock input cycle time serial i/o external clock input ??pulse width serial i/o external clock input ??pulse width serial i/o input setup time (external clock) serial i/o input hold time (external clock) serial i/o output delay time (external clock) serial i/o srdy valid time (external clock) serial i/o internal clock output cycle time serial i/o internal clock output ??pulse width serial i/o internal clock output ??pulse width serial i/o input setup time (internal clock) serial i/o input hold time (internal clock) serial i/o output delay time (internal clock) t w (reset) t c (x in ) t wh (x in ) t wl (x in ) t c (x cin ) t wh (x cin ) t wl (x cin ) t c (int) t wh (int) t wl (int) t d ( -tout) t c (sclk e ) t wh (sclk e ) t wl (sclk e ) t su (srxd-sclk e ) t h (sclk e -srxd) t d (sclk e -stxd) t v (sclk e -srdy) t c (sclk i ) t wh (sclk i ) t wl (sclk i ) t su (srxd-sclk i ) t h (sclk i -srxd) t d (sclk i -stxd) limits s ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns parameter min. 2 41.66 0.4?c(x in ) 0.4?c(x in ) 200 0.4?c(x cin ) 0.4?c(x cin ) 200 90 90 400 190 180 15 10 166.66 0.5?c(sclk i ) ?5 0.5?c(sclk i ) ?5 20 5 typ. max. symbol unit table 13 timing requirements (vcc = 4.15 to 5.25 v, vss = 0 v, ta = ?0 to 70?, unless otherwise noted) note: make sure not to exceed 12 mhz of , in other words, tc( ) 83.33 ns). for example, set bit 7 of the clock control register (ccr) to ??in the case of tc(x in ) < 41.66 ns. timing requirements in vcc = 5 v 15 25 26 5 rev.1.00 jul 30, 2003 page 75 of 119 7643 group clock cycle time clock ??pulse width clock ??pulse width ab 15 ?b 8 delay time ab 15 ?b 8 valid time ab 7 ?b 0 delay time ab 7 ?b 0 valid time wr delay time wr valid time rd delay time rd valid time sync out delay time sync out valid time dma out delay time dma out valid time rdy setup time rdy hold time hold setup time hold hold time hold ??delay time hold ??delay time data bus setup time data bus hold time data bus delay time data bus valid time ( note 1 ) edma delay time edma valid time wr pulse width rd pulse width ab 15 ?b 8 valid time before wr ab 7 ?b 0 valid time before wr ab 15 ?b 8 valid time after wr ab 7 ?b 0 valid time after wr ab 15 ?b 8 valid time before rd ab 7 ?b 0 valid time before rd ab 15 ?b 8 valid time after rd ab 7 ?b 0 valid time after rd rdy setup time before wr rdy hold time after wr rdy setup time before rd rdy hold time after rd data bus setup time before rd data bus hold time after rd data bus delay time before wr data bus valid time after wr ( note 1 ) edma delay time after wr edma valid time after rd usb output rise time, c l = 50 pf usb output fall time, c l = 50 pf t c ( ) t wh ( ) t wl ( ) t d ( -ah) t v ( -ah) t d ( -al) t v ( -al) t d ( -wr) t v ( -wr) t d ( -rd) t v ( -rd) t d ( -sync) t v ( -sync) t d ( -dma) t v ( -dma) t su (rdy- ) t h ( -rdy) t su (hold- ) t h ( -hold) t d ( -hldal) t d ( -hldah) t su (db- ) t h ( -db) t d ( -db) t v ( -db) t d ( -edma) t v ( -edma) t wl (wr) ( note 2 ) t wl (rd) ( note 2 ) t d (ah-wr) t d (al-wr) t v (wr-ah) t v (wr-al) t d (ah-rd) t d (al-rd) t v (rd-ah) t v (rd-al) t su (rdy-wr) t h (wr-rdy) t su (rdy-rd) t h (rd-rdy) t su (db-rd) t h (rd-db) t d (wr-db) t v (wr-db) t v (wr-edma) t v (rd-edma) t r (d+), t r (d-) t f (d+), t f (d-) limits ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns parameter min. 83.33 0.5?c( ) ?5 0.5?c( ) ?5 0 0 0 0 0 0 21 0 21 0 7 0 13 0 0.5?c( ) ?5 0.5?c( ) ?5 0.5?c( ) ?28 0.5?c( ) ?30 0 0 0.5?c( ) ?28 0.5?c( ) ?30 0 0 27 0 27 0 13 0 10 0 0 4 4 typ. max. symbol unit table 14 timing requirements and switching characteristics in memory expansion and microprocessor modes (vcc = 4.15 to 5.25 v, vss = 0 v, ta = ?0 to 70?, unless otherwise noted) 31 33 6 6 6 25 in vcc = 5 v 25 25 22 12 20 20 20 rev.1.00 jul 30, 2003 page 76 of 119 7643 group notes 1: test conditions: i ohl = 5ma, c l = 50 pf 2: t wl (rd) = ((n + 0.5) ?tc(phi)) ?5 ns (n = wait number) t wl (wr) = ((n + 0.5) ?tc(phi)) ?5 ns (n = wait number) for example, two software waits, phi = 12 mhz operating t wl (rd) = 2.5 ?tc(phi) ?5 ns = 203.33 ns table 15 recommended operating conditions (vcc = 3.0 to 3.6 v, vss = 0 v, ta = ?0 to 70?, unless otherwise noted) power source voltage analog reference voltage power source voltage analog reference voltage dc-dc converter voltage ??input voltage p0 0 ?0 7 , p1 0 ?1 7 , p2 0 ?2 7, p3 0 ?3 7, p4 0 ?4 4, p5 0 ?5 7, p6 0 ?6 7, p7 0 ?7 4, p8 0 ?8 7 ??input voltage (selecting vihl level input) p2 0 ?2 7 ??input voltage reset, x in , x cin , cnvss ??input voltage usb d+, usb d ??input voltage p0 0 ?0 7 , p1 0 ?1 7 , p2 0 ?2 7, p3 0 ?3 7, p4 0 ?4 4, p5 0 ?5 7, p6 0 ?6 7, p7 0 ?7 4, p8 0 ?8 7 ??input voltage (selecting vihl level input) p2 0 ?2 7 ??input voltage reset, x in , x cin , cnvss ??input voltage usb d+, usb d ??total peak output current p0 0 ?0 7 , p1 0 ?1 7 , p2 0 ?2 7, ( note 1 )p3 0 ?3 7, p4 0 ?4 4, p5 0 ?5 7, p6 0 ?6 7, p7 0 ?7 4, p8 0 ?8 7 ??total peak output current p0 0 ?0 7 , p1 0 ?1 7 , p2 0 ?2 7, ( note 1 )p3 0 ?3 7, p4 0 ?4 4, p5 0 ?5 7, p6 0 ?6 7, p7 0 ?7 4, p8 0 ?8 7 ??total average output current p0 0 ?0 7 , p1 0 ?1 7 , p2 0 ?2 7, ( note 1 )p3 0 ?3 7, p4 0 ?4 4, p5 0 ?5 7, p6 0 ?6 7, p7 0 ?7 4, p8 0 ?8 7 ??total average output current p0 0 ?0 7 , p1 0 ?1 7 , p2 0 ?2 7, ( note 1 )p3 0 ?3 7, p4 0 ?4 4, p5 0 ?5 7, p6 0 ?6 7, p7 0 ?7 4, p8 0 ?8 7 ??peak output current p0 0 ?0 7 , p1 0 ?1 7 , p2 0 ?2 7, ( note 2 )p3 0 ?3 7, p4 0 ?4 4, p5 0 ?5 7, p6 0 ?6 7, p7 0 ?7 4, p8 0 ?8 7 ??peak output current p0 0 ?0 7 , p1 0 ?1 7 , p2 0 ?2 7, ( note 2 )p3 0 ?3 7, p4 0 ?4 4, p5 0 ?5 7, p6 0 ?6 7, p7 0 ?7 4, p8 0 ?8 7 ??average output current p0 0 ?0 7 , p1 0 ?1 7 , p2 0 ?2 7, ( note 3 )p3 0 ?3 7, p4 0 ?4 4, p5 0 ?5 7, p6 0 ?6 7, p7 0 ?7 4, p8 0 ?8 7 ??average output current p0 0 ?0 7 , p1 0 ?1 7 , p2 0 ?2 7, ( note 3 )p3 0 ?3 7, p4 0 ?4 4, p5 0 ?5 7, p6 0 ?6 7, p7 0 ?7 4, p8 0 ?8 7 main clock input frequency ( notes 4, 5 ) sub-clock input frequency ( notes 4, 6 ) v cc avcc v ss av ss ext. cap. v ih v ih v ih v ih v il v il v il v il i oh(peak) i ol(peak) i oh(avg) i ol(avg) i oh(peak) i ol(peak) i oh(avg) i ol(avg) f(x in ) f(x cin ) limits v v v v v parameter min. 3.0 3.0 3.0 0.8v cc 0.5v cc 0.8v cc 2.0 0 typ. 3.3 3.3 0 0 3.3 max. 3.6 v cc symbol unit 3.6 v cc recommended operating conditions in vcc = 3 v 0 0 1 v cc v cc 0.2v cc 0.16v cc 0.2v cc 0.8 ?0 80 ?0 40 ?0 10 ?.0 v v v v v v v v ma ma ma ma ma ma ma ma ma 32.768 5.0 24 50/5.0 mhz khz/mhz notes 1: the total peak output current is the peak value of the peak currents flowing through all the applicable ports. the total avera ge output current is the average value measured over 100 ms flowing through all the applicable ports. 2: the peak output current is the peak current flowing in each port. 3: the average output current is an average value measured over 100 ms. 4: the duty of oscillation frequency is 50 %. 5: connect a ceramic resonator or a quartz-crystal oscillator between the x in and x out pins. its maximum oscillation frequency must be 24 mhz. however, make sure to set to 6 mhz or slower. more faster clocks are required as the f(x in ) when using the frequency synthesizer as possible. 6: connect a ceramic resonator or a quartz-crystal oscillator between the x cin and x cout pins. its maximum oscillation frequency must be 50 khz. input an external clock having 5 mhz (max.) frequency from the x cin pin. rev.1.00 jul 30, 2003 page 77 of 119 7643 group table 16 electrical characteristics (1) (vcc = 3.0 to 3.6 v, vss = 0 v, ta = ?0 to 70?, unless otherwise noted) electrical characteristics in vcc = 3 v i oh = ? ma ??output voltage p0 0 ?0 7 , p1 0 ?1 7 , p2 0 ?2 7, p3 0 ?3 7, p4 0 ?4 4, p5 0 ?5 7, p6 0 ?6 7, p7 0 ?7 4, p8 0 ?8 7 ??output voltage usb d+, usb d- limits v parameter min. v cc ?.0 typ. max. symbol unit test conditions v oh v oh usb+, and usb- pins pull-down via a resistor of 15 k ? 5 % usb+ pin pull-up to ext. cap. pin via a resistor of 1.5 k ? 5 % i ol = 1 ma v ol ??output voltage p0 0 ?0 7 , p1 0 ?1 7 , p2 0 ?2 7, p3 0 ?3 7, p4 0 ?4 4, p5 0 ?5 7, p6 0 ?6 7, p7 0 ?7 4, p8 0 ?8 7 ??output voltage usb d+, usb d- usb+, and usb- pins pull-down via a resistor of 15 k ? 5 % usb+ pin pull-up to ext. cap. pin via a resistor of 1.5 k ? 5 % v t+ ? t- hysteresis int 0 , int 1 , rdy, hold, p2 0 ?2 7 (note 1) hysteresis urxd, sclk, srxd, srdy, cts hysteresis reset ??input current p0 0 ?0 7 , p1 0 ?1 7 , p2 0 ?2 7, p3 0 ?3 7, p4 0 ?4 4, p5 0 ?5 7, p6 0 ?6 7, p7 0 ?7 4, p8 0 ?8 7 ??input current reset, cnv ss ??input current x in ??input current x cin ??input current p0 0 ?0 7 , p1 0 ?1 7 , p3 0 ?3 7, p4 0 ?4 4, p5 0 ?5 7, p6 0 ?6 7, p7 0 ?7 4, p8 0 ?8 7 ??input current reset ??input current cnv ss ??input current x in ??input current x cin ??input current p2 0 ?2 7 ram hold voltage v t+ ? t- v t+ ? t- i ih i ih i ih i ih i il i il i il i il i il i il v i = v cc v i = v ss v i = v ss pull-ups ?ff v cc = 3.0 v, v i = v ss pull-ups ?n when clock is stopped 2.8 ?0 2.0 0.3 0.3 0.3 9.0 ?.0 ?0 3.6 1.0 0.3 5.0 5.0 20 5.0 ?.0 ?.0 ?0 ?0 ?.0 ?.0 v v v v v v a a a a a a a a a a a v ol ?0 v v ram 0 note 1: this spec is hysteresis of key input interrupt. rev.1.00 jul 30, 2003 page 78 of 119 7643 group table 17 electrical characteristics (2) (vcc = 3.0 to 3.6 v, vss = 0 v, ta = ?0 to 70?, unless otherwise noted) in vcc = 3 v power source current (output transistor is isolated.) limits parameter min. typ. 25 max. 45 symbol unit test conditions i cc ma normal mode ( note 1 ) f(x in ) = 24 mhz, = 6 mhz usb operating frequency synthesizer on wait mode ( note 2 ) f(x in ) = 24 mhz, = 6 mhz usb block enabled, usb clock stopped, frequency synthesizer on wait mode ( note 3 ) f(x cin ) = 32 khz, = 16 khz usb block disabled frequency synthesizer off usb transceiver dc-dc converter off stop mode usb transceiver dc-dc converter off ta = 25 ? stop mode usb transceiver dc-dc converter off ta = 70 ? 2.5 6 6 1.0 10 ma a a a rev.1.00 jul 30, 2003 page 79 of 119 7643 group reset input ??pulse width main clock input cycle time ( note ) main clock input ??pulse width main clock input ??pulse width sub-clock input cycle time sub-clock input ??pulse width sub-clock input ??pulse width int 0 , int 1 input cycle time int 0 , int 1 input ??pulse width int 0 , int 1 input ??pulse width timer t out delay time serial i/o external clock input cycle time serial i/o external clock input ??pulse width serial i/o external clock input ??pulse width serial i/o input setup time (external clock) serial i/o input hold time (external clock) serial i/o output delay time (external clock) serial i/o srdy valid time (external clock) serial i/o internal clock output cycle time serial i/o internal clock output ??pulse width serial i/o internal clock output ??pulse width serial i/o input setup time (internal clock) serial i/o input hold time (internal clock) serial i/o output delay time (internal clock) t w (reset) t c (x in ) t wh (x in ) t wl (x in ) t c (x cin ) t wh (x cin ) t wl (x cin ) t c (int) t wh (int) t wl (int) t d ( -tout) t c (sclk e ) t wh (sclk e ) t wl (sclk e ) t su (srxd-sclk e ) t h (sclk e -srxd) t d (sclk e -stxd) t v (sclk e -srdy) t c (sclk i ) t wh (sclk i ) t wl (sclk i ) t su (srxd-sclk i ) t h (sclk i -srxd) t d (sclk i -stxd) limits s ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns parameter min. 2 41.66 0.4?c(x in ) 0.4?c(x in ) 200 0.4?c(x cin ) 0.4?c(x cin ) 250 110 110 450 220 190 20 15 300 0.5?c(sclk i ) ?5 0.5?c(sclk i ) ?5 20 5 typ. max. symbol unit table 18 timing requirements (vcc = 3.0 to 3.6 v, vss = 0 v, ta = ?0 to 70?, unless otherwise noted) note: make sure not to exceed 6 mhz of , in other words, tc( ) 166.66 ns). timing requirements in vcc = 3 v 17 34 35 5 rev.1.00 jul 30, 2003 page 80 of 119 7643 group clock cycle time clock ??pulse width clock ??pulse width ab 15 ?b 8 delay time ab 15 ?b 8 valid time ab 7 ?b 0 delay time ab 7 ?b 0 valid time wr delay time wr valid time rd delay time rd valid time sync out delay time sync out valid time dma out delay time dma out valid time rdy setup time rdy hold time hold setup time hold hold time hold ??delay time hold ??delay time data bus setup time data bus hold time data bus delay time data bus valid time ( note 1 ) edma delay time edma valid time wr pulse width rd pulse width ab 15 ?b 8 valid time before wr ab 7 ?b 0 valid time before wr ab 15 ?b 8 valid time after wr ab 7 ?b 0 valid time after wr ab 15 ?b 8 valid time before rd ab 7 ?b 0 valid time before rd ab 15 ?b 8 valid time after rd ab 7 ?b 0 valid time after rd rdy setup time before wr rdy hold time after wr rdy setup time before rd rdy hold time after rd data bus setup time before rd data bus hold time after rd data bus delay time after wr data bus valid time after wr ( note 1 ) edma delay time after wr edma valid time after rd usb output rise time, c l = 50 pf usb output fall time, c l = 50 pf t c ( ) t wh ( ) t wl ( ) t d ( -ah) t v ( -ah) t d ( -al) t v ( -al) t d ( -wr) t v ( -wr) t d ( -rd) t v ( -rd) t d ( -sync) t v ( -sync) t d ( -dma) t v ( -dma) t su (rdy- ) t h ( -rdy) t su (hold- ) t h ( -hold) t d ( -hldal) t d ( -hldah) t su (db- ) t h ( -db) t d ( -db) t v ( -db) t d ( -edma) t v ( -edma) t wl (wr) ( note 2 ) t wl (rd) ( note 2 ) t d (ah-wr) t d (al-wr) t v (wr-ah) t v (wr-al) t d (ah-rd) t d (al-rd) t v (rd-ah) t v (rd-al) t su (rdy-wr) t h (wr-rdy) t su (rdy-rd) t h (rd-rdy) t su (db-rd) t h (rd-db) t d (wr-db) t v (wr-db) t v (wr-edma) t v (rd-edma) t r (d+), t r (d-) t f (d+), t f (d-) limits s ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns parameter min. 166.66 0.5?c( ) ?5 0.5?c( ) ?5 0 0 0 0 0 0 35 0 21 0 9 0 15 0 0.5?c( ) ?6 0.5?c( ) ?6 0.5?c( ) ?33 0.5?c( ) ?35 0 0 0.5?c( ) ?33 0.5?c( ) ?35 0 0 45 0 45 0 18 0 12 0 0 4 4 typ. max. symbol unit table 19 timing requirements and switching characteristics in memory expansion and microprocessor modes (vcc = 3.0 to 3.6 v, vss = 0 v, ta = ?0 to 70?, unless otherwise noted) 45 47 8 8 11 26 in vcc = 3 v 30 30 30 15 28 20 20 rev.1.00 jul 30, 2003 page 81 of 119 7643 group fig. 71 circuit for measuring output switching characteristics (1) notes 1: test conditions: i ohl = 5ma, c l = 50 pf 2: t wl (rd) = ((n + 0.5) ?tc(phi)) ?5 ns (n = wait number) t wl (wr) = ((n + 0.5) ?tc(phi)) ?5 ns (n = wait number) for example, two software waits, phi = 12 mhz operating t wl (rd) = 2.5 ?tc(phi) ?5 ns = 203.33 ns m easurement output pin 100 pf cmos output n - c h a n n e l o p e n - d r a i n o u t p u t ( n o t e ) 1 k ? 1 0 0 p f m e a s u r e m e n t o u t p u t p i n n o t e : t h i s d i a g r a m a p p l i e s w h e n b i t 7 o f t h e s e r i a l i / o c o n t r o l r e g i s t e r 1 i s 1 . fig. 72 circuit for measuring output switching characteristics (2) rev.1.00 jul 30, 2003 page 82 of 119 7643 group 0.2v cc t wl(int) 0.8v cc t wh(int) 0.5v cc 0.2v cc t wl(x in ) 0.8v cc t wh(x in ) t c(x in ) x in 0.2v cc 0.8v cc t w(reset) reset t d( ?t out ) t out int 0, int 1 0.2v cc t wl(x cin ) 0.8v cc t wh(x cin ) t c(x cin ) x cin 0.5v cc t c(int) timing diagram [interrupt] [input] [timer] fig. 73 timing diagram (1) rev.1.00 jul 30, 2003 page 83 of 119 7643 group 0.2v cc 0.2v cc 0.8v cc 0.8v cc t d(sclk e, i ?stxd) t c(sclk e,i ) t wl(sclk e, i ) t wh(sclk e,i ) th(sclk e, i ? srxd) t su(srxd ? sclk e, i ) stxd srxd sclk srdy t v(sclk e ?srdy) 0.5v cc 0.8v cc timing diagram [serial i/o] fig. 74 timing diagram (2) tf( d +) tf( d -) tr( d +) tr( d -) usbd+, usbd- 0.1v oh 0.9v oh fig. 75 timing diagram (3) rev.1.00 jul 30, 2003 page 84 of 119 7643 group t wl( ) 0.5v cc t wh( ) t c( ) t d( -ah) t d( -al) t d( -sync) t v( -ah) t v( -al) t v( -sync) t d( -wr) t d( -rd) t v( -wr) t v( -rd) 0.5v cc 0.5v cc 0.5v cc ab 15 to ab 8 ab 7 to ab 0 sync out rd,wr dma out 0.8v cc 0.2v cc t h( -db) 0.5v cc t d( -db) t v( -db) db 0 to db 7 db 0 to db 7 0.5v cc t v( -dma) 0.5v cc t d( -dma) rdy 0.8v cc 0.2v cc t su(rdy- ) t h( -rdy) hold (at entering) 0.8v cc 0.2v cc t su(hold- ) t h( -hold) hlda t d( -hldal) hold (at releasing) 0.8v cc 0.2v cc t su(hold- ) t h( -hold) hlda t d( -hldah) 0.5v cc 0.5v cc t su(db- ) < cpu write> edma 0.5v cc t v( -edma) 0.5v cc t d( -edma) < cpu read> n cycles of fig. 76 timing diagram (4); memory expansion and microprocessor modes rev.1.00 jul 30, 2003 page 85 of 119 7643 group 0.5v cc rd,wr 0.5v cc ab 15 to ab 8 t d(ah-wr) t v(wr-ah) 0.5v cc ab 7 to ab 0 t d(al-wr) t v(wr-al) 0.8v cc 0.2v cc db 0 to db 7 t su(db-rd) t h(rd-db) 0.5v cc db 0 to db 7 t d(wr-db) t v(wr-db) rdy t v(rd-ah) t d(ah-rd) t d(al-rd) t v(rd-al) t wl(rd) t wl(wr) 0.8v cc 0.2v cc t su(rdy-wr) tsu(rdy-rd) t h(wr-rdy) th(rd-rdy) rev.1.00 jul 30, 2003 page 86 of 119 7643 group table 20 summary of m37643f8 (flash memory version) flash memory mode the m37643f8fp/hp (flash memory version) has an internal new dinor (divided bit line nor) flash memory that can be rewritten with a single power source when v cc is 5 v, and 2 power sources when v pp is 5 v and v cc is 3.3 v in the cpu rewrite and standard serial i/o modes. for this flash memory, three flash memory modes are available in which to read, program, and erase: the parallel i/o and standard serial i/o modes in which the flash memory can be manipulated using a programmer and the cpu rewrite mode in which the flash memory can be manipulated by the central processing unit (cpu). summary table 20 lists the summary of the m37643f8 (flash memory ver- sion). this flash memory version has some blocks on the flash memory as shown in figure 78 and each block can be erased. the flash memory is divided into user rom area and boot rom area. in addition to the ordinary user rom area to store the mcu op- eration control program, the flash memory has a boot rom area that is used to store a program to control rewriting in cpu rewrite and standard serial i/o modes. this boot rom area has had a standard serial i/o mode control program stored in it when shipped from the factory. however, the user can write a rewrite control program in this area that suits the user s application sys- tem. this boot rom area can be rewritten in only parallel i/o mode. item power source voltage (for program/erase) v pp voltage (for program/erase) flash memory mode erase block division user rom area boot rom area program method erase method program/erase control method number of commands number of program/erase times rom code protection specifications vcc = 3.00 ?3.60 v, 4.50 ?5.25 v (f(x in ) = 24 mhz, = 6 mhz) (note 1) v pp = 4.50 ?5.25 v 3 modes; flash memory can be manipulated as follows: (1) cpu rewrite mode: manipulated by the central processing unit (cpu) (2) parallel i/o mode: manipulated using an external programmer (note 2) (3) standard serial i/o mode: manipulated using an external programmer (note 2) . see figure 78. 1 block (4 kbytes) ( note 3 ) byte program batch erasing/block erasing program/erase control by software command 6 commands 100 times available in parallel i/o mode and standard serial i/o mode notes 1: after programming/erasing at vcc = 3.0 to 3.6 v, the mcu can operate only at vcc = 3.0 to 3.6 v. after programming/erasing at vcc = 4.5 to 5.25 v or programming/erasing with the exclusive external equipment flash programmer, the mcu can operate at both vcc = 3.0 to 3.6 v and 4.15 to 5.25 v. 2: in the parallel i/o mode or the standard serial i/o mode, use the exclusive external equipment flash programmer which supports the 7643 group (flash memory version). 3: the boot rom area has had a standard serial i/o mode control program stored in it when shipped from the factory. this boot rom area can be rewritten in only parallel i/o mode. rev.1.00 jul 30, 2003 page 87 of 119 7643 group fig. 78 block diagram of built-in flash memory (1) cpu rewrite mode in cpu rewrite mode, the internal flash memory can be operated on (read, program, or erase) under control of the central process- ing unit (cpu). in cpu rewrite mode, only the user rom area shown in figure 78 can be rewritten; the boot rom area cannot be rewritten. make sure the program and block erase commands are issued for only the user rom area and each block area. the control program for cpu rewrite mode can be stored in either user rom or boot rom area. in the cpu rewrite mode, because the flash memory cannot be read from the cpu, the rewrite con- trol program must be transferred to internal ram area to be executed before it can be executed. microcomputer mode and boot mode the control program for cpu rewrite mode must be written into the user rom or boot rom area in parallel i/o mode beforehand. (if the control program is written into the boot rom area, the stan- dard serial i/o mode becomes unusable.) see figure 78 for details about the boot rom area. normal microcomputer mode is entered when the microcomputer is reset with pulling cnv ss pin low. in this case, the cpu starts operating using the control program in the user rom area. when the microcomputer is reset by pulling the p3 6 (ce) pin high, the p8 1 (sclk) pin high, the cnv ss pin high, the cpu starts oper- ating using the control program in the boot rom area. this mode is called the ?oot?mode. block address block addresses refer to the maximum address of each block. these addresses are used in the block erase command. e0 0 0 1 6 u s e r r o m a r e a 4 kb y t e s f f f f 1 6 b o o t r o m a r e a n o t e s 1 : t h e b o o t r o m a r e a c a n b e r e w r i t t e n i n o n l y p a r a l l e l i / o m o d e . ( a c c e s s t o a n y o t h e r a r e a s i s i n h i b i t e d . ) 2 : t o s p e c i f y a b l o c k , u s e t h e m a x i m u m a d d r e s s i n t h e b l o c k . p a r a l l e l i / o m o d e c p u r e w r i t e m o d e , s t a n d a r d s e r i a l i / o m o d e b s e l = l b s e l = h u s e r a r e a / b o o t a r e a s e l e c t b i t = 0 u s e r a r e a / b o o t a r e a s e l e c t b i t = 1 c0 0 0 1 6 b l o c k 1 : 8 k b y t e s b l o c k 2 : 1 6 k b y t e s b l o c k 0 : 8 k b y t e s 80 0 0 1 6 f0 0 0 1 6 f f f f 1 6 e0 0 0 1 6 u s e r r o m a r e a 4 kb y t e s f f f f 1 6 b o o t r o m a r e a c0 0 0 1 6 b l o c k 1 : 8 k b y t e s b l o c k 2 : 1 6 k b y t e s b l o c k 0 : 8 k b y t e s 80 0 0 1 6 f0 0 0 1 6 f f f f 1 6 rev.1.00 jul 30, 2003 page 88 of 119 7643 group outline performance (cpu rewrite mode) cpu rewrite mode is usable in the single-chip, memory expansion or boot mode. the only user rom area can be rewritten in cpu rewrite mode. in cpu rewrite mode, the cpu erases, programs and reads the in- ternal flash memory by executing software commands. this rewrite control program must be transferred to a memory such as the internal ram before it can be executed. the mcu enters cpu rewrite mode by applying 4.50 v to 5.25 v to the cnv ss pin and setting ??to the cpu rewrite mode select bit (bit 1 of address 006a 16 ). software commands are accepted once the mode is entered. use software commands to control program and erase operations. whether a program or erase operation has terminated normally or in error can be verified by reading the status register. figure 79 shows the flash memory control register. bit 0 is the ry/by status flag used exclusively to read the operat- ing status of the flash memory. during programming and erase operations, it is ??(busy). otherwise, it is ??(ready). bit 1 is the cpu rewrite mode select bit. when this bit is set to ?? the mcu enters cpu rewrite mode. software commands are accepted once the mode is entered. in cpu rewrite mode, the f l a s h m e m o r y c o n t r o l r e g i s t e r ( a d d r e s s 0 0 6 a 1 6 ) f m c r r y / b y s t a t u s f l a g 0 : b u s y ( b e i n g p r o g r a m m e d o r e r a s e d ) 1 : r e a d y c p u r e w r i t e m o d e s e l e c t b i t ( n o t e 2 ) 0 : n o r m a l m o d e ( s o f t w a r e c o m m a n d s i n v a l i d ) 1 : c p u r e w r i t e m o d e ( s o f t w a r e c o m m a n d s a c c e p t a b l e ) c p u r e w r i t e m o d e e n t r y f l a g 0 : n o r m a l m o d e 1 : c p u r e w r i t e m o d e f l a s h m e m o r y r e s e t b i t ( n o t e 3 ) 0 : n o r m a l o p e r a t i o n 1 : r e s e t u s e r r o m a r e a / b o o t r o m a r e a s e l e c t b i t ( n o t e 4 ) 0 : u s e r r o m a r e a a c c e s s e d 1 : b o o t r o m a r e a a c c e s s e d r e s e r v e d b i t s ( i n d e f i n i t e a t r e a d / 0 a t w r i t e ) b 0 b 7 n o t e s1 : t h e c o n t e n t s o f f l a s h m e m o r y c o n t r o l r e g i s t e r a r e x x x 0 0 0 0 1 j u s t a f t e r r e s e t r e l e a s e . 2 : f o r t h i s b i t t o b e s e t t o 1 , t h e u s e r n e e d s t o w r i t e 0 a n d t h e n 1 t o i t i n s u c c e s s i o n . i f i t i s n o t t h i s p r o c e d u r e , t h i s b i t w i l l n o t b e s e t t o 1 . a d d i t i o n a l l y , i t i s r e q u i r e d t o e n s u r e t h a t n o i n t e r r u p t w i l l b e g e n e r a t e d d u r i n g t h a t i n t e r v a l . u s e t h e c o n t r o l p r o g r a m i n t h e a r e a e x c e p t t h e b u i l t - i n f l a s h m e m o r y f o r w r i t e t o t h i s b i t . 3 : t h i s b i t i s v a l i d w h e n t h e c p u r e w r i t e m o d e s e l e c t b i t i s 1 . s e t t h i s b i t 3 t o 0 s u b s e q u e n t l y a f t e r s e t t i n g b i t 3 t o 1 . 4 : u s e t h e c o n t r o l p r o g r a m i n t h e a r e a e x c e p t t h e b u i l t - i n f l a s h m e m o r y f o r w r i t e t o t h i s b i t . cpu becomes unable to access the internal flash memory directly. therefore, use the control program in a memory other than inter- nal flash memory for write to bit 1. to set this bit to ?? it is necessary to write ??and then write ??in succession. the bit can be set to ??by only writing ?? bit 2 is the cpu rewrite mode entry flag. this flag indicates ??in cpu rewrite mode, so that reading this flag can check whether cpu rewrite mode has been entered or not. bit 3 is the flash memory reset bit used to reset the control circuit of internal flash memory. this bit is used when exiting cpu rewrite mode and when flash memory access has failed. when the cpu rewrite mode select bit is ?? setting ??for this bit resets the control circuit. to set this bit to ?? it is necessary to write ??and then write ??in succession. to release the reset, it is necessary to set this bit to ?? bit 4 is the user area/boot area select bit. when this bit is set to ?? boot rom area is accessed, and cpu rewrite mode in boot rom area is available. in boot mode, this bit is set to ??auto- matically. reprogramming of this bit must be in a memory other than internal flash memory. figure 80 shows a flowchart for setting/releasing cpu rewrite mode. fig. 79 structure of flash memory control register rev.1.00 jul 30, 2003 page 89 of 119 7643 group fig. 80 cpu rewrite mode set/release flowchart e n d s t a r t e x e c u t e r e a d a r r a y c o m m a n d o r r e s e t f l a s h m e m o r y b y s e t t i n g f l a s h m e m o r y r e s e t b i t ( b y w r i t i n g 1 a n d t h e n 0 i n s u c c e s s i o n ) ( n o t e 3 ) s i n g l e - c h i p m o d e , m e m o r y e x p a n s i o n m o d e o r b o o t m o d e s e t c p u m o d e r e g i s t e r s a , b ( n o t e 2 ) u s i n g s o f t w a r e c o m m a n d e x e c u t e e r a s e , p r o g r a m , o r o t h e r o p e r a t i o n j u m p t o c o n t r o l p r o g r a m t r a n s f e r r e d i n m e m o r y o t h e r t h a n i n t e r n a l f l a s h m e m o r y ( s u b s e q u e n t o p e r a t i o n s a r e e x e c u t e d b y c o n t r o l p r o g r a m i n t h i s m e m o r y ) t r a n s f e r c p u r e w r i t e m o d e c o n t r o l p r o g r a m t o m e m o r y o t h e r t h a n i n t e r n a l f l a s h m e m o r y n o t e s1 : w h e n s t a r t i n g t h e m c u i n t h e s i n g l e - c h i p m o d e o r m e m o r y e x p a n s i o n m o d e , s u p p l y 4 . 5 v t o 5 . 2 5 v t o t h e c n v s s p i n u n t i l c h e c k i n g t h e c p u r e w r i t e m o d e e n t r y f l a g . 2 : s e t t h e m a i n c l o c k a s f o l l o w s d e p e n d i n g o n t h e x i n d i v i d e r s e l e c t b i t o f c l o c k c o n t r o l r e g i s t e r ( b i t 7 o f a d d r e s s 0 0 1 f 1 6 ) : w h e n x i n d i v i d e r s e l e c t b i t = 0 ( = f ( x i n ) / 4 ) , t h e m a i n c l o c k i s 2 4 m h z o r l e s s w h e n x i n d i v i d e r s e l e c t b i t = 1 ( = f ( x i n ) / 2 ) , t h e m a i n c l o c k i s 1 2 m h z o r l e s s . 3 : b e f o r e e x i t i n g t h e c p u r e w r i t e m o d e a f t e r c o m p l e t i n g e r a s e o r p r o g r a m o p e r a t i o n , a l w a y s b e s u r e t o e x e c u t e t h e r e a d a r r a y c o m m a n d o r r e s e t t h e f l a s h m e m o r y . w r i t e 0 t o c p u r e w r i t e m o d e s e l e c t b i t s e t c p u r e w r i t e m o d e s e l e c t b i t t o 1 ( b y w r i t i n g 0 a n d t h e n 1 i n s u c c e s s i o n ) c h e c k c p u r e w r i t e m o d e e n t r y f l a g s e t t i n g r e l e a s e d rev.1.00 jul 30, 2003 page 90 of 119 7643 group notes on cpu rewrite mode the below notes applies when rewriting the flash memory in cpu rewrite mode. operation speed during cpu rewrite mode, set the internal clock to 6 mhz or less using the x in divider select bit (bit 7 of address 001f 16 ). instructions inhibited against use the instructions which refer to the internal data of the flash memory cannot be used during cpu rewrite mode . interrupts inhibited against use the interrupts cannot be used during cpu rewrite mode because they refer to the internal data of the flash memory. reset reset is always valid. when cnv ss is ??at reset release, the program starts from the address stored in addresses fffa 16 and fffb 16 of the boot rom area in order that cpu may start in boot mode. rev.1.00 jul 30, 2003 page 91 of 119 7643 group software commands (cpu rewrite mode) table 21 lists the software commands. after setting the cpu rewrite mode select bit of the flash memory control register to ?? execute a software command to specify an erase or program operation. each software command is explained below. read array command (ff 16 ) the read array mode is entered by writing the command code ?f 16 ?in the first bus cycle. when an address to be read is input in one of the bus cycles that follow, the contents of the specified ad- dress are read out at the data bus (db 0 to db 7 ). the read array mode is retained intact until another command is written. read status register command (70 16 ) the read status register mode is entered by writing the command code ?0 16 ?in the first bus cycle. the contents of the status regis- ter are read out at the data bus (db 0 to db 7 ) by a read in the second bus cycle. the status register is explained in the next section. clear status register command (50 16 ) this command is used to clear the bits sr4 and sr5 of the status register after they have been set. these bits indicate that opera- tion has ended in an error. to use this command, write the command code ?0 16 ?in the first bus cycle. program command (40 16 ) program operation starts when the command code ?0 16 ?is writ- ten in the first bus cycle. then, if the address and data to program are written in the 2nd bus cycle, program operation (data program- ming and verification) will start. whether the write operation is completed can be confirmed by _____ reading the status register or the ry/by status flag of the flash memory control register. when the program starts, the read status table 21 list of software commands (cpu rewrite mode) register mode is entered automatically and the contents of the sta- tus register is read at the data bus (db 0 to db 7 ). the status register bit 7 (sr7) is set to ??at the same time the write opera- tion starts and is returned to ??upon completion of the write operation. in this case, the read status register mode remains ac- tive until the next command is written. ____ the ry/by status flag is ??(busy) during write operation and ? (ready) when the write operation is completed as is the status reg- ister bit 7. at program end, program results can be checked by reading bit 4 (sr4) of the status register. fig. 81 program flowchart c o m m a n d p r o g r a m c l e a r s t a t u s r e g i s t e r r e a d a r r a y r e a d s t a t u s r e g i s t e r x x f i r s t b u s c y c l e s e c o n d b u s c y c l e f f 1 6 7 0 1 6 5 0 1 6 4 0 1 6 w r i t e w r i t e w r i t e w r i t e x s r d r e a d w r i t e e r a s e a l l b l o c k s 2 0 1 6 w r i t e x 2 0 1 6 w r i t e ( n o t e 1 ) w a ( n o t e 2 ) w d ( n o t e 2 ) b l o c k e r a s e 2 0 1 6 w r i t e d 0 1 6 w r i t e b a ( n o t e 3 ) m o d e a d d r e s s m o d e a d d r e s s d a t a ( d b 0 t o d b 7 ) ( d b 0 t o d b 7 ) ( n o t e 4 ) n o t e s 1 : s r d = s t a t u s r e g i s t e r d a t a 2 : w a = w r i t e a d d r e s s , w d = w r i t e d a t a 3 : b a = b l o c k a d d r e s s t o b e e r a s e d ( i n p u t t h e m a x i m u m a d d r e s s o f e a c h b l o c k . ) 4 : x d e n o t e s a g i v e n a d d r e s s i n t h e u s e r r o m a r e a . c y c l e n u m b e r 1 2 1 2 2 2 x x x x d a t a s t a r t w r i t e 4 0 1 6 s t a t u s r e g i s t e r r e a d p r o g r a m c o m p l e t e d n o y e s w r i t e a d d r e s s w r i t e d a t a s r 4 = 0 ? p r o g r a m e r r o r n o y e s s r 7 = 1 ? o r r y / b y = 1 ? w r i t e rev.1.00 jul 30, 2003 page 92 of 119 7643 group erase all blocks command (20 16 /20 16 ) by writing the command code ?0 16 ?in the first bus cycle and the confirmation command code ?0 16 ?in the second bus cycle that follows, the operation of erase all blocks (erase and erase verify) starts. whether the erase all blocks command is terminated can be con- ____ firmed by reading the status register or the ry/by status flag of flash memory control register. when the erase all blocks operation starts, the read status register mode is entered automatically and the contents of the status register can be read out at the data bus (db 0 to db 7 ). the status register bit 7 (sr7) is set to ??at the same time the erase operation starts and is returned to ??upon completion of the erase operation. in this case, the read status register mode remains active until another command is written. ____ the ry/by status flag is ??during erase operation and ??when the erase operation is completed as is the status register bit 7 (sr7). after the erase all blocks end, erase results can be checked by reading bit 5 (srs) of the status register. for details, refer to the section where the status register is detailed. block erase command (20 16 /d0 16 ) by writing the command code ?0 16 ?in the first bus cycle and the confirmation command code ?0 16 ?and the blobk address in the second bus cycle that follows, the block erase (erase and erase verify) operation starts for the block address of the flash memory to be specified. whether the block erase operation is completed can be confirmed ____ by reading the status register or the ry/by status flag of flash memory control register. at the same time the block erase opera- tion starts, the read status register mode is automatically entered, so that the contents of the status register can be read out. the status register bit 7 (sr7) is set to ??at the same time the block erase operation starts and is returned to ??upon completion of the block erase operation. in this case, the read status register mode remains active until the read array command (ff 16 ) is writ- ten. ____ the ry/by status flag is ??during block erase operation and ? when the block erase operation is completed as is the status reg- ister bit 7. after the block erase ends, erase results can be checked by read- ing bit 5 (srs) of the status register. for details, refer to the section where the status register is detailed. w r i t e 2 0 1 6 2 0 1 6 / d 0 1 6 b l o c k a d d r e s s e r a s e c o m p l e t e d n o y e s s t a r t w r i t e s r 5 = 0 ? e r a s e e r r o r y e s n o 2 0 1 6 : e r a s e a l l b l o c k s c o m m a n d d 0 1 6 : b l o c k e r a s e c o m m a n d s r 7 = 1 ? o r r y / b y = 1 ? s t a t u s r e g i s t e r r e a d fig. 82 erase flowchart rev.1.00 jul 30, 2003 page 93 of 119 7643 group symbol table 22 definition of each bit in status register (srd) status register (srd) the status register shows the operating status of the flash memory and whether erase operations and programs ended suc- cessfully or in error. it can be read in the following ways: (1) by reading an arbitrary address from the user rom area after writing the read status register command (70 16 ) (2) by reading an arbitrary address from the user rom area in the period from when the program starts or erase operation starts to when the read array command (ff 16 ) is input. also, the status register can be cleared by writing the clear status register command (50 16 ). after reset, the status register is set to ?0 16 ? table 22 shows the status register. each bit in this register is ex- plained below. sequencer status (sr7) the sequencer status indicates the operating status of the flash memory. this bit is set to ??(busy) during write or erase operation and is set to ??when these operations ends. after power-on, the sequencer status is set to ??(ready). erase status (sr5) the erase status indicates the operating status of erase operation. if an erase error occurs, it is set to ?? when the erase status is cleared, it is set to ?? program status (sr4) the program status indicates the operating status of write opera- tion. when a write error occurs, it is set to ?? the program status is set to ??when it is cleared. if ??is written for any of the sr5 and sr4 bits, the program, erase all blocks, and block erase commands are not accepted. before executing these commands, execute the clear status regis- ter command (50 16 ) and clear the status register. also, if any commands are not correct, both sr5 and sr4 are set to ?? sr7 (bit7) sr6 (bit6) sr5 (bit5) sr4 (bit4) sr3 (bit3) sr2 (bit2) sr1 (bit1) sr0 (bit0) definition ?? ? status name sequencer status reserved erase status program status reserved reserved reserved reserved ready - terminated in error terminated in error - - - - busy - terminated normally terminated normally - - - - rev.1.00 jul 30, 2003 page 94 of 119 7643 group full status check by performing full status check, it is possible to know the execu- tion results of erase and program operations. figure 83 shows a fig. 83 full status check flowchart and remedial procedure for errors full status check flowchart and the action to be taken when each error occurs. r e a d s t a t u s r e g i s t e r s r 4 = 1 a n d s r5 = 1 ? n o y e s s r 5 = 0 ? y e s er a s e e r r o r n o s r 4 = 0 ? y e s n o c o m m a n d s e q u e n c e e r r o r p r o g r a m e r r o r e n d ( e r a s e , p r o g r a m ) e x e c u t e t h e c l e a r s t a t u s r e g i s t e r c o m m a n d ( 5 0 1 6 ) t o c l e a r t h e s t a t u s r e g i s t e r . t r y p e r f o r m i n g t h e o p e r a t i o n o n e m o r e t i m e a f t e r c o n f i r m i n g t h a t t h e c o m m a n d i s e n t e r e d c o r r e c t l y . s h o u l d a n e r a s e e r r o r o c c u r , t h e b l o c k i n e r r o r c a n n o t b e u s e d . n o t e : w h e n o n e o f s r 5 a n d s r 4 i s s e t t o 1 , n o n e o f t h e r e a d a r a y , t h e p r o g r a m , e r a s e a l l b l o c k s , a n d b l o c k e r a s e c o m m a n d s i s a c c e p t e d . e x e c u t e t h e c l e a r s t a t u s r e g i s t e r c o m m a n d ( 5 0 1 6 ) b e f o r e e x e c u t i n g t h e s e c o m m a n d s . s h o u l d a p r o g r a m e r r o r o c c u r , t h e b l o c k i n e r r o r c a n n o t b e u s e d . rev.1.00 jul 30, 2003 page 95 of 119 7643 group functions to inhibit rewriting flash memory version to prevent the contents of internal flash memory from being read out or rewritten easily, this mcu incorporates a rom code protect function for use in parallel i/o mode and an id code check func- tion for use in standard serial i/o mode. rom code protect function (in pararell i/o mode) the rom code protect function is the function to inhibit reading out or modifying the contents of internal flash memory by using the rom code protect control (address ffc9 16 ) in parallel i/o mode. figure 84 shows the rom code protect control (address ffc9 16 ). (this address exists in the user rom area.) if one or both of the pair of rom code protect bits is set to ?? the rom code protect is turned on, so that the contents of internal flash memory are protected against readout and modification. the rom code protect is implemented in two levels. if level 2 is se- lected, the flash memory is protected even against readout by a shipment inspection lsi tester, etc. when an attempt is made to select both level 1 and level 2, level 2 is selected by default. if both of the two rom code protect reset bits are set to ?0? the rom code protect is turned off, so that the contents of internal flash memory can be read out or modified. once the rom code protect is turned on, the contents of the rom code protect reset bits cannot be modified in parallel i/o mode. use the serial i/o or cpu rewrite mode to rewrite the contents of the rom code pro- tect reset bits. fig. 84 structure of rom code protect control r o m c o d e p r o t e c t c o n t r o l ( a d d r e s s f f c 9 1 6 ) ( n o t e 1 ) r o m c p r e s e r v e d b i t s ( 1 a t r e a d / w r i t e ) r o m c o d e p r o t e c t l e v e l 2 s e t b i t s ( r o m c p 2 ) ( n o t e s 2 , 3 ) b 3 b 2 0 0 : p r o t e c t e n a b l e d 0 1 : p r o t e c t e n a b l e d 1 0 : p r o t e c t e n a b l e d 1 1 : p r o t e c t d i s a b l e d r o m c o d e p r o t e c t r e s e t b i t s ( n o t e 4 ) b 5 b 4 0 0 : p r o t e c t r e m o v e d 0 1 : p r o t e c t s e t b i t s e f f e c t i v e 1 0 : p r o t e c t s e t b i t s e f f e c t i v e 1 1 : p r o t e c t s e t b i t s e f f e c t i v e r o m c o d e p r o t e c t l e v e l 1 s e t b i t s ( r o m c p 1 ) ( n o t e 2 ) b 7 b 6 0 0 : p r o t e c t e n a b l e d 0 1 : p r o t e c t e n a b l e d 1 0 : p r o t e c t e n a b l e d 1 1 : p r o t e c t d i s a b l e d b 0 b 7 n o t e s1 : t h i s a r e a i s o n t h e r o m i n t h e m a s k r o m v e r s i o n . 2 : w h e n r o m c o d e p r o t e c t i s t u r n e d o n , t h e i n t e r n a l f l a s h m e m o r y i s p r o t e c t e d a g a i n s t r e a d o u t o r m o d i f i c a t i o n i n p a r a l l e l i / o m o d e . 3 : w h e n r o m c o d e p r o t e c t l e v e l 2 i s t u r n e d o n , r o m c o d e r e a d o u t b y a s h i p m e n t i n s p e c t i o n l s i t e s t e r , e t c . a l s o i s i n h i b i t e d . 4 : t h e r o m c o d e p r o t e c t r e s e t b i t s c a n b e u s e d t o t u r n o f f r o m c o d e p r o t e c t l e v e l 1 a n d r o m c o d e p r o t e c t l e v e l 2 . h o w e v e r , s i n c e t h e s e b i t s c a n n o t b e m o d i f i e d i n p a r a l l e l i / o m o d e , t h e y n e e d t o b e r e w r i t t e n i n s t a n d a r d s e r i a l i / o m o d e o r c p u r e w r i t e m o d e . 1 1 rev.1.00 jul 30, 2003 page 96 of 119 7643 group id code check function (in standard serial i/o mode) use this function in standard serial i/o mode. when the contents of the flash memory are not blank, the id code sent from the pro- grammer is compared with the id code written in the flash memory to see if they match. if the id codes do not match, the commands sent from the programmer are not accepted. the id code consists of 8-bit data, and its areas are ffc2 16 to ffc8 16 . write a program which has had the id code preset at these addresses to the flash memory. fig. 85 id code store addresses rom code protect control id7 id6 id5 id4 id3 id2 id1 f fc9 16 f fc8 16 f fc7 16 f fc6 16 f fc5 16 f fc4 16 f fc3 16 f fc2 16 address interrupt vector area rev.1.00 jul 30, 2003 page 97 of 119 7643 group (2) parallel i/o mode parallel i/o mode is the mode which parallel output and input soft- ware command, address, and data required for the operations (read, program, erase, etc.) to a built-in flash memory. use the ex- clusive external equipment flash programmer which supports the 7643 group (flash memory version). refer to each programmer maker s handling manual for the details of the usage. user rom and boot rom areas in parallel i/o mode, the user rom and boot rom areas shown in fig- ure 88 can be rewritten. both areas of flash memory can be operated on in the same way. program and block erase operations can be performed in the user rom area. the user rom area and its block is shown in figure 78. the boot rom area is 4 kbytes in size. it is located at addresses f000 16 through ffff 16 . make sure program and block erase opera- tions are always performed within this address range. (access to any location outside this address range is prohibited.) in the boot rom area, an erase block operation is applied to only one 4 kbyte block. the boot rom area has had a standard serial i/o mode control program stored in it when shipped from the renesas factory. therefore, using the device in standard serial i/o mode, you do not need to write to the boot rom area. rev.1.00 jul 30, 2003 page 98 of 119 7643 group (3) standard serial i/o mode the standard serial i/o mode inputs and outputs the software commands, addresses and data needed to operate (read, pro- gram, erase, etc.) the internal flash memory. this i/o is clock synchronized serial. this mode requires the exclusive external equipment (flash programmer). the standard serial i/o mode is different from the parallel i/o mode in that the cpu controls flash memory rewrite (uses the cpu rewrite mode), rewrite data input and so forth. the standard serial i/o mode is started by connecting ??to the p3 6 (ce) pin and ??to the p8 1 (sclk) pin and ??to the cnv ss pin (apply 4.5 v to 5.25 v to vpp from an external source), and releasing the re- set operation. (in the ordinary microcomputer mode, set cnvss pin to ??level.) this control program is written in the boot rom area when the product is shipped from renesas. accordingly, make note of the fact that the standard serial i/o mode cannot be used if the boot rom area is rewritten in parallel i/o mode. figures 86 and 87 show the pin connections for the standard serial i/o mode. in standard serial i/o mode, serial data i/o uses the four serial i/o pins sclk, srxd, stxd and srdy (busy). the sclk pin is the transfer clock input pin through which an external transfer clock is input. the stxd pin is for cmos output. the srdy (busy) pin outputs ??level when ready for reception and ??level when re- ception starts. serial data i/o is transferred serially in 8-bit units. in standard serial i/o mode, only the user rom area shown in figure 88 can be rewritten. the boot rom area cannot. in standard serial i/o mode, a 7-byte id code is used. when there is data in the flash memory, commands sent from the peripheral unit (programmer) are not accepted unless the id code matches. outline performance (standard serial i/o mode) in standard serial i/o mode, software commands, addresses and data are input and output between the mcu and peripheral units (flash programer, etc.) using 4-wire clock-synchronized serial i/o. in reception, software commands, addresses and program data are synchronized with the rise of the transfer clock that is input to the sclk pin, and are then input to the mcu via the srxd pin. in transmission, the read data and status are synchronized with the fall of the transfer clock, and output from the stxd pin. the stxd pin is for cmos output. transfer is in 8-bit units with lsb first. when busy, such as during transmission, reception, erasing or program execution, the srdy (busy) pin is ??level. accordingly, always start the next transfer after the srdy (busy) pin is ? level. also, data and status registers in a memory can be read after in- putting software commands. status, such as the operating state of the flash memory or whether a program or erase operation ended successfully or not, can be checked by reading the status register. here following explains software commands, status registers, etc. rev.1.00 jul 30, 2003 page 99 of 119 7643 group table 23 description of pin function (standard serial i/o mode) p i n n a m e s i g n a l n a m e i / o f u n c t i o n v c c , v s s p o w e r s u p p l y i n p u t a p p l y 4 . 5 0 v 5 . 2 5 v f o r 5 v v e r s i o n o r 3 . 0 0 v 3 . 6 0 v f o r 3 v v e r s i o n t o t h e v c c p i n . a p p l y 0 v t o t h e v s s p i n . c n v s s c n v s s t h i s c o n t r o l s t h e m c u o p e r a t i n g m o d e . c o n n e c t t h i s p i n t o v p p ( = 4 . 5 0 v 5 . 2 5 v i r e s e t i n p u t t o r e s e t , i n p u t l l e v e l f o r 2 0 c y c l e s o r l o n g e r c l o c k s o f . i r e s e t x i n c l o c k i n p u t c o n n e c t a c e r a m i c o r c r y s t a l r e s o n a t o r b e t w e e n t h e x i n a n d x o u t p i n s . w h e n i n p u t t i n g a n e x t e r n a l l y d e r i v e d c l o c k , i n p u t i t f r o m x i n a n d l e a v e x o u t o p e n . x o u t c l o c k o u t p u t a v c c , a v s s a n a l o g p o w e r s u p p l y i n p u t l p f l p f o l o o p f i l t e r f o r t h e f r e q u e n c y s y n t h e s i z e r . w h e n t h i s p i n i s n o t u s e d , l e a v e t h i s o p e n . e x t . c a p 3 . 3 v l i n e p o w e r s u p p l y i n p u t i p 0 0 t o p 0 7 i / o u s b d + u s b d + s i g n a l p o r t . w h e n t h i s p i n i s n o t u s e d , i n p u t h l e v e l . u s b d + u s b d - u s b d - p 1 0 t o p 1 7 p 8 0 b u s y o u t p u t p 8 1 s c l k in p u t i / o i / o o i i a p p l y 4 . 5 0 v 5 . 2 5 v f o r 5 v v e r s i o n o r 3 . 0 0 v 3 . 6 0 v f o r 3 v v e r s i o n t o t h e a v c c p i n . a p p l y 0 v t o t h e a v s s p i n . u s b d - s i g n a l p o r t . w h e n t h i s p i n i s n o t u s e d , i n p u t l l e v e l . p o w e r s u p p l y i n p u t p i n f o r 3 . 3 v u s b l i n e d r i v e r . w h e n t h i s p i n i s n o t u s e d , i n p u t h l e v e l . w h e n t h e s e p o r t s a r e n o t u s e d , i n p u t l o r h l e v e l , o r l e a v e t h e m o p e n i n o u t p u t m o d e . i / o p o r t p 0 i / o i / o p o r t p 1 i / o p 2 0 t o p 2 7 i / o p o r t p 2 p 3 0 t o p 3 5 , p 3 7 i / o p 4 0 t o p 4 4 i / o p o r t p 3 i / o i / o p o r t p 4 i / o p 5 0 t o p 5 7 i / o p o r t p 5 i / o p 6 0 t o p 6 7 i / o p o r t p 6 i / o p 7 0 t o p 7 4 i / o p o r t p 7 t h i s i s a b u s y o u t p u t p i n . t h i s i s a s e r i a l c l o c k i n p u t p i n . p 8 2 s r x d in p u t t h i s i s a s e r i a l d a t a i n p u t p i n . o p 8 3 s t x d o u t p u t t h i s i s a s e r i a l d a t a o u t p u t p i n . p 8 4 t o p 8 7 w h e n t h e s e p o r t s a r e n o t u s e d , i n p u t l o r h l e v e l , o r l e a v e t h e m o p e n i n o u t p u t m o d e . i / o p o r t p 8 i / o p 3 6 c e i n p u t i w h e n t h e s e p o r t s a r e n o t u s e d , i n p u t l o r h l e v e l , o r l e a v e t h e m o p e n i n o u t p u t m o d e . in p u t h l e v e l . rev.1.00 jul 30, 2003 page 100 of 119 7643 group fig. 86 pin connection diagram in standard serial i/o mode (1) busy sclk cnv ss sclk reset ce 4.5 to 5.25 v v cc ( note ) v ss v cc v cc v cc v ss m ode setup method signal value connect to oscillator circuit. package outline: 80p6n-a srxd stxd reset v pp n ote : it is necessary to apply vcc only when reset is released. ce p7 4 1 2 3 4 7 8 9 10 11 12 13 14 15 16 17 18 19 20 5 6 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 p6 1 p5 6 p5 5 p5 3 p5 2 cnv ss /v pp reset av cc av ss p4 4 p8 7 /rts p8 6 /cts v cc p5 0 /x cin v ss x in x out p5 1 /t out /x cout lpf p8 5 /urxd p8 4 /utxd p3 2 p3 1 m37643f8fp p6 0 p5 7 p5 4 21 22 23 24 p4 3 p4 2 /int 1 p4 1 /int 0 p4 0 /edma 61 62 63 64 p8 3 /stxd p8 2 /srxd p8 1 /sclk p8 0 /srdy p3 7 /rd p3 6 /wr p3 5 /sync out p3 4 / out p3 3 /dma out p3 0 /rdy p1 7 /ab 15 p1 6 /ab 14 p1 5 /ab 13 p1 4 /ab 12 p1 3 /ab 11 p1 2 /ab 10 p1 1 /ab 9 p1 0 /ab 8 p0 7 /ab 7 p0 6 /ab 6 p0 5 /ab 5 p0 4 /ab 4 p0 3 /ab 3 p0 2 /ab 2 p0 1 /ab 1 p0 0 /ab 0 p2 7 /db 7 p2 6 /db 6 p2 5 /db 5 p2 4 /db 4 p2 3 /db 3 p2 2 /db 2 p2 1 /db 1 p2 0 /db 0 p7 3 /hlda p7 2 p7 1 /hold p7 0 usb d+ usb d- ext.cap v ss v cc p6 7 p6 6 p6 5 p6 4 p6 3 p6 2 rev.1.00 jul 30, 2003 page 101 of 119 7643 group fig. 87 pin connection diagram in standard serial i/o mode (2) v cc v ss cnv ss sclk reset ce mode setup method signal value connect to oscillator circuit. package outline: 80p6q-a busy sclk srxd stxd reset v pp 4.5 to 5.25 v v cc ( note ) v ss v cc v cc note : it is necessary to apply vcc only when reset is released. ce p7 4 1 2 3 4 7 8 9 10 11 12 13 14 15 16 17 18 19 20 5 6 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 p6 1 p5 6 p5 5 p5 3 p5 2 cnv ss /v pp reset av cc av ss p4 4 p8 7 /rts p8 6 /cts v cc p5 0 /x cin v ss x in x out p5 1 /t out /x cout lpf p8 5 /urxd p8 4 /utxd p3 2 p3 1 m37643f8hp p6 0 p5 4 21 22 23 24 p4 3 p4 2 /int 1 p4 1 /int 0 61 62 63 64 p8 3 /stxd p8 2 /srxd p8 1 /sclk p8 0 /srdy p3 7 /rd p3 6 /wr p3 5 /sync out p3 4 / out p3 3 /dma out p3 0 /rdy p1 7 /ab 15 p1 6 /ab 14 p1 5 /ab 13 p1 4 /ab 12 p1 3 /ab 11 p1 2 /ab 10 p1 1 /ab 9 p1 0 /ab 8 p0 7 /ab 7 p0 6 /ab 6 p0 5 /ab 5 p0 4 /ab 4 p0 3 /ab 3 p0 2 /ab 2 p0 1 /ab 1 p0 0 /ab 0 p2 7 /db 7 p2 6 /db 6 p2 5 /db 5 p2 4 /db 4 p2 3 /db 3 p2 2 /db 2 p2 1 /db 1 p2 0 /db 0 usb d+ usb d- ext.cap v ss v cc p6 7 p6 6 p6 5 p6 4 p6 3 p6 2 p4 0 /edma p7 1 /hold p7 0 p5 7 p7 2 p7 3 /hlda rev.1.00 jul 30, 2003 page 102 of 119 7643 group software commands (standard serial i/o mode) table 24 lists software commands. in standard serial i/o mode, erase, program and read are controlled by transferring software 2nd byte address (middle) 3rd byte address (high) 4th byte data output 5th byte data output 6th byte data output ..... data output to 259th byte data input to 259th byte ff 16 when id is not verified not acceptable 1st byte transfer notes1: shading indicates transfer from the internal flash memory microcomputer to a programmer. all other data is transferred from an external equipment (programmer) to the internal flash memory microcomputer. 2: srd refers to status register data. srd1 refers to status register 1 data. 3: all commands can be accepted for the products of which boot rom area is totally blank. 4: address low is ab 0 to ab 7 ; address middle is ab 8 to ab 15 ; address high is ab 16 to ab 23 . commands via the srxd pin. software commands are explained here below. table 24 software commands (standard serial i/o mode) 1 page read 41 16 address (middle) address (high) data input data input data input not acceptable not acceptable not acceptable 20 16 address (middle) address (high) d0 16 a7 16 d0 16 70 16 srd output srd1 output acceptable 50 16 not acceptable f5 16 address (low) size (low) address (middle) size (high) address (high) check- sum id size id1 to id7 acceptable fa 16 data input to required number of times not acceptable fb 16 version data output address (middle) version data output address (high) version data output data output version data output data output version data output data output version data output to 9th byte data output to 259th byte acceptable not acceptable fc 16 control command 2 page program 3 block erase 4 erase all blocks 5 read status register 6 clear status register 7 id code check 8 download function 9 version data output function 10 boot rom area output function rev.1.00 jul 30, 2003 page 103 of 119 7643 group read status register command this command reads status information. when the ?0 16 ?com- mand code is transferred with the 1st byte, the contents of the status register (srd) with the 2nd byte and the contents of status register 1 (srd1) with the 3rd byte are read. page read command this command reads the specified page (256 bytes) in the flash memory sequentially one byte at a time. execute the page read command as explained here following. (1) transfer the ?f 16 ?command code with the 1st byte. (2) transfer addresses ab 8 to ab 15 and ab 16 to ab 23 with the 2nd and 3rd bytes respectively. (3) from the 4th byte onward, data (db 0 to db 7 ) for the page (256 bytes) specified with addresses ab 8 to ab 23 will be output se- quentially from the smallest address first synchronized with the fall of the clock. d a t a 0 d a t a 2 5 5 a b 8 t o a b 1 5 a b 1 6 t o a b 2 3 f f 1 6 s c l k s r x d s t x d s r d y ( b u s y ) s r d o u t p u t s r d 1 o u t p u t s c l k s r x d s t x d s r d y ( b u s y ) 7 0 1 6 fig. 88 timing for page read fig. 89 timing for reading status register rev.1.00 jul 30, 2003 page 104 of 119 7643 group fig. 90 timing for clear status register clear status register command this command clears the bits (sr3 to sr5) which are set when the status register operation ends in error. when the ?0 16 ?com- mand code is sent with the 1st byte, the aforementioned bits are cleared. when the clear status register operation ends, the srdy (busy) signal changes from ??to ??level. sclk srxd stxd srdy (busy) 50 16 a b 8 t o a b 1 5 a b 1 6 t o a b 2 3 4 1 1 6 d a t a 0 d a t a 2 5 5 s c l k s r x d s t x d s r d y ( b u s y ) page program command this command writes the specified page (256 bytes) in the flash memory sequentially one byte at a time. execute the page pro- gram command as explained here following. (1) transfer the ?1 16 ?command code with the 1st byte. (2) transfer addresses ab 8 to ab 15 and ab 16 to ab 23 with the 2nd and 3rd bytes respectively. (3) from the 4th byte onward, as write data (db 0 to db 7 ) for the page (256 bytes) specified with addresses a 8 to a 23 is input sequentially from the smallest address first, that page is auto- matically written. when reception setup for the next 256 bytes ends, the srdy (busy) signal changes from ??to ??level. the result of the page program can be known by reading the status register. for more information, see the section on the status register. fig. 91 timing for page program rev.1.00 jul 30, 2003 page 105 of 119 7643 group block erase command this command erases the contents of the specifided block. ex- ecute the block erase command as explained here following. (1) transfer the ?0 16 ?command code with the 1st byte. (2) transfer addresses ab 8 to ab 15 and ab 16 to ab 23 with the 2nd and 3rd bytes respectively. (3) transfer the verify command code ?0 16 ?with the 4th byte. with the verify command code, the erase operation will start for the specifided block in the flash memory. set the addresses ab 8 to ab 23 to the maximum address of the specified block. 2 0 1 6 d 0 1 6 s c l k s r x d s t x d s r d y ( b u s y ) a b 8 t o a b 1 5 a b 1 6 t o a b 2 3 when block erasing ends, the srdy (busy) signal changes from ??to ??level. the result of the erase operation can be known by reading the status register. for more information, see the section on the status register. fig. 92 timing for block erasing erase all blocks command this command erases the contents of all blocks. execute the erase all blocks command as explained here following. (1) transfer the ?7 16 ?command code with the 1st byte. (2) transfer the verify command code ?0 16 ?with the 2nd byte. with the verify command code, the erase operation will start and continue for all blocks in the flash memory. when erase all blocks end, the srdy (busy) signal changes from ? to ??level. the result of the erase operation can be known by reading the status register. a 7 1 6 d 0 1 6 s c l k s r x d s t x d s r d y ( b u s y ) fig. 93 timing for erase all blocks rev.1.00 jul 30, 2003 page 106 of 119 7643 group download command this command downloads a program to the ram for execution. execute the download command as explained here following. (1) transfer the ?a 16 ?command code with the 1st byte. (2) transfer the program size with the 2nd and 3rd bytes. (3) transfer the check sum with the 4th byte. the check sum is added to all data sent with the 5th byte onward. (4) the program to execute is sent with the 5th byte onward. when all data has been transmitted, if the check sum matches, the downloaded program is executed. the size of the program will vary according to the internal ram. fig. 94 timing for download f a 1 6 p r o g r a m d a t a p r o g r a m d a t a d a t a s i z e ( l o w ) c h e c k s u m s c l k s r x d s t x d s r d y ( b u s y ) d a t a s i z e ( h i g h ) rev.1.00 jul 30, 2003 page 107 of 119 7643 group version information output command this command outputs the version information of the control pro- gram stored in the boot rom area. execute the version information output command as explained here following. (1) transfer the ?b 16 ?command code with the 1st byte. (2) the version information will be output from the 2nd byte on- ward. this data is composed of 8 ascii code characters. fig. 95 timing for version information output f b 1 6 x ? e r s c l k s r x d s t x d s r d y ( b u s y ) boot rom area output command this command reads the control program stored in the boot rom area in page (256 bytes) unit. execute the boot rom area output command as explained here following. (1) transfer the ?c 16 ?command code with the 1st byte. (2) transfer addresses ab 8 to ab 15 and ab 16 to ab 23 with the 2nd and 3rd bytes respectively. (3) from the 4th byte onward, data (db 0 to db 7 ) for the page (256 bytes) specified with addresses ab 8 to ab 23 will be output se- quentially from the smallest address first synchronized with the fall of the clock. fig. 96 timing for boot rom area output f c 1 6 a b 8 t o a b 1 5 a b 1 6 t o a b 2 3 d a t a 0 d a t a 2 5 5 s c l k s r x d s t x d s r d y ( b u s y ) rev.1.00 jul 30, 2003 page 108 of 119 7643 group id code check this command checks the id code. execute the boot id check command as explained here following. id code when the flash memory is not blank, the id code sent from the se- rial programmer and the id code written in the flash memory are compared to see if they match. if the codes do not match, the command sent from the serial programmer is not accepted. an id code contains 8 bits of data. area is, from the 1st byte, addresses ffc2 16 to ffc8 16 . write a program into the flash memory, which already has the id code set for these addresses. fig. 97 timing for id check i d s i z e i d 1 i d 7 f 5 1 6 c 2 1 6 f f 1 6 0 0 1 6 s c l k s r x d s t x d s r d y ( b u s y ) rom code protect control id7 id6 id5 id4 id3 id2 id1 f fc9 16 f fc8 16 f fc7 16 ffc6 16 ffc5 16 f fc4 16 f fc3 16 ffc2 16 address interrupt vector area fig. 98 id code storage addresses (1) transfer the ?5 16 ?command code with the 1st byte. (2) transfer addresses ab 0 to ab 7 , ab 8 to ab 15 and ab 16 to ab 23 (?0 16 ? of the 1st byte of the id code with the 2nd and 3rd re- spectively. (3) transfer the number of data sets of the id code with the 5th byte. (4) transfer the id code with the 6th byte onward, starting with the 1st byte of the code. rev.1.00 jul 30, 2003 page 109 of 119 7643 group status register (srd) the status register indicates operating status of the flash memory and status such as whether an erase operation or a program ended successfully or in error. it can be read by writing the read status register command (70 16 ). also, the status register is cleared by writing the clear status register command (50 16 ). table 25 lists the definition of each status register bit. after releas- ing the reset, the status register becomes ?0 16 ? sequencer status (sr7) the sequencer status indicates the operating status of the the flash memory. after power-on and recover from deep power down mode, the se- quencer status is set to ??(ready). this status bit is set to ??(busy) during write or erase operation and is set to ??upon completion of these operations. erase status (sr5) the erase status indicates the operating status of erase operation. if an erase error occurs, it is set to ?? when the erase status is cleared, it is set to ?? program status (sr4) the program status indicates the operating status of write opera- tion. if a program error occurs, it is set to ?? when the program status is cleared, it is set to ?? srd0 bits sr7 (bit7) sr6 (bit6) sr5 (bit5) sr4 (bit4) sr3 (bit3) sr2 (bit2) sr1 (bit1) sr0 (bit0) definition ? ? table 25 definition of each bit of status register (srd) status name sequencer status reserved erase status program status reserved reserved reserved reserved ready - terminated in error terminated in error - - - - busy - terminated normally terminated normally - - - - rev.1.00 jul 30, 2003 page 110 of 119 7643 group status register 1 (srd1) the status register 1 indicates the status of serial communica- tions, results from id checks and results from check sum comparisons. it can be read after the status register (srd) by writ- ing the read status register command (70 16 ). also, status register 1 is cleared by writing the clear status register command (50 16 ). table 26 lists the definition of each status register 1 bit. this regis- ter becomes ?0 16 ?when power is turned on and the flag status is maintained even after the reset. table 26 definition of each bit of status register 1 (srd1) 00 not verified 01 verification mismatch 10 reserved 11 verified sr15 (bit7) sr14 (bit6) sr13 (bit5) sr12 (bit4) sr11 (bit3) sr10 (bit2) sr9 (bit1) sr8 (bit0) boot update completed bit reserved reserved checksum match bit id code check completed bits data reception time out reserved ? update completed - - match time out - ? not update - - mismatch normal operation - definition srd1 bits status name boot update completed bit (sr15) this flag indicates whether the control program was downloaded to the ram or not, using the download function. check sum consistency bit (sr12) this flag indicates whether the check sum matches or not when a program, is downloaded for execution using the download func- tion. id code check completed bits (sr11 and sr10) these flags indicate the result of id code checks. some com- mands cannot be accepted without an id code check. data reception time out (sr9) this flag indicates when a time out error is generated during data reception. if this flag is attached during data reception, the re- ceived data is discarded and the mcu returns to the command wait state. rev.1.00 jul 30, 2003 page 111 of 119 7643 group full status check results from executed erase and program operations can be known by running a full status check. figure 99 shows a flowchart of the full status check and explains how to remedy errors which occur. r e a d s t a t u s r e g i s t e r s r 4 = 1 a n d s r5 = 1 ? n o y e s s r 5 = 0 ? y e s er a s e e r r o r n o s r 4 = 0 ? y e s n o c o m m a n d s e q u e n c e e r r o r p r o g r a m e r r o r e n d ( e r a s e , p r o g r a m ) e x e c u t e t h e c l e a r s t a t u s r e g i s t e r c o m m a n d ( 5 0 1 6 ) t o c l e a r t h e s t a t u s r e g i s t e r . t r y p e r f o r m i n g t h e o p e r a t i o n o n e m o r e t i m e a f t e r c o n f i r m i n g t h a t t h e c o m m a n d i s e n t e r e d c o r r e c t l y . s h o u l d a n e r a s e e r r o r o c c u r , t h e b l o c k i n e r r o r c a n n o t b e u s e d . n o t e : w h e n o n e o f s r 5 t o s r 4 i s s e t t o 1 , n o n e o f t h e p a g e r e a d , p r o g r a m , e r a s e a l l b l o c k s , a n d b l o c k e r a s e c o m m a n d s i s a c c e p t e d . e x e c u t e t h e c l e a r s t a t u s r e g i s t e r c o m m a n d ( 5 0 1 6 ) b e f o r e e x e c u t i n g t h e s e c o m m a n d s . s h o u l d a p r o g r a m e r r o r o c c u r , t h e b l o c k i n e r r o r c a n n o t b e u s e d . fig. 99 full status check flowchart and remedial procedure for errors rev.1.00 jul 30, 2003 page 112 of 119 7643 group example circuit application for standard serial i/o mode figure 100 shows a circuit application for the standard serial i/o mode. control pins will vary according to a programmer, therefore see a programmer manual for more information. srdy (busy) sclk srxd stxd cnvss clock input busy output data input data output m37643f8 n otes 1: control pins and external circuitry will vary according to a programmer. for more information, see the programmer manual. 2: in this example, the vpp power supply is supplied from an external source (programmer) . to use the user? power source, connect to 4.5 v to 5.25 v. v pp power source input p3 6 /wr (ce) fig. 100 example circuit application for standard serial i/o mode rev.1.00 jul 30, 2003 page 113 of 119 7643 group notes on programming processor status register ?he contents of the processor status register (ps) after a reset are undefined, except for the interrupt disable flag (i) which is ?? after a reset, initialize flags which affect program execution. in particular, it is essential to initialize the index x mode (t) and the decimal mode (d) flags because of their effect on calculations. ?o reference the contents of the processor status register (ps), execute the php instruction once then read the contents of (s+1). if necessary, execute the plp instruction to return the ps to its original status. a nop instruction must be executed after every plp instruction. ? sei instruction must be executed before every plp instruction. a nop instruction must be executed before every cli instruction. brk instruction it can be detected that the brk instruction interrupt event or the least priority interrupt event by referring the stored b flag state. refer to the stored b flag state in the interrupt routine. decimal calculations when decimal mode is selected, the values of the v flags are in- valid. the carry flag (c) is set to ??if a carry is generated as a result of the calculation, or is cleared to ??if a borrow is generated. to de- termine whether a calculation has generated a carry, the c flag must be initialized to ??before each calculation. to check for a borrow, the c flag must be initialized to ??before each calcula- tion. multiplication and division instructions ?he index x mode (t) and the decimal mode (d) flags do not af- fect the mul and div instruction. instruction execution time the instruction execution time is obtained by multiplying the fre- quency of the internal clock by the number of cycles needed to execute an instruction. the number of cycles required to execute an instruction is shown in the list of machine instructions. timers ?f a value n (between 0 and 255) is written to a timer latch, the frequency division ratio is 1/(n+1). ?5 1 /x cout /t out pin cannot function as an i/o port when x cin - x cout is oscillating. when x cin - x cout oscillation is not used or x cout oscillation drive is disabled, this pin can function as the t out output pin of the timer 1 or 2. when using the t out output function and f(x cin ) divided by 2 is used as the timer 1 count source (bit 2 of t123m = ??, disable x cout oscillation drive (bit 5 of ccr = ??. ports ?hen the data register (port latch) of an i/o port is modified with the bit managing instruction ( seb , clb instructions) the value of the unspecified bit may be changed. ?n standby state (the stop mode by executing the stp instruction, and the wait mode by executing the wit instruction) for low- power dissipation, do not make input levels of an i/o port ?ndefined? especially for i/o ports of the p-channel and the n- channel open-drain. pull-up (connect the port to vcc) or pull-down (connect the port to vss) these ports through a resistor. when determining a resistance value, note the following points: (1) external circuit (2) variation of output levels during the ordinary operation when using built-in pull-up or pull-down resistor, note on varied current values. (1) when setting as an input port : fix its input level (2) when setting as an output port : prevent current from flowing out to external serial i/o do not write to the serial i/o shift register during a transfer when in spi compatible mode. uart ?he all error flags per, fer, oer and ser are cleared to ? when the uart status register is read, at the hardware reset or initialization by setting the transmit initialization bit. these flags are also cleared to ??by execution of bit test instructions such as bbc and bcs . ?he transmission interrupt request bit might be set and the inter- rupt request is generated by setting the transmit initialization bit to ??even when selecting timing that either of the following flags is set to ??as timing where the transmission interrupt is gener- ated: (1) transmit buffer empty flag is set to ? (2) transmit complete flag is set to ?? therefore, when the transmit interrupt is used, set the transmit in- terrupt enable bit to transmit enabled as the following sequence: (1) transmit initialization bit is set to ? (2) transmit interrupt request bit is set to ? (3) transmit interrupt enable bit is set to ?? rev.1.00 jul 30, 2003 page 114 of 119 7643 group usb ?hen the usb reset interrupt status flag is kept at ?? all other flags in the usb internal registers (addresses 0050 16 to 005f 16 ) will return to their reset status. however, the following registers are not affected by the usb reset: usb control register (address 0013 16 ), frequency synthesizer control register (address 006c 16 ), clock control register (address 001f 16 ), and usb end- point-x fifo register (addresses 0060 16 to 0062 16 ). ?hen not using the usb function, set the usb line driver supply enable bit of the usb control register (address 0013 16 ) to ??for power supply to the internal circuits (at vcc = 5v). ?he in_pkt_rdy bit can be set by software even when using the auto_set function. ?hen writing to usb-related registers, set the usb clock enable bit to ?? then perform the write after four cycle waits. ?he receive buffer full interrupt request is not generated if receive errors are detected at receiving. ?f a character bit length is 7 bits, bit 7 of the uart transmit/re- ceive buffer register 1 and bits 0 to 7 of the uart transmit/ receive buffer register 2 are ignored at transmitting; they are in- valid at receiving. if a character bit length is 8 bits, bits 0 to 7 of the uart transmit/ receive buffer register 2 are ignored at transmitting; they are in- valid at receiving. if a character bit length is 9 bits, bits 1 to 7 of the uart transmit/ receive buffer register 2 are ignored at transmitting; they are ? at receiving. ?hen using the mcu at vcc = 3.3v, set the usb line driver sup- ply enable bit to ??(line driver disable). note that setting the usb line driver current control bit (usbc3) doesn? affect the usb operation. ?ead one packet data from the out fifo before clearing the out_pkt_rdy flag. if the out_pkt_rdy flag is cleared while one packet data is being read, the internal read pointer can- not operate normally. ?se the transfer instructions such as lda and sta to set the reg- isters: usb interrupt status registers 1, 2 (addresses 0052 16 , 0053 16 ); usb endpoint 0 in control register (address 0059 16 ); usb endpoint x in control register (address 0059 16 ); usb end- point x out control register (address 005a 16 ). do not use the read-modify-write instructions such as the seb or the clb in- struction. when writing to bits shown by table 27 using the transfer instruc- tion such as lda or sta , a value which never affect its bit state is required. take the following sequence to change these bits contents: (1) store the register contents onto a variable or a data register. (2) change the target bit on the variable or the data register. si- multaneously mask the bit so that its bit state cannot be changed. (see to table 27.) (3) write the value from the variable or the data register to the register using the transfer instruction such as lda or sta. table 27 bits of which state might be changed owing to software write register name usb endpoint 0 in control register usb endpoint x (x = 1, 2) in control register usb endpoint x (x = 1, 2) out control register bit name in_pkt_rdy (b1) data_end (b3) force_stall (b4) in_pkt_rdy (b0) out_pkt_rdy (b0) force_stall (b4) value not affecting state ( note ) ? ? ? ? ? ? note: writing this value will not change the bit state, because this value cannot be written to the bit by software. rev.1.00 jul 30, 2003 page 115 of 119 7643 group frequency synthesizer ?he frequency synthesizer and dc-dc converter must be set up as follows when recovering from a hardware reset: (1) enable the frequency synthesizer after setting the frequency synthesizer related registers (addresses 006c 16 to 006f 16 ). then wait for 2 ms. (2) check the frequency synthesizer lock status bit. if ?? wait for 0.1 ms and then recheck. (3) when using the usb built-in dc-dc converter, set the usb line driver supply enable bit of the usb control register to ?? this setting must be done 2 ms or more after the setup described in step (1). the usb line driver current control bit must be set to ??at this time. (when vcc = 3.3v, the setting explained in this step is not necessary.) (4) after waiting for (c + 1) ms so that the external capacitance pin (ext. cap. pin) can reach approximately 3.3 v, set the usb clock enable bit to ?? at this time, ??equals the ca- pacitance ( f) of the capacitor connected to the ext. cap. pin. for example, if 2.2 f and 0.1 f capacitors are con- nected to the ext. cap. in parallel, the required wait will be (2.3 + 1) ms. (5) after enabling the usb clock, wait for 4 or more f cycles, and then set the usb enable bit to ?? after enabling usb clock, read or write the usb internal registers (address 0050 16 to 0062 16 with the exception of usbc, ccr and psc) . ?its 6 and 5 of the frequency synthesizer control register (ad- dress 006c 16 ) are initialized to ?1?after reset release. make sure to set bits 6 and 5 to ?0?after the frequency synthesizer lock status bit goes to ?? ?hen using the frequency synthesized clock function, we recom- mend using the fastest frequency possible of f(x in ) or f(x cin ) as an input clock for the pll. owing to the pll mechanism, the pll controls the speed of multiplied clocks from the source clock. as a result, when the source clock input is lower, the generated clock becomes less stable. this is because more multipliers are needed and the speed control is very rough. higher source clock input generates a stabler clock, as less multipliers are needed and the speed control is more accurate. however, if the input clock frequency is relatively high, the pll clock generator can quickly lock-up the output clock to the source and make the out- put clock very stable. ?et the value of frequency synthesizer multiply register 2 (fsm2) so that the f pin is 1 mh z or higher. dma ?n the memory expansion mode and microprocessor mode, the dma out pin outputs ??during a dma transfer. ?o not access the dmac-related registers by using a dmac transfer. the destination address data and the source address data will collide in the dmac internal bus. ?hen using the usb fifo as the dma transfer source, make sure that, if you use the auto_set function, short packet data does not get mixed in with the transfer data. ?hen setting the dmac channel x enable bit (bit 7 of address 0041 16 ) to ?? be sure simultaneously to set the dmac channel x transfer initiation source capture register reset bit (bit 6 of ad- dress 0041 16 ) to ?? if this is not performed, an incorrect data will be transferred at the same time when the dmac is enabled. memory expansion mode & microprocessor mode ?n both memory expansion mode and microprocessor mode, use the ldm instruction or sta instruction to write to port p3 (address 000e 16 ). when using the read-modify-write instruction ( seb in- struction, clb instruction) you will need to map a memory that the cpu can read from and write to. ?n the memory expansion mode, if the internal and external memory areas overlap, the internal memory becomes the valid memory for the overlapping area. when the cpu performs a read or a write operation on this overlapped area, the following things happen: (1) read the cpu reads out the data in the internal memory instead of in the external memory. note that, since the cpu will output a proper read signal, address signal, etc., the memory data at the respective address will appear on the external data bus. (2) write the cpu writes data to both the internal and external memo- ries. ?he wait function is serviceable at accessing an external memory. stop mode ?hen the stp instruction is executed, bit 7 of the clock control register (address 001f 16 ) goes to ?? to return from stop mode, reset ccr7 to ?? ?hen using f syn (set internal system clock select bit (cpma6) to ?? as the internal system clock, switch cpma6 to ??before executing the stp instruction. reset cpma6 after the system re- turns from stop mode and the frequency synthesizer has stabilized. cpma6 does not need to be switched to ??when using the wit instruction. ?hen the stp instruction is being executed, all bits except bit 4 of the timer 123 mode register (address 0029 16 ) are initialized to ?? it is not necessary to set t123m1 (timer 1 count stop bit) to ??before executing the stp instruction. after returning from stop mode, reset the timer 1 (address 0024 16 ), timer 2 (address 0025 16 ), and the timer 123 mode register (address 0029 16 ). rev.1.00 jul 30, 2003 page 116 of 119 7643 group usage notes oscillator connection notice the built-in feedback register (1 m ? ) and the dumping resistor (400 ? ) is internally connected between pins x in and x out . power supply pins treatment notice please connect 0.1 f and 4.7 f capacitors in parallel between pins vcc and vss, and pins avss and avcc. these capacitors must be connected as close as possible be- tween the dc supply and gnd pins, and also the analog supply pin and corresponding gnd pin. wiring patterns for these supply and gnd pins must be wider than other signal patterns. these filter capacitors should not be placed near the lpf pins as they will cause noise problems reset pin treatment notice (noise elimination) if the reset input signal rises very slowly, we recommend attaching a capacitor, such as a 1000 pf ceramic capacitor with excellent high frequency characteristics, between the reset pin and the vss pin. please note the following two issues for this capacitor connection. (1) capacitor wiring pattern must be as short as possible (within 20 mm). (2) the user must perform an application level operation test. lpf pin treatment notice all passive components must be located as close as possible to the lpf pin. 0 . 1 f 6 8 0 p f l p f p i n a v s s p i n 1 k ? fig. 101 passive components near lpf pin usb transceiver treatment (noise elimination) ?he full-speed usb2.0 specification requires a driver -imped- ance 28 to 44 ?. (refer to clause 7.1.1.1 full-speed (12 mb/s) driver characteristics in the usb specification.) in order to meet the usb specification impedance requirements, connect a resis- tor (27 ? to 33 ? recommended) in series to the usb d+ pin and the usb d- pin. in addition, in order to reduce the ringing and control the falling/ rising timing of usb d+/d- and a crossover point, connect a ca- pacitor between the usb d+/d- pins and the vss pin if necessary. the values and structure of those peripheral elements depend on the impedance characteristics and the layout of the printed circuit board. accordingly, evaluate your system and observe waveforms before actual use and decide use of elements and the values of resistors and capacitors. ?onnect a capacitor between the ext. cap. pin and the vss pin. the capacitor should have a 2.2 f capacitor (tantalum capaci- tor) and a 0.1 f capacitor (ceramic capacitor) connected in parallel. figure 102 for the proper positions of the peripheral components. x i n e n a b l e l o c k f s e l s u s b c 5 e n a b l e u s b c l o c k ( 4 8 m h z ) u s b f c u e n a b l e u s b c 7 u s b t r a n s c e i v e r e n a b l e u s b c 7 d c - d c c o n v e r t e r e n a b l e u s b c 4 c u r r e n t m o d e u s b c 3 e x t . c a p . 2 . 2 f 0 . 1 f d + d - 1 . 5 k ? f r e q u e n c y s y n t h e s i z e r n o t e 1 n o t e s 1 : i n v c c = 3 . 3 v , c o n n e c t t o v c c . i n v c c = 5 v , d o n o t c o n n e c t t h e e x t e r n a l d c - d c c o n v e r t e r t o t h e e x t . c a p p i n . 2 : t h e r e s i s t o r s v a l u e s d e p e n d o n t h e l a y o u t o f t h e p r i n t e d c i r c u i t b o a r d . n o t e 2 fig.102 peripheral circuit ?n vcc = 3.3 v operation, connect the ext. cap. pin directly to the vcc pin in order to supply power to the usb transceiver. in addi- tion, you will need to disable the dc-dc converter in this operation (set bit 4 of the usb control register to ??) if you are using the bus powered supply in vcc = 3.3 v operation, the dc- dc converter must be placed outside the mcu. ?n vcc = 5 v operation, do not connect the external dc-dc con- verter to the ext. cap. pin. use the built-in dc-dc converter by enabling the usb line driver. ?ake sure the usb d+/d- lines do not cross any other wires. keep a large gnd area to protect the usb lines. also, make sure you use a usb specification compliant connecter for the connec- tion. avss and avcc pin treatment notice (noise elimination) an insulation connector (ferrite beads) must be connected be- tween avss and vss pins and between avcc and vcc pins. rev.1.00 jul 30, 2003 page 117 of 119 7643 group oscillator wiring (noise elimination) (1) keeping oscillator away from large current signal lines install a microcomputer (and especially an oscillator) as far as possible from signal lines, including usb signal lines, where a cur- rent larger than the tolerance of current value flows. when a large current flows through those signal lines, strong noise occurs be- cause of mutual inductance. (2) installing oscillator away from signal lines where potential levels change frequently install an oscillator and a connecting pattern of an oscillator away from signal lines where potential levels change frequently. also, do not cross such signal lines over the clock lines or the signal lines which are sensitive to noise. terminate unused pins (1) output ports : open (2) input ports : connect each pin to vcc or vss through each resistor of 1 k ? to 10 k ? . ports that permit the selecting of a built-in pull-up or pull-down re- sistor can also use this resistor. as for pins whose potential affects to operation modes such as pins cnvss, int or others, select the vcc pin or the vss pin according to their operation mode. (3) i/o ports : ?set the i/o ports for the input mode and connect them to vcc or vss through each resistor of 1 k ? to 10 k ? . ports that permit the selecting of a built-in pull-up or pull-down re- sistor can also use this resistor. set the i/o ports for the output mode and open them at ??or ?? ?when opening them in the output mode, the input mode of the initial status remains until the mode of the ports is switched over to the output mode by the program after reset. thus, the potential at these pins is undefined and the power source current may in- crease in the input mode. with regard to an effects on the system, thoroughly perform system evaluation on the user side. ?since the direction register setup may be changed because of a program runaway or noise, set direction registers by program pe- riodically to increase the reliability of program. ?at the termination of unused pins, perform wiring at the shortest possible distance (20 mm or less) from microcomputer pins. electric characteristic differences between mask rom and flash memory version mcus there are differences in electric characteristics, operation margin, noise immunity, and noise radiation between mask rom and flash memory version mcus due to the difference in the manufac- turing processes. when manufacturing an application system with the flash memory version and then switching to use of the mask rom ver- sion, please perform sufficient evaluations for the commercial samples of the mask rom version. rom ordering method 1.mask rom order confirmation form 2.mark specification form 3.data to be written to rom, in eprom form (three identical copies) or one floppy disk. ?for the mask rom confirmation and the mark specifications, refer to the ?enesas technology corp.?homepage (http://www.renesas.com/en/rom). clock input/output pin wiring (noise elimination) (1) make the wiring for the input/output pins as short as possible. (2) make the wiring across the grounding lead of the capacitor which is connected to an oscillator and the vss pin of the mcu as short as possible (within 20 mm) (3) make sure to isolate the oscillation vss pattern from other pat- terns for oscillation circuit-use only. rev.1.00 jul 30, 2003 page 118 of 119 7643 group package outline qfp80-p-1420-0.80 1.58 weight(g) jedec code eiaj package code lead material alloy 42 80p6n-a plastic 80pin 14 ? 20mm body qfp 0.1 0.2 symbol min nom max a a 2 b c d e h e l l 1 y b 2 dimension in millimeters h d a 1 0.5 i 2 1.3 m d 14.6 m e 20.6 10 0 0.1 1.4 0.8 0.6 0.4 23.1 22.8 22.5 17.1 16.8 16.5 0.8 20.2 20.0 19.8 14.2 14.0 13.8 0.2 0.15 0.13 0.45 0.35 0.3 2.8 0 3.05 e e e e c h e 1 80 65 40 64 41 25 24 h d d m d m e a f a 1 a 2 l 1 l y b 2 i 2 recommended mount pad detail f x 0.2 b x m mmp rev.1.00 jul 30, 2003 page 119 of 119 7643 group lqfp80-p-1212-0.5 weight(g) 0.47 jedec code eiaj package code lead material cu alloy 80p6q-a plastic 80pin 12 ? 12mm body lqfp 0.1 0.2 symbol min nom max a a 2 b c d e h e l l 1 y b 2 dimension in millimeters h d a 1 0.225 i 2 0.9 m d 12.4 m e 12.4 10 0 0.1 1.0 0.7 0.5 0.3 14.2 14.0 13.8 14.2 14.0 13.8 0.5 12.1 12.0 11.9 12.1 12.0 11.9 0.175 0.125 0.105 0.28 0.18 0.13 1.4 0 1.7 e a f e h d e h e d 1 20 21 40 41 60 61 80 y lp 0.45 0.6 0.25 0.75 0.08 x a3 m d l 2 b 2 m e e recommended mount pad b x m a 1 a 2 l 1 l detail f lp a3 c mmp revision history rev. date description page summary 7643 group data sheet 0.50 jan. 24, 2003 first edition issued 1.00 jul. 30, 2003 ?reliminary...?eliminated. fig.12: (2) port p2 revised. fig.13: (7) port p5 1 revised. table 7: note 2; ?verrun/underrun?eliminated. fig.42: note added. fig.44: note 4 added. fig.45: bit 3 revised and note 4 added. fig.55: (55) and (56) revised. v t + ? t - hysteresis int 0 , int 1 , rdy, hold, p2 0 ?2 7 : note added. td ( -edma), tv ( -edma): revised. v t + ? t - hysteresis int 0 , int 1 , rdy, hold, p2 0 ?2 7 : note added. tv ( -dma), td ( -edma), tv ( -edma): revised. table 27 revised. usage notes: oscillator connection notice revised. all pages 16 17 21 49 51 52 59 72 75 77 80 114 116 |
Price & Availability of 7643
![]() |
|
|
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] |