Part Number Hot Search : 
IRF780 CA3083 P5051 AEO30B48 B1004 SA100 74HC192 22000
Product Description
Full Text Search
 

To Download M38K09F8HP Datasheet File

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


  Datasheet File OCR Text:
  mitsubishi 8-bit single-chip microcomputer 740 family / 38000 series user? manual 38k0 group before using this material, please visit the above website to confirm that this is the most current document available. http://www.infomicom.maec.co.jp/indexe.htm rev. 1.0 revision date: jan. 17, 2003
keep safety first in your circuit designs! notes regarding these materials mitsubishi electric corporation puts the maximum effort into making semiconductor prod- ucts better and more reliable, but there is always the possibility that trouble may occur with them. trouble with semiconductors may lead to personal injury, fire or property damage. remember to give due consideration to safety when making your circuit designs, with ap- propriate measures such as (i) placement of substitutive, auxiliary circuits, (ii) use of non- flammable material or (iii) prevention against any malfunction or mishap. these materials are intended as a reference to assist our customers in the selection of the mitsubishi semiconductor product best suited to the customer's application; they do not convey any license under any intellectual property rights, or any other rights, belonging to mitsubishi electric corporation or a third party. mitsubishi electric corporation assumes no responsibility for any damage, or infringement of any third-party's rights, originating in the use of any product data, diagrams, charts, programs, algorithms, or circuit application examples contained in these materials. all information contained in these materials, including product data, diagrams, charts, pro- grams and algorithms represents information on products at the time of publication of these materials, and are subject to change by mitsubishi electric corporation without notice due to product improvements or other reasons. it is therefore recommended that customers contact mitsubishi electric corporation or an authorized mitsubishi semiconductor product distributor for the latest product information before purchasing a product listed herein. the information described here may contain technical inaccuracies or typographical errors. mitsubishi electric corporation assumes no responsibility for any damage, liability, or other loss rising from these inaccuracies or errors. please also pay attention to information published by mitsubishi electric corporation by various means, including the mitsubishi semiconductor home page (http:// www.mitsubishichips.com). when using any or all of the information contained in these materials, including product data, diagrams, charts, programs, and algorithms, please be sure to evaluate all informa- tion as a total system before making a final decision on the applicability of the information and products. mitsubishi electric corporation assumes no responsibility for any damage, liability or other loss resulting from the information contained herein. mitsubishi electric corporation semiconductors are not designed or manufactured for use in a device or system that is used under circumstances in which human life is potentially at stake. please contact mitsubishi electric corporation or an authorized mitsubishi semicon- ductor product distributor when considering the use of a product contained herein for any specific purposes, such as apparatus or systems for transportation, vehicular, medical, aerospace, nuclear, or undersea repeater use. the prior written approval of mitsubishi electric corporation is necessary to reprint or repro- duce in whole or in part these materials. if these products or technologies are subject to the japanese export control restrictions, they must be exported under a license from the japanese government and cannot be im- ported into a country other than the approved destination. any diversion or reexport contrary to the export control laws and regulations of japan and/ or the country of destination is prohibited. please contact mitsubishi electric corporation or an authorized mitsubishi semiconductor product distributor for further details on these materials or the products contained therein.
revision history 38k0 group user? manual rev. date description page summary (1/1) 1.0 01/17/03 first edition
preface this user? manual describes mitsubishi? cmos 8- bit microcomputers 38k0 group. after reading this manual, the user should have a through knowledge of the functions and features of the 38k0 group, and should be able to fully utilize the product. the manual starts with specifications and ends with application examples. for details of software, refer to the ?40 family software manual?
before using this manual this user? manual consists of the following three chapters. refer to the chapter appropriate to your conditions, such as hardware design or software development. chapter 3 also includes necessary information for systems development. you must refer to that chapter. 1. organization chapter 1 hardware this chapter describes features of the microcomputer and operation of each peripheral function. chapter 2 application this chapter describes usage and application examples of peripheral functions, based mainly on setting examples of relevant registers. chapter 3 appendix this chapter includes necessary information for systems development using the microcomputer, such as the electrical characteristics, the notes, and the list of registers. ? for the mask rom confirmation form and the mark specifications, refer to the ?itsubishi mcu technical information?homepage (http://www.infomicom.maec.co.jp/). 2. structure of register the figure of each register structure describes its functions, contents at reset, and attributes as follows : n o t e 2 : b i t a t t r i b u t e s . . . . . . . . .t h e a t t r i b u t e s o f c o n t r o l r e g i s t e r b i t s a r e c l a s s i f i e d i n t o 3 b y t e s : r e a d - o n l y , w r i t e - o n l y a n d r e a d a n d w r i t e . i n t h e f i g u r e , t h e s e a t t r i b u t e s a r e r e p r e s e n t e d a s f o l l o w s : : b i t i n w h i c h n o t h i n g i s a r r a n g e d 0 1 : n a m e function a t reset rw b 0 1 2 3 4 0 0 0 0 0 ? ? contents immediately after reset release bit attributes (n ote 1 ) p r o c e s s o r m o d e b i t s s t a c k p a g e s e l e c t i o n b i t n o t h i n g a r r a n g e d f o r t h e s e b i t s . t h e s e a r e w r i t e d i s a b l e d b i t s . w h e n t h e s e b i t s a r e r e a d o u t , t h e c o n t e n t s a r e 0 . fix this bit to 0. m a i n c l o c k ( x i n - x o u t ) s t o p b i t internal system clock selection bit 0 0 : si ng l e-c hi p mo d e 1 0 : 1 1 : n ot ava il a bl e b1 b0 0 : 0 page 1 : 1 page 0 : o perat i ng 1 : s toppe d 0 : x in - x out se l ecte d 1 : x cin - x cout se l ecte d : b i t t h a t i s n o t u s e d f o r c o n t r o l o f t h e c o r r e s p o n d i n g f u n c t i o n 0 n o t e 1 : . c o n t e n t s i m m e d i a t e l y a f t e r r e s e t r e l e a s e 0 . . . . . . . 0 a t r e s e t r e l e a s e 1 . . . . . . . 1 a t r e s e t r e l e a s e ? . . . . . . .u n d e f i n e d a t r e s e t r e l e a s e ? ? ? bits ? ?
i 38k0 group user? manual table of contents table of contents chapter 1 hardware description ............................................................................................................................... . 1-2 features ............................................................................................................................... ..... 1-2 pin configuration .................................................................................................................. 1-2 functional block .................................................................................................................. 1-3 pin description ........................................................................................................................ 1-4 part numbering ....................................................................................................................... 1-5 group expansion .................................................................................................................... 1-6 memory type ............................................................................................................................ 1-6 memory size ............................................................................................................................. 1- 6 packages ............................................................................................................................... .... 1-6 functional description ...................................................................................................... 1-7 central processing unit (cpu) .............................................................................................. 1-7 memory ............................................................................................................................... ..... 1-11 i/o ports ............................................................................................................................... ... 1-13 interrupts ..................................................................................................................... ............ 1-17 timers ............................................................................................................................... ....... 1-20 serial i/o ............................................................................................................................... .. 1-22 usb function .......................................................................................................................... 1-26 external bus interface (exb) ............................................................................................... 1-52 multichannel ram .................................................................................................................. 1-71 a-d converter ......................................................................................................................... 1-73 watchdog timer ..................................................................................................................... 1-75 reset circuit ........................................................................................................................... 1-76 pll circuit (frequency synthesizer) ................................................................................... 1-77 clock generating circuit ....................................................................................................... 1-79 flash memory mode .............................................................................................................. 1-82 notes on programming ................................................................................................... 1-108 notes on usage ................................................................................................................... 1-110 data required for mask orders .............................................................................. 1-110 functional description supplement ....................................................................... 1-111 chapter 2 application 2.1 i/o port ............................................................................................................................... ...... 2-2 2.1.1 memory map ................................................................................................................... 2-2 2.1.2 related registers ............................................................................................................ 2-3 2.1.3 handling of unused pins ............................................................................................... 2-5 2.1.4 notes on input and output pins ................................................................................... 2-6 2.1.5 termination of unused pins .......................................................................................... 2-7 2.2 interrupt ............................................................................................................................... .... 2-8 2.2.1 memory map ................................................................................................................... 2-8 2.2.2 related registers ............................................................................................................ 2-8 2.2.3 interrupt source ............................................................................................................ 2-11 2.2.4 interrupt operation ........................................................................................................ 2-12 2.2.5 interrupt control ............................................................................................................ 2-15 2.2.6 int interrupt .................................................................................................................. 2-18 2.2.7 key input interrupt ....................................................................................................... 2-19 2.2.8 notes on interrupts ...................................................................................................... 2-21
ii 38k0 group user? manual table of contents 2.3 timer ............................................................................................................................... ........ 2-23 2.3.1 memory map ................................................................................................................. 2-23 2.3.2 related registers .......................................................................................................... 2-23 2.3.3 timer application examples ........................................................................................ 2-28 2.3.4 notes on timer .............................................................................................................. 2-39 2.4 serial i/o ............................................................................................................................... . 2-40 2.4.1 memory map ................................................................................................................. 2-40 2.4.2 related registers .......................................................................................................... 2-41 2.4.3 serial i/o connection examples ................................................................................. 2-45 2.4.4 setting of serial i/o transfer data format ................................................................. 2-47 2.4.5 serial i/o application examples ................................................................................. 2-48 2.4.6 notes on serial i/o ...................................................................................................... 2-66 2.5 usb function ........................................................................................................................ 2-69 2.6 external bus interface(exb) .............................................................................................. 2-70 2.7 a-d converter ....................................................................................................................... 2-71 2.7.1 memory map ................................................................................................................. 2-71 2.7.2 related registers .......................................................................................................... 2-71 2.7.3 a-d converter application examples .......................................................................... 2-74 2.7.4 notes on a-d converter .............................................................................................. 2-76 2.8 watchdog timer .................................................................................................................... 2-77 2.8.1 memory map ................................................................................................................. 2-77 2.8.2 related registers .......................................................................................................... 2-77 2.8.3 watchdog timer application examples ..................................................................... 2-79 2.8.4 notes on watchdog timer ............................................................................................ 2-80 2.9 reset ............................................................................................................................... ........ 2-81 2.9.1 connection example of reset ic ................................................................................ 2-81 ____________ 2.9.2 notes on reset pin ................................................................................................... 2-82 2.10 frequency synthesizer (pll) .......................................................................................... 2-83 2.10.1 memory map ............................................................................................................... 2-83 2.10.2 related registers ........................................................................................................ 2-83 2.10.3 functional description ................................................................................................ 2-85 2.10.4 notes on pll ............................................................................................................ . 2-88 2.11 clock generating circuit .................................................................................................. 2-89 2.11.1 memory map ............................................................................................................... 2-89 2.11.2 related registers ........................................................................................................ 2-89 2.11.3 oscillation control ....................................................................................................... 2-91 2.12 standby function ............................................................................................................... 2-94 2.12.1 memory map ............................................................................................................... 2-94 2.12.2 related registers ........................................................................................................ 2-94 2.12.3 stop mode ................................................................................................................... 2-95 2.12.4 wait mode ................................................................................................................... 2-99 2.12.5 notes on stand-by function ..................................................................................... 2-101 2.13 flash memory ................................................................................................................... 2-102 2.13.1 overview .................................................................................................................... 2-102 2.13.2 memory map ............................................................................................................. 2-102 2.13.3 related registers ...................................................................................................... 2-103 2.13.4 parallel i/o mode ..................................................................................................... 2-104 2.13.5 standard serial i/o mode ........................................................................................ 2-104 2.13.6 cpu rewrite mode ................................................................................................... 2-105 2.13.7 flash memory mode application examples .......................................................... 2-106 2.13.8 notes on cpu rewrite mode .................................................................................. 2-111
iii 38k0 group user? manual table of contents chapter 3 appendix 3.1 electrical characteristics ..................................................................................................... 3-2 3.1.1 absolute maximum ratings ............................................................................................ 3-2 3.1.2 recommended operating conditions ............................................................................ 3-3 3.1.3 electrical characteristics ................................................................................................ 3-5 3.1.4 a-d converter characteristics ....................................................................................... 3-7 3.1.5 timing requirements ...................................................................................................... 3-8 3.1.6 switching characteristics ............................................................................................... 3-9 3.1.7 recommended operating conditions .......................................................................... 3-11 3.1.8 electrical characteristics .............................................................................................. 3-13 3.1.9 a-d converter characteristics ..................................................................................... 3-15 3.1.10 timing requirements .................................................................................................. 3-16 3.1.11 switching characteristics ........................................................................................... 3-19 3.2 standard characteristics .................................................................................................... 3-28 3.3 notes on use ........................................................................................................................ 3-29 3.3.1 notes on input and output ports ................................................................................ 3-29 3.3.2 termination of unused pins ........................................................................................ 3-30 3.3.3 notes on interrupts ...................................................................................................... 3-31 3.3.4 notes on timer .............................................................................................................. 3-32 3.3.5 notes on serial i/o ...................................................................................................... 3-33 3.3.6 notes on usb function ................................................................................................ 3-35 3.3.7 notes on a-d converter .............................................................................................. 3-36 3.3.8 notes on watchdog timer ............................................................................................ 3-36 _____________ 3.3.9 notes on reset pin ................................................................................................... 3-36 3.3.10 notes onpll ............................................................................................................... 3-36 3.3.11 notes on stand-by function ....................................................................................... 3-37 3.3.12 notes on cpu rewrite mode .................................................................................... 3-37 3.3.13 notes on programming .............................................................................................. 3-38 3.3.14 notes on flash memory version ............................................................................... 3-40 3.3.15 electric characteristic differences between mask rom and flash memory version mcus ........................................................................................................................... 3-40 3.4 countermeasures against noise ...................................................................................... 3-41 3.4.1 shortest wiring length .................................................................................................. 3-41 3.4.2 connection of bypass capacitor across v ss line and v cc line ............................... 3-43 3.4.3 wiring to analog input pins ........................................................................................ 3-44 3.4.4 oscillator concerns ....................................................................................................... 3-45 3.4.5 setup for i/o ports ....................................................................................................... 3-46 3.4.6 providing of watchdog timer function by software .................................................. 3-47 3.5 list of registers ................................................................................................................... 3-48 3.6 package outline ................................................................................................................... 3-82 3.7 machine instructions .......................................................................................................... 3-84 3.8 list of instruction code ..................................................................................................... 3-95 3.9 sfr memory map ................................................................................................................ 3-96 3.10 pin configurations ........................................................................................................ ..... 3-97
iv 38k0 group user? manual list of figures list of figures chapter 1 hardware fig. 1 pin configuration of 38k0 group ..................................................................................... 1-2 fig. 2 functional block diagram ................................................................................................. 1-3 fig. 3 part numbering .................................................................................................................. 1-5 fig. 4 memory expansion plan ................................................................................................... 1-6 fig. 5 740 family cpu register structure ................................................................................. 1-7 fig. 6 register push and pop at interrupt generation and subroutine call .......................... 1-8 fig. 7 structure of cpu mode register ................................................................................... 1-10 fig. 8 memory map diagram ..................................................................................................... 1-11 fig. 9 memory map of special function register (sfr) ......................................................... 1-12 fig. 10 port block diagram (1) ................................................................................................. 1-14 fig. 11 port block diagram (2) ................................................................................................. 1-15 fig. 12 structure of port i/o-related registers ........................................................................ 1-16 fig. 13 interrupt control ..................................................................................................... ........ 1-18 fig. 14 structure of interrupt-related registers ....................................................................... 1-18 fig. 15 connection example when using key input interrupt and port p0 block diagram1-19 fig. 16 structure of timer x mode register ............................................................................ 1-20 fig. 17 timer block diagram ..................................................................................................... 1-21 fig. 18 block diagram of clock synchronous serial i/o ........................................................ 1-22 fig. 19 operation of clock synchronous serial i/o function ................................................. 1-22 fig. 20 block diagram of uart serial i/o .............................................................................. 1-23 fig. 21 operation of uart serial i/o function ....................................................................... 1-23 fig. 22 structure of serial i/o control registers ..................................................................... 1-25 fig. 23 usb function overview ................................................................................................. 1-26 fig. 24 usb function control circuit (usbfcc) block diagram ......................................... 1-27 fig. 25 usb port external circuit (d0+, d0-, usbv ref , tron) block diagram (4.0v v cc 5.25v) ........................................................................................................................ 1-28 fig. 26 usb port external circuit (d0+, d0-, usbv ref , tron) block diagram (3.0v v cc 4.0v) .......................................................................................................................... 1-28 fig. 27 example setting of buffer area beginning address .................................................. 1-29 fig. 28 examples of interrupt source dependant buffer area offset address .................... 1-29 fig. 29 usb device interrupt control ....................................................................................... 1-31 fig. 30 usb related registers ................................................................................................... 1-32 fig. 31 structure of usb control register ............................................................................... 1-33 fig. 32 structure of usb function enable register ................................................................ 1-33 fig. 33 structure of usb function address register .............................................................. 1-34 fig. 34 structure of frame number register low .................................................................. 1-34 fig. 35 structure of frame number register high ................................................................. 1-34 fig. 36 structure of usb interrupt source enable register ................................................... 1-35 fig. 37 structure of usb interrupt source register ................................................................ 1-36 fig. 38 structure of endpoint index register .......................................................................... 1-36 fig. 39 structure of ep00 stage register ................................................................................ 1-37 fig. 40 structure of ep00 control register 1 .......................................................................... 1-37 fig. 41 structure of ep00 control register 2 .......................................................................... 1-37 fig. 42 structure of ep00 control register 3 .......................................................................... 1-38 fig. 43 structure of ep00 interrupt source register .............................................................. 1-38
v 38k0 group user? manual list of figures fig. 44 structure of ep00 byte number register .................................................................... 1-39 fig. 45 structure of ep00 buffer area set register ................................................................ 1-39 fig. 46 structure of ep01 set register .................................................................................... 1-40 fig. 47 structure of ep01 control register 1 .......................................................................... 1-40 fig. 48 structure of ep01 control register 2 .......................................................................... 1-41 fig. 49 structure of ep01 control register 3 .......................................................................... 1-41 fig. 50 structure of ep01 interrupt source register .............................................................. 1-41 fig. 51 structure of ep01 byte number register 0 ................................................................ 1-42 fig. 52 structure of ep01 byte number register 1 ................................................................ 1-42 fig. 53 structure of ep01 max. packet size register ........................................................... 1-42 fig. 54 structure of ep01 buffer area set register ................................................................ 1-43 fig. 55 structure of ep02 set register .................................................................................... 1-44 fig. 56 structure of ep02 control register 1 .......................................................................... 1-44 fig. 57 structure of ep02 control register 2 .......................................................................... 1-45 fig. 58 structure of ep02 control register 3 .......................................................................... 1-45 fig. 59 structure of ep02 interrupt source register .............................................................. 1-45 fig. 60 structure of ep02 byte number register 0 ................................................................ 1-46 fig. 61 structure of ep02 byte number register 1 ................................................................ 1-46 fig. 62 structure of ep02 max. packet size register ........................................................... 1-46 fig. 63 structure of ep02 buffer area set register ................................................................ 1-47 fig. 64 structure of ep03 set register .................................................................................... 1-48 fig. 65 structure of ep03 control register 1 .......................................................................... 1-48 fig. 66 structure of ep03 control register 2 .......................................................................... 1-49 fig. 67 structure of ep03 control register 3 .......................................................................... 1-49 fig. 68 structure of ep03 interrupt source register .............................................................. 1-49 fig. 69 structure of ep03 byte number register 0 ................................................................ 1-50 fig. 70 structure of ep03 byte number register 1 ................................................................ 1-50 fig. 71 structure of ep03 max. packet size register ........................................................... 1-50 fig. 72 structure of ep03 buffer area set register ................................................................ 1-51 fig. 73 external bus interface .................................................................................................. 1-52 fig. 74 data transfer timing of memory channel ................................................................... 1-52 fig. 75 external bus interface (exb) pin assignment ........................................................... 1-53 fig. 76 block diagram of external bus interface (exb) ........................................................ 1-54 fig. 77 exb related registers (1) ............................................................................................. 1-58 fig. 78 exb related registers (2) ............................................................................................. 1-58 fig. 79 structure of exb interrupt source enable register ................................................... 1-59 fig. 80 structure of exb interrupt source register ................................................................ 1-59 fig. 81 structure of exb index register .................................................................................. 1-60 fig. 82 structure of register window 1 .................................................................................. 1-60 fig. 83 structure of register window 2 .................................................................................. 1-60 fig. 84 index00[low]; structure of external i/o configuration register ................................ 1-61 fig. 85 index00[high]; structure of external i/o configuration register ............................. 1-61 fig. 86 index01[low]; structure of transmit/receive buffer register ................................... 1-62 fig. 87 index02[low]; structure of memory channel operation mode register ................... 1-62 fig. 88 index03[low]; structure of memory address counter ............................................... 1-62 fig. 89 index03[high]; structure of memory address counter .............................................. 1-63 fig. 90 index04[low]; structure of end address register ...................................................... 1-63 fig. 91 index04[high]; structure of end address register ..................................................... 1-63 fig. 92 cpu channel receiving operation ............................................................................... 1-64 fig. 93 cpu channel tranmitting operation ............................................................................. 1-65 fig. 94 memory channel receiving operation (1) ................................................................... 1-66 fig. 95 memory channel receiving operation (2) ................................................................... 1-67
vi 38k0 group user? manual list of figures fig. 96 memory channel receiving operation (3) ................................................................... 1-68 fig. 97 memory channel tranmitting operation (1) ................................................................. 1-69 fig. 98 memory channel tranmitting operation (2) ................................................................. 1-70 fig. 99 multichannel ram timing diagram (no wait) ............................................................. 1-71 fig. 100 multichannel ram timing diagram (one wait) ......................................................... 1-71 fig. 101 multichannel ram operation example ...................................................................... 1-72 fig. 102 structure of a-d control register .............................................................................. 1-73 fig. 103 10-bit a-d mode reading ........................................................................................... 1-73 fig. 104 a-d converter block diagram .................................................................................... 1-74 fig. 105 block diagram of watchdog timer ............................................................................ 1-75 fig. 106 structure of watchdog timer control register .......................................................... 1-75 fig. 108 reset sequence .......................................................................................................... 1-76 fig. 107 example of reset circuit ............................................................................................. 1-76 fig. 109 block diagram of pll circuit ..................................................................................... 1-77 fig. 110 structure of pll control register .............................................................................. 1-78 fig. 111 ceramic resonator or quartz-crystal oscilltor circuit .............................................. 1-80 fig. 112 external clock input circuit ........................................................................................ 1-80 fig. 114 system clock generating circuit block diagram (single-chip mode) ..................... 1-80 fig. 113 structure of misrg .................................................................................................... 1-80 fig. 115 state transitions of clock ........................................................................................... 1-81 fig. 116 block diagram of built-in flash memory ................................................................... 1-83 fig. 117 structure of flash memory control register .............................................................. 1-84 fig. 118 cpu rewrite mode set/release flowchart ................................................................. 1-85 fig. 119 program flowchart ....................................................................................................... 1-87 fig. 120 erase flowchart ........................................................................................................... 1-88 fig. 121 full status check flowchart and remedial procedure for errors ........................... 1-90 fig. 122 structure of rom code protect control register ..................................................... 1-91 fig. 123 id code store addresses ........................................................................................... 1-92 fig. 124 pin connection diagram in standard serial i/o mode (1) ...................................... 1-96 fig. 125 timing for page read .................................................................................................. 1-98 fig. 126 timing for reading status register ............................................................................ 1-98 fig. 127 timing for clear status register ................................................................................. 1-99 fig. 128 timing for page program ........................................................................................... 1-99 fig. 129 timing for erase all blocks ...................................................................................... 1-100 fig. 130 timing for download ................................................................................................. 1-101 fig. 131 timing for version information output .................................................................... 1-102 fig. 132 timing for boot rom area output .......................................................................... 1-102 fig. 133 timing for id check .................................................................................................. 1-103 fig. 134 id code storage addresses ..................................................................................... 1-103 fig. 135 full status check flowchart and remedial procedure for errors ......................... 1-106 fig. 136 example circuit application for standard serial i/o mode ................................... 1-107 fig. 137 definition of a-d conversion accuracy ................................................................... 1-109 fig. 138 a-d conversion equivalent circuit ........................................................................... 1-112 fig. 139 a-d conversion timing chart .................................................................................... 1-112
vii 38k0 group user? manual list of figures chapter 2 application fig. 2.1.1 memory map of registers related to i/o port ........................................................... 2-2 fig. 2.1.2 structure of port pi (i = 0 to 6) ................................................................................. 2-3 fig. 2.1.3 structure of port pi direction register (i = 0 to 6) .................................................. 2-3 fig. 2.1.4 structure of port p0 pull-up control register ............................................................ 2-4 fig. 2.1.5 structure of port p5 pull-up control register ............................................................ 2-4 fig. 2.2.1 memory map of registers related to interrupt .......................................................... 2-8 fig. 2.2.2 structure of interrupt request register 1 ................................................................... 2-8 fig. 2.2.3 structure of interrupt request register 2 ................................................................... 2-9 fig. 2.2.4 structure of interrupt control register 1 .................................................................... 2-9 fig. 2.2.5 structure of interrupt control register 2 .................................................................. 2-10 fig. 2.2.6 structure of interrupt edge selection register ........................................................ 2-10 fig. 2.2.7 interrupt operation diagram ....................................................................................... 2-12 fig. 2.2.8 changes of stack pointer and program counter upon acceptance of interrupt request ............................................................................................................................... ...... 2-13 fig. 2.2.9 time up to execution of interrupt processing routine ........................................... 2-14 fig. 2.2.10 timing chart after acceptance of interrupt request ........................................... 2-14 fig. 2.2.11 interrupt control diagram ......................................................................................... 2-15 fig. 2.2.12 example of multiple interrupts ................................................................................ 2-17 fig. 2.2.13 connection example and port p0 block diagram when using key input interrupt . ............................................................................................................................... .... 2-19 fig. 2.2.14 registers setting related to key input interrupt (corresponding to figure 2.2.13) . ............................................................................................................................... .... 2-20 fig. 2.2.15 sequence of changing relevant register ............................................................... 2-21 fig. 2.2.16 sequence of check of interrupt request bit .......................................................... 2-22 fig. 2.3.1 memory map of registers related to timers ............................................................ 2-23 fig. 2.3.2 structure of prescaler 12, prescaler x ................................................................... 2-23 fig. 2.3.3 structure of timer 1 .................................................................................................. 2-24 fig. 2.3.4 structure of timer 2, timer x .................................................................................. 2-24 fig. 2.3.5 structure of timer x mode register ......................................................................... 2-25 fig. 2.3.6 structure of interrupt request register 1 ................................................................. 2-26 fig. 2.3.7 structure of interrupt request register 2 ................................................................. 2-26 fig. 2.3.8 structure of interrupt control register 1 .................................................................. 2-27 fig. 2.3.9 structure of interrupt control register 2 .................................................................. 2-27 fig. 2.3.10 timers connection and setting of division ratios ................................................. 2-29 fig. 2.3.11 related registers setting ......................................................................................... 2-29 fig. 2.3.12 control procedure ..................................................................................................... 2-30 fig. 2.3.13 peripheral circuit example ....................................................................................... 2-31 fig. 2.3.14 timers connection and setting of division ratios ................................................. 2-31 fig. 2.3.15 related registers setting ......................................................................................... 2-32 fig. 2.3.16 control procedure ..................................................................................................... 2-32 fig. 2.3.17 judgment method of valid/invalid of input pulses ............................................... 2-33 fig. 2.3.18 related registers setting ......................................................................................... 2-34 fig. 2.3.19 control procedure ..................................................................................................... 2-35 fig. 2.3.20 timers connection and setting of division ratios ................................................. 2-36 fig. 2.3.21 related registers setting ......................................................................................... 2-37 fig. 2.3.22 control procedure ..................................................................................................... 2-38 fig. 2.4.1 memory map of registers related to serial i/o ...................................................... 2-40 fig. 2.4.2 structure of transmit/receive buffer register ........................................................ 2-41 fig. 2.4.3 structure of serial i/o status register ..................................................................... 2-41 fig. 2.4.4 structure of serial i/o control register .................................................................... 2-42 fig. 2.4.5 structure of uart control register .......................................................................... 2-42
viii 38k0 group user? manual list of figures fig. 2.4.6 structure of baud rate generator ............................................................................. 2-43 fig. 2.4.7 structure of interrupt edge selection register ........................................................ 2-43 fig. 2.4.8 structure of interrupt request register 2 ................................................................. 2-44 fig. 2.4.9 structure of interrupt control register 2 .................................................................. 2-44 fig. 2.4.10 serial i/o connection examples (1) ....................................................................... 2-45 fig. 2.4.11 serial i/o connection examples (2) ....................................................................... 2-46 fig. 2.4.12 serial i/o transfer data format ............................................................................... 2-47 fig. 2.4.13 connection diagram ................................................................................................. 2-48 fig. 2.4.14 timing chart .............................................................................................................. 2-48 fig. 2.4.15 registers setting related to transmitting side ...................................................... 2-49 fig. 2.4.16 registers setting related to receiving side ........................................................... 2-50 fig. 2.4.17 control procedure of transmitting side .................................................................. 2-51 fig. 2.4.18 control procedure of receiving side ...................................................................... 2-52 fig. 2.4.19 connection diagram ................................................................................................. 2-53 fig. 2.4.20 timing chart .............................................................................................................. 2-53 fig. 2.4.22 setting of serial i/o transmission data ................................................................. 2-54 fig. 2.4.21 registers setting related to serial i/o .................................................................. 2-54 fig. 2.4.23 control procedure of serial i/o .............................................................................. 2-55 fig. 2.4.24 connection diagram ................................................................................................. 2-56 fig. 2.4.25 timing chart .............................................................................................................. 2-57 fig. 2.4.26 related registers setting ......................................................................................... 2-57 fig. 2.4.27 control procedure of master unit ........................................................................... 2-58 fig. 2.4.28 control procedure of slave unit ............................................................................. 2-59 fig. 2.4.29 connection diagram (communication using uart) ............................................ 2-60 fig. 2.4.30 timing chart (using uart) ..................................................................................... 2-60 fig. 2.4.31 registers setting related to transmitting side ...................................................... 2-62 fig. 2.4.32 registers setting related to receiving side ........................................................... 2-63 fig. 2.4.33 control procedure of transmitting side .................................................................. 2-64 fig. 2.4.34 control procedure of receiving side ...................................................................... 2-65 fig. 2.4.35 sequence of setting serial i/o control register again ......................................... 2-67 fig. 2.7.1 memory map of registers related to a-d converter .............................................. 2-71 fig. 2.7.2 structure of a-d control register .............................................................................. 2-71 fig. 2.7.3 structure of a-d conversion register 1 ................................................................... 2-72 fig. 2.7.4 structure of a-d conversion register 2 ................................................................... 2-72 fig. 2.7.5 structure of interrupt request register 2 ................................................................. 2-73 fig. 2.7.6 structure of interrupt control register 2 .................................................................. 2-73 fig. 2.7.7 connection diagram ................................................................................................... 2-74 fig. 2.7.8 related registers setting ........................................................................................... 2-74 fig. 2.7.9 control procedure for 8-bit read .............................................................................. 2-75 fig. 2.7.10 control procedure for 10-bit read .......................................................................... 2-75 fig. 2.8.1 memory map of registers related to watchdog timer ............................................ 2-77 fig. 2.8.2 structure of watchdog timer control register ......................................................... 2-77 fig. 2.8.3 structure of cpu mode register .............................................................................. 2-78 fig. 2.8.4 watchdog timer connection and division ratio setting .......................................... 2-79 fig. 2.8.5 related registers setting ........................................................................................... 2-80 fig. 2.8.6 control procedure ....................................................................................................... 2-80 fig. 2.9.1 example of poweron reset circuit ............................................................................ 2-81 fig. 2.9.2 ram backup system .................................................................................................. 2-81 fig. 2.10.1 memory map of registers related to pll .............................................................. 2-83 fig. 2.10.2 structure of usb control register .......................................................................... 2-83 fig. 2.10.3 structure of cpu mode register ............................................................................ 2-84 fig. 2.10.4 structure of pll control register ........................................................................... 2-84
ix 38k0 group user? manual list of figures fig. 2.10.5 block diagram for frequency synthesizer circuit .................................................. 2-85 fig. 2.10.6 related registers setting when hardware reset ................................................... 2-86 fig. 2.10.7 related registers setting when stop mode ........................................................... 2-87 fig. 2.10.8 related registers setting when recovery from stop mode ................................. 2-88 fig. 2.11.1 memory map of registers related to clock generating circuit ............................ 2-89 fig. 2.11.2 structure of usb control register .......................................................................... 2-89 fig. 2.11.3 structure of cpu mode register ............................................................................ 2-90 fig. 2.11.4 structure of pll control register ........................................................................... 2-90 fig. 2.11.5 related registers setting ......................................................................................... 2-91 fig. 2.11.6 related registers setting ......................................................................................... 2-93 fig. 2.12.1 memory map of registers related to standby function ........................................ 2-94 fig. 2.12.2 structure of misrg ................................................................................................. 2-94 fig. 2.12.3 oscillation stabilizing time at restoration by reset input .................................... 2-96 fig. 2.12.4 execution sequence example at restoration by occurrence of int0 interrupt request ............................................................................................................................... .... 2-98 fig. 2.12.5 reset input time ..................................................................................................... 2-100 fig. 2.13.1 memory map of flash memory version for 38k0 group ................................... 2-102 fig. 2.13.2 memory map of registers related to flash memory ........................................... 2-103 fig. 2.13.3 structure of flash memory control register ........................................................ 2-103 fig. 2.13.4 rewrite example of built-in flash memory in standard serial i/o mode ......... 2-106 fig. 2.13.5 connection example in standard serial i/o mode (1) ....................................... 2-107 fig. 2.13.6 connection example in standard serial i/o mode (2) ....................................... 2-107 fig. 2.13.7 connection example in standard serial i/o mode (3) ....................................... 2-108 fig. 2.13.8 example of rewrite system for built-in flash memory in cpu rewrite mode . 2-109 fig. 2.13.9 cpu rewrite mode beginning/release flowchart ................................................. 2-110 chapter 3 appendix fig. 3.1.1 output switching characteristics measurement circuit ............................................ 3-9 fig. 3.1.2 usb output switching characteristics measurement circuit (1) for d0- .............. 3-10 fig. 3.1.3 usb output switching characteristics measurement circuit (2) for d0+ ............. 3-10 fig. 3.1.4 output switching characteristics measurement circuit .......................................... 3-19 fig. 3.1.5 usb output switching characteristics measurement circuit (1) for d0- .............. 3-21 fig. 3.1.6 usb output switching characteristics measurement circuit (2) for d0+ ............. 3-21 fig. 3.1.7 timing chart (1) .......................................................................................................... 3-22 fig. 3.1.8 timing chart (2) .......................................................................................................... 3-23 fig. 3.1.9 timing chart (3) .......................................................................................................... 3-24 fig. 3.1.10 timing chart (4) ........................................................................................................ 3-25 fig. 3.1.11 timing chart (5) ........................................................................................................ 3-26 fig. 3.1.12 timing chart (6) ........................................................................................................ 3-27 fig. 3.3.1 sequence of changing relevant register ................................................................. 3-31 fig. 3.3.2 sequence of check of interrupt request bit ............................................................ 3-32 fig. 3.3.3 sequence of setting serial i/o control register again ........................................... 3-34 fig. 3.3.4 initialization of processor status register ................................................................ 3-38 fig. 3.3.5 sequence of plp instruction execution .................................................................. 3-38 fig. 3.3.6 stack memory contents after php instruction execution ..................................... 3-38 fig. 3.3.7 status flag at decimal calculations .......................................................................... 3-39 fig. 3.4.1 selection of packages ............................................................................................... 3-41 fig. 3.4.3 wiring for clock i/o pins ........................................................................................... 3-42 fig. 3.4.4 wiring for cnv ss pin .................................................................................................. 3-42 fig. 3.4.5 wiring for the v pp pin of the flash memory version .............................................. 3-43 fig. 3.4.6 bypass capacitor across the v ss line and the v cc line ........................................ 3-43 fig. 3.4.7 analog signal line and a resistor and a capacitor ................................................ 3-44
x 38k0 group user? manual list of figures fig. 3.4.8 wiring for a large current signal line ...................................................................... 3-45 ___________ fig. 3.4.9 wiring of reset pin ................................................................................................. 3-45 fig. 3.4.10 v ss pattern on the underside of an oscillator ...................................................... 3-46 fig. 3.4.11 setup for i/o ports ................................................................................................... 3-46 fig. 3.4.12 watchdog timer by software ................................................................................... 3-47 fig. 3.5.1 structure of port pi .................................................................................................... 3-48 fig. 3.5.2 structure of port pi direction register ..................................................................... 3-48 fig. 3.5.3 structure of usb control register ............................................................................. 3-49 fig. 3.5.4 structure of usb function enable register .............................................................. 3-49 fig. 3.5.5 structure of usb function address register ............................................................ 3-49 fig. 3.5.6 structure of frame number register low ................................................................ 3-50 fig. 3.5.7 structure of frame number register high ............................................................... 3-50 fig. 3.5.8 structure of usb interrupt source enable register ................................................ 3-50 fig. 3.5.9 structure of usb interrupt source register ............................................................. 3-51 fig. 3.5.10 structure of endpoint index register ...................................................................... 3-51 fig. 3.5.11 structure of ep00 stage register ........................................................................... 3-52 fig. 3.5.12 structure of ep01 set register ............................................................................... 3-52 fig. 3.5.13 structure of ep02 set register ............................................................................... 3-53 fig. 3.5.14 structure of ep03 set register ............................................................................... 3-53 fig. 3.5.15 structure of ep00 control register 1 ..................................................................... 3-54 fig. 3.5.16 structure of ep01 control register 1 ..................................................................... 3-54 fig. 3.5.17 structure of ep02 control register 1 ..................................................................... 3-54 fig. 3.5.18 structure of ep03 control register 1 ..................................................................... 3-55 fig. 3.5.19 structure of ep00 control register 2 ..................................................................... 3-55 fig. 3.5.20 structure of ep01 control register 2 ..................................................................... 3-55 fig. 3.5.21 structure of ep02 control register 2 ..................................................................... 3-56 fig. 3.5.22 structure of ep03 control register 2 ..................................................................... 3-56 fig. 3.5.23 structure of ep00 control register 3 ..................................................................... 3-56 fig. 3.5.24 structure of ep01 control register 3 ..................................................................... 3-57 fig. 3.5.25 structure of ep02 control register 3 ..................................................................... 3-57 fig. 3.5.26 structure of ep03 control register 3 ..................................................................... 3-57 fig. 3.5.27 structure of ep00 interrupt source register ......................................................... 3-58 fig. 3.5.28 structure of ep01 interrupt source register ......................................................... 3-59 fig. 3.5.29 structure of ep02 interrupt source register ......................................................... 3-59 fig. 3.5.30 structure of ep03 interrupt source register ......................................................... 3-60 fig. 3.5.31 structure of ep00 byte number register ............................................................... 3-60 fig. 3.5.32 structure of ep01 byte number register 0 ........................................................... 3-60 fig. 3.5.33 structure of ep02 byte number register 0 ........................................................... 3-61 fig. 3.5.34 structure of ep03 byte number register 0 ........................................................... 3-61 fig. 3.5.35 structure of ep01 byte number register 1 ........................................................... 3-61 fig. 3.5.36 structure of ep02 byte number register 1 ........................................................... 3-62 fig. 3.5.37 structure of ep03 byte number register 1 ........................................................... 3-62 fig. 3.5.38 structure of prescaler12, prescaler x .................................................................. 3-62 fig. 3.5.39 structure of timer 1 ................................................................................................ 3-63 fig. 3.5.40 structure of timer 2, timer x ................................................................................ 3-63 fig. 3.5.41 structure of timer x mode register ...................................................................... 3-64 fig. 3.5.42 structure of transmit/receive buffer register ...................................................... 3-64 fig. 3.5.43 structure of serial i/o status register ................................................................... 3-65 fig. 3.5.44 structure of exb interrupt source enable register ............................................ 3-65 fig. 3.5.45 structure of exb interrupt source register ........................................................... 3-66 fig. 3.5.46 structure of exb index register ............................................................................. 3-66 fig. 3.5.47 structure of register window 1 .............................................................................. 3-67
xi 38k0 group user? manual list of figures fig. 3.5.48 index00[low]; structure of external i/o configuration register ......................... 3-67 fig. 3.5.49 index01[low]; structure of transmit/receive buffer register .............................. 3-68 fig. 3.5.50 index02[low]; structure of memory channel operation mode register .............. 3-68 fig. 3.5.51 index03[low]; structure of memory address counter ........................................... 3-68 fig. 3.5.52 index04[low]; structure of end address register ................................................. 3-69 fig. 3.5.53 structure of register window 2 .............................................................................. 3-69 fig. 3.5.54 index00[high]; structure of external i/o configuration register ........................ 3-69 fig. 3.5.55 index03[high]; structure of memory address counter ......................................... 3-70 fig. 3.5.56 index04[high]; structure of end address register ................................................ 3-70 fig. 3.5.57 structure of a-d control register ............................................................................ 3-70 fig. 3.5.58 structure of a-d conversion register 1 ................................................................. 3-71 fig. 3.5.59 structure of a-d conversion register 2 ................................................................. 3-71 fig. 3.5.60 structure of watchdog timer control register ....................................................... 3-72 fig. 3.5.61 structure of cpu mode register ............................................................................ 3-72 fig. 3.5.62 structure of interrupt request register 1 ............................................................... 3-73 fig. 3.5.63 structure of interrupt request register 2 ............................................................... 3-73 fig. 3.5.64 structure of interrupt control register 1 ................................................................ 3-74 fig. 3.5.65 structure of interrupt control register 2 ................................................................ 3-74 fig. 3.5.66 structure of serial i/o control register .................................................................. 3-75 fig. 3.5.67 structure of uart control register ........................................................................ 3-75 fig. 3.5.68 structure of baud rate generator ........................................................................... 3-76 fig. 3.5.69 structure of ep01 max. packet size register ...................................................... 3-76 fig. 3.5.70 structure of ep02 max. packet size register ...................................................... 3-76 fig. 3.5.71 structure of ep03 max. packet size register ...................................................... 3-77 fig. 3.5.72 structure of ep00 buffer area set register ........................................................... 3-77 fig. 3.5.73 structure of ep01 buffer area set register ........................................................... 3-77 fig. 3.5.74 structure of ep02 buffer area set register ........................................................... 3-78 fig. 3.5.75 structure of ep03 buffer area set register ........................................................... 3-78 fig. 3.5.76 structure of port p0 pull-up control register ........................................................ 3-79 fig. 3.5.77 structure of port p5 pull-up control register ........................................................ 3-79 fig. 3.5.78 structure of interrupt edge selection register ...................................................... 3-80 fig. 3.5.79 structure of pll control register ........................................................................... 3-80 fig. 3.5.80 structure of misrg ................................................................................................. 3-81 fig. 3.5.81 structure of flash memory control register .......................................................... 3-81
xii 38k0 group user? manual list of tables list of tables chapter 1 hardware table 1. pin description ............................................................................................................... 1-4 table 2. list of 38k0 group products (standard) .................................................................... 1-6 table 3. list of 38k0 group products (l version) ................................................................... 1-6 table 4 push and pop instructions of accumulator or processor status register ............... 1-8 table 5 set and clear instructions of each bit of processor status register ....................... 1-9 table 6 i/o ports functions ....................................................................................................... 1-13 table 7 interrupt vector addresses and priority ..................................................................... 1-17 table 8 usb interrupt sources ................................................................................................. 1-30 table 9 summary of 38k0 group? flash memory version ................................................... 1-82 table 10 list of software commands (cpu rewrite mode) .................................................. 1-87 table 11 definition of each bit in status register .................................................................. 1-89 table 12 description of pin function (standard serial i/o mode) ....................................... 1-95 table 13 software commands (standard serial i/o mode) .................................................. 1-97 table 14 status register (srd) .............................................................................................. 1-104 table 15 status register 1 (srd1) ........................................................................................ 1-104 table 16 relative formula for a reference voltage vref of a-d converter and vref ... 1-111 table 17 change of a-d conversion register during a-d conversion .............................. 1-111 chapter 2 application table 2.1.1 handling of unused pins .......................................................................................... 2-5 table 2.2.1 interrupt sources, vector addresses and priority of 38k0 group ...................... 2-11 table 2.2.2 list of interrupt bits according to interrupt source ............................................. 2-16 table 2.3.1 cntr 0 active edge selection bit function ............................................................ 2-25 table 2.4.1 setting examples of baud rate generator values and transfer bit rate values 2-61 table 2.10.1 pll operation mode selection bits setting example ........................................ 2-85 table 2.10.2 usb clock division ratio selection bits setting example .................................. 2-86 table 2.11.1 example of internal clock f(f) generation using main clock f(x in ) .................. 2-91 table 2.11.2 example of internal clock f(f) generation using fsyn ..................................... 2-92 table 2.12.1 state in stop mode ............................................................................................... 2-95 table 2.12.2 state in wait mode ................................................................................................ 2-99 table 2.13.1 setting of programmers when parallel programming ..................................... 2-104 table 2.13.2 connection example to flash programmer when serial programming (4 wires).. ............................................................................................................................. 2- 104 table 2.13.3 setting condition in serial i/o mode ............................................................... 2-106
xiii 38k0 group user? manual list of tables chapter 3 appendix table 3.1.1 absolute maximum ratings ....................................................................................... 3-2 table 3.1.2 recommended operating conditions (vcc = 4.00 to 5.25 v, vss = 0 v, ta = ?0 to 85?, unless otherwise noted) ........................................................................... 3-3 table 3.1.3 recommended operating conditions (vcc = 4.00 to 5.25 v, vss = 0 v, ta = ?0 to 85?, unless otherwise noted) ........................................................................... 3-4 table 3.1.4 electrical characteristics (1) (vcc = 4.00 to 5.25 v, vss = 0 v, ta = ?0 to 85?, unless otherwise noted) ........................................................................................... 3-5 table 3.1.5 electrical characteristics (2) (vcc = 4.00 to 5.25 v, vss = 0 v, ta = ?0 to 85?, unless otherwise noted) ........................................................................................... 3-6 table 3.1.6 a-d converter characteristics (v cc = 4.00 to 5.25 v, v ss = 0 v, ta = ?0 to 85?, unless otherwise noted) ........................................................................................... 3-7 table 3.1.7 timing requirements (v cc = 4.00 to 5.25 v, v ss = 0 v, ta = ?0 to 85 ?, unless otherwise noted) ........................................................................................................ 3-8 table 3.1.8 timing requirements of external bus interface (exb)8 (v cc = 4.00 to 5.25 v, v ss = 0 v, ta = ?0 to 85 ?, unless otherwise noted) ........................................... 3-8 table 3.1.9 switching characteristics (v cc = 4.00 to 5.25 v, v ss = 0 v, ta = ?0 to 85 ?, unless otherwise noted) ........................................................................................... 3-9 table 3.1.10 switching characteristics of external bus interface (exb) (v cc = 4.00 to 5.25 v, v ss = 0 v, ta = ?0 to 85 ?, unless otherwise noted) .................................. 3-9 table 3.1.11 switching characteristics (usb ports) (v cc = 4.00 to 5.25 v, v ss = 0 v, ta = ?0 to 85 ?, unless otherwise noted) ..................................................................... 3-10 table 3.1.12 recommended operating conditions (vcc = 3.00 to 5.25 v, vss = 0 v, ta = ?0 to 85?, unless otherwise noted) ....................................................................... 3-11 table 3.1.13 recommended operating conditions (vcc = 3.00 to 5.25 v, vss = 0 v, ta = ?0 to 85?, unless otherwise noted) ....................................................................... 3-12 table 3.1.14 electrical characteristics (1) (vcc = 3.00 to 5.25 v, vss = 0 v, ta = ?0 to 85?, unless otherwise noted) ....................................................................................... 3-13 table 3.1.15 electrical characteristics (2) (vcc = 3.00 to 5.25 v, vss = 0 v, ta = ?0 to 85?, unless otherwise noted) ....................................................................................... 3-14 table 3.1.16 a-d converter characteristics (v cc = 3.00 to 5.25 v, v ss = 0 v, ta = ?0 to 85?, unless otherwise noted) ....................................................................................... 3-15 table 3.1.17 timing requirements (1) (v cc = 4.00 to 5.25 v, v ss = 0 v, ta = ?0 to 85 ?, unless otherwise noted) ....................................................................................... 3-16 table 3.1.18 timing requirements (2) (v cc = 3.00 to 4.00 v, v ss = 0 v, ta = ?0 to 85 ?, unless otherwise noted) ....................................................................................... 3-16 table 3.1.19 timing requirements of external bus interface (exb) (1) (v cc = 4.00 to 5.25 v, v ss = 0 v, ta = ?0 to 85 ?, unless otherwise noted) ................................ 3-17 table 3.1.20 timing requirements of external bus interface (exb) (2) (v cc = 3.00 to 4.00 v, v ss = 0 v, ta = ?0 to 85 ?, unless otherwise noted) ....................................... 3-18 table 3.1.21 switching characteristics (1) (v cc = 4.00 to 5.25 v, v ss = 0 v, ta = ?0 to 85 ?, unless otherwise noted) ....................................................................................... 3-19 table 3.1.22 switching characteristics (2) (v cc = 3.00 to 4.00 v, v ss = 0 v, ta = ?0 to 85 ?, unless otherwise noted) ....................................................................................... 3-19 table 3.1.23 switching characteristics of external bus interface (exb) (1) (v cc = 4.00 to 5.25 v, v ss = 0 v, ta = ?0 to 85 ?, unless otherwise noted) ........................... 3-20 table 3.1.24 switching characteristics of external bus interface (exb) (2) (v cc = 3.00 to 4.00 v, v ss = 0 v, ta = ?0 to 85 ?, unless otherwise noted) ........................... 3-20 table 3.1.25 switching characteristics (usb ports) (v cc = 3.00 to 5.25 v, v ss = 0 v, ta = ?0 to 85 ?, unless otherwise noted) ..................................................................... 3-21
chapter 1 hardware description features pin configuration functional block pin description part numbering group expansion functional description notes on programming notes on usage data required for mask orders functional description supplement
hardware 1-2 38k0 group user? manual description the 38k0 group is the 8-bit microcomputer based on the 740 fam- ily core technology. the 38k0 group has the usb function, an 8-bit bus interface, a serial i/o, three 8-bit timers, and an 8-channel 10-bit a-d con- verter, which are available for the pc peripheral i/o device. the various microcomputers in the 38k0 group include variations of internal memory size and packaging. for details, refer to the section on part numbering. features basic machine-language instructions ....................................... 71 the minimum instruction execution time .......................... 0.25 ? (at 8 mhz system clock ? ) system clock ? : reference frequency to internal circuit except usb function memory size rom ................................................................ 16 k to 32 k bytes ram ............................................................... 1024 to 2048 bytes programmable input/output ports ............................................. 48 software pull-up resistors interrupts .................................................. 15 sources, 15 vectors usb function (full-speed usb2.0 specification) ...... 4 endpoints external bus interface ....................................... 8-bit ? 1 channel timers ............................................................................. 8-bit ? 3 watchdog timer ............................................................. 16-bit ? 1 serial i/o ...................... 8-bit ? 1 (uart or clock-synchronized) a-d converter ................................................ 10-bit ? 8 channels (8-bit reading available) led direct drive port ................................................................... 4 clock generating circuit (connect to external ceramic resonator or quartz-crystal oscillator) power source voltage (standard) system clock/internal clock division mode at 8 mhz/through mode ( = 8 mhz) ................... 4.00 to 5.25 v at 6 mhz/through mode ( = 6 mhz) ................... 4.00 to 5.25 v power source voltage (l version) system clock/internal clock division mode at 12 mhz/through mode ( = 12 mhz) (under planning) .......... ................... 4.50 to 5.25 v at 12 mhz/2-divide mode( = 6 mhz) ................... 4.00 to 5.25 v at 8 mhz/through mode ( = 8 mhz) ................... 4.00 to 5.25 v at 6 mhz/through mode ( = 6 mhz) ................... 3.00 to 5.25 v power dissipation at 5 v power source voltage .................................. 125 mw (typ.) (at 8 mhz system clock, in through mode) at 3.3 v power source voltage ................................ 30 mw (typ.) (at 6 mhz system clock, in through mode) operating temperature range .................................... ?0 to 85? packages fp ........................................ 64p6u-a (64-pin 14 ? 14 mm lqfp) hp ........................................ 64p6q-a (64-pin 10 ? 10 mm lqfp) notes the specifications of this product are subject to change because it is under development. inquire the use of mitsubishi electric cor- poration. package type : 64p6u-a/64p6q-a fig. 1 pin configuration of 38k0 group pin configuration (top view) 32 31 30 29 28 26 25 24 23 22 21 20 19 18 17 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 27 64 48 47 46 45 43 42 41 40 39 38 37 36 35 34 33 44 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 tron p2 3 p2 2 p2 1 p2 0 d0- d0+ usbv ref dv cc pv cc p0 3 p0 2 p0 1 p0 0 p5 7 p5 6 p5 5 p5 4 p5 3 p5 2 /int 1 p5 1 /cntr 0 p5 0 /int 0 pv ss p1 0 /dq 0 /an 0 p0 6 p0 7 p4 0 /e x dreq/r x d p1 1 /dq 1 /an 1 p1 2 /dq 2 /an 2 p1 3 /dq 3 /an 3 p1 4 /dq 4 /an 4 p1 5 /dq 5 /an 5 p1 6 /dq 6 /an 6 p1 7 /dq 7 /an 7 p6 0 (led 0 ) p6 1 (led 1 ) p6 2 (led 2 ) p6 3 (led 3 ) p4 1 /e x dack/t x d p4 2 /e x tc/s clk p4 3 /e x a1/s rdy p3 0 p3 1 p3 2 p3 3 /e x int p3 4 /e x cs p3 5 /e x wr p3 6 /e x rd p3 7 /e x a0 m38k07m4-xxxfp/hp m38k09f8fp/hp p2 4 p0 4 p2 7 p2 6 cnv ss v cc e v ref v ss x out v cc cnv ss 2 x in reset p2 5 p0 5 m38k07m4l-xxxfp/hp m38k09f8lfp/hp description/features/pin configuration
1-3 38k0 group user s manual hardware functional block diagram (package : 64p6u-a/64p6q-a) fig. 2 functional block diagram c n t r 0 v s s r e s e t v c c x i n w a t c h d o g t i m e r t i m e r x ( 8 ) t i m e r 1 ( 8 ) t i m e r 2 ( 8 ) x o u t c l o c k g e n e r a t i n g c i r c u i t r a m d a t a b u s c p u r a m i / f r o m c n v s s c n v s s 2 p v c c p v s s p 5 ( 8 ) i n t 1 i n t 0 3 5 3 6 3 7 3 8 3 9 4 0 4 1 4 2 p 6 ( 4 ) 1 6 1 7 1 8 1 9 p 4 ( 4 ) s i / o e x t b u s ( 8 ) p 3 ( 8 ) 5 1 5 2 5 3 5 4 5 5 5 6 5 7 5 8 5 9 6 0 6 1 6 2 d 0 + u s b d 0 - t r o n u s b v r e f d v c c 2 2 2 3 2 4 2 6 2 5 p 0 ( 8 ) 4 3 4 4 4 5 4 6 4 7 4 8 4 9 5 0 v r e f p 1 ( 8 ) 1 0 - b i t a - d c o n v e r t e r ( 8 ) 1 0 6 3 6 4 1 2 3 4 5 6 2 0 2 1 1 2 1 3 1 1 1 4 8 7 1 5 p 2 ( 8 ) 2 7 2 8 2 9 3 0 3 1 3 2 3 3 3 4 v c c e 9 functional block functional block
hardware 1-4 38k0 group user s manual pin description table 1. pin description function apply voltage of 4.0 v 5.25v (standard) or 3.0 v 5.25 v (l version) to v cc , and 0 v to v ss . power source pin for ports p1, p3, p4 and analog circuit. connect this pin to v cc . this pin controls the operation mode of the chip. connect this pin to v ss . in the flash memory mode, this pin becoems v pp power source input pin. this pin controls the operation mode of the chip. connect this pin to v ss . reference voltage input pin for a-d converter. power source pin for analog circuit. connect the dv cc and pv cc pins to v cc , and the pv ss pin to v ss . reset input pin for active l input and output pins for the main clock generating circuit. 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. power source pin for usb port circuit. in vcc = 4.00 to 5.25 v use the built-in usb reference voltage circuit. in vcc = 3.60 to 4.00 v apply 3.3 v power supply from the external because use of the built-in usb reference voltage circuit is prohibited in this voltage range. in vcc = 3.00 to 3.60 v connect this pin to v cc because use of the built-in usb reference voltage circuit is prohibited in this voltage range. output pin to pull-up d0+ by 1.5 k ? usb upstream i/o port usb input level usb output level output structure 8-bit i/o port i/o direction register allows each pin to be individually programmed as either input or output. cmos compatible input level cmos 3-state output structure pull-up control is enabled. 8-bit i/o port i/o direction register allows each pin to be individually programmed as either input or output. cmos compatible input level cmos 3-state output structure 8-bit i/o port i/o direction register allows each pin to be individually programmed as either input or output. cmos compatible input level cmos 3-state output structure 8-bit i/o port i/o direction register allows each pin to be individually programmed as either input or output. cmos compatible input level cmos 3-state output structure 4-bit i/o port i/o direction register allows each pin to be individually programmed as either input or output. cmos compatible input level cmos 3-state output structure 8-bit i/o port i/o direction register allows each pin to be individually programmed as either input or output. cmos compatible input level cmos 3-state output structure 4-bit i/o port i/o direction register allows each pin to be individually programmed as either input or output. cmos compatible input level cmos 3-state output structure output large current for led drive is enabled. key input pins (key-on wake up interrupt) a-d converter input pins external bus interface function pins external bus interface function pins serial i/o function pins external bus interface function pins interrupt input pin timer x funciton pin interrupt input pin pin v cc , v ss v cc e cnv ss cnv ss 2 v ref dv cc pv cc , pv ss reset x in x out usbv ref tron d0+, d0- p0 0 p0 7 p1 0 /dq 0 /an 0 p1 7 /dq 7 /an 7 p2 0 p2 7 p3 0 p3 2 p3 3 /exint p3 4 /excs p3 5 /exwr p3 6 /exrd p3 7 /exa0 p4 0 /exdreq/rxd p4 1 /exdack/txd p4 2 /extc/s clk p4 3 /exa1/s rdy p5 0 /int 0 p5 1 /cntr 0 p5 2 /int 1 p5 3 p5 7 p6 0 p6 3 name power source analog power source cnv ss cnv ss 2 analog reference voltage input analog power source reset input clock input clock output usb reference power source usb reference voltage output usb upstream i/o i/o port p0 i/o port p1 i/o port p2 i/o port p3 i/o port p4 i/o port p5 i/o port p6 function except a port function pin description
1-5 38k0 group user s manual hardware part numbering fig. 3 part numbering m 3 8 k0 7 m 4 - x x x f p product rom/prom size 1 : 4096 bytes 2 : 8192 bytes 3 : 12288 bytes 4 : 16384 bytes 5 : 20480 bytes 6 : 24576 bytes 7 : 28672 bytes 8 : 32768 bytes the first 128 bytes and the last 2 bytes of rom are reserved areas ; they cannot be used as a user s rom area. however, they can be programmed or erased in the flash memory version, so that users can use them. memory type m : mask rom version f : flash memory version ram size 0 : 192 bytes 1 : 256 bytes 2 : 384 bytes 3 : 512 bytes 4 : 640 bytes 5 : 768 bytes 6 : 896 bytes 7 : 1024 bytes 8 : 1536 bytes 9 : 2048 bytes rom number omitted in the flash memory version. : s t a n d a r d o m i t t e d i n t h e f l a s h m e m o r y v e r s i o n . p a c k a g e t y p e f p : 6 4 p 6 u - a p a c k a g e h p : 6 4 p 6 q - a p a c k a g e 9 : 3 6 8 6 4 b y t e s a : 4 0 9 6 0 b y t e s b : 4 5 0 5 6 b y t e s c : 4 9 1 5 2 b y t e s d : 5 3 2 4 8 b y t e s e : 5 7 3 4 4 b y t e s f : 6 1 4 4 0 b y t e s part numbering
hardware 1-6 38k0 group user? manual group expansion mitsubishi plans to expand the 38k0 group as follows. memory type support for mask rom and flash memory versions. memory size flash memory size .......................................................... 32 kbytes mask rom size ............................................................... 16 kbytes ram size .......................................................... 1024 to 2048 bytes packages 64p6u-a .................................. 0.8 mm-pitch plastic molded lqfp 64p6q-a .................................. 0.5 mm-pitch plastic molded lqfp 100d0m ........................... 0.65 mm-pitch metal seal piggy back memory expansion plan fig. 4 memory expansion plan as of december 2002 remarks package 64p6u-a 64p6q-a 64p6u-a 64p6q-a 100d0m product m38k07m4-xxxfp m38k07m4-xxxhp m38k09f8fp M38K09F8HP m38k09rfs ram size (bytes) 1024 2048 2048 16384 (16254) rom size (bytes) rom size for user in ( ) 32768 (32638) mask rom version flash memory version emulator mcu (for program evaluation) 256 512 1,024 2,048 8k 16k 32k 60k rom size (bytes) ram size (bytes) products under development or planning: the development schedule and specification may be revised without notice. m38k09f8l : under development : mass production m38k09f8 m38k07m4l m38k07m4 currently products are listed below. table 2. list of 38k0 group products (standard) table 3. list of 38k0 group products (l version) as of december 2002 remarks package 64p6u-a 64p6q-a 64p6u-a 64p6q-a 100d0m product m38k07m4l-xxxfp m38k07m4l-xxxhp m38k09f8lfp m38k09f8lhp m38k09rfs ram size (bytes) 1024 2048 2048 16384 (16254) rom size (bytes) rom size for user in ( ) 32768 (32638) mask rom version flash memory version use of standard product only group expansion
1-7 38k0 group user s manual hardware functional description functional description central processing unit (cpu) the 38k0 group uses the standard 740 family instruction set. re- fer to the table of 740 family addressing modes and machine instructions or the 740 family software manual for details on the instruction set. machine-resident 740 family instructions are as follows: the fst and slw instruction cannot be used. the stp, wit, mul, and div instruction can be used. the cpu has the 6 registers. the register structure is shown in figure 5. [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 contents 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 0 , the high-order 8 bits becomes 00 16 . if the stack page selection bit is 1 , the high-order 8 bits becomes 01 16 . figure 6 shows the store and the return movement into the stack. if there are registers other than those described in figure 5, the users need to store them with the program. [program counter (pc)] the program counter is a 16-bit counter consisting of two 8-bit registers pc h and pc l . it is used to indicate the address of the next instruction to be executed. fig. 5 740 family cpu register structure a accumulator b7 b7 b7 b7 b0 b7 b15 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
hardware 1-8 38k0 group user s manual functional description 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. 6 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 ) execute rts (pc l )m (s) (s) (s) 1 ( s ) ( s ) + 1 (s) (s) + 1 (pc h )m (s) subroutine pop return address from stack 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) (ps) execute rti (ps) 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 pop contents of processor status register from stack m (s) (pc h ) (s) 1 m ( s )( p c l ) ( s ) ( s ) 1 (pc l )m (s) (s) (s) + 1 (s) (s) + 1 (pc 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 flag is set from 0 to 1 fetch the jump vector 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
1-9 38k0 group user s manual hardware functional description [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 operation and 3 flags which decide mcu operation. branch opera- tions 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. bit 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. bit 1: zero flag (z) the z flag is set if the result of an immediate arithmetic operation or a data transfer is 0 , and cleared if the result is anything other than 0 . bit 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 1 . bit 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 0 ; decimal arithmetic is executed when it is 1 . decimal correction is automatic in decimal mode. only the adc bit 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 0 . 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 1 . bit 5: index x mode flag (t) when the t flag is 0 , arithmetic operations are performed between accumulator and memory. when the t flag is 1 , direct arithmetic operations and direct data transfers are enabled between memory locations. bit 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. bit 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
hardware 1-10 38k0 group user s manual functional description [cpu mode register (cpum)] 003b 16 the cpu mode register contains the stack page selection bit and the internal system clock selection bit. the cpu mode register is allocated at address 003b 16 . fig. 7 structure of cpu mode register p r o c e s s o r m o d e b i t s b 1b 0 00 : s i n g l e - c h i p m o d e 01 : 10 : n o t a v a i l a b l e 11 : s t a c k p a g e s e l e c t i o n b i t 0 : 0 p a g e 1 : 1 p a g e n o t u s e d ( r e t u r n s 1 w h e n r e a d ) ( d o n o t w r i t e 0 t o t h i s b i t ) n o t u s e d ( r e t u r n s 0 w h e n r e a d ) ( d o n o t w r i t e 1 t o t h i s b i t ) s y s t e m c l o c k s e l e c t i o n b i t 0 : m a i n c l o c k ( x i n ) 1 : f s y n s y s t e m c l o c k d i v i s i o n r a t i o s e l e c t i o n b i t s b 7b 6 00 :
1-11 38k0 group user s manual hardware functional description memory special function register (sfr) area the special function register area in the zero page contains con- trol 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 2 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 the 256 bytes from addresses 0000 16 to 00ff 16 are called the zero page area. the internal ram and the special function regis- ters (sfr) are allocated to this area. the zero page addressing mode can be used to specify memory and register addresses in the zero page area. access to this area with only 2 bytes is possible in the zero page addressing mode. special page the 256 bytes from addresses ff00 16 to ffff 16 are called the special page area. the special page addressing mode can be used to specify memory addresses in the special page area. ac- cess to this area with only 2 bytes is possible in the special page addressing mode. fig. 8 memory map diagram 1 9 2 2 5 6 3 8 4 5 1 2 6 4 0 7 6 8 8 9 6 1 0 2 4 1 5 3 6 2 0 4 8 00 ff 16 013f 16 01bf 16 023f 16 02bf 16 033f 16 03bf 16 043f 16 063f 16 083f 16 ram area r a m s i z e ( b y t e s ) a d d r e s s x x x x 1 6 409 6 819 2 1228 8 1638 4 2048 0 2457 6 2867 2 3276 8 3686 4 4096 0 4505 6 4915 2 5324 8 5734 4 6144 0 f 000 16 e000 16 d000 16 c000 16 b000 16 a000 16 9000 16 8000 16 7000 16 6000 16 5000 16 4000 16 3000 16 2000 16 1000 16 f 080 16 e080 16 d080 16 c080 16 b080 16 a080 16 9080 16 8080 16 7080 16 6080 16 5080 16 4080 16 3080 16 2080 16 1080 16 rom area rom s i ze (bytes) a d d r e s s y y y y 1 6 a d d r e s s z z z z 1 6 0100 16 0000 16 0040 16 0 fe 0 16 ff 00 16 ffdc 16 f f f e 1 6 ffff 16 xxxx 16 yyyy 16 zzzz 16 ram r o m s f r a r e a n ot use d i n t e r r u p t v e c t o r a r e a r eserve d rom area (128 bytes) z e r o p a g e s pec i a l page r e s e r v e d r o m a r e a 0 fff 16 s f r a r e a
hardware 1-12 38k0 group user? manual functional description fig. 9 memory map of special function register (sfr) 0020 16 0021 16 0022 16 0023 16 0024 16 0025 16 0026 16 0027 16 0028 16 0029 16 0 0 2 a 1 6 0 0 2 b 1 6 002 c 16 002 d 16 0 0 2 e 1 6 0 0 2 f 1 6 0030 16 0031 16 0032 16 0033 16 0034 16 0035 16 0036 16 0037 16 0038 16 0039 16 0 0 3 a 1 6 0 0 3 b 1 6 003 c 16 003 d 16 0 0 3 e 1 6 003 f 16 0000 16 0 0 0 1 1 6 0 0 0 2 1 6 0003 16 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 0009 16 0 0 0 a 1 6 000 b 16 0 0 0 c 1 6 0 0 0 d 1 6 0 0 0 e 1 6 0 0 0 f 1 6 0010 16 0 0 1 1 1 6 0012 16 0 0 1 3 1 6 0014 16 0 0 1 5 1 6 0016 16 0017 16 0018 16 0019 16 001 a 16 0 0 1 b 1 6 0 0 1 c 1 6 001 d 16 001 e 16 0 0 1 f 1 6 p o r t p 0 ( p 0 ) 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 4 ( p 4 ) p ort p 4 di rect i on reg i ster (p 4 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 ort 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 ) s er i a l i / o status reg i ster (siosts) i nterrupt contro l reg i ster 2 (icon 2 ) t ransm i t/ r ece i ve b u ff er reg i ster (tb/rb) cpu mo d e reg i ster (cpum) i nterrupt request reg i ster 1 (ireq 1 ) i nterrupt request reg i ster 2 (ireq 2 ) i nterrupt contro l reg i ster 1 (icon 1 ) p resca l er 12 (pre 12 ) ti mer 2 (t 2 ) p resca l er x (prex) ti mer x (tx) ti mer 1 (t 1 ) ti mer x mo d e reg i ster (tm) a - d contro l reg i ster (adcon) a - d convers i on reg i ster 1 (ad 1 ) 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 ort p 3 di rect i on reg i ster (p 3 d) r eserve d (n ote ) r e s e r v e d ( n o t e ) u s b c o n t r o l r e g i s t e r ( u s b c o n ) u s b f u n c t i o n e n a b l e r e g i s t e r ( u s b a e ) usb f unct i on a dd ress reg i ster (usba 0 ) 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 ) e n d p o i n t f i e l d r e g i s t e r 1 ( e p x x r e g 1 ) e n d po i nt fi e ld reg i ster 2 (epxxreg 2 ) e n d p o i n t f i e l d r e g i s t e r 3 ( e p x x r e g 3 ) e n d p o i n t f i e l d r e g i s t e r 4 ( e p x x r e g 4 ) e n d p o i n t f i e l d r e g i s t e r 5 ( e p x x r e g 5 ) e n d po i nt fi e ld reg i ster 6 (epxxreg 6 ) e n d p o i n t f i e l d r e g i s t e r 7 ( e p x x r e g 7 ) r e s e r v e d ( n o t e ) r e s e r v e d ( n o t e ) r e s e r v e d ( n o t e ) r e s e r v e d ( n o t e ) r e s e r v e d ( n o t e ) r e s e r v e d ( n o t e ) r e s e r v e d ( n o t e ) r e s e r v e d ( n o t e ) f r a m e n u m b e r r e g i s t e r l o w ( f n u m l ) f r a m e n u m b e r r e g i s t e r h i g h ( f n u m h ) u s b i n t e r r u p t s o u r c e e n a b l e r e g i s t e r ( u s b i c o n ) u s b i n t e r r u p t s o u r c e r e g i s t e r ( u s b i r e q ) e x b i n t e r r u p t s o u r c e e n a b l e r e g i s t e r ( e x b i c o n ) e xb i n t e r r u p t s o u r c e r e g i s t e r ( e x b i r e q ) r eserve d (n ote ) exb i n d ex reg i ster (exbindex) e x b f i e l d r e g i s t e r 1 ( e x b r e g 1 ) e x b f i e l d r e g i s t e r 2 ( e x b r e g 2 ) a - d convers i on reg i ster 2 (ad 2 ) watchdog timer control register (wdtcon) r eserve d (n ote ) 0 fe 0 16 0 f e 1 1 6 0 fe 2 16 0 f e 3 1 6 0 f e 4 1 6 0 fe 5 16 0 f e 6 1 6 0 f e 7 1 6 0 fe 8 16 0 f e 9 1 6 0 fea 16 fl as h memory contro l reg i ster (fmcr) p l l c o n t r o l r e g i s t e r ( p l l c o n ) p ort p 5 pu ll -up contro l reg i ster (pull 5 ) e n d po i nt fi e ld reg i ster 8 (epxxreg 8 ) e n d po i nt fi e ld reg i ster 9 (epxxreg 9 ) s e r i a l i / o c o n t r o l r e g i s t e r ( s i o c o n ) uart contro l reg i ster (uartcon) b a u d r a t e g e n e r a t o r ( b r g ) p o r t p 0 p u l l - u p c o n t r o l r e g i s t e r ( p u l l 0 ) interrupt edge selection register (intedge) r e s e r v e d ( n o t e ) 0 f e b 1 6 0 f e c 1 6 0 f e d 1 6 0 fee 16 0 f e f 1 6 0 f f 0 1 6 0 ff 1 16 0 f f 2 1 6 0 f f 3 1 6 0 ff 4 16 0 f f 5 1 6 0 ff 6 16 0 ff 7 16 0 ff 8 16 0 ff 9 16 0 ffa 16 0 ffb 16 0 f f c 1 6 0 f f d 1 6 0 ffe 16 0 f f f 1 6 r eserve d (n ote ) r e s e r v e d ( n o t e ) r e s e r v e d ( n o t e ) r e s e r v e d ( n o t e ) r eserve d (n ote ) r e s e r v e d ( n o t e ) r e s e r v e d ( n o t e ) r e s e r v e d ( n o t e ) r e s e r v e d ( n o t e ) r e s e r v e d ( n o t e ) r eserve d (n ote ) r e s e r v e d ( n o t e ) r e s e r v e d ( n o t e ) r e s e r v e d ( n o t e ) r e s e r v e d ( n o t e ) m i s r g r e s e r v e d ( n o t e ) r e s e r v e d ( n o t e ) r eserve d (n ote ) r e s e r v e d ( n o t e ) r e s e r v e d ( n o t e ) n o t e : d o n o t w r i t e a n y d a t a t o t h e s e a d d r e s s e s , b e c a u s e t h e s e a r e a s a r e r e s e r v e d . r e s e r v e d ( n o t e )
1-13 38k0 group user s manual hardware functional description i/o ports the i/o ports have direction registers which determine the input/ output direction of each individual pin. each bit in a direction reg- ister corresponds to one pin, and each pin can be set to be input port or output port. when 0 is written to the bit corresponding to a pin, that pin be- comes an input pin. when 1 is written to that bit, that pin be- comes 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 floating. if a pin set to input is written to, only the port output latch is written to and the pin remains floating. table 6 i/o ports functions related sfrs port p0 pull-up control register a-d control register exb control register exb control register exb control register serial i/o control register exb control register serial i/o control register exb control register serial i/o control register exb control register serial i/o control register exb control register port p5 pull-up control register interrupt edge selection register timer x mode register input/output input/output, individual bits name port p0 port p1 port p2 port p3 port p4 port p5 port p6 pin p0 0 p0 7 p1 0 p1 7 p2 0 p2 7 p3 0 p3 2 p3 3 /e x int p3 4 /e x cs p3 5 /e x wr p3 6 /e x rd p3 7 /e x a0 p4 0 /rxd/ exdreq p4 1 /txd/ exdack p4 2 /s clk / extc p4 3 /s rdy / exa1 p5 0 /int 0 p5 2 /int 1 p5 1 /cntr 0 p5 3 p5 7 p6 0 p6 3 non-port function key-on wake up a-d conversion input external bus interface funciton i/o external bus interface funciton output external bus interface funciton input serial i/o input external bus interface funciton output serial i/o output external bus interface funciton input serial i/o i/o external bus interface funciton input serial i/o output external bus interface funciton input external interrupt input timer x function i/o i/o format cmos compatible input level cmos 3-state output cmos compatible input level cmos 3-state output (power source is v cc e) cmos compatible input level cmos 3-state output cmos compatible input level cmos 3-state output (power source is vcce) cmos compatible input level cmos 3-state output diagram no. (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) (11) (12) (13) (14) note: 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 poten- tial, a current will flow from v cc to v ss through the input-stage gate.
hardware 1-14 38k0 group user s manual functional description fig. 10 port block diagram (1) ( 4 ) p o r t s p 3 0 p 3 2 ( 1 ) p o r t p 0 d a t a b u s p o r t l a t c h k e y - o n w a k e - u p i n p u t p u l l - u p c o n t r o l b i t ( 5 ) p o r t p 3 3 e x i n t o u t p u t ( 6 ) p o r t s p 3 4 , p 3 5 , p 3 6 , p 3 7 e x c s ( p 3 4 ) e x w r ( p 3 5 ) e x r d ( p 3 6 ) e x a 0 ( p 3 7 ) ( 2 ) p o r t p 1 analog input pin selection bit a - d c o n v e r s i o n i n p u t e x o e e x t e r n a l b u s i n t e r f a c e e n a b l e b i t o u t p u t b u f f e r i n p u t b u f f e r ( 3 ) p o r t p 2 d i r e c t i o n r e g i s t e r e x b d a t a o u t p u t e x b d a t a i n p u t v c c e v c c e v c c e v cc e d a t a b u s p o r t l a t c h d i r e c t i o n r e g i s t e r d a t a b u s p o r t l a t c h direction register d a t a b u sp o r t l a t c h d i r e c t i o n r e g i s t e r e x t e r n a l b u s i n t e r f a c e e n a b l e b i t port latch d a t a b u s d i r e c t i o n r e g i s t e r external bus interface enable bit e x t e r n a l b u s i n t e r f a c e e n a b l e b i t d a t a b u sp o r t l a t c h direction register
1-15 38k0 group user s manual hardware functional description fig. 11 port block diagram (2) e x d r e q o u t p u t s e r i a l i / o i n p u t e x d a c k s e r i a l i / o e n a b l e b i t e x t c serial i/o synchronous clock selection bit e x a 1 cntr 0 interrupt input pulse output mode int 0 (p5 0 ), int 1 (p5 2 ) interrupt input v cc e v c c e v cc e v c c e s r d y o u t p u t e n a b l e b i t ( 7 ) p o r t p 4 0 d i r e c t i o n r e g i s t e r direction register d i r e c t i o n r e g i s t e r direction register p o r t l a t c h port latch p o r t l a t c h p o r t l a t c h p o r t l a t c h port latch p o r t l a t c h p o r t l a t c h direction register d i r e c t i o n r e g i s t e r direction register d i r e c t i o n r e g i s t e r d a t a b u s d a t a b u s data bus data bus d a t a b u s data bus d a t a b u s d a t a b u s serial i/o output ( 8 ) p o r t p 4 1 (9) port p4 2 ( 1 0 ) p o r t p 4 3 (11) ports p5 0, p5 2 (12) port p5 1 (13) ports p5 3 p5 7 (14) port p6 serial i/o enable bit serial i/o enable bit s e r i a l i / o e n a b l e b i t e x t e r n a l b u s i n t e r f a c e e n a b l e b i t e x t e r n a l b u s i n t e r f a c e e n a b l e b i t e x t e r n a l b u s i n t e r f a c e e n a b l e b i t e x t e r n a l b u s i n t e r f a c e e n a b l e b i t external bus interface enable bit e x t e r n a l b u s i n t e r f a c e e n a b l e b i t e x t e r n a l b u s i n t e r f a c e e n a b l e b i t receive enable bit r e c e i v e e n a b l e b i t pull-up control bit serial i/o mode selection bit s e r i a l i / o m o d e s e l e c t i o n b i t timer output s e r i a l i / o s y n c h r o n o u s c l o c k s e l e c t i o n b i t s e r i a l i / o o u t p u t s e r i a l i / o e x t e r n a l c l o c k i n p u t serial i/o clock output serial i/o enable bit
hardware 1-16 38k0 group user s manual functional description fig. 12 structure of port i/o-related registers p 0 0 pu ll -up contro l bi t 0 : no pull-up 1 : pull-up p0 1 pull-up control bit 0 : no pull-up 1 : pull-up p0 2 pull-up control bit 0 : no pull-up 1 : pull-up p0 3 pull-up control bit 0 : no pull-up 1 : pull-up p0 4 pull-up control bit 0 : no pull-up 1 : pull-up p0 5 pull-up control bit 0 : no pull-up 1 : pull-up p0 6 pull-up control bit 0 : no pull-up 1 : pull-up p0 7 pull-up control bit 0 : no pull-up 1 : pull-up p ort p 0 pu ll -up contro l reg i ster (pull0 : address 0ff0 16 ) b 7 b 0 p 5 0 pu ll -up contro l bi t 0 : no pull-up 1 : pull-up nothing is arranged for this bit. this is a write disabled bit. when this bit is read out, the contents are 0 . p5 2 pull-up control bit 0 : no pull-up 1 : pull-up nothing is arranged for these bits. these are write disabled bits. when these bits are read out, the contents are 0 . p ort p 5 pu ll -up contro l reg i ster (pull5 : address 0ff2 16 ) b 7 b 0
1-17 38k0 group user s manual hardware functional description interrupt request generating conditions at reset at detection of usb bus reset signal (2.5 (note 4) at completion of serial i/o data reception at completion of serial i/o data transmission at detection of either rising or falling edge of cntr 0 input at falling of conjunction of input level for port p0 (at input mode) at completion of a-d conversion at brk instruction execution notes 1 : vector addresses contain interrupt jump destination addresses. 2 : reset function in the same way as an interrupt with the highest priority. 3 : nothing is arranged in these vector addresses. 4 : fix bit 1 of interrupt control register 2 (address 003f 16 ) to 0 . interrupts i nterrupts occur by fifteen sources: four external, ten internal, and one software. interrupt control each interrupt is controlled by an interrupt request bit, an interrupt enable bit, and the interrupt disable flag except for the software in- terrupt set by the brk instruction. an interrupt occurs if the corre- sponding interrupt request and enable bits are 1 and the inter- rupt disable flag is 0 . interrupt enable bits can be set or cleared by software. interrupt request bits can be cleared by software, but cannot be set by software. the brk instruction cannot be disabled with any flag or bit. the i flag disables all interrupts except the brk instruction interrupt. when several interrupts occur at the same time, the interrupts are received according to priority. interrupt operation by acceptance of an interrupt, the following operations are auto- matically performed: 1. the contents of the program counter and the processor status register are automatically pushed onto the stack. 2. the interrupt disable flag is set and the corresponding interrupt request bit is cleared. 3. the interrupt jump destination address is read from the vector table into the program counter. interrupt source reset (note 2) usb bus reset usb sof usb device external bus int 0 timer x timer 1 timer 2 int 1 (note 3) serial i/o reception serial i/o transmission cntr 0 key-on wake up a-d conversion brk instruction low fffc 16 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 high fffd 16 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 table 7 interrupt vector addresses and priority priority 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 vector addresses (note 1) notes on interrupts when setting the followings, the interrupt request bit may be set to 1 . when switching external interrupt active edge related register: interrupt edge selection register (address 0ff3 16 ), timer x mode register (address 0023 16 ) when not requiring for the interrupt occurrence synchronized with these setting, take the following sequence. ? 0 (disabled). ? ? 0 after 1 or more instructions have been executed. ? 1 (enabled).
hardware 1-18 38k0 group user? manual functional description fig. 13 interrupt control fig. 14 structure of interrupt-related registers 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 b 7 b 0 i n t e r r u p t e d g e s e l e c t i o n r e g i s t e r i n t 0 i n t e r r u p t e d g e s e l e c t i o n b i t n o t u s e d ( r e t u r n 0 w h e n r e a d ) i n t 1 i n t e r r u p t e d g e s e l e c t i o n b i t n o t u s e d ( r e t u r n 0 w h e n r e a d ) ( i n t e d g e : a d d r e s s 0 f f 3 1 6 ) i n t e r r u p t r e q u e s t r e g i s t e r 1 usb b us reset i nterrupt request bi t usb sof interrupt request bit usb device interrupt request bit exb interrupt request bit int 0 interrupt request bit timer x interrupt request bit timer 1 interrupt request bit timer 2 interrupt request bit 0 : n o i nterrupt request i ssue d 1 : interrupt request issued (ireq 1 : a dd ress 003 c 16 ) 0 : f a lli ng e d ge act i ve 1 : rising edge active b 7 b 0 i n t e r r u p t r e q u e s t r e g i s t e r 2 i n t 1 i n t e r r u p t r e q u e s t b i t n o t h i n g i s a r r a n g e d f o r t h i s b i t . t h i s i s a w r i t e d i s a b l e d b i t . w h e n t h i s b i t i s r e a d o u t , t h e c o n t e n t s a r e 0 . s e r i a l i / o r e c e i v e i n t e r r u p t r e q u e s t b i t s e r i a l i / o t r a n s m i t i n t e r r u p t r e q u e s t b i t c n t r 0 i n t e r r u p t r e q u e s t b i t k e y - o n w a k e - u p i n t e r r u p t r e q u e s t b i t a - d c o n v e r s i o n i n t e r r u p t r e q u e s t b i t n o t h i n g i s a r r a n g e d f o r t h i s b i t . t h i s i s a w r i t e d i s a b l e d b i t . w h e n t h i s b i t i s r e a d o u t , t h e c o n t e n t s a r e 0 . (ireq 2 : a dd ress 003 d 16 ) b 7 b 0 i nterrupt contro l reg i ster 1 (icon 1 : a dd ress 003 e 16 ) b 7 b 0 u s b b u s r e s e t i n t e r r u p t e n a b l e b i t u s b s o f i n t e r r u p t e n a b l e b i t u s b d e v i c e i n t e r r u p t e n a b l e b i t e x b i n t e r r u p t e n a b l e b i t i n t 0 i n t e r r u p t e n a b l e b i t t i m e r x i n t e r r u p t e n a b l e b i t t i m e r 1 i n t e r r u p t e n a b l e b i t t i m e r 2 i n t e r r u p t e n a b l e b i t ? 0 c a n b e s e t b y s o f t w a r e , b u t 1 c a n n o t b e s e t . ? 0 c a n b e s e t b y s o f t w a r e , b u t 1 c a n n o t b e s e t . i nterrupt contro l reg i ster 2 0 : i n t e r r u p t s d i s a b l e d 1 : i n t e r r u p t s e n a b l e d (icon 2 : a dd ress 003 f 16 ) b 7 b 0 i n t 1 i n t e r r u p t e n a b l e b i t f i x t h i s b i t t o 0 . s e r i a l i / o r e c e i v e i n t e r r u p t e n a b l e b i t s e r i a l i / o t r a n s m i t i n t e r r u p t e n a b l e b i t c n t r 0 i n t e r r u p t e n a b l e b i t k e y - o n w a k e - u p i n t e r r u p t e n a b l e b i t a - d c o n v e r s i o n i n t e r r u p t e n a b l e b i t f i x t h i s b i t t o 0 . 0 : i n t e r r u p t s d i s a b l e d 1 : i n t e r r u p t s e n a b l e d 0 : n o i nterrupt request i ssue d 1 : interrupt request issued
1-19 38k0 group user s manual hardware functional description key input interrupt (key-on wake up) a key-on wake up interrupt request is generated by applying a falling edge to any pin of port p0 that have been set to input mode. in other words, it is generated when and of input level goes from 1 to 0 . an example of using a key input interrupt is shown in figure 15, where an interrupt request is generated by pressing one of the keys consisted as an active-low key matrix which inputs to ports p0 0 p0 3 . fig. 15 connection example when using key input interrupt and port p0 block diagram ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 0 p o r t p 0 1 l a t c h port p0 1 direction register = 0 p o r t p 0 2 l a t c h port p0 2 direction register = 0 p o r t p 0 3 l a t c h p o r t p 0 3 d i r e c t i o n r e g i s t e r = 0 p o r t p 0 4 l a t c h p o r t p 0 4 d i r e c t i o n r e g i s t e r = 1 p o r t p 0 5 l a t c h port p0 5 direction register = 1 port p0 6 latch p o r t p 0 6 d i r e c t i o n r e g i s t e r = 1 p o r t p 0 7 l a t c h p o r t p 0 7 d i r e c t i o n r e g i s t e r = 1 p0 0 input p0 1 input p0 2 input p 0 3 i n p u t p 0 4 o u t p u t p 0 5 o u t p u t p0 6 output p0 7 output p u l l 0 r e g i s t e r b i t 7 = 0 port p0 input reading circuit port pxx l level output ? ? ? 0 p u l l 0 r e g i s t e r b i t 5 = 0 p u l l 0 r e g i s t e r b i t 4 = 0 p u l l 0 r e g i s t e r b i t 3 = 1 p u l l 0 r e g i s t e r b i t 2 = 1 pull 0 register bit 1 = 1 p u l l 0 r e g i s t e r b i t 0 = 1
hardware 1-20 38k0 group user s manual functional description timers the 38k0 group has three timers: timer x, timer 1, and timer 2. the division ratio of each timer or prescaler is given by 1/(n + 1), where n is the value in the corresponding timer or prescaler latch. all timers are down count timers. when the timer reaches 00 16 , an underflow occurs at the next count pulse and the correspond- ing timer latch is reloaded into the timer and the count is contin- ued. when a timer underflows, the interrupt request bit corre- sponding to that timer is set to 1 . fig. 16 structure of timer x mode register timer 1 and timer 2 the count source of prescaler 12 is the system clock divided by 16. the output of prescaler 12 is counted by timer 1 and timer 2, and a timer underflow periodically sets the interrupt request bit. timer x timer x can each select in one of four operating modes by setting the timer x mode register. (1) timer mode the timer counts the count source selected by timer count source selection bit. (2) pulse output mode the timer counts the system clock divided by 16. whenever the contents of the timer reach 00 16 , the signal output from the cntr 0 pin is inverted. if the cntr 0 active edge selection bit is 0 , output begins at h . if it is 1 , output starts at l . when using a timer in this mode, set the corresponding port p5 1 direction register to output mode. (3) event counter mode operation in event counter mode is the same as in timer mode, except that the timer counts signals input through the cntr 0 pin. when the cntr 0 active edge selection bit is 0 , the rising edge of the cntr 0 pin is counted. when the cntr 0 active edge selection bit is 1 , the falling edge of the cntr 0 pin is counted. (4) pulse width measurement mode if the cntr 0 active edge selection bit is 0 , the timer counts the system clock divided by 16 while the cntr 0 pin is at h . if the cntr 0 active edge selection bit is 1 , the timer counts it while the cntr 0 pin is at l . the count can be stopped by setting 1 to the timer x count stop bit in any mode. the corresponding interrupt request bit is set each time a timer underflows. t i m e r x m o d e r e g i s t e r ( t m : a d d r e s s 0 0 2 3 1 6 ) t i m e r x o p e r a t i n g m o d e b i t s b 1 b 0 00 : t i m e r m o d e 01 : p u l s e o u t p u t m o d e 10 : e v e n t c o u n t e r m o d e 11 : p u l s e w i d t h m e a s u r e m e n t m o d e c n t r 0 a c t i v e e d g e s w i t c h b i t 0 : f a l l i n g e d g e a c t i v e f o r c n t r 0 i n t e r r u p t c o u n t a t r i s i n g e d g e i n e v e n t c o u n t e r m o d e 1 : r i s i n g e d g e a c t i v e f o r c n t r 0 i n t e r r u p t c o u n t a t f a l l i n g e d g e i n e v e n t c o u n t e r m o d e t i m e r x 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 n o t u s e d ( r e t u r n 0 w h e n r e a d ) b 7 b 0
1-21 38k0 group user s manual hardware functional description fig. 17 timer block diagram q q 1 0 p 5 1 / c n t r 0 1 / 1 6 0 1 r t s y s t e m c l o c k 1/16 p r e s c a l e r x l a t c h ( 8 ) prescaler x (8) timer x latch (8) timer x (8) t i m e r x i n t e r r u p t r e q u e s t b i t toggle flip-flop t i m e r x c o u n t s t o p b i t p u l s e w i d t h m e a s u r e m e n t m o d e e v e n t c o u n t e r m o d e c n t r 0 i n t e r r u p t r e q u e s t b i t p u l s e o u t p u t m o d e port p5 1 latch port p5 1 direction register cntr 0 active edge selection bit t i m e r x l a t c h w r i t e p u l s e o u t p u t m o d e timer mode pulse output mode d a t a b u s d i v i d e r prescaler 12 latch (8) prescaler 12 (8) timer 1 latch (8) timer 1 (8) timer 2 latch (8) timer 2 (8) timer 2 interrupt request bit timer 1 interrupt request bit c n t r 0 a c t i v e e d g e s e l e c t i o n b i t d a t a b u s system clock divider
hardware 1-22 38k0 group user s manual functional description serial i/o serial i/o can be used as either clock synchronous or asynchro- nous (uart) serial i/o. a dedicated timer (baud rate generator) is also provided for baud rate generation. (1) clock synchronous serial i/o mode clock synchronous serial i/o mode can be selected by setting the mode selection bit of the serial i/o control register (bit 6 of ad- dress 0fe0 16 ) to 1 . for clock synchronous serial i/o, the transmitter and the receiver must use the same clock. if an internal clock is used, transfer is started by a write signal to the trancemit/receive buffer register. fig. 18 block diagram of clock synchronous serial i/o fig. 19 operation of clock synchronous serial i/o function p 4 2 / e x t c / s c l k p 4 3 / e x a 1 / s r d y p 4 0 / e x d r e q / r x d s y s t e m c l o c k 1/4 1 / 4 f / f serial i/o status registe r s e r i a l i / o c o n t r o l r e g i s t e r r e c e i v e b u f f e r r e g i s t e r a d d r e s s 0 0 2 6 1 6 r e c e i v e s h i f t r e g i s t e r r e c e i v e b u f f e r f u l l f l a g ( r b f ) r ece i ve i nterrupt request (ri) clock control circuit s h i f t c l o c k s e r i a l i / o s y n c h r o n o u s c l o c k s e l e c t i o n b i t f r e q u e n c y d i v i s i o n r a t i o 1 / ( n + 1 ) b a u d r a t e g e n e r a t o r add ress 0 fe 2 16 b r g c o u n t s o u r c e s e l e c t i o n b i t clock control circuit f a l l i n g - e d g e d e t e c t o r d ata b us add ress 0026 16 shif t c l oc k t r a n s m i t s h i f t r e g i s t e r s h i f t c o m p l e t i o n f l a g ( t s c ) t ransm i t b u ff er empty fl ag (tbe) t r a n s m i t i n t e r r u p t r e q u e s t ( t i ) t ransm i t i nterrupt source se l ect i on bi t add ress 0027 16 d ata b us a d d r e s s 0 f e 0 1 6 transmit buffer register transmit shift register p 4 1 / e x dack / t x d r e c e i v e e n a b l e s i g n a l s r d y d 7 d 0 d 1 d 2 d 3 d 4 d 5 d 6 r b f = 1 t s c = 1 t b e = 0 t b e = 1 t s c = 0 t rans f er s hif t c l oc k (1/2 to 1/2048 of the internal clock, or an external clock) s er i a l output t x d s e r i a l i n p u t r x d w r i t e s i g n a l t o r e c e i v e / t r a n s m i t b u f f e r r e g i s t e r ( a d d r e s s 0 0 2 6 1 6 ) o verrun error (oe) detection n o t e s 1 : t h e t r a n s m i t i n t e r r u p t ( t i ) c a n b e g e n e r a t e d e i t h e r w h e n t h e t r a n s m i t b u f f e r r e g i s t e r h a s e m p t i e d ( t b e = 1 ) o r a f t e r t h e t r a n s m i t s h i f t o p e r a t i o n h a s e n d e d ( t s c = 1 ) , b y s e t t i n g t h e t r a n s m i t i n t e r r u p t s o u r c e s e l e c t i o n b i t ( t i c ) o f t h e s e r i a l i / o 1 c o n t r o l r e g i s t e r . 2 : i f d a t a i s w r i t t e n t o t h e t r a n s m i t b u f f e r r e g i s t e r w h e n t s c = 0 , t h e t r a n s m i t c l o c k i s g e n e r a t e d c o n t i n u o u s l y a n d s e r i a l d a t a i s o u t p u t c o n t i n u o u s l y f r o m t h e t x d p i n . 3 : t h e r e c e i v e i n t e r r u p t ( r i ) i s s e t w h e n t h e r e c e i v e b u f f e r f u l l f l a g ( r b f ) b e c o m e s 1 . d 7 d 0 d 1 d 2 d 3 d 4 d 5 d 6
1-23 38k0 group user s manual hardware functional description (2) asynchronous serial i/o (uart) mode clock asynchronous serial i/o mode (uart) can be selected by setting the serial i/o mode selection bit of the serial i/o control register to 0 . eight serial data transfer formats can be selected, and the transfer formats used by a transmitter and receiver must be identical. the transmit and receive shift registers each have a buffer regis- ter, but the two buffers have the same address in memory. since the shift register cannot be written to or read from directly, transmit data is written to the transmit buffer, and receive data is read from the receive buffer. the transmit buffer 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. fig. 20 block diagram of uart serial i/o fig. 21 operation of uart serial i/o function s ystem c l oc k 1 / 4 o e p e f e 1/16 1 / 1 6 d a t a b u s r e c e i v e b u f f e r r e g i s t e r a d d r e s s 0 0 2 6 1 6 r ece i ve s hif t reg i ster r ece i ve b u ff er f u ll fl ag (rbf) r ece i ve i nterrupt request (ri) b au d rate generator f r e q u e n c y d i v i s i o n r a t i o 1 / ( n + 1 ) a d d r e s s 0 f e 2 1 6 s t / s p / p a g e n e r a t o r transmit buffer register d ata b us t ransm i t s hif t reg i ster add ress 0026 16 t r a n s m i t s h i f t r e g i s t e r s h i f t c o m p l e t i o n f l a g ( t s c ) t r a n s m i t b u f f e r e m p t y f l a g ( t b e ) t r a n s m i t i n t e r r u p t r e q u e s t ( t i ) add ress 0027 16 std etector s p d e t e c t o r uart contro l reg i ster a d d r e s s 0 f e 1 1 6 c h a r a c t e r l e n g t h s e l e c t i o n b i t add ress 0 fe 0 16 brg count source se l ect i on bit t ransm i t i nterrupt source se l ect i on bit s er i a l i / o sync h ronous c l oc k se l ect i on bi t cl oc k contro l c i rcu i t c h a r a c t e r l e n g t h s e l e c t i o n b i t 7 b i t s 8 b i t s s e r i a l i / o 1 c o n t r o l r e g i s t e r p 4 2 / e x tc / s cl k s e r i a l i / o s t a t u s r e g i s t e r p 4 0 / e x dreq / r x d p 4 1 / e x dack / t x d tsc =0 tbe=1 rbf =0 tbe =0 t b e = 0 r b f = 1 r b f = 1 s t d 0 d 1 s p d 0 d 1 s t sp tbe =1 t s c = 1 ? ? 1 : e r r o r f l a g d e t e c t i o n o c c u r s a t t h e s a m e t i m e t h a t t h e r b f f l a g b e c o m e s 1 ( a t 1 s t s t o p b i t , d u r i n g r e c e p t i o n ) . 2 : t h e t r a n s m i t i n t e r r u p t ( t i ) c a n b e g e n e r a t e d t o o c c u r w h e n e i t h e r t h e t b e o r t s c f l a g b e c o m e s 1 , d e p e n d i n g o n t h e s e t t i n g o f t h e t r a n s m i t i n t e r r u p t s o u r c e s e l e c t i o n b i t ( t i c ) o f t h e s e r i a l i / o 1 c o n t r o l r e g i s t e r . 3 : t h e r e c e i v e i n t e r r u p t ( r i ) i s s e t w h e n t h e r b f f l a g b e c o m e s 1 . 4 : a f t e r d a t a i s w r i t t e n t o t h e t r a n s m i t b u f f e r r e g i s t e r w h e n t s c = 1 , 0 . 5 t o 1 . 5 c y c l e s o f t h e d a t a s h i f t c y c l e i s n e c e s s a r y u n t i l c h a n g i n g t o t s c = 0 . n o t e s s e r i a l o u t p u t t x d s e r i a l i n p u t r x d r ece i ve b u ff er rea d s i gna l t r a n s m i t o r r e c e i v e c l o c k
hardware 1-24 38k0 group user s manual functional description [serial i/o control register (siocon)] 0fe0 16 the serial i/o control register contains eight control bits for the se- rial i/o function. [uart control register (uartcon)] 0fe1 16 the uart control register consists of four control bits (bits 0 to 3) which are valid when asynchronous serial i/o is selected and set the data format of an data transfer. [serial i/o status register (siosts)] 0027 16 the read-only serial i/o status register consists of seven flags (bits 0 to 6) which indicate the operating status of the serial i/o function and various errors. three of the flags (bits 4 to 6) are valid only in uart mode. the receive buffer full flag (bit 1) is cleared to 0 when the receive buffer is read. 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. a write to the serial i/o status register clears all the error flags oe, pe, fe, and se (bit 3 to bit 6, respectively). writing 0 to the serial i/o enable bit sioe (bit 7 of the serial i/o control register) also clears all the status flags, including the error flags. all bits of the serial i/o status register are initialized to 0 at reset, but if the transmit enable bit (bit 4) of the serial i/o control register has been set to 1 , the transmit shift register shift completion flag (bit 2) and the transmit buffer empty flag (bit 0) become 1 . [transmit buffer/receive buffer register (tb/ rb)] 0026 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 character bit length is 7 bits, the msb of data stored in the receive buffer regis- ter is 0 . [baud rate generator (brg)] 0fe2 16 the baud rate generator determines the baud rate for serial 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. notes on serial i/o when setting the transmit enable bit to 1 , the serial i/o transmit interrupt request bit is automatically set to 1 . when not requiring the interrupt occurrence synchronized with the transmission enalbed, take the following sequence. ? 0 (disabled). ? 1 . ? 0 after 1 or more instructions have been executed. ? 1 (enabled).
1-25 38k0 group user s manual hardware functional description fig. 22 structure of serial i/o control registers b r g c o u n t s o u r c e s e l e c t i o n b i t ( c s s ) 0 : s y s t e m c l o c k 1 : s y s t e m c l o c k / 4 s e r i a l i / o s y n c h r o n o u s c l o c k s e l e c t i o n b i t ( s c s ) 0 : b r g o u t p u t d i v i d e d b y 4 w h e n c l o c k s y n c h r o n o u s s e r i a l i / o i s s e l e c t e d . b r g o u t p u t d i v i d e d b y 1 6 w h e n u a r t i s s e l e c t e d . 1 : e x t e r n a l c l o c k i n p u t w h e n c l o c k s y n c h r o n o u s s e r i a l i / o i s s e l e c t e d . e x t e r n a l c l o c k i n p u t d i v i d e d b y 1 6 w h e n u a r t i s s e l e c t e d . s r d y o u t p u t e n a b l e b i t ( s r d y ) 0 : p 4 3 p i n o p e r a t e s a s o r d i n a r y i / o p i n 1 : p 4 3 p i n o p e r a t e s a s s r d y o u t p u t p i n t r a n s m i t i n t e r r u p t s o u r c e s e l e c t i o n b i t ( t i c ) 0 : i n t e r r u p t w h e n t r a n s m i t b u f f e r h a s e m p t i e d 1 : i n t e r r u p t w h e n t r a n s m i t s h i f t o p e r a t i o n i s c o m p l e t e d t r a n s m i t e n a b l e b i t ( t e ) 0 : t r a n s m i t d i s a b l e d 1 : t r a n s m i t e n a b l e d r e c e i v e e n a b l e b i t ( r e ) 0 : r e c e i v e d i s a b l e d 1 : r e c e i v e e n a b l e d s e r i a l i / o m o d e s e l e c t i o n b i t ( s i o m ) 0 : a s y n c h r o n o u s s e r i a l i / o ( u a r t ) 1 : c l o c k s y n c h r o n o u s s e r i a l i / o s e r i a l i / o e n a b l e b i t ( s i o e ) 0 : s e r i a l i / o d i s a b l e d ( p i n s p 4 0 p 4 3 o p e r a t e a s o r d i n a r y i / o p i n s ) 1 : s e r i a l i / o e n a b l e d ( p i n s p 4 0 p 4 3 c a n o p e r a t e a s s e r i a l i / o p i n s ) s e r i a l i / o c o n t r o l r e g i s t e r ( s i o c o n : a d d r e s s 0 f e 0 1 6 ) b7 b0 t r a n s m i t b u f f e r e m p t y f l a g ( t b e ) 0 : b u f f e r f u l l 1 : b u f f e r e m p t y r e c e i v e b u f f e r f u l l f l a g ( r b f ) 0 : b u f f e r e m p t y 1 : b u f f e r f u l l t r a n s m i t s h i f t r e g i s t e r s h i f t c o m p l e t i o n f l a g ( t s c ) 0 : t r a n s m i t s h i f t i n p r o g r e s s 1 : t r a n s m i t s h i f t c o m p l e t e d o v e r r u n e r r o r f l a g ( o e ) 0 : n o e r r o r 1 : o v e r r u n e r r o r p a r i t y e r r o r f l a g ( p e ) 0 : n o e r r o r 1 : p a r i t y e r r o r f r a m i n g e r r o r f l a g ( f e ) 0 : n o e r r o r 1 : f r a m i n g e r r o r s u m m i n g e r r o r f l a g ( s e ) 0 : ( o e ) u ( p e ) u ( f e ) = 0 1 : ( o e ) u ( p e ) u ( f e ) = 1 n o t u s e d ( r e t u r n s 1 w h e n r e a d ) s e r i a l i / o s t a t u s r e g i s t e r ( s i o s t s : a d d r e s s 0 0 2 7 1 6 ) b 7b 0 u a r t c o n t r o l r e g i s t e r ( u a r t c o n : a d d r e s s 0 f e 1 1 6 ) c h a r a c t e r l e n g t h s e l e c t i o n b i t ( c h a s ) 0 : 8 b i t s 1 : 7 b i t s p a r i t y e n a b l e b i t ( p a r e ) 0 : p a r i t y c h e c k i n g d i s a b l e d 1 : p a r i t y c h e c k i n g e n a b l e d p a r i t y s e l e c t i o n b i t ( p a r s ) 0 : e v e n p a r i t y 1 : o d d p a r i t y s t o p b i t l e n g t h s e l e c t i o n b i t ( s t p s ) 0 : 1 s t o p b i t 1 : 2 s t o p b i t s n o t u s e d ( r e t u r n 0 w h e n r e a d ) ( t h i s i s a w r i t e d i s a b l e d b i t . ) n o t u s e d ( r e t u r n 1 w h e n r e a d ) b 7b 0
hardware 1-26 38k0 group user s manual functional description usb function 38k0 group is equipped with a usb function control circuit (usbfcc) that enables effective interfacing with the host-pc. this circuit is in compliance with usb2.0 s full-speed transfer mode (12 mbps, equivalent to usb1.1). this circuit also supports all four transfer-types specified in the standard usb specification. the usbfcc has four endpoints that can select its transfer type. although endpoint 0 is fixed to control transfer, the endpoints 1 to 3 can be set to interrupt transfer, bulk transfer, or isochronous transfer. a dedicated circuit automatically performs stage management for control transfer and packet management for transactions, which are necessary for matching of data transmit/receive timing, error detection, and retry after error. this dedicated control circuit en- ables the user to develop a program or timing design very easily. each endpoint can be programmed for data transfer conditions so that the endpoints are adaptive for all usb device class transfer systems. the data buffer of each endpoint can be assigned to any area in the multi-channel ram. this feature offers highly efficient memory usage by avoiding re-buffering and enabling simple data modifica- tion. the transmit/receive data is directly transferred to the data buffer via the control circuit (direct ram access type) without disturbing the cpu operation. this mechanism enables the cpu to transfer data smoothly with no drop in performance. in addition to this buffer function, a double-buffer setting will keep a re-buffering stall at a minimum and increase the overall data throughput (max. 64 bytes x 2 channels). as other special signals control, the endpoints have detection functions for the usb bus reset signal, resume signal, suspend signal, and sof signal, and also have a remote wake-up signal transmit function. when completing data transfer or receiving a special signal, the endpoint generates the corresponding interrupt to the cpu (3 vec- tors/18 factors). with all this essential yet comprehensive built-in hardware, your system using the 38k0 group will be ready for any usb applica- tion that comes its way. usb data transfer the usb specification promises 12 mbps data transfer in the full- speed mode, that is equivalent to 1.5 m bytes per second of data transactions. however, in usb data transfer, bit-stuffing may be executed de- pending on the bit patterns of the transfer data, possibly resulting in 1-byte data (normally 8 bits) handled as up to 10 bits. because usb uses asynchronous transfers, the clock cycle of the usb internal reference clock may change to adjust to the clock phase. therefore, the access timing of the usbfcc for the multi- channel ram will change owing to the frequency of internal clock fig. 23 usb function overview interrupt request data transmit/receive path [direct ram access type] 38k0 group mcu usb bus (usb-host) external mcu cpu program rom usb multi-channel ram built-in peripheral functions external bus interface (exb)
1-27 38k0 group user s manual hardware functional description usb function control circuit (usbfcc) block diagram the following diagram shows the usbfcc block diagram. the cir- cuit comprises: (1) serial interface engine (sie) (2) device control unit (dcu) (3) internal memory interface (mif) (4) cpu interface (cif) fig. 24 usb function control circuit (usbfcc) block diagram (1) serial interface engine (sie) the sie performs the following usb lower-layer protocols (pack- ets, transactions): sampling of receive data and clock, generation of transmit clock serial-to-parallel conversion of transmit/receive data nrzi (non return zero invert) encode/decode bit stuffing/unstuffing sync (synchronization pattern) detection, eop (end of packet) detection usb address detection, endpoint detection crc (cyclic redundancy check) generation and checking (2) device control unit (dcu) the dcu manages the following usb upper-layer protocols (ad- dress/endpoint and control-transfer sequence): status control for each endpoint control-transfer sequence control memory interface status control (3) memory interface (mif) the mif controls the flow of data transfer between the sie and the multi-channel ram under the management of the dcu. (4) cpu interface (cif) the cif performs the following functions: mode setting via registers, dcu control signal generation, dcu status signal reading interrupt signal generation internal bus interface control. c p u c i f u s b f u n c t i o n c o n t r o l c i r c u i t d c u m i f s i e d c u c o n t r o l d c u s t a t u s mif control sie control sie status transmit/receive data u s b t r a n s c e i v e r d 0 + d 0 - multi-channel ram
hardware 1-28 38k0 group user s manual functional description usb port external circuit configuration the operation mode of the usb port driver circuit can be config- ured by usb control register (address 0010 16 ). figure 25 and figure 26 show the usb port external circuit block diagram. 1 0 usb reference voltage circuit pll uclkcon v refe v refcon dv cc full speed + - usbe usbe usb module x out f vco troncon trone usbvref tron d0+ d0- 2.2 ? ? ? fig. 25 usb port external circuit (d0+, d0-, usbv ref , tron) block diagram (4.0v v cc 5.25v) fig. 26 usb port external circuit (d0+, d0-, usbv ref , tron) block diagram (3.0v v cc 4.0v) 1 0 pll uclkcon full speed + - usbe usbe usb module x out f vco troncon trone usbvref tron d0+ d0- 27 ? ? ? (note) note: in vcc = 3.0 v to 3.6 v connect this pin to vcc.
1-29 38k0 group user s manual hardware functional description endpoint buffer area setting the buffer area used in data transfer can be assigned to any area of the multi-channel ram for each endpoint. buffer area beginning address the buffer area configuration register (address 0fed 16 ) defines the beginning address of the buffer area (every 32 bytes) for each endpoint. however, the only ram area is configurable. 00h [address 0000 16 ], 01h [address 0020 16 ]: not configurable 02h [address 0040 16 ] to 1fh [address 03e0 16 ]: configurable interrupt-source dependant buffer area offset address an offset value is added to the beginning address of each source, which is specified by the interrupt source register (address 001d 16 ), for each endpoint. this section describes in detail the beginning address specified by the buffer area set register as offset address 00h, according to each endpoint. (1) endpoint 00 endpoint 00 has two kinds of interrupt sources for accessing the buffer. the respective address offsets are: bsrdy00 (setup buffer ready interrupt): offset address = 00h brdy00 (out or in buffer ready interrupt): offset address = 08h (2) endpoint 01 the buffer area offset address for each interrupt source for of end- point 01 varies according to the contents of the ep01 set register (address 0019 16 ). in single buffer mode (dblb01 = 0 ): endpoint 01 has only one interrupt source for accessing the buffer. b0rdy01 (buffer 0 ready interrupt): offset address = 00h in double buffer mode (dblb01 = 1 ): endpoint 01 has two kinds of interrupt sources for accessing the buffer. b0rdy01 (buffer 0 ready interrupt): offset address = 00h b1rdy01 (buffer 1 ready interrupt): the offset address varies according to the double buffer begin- ning address set bit (bsiz01). -offset address = 08h when bsiz01 = 00 -offset address = 10h when bsiz01 = 01 -offset address = 40h when bsiz01 = 10 -offset address = 80h when bsiz01 = 11 (3) endpoints 02 and 03 same as endpoint 01. notes the selected ram area must be within addresses 0040 16 to 03ff 16 . make sure the buffer area beginning address is set in agreement with the offset address and the number of transmit/receive data bytes. this is particularly important when in the double buffer mode or when handling 64-byte data. fig. 27 example setting of buffer area beginning address fig. 28 examples of interrupt source dependant buffer area offset address 0fed 16 = 15h 0000 16 0020 16 0040 16 0060 16 02a0 16 03e0 16 memory sfr ram 00 01 02 03 15 1f 0fed 16 disabled to be used 0000 0000 0010 1010 (a) when selecting endpoint 00 memory 02a0 16 02a8 16 offset 00 h 08 h bsrdy00 brdy00 02a0 16 00 h b0rdy01 02a0 16 0320 16 00 h 80 h b0rdy01 b1rdy01 memory offset (b) when selecting single buffer mode memory offset (c) when selecting double buffer mode (when bsiz01 = 11)
hardware 1-30 38k0 group user s manual functional description usb interrupt function usb interrupt control circuit (usbintcon) has 3 requests and 16 usb-device interrupt request sources. each interrupt source register enables the user to easily determine which interrupt has occurred. table 8 shows the list of usb interrupt sources. table 8 usb interrupt sources interrupt request bit (ireq1: address 003c 16 ) usb bus reset usb interrupt bit (usbireq: address 0017 16 ) interrupt source at usb bus reset signal detection: after enabling the usb module (usbe = 1 ), an interrupt request occurs when 2.5 1 ), an interrupt request occurs when sof packet is detected in d0+/d0- port. its occurrence does not depend on frame-time or crc value after sof packet is transferred. (normally, sof packet detection occurs only when f usb = 48 mhz) at endpoint 00 data transfer complete: buffer ready (read/write enabled state) control transfer completed status stage transition setup buffer ready (read enabled state) control transfer error at endpoint 01 data transfer complete: buffer 0 ready (read/write enabled state) buffer 1 ready (read/write enabled state) transfer error at endpoint 02 data transfer complete: buffer 0 ready (read/write enabled state) buffer 1 ready (read/write enabled state) transfer error at endpoint 03 data transfer complete: buffer 0 ready (read/write enabled state) buffer 1 ready (read/write enabled state) transfer error at suspend signal detection: after enabling the usb module (usbe = 1 ), an interrupt request occurs when 3 ms j state is detected in d0+/d0- port. (equivalent to 144,000 clock-length when f usb = 48mhz) at resume signal detection: after enabling the usb module (usbe = 1 ) and resume interrupt (rsme = 1 ), an interrupt request occurs when a bus state change (j state to se0 or k state) is detected in d0- port. usb sof usb device ep00 ep01 ep02 ep03 sus rsm
1-31 38k0 group user s manual hardware functional description fig. 29 usb device interrupt control [epxxreg5] [ep00req] brdy00 ep00 [usbireq] ep00e [usbicon] [ep01req] b0rdy01 ep01 ep01e usb device interrupt request [ep02req] ep02 ep02e [ep03req] ep03 ep03e sus suse rsm rsme ctend00 ctsts00 bsydy00 err00 b1rdy01 err01 b0rdy02 b1rdy02 err02 b0rdy03 b1rdy03 err03
hardware 1-32 38k0 group user? manual functional description usb register list the usb register list is shown below. 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 0fec 16 0fed 16 usb control register usb function enable register usb function address register frame number register low frame number register high usb interrupt source enable register usb interrupt source register endpoint index register endpoint field register 1 endpoint field register 2 endpoint field register 3 endpoint field register 4 endpoint field register 5 endpoint field register 6 endpoint field register 7 endpoint field register 8 endpoint field register 9 usbcon usbae usba0 fnuml fnumh usbicon usbireq usbindex epxxreg1 epxxreg2 epxxreg3 epxxreg4 epxxreg5 epxxreg6 epxxreg7 epxxreg8 epxxreg9 usbe uclkcon usbdife vrefe vrefcon trone troncon wkup symbol address register name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 ad0e usbadd0[6:0] fnum[7:0] fnum[10:8] rsme suse ep03e ep02e ep01e ep00e rsm sus ep03 ep02 ep01 ep00 0019 16 001a 16 001b 16 001c 16 001d 16 001e 16 001f 16 0fec 16 0fed 16 (1) endpoint 00 (2) endpoint 01 (3) endpoint 02 (4) endpoint 03 ep00stg ep00con1 ep00con2 ep00con3 ep00req ep00byt ep00buf setup00 ep00 stage register ep00 control register 1 ep00 control register 2 ep00 control register 3 ep00 interrupt source register ep00 byte number register ep00 buffer area set register bval00 ctende00 err00 bsrdy00 ctsts00 ctend00 brdy00 bbyt00[3:0] 0019 16 001a 16 001b 16 001c 16 001d 16 001e 16 001f 16 0fec 16 0fed 16 ep01 set register ep01 control register 1 ep01 control register 2 ep01 control register 3 ep01 interrupt source register ep01 byte number register 0 ep01 byte number register 1 ep01 max. packet size register ep01 buffer area set register ep01cfg ep01con1 ep01con2 ep01con3 ep01req ep01byt0 ep01byt1 ep01max ep01buf typ01[1:0] dir01 itmd01 sqcl01 dblb01 bsiz01[1:0] b0val01 b1val01 err01 b1rdy01 b0rdy01 b0byt01[6:0] b1byt01[6:0] mxps01[6:0] 0019 16 001a 16 001b 16 001c 16 001d 16 001e 16 001f 16 0fec 16 0fed 16 ep02cfg ep02con1 ep02con2 ep02con3 ep02req ep02byt0 ep02byt1 ep02max ep02buf typ02[1:0] dir02 itmd02 sqcl02 dblb02 bsiz02[1:0] b0val02 b1val02 err02 b1rdy02 b0rdy02 b0byt02[6:0] b1byt02[6:0] mxps02[6:0] 0019 16 001a 16 001b 16 001c 16 001d 16 001e 16 001f 16 0fec 16 0fed 16 ep03 set register ep03 control register 1 ep03 control register 2 ep03 control register 3 ep03 interrupt source register ep03 byte number register 0 ep03 byte number register 1 ep03 max. packet size register ep03 buffer area set register ep02 set register ep02 control register 1 ep02 control register 2 ep02 control register 3 ep02 interrupt source register ep02 byte number register 0 ep02 byte number register 1 ep02 max. packet size register ep02 buffer area set register ep03cfg ep03con1 ep03con2 ep03con3 ep03req ep03byt0 ep03byt1 ep03max ep03buf typ03[1:0] dir03 itmd03 sqcl03 dblb03 bsiz03[1:0] b0val03 b1val03 err03 b1rdy03 b0rdy03 b0byt03[6:0] b1byt03[6:0] mxps03[6:0] : not used usb sfr pid00[1:0] badd02[4:0] badd01[4:0] pid01[1:0] pid02[1:0] badd03[4:0] pid03[1:0] epidx[1:0] badd00[4:0] fig. 30 usb related registers
1-33 38k0 group user s manual hardware functional description usb related registers the usb related registers are shown below. b7 at reset w function bit name bit symbol b0 remote wakeup bit tron output control bit tron output enable bit usb reference voltage control bit usb reference voltage enable bit usb difference input enable bit usb clock select bit usb module operation enable bit wkup troncon trone vrefcon vrefe usbdife uclkcon usbe o o o o o o o o o o o o o o o o 0 0 0 0 0 0 0 0 usb control register ( usbcon) [address 0010 16 ] : state remainin g 0 : returning to bus idle state by writing 1 first and then 0 . (remote wakeup signal) 1 : k-state output 0 : l output mode (valid in trone = 1 ) 1 : h output mode (valid in trone = 1 ) 0 : tron port output disabled (hi-z state) 1 : tron port output enabled 0 : normal mode (valid in vrefe = 1 ) 1 : low current mode (valid in vrefe = 1 ) 0 : usb reference voltage circuit operation disabled 1 : usb reference voltage circuit operation enabled 0 : upstream-port difference input circuit operation disabled 1 : upstream--port difference input circuit operation enabled 0 : external oscillating clock f(x in ) 1 : pll circuit output clock f vco 0 : usb module reset 1 : usb module operation enabled h/w s/w r fig. 31 structure of usb control register fig. 32 structure of usb function enable register b7 bit name bit symbol b0 usb function enable bit not used ad0e b7:b1 0 usb function enable register (usbae) [address 0011 16 ] 0: usb function address register invalidated 1: usb function address register validated write 0 when writing. 0 is read when reading. at reset function h/w s/w o o o o : state remaining 0000000 w r
hardware 1-34 38k0 group user s manual functional description fig. 33 structure of usb function address register b7 b0 usb function address bit not used usbadd0 [6:0] b7 0 0 usb function address register ( usba0) [address 0012 16 ] bit name bit symbol at reset function h/w s/w o o o o : state remaining in ad0e = 0 , this value changes after writing. in ad0e = 1 , this value changes after completion of set_address control transferring. write 0 when writing. 0 is read when reading. 0 w r fig. 34 structure of frame number register low b7 b0 frame number low bit fnum [7:0] in- definite in- definite frame number register low ( fnuml) [address 0014 16 ] the frame number is updated at sof reception. bit name bit symbol at reset function h/w s/w o ? fig. 35 structure of frame number register high b7 b0 fnum [10:8] b7:b3 frame number register high ( fnumh) [address 0015 16 ] in- definite in- definite bit name bit symbol at reset function h/w s/w o o frame number high bit not used the frame number is updated at sof reception. write 0 when writing. 0 is read when reading. ? : state remaining 00000 w r
1-35 38k0 group user s manual hardware functional description b7 b0 ep00e ep01e ep02e ep03e b5:b4 suse rsme 0 0 0 0 0 0 0 0 0 0 0 0 usb interrupt source enable register ( usbicon) [address 0016 16 ] 0 : interrupt disabled 1 : interrupt enabled 0 : interrupt disabled 1 : interrupt enabled 0 : interrupt disabled 1 : interrupt enabled 0 : interrupt disabled 1 : interrupt enabled write 0 when writing. 0 is read when reading. 0 : interrupt disabled 1 : interrupt enabled 0 : interrupt disabled 1 : interrupt enabled bit name bit symbol at reset function h/w s/w o o o o o o o o o o o o o o usb function/endpoint 0 interrupt enable bit usb function/endpoint 1 interrupt enable bit usb function/endpoint 2 interrupt enable bit usb function/endpoint 3 interrupt enable bit not used suspend interrupt enable bit resume interrupt enable bit w r 00 : state remaining fig. 36 structure of usb interrupt source enable register
hardware 1-36 38k0 group user s manual functional description b7 b0 usb function/endpoint 0 interrupt bit usb function/endpoint 1 interrupt bit usb function/endpoint 2 interrupt bit usb function/endpoint 3 interrupt bit not used suspend interrupt bit resume interrupt bit ep00 ep01 ep02 ep03 b5:b4 sus rsm 0 0 0 0 0 0 0 0 0 0 0 0 usb interrupt source register ( usbireq) [address 0017 16 ] bit name bit symbol at reset function h/w s/w o o o o o o o ? ? ? ? ? 1 when any one of ep00 interrupt source register s bits at least is set to 1 . this bit is cleared to 0 by clearing ep00 interrupt source register to 00 16 . writing to this bit causes no state change. this bit is set to 1 when any one of ep01 interrupt source register s bits at least is set to 1 . this bit is cleared to 0 by clearing ep01 interrupt source register to 00 16 . writing to this bit causes no state change. this bit is set to 1 when any one of ep02 interrupt source register s bits at least is set to 1 . this bit is cleared to 0 by clearing ep02 interrupt source register to 00 16 . writing to this bit causes no state change. this bit is set to 1 when any one of ep03 interrupt source register s bits at least is set to 1 . this bit is cleared to 0 by clearing ep03 interrupt source register to 00 16 . writing to this bit causes no state change. write 0 when writing. 0 is read when reading. 0 : no interrupt request issued 1 : interrupt request issued this bit is set to 1 when detecting 3 ms or more of j- state, using usb clock (f usb ) at 48 mhz. 0 can be set by software, but 1 cannot be set. this bit is set to 1 when the usb bus state changes from j-state to k-state or se0 in the resume interrupt enable bit = 1 . it is also 1 in the condition of internal clock stopped. this bit is cleared to 0 by clearing the resume interrupt enable bit. writing to this bit causes no state change. w r 00 : state remaining fig.37 structure of usb interrupt source register b7 b0 endpoint index bit not used epidx [1:0] b7:b3 0 endpoint index register ( usbindex) [address 0018 16 ] b1 b0 0 0 : endpoint 0 0 1 : endpoint 1 1 0 : endpoint 2 1 1 : endpoint 3 write 0 when writing. 0 is read when reading. bit name bit symbol at reset function o o o o : state remaining h/w s/w 000000 w r fig. 38 structure of endpoint index register
1-37 38k0 group user s manual hardware functional description (1) endpoint 00 b7 b0 setup packet detection bit not used setup00 b7:b1 1 1 ep00 stage register ( ep00stg) [address 0019 16 ] bit name bit symbol at reset function h/w s/w this bit is set to 1 at reception of setup packet. writing 0 to this bit clears this bit if the next setup token does not occur. writing 1 to this bit causes no state change of the status flags. write 0 when writing. 0 is read when reading. o o o o : state remaining 000 0 000 w r fig. 39 structure of ep00 stage register fig. 40 structure of ep00 control register 1 b7 b0 response pid bit not used pid00 [1:0] b7:b2 0 ep00 control register 1 ( ep00con1) [address 001a 16 ] bit name bit symbol at reset function h/w s/w b1 b0 0 0 : nak 0 1 : automatic response (ack, nak, data0, data1) 1 x : stall at occurrence of control transfer error: b1 is set to 1 by the hardware. at reception of setup token: b1 and b0 are cleared to 0 by the hardware. write 0 when writing. 0 is read when reading. o o o o : state remaining 000000 w r b7 b0 buffer enable bit not used bval00 b7:b1 0 ep00 control register 2 ( ep00con2) [address 001b 16 ] bit name bit symbol at reset function h/w s/w 0 : nak transmission (sie is disabled to read a buffer.) 1 : transmitting/receiving data set state (sie is possible to read from/write to a buffer.) at reception of setup token: this bit is cleared to 0 by the hardware. write 0 when writing. 0 is read when reading. o o o o : state remaining 000 0 0 0 0 w r fig. 41 structure of ep00 control register 2
hardware 1-38 38k0 group user s manual functional description fig. 42 structure of ep00 control register 3 b7 b0 control transfer completion enable bit not used ctende00 b7:b1 0 ep00 control register 3 ( ep00con3) [address 001c 16 ] 0 : nak transmission in the status stage 1 : control transfer completion enabled (sie transmits null/ack.) (valid in pid00 = 01 2 ) at reception of setup token: this bit is cleared to 0 by the hardware. write 0 when writing. 0 is read when reading. o o o o : state remaining bit name bit symbol at reset function h/w s/w 000 0 0 0 0 w r b7 b0 usb function/endpoint 0 buffer ready interrupt bit usb function/endpoint 0 control transfer completion interrupt bit usb function/endpoint 0 status stage transition interrupt bit usb function/endpoint 0 setup buffer ready interrupt bit usb function/endpoint 0 error interrupt bit not used brdy00 ctend00 ctsts00 bsrdy00 err00 b7:b5 0 0 0 0 0 0 0 0 0 0 ep00 interrupt source register (ep00req) [address 001d 16 ] bit name bit symbol at reset function h/w s/w o o o o o o o o o o o o 0: no interrupt request issued 1: interrupt request issued this bit is set to 1 when the buffer is ready state (enabled to be read/written) on usb function/endpoint 0. 0 can be set by software, but 1 cannot be set. 0: no interrupt request issued 1: interrupt request issued this bit is set to 1 when control transfer is completed (null/ack transmission in the status stage) on usb function/endpoint 0. 0 can be set by software, but 1 cannot be set. 0: no interrupt request issued 1: interrupt request issued this bit is set to 1 when transition to status stage occurs in ctende00 = 0 (control transfer completion disabled) on usb function/endpoint 0. 0 can be set by software, but 1 cannot be set. at transfer of control write: when receiving in-token in data stage (out) at transfer of control read: when receiving out-token in data stage (in) at no data transfer: nothing occurs. 0: no interrupt request issued 1: interrupt request issued this bit is set to 1 when the exclusive buffer for setup is ready state (enabled to be read) on usb function/endpoint 0. 0 can be set by software, but 1 cannot be set. 0: no interrupt request issued 1: interrupt request issued this bit is set to 1 when control transfer error occurs on usb function/endpoint 0. this bit is cleared to 0 by the hardware when receiving setup token. 0 can be set by software, but 1 cannot be set. write 0 when writing. 0 is read when reading. : state remaining 000 w r fig. 43 structure of ep00 interrupt source register
1-39 38k0 group user s manual hardware functional description b7 b0 bbyt00 [3:0] b7:b4 0 ep00 byte number register ( ep00byt) [address 001e 16 ] out : the received byte number is automatically set. in : set the transmitting byte number. write 0 when writing. 0 is read when reading. bit name bit symbol at reset function h/w s/w o o o o transmit/receive byte number bit not used : state remaining 0000 w r fig. 44 structure of ep00 byte number register b7 b0 ep00 beginning address set bit not used badd00 [4:0] b7:b5 0 ep00 buffer area set register ( ep00buf) [address 0fed 16 ] bit name bit symbol at reset function h/w s/w set the beginning address of ep00 s buffer area. (32-byte unit) b4b3b2b1b0 0 0 0 1 0 : 0040 16 0 0 0 1 1 : 0060 16 .............. 1 1 1 1 0 : 03c0 16 1 1 1 1 1 : 03e0 16 write 0 when writing. 0 is read when reading. o o o o : state remaining 000 w r fig. 45 structure of ep00 buffer area set register
hardware 1-40 38k0 group user s manual functional description (2) endpoint 01 fig. 46 structure of ep01 set register fig. 47 structure of ep01 control register 1 b7 b0 double buffer beginning address set bit buffer mode select bit sequence toggle bit clear bit interrupt toggle mode select bit transfer direction bit transfer type bite bsiz01 [1:0] dblb01 sqcl01 itmd01 dir01 typ01 [1:0] 0 0 0 0 0 0 ep01 set register ( ep01cfg) [address 0019 16 ] bit name bit symbol at reset function h/w s/w in double buffer mode set the beginning address of buffer 1 area, using a relative value for the beginning address of buffer 0. b1b0 0 0 = 8 bytes 0 1 = 16 bytes 1 0 = 64 bytes 1 1 = 128 bytes 0 : single buffer mode 1 : double buffer mode 0 : toggle bit clear disabled 1 : writing 1 clears the toggle bit and data0 is used as the next data pid. 0 is always read when reading. 0 : normal mode 1 : contin uous toggle mode (valid at interrupt in transfer) 0 : out (data is received from the host.) 1 : in (data is transmitted to the host.) b7b6 0 0 : transfer disabled 0 1 : bulk transfer 1 0 : interrupt transfer 1 1 : isochronous transfer o o o o o o o o o o o o : state remaining w r b7 b0 response pid bit not used pid01 [1:0] b7:b2 0 ep01 control register 1 ( ep01con1) [address 001a 16 ] bit name bit symbol at reset function h/w s/w b1 b0 0 0 : nak 0 1 : automatic response (ack, nak, data0, data1) 1 x : stall at occurrence of over-max. packet size : b1 is set to 1 by the hardware. write 0 when writing. 0 is read when reading. o o o o : state remaining 000000 w r
1-41 38k0 group user s manual hardware functional description fig. 49 structure of ep01 control register 3 fig. 50 structure of ep01 interrupt source register b7 b0 b0val01 b7:b1 0 ep01 control register 2 ( ep01con2) [address 001b 16 ] bit name bit symbol at reset function h/w s/w o o o o : state remaining buffer 0 enable bit not used when the selected endpoint is in, writing 1 to this bit makes the transmitting data a set state (sie is possible to read). when the selected endpoint is out, writing 1 to this bit makes data reception possible (sie is possible to write). write 0 when writing. 0 is read when reading. 00 0 00 0 0 w r fig. 48 structure of ep01 control register 2 b7 b0 b1val01 b7:b1 0 ep01 control register 3 ( ep01con3) [address 001c 16 ] bit name bit symbol at reset function h/w s/w o o o o : state remaining buffer 1 enable bit not used when the selected endpoint is in, writing 1 to this bit makes the transmitting data a set state (sie is possible to read). when the selected endpoint is out, writing 1 to this bit makes data reception possible (sie is possible to write). in double buffer mode this bit is valid. write 0 when writing. 0 is read when reading. 0000000 w r b7 b0 b0rdy01 b1rdy01 err01 b7:b3 0 0 0 0 0 0 ep01 interrupt source register (ep01req) [address 001d 16 ] bit name bit symbol at reset function h/w s/w o o o o o o o o usb function/endpoint 1 buffer 0 ready interrupt bit usb function/endpoint 1 buffer 1 ready interrupt bit usb function/endpoint 1 error interrupt bit not used 0: no interrupt request issued 1: interrupt request issued this bit is set to 1 when the buffer 0 is ready state (enabled to be read/written) on usb function/endpoint 1. 0 can be set by software, but 1 cannot be set. 0: no interrupt request issued 1: interrupt request issued in single buffer mode this bit is invalid. this bit is set to 1 when the buffer 1 is ready state (enabled to be read/written) on usb function/endpoint 1 in double buffer mode. 0 can be set by software, but 1 cannot be set. 0: no interrupt request issued 1: interrupt request issued this bit is set to 1 when stall response occurs on usb function/endpoint 1. 0 can be set by software, but 1 cannot be set. write 0 when writing. 0 is read when reading. 00000 w r
hardware 1-42 38k0 group user s manual functional description fig. 51 structure of ep01 byte number register 0 b7 b0 b0byt01 [6:0] b7 0 0 ep01 byte number register 0 ( ep01byt0) [address 001e 16 ] bit name bit symbol at reset function h/w s/w in : transmit byte number bit out : receive byte number bit not used : state remaining single buffer mode: set the transmitting byte number. double buffer mode : set the transmitting byte number of buffer 0. single buffer mode : the received byte number is automatically set. double buffer mode : the received byte number of buffer 0 is automatically set. write 0 when writing. 0 is read when reading. o o o o ? 0 0 ep01 byte number register 1 ( ep01byt1) [address 001f 16 ] bit name bit symbol at reset function h/w s/w in : transmit byte number bit out : receive byte number bit not used : state remaining single buffer mode: these bits are invalid. double buffer mode : set the transmitting byte number of buffer 1. single buffer mode: these bits are invalid. double buffer mode : the received byte number of buffer 1 is automatically set. write 0 when writing. 0 is read when reading. o o o o ? fig. 52 structure of ep01 byte number register 1 b7 b0 mxps01 [6:0] b7 ep01 max. packet size register (ep01max) [address 0fec 16 ] 0 bit name bit symbol at reset function h/w s/w : state remaining o o o o max. packet size bit not used in : these bits are invalid. out : set the maximum packet size. write 0 when writing. 0 is read when reading. 0 w r fig. 53 structure of ep01 max. packet size register
1-43 38k0 group user s manual hardware functional description b7 b0 ep01 beginning address set bit not used badd01 [4:0] b7:b5 0 ep01 buffer area set register ( ep01buf) [address 0fed 16 ] bit name bit symbol at reset function h/w s/w set the beginning address of ep01 s buffer area. (32-byte unit) b4b3b2b1b0 0 0 0 1 0 : 0040 16 0 0 0 1 1 : 0060 16 .............. 1 1 1 1 0 : 03c0 16 1 1 1 1 1 : 03e0 16 write 0 when writing. 0 is read when reading. o o o o : state remaining 000 w r fig. 54 structure of ep01 buffer area set register
hardware 1-44 38k0 group user s manual functional description (3) endpoint 02 fig. 55 structure of ep02 set register fig. 56 structure of ep02 control register 1 b7 b0 double buffer beginning address set bit buffer mode select bit sequence toggle bit clear bit interrupt toggle mode select bit transfer direction bit transfer type bite bsiz02 [1:0] dblb02 sqcl02 itmd02 dir02 typ02 [1:0] 0 0 0 0 0 0 ep02 set register ( ep02cfg) [address 0019 16 ] bit name bit symbol at reset function h/w s/w in double buffer mode set the beginning address of buffer 1 area, using a relative value for the beginning address of buffer 0. b1b0 0 0 = 8 bytes 0 1 = 16 bytes 1 0 = 64 bytes 1 1 = 128 bytes 0 : single buffer mode 1 : double buffer mode 0 : toggle bit clear disabled 1 : writing 1 clears the toggle bit and data0 is used as the next data pid. 0 is always read when reading. 0 : normal mode 1 : contin uous toggle mode (valid at interrupt in transfer) 0 : out (data is received from the host.) 1 : in (data is transmitted to the host.) b7b6 0 0 : transfer disabled 0 1 : bulk transfer 1 0 : interrupt transfer 1 1 : isochronous transfer o o o o o o o o o o o o : state remaining w r b7 b0 response pid bit not used pid02 [1: 0] b7:b2 0 ep02 control register 1 ( ep02con1) [address 001a 16 ] bit name bit symbol at reset function h/w s/w b1 b0 0 0 : nak 0 1 : automatic response (ack, nak, data0, data1) 1 x : stall at occurrence of over-max. packet size : b1 is set to 1 by the hardware. write 0 when writing. 0 is read when reading. o o o o : state remaining 00 0 0 00 w r
1-45 38k0 group user s manual hardware functional description b7 b0 b0val02 b7:b1 0 ep02 control register 2 ( ep02con2) [address 001b 16 ] bit name bit symbol at reset function h/w s/w o o o o : state remaining buffer 0 enable bit not used when the selected endpoint is in, writing 1 to this bit makes the transmitting data a set state (sie is possible to read). when the selected endpoint is out, writing 1 to this bit makes data reception possible (sie is possible to write). write 0 when writing. 0 is read when reading. 00 0 00 0 0 w r fig. 57 structure of ep02 control register 2 b7 b0 b1val02 b7:b1 0 ep02 control register 3 ( ep02con3) [address 001c 16 ] bit name bit symbol at reset function h/w s/w o o o o : state remaining buffer 1 enable bit not used when the selected endpoint is in, writing 1 to this bit makes the transmitting data a set state (sie is possible to read). when the selected endpoint is out, writing 1 to this bit makes data reception possible (sie is possible to write). in double buffer mode this bit is valid. write 0 when writing. 0 is read when reading. 00 0 00 0 0 w r fig. 58 structure of ep02 control register 3 fig. 59 structure of ep02 interrupt source register b7 b0 b0rdy02 b1rdy02 err02 b7 to b3 0 0 0 0 0 0 ep02 interrupt source register (ep02req) [address 001d 16 ] bit name bit symbol at reset function h/w s/w o o o o o o o o usb function/endpoint 2 buffer 0 ready interrupt bit usb function/endpoint 2 buffer 1 ready interrupt bit usb function/endpoint 2 error interrupt bit not used 0 : no interrupt request issued 1 : interrupt request issued this bit is set to 1 when the buffer 0 is ready state (enabled to be read/written) on usb function/endpoint 2. 0 can be set by software, but 1 cannot be set. 0 : no interrupt request issued 1 : interrupt request issued in single buffer mode this bit is invalid. this bit is set to 1 when the buffer 1 is ready state (enabled to be read/written) on usb function/endpoint 2 in double buffer mode. 0 can be set by software, but 1 cannot be set. 0 : no interrupt request issued 1 : interrupt request issued this bit is set to 1 when stall response occurs on usb function/endpoint 2. 0 can be set by software, but 1 cannot be set. write 0 when writing. 0 is read when reading. 00 0 00 w r
hardware 1-46 38k0 group user s manual functional description fig. 60 structure of ep02 byte number register 0 b7 b0 b0byt02 [6:0] b7 0 0 ep02 byte number register 0 ( ep02byt0) [address 001e 16 ] bit name bit symbol at reset function h/w s/w in : transmit byte number bit out : receive byte number bit not used : state remaining single buffer mode: set the transmitting byte number. double buffer mode : set the transmitting byte number of buffer 0. single buffer mode: the received byte number is automatically set. double buffer mode : the received byte number of buffer 0 is automatically set. write 0 when writing. 0 is read when reading. o o o o ? 0 0 ep02 byte number register 1 ( ep02byt1) [address 001f 16 ] bit name bit symbol at reset function h/w s/w in : transmit byte number bit out : receive byte number bit not used : state remaining single buffer mode: these bits are invalid. double buffer mode : set the transmitting byte number of buffer 1. single buffer mode: these bits are invalid. double buffer mode : the received byte number of buffer 1 is automatically set. write 0 when writing. 0 is read when reading. o o o o ? fig. 61 structure of ep02 byte number register 1 b7 b0 mxps02 [6:0] b7 ep02 max. packet size register (ep02max) [address 0fec 16 ] 0 bit name bit symbol at reset function h/w s/w : state remaining o o o o max. packet size bit not used in : these bits are invalid. out : set the maximum packet size. write 0 when writing. 0 is read when reading. 0 w r fig. 62 structure of ep02 max. packet size register
1-47 38k0 group user s manual hardware functional description b7 b0 ep02 beginning address set bit not used badd02 [4:0] b7:b5 0 ep02 buffer area set register ( ep02buf) [address 0fed 16 ] bit name bit symbol at reset function h/w s/w set the beginning address of ep02 s buffer area. (32-byte unit) b4b3b2b1b0 0 0 0 1 0 : 0040 16 0 0 0 1 1 : 0060 16 .............. 1 1 1 1 0 : 03c0 16 1 1 1 1 1 : 03e0 16 write 0 when writing. 0 is read when reading. o o o o : state remaining 000 w r fig. 63 structure of ep02 buffer area set register
hardware 1-48 38k0 group user s manual functional description (4) endpoint 03 fig. 64 structure of ep03 set register fig. 65 structure of ep03 control register 1 b7 b0 double buffer beginning address set bit buffer mode select bit sequence toggle bit clear bit interrupt toggle mode select bit transfer direction bit transfer type bit bsiz03 [1:0] dblb03 sqcl03 itmd03 dir03 typ03 [1:0] 0 0 0 0 0 0 ep03 set register ( ep03cfg) [address 0019 16 ] bit name bit symbol at reset function h/w s/w in double buffer mode set the beginning address of buffer 1 area, using a relative value for the beginning address of buffer 0. b1b0 0 0 = 8 bytes 0 1 = 16 bytes 1 0 = 64 bytes 1 1 = 128 bytes 0 : single buffer mode 1 : double buffer mode 0 : toggle bit clear disabled 1 : writing 1 clears the toggle bit and data0 is used as the next data pid. 0 is always read when reading. 0 : normal mode 1 : contin uous toggle mode (valid at interrupt in transfer) 0 : out (data is received from the host.) 1 : in (data is transmitted to the host.) b7b6 0 0 : transfer disabled 0 1 : bulk transfer 1 0 : interrupt transfer 1 1 : isochronous transfer o o o o o o o o o o o o : state remaining w r b7 b0 response pid bit not used pid03 [1:0] b7:b2 0 ep03 control register 1 ( ep03con1) [address 001a 16 ] bit name bit symbol at reset function h/w s/w b1 b0 0 0 : nak 0 1 : automatic response (ack, nak, data0, data1) 1 x : stall at occurrence of over-max. packet size : b1 is set to 1 by the hardware. write 0 when writing. 0 is read when reading. o o o o : state remaining 000000 w r
1-49 38k0 group user s manual hardware functional description fig. 66 structure of ep03 control register 2 b7 b0 b0val03 b7:b1 0 ep03 control register 2 ( ep03con2) [address 001b 16 ] bit name bit symbol at reset function h/w s/w o o o o : state remaining buffer 0 enable bit not used when the selected endpoint is in, writing 1 to this bit makes the transmitting data a set state (sie is possible to read). when the selected endpoint is out, writing 1 to this bit makes data reception possible (sie is possible to write). write 0 when writing. 0 is read when reading. 00 0 00 0 0 w r b7 b0 b1val03 b7:b1 0 ep03 control register 3 ( ep03con3) [address 001c 16 ] bit name bit symbol at reset function h/w s/w o o o o : state remaining buffer 1 enable bit not used when the selected endpoint is in, writing 1 to this bit makes the transmitting data a set state (sie is possible to read). when the selected endpoint is out, writing 1 to this bit makes data reception possible (sie is possible to write). in double buffer mode this bit is valid. write 0 when writing. 0 is read when reading. 0000000 w r fig. 67 structure of ep03 control register 3 b7 b0 b0rdy03 b1rdy03 err03 b7:b3 0 0 0 0 0 0 ep03 interrupt source register (ep03req) [address 001d 16 ] bit name bit symbol at reset function h/w s/w o o o o o o o o usb function/endpoint 3 buffer 0 ready interrupt bit usb function/endpoint 3 buffer 1 ready interrupt bit usb function/endpoint 3 error interrupt bit not used 0 : no interrupt request issued 1 : interrupt request issued this bit is set to 1 when the buffer 0 is ready state (enabled to be read/written) on usb function/endpoint 3. 0 can be set by software, but 1 cannot be set. 0 : no interrupt request issued 1 : interrupt request issued in single buffer mode this bit is invalid. this bit is set to 1 when the buffer 1 is ready state (enabled to be read/written) on usb function/endpoint 3 in double buffer mode. 0 can be set by software, but 1 cannot be set. 0 : no interrupt request issued 1 : interrupt request issued this bit is set to 1 when stall response occurs on usb function/endpoint 3. 0 can be set by software, but 1 cannot be set. write 0 when writing. 0 is read when reading. 00000 w r fig. 68 structure of ep03 interrupt source register
hardware 1-50 38k0 group user s manual functional description fig. 69 structure of ep03 byte number register 0 fig. 71 structure of ep03 max. packet size register b7 b0 b1byt03 [6:0] b7 0 0 ep03 byte number register 1 ( ep03byt1) [address 001f 16 ] bit name bit symbol at reset function h/w s/w in : transmit byte number bit out : receive byte number bit not used : state remaining single buffer mode: these bits are invalid. double buffer mode : set the transmitting byte number of buffer 1. single buffer mode: these bits are invalid. double buffer mode : the received byte number of buffer 1 is automatically set. write 0 when writing. 0 is read when reading. o o o o ? 0 0 ep03 byte number register 0 ( ep03byt0) [address 001e 16 ] bit name bit symbol at reset function h/w s/w in : transmit byte number bit out : receive byte number bit not used : state remaining single buffer mode: set the transmitting byte number. double buffer mode : set the transmitting byte number of buffer 0. single buffer mode: the received byte number is automatically set. double buffer mode : the received byte number of buffer 0 is automatically set. write 0 when writing. 0 is read when reading. o o o o ? fig. 70 structure of ep03 byte number register 1 b7 b0 mxps03 [6:0] b7 ep03 max. packet size register (ep03max) [address 0fec 16 ] 0 bit name bit symbol at reset function h/w s/w : state remaining o o o o max. packet size bit not used in : these bits are invalid. out : set the maximum packet size. write 0 when writing. 0 is read when reading. 0 w r
1-51 38k0 group user s manual hardware functional description b7 b0 ep03 beginning address set bit not used badd03 [4:0] b7:b5 0 ep03 buffer area set register ( ep03buf) [address 0fed 16 ] bit name bit symbol at reset function h/w s/w set the beginning address of ep03 s buffer area. (32-byte unit) b4b3b2b1b0 0 0 0 1 0 : 0040 16 0 0 0 1 1 : 0060 16 .............. 1 1 1 1 0 : 03c0 16 1 1 1 1 1 : 03e0 16 write 0 when writing. 0 is read when reading. o o o o : state remaining 000 w r fig. 72 structure of ep03 buffer area set register
hardware 1-52 38k0 group user s manual functional description external bus interface (exb) the external bus interface (exb) controls the data transfer be- tween the external mcu and the 38k0 group s cpu or its cpu channel it is a data transfer course by the interrupt processing between the external mcu and the 38k0 group s cpu. memory channel it is a data transfer course by direct ram access of the memory channel controller between the external mcu and the 38k0 group s memory (multichannel ram) cpu channel [interrupt type] memory channel [direct ram access type] 38k0 group usb bus (usb host) external mcu cpu program rom peripheral functions external bus interface (exb) usb multichannel ram fig. 73 external bus interface address cs, rd, wr, dma acknowledge access cycle time from externals: 3 clocks or more of 5 clocks or more of fig. 74 data transfer timing of memory channel memory (multichannel ram). the external bus interface is shown below. data transfer of memory channel when the burst mode is selected with the burst bit of the memory channel operation mode register, data transfer can be carried out at the highest speed. after the external bus interface detects a rise of external read signal/write signal and synchronizes it with the in- ternal clock
1-53 38k0 group user s manual hardware functional description exb pin assignment the external bus interface (exb) pins are shown bellow. the 38k0 group can transmit/receive a data to/from an external mcu, using the following signals: control input signal ................ 4 (excs, exa0, exrd, exwr) data input/output pin .............. 8 (dq 0 to dq 7 ) interrupt output signal ............ 1 (exint) additionally, the dma interface signal and the buffer status read select signal of 38k0 group can be set up per one by the program. control input signal ................ 3 (extc, exdack, exrd, exa1) interrupt output signal ............ 1 (exdreq) external chip select external address external read external write external data external interrupt dma request terminal count dma acknowledge status read select external pins cpu multichannel ram external bus interface (exb) 38k0 group p3 4 /excs [ l ] p3 7 /exa0 [address] p3 6 /exrd [ l ] p3 5 /exwr [ l ] p1 0 /dq 0 /an 0 p1 7 /dq 7 /an 7 [data] p3 3 /exint [ l ] p4 0 /exdreq/rxd [ l ] p4 2 /extc/s clk [ l ] p4 1 /exdack/txd [ l ] p4 3 /exa 1 /s rdy [ h ] 8 : functions as normal ports just after reset. fig. 75 external bus interface (exb) pin assignment
hardware 1-54 38k0 group user s manual functional description exb block diagram the block diagram of external bus interface (exb) is shown below. the external bus interface (exb) consists of: (1) external i/o interface part (2) cpu interface part (3) internal memory interface part (4) transmit/receive data buffer part external i/o interface cpu interface index register external i/o configuration register exb interrupt source enable register cch_wr external mcu bus cch_rd p3 4 /excs cpu channel txb_rdy controller rxb_rdy p3 7 /exa0 p3 6 /exrd memory channel control memory channel operation mode register memory channel transmit buffer control transmit buffer register receive buffer register memory channel controller end address register memory address counter memory channel status p3 5 /exwr mch_rd mch_wr mch_tc p4 1 /exdack/txd mrx_enb p4 2 /extc/s clk mtx_enb p4 3 /exa1/s rdy memory address request acknowledge memory read data memory write data p3 3 /exint mch_req p4 0 /exdreq/rxd fifo_stt mrdsel stt_sel buf_wr transmit/receive data buffer exoe p1 0 /dq 0 /an 0 p1 7 /dq 7 /an 7 multichannel ram command decoder output selector decoder data selector configuration signal internal memory interface : functions as normal ports just after reset. fig. 76 block diagram of external bus interface (exb)
1-55 38k0 group user s manual hardware functional description (1) external i/o interface part the external i/o interface part consists of a command decoder and an output selector. a command decoder generates the follow- ing signals to each unit. cpu interface part cpu channel read (cch_rd) cpu channel write (cch_wr) internal memory interface part memory channel read (mch_rd) memory channel write (mch_wr) memory channel terminal count (mch_tc) transmit/receive data buffer part buffer write (buf_wr) external i/o interface part status selection (stt_sel) output enable (exoe) access to the cpu channel can be controlled only by setup of external signals. access to the memory channel can be controlled by the value of the external i/o configuration register and the state (mrx_enb, mtx_enb signals) of the internal memory interface part. the output selector has the function which selects from the state of cpu channel (txb_rdy and rxd_rdy) and the state of memory channel (mch_req) as the signal assigned to p3 3 / exint pin and p4 0 /exdreq/rxd pin. (2) cpu interface part the cpu interface part consists of the decoder/data selector of the cpu channel, the cpu write register and cpu channel con- troller decoder/data selector of cpu channel a write operation to the cpu register is performed by generating a write signal for each register with an address decode signal and a write signal. a read operation from the cpu register is performed by generat- ing an output enable signal of the internal data bus with an module select signal and a read signal and generating a select signal for each register with an address decode signal. cpu write register there are three cpu write registers as follows: exb interrupt source enable register index register external i/o configuration register the exb interrupt source register is a read-only register. a status signal of the cpu channel controller and a status signal of the memory channel controller in the internal memory interface part are generated. cpu channel controller the cpu channel controller generates the following signals, using bits 0 and 1 (rxb_enb, txb_enb) of exb interrupt source en- able register. memory channel transmitting buffer control signal (mrd_sel), generated in the internal memory interface part cpu channel command signal (cch_rd, cch_wr), generated in the external i/o interface part signals rxb_rdy/rxb_full and txb_rdy/txb_empty, gener- ated with read/write signals from the cpu channel
hardware 1-56 38k0 group user s manual functional description (3) internal memory interface part the internal memory interface part consists of the cpu register and the memory channel controller. cpu register the cpu register consists of the follows: memory channel operation mode register memory address counter end address register the cpu can set the beginning address into the memory address counter when the memory channel operation enable bit (mc_enb) of exb interrupt source enable register is 0 . when this bit is 1 , the write operation from the cpu is invalid and each access from the external bus causes count-up operation. memory channel controller the cpu register consists of the follows: main sequencer internal memory request signal generating circuit external memory channel request signal generating circuit address end detection circuit terminal end input processing circuit (4) transmit/receive data buffer part the transmit/receive data buffer part consists of the 8-bit transmit buffer register (txbuf) and the 8-bit receive buffer register (rxbuf). both cpu channel and memory channel use the same transmit buffer register/receive buffer register to transfer a data to an exter- nal mcu bus. (5) external pin the external bus interface has the following pins to connect with an external mcu bus. chip select ........................... p3 4 /excs address ................................ p3 7 /exa0 data ...................................... p1 0 /dq 0 /an 0 to p1 7 /dq 7 /an 7 read .................................... p3 6 /exrd write ..................................... p3 5 /exwr interrupt request .................. p3 3 /exint it also has the following pins to connect with an external dmac. each pin can be programmed for an ordinary port function or a dma interface pin function. dma request ........................ p4 0 /exdreq/rxd dma acknowledgment ......... p4 1 /exdack/txd terminal count ..................... p4 2 /extc/s clk it also has the status read select pin (p4 3 /exa1/s rdy pin) to con- firm a ready status of the data buffer from an external mcu bus this pin functions as a port just after reset. the status read select function can be set by a program. status read select ................ p4 3 /exa1/s rdy cpu channel: communication with 38k0 group cpu when a read/write operation is performed from an external mcu bus in address signal exa0 = h , the interrupt is generated and the 38k0 group cpu can confirm its access. the 38k0 group cpu judges the interrupt source and it starts a data transmission/recep- tion with an external mcu bus. memory channel: communication with 38k0 group memory multichannel ram when a read/write operation is performed from an external mcu bus in address signal exa0 = l , access to the multichannel ram is performed. then an address of the multichannel ram is made by the external bus interface and it is increased at each access completion. consequently, fifo access is performed. even if a read/write operation is performed in dack = l instead of excs = l and exa0 = l , fifo access to the multichannel ram is performed. the beginning address and the end address must be set by the cpu in advance.
1-57 38k0 group user s manual hardware functional description p3 3 /exint pin any one of the following signals for this pin can be selected: txb_rdy (transmit buffer ready) output rxb_rdy (receive buffer ready) output mch_req (memory channel request) output either txb_rdy or rxb_rdy is normally selected. the memory channel request is for an access request signal to the memory channel. in a small system, a data transfer processing to the internal memory is performed in the interrupt routine. according to that situation, the 38k0 group has the function automatically to switch an interrupt factor attached on the interrupt pin by program. p4 0 /exdreq/rxd pin this pin is a port at the initial state. which signal can be set by program. rxb_rdy (receive buffer ready) output mch_req (memory channel request) output mch_req of dmac is normally selected. the output method of the memory channel request signal depends on the burst bit (burst) of memory channel operation mode register. when the burst bit is 0 , this signal is periodically output at each 1-byte transfer. (see figures 94 and 97.) when the burst bit is 1 , this signal is continuously output while the memory address counter is counting from the beginning ad- dress to the end address (see figures 95 and 98.) p4 1 /exdack/txd pin this pin is a port at the initial state. the dma acknowledge signal can be set by program. the dma acknowledge signal dack = l is the same state as that of cs = l and a0 = l . access to multichannel ram is started by a rise of read signal or write signal which is set during this term. note : if the dma acknowledge signal and the chip select signal are simultaneously active (dack = l and cs = l ), also set the address signal a0 to l . if a0 is h , the memory channel and the cpu channel are activated simultaneously and it might cause some error. p4 2 /extc/s clk pin this pin is a port at the initial state. the terminal count signal can be set by program. if the terminal count signal is set at one bus cycle while a memory channel operation write is being performed, the 38k0 group con- firms that its bus cycle is the write cycle of the last data and sets the memory channel status bits to 11 2 , and the interrupt is gener- ated and the memory channel operation ends even if the memory address counter has not reached the end address. the cpu can obtain the last address where the data is written by reading out the value of memory address counter. (see figure 96.)
hardware 1-58 38k0 group user s manual functional description exb register list the exb register list is shown below. fig. 77 exb related registers (1) exb interrupt source enable register this register enables/disables access from an external bus and an internal interrupt. ?xb interrupt source register this register indicates the state of cpu channel s transmit/receive buffer register and the memory channel. the same value can be read out from the external mcu bus by using the buffer status read select signal (a1 pin = h ). ?xb index register/register windows 1, 2 the accessible register is switched by treating addresses 0034 16 and 0035 16 as a register window depending on the value of exb index register at address 0033 16 . external i/o configuration register this register selects the function of each pin. transmit/receive buffer register this register consists of the receive buffer register (rxbuf) and the transmit buffer register (txbuf) memory channel operation mode register this register sets the operation mode of the memory channel. memory address counter this is a counter to set the beginning address which fifo ac- cesses. this register is increased by access from the external mcu bus. end address register this register is to set the end address which fifo accesses. mc_enb txb_enb rxb_emb mc_sts[1:0] txb_empty rxb_full index[2:0] 0 : 0 fixed : not used low_win[7:0] high_win[7:0] exb sfr symbol bit7 bit6 bit5 bit4 bit3 00000 bit2 bit1 bit0 exbicon exbireq exbindex exbreg1 exbreg2 0030 16 0031 16 0033 16 0034 16 0035 16 exb interrupt source enable register exb interrupt source register register window 1 (low) register window 2 (high) exb index register address register name index bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 00 16 low low a1_ctr int_ctr[2:0] exb_ctr high high tc_ctr dak_ctr[1:0] drq_ctr[1:0] 01 16 low at cpu read : rxbuf[7:0] at cpu write : txbuf[7:0] high 02 16 low burst mc_dir[1:0] high 03 16 low im_a[7:0] high 00000 im_a[10:8] 04 16 low end_a[7:0] high 00000 end_a[10:8] external i/o configu- ration register transmit/receive buffer register memory channel ope- ration mode register memory address counter end address register exb sfr register name symbol exbcfgl exbcfgh rxbuf/txbuf mchmod memadl memadh endadl endadh 0 : 0 fixed : not used fig. 78 exb related registers (2)
1-59 38k0 group user s manual hardware functional description exb related registers the exb related registers are shown below. b7 b0 cpu channel receive enable bit cpu channel transmit enable bit memory channel operation enable bit not used rxb_enb txb_enb mc_enb b7:b3 0 0 0 e xb interrupt source enable register ( exbicon) [address 0030 16 ] ( note ) 00 000 bit name bit symbol at reset function h/w s/w 0 : operation disabled (interrupt disabled) 1 : operation enabled (receive buffer full interrupt enabled) 0 : operation disabled (interrupt disabled) 1 : operation enabled (transmit buffer empty interrupt enabled) 0 : operation disabled (memory channel operation end interrupt disabled) 1 : operation enabled (memory channel operation end interrupt disabled) write 0 when writing. 0 is read when reading. o o o o o o o o : state remaining w r note: do not set each bit simultaneously. fig. 79 structure of exb interrupt source enable register b7 b0 rxb_full txb_empty mc_sts [1:0] ( note 2 ) b7:b4 0000 0 0 0 0 (note 3) 0 (note 4) 0 e xb interrupt source register ( exbireq) [address 0031 16 ] ( note 1 ) bit name bit symbol at reset function h/w s/w o o o o o : state remaining receive buffer full bit transmit buffer empty bit memory channel status bits not used 0 : receive buffer empty 1 : receive buffer full 0 : transmit buffer full 1 : transmit buffer empty b3b2 0 0 : memory channel operation stopped 0 1 : memory channel being operating; no external access 1 0 : memory channel being operating; external accessing 1 1 : memory channel operation end; memory channel operation end interrupt generated write 0 when writing. 0 is read when reading. notes 1 : when the the exa1 pin control bit of external i/o configuration register is 1 , the external mcu bus can read this register contents by setting the exa1 pin to h . 2 : the memory channel status bits indicate the status of memory channel. in mc_enb = 0 these bits are always 00 2 . when the memory channel operation ends, these bits are set to 11 2 and the memory channel operation end interrupt is generated. these bits can be read out during operation, so that it will show that whether the external mcu bus is accessing or not. 3 : this bit is cleared to 0 when reading the transmit/receive buffer register in the cpu channel receive enable bit = 1 or when the cpu channel receive enable bit is 0 . 4 : this bit is cleared to 0 when writing to the transmit/receive buffer register in the cpu channel transmit enable bit = 1 or when the cpu channel transmit enable bit is 0 . w r fig. 80 structure of exb interrupt source register
hardware 1-60 38k0 group user s manual functional description b7 b0 index [2:0] b7:b3 0 exb index register (exbindex) [address 0033 16 ] 00000 bit name bit symbol at reset function h/w s/w o o o o index bits not used the accessible register, using the register window, depends on these index bits contents as follows: b2b1b0 0 0 0 : external i/o configuration register 0 0 1 : transmit/receive buffer register 0 1 0 : memory channel operation mode register 0 1 1 : memory address counter 1 0 0 : end address register 1 0 1 : do not set. 1 1 0 : do not set. 1 1 1 : do not set. write 0 when writing. 0 is read when reading. : state remaining w r fig. 81 structure of exb index register b7 b0 low_win [7:0] in- definite in- definite register window 1 (exbreg1) [address 0034 16 ] bit name bit symbol at reset function h/w s/w oo the accessible register, using this register window, depends on the exb index register contents as follows: index value 00 16 : external i/o configuration register 01 16 : transmit/receive buffer register 02 16 : memory channel operation mode register 03 16 : memory address counter 04 16 : end address register w r b7 b0 high_win [7:0] in- definite in- definite register window 2 (exbreg2) [address 0035 16 ] bit name bit symbol at reset function h/w s/w oo the accessible register, using this register window, depends on the exb index register contents as follows: index value 00 16 : external i/o configuration register 01 16 : transmit/receive buffer register 02 16 : memory channel operation mode register 03 16 : memory address counter 04 16 : end address register w r fig. 82 structure of register window 1 fig. 83 structure of register window 2
1-61 38k0 group user s manual hardware functional description b7 b0 exb_ctr int_ctr [2:0] a1_ctr b7:b5 index = 00 16 : external i/o configuration register (exbcfgl) [address 0034 16 ] 0 0 0 000 bit name bit symbol at reset function h/w s/w 0 : port 1 : exb function pin selects a signal of p3 3 /exint pin. on/off is programmed by each bit. an output logical sum of p3 3 /exint pins set for on are performed and it is output as an l active signal. b3b2b1 0 0 1 : rxb_rdy (rxbuf ready) output 0 1 0 : txb_rdy (txbuf ready) output 1 0 0 : mch_req (memory channel request) output others : do not set. 0 : port 1 : a1 input (used to read status) write 0 when writing. 0 is read when reading. exb pin control bit (pins p1 0 to p1 7 , p3 0 to p3 4 ) p3 3 /exint pin control bit p4 3 /exa1 pin control bit not used o o o o o o o o : state remaining w r fig. 84 index00[low]; structure of external i/o configuration register fig. 85 index00[high]; structure of external i/o configuration register b7 b0 drq_ctr [1:0] dak_ctr [1:0] tc_ctr b7:b5 index = 00 16 : external i/o configuration register (exbcfgh) [address 0035 16 ] 0 0 0 000 bit name bit symbol at reset function h/w s/w b1b0 0 0 : port 0 1 : do not set. 1 0 : exdreq function; rxb_rdy (rxbuf ready) output 1 1 : exdreq function; mch_req (memory channel request) output specifies p4 1 /exdack/txd pin function. selects which mode; requiring read or write signal, or not requiring it for use of dma acknowledge function. b3b2 0 0 : port 0 1 : do not set. 1 0 : exdack function; dma acknowledge input (mode for read and write signals used together) 1 1 :exdack function; dma acknowledge input (mode for read and write signals not required) 0 : port 1 : extc (terminal count) input write 0 when writing. 0 is read when reading. p4 0 /exdreq/rxd pin control bit p4 1 /exdack/txd pin control bit p4 2 /extc/s clk pin control bit not used o o o o o o o o : state remaining w r
hardware 1-62 38k0 group user s manual functional description b7 b0 rxbuf/ txbuf 0 index =01 16 : transmit/receive buffer register (rxbuf/txbuf) [address 0034 16 ] bit name bit symbol at reset function h/w s/w oo the data received from an external bus is written here at the rise timing of external write signal. the data transmitted to an external bus is written here at the timing of internal cpu write or memory write. the receive buffer register (rxbuf) contents can be read out by reading to this address with the cpu. the data which the cpu has written to this address is stored in the transmit buffer register (txbuf). however, do not perform write operation with the cpu to this address if the memory channel direction control bits of memory channel operation mode register is 10 2 (transmit mode) and the memory channel status bits of exb interrupt source register are 01 2 or 10 2 (memory channel being operating). w r fig. 86 index01[low]; structure of transmit/receive buffer register b7 b0 mc_dir [1:0] burst b7:b3 0 0 index =02 16 : memory channel operation mode register (mchmod) [address 0034 16 ] 00000 bit name bit symbol at reset function h/w s/w b1b0 0 0 : operation disabled 0 1 : receive mode 1 0 : transmit mode 1 1 : do not set. 0 : cycle mode (each byte transfer according to assertion or negation) 1 : burst mode (continuous transfer till the terminal count) write 0 when writing. 0 is read when reading. o o o o o o : state remaining memory channel direction control bit burst bit not used w r fig. 87 index02[low]; structure of memory channel operation mode register b7 b0 im_a [7:0] 0 index = 03 16 : memory address counter (memadl) [address 0034 16 ] bit name bit symbol at reset function h/w s/w oo register to set the low-order address of memory channel operation beginning. this contents are increased each time one memory access ends. w r fig. 88 index03[low]; structure of memory address counter
1-63 38k0 group user s manual hardware functional description b7 b0 im_a [10:8] b7:b3 0 index = 03 16 : memory address counter (memadh) [address 0035 16 ] 00000 bit name bit symbol at reset function h/w s/w o o o o : state remaining not used register to set the high-order address of memory channel operation start. this contents are increased each time one memory access ends. write 0 when writing. 0 is read when reading. w r fig. 89 index03[high]; structure of memory address counter b7 b0 end_a [7:0] 0 index = 04 16 : end address register (endadl) [address 0034 16 ] bit name bit symbol at reset function h/w s/w oo : state remaining register to set the low-order address of memory channel operation end. w r fig. 90 index04[low]; structure of end address register b7 b0 end_a [10:8] b7:b3 0 index = 04 16 : end address register (endadh) [address 0035 16 ] 00000 bit name bit symbol at reset function h/w s/w o o o o : state remaining not used register to set the high-order address of memory channel operation end. write 0 when writing. 0 is read when reading. w r fig. 91 index04[high]; structure of end address register
hardware 1-64 38k0 group user s manual functional description ??? 1 cs = 0 a0 = 1 cs = 0 read exrd ? ? ? 1 (receive buffer full interrupt enabled) ? l . if the cpu channel receive enable bit (rxb_enb) is 0 , both the receive buffer full bit (rxb_full) and the receive buffer ready signal (rxb_rdy) to an external are inactive. ? l and wxa0 = h , it will result in as follows: the data is written into the receive buffer (rxbuf) negation of the receive buffer ready signal (rxb_rdy) to an external is made the rxb_full interrupt is generated. ? 0 . exb operation timing diagram (1) cpu channel receiving operation cpu channel receiving operation is shown bellow. fig. 92 cpu channel receiving operation
1-65 38k0 group user s manual hardware functional description #0 #1 txb_rdy txb_rdy #0 #1 ? ? ? ? ? ? ? ? 1 (transmit buffer empty interrupt enabled) ? 0 , both the transmit buffer empty bit (txb_empty) and the transmit buffer ready signal (txb_rdy) to an external are inactive. ? 0 and assertion of the transmit buffer ready signal (txb_rdy) to an external is made. ? l and exa0 = h , it will result in as follows: the contents of the transmit buffer (txbuf) is read out the transmit buffer empty bit (txb_empty) is set to 1 negation of the transmit buffer ready signal (txb_rdy) to an external is made. a0 = 1 cs = 0 a0 = 1 cs = 0 (2) cpu channel transmitting operation cpu channel transmitting operation is shown bellow. fig. 93 cpu channel tranmitting operation
hardware 1-66 38k0 group user s manual functional description dma acknowledge exdack #0 #1 mch_req mch_req mwr detection mwr detection #0 #1 012 3 5 req req 0100 16 0101 16 0102 16 ack ack dma request exdreq ? ? ?? ? ?? ? ? ? ? ? 0 cs = 0 a0 = 0 cs = 0 external i/o configuration register set as necessary. memory channel operation mode register mc_dir[1:0] (memory channel direction control) = 01 2 (receive mode) burst (burst) = 0 (cycle mode) memory address counter (example) 0100 16 end address register (example) 0101 16 exb interrupt source enable register mc_enb (memory channel operation enable) = 1 (operation start) ? ? l and exa0 = l or a fall of exwr is detected in the condition of exdack = l , negation of the memory channel request which synchronized with a rise of ? ? ?
1-67 38k0 group user s manual hardware functional description dack = 0 dack = 0 dack = 0 #0 #1 #2 mch_req #0 #1 #2 012 3 5 req req req 0100 16 0101 16 0102 16 0103 16 ack ack ack dma acknowledge exdack mwr detection mwr detection dma request exdreq ? ? ? ? ? ? ??? ??? ? ? x cs = 1 a0 = x cs = 1 a0 = x cs = 1 external i/o configuration register set as necessary. memory channel operation mode register mc_dir[1:0] (memory channel direction control) = 01 2 (receive mode) burst (burst) = 1 (burst mode) memory address counter (example) 0100 16 end address register (example) 0102 16 exb interrupt source enable register mc_enb (memory channel operation enable) = 1 (operation start) ? ? ? ? ?
hardware 1-68 38k0 group user s manual functional description tc #0 #1 mch_req #0 #1 012 3 (5) 5 req 0100 16 0101 16 0102 16 ack ack dma acknowledge exdack mwr detection mwr detection dma request exdreq ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 1 (burst mode) memory address counter (example) 0100 16 end address register (example) 0107 16 exb interrupt source enable register mc_enb (memory channel operation enable) = 1 (operation start) ? ? 0 a0 = x cs = 1 dack = 0 a0 = x cs = 1 (5) memory channel receiving operation (3)- burst mode (terminal count) memory channel receiving operation (3) is shown bellow. fig. 96 memory channel receiving operation (3)
1-69 38k0 group user s manual hardware functional description #0 #1 mch_req mch_req #0 #1 012 34 5 req req 0100 16 0101 16 0102 16 ack ack dma acknowledge exdack mrd detection mrd detection dma request exdreq ? ? ? ? ? ?? ?? ? ? ? ? ? ? ? 0 a0 = x cs = 1 dack = 0 a0 = x cs = 1 external i/o configuration register set as necessary. memory channel operation mode register mc_dir[1:0] (memory channel direction control) = 10 2 (transmit mode) burst (burst) = 0 (cycle mode) memory address counter (example) 0100 16 end address register (example) 0101 16 exb interrupt source enable register mc_enb (memory channel operation enable) = 1 (operation start) ? ? ? l and exa0 = l or a fall of exrd is detected in the condition of exdack = l , negation of the memory channel request which synchronized with a rise of ? ? ?
hardware 1-70 38k0 group user s manual functional description #0 #1 #2 mch_req #0 #1 #2 012 3 4 5 req req req 0100 16 0101 16 0102 16 0103 16 ack ack ack dma acknowledge exdack mrd detection mrd detection dma request exdreq ? ? ?? ? ? ? ?? ??? ? ? ? ? 1 (burst mode) memory address counter (example) 0100 16 end address register (example) 0102 16 exb interrupt source enable register mc_enb (memory channel operation enable) = 1 (operation start) ? ? ? ? ? ? 0 a0 = x cs = 1 dack = 0 a0 = x cs = 1 dack = 0 a0 = x cs = 1 fig. 98 memory channel tranmitting operation (2) (7) memory channel transmitting operation (2)-burst mode memory channel transmitting operation (2) is shown bellow.
1-71 38k0 group user s manual hardware functional description multichannel ram the 38k0 group has the built-in multichannel ram including the small logic circuit (ram i/f) instead of ordinary ram. the multichannel ram has the usb channel and the exb channel in addition to the cpu channel. the multichannel ram controls access from cpu, usb and exb, synchronizing control with . s access has priority to the exb s. the one wait function (onw function) of 38000 series cpu is used internally to control access with the cpu. when receiving an access request from the usb or the exb, the multichannel ram outputs onw signal to wait the cpu for one clock, and access of the usb or the exb is performed. if the multichannel ram is outputting onw signal while the cpu is in the state of reading/writing for the ram area, the cpu read cycle or write cycle is extended by 1 period of h
hardware 1-72 38k0 group user s manual functional description multichannel ram operation example the multichannel ram operation example is shown below. this example shows the case that an external mcu uses the 38k0 group as a peripheral lsi (usb controller). the following explains that the external mcu reads out the data which is received via the usb. ? ? ? ? ? ? ? ?
1-73 38k0 group user s manual hardware functional description comparator and control circuit the comparator and control circuit compares an analog input volt- age with the comparison voltage, and then stores the result in the a-d conversion registers 1, 2. when an a-d conversion is com- pleted, the control circuit sets the ad conversion completion bit and the ad interrupt request bit to 1 . note that because the comparator consists of a capacitor cou- pling, set f(system clock) to 500 khz or more during an a-d conversion. fig. 102 structure of a-d control register fig. 103 10-bit a-d mode reading a - d c o n t r o l r e g i s t e r ( a d c o n : a d d r e s s 0 0 3 6 1 6 ) a d c o n v e r s i o n c o m p l e t i o n b i t 0 : c o n v e r s i o n i n p r o g r e s s 1 : c o n v e r s i o n c o m p l e t e d a n a l o g i n p u t p i n s e l e c t i o n b i t s 0 0 0 : p 1 0 / d q 0 / a n 0 0 0 1 : p 1 1 / d q 1 / a n 1 0 1 0 : p 1 2 / d q 2 / a n 2 0 1 1 : p 1 3 / d q 3 / a n 3 1 0 0 : p 1 4 / d q 4 / a n 4 1 0 1 : p 1 5 / d q 5 / a n 5 1 1 0 : p 1 6 / d q 6 / a n 6 1 1 1 : p 1 7 / d q 7 / a n 7 n o t u s e d ( i n d e f i n i t e a t r e a d ) ( t h e s e b i t s a r e w r i t e d i s a b l e d b i t s . ) b 7 b 0 10-bit reading (read address 0038 16 before 0037 16 ) note : bits 2 to 7 of address 0038 16 become 0 at reading. b 8 b 7 b 6 b 5 b4 b3 b 2 b1 b0 b 7 b0 b 9 b7 b 0 b 9 b 8 b 7 b6 b5 b 4 b 3 b2 b7 b 0 0 ( a d d r e s s 0 0 3 8 1 6 ) (a d d r e s s 0 0 3 7 1 6 ) 8-bit reading (read only address 0037 16 ) (address 0037 16 ) a-d converter the functional blocks of the a-d converter are described below. [a-d conversion register 1, 2 (ad1, ad2)] 0037 16 , 0038 16 the a-d conversion register is a read-only register that stores the result of an a-d conversion. when reading this register during an a-d conversion, the previous conversion result is read. bit 7 of the a-d conversion register 2 must be set to 0 .not only 10-bit reading but also only high-order 8-bit reading of conversion result can be performed by selecting the reading procedure of the a-d conversion registers 1, 2 after a-d conversion is completed (in figure 103). the 8-bit reading inclined to msb is performed when reading the a-d converter register 1 after a-d conversion is started or reset; and when the a-d converter register 1 is read after reading the a- d converter register 2, the 8-bit reading inclined to lsb is performed. [a-d control register (adcon)] 0036 16 the a-d control register controls the a-d conversion process. bits 0 to 2 select a specific analog input pin. bit 3 signals the comple- tion of an a-d conversion. the value of this bit remains at 0 during an a-d conversion, and changes to 1 when an a-d con- version ends. writing 0 to this bit starts the a-d conversion. comparison voltage generator the comparison voltage generator divides the voltage between v ref and av ss into 1024, and that outputs the comparison volt- age. the a-d converter successively compares the comparison voltage v ref in each mode, dividing the v ref voltage (see below), with the input voltage. 10-bit reading v ref = ? 1023) 8-bit reading v ref = ? 255) channel selector the channel selector selects one of the input ports p1 7 /an 7 p1 0 / an 0 . v ref 256 v ref 1024
hardware 1-74 38k0 group user s manual functional description fig. 104 a-d converter block diagram p 1 0 / d q 0 / a n 0 p 1 1 / d q 1 / a n 1 p 1 2 / d q 2 / a n 2 p 1 3 / d q 3 / a n 3 p 1 4 / d q 4 / a n 4 p 1 5 / d q 5 / a n 5 p 1 6 / d q 6 / a n 6 p 1 7 / d q 7 / a n 7 d a t a b u s a - d c o n t r o l r e g i s t e r ( a d d r e s s 0 0 3 6 1 6 ) v ss b 7b 0 3 1 0 a-d control circuit comparator r e s i s t o r l a d d e r a-d conversion register 2 a-d conversion register 1 (address 0038 16 ) (address 0037 16 ) c h a n n e l s e l e c t o r a - d i n t e r r u p t r e q u e s t v ref
1-75 38k0 group user s manual hardware functional description fig. 106 structure of watchdog timer control register fig. 105 block diagram of watchdog timer watchdog timer the watchdog timer gives a mean of returning to the reset status when a program cannot run on a normal loop (for example, be- cause of a software run-away). the watchdog timer consists of an 8-bit watchdog timer l and an 8-bit watchdog timer h. standard operation of watchdog timer when any data is not written into the watchdog timer control reg- ister (address 0039 16 ) after resetting, the watchdog timer is in the stop state. the watchdog timer starts to count down by writing an optional value into the watchdog timer control register (address 0039 16 ) and an internal reset occurs at an underflow of the watch- dog timer h. accordingly, programming is usually performed so that writing to the watchdog timer control register (address 0039 16 ) may be started before an underflow. when the watchdog timer control reg- ister (address 0039 16 ) is read, the values of the high-order 6 bits of the watchdog timer h, stp instruction disable bit (bit 6), and watchdog timer h count source selection bit (bit 7) are read. initial value of watchdog timer at reset or writing to the watchdog timer control register (address 0039 16 ), each watchdog timer h and l is set to ff 16 . 0 , the count source becomes the underflow signal of watchdog timer l. the detection time is set to 131.072 ms at sys- tem clock 8 mhz frequency. when this bit is set to 1 , the count source becomes the system clock divided by 16. the detection time in this case is set to 512 0 after resetting. 0 , the stp instruction is enabled. when this bit is 1 , the stp instruction is disabled. once the stp instruction is executed, an internal reset occurs. when this bit is set to 1 , it cannot be rewritten to 0 by program. this bit is cleared to 0 after resetting. s y s t e m c l o c k 0 1 1 / 1 6 reset f f 1 6 i s s e t w h e n w a t c h d o g t i m e r c o n t r o l r e g i s t e r i s w r i t t e n t o . w a t c h d o g t i m e r l ( 8 ) watchdog timer h count source selection bit w a t c h d o g t i m e r h ( 8 ) d a t a b u s f f 1 6 i s s e t w h e n w a t c h d o g t i m e r c o n t r o l r e g i s t e r i s w r i t t e n t o . s t p i n s t r u c t i o n d i s a b l e b i t s t p i n s t r u c t i o n r e s e t c i r c u i t internal reset b 0 stp instruction disable bit 0: stp instruction enabled 1: stp instruction disabled watchdog timer h count source selection bit 0: watchdog timer l underflow 1: system clock/16 watchdog timer h (for read-out of high-order 6 bit) w a t c h d o g t i m e r c o n t r o l r e g i s t e r ( w d t c o n : a d d r e s s 0 0 3 9 1 6 ) b 7
hardware 1-76 38k0 group user s manual functional description fig. 107 example of reset circuit fig. 108 reset sequence 0 v 0 v v cc reset v cc reset (note) 0.2v cc poweron power source voltage detection circuit power source voltage reset input voltage note : reset release voltage ; vcc = 4.0 v (standard) vcc = 3.0 v (l version) r e s e t i n t e r n a l r e s e t d a t a f ( l level for 16 cycles or more of x in . then the reset pin is returned to an h level (the power source voltage should be between 4.0 v and 5.25 v for standard or between 3.0 v and 5.25 v for l ver- sion, and the oscillation should be stable), reset is released. after the reset is completed, the program starts from the address con- tained in address fffd 16 (high-order byte) and address fffc 16 (low-order byte). make sure that the reset input voltage is 0.8 v for v cc of 4.0 v (standard), it is 0.6 v for v cc of 3.0 v (l version).
1-77 38k0 group user s manual hardware functional description pll circuit (frequency synthesizer) the pll circuit generates f vco (pll output clock), which is re- quired for f usb (usb clock) and f syn (f usb division clock), from f(x in ) (external input reference clock). figure 109 shows the pll circuit block diagram. it is possible to input 6 or 12 mhz clock from the externals as a standard clock input. when using the usb function, set the pll operation mode selection bit so that fvco may be set to 48 mhz. the pll circuit operates by setting the pll operation enable bit to 1 . when supplying f vco to the usb block, wait for the oscillation stable time (1ms or less) of pll before selecting f vco with the usb clock selection bit. according to the setting of the usb clock division ratio selection bit, the division clock of f usb is supplied to f syn . when using this clock as system clock, set the usb clock division ratio selection bit so that it may be set to 6 mhz, 8 mhz or 12 mhz. (however, using it only when f usb is 48mhz is recommended). fig. 109 block diagram of pll circuit pll f usb f ( x i n ) f vco p l l c o n division circuit f s y n (address 0ff8 16 ) u s b c o n (address 0010 16 )
hardware 1-78 38k0 group user s manual functional description fig. 110 structure of pll control register p l l c o n t r o l r e g i s t e r ( p l l c o n : a d d r e s s 0 f f 8 1 6 ) not used (return 0 when read) usb clock division ratio selection bits b4b3 0 0: divided by 8 (f syn = f usb /8) 0 1: divided by 6 (f syn = f usb /6) 1 0: divided by 4 (f syn = f usb /4) 1 1: not selected pll operation mode selection bits b6b5 0 0: not multiplied (f vco = f xin ) 0 1: double (f vco = f xin ? ? ?
1-79 38k0 group user s manual hardware functional description clock generating circuit an oscillation circuit can be formed by connecting a resonator be- tween x in and x out . use the circuit constants in accordance with the resonator manufacturer s recommended values. no external resistor is needed between x in and x out since a feed-back resis- tor exists on-chip. frequency control either f syn or f(x in ) can be selected as an internal system clock. furthermore, the frequency of internal clock pll cir- cuit . (2) f(x in ) clock the frequency applied to the x in pin is used as an internal system clock frequency. oscillation control (1) stop mode if the stp instruction is executed, the internal clock h level, and the x in oscillator stops. when the oscillation stabi- lizing time set after stp instruction released bit is 0, the prescaler 12 is set to ff 16 and timer 1 is set to 01 16 . when the oscillation stabilizing time set after stp instruction released bit is 1, set the sufficient time for oscillation of used oscillator to stabi- lize since nothing is set to the prescaler 12 and timer 1. x in divided by 16 is compulsorily connected to the input of the prescaler 12. oscillator restarts when an external interrupt (includ- ing usb resume interrupt) is received, but the internal clock h until timer 1 underflows. the internal clock l level to the reset pin until the oscillation is stable since a wait time will not be generated automatically. (2) wait mode if the wit instruction is executed, the internal clock h level, but the oscillator does not stop. the internal clock 1 before ex- ecuting of the stp or wit instruction. when releasing the stp state, the prescaler 12 and timer 1 will start counting the clock x in divided by 16. accordingly, set the timer 1 interrupt enable bit to 0 before executing the stp instruc- tion. 1 , evaluate time to stabilize oscillation of the used oscillator and set the value to the timer 1 and prescaler 12.
hardware 1-80 38k0 group user s manual functional description fig. 114 system clock generating circuit block diagram (single-chip mode) fig. 111 ceramic resonator or quartz-crystal oscilltor circuit fig. 112 external clock input circuit fig. 113 structure of misrg c i n c o u t x i n x o u t x o u t e x t e r n a l o s c i l l a t i o n c i r c u i t o p e n v cc v ss x i n m i s r g ( m i s r g : a d d r e s s 0 f f b 1 6 ) o s c i l l a t i o n s t a b i l i z i n g t i m e s e t a f t e r s t p i n s t r u c t i o n r e l e a s e d b i t 0 : a u t o m a t i c a l l y s e t 0 1 1 6 t o t i m e r 1 , f f 1 6 t o p r e s c a l e r 1 2 1 : a u t o m a t i c a l l y s e t n o t h i n g n o t u s e d ( i n d e f i n i t e a t r e a d ) b 0 b 7 p l l 1 / 8 1 / 41 / 6 f u s b x i n x o u t f s i o f a d 1 / 8 1 / 4 1 / 2 1 / 1 s r q s r q s r q 1 / 2 f f 1 6 0 1 1 6 1 / 2 1 / 2 1 / 2 f v c o f s y n u s b c l o c k s e l e c t i o n b i t u s b c l o c k d i v i s i o n r a t i o n s e l e c t i o n b i t s s y s t e m c l o c k d i v i s i o n r a t i o n s e l e c t i o n b i t s t i m e r 1 p r e s c a l e r 1 2 r e s e t o r s t p i n s t r u c t i o n t i m i n g
1-81 38k0 group user s manual hardware functional description fig. 115 state transitions of clock n o t e s r e s e t c m 7 1 0 cm6 0 1 x in 8-divide mode f( p l l c i r c u i t i n d e t a i l s f o r e n a b l i n g / d i s a b l i n g p l l o p e r a t i o n a n d u s a g e n o t e s o f f s y n . 5 : s e t t h e s y s t e m c l o c k t o x i n w h e n e n t e r i n g s t o p m o d e . 6 : i n a l l m o d e s , s w i t c h i n g t o w a i t m o d e i s p o s s i b l e . w h e n i t i s r e l e a s e d , t h e m c u r e t u r n s t o t h e o r i g i n a l m o d e . i n w a i t m o d e t h e t i m e r s c a n o p e r a t e . c m 5 1 0 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 t h e 6 m h z s i g n a l s a r e a p p l i e d t o x i n p i n . x in 4-divide mode f( 1 0 c m 6 0 1 c m 7 0 1 c m 6 0 1 c m 7 1 0 x i n 2 - d i v i d e m o d e f ( 0 1 x in through mode f( 0 1 f( syn ) through mode f( 1 0 under planning f( syn ) through mode f( 0 1 cm6 0 1 note : set pllcon [4:3] = 00 before switching the system clock from x in to f syn . cm5 0 1 cm6 0 1 note : set pllcon [4:3] = 01 before switching the system clock from x in to f syn . c m 5 0 1 cm5 0 1 note : set pllcon [4:3] = 00 before switching the system clock from x in to f syn . note : set pllcon [4:3] = 01 before switching the system clock from x in to f syn .
hardware 1-82 38k0 group user s manual functional description flash memory mode the 38k0 group s 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 4.5 to 5.25 v, and 2 power sources when v cc is 3.0 to 4.5 v. 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 9 lists the summary of the 38k0 group s flash memory ver- sion. this flash memory version has some blocks on the flash memory as shown in figure 116 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. table 9 summary of 38k0 group s flash memory version notes 1: in the parallel i/o mode or the standard serial i/o mode, use the exclusive external equipment flash programmer which support s the 38k0 group (flash memory version). 2: 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 re- written in only parallel i/o mode. item power source voltage (vcc) program/erase v pp voltage (v pp ) 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 data retention period rom code protection specifications 4.00 5.25 v (standard), 3.00 5.25 v (l version) (program and erase in 4.00 to 5.25 v of vcc.) 3.00 4.00 v(only l version) (program and erase in 3.00 to 5.25 v of vcc.) 4.50 5.25 v 3 modes; flash memory can be manipulated as follows: cpu rewrite mode: manipulated by the central processing unit (cpu). parallel i/o mode: manipulated using an external programmer ( note 1 ) standard serial i/o mode: manipulated using an external programmer ( note 1 ) 1 block (32 kbytes) 1 block (4 kbytes) ( note 2 ) byte program batch erasing program/erase control by software command 6 commands 100 times 10 years available in parallel i/o mode and standard serial i/o mode
1-83 38k0 group user s manual hardware functional description fig. 116 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 116 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 116 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 p1 6 (ce ) pin high, the cnv ss pin high, the cpu starts operating using the control program in the boot rom area. this mode is called the boot mode. block address block addresses refer to the maximum address of each block. these addresses are used in the block erase command. 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 notes 1 : the boot rom area can be rewritten in only parallel i/o mode. (access to any other areas is inhibited.) 2 : to specify a block, use the maximum address in the block. b l o c k 1 : 3 2 k b y t e s 8000 16 f0 0 0 1 6 f f f f 1 6
hardware 1-84 38k0 group user s manual functional description outline performance (cpu rewrite mode) cpu rewrite mode is usable in the single-chip 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 as instructed by 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 1 to the cpu rewrite mode select bit (bit 1 of address 0ffe 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 117 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 0 (busy). otherwise, it is 1 (ready). this is equivalent to the ry/by pin function in parallel i/o mode. bit 1 is the cpu rewrite mode select bit. when this bit is set to 1 , the mcu enters cpu rewrite mode. software commands are accepted once the mode is entered. in cpu rewrite mode, the flash memory control register (address 0ffe 16 ) fmcr ( note 1 ) ry/by status flag 0: busy (being written or erased) 1: ready cpu rewrite mode select bit ( note 2 ) 0: normal mode (software commands invalid) 1: cpu rewrite mode (software commands acceptable) cpu rewrite mode entry flag 0: normal mode (software commands invalid) 1: cpu rewrite mode flash memory reset bit ( note 3 ) 0: normal operation 1: reset user area / boot area select bit ( note 4 ) 0: user rom area accessed 1: boot rom area accessed reserved bits (indefinite at read/ 0 at write) b0 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 1 , it is necessary to write 0 and then write 1 in succession. the bit can be set to 0 by only writing 0 . bit 2 is the cpu rewrite mode entry flag. this flag indicates 1 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 1 , setting 1 for this bit resets the control circuit. to set this bit to 1 , it is necessary to write 0 and then write 1 in succession. to release the reset, it is necessary to set this bit to 0 . bit 4 is the user area/boot area select bit. when this bit is set to 1 , boot rom area is accessed, and cpu rewrite mode in boot rom area is available. in boot mode, this bit is set to 1 auto- matically. reprogramming of this bit must be in a memory other than internal flash memory. figure 118 shows a flowchart for setting/releasing cpu rewrite mode. fig. 117 structure of flash memory control register
1-85 38k0 group user s manual hardware functional description fig. 118 cpu rewrite mode set/release flowchart e n d s t a r t execute read array command or reset flash memory by setting flash memory reset bit (by writing 1 and then 0 in succession) (note 3) s i n g l e - c h i p m o d e o r b o o t m o d e ( n o t e 1 ) s e t c p u m o d e r e g i s t e r ( 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 s y s t e m c l o c k d i v i s i o n r a t i o n s e l e c t i o n b i t s o f c p u m o d e r e g i s t e r ( b i t s 6 a n d 7 a t a d d r e s s 0 0 3 b 1 6 ) . 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 . write 0 to cpu rewrite mode select bit set cpu rewrite mode select bit to 1 (by writing 0 and then 1 in succession) 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
hardware 1-86 38k0 group user s manual functional description notes on cpu rewrite mode take the notes described below when rewriting the flash memory in cpu rewrite mode. h , so that the pro- gram will begin at the address which is stored in addresses fffc 16 and fffd 16 of the boot rom area.
1-87 38k0 group user s manual hardware functional description software commands table 10 lists the software commands. after setting the cpu rewrite mode select bit to 1 , write a soft- ware command to specify an erase or program operation. each software command is explained below. ff 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 (d 0 to d 7 ). the read array mode is retained intact until another command is written. 70 16 is written in the first bus cycle, the contents of the status register are read out at the data bus (d 0 to d 7 ) by a read in the second bus cycle. the status register is explained in the next section. 50 16 in the first bus cycle. 40 16 is writ- ten in the first bus cycle. then, if the address and data to program are written in the 2nd bus cycle, the control circuit of flash memory (data programming and verification) will start a program. whether the write operation is completed can be confirmed by _____ reading the status register or the ry/by status flag. when the program starts, the read status register mode is entered automati- cally and the contents of the status register is read at the data bus (db 0 to db 7 ). the status register bit 7 (sr7) is set to 0 at the same time the write operation starts and is returned to 1 upon completion of the write operation. in this case, the read status reg- ister mode remains active until the read array command (ff 16 ) is written. table 10 list of software commands (cpu rewrite mode) ____ during the program movement, the ry/by status flag of flash memory control register is set to 0 . when the program com- pletes, it becomes 1 . at program end, program results can be checked by reading the status register. fig. 119 program flowchart command program 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 first bus cycle second bus cycle ff 16 70 16 50 16 40 16 write write write write xsrd r e a d write e r a s e a l l b l o c k s20 16 write x 20 16 w r i t e (note 1) wa (note 2) wd (note 2) block erase 2 0 1 6 write d0 16 w r i t eba ( n o t e 3 ) mode a d d r e s s m o d ea d d r e s s data (d 0 to d 7 ) (d 0 to d 7 ) (note 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 program completed 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 sr4 = 0 ? program error no yes s r 7 = 1 ? o r r y / b y = 1 ? w r i t e
hardware 1-88 38k0 group user s manual functional description 20 16 in the first bus cycle and the confirmation command code 20 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 (d 0 to d 7 ). the status register bit 7 (sr7) is set to 0 at the same time the erase operation starts and is returned to 1 upon comple- tion of the 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 0 during erase operation and 1 when the erase operation is completed as is the status register bit 7. after the erase all blocks end, erase results can be checked by reading the status register. for details, refer to the section where the status register is detailed. 20 16 in the first bus cycle and the confirmation command code d0 16 and the block 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 0 at the same time the block erase operation starts and is returned to 1 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 0 during block erase operation and 1 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 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 erase completed n o y e s s t a r t write sr5 = 0 ? e r a s e e r r o r y e s no 2 0 1 6 : e r a s e a l l b l o c k s d 0 1 6 : b l o c k e r a s e 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. 120 erase flowchart
1-89 38k0 group user s manual hardware functional description table 11 definition of each bit in status register 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 80 16 . table 11 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 0 (busy) during write or erase operation and is set to 1 when these operations ends. after power-on, the sequencer status is set to 1 (ready). erase status (sr5) the erase status indicates the operating status of erase operation. if an erase error occurs, it is set to 1 . when the erase status is cleared, it is set to 0 . program status (sr4) the program status indicates the operating status of write opera- tion. when a write error occurs, it is set to 1 . the program status is set to 0 when it is cleared. if 1 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. each bit of srd0 bits sr7 (bit7) sr6 (bit6) sr5 (bit5) sr4 (bit4) sr3 (bit3) sr2 (bit2) sr1 (bit1) sr0 (bit0) definition 1 0 sequencer status reserved erase status program status reserved reserved reserved reserved ready - terminated in error terminated in error - - - - status name busy - terminated normally terminated normally - - - -
hardware 1-90 38k0 group user s manual functional description full status check by performing full status check, it is possible to know the execu- tion results of erase and program operations. figure 121 shows a full status check flowchart and the action to be taken when each error occurs. fig. 121 full status check flowchart and remedial procedure for errors 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 ? yes n o c o m m a n d s e q u e n c e e r r o r program error e n d ( b l o c k e r a s e , p r o g r a m ) execute the clear status register command (50 16 ) to clear the status register. try performing the operation one more time after confirming that the command is entered correctly. should an erase error occur, the block in error cannot be used. 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 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 . should a program error occur, the block in error cannot be used.
1-91 38k0 group user s manual hardware functional description 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. 0 , 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 00 , 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. 122 structure of rom code protect control register 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 ( a d d r e s s f f d b 1 6 ) r o m c p reserved bits ( 1 at read/write) rom code protect level 2 set bits (romcp2) ( notes 1, 2 ) b3b2 0 0: protect enabled 0 1: protect enabled 1 0: protect enabled 1 1: protect disabled rom code protect reset bits ( note 3 ) b5b4 0 0: protect removed 0 1: protect set bits effective 1 0: protect set bits effective 1 1: protect set bits effective rom code protect level 1 set bits (romcp1) ( note 1 ) b7b6 0 0: protect enabled 0 1: protect enabled 1 0: protect enabled 1 1: protect disabled b 0 b 7 n o t e s1 : 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 . 2 : 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 . 3 : 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 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 .
hardware 1-92 38k0 group user s manual functional description id code check function 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 ffd4 16 to ffda 16 . write a pro- gram which has had the id code preset at these addresses to the flash memory. fig. 123 id code store addresses rom cord protect control id7 id6 id5 id4 id3 id2 id1 ffdb 16 ffda 16 ffd9 16 ffd8 16 ffd7 16 ffd6 16 ffd5 16 ffd4 16 address interrupt vector area
1-93 38k0 group user s manual hardware functional description (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 38k0 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 116 can be rewritten. both areas of flash memory can be operated on in the same way. 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 pro- gram stored in it when shipped from the mitsubishi factory. there- fore, using the device in standard serial i/o mode, you must perform program and block erase in the user rom area.
hardware 1-94 38k0 group user s manual functional description (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 a purpose-specific pe- ripheral unit.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 h to the p1 6 (ce) pin and h to the p4 2 (s clk ) pin and h to the cnv ss (v pp ) pin (apply 4.5 v to 5.25 v to vpp from an external source), and re- leasing the reset operation. (in the ordinary microcomputer mode, set cnvss pin to l level.) this control program is written in the boot rom area when the product is shipped from mitsubishi. 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. figure 124 shows 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 s clk , rxd, txd and s rdy (busy). the s clk pin is the trans- fer clock input pin through which an external transfer clock is input. the txd pin is for cmos output. the s rdy (busy) pin out- puts l level when ready for reception and h level when reception 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 116 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 (serial 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 s clk pin, and are then input to the mcu via the rxd pin. in transmission, the read data and status are synchronized with the fall of the transfer clock, and output from the txd pin. the txd 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 s rdy (busy) pin is h level. accordingly, always start the next transfer after the s rdy (busy) pin is l 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.
1-95 38k0 group user s manual hardware functional description table 12 description of pin function (standard serial i/o mode) pin name signal name i/o v cc ,v ss power supply v cc e power supply cnv ss v pp i cnv ss 2 cnv ss 2i v ref analog reference voltage i dv cc , pv cc analog power supply pv ss analog power supply ____________ reset reset input i x in clock input i x out clock output o usbv ref usb reference voltage input tron usb reference voltage output o d0+,d0- usb upstream input i/o p0 0 to p0 7 input port p0 i p1 0 to p1 5 input port p1 i p1 6 input port p1 i p1 7 input port p1 i p2 0 to p2 7 input port p2 i p3 0 to p3 7 input port p3 i p4 0 rxd input i p4 1 txd output o p4 2 s clk input i p4 3 busy output o p5 0 to p5 7 input port p5 i p6 0 to p6 3 input port p6 i function apply 4.00 to 5.25 v (standard) or 3.00 to 5.25 v (l version) to the vcc pin and 0 v to the vss pin. connect this pin to vcc. connect this pin to v pp (v pp = 4.50 to 5.25 v). connect this pin to vss. connect this pin to vcc when not using. connect this pin to vcc. connect this pin to vss. to reset, input l level for 20 cycles or longer clocks of l level when not using. input l or h level, or keep open. input l or h level, or keep open. input l or h level, or keep open. input h level only at release of reset. input l or h level, or keep open. input l or h level, or keep open. input l or h level, or keep open. this is a serial data input pin. this is a serial data output pin. this is a serial clock input pin.input h level only at release of reset. this is a busy output pin. input l or h level, or keep open. input l or h level, or keep open.
hardware 1-96 38k0 group user s manual functional description fig. 124 pin connection diagram in standard serial i/o mode (1) p0 6 1 2 3 4 7 8 9 10 11 12 13 14 15 16 5 6 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 p1 2 /dq 2 /an 2 p1 5 /dq 5 /an 5 cnv ss cnv ss 2 p6 0 (led 0 ) p6 1 (led 1 ) p6 2 (led 2 ) v cc v ss x in x out p6 3 (led 3 ) pv ss p2 3 p2 4 p1 3 /dq 3 /an 3 p1 4 /dq 4 /an 4 45 46 47 48 pv cc dv cc usbv ref tron d0+ d0- p2 0 p2 1 p2 2 p2 5 p2 6 p2 7 p5 0 /int 0 p5 1 /cntr 0 p5 2 /int 1 p5 3 p5 4 p5 5 p5 6 p5 7 p0 0 p0 1 p0 2 p0 3 p0 4 p0 5 p0 7 p4 0 /e x dreq/r x d p4 1 /e x dack/t x d p4 2 /e x tc/s clk p4 3 /e x a 1 /s rdy p3 0 p3 1 p3 2 p3 3 /e x int p3 4 /e x cs p3 5 /e x wr p3 6 /e x rd p3 7 /e x a0 p1 0 /dq 0 /an 0 p1 1 /dq 1 /an 1 reset p1 6 /dq 6 /an 6 p1 7 /dq 7 /an 7 v cc e v ref v pp vcc vss t x d busy r x d s clk reset connect to oscillator circuit. packa g e outline: 64p6u-a, 64p6q-a ( note 1 ) notes 1 : connect to vcc in the case of vcc = 4.5 v to 5.25 v. connect to v pp (= 4.5 v to 5.25 v) in the case of vcc = 3.0 v to 4.5 v. 2 : supply vcc at releasimg reset. mode setup method signal value cnvss 4.5 to 5.25 v s clk vcc ( note 2 ) reset vss
1-97 38k0 group user s manual hardware functional description software commands table 13 lists software commands. in standard serial i/o mode, erase, program and read are controlled by transferring software commands via the rxd pin. software commands are explained 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 a programmer to the in- ternal flash memory microcomputer. 2: srd refers to status register data. srd1 refers to status register 1 data. 3: all commands can be accepted when the flash memory is totally blank. 4: address low is a 0 to a 7 ; address middle is a 8 to a 15 ; address high is a 16 to a 23 . address-high a 16 to a 23 are always 00 16 . here below. basically, the software commands of the standard se- rial i/o mode are the same as that of the parallel i/o mode, but the block erase function is excluded, and 4 commands are added: id check, download, version data output and boot rom area output functions. table 13 software commands (standard serial i/o mode) control command 1 page read 2 page program 41 16 address (middle) address (high) data input data input data input not acceptable not acceptable acceptable 3 erase all blocks a7 16 d0 16 srd1 output 4 read status register 70 16 srd output 5 clear status register 50 16 address (low) address (middle) not acceptable 6 id check function f5 16 acceptable 7 download function fa 16 size (low) size (high) address (high) check- sum id size id1 to id7 not acceptable 8 version data output function fb 16 data input to required number of times acceptable fc 16 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 not acceptable 9 boot rom area output function version data output address (middle)
hardware 1-98 38k0 group user s manual functional description 70 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. the contents of software commands are explained as follows. ff 16 command code with the 1st byte. (2) transfer addresses a 8 to a 15 and a 16 to a 23 with the 2nd and 3rd bytes respectively. (3) from the 4th byte onward, data (d 0 to d 7 ) for the page (256 bytes) specified with addresses a 8 to a 23 will be output se- quentially from the smallest address first synchronized with the fall of the clock. data0 data255 a 8 t o a 1 5 a 16 to a 23 f f 1 6 s c l k r x d 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 r x d t x d s r d y ( b u s y ) 70 16 fig. 125 timing for page read fig. 126 timing for reading status register
1-99 38k0 group user s manual hardware functional description fig. 127 timing for clear status register 50 16 com- mand code is sent with the 1st byte, the aforementioned bits are cleared. when the clear status register operation ends, the s rdy (busy) signal changes from h to l level. s clk rxd txd s rdy (busy) 5 0 1 6 a 8 t o a 1 5 a 1 6 t o a 2 3 4 1 1 6 d a t a 0 d a t a 2 5 5 s clk rxd txd s rdy (busy) 41 16 command code with the 1st byte. (2) transfer addresses a 8 to a 15 and a 16 to a 23 with the 2nd and 3rd bytes respectively. (3) from the 4th byte onward, as write data (d 0 to d 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 s rdy (busy) signal changes from h to l 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. 128 timing for page program
hardware 1-100 38k0 group user s manual functional description a7 16 command code with the 1st byte. (2) transfer the verify command code d0 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 s rdy (busy) signal changes from h to l level. the result of the erase operation can be known by reading the status register. a7 16 d 0 1 6 s c l k r x d t x d s r d y ( b u s y ) fig. 129 timing for erase all blocks
1-101 38k0 group user s manual hardware functional description fa 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. 130 timing for download f a 1 6 p r o g r a m d a t a program data data size (low) check sum s clk rxd txd s rdy (busy) d a t a s i z e ( h i g h )
hardware 1-102 38k0 group user s manual functional description fb 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. 131 timing for version information output fb 16 x v e r s clk rxd txd s rdy (busy) fc 16 command code with the 1st byte. (2) transfer addresses a 8 to a 15 and a 16 to a 23 with the 2nd and 3rd bytes respectively. (3) from the 4th byte onward, data (d 0 to d 7 ) for the page (256 bytes) specified with addresses a 8 to a 23 will be output se- quentially from the smallest address first synchronized with the fall of the clock. fig. 132 timing for boot rom area output f c 1 6 a 8 t o a 1 5 a 1 6 t o a 2 3 d a t a 0d a t a 2 5 5 s cl k rx d tx d s rdy (busy)
1-103 38k0 group user s manual hardware functional description f5 16 command code with the 1st byte. (2) transfer addresses a 0 to a 7 , a 8 to a 15 and a 16 to a 23 ( 00 16 ) of the 1st byte of the id code with the 2nd, 3rd and 4th respec- tively. (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.
hardware 1-104 38k0 group user s manual functional description 80 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 1 (ready). this status bit is set to 0 (busy) during write or erase operation and is set to 1 upon completion of these operations. erase status (sr5) the erase status indicates the operating status of erase opera- tion. if an erase error occurs, it is set to 1 . when the erase status is cleared, it is set to 0 . program status (sr4) the program status indicates the operating status of write opera- tion. if a write error occurs, it is set to 1 . when the program status is cleared, it is set to 0 . srd0 bits sr7 (bit7) sr6 (bit6) sr5 (bit5) sr4 (bit4) sr3 (bit3) sr2 (bit2) sr1 (bit1) sr0 (bit0) definition 1 0 table 14 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 - - - -
1-105 38k0 group user s manual hardware functional description 00 16 when power is turned on and the flag status is maintained even after the reset. table 15 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 check completed bits data reception time out reserved 1 update completed - - match time out - 0 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 check completed bits (sr11 and sr10) these flags indicate the result of id checks. some commands cannot be accepted without an id 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.
hardware 1-106 38k0 group user s manual functional description full status check results from executed erase and program operations can be known by running a full status check. figure 135 shows a flow- chart 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 erase error n o s r 4 = 0 ? y e s no c o m m a n d s e q u e n c e e r r o r program error e n d ( e r a s e , p r o g r a m ) execute the clear status register command (50 16 ) to clear the status register. try performing the operation one more time after confirming that the command is entered correctly. should an erase error occur, the block in error cannot be used. note : when one of sr5 to sr4 is set to 1 , none of the program, erase all blocks, and block erase commands is accepted. execute the clear status register command (50 16 ) before executing these commands. should a program error occur, the block in error cannot be used. fig. 135 full status check flowchart and remedial procedure for errors
1-107 38k0 group user s manual hardware functional description example circuit application for standard serial i/o mode figure 136 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. s r d y ( b u s y ) s cl k rxd txd cnvss c l o c k i n p u t b u s y o u t p u t d a t a i n p u t d a t a o u t p u t m 3 8 k 0 9 f 8 n o t e s 1 : c o n t r o l p i n s a n d e x t e r n a l c i r c u i t r y w i l l v a r y a c c o r d i n g t o a p r o g r a m m e r . f o r m o r e i n f o r m a t i o n , s e e t h e p r o g r a m m e r m a n u a l . 2 : i n t h i s e x a m p l e , t h e v p p p o w e r s u p p l y i s s u p p l i e d f r o m a n e x t e r n a l s o u r c e ( p r o g r a m m e r ) . t o u s e t h e u s e r s p o w e r s o u r c e , c o n n e c t t o 4 . 5 v t o 5 . 2 5 v . v p p p o w e r s o u r c e i n p u t v c c v c c p 1 6 ( c e ) fig. 136 example circuit application for standard serial i/o mode
hardware 1-108 38k0 group user s manual notes on programming notes on programming processor status register the contents of the processor status register (ps) after a reset are undefined, except for the interrupt disable flag (i) which is 1. af- ter 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. interrupts the contents of the interrupt request bits do not change immedi- ately after they have been written. after writing to an interrupt request register, execute at least one instruction before perform- ing a bbc or bbs instruction. decimal calculations to calculate in decimal notation, set the decimal mode flag (d) to 1 , then execute an adc or sbc instruction. after executing an adc or sbc instruction, execute at least one instruction be- fore executing a sec, clc, or cld instruction. in decimal mode, the values of the negative (n), overflow (v), and zero (z) flags are invalid. timers when n (0 to 255) is written to a timer latch, the frequency divi- sion ratio is 1/(n+1). when a count source of timer x is switched, stop a count of timer x. multiplication and division instructions the index x mode (t) and the decimal mode (d) flags do not af- fect the mul and div instruction. the execution of these instructions does not change the con- tents of the processor status register. ports the contents of the port direction registers cannot be read. the following cannot be used: the data transfer instruction (lda, etc.) the operation instruction when the index x mode flag (t) is 1 the addressing mode which uses the value of a direction regis- ter as an index the bit-test instruction (bbc or bbs, etc.) to a direction register the read-modify-write instructions (ror, clb, or seb, etc.) to a direction register. use instructions such as ldm and sta, etc., to set the port direc- tion registers. a-d converter the comparator uses capacitive coupling amplifier whose charge will be lost if the clock frequency is too low. therefore, make sure that f(system clock) in the middle/high- speed mode is at least on 500 khz during an a-d conversion. do not execute the stp or wit instruction during an a-d conver- sion. instruction execution time the instruction execution time is obtained by multiplying the fre- quency of the internal clock
1-109 38k0 group user s manual hardware notes on programming definition of a-d conversion accuracy the a-d conversion accuracy is defined below (refer to figure 137). relative accuracy ? 0 to 1. ? 1023 to 1022. ? ? absolute accuracy this means a deviation from the ideal characteristics between 0 to v ref of actual a-d conversion characteristics. v ref 1024 vn: analog input voltage when the output data changes from n to n + 1 (n = 0 to 1022) 1 lsb at relative accuracy 1 lsb at absolute accuracy v ot 1022 analog voltage v ref v 1022 v n v 1 v 0 zero transition voltage (v 0t ) full-scale transition voltage (v fst ) non-linearity error= actual a-d conversion characteristics v n+1 n+1 n 1022 1023 1 0 ideal line of a-d conversion between v 0 to v 1022 output data b a a: 1lsb at relative accuracy b: v n+1 -v n c: difference between the ideal vn and actual vn differential non-linearity error= b-a a [lsb] c c a [lsb] fig. 137 definition of a-d conversion accuracy
hardware 1-110 38k0 group user s manual notes on usage/data required for mask orders notes on usage handling of power source pin in order to avoid a latch-up occurrence, connect a capacitor suit- able for high frequencies as bypass capacitor between power source pin (vcc pin) and gnd pin (vss pin). besides, connect the capacitor to as close as possible. for bypass capacitor which should not be located too far from the pins to be connected, a ce- ramic or electrolytic capacitor of 1.0 the usb specification requires a driver-impedance 28 to 44 ?. ? make 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. usbv ref pin treatment (noise elimination) connect a capacitor between the usbv ref pin and the vss pin. the capacitor should have a 2.2 in vcc = 3.0 to 3.6 v operation, connect the usbv ref pin directly to the vcc pin in order to supply power to the usb port circuit. in addition, you will need to disable the built-in usb reference volt- age circuit in this operation (set bit 4 of the usb control register to 0 .) if you are using the bus powered supply in this condition, the dc-dc converter must be placed outside the mcu. in vcc = 4.00 to 5.25 v operation, do not connect the external dc-dc converter to the usbv ref pin. use the built-in usb refer- ence voltage circuit. flash memory version the cnvss pin is connected to the internal memory circuit block by a low-ohmic resistance, since it has the multiplexed function to be a programmable power source pin (v pp pin) as well. to improve the noise reduction, connect a track between cnvss pin and vss pin or vcc pin with 1 to 10 k ? ? ? ?
1-111 38k0 group user? manual hardware functional description supplement functional description supplement a-d converter a-d conversion is started by setting ad conversion completion bit to ?.?during a-d conversion, internal operations are performed as follows. 1. after the start of a-d conversion, a-d conversion register goes to ?0 16 . 2. the highest-order bit of a-d conversion register is set to ?,?and the comparison voltage vref is input to the comparator. then, v ref is compared with analog input voltage v in . 3. as a result of comparison, when v ref < v in , the highest-order bit of a-d conversion register becomes ?.?when v ref > v in , the highest-order bit becomes ?. by repeating the above operations up to the lowest-order bit of the a-d conversion register, an analog value converts into a digital value. a-d conversion completes at 122 clock cycles (15.25 s at system clock = 8 mhz, through mode) after it is started, and the result of the conversion is stored into the a-d conversion register. concurrently with the completion of a-d conversion, a-d conversion interrupt request occurs, so that the ad conversion interrupt request bit is set to ?. table 16 relative formula for a reference voltage v ref of a-d converter and v ref v ref 1024 ? 1 ? 10: a result of the first comparison to the tenth comparison table 17 change of a-d conversion register during a-d conversion at start of conversion first comparison second comparison third comparison after completion of tenth comparison 0 a result of a-d conversion ? 1 change of a-d conversion register 0 value of comparison voltage (v ref ) v ref 2 v ref 2 v ref 4 v ref 2 v ref 4 v ref 8 when n = 0 v ref = 0 when n = 1 to 1023 v ref = ? n n: value of a-d converter (decimal numeral) v ref 2 v ref 4 v ref 1024 ??? 0 0 000 0 000 1 0 0 00 0 0 0 0 0 10 0 0 0 0 000 ? 1 ? 2 00 0 0 0 0 0 1 ? 1 ? 2 ? 3 ? 4 ? 5 ? 6 ? 7 ? 8 ? 9 ? 10
hardware 1-112 38k0 group user s manual figures 138 shows the a-d conversion equivalent circuit, and fig- ure 139 shows the a-d conversion timing chart. fig. 138 a-d conversion equivalent circuit fig. 139 a-d conversion timing chart functional description supplement v ss v cc v ss v cc an 0 an 1 an 2 an 3 an 4 v ref v ss v ref v in c b1 b0 b2 about 2 kw sampling clock a-d control register built-in d-a converter reference clock chopper amplifier a-d conversion register 2 a-d conversion register 1 ad conversion interrupt request an 5 an 6 an 7 write signal for a-d control register ad conversion completion bit sampling clock
chapter 2 application 2.1 i/o port 2.2 interrupt 2.3 timer 2.4 serial i/o 2.5 usb function 2.6 external bus interface (exb) 2.7 a-d converter 2.8 watchdog timer 2.9 reset 2.10 frequency synthesizer (pll) 2.11 clock generating circuit 2.12 standby function 2.13 flash memory
38k0 group user? manual application 2.1 i/o port 2-2 2.1 i/o port this paragraph explains the registers setting method and the notes related to the i/o ports. 2.1.1 memory map fig. 2.1.1 memory map of registers related to i/o port 0000 16 0001 16 0002 16 0003 16 0004 16 0005 16 0006 16 0007 16 0008 16 0009 16 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 p4 (p4) port p4 direction register (p4d) port p5 (p5) port p5 direction register (p5d) port p6 (p6) port p6 direction register (p6d) port p0 pull-up control register (pull0) port p5 pull-up control register (pull5) 000a 16 000b 16 000c 16 000d 16 0ff0 16 0ff2 16
38k0 group user s manual application 2-3 2.1 i/o port 2.1.2 related registers fig. 2.1.2 structure of port pi (i = 0 to 6) fig. 2.1.3 structure of port pi direction register (i = 0 to 6) port pi b7 b6 b5 b4 b3 b2 b1 b0 b function at reset rw 0 1 2 3 4 5 6 7 name port pi 0 port pi 1 port pi 2 port pi 3 port pi 4 port pi 5 port pi 6 port pi 7 in output mode write read port latch in input mode write : port latch read : value of pins port pi (pi) (i = 0, 1, 2, 3, 4, 5, 6) (note) [address : 00 16 , 02 16 , 04 16 , 06 16, 08 16 , 0a 16 , 0c 16 ] ? ? ? ? ? ? ? ? note: since the following ports are not allocated, the corrrsponding bits can not be used. p4 4 to p4 7 p6 4 to p6 7 port pi direction register b7 b6 b5 b4 b3 b2 b1 b0 b function at reset rw 0 1 2 3 4 5 6 7 name port pi direction register 0 0 0 0 0 0 0 0 port pi direction register (pid) (i = 0, 1, 2, 3, 4, 5, 6) (note) [address : 01 16 , 03 16 , 05 16 , 07 16, 09 16 , 0b 16 , 0d 16 ] 0 : port pi 0 input mode 1 : port pi 0 output mode 0 : port pi 1 input mode 1 : port pi 1 output mode 0 : port pi 2 input mode 1 : port pi 2 output mode 0 : port pi 3 input mode 1 : port pi 3 output mode 0 : port pi 4 input mode 1 : port pi 4 output mode 0 : port pi 5 input mode 1 : port pi 5 output mode 0 : port pi 6 input mode 1 : port pi 6 output mode 0 : port pi 7 input mode 1 : port pi 7 output mode ? ? ? ? ? ? ? ? note: since the following ports are not allocated, the corrrsponding bits can not be used. p4 4 to p4 7 p6 4 to p6 7
38k0 group user? manual application 2.1 i/o port 2-4 fig. 2.1.4 structure of port p0 pull-up control register fig. 2.1.5 structure of port p5 pull-up control register b7 b6 b5 b4 b3 b2 b1 b0 rw 0 0 2 0 3 0 4 0 5 0 6 0 7 0 1 0 p0 0 pul l-up control bit port p0 pull-up control register (pull0) [address : 0ff0 16 ] b function at reset name port p0 pull-up control register 0 : no pull-up 1 : pull-up p0 0 pul l-up control bit 0 : no pull-up 1 : pull-up p0 0 pul l-up control bit 0 : no pull-up 1 : pull-up p0 0 pul l-up control bit 0 : no pull-up 1 : pull-up p0 0 pul l-up control bit 0 : no pull-up 1 : pull-up p0 0 pul l-up control bit 0 : no pull-up 1 : pull-up p0 0 pul l-up control bit 0 : no pull-up 1 : pull-up p0 0 pul l-up control bit 0 : no pull-up 1 : pull-up b7 b6 b5 b4 b3 b2 b1 b0 r w 0 0 2 0 3 0 40 50 60 7 0 1 0 p5 0 pul l-up control bit port p5 pull-up control register (pull5) [address : 0ff2 16 ] b function at reset name port p5 pull-up control register 0 : no pull-up 1 : pull-up p5 2 pul l-up control bit 0 : no pull-up 1 : pull-up nothing is arranged for this bit. this is a write disabled bit. when this bit is read out, the contents are 0 . nothing is arranged for these bits. these are write disabled bits. when these bits are read out, the contents are 0 .
38k0 group user s manual application 2-5 2.1 i/o port 2.1.3 handling of unused pins table 2.1.1 handling of unused pins pins/ports name p0, p1, p2, p3, p4, p5, p6 v ref x out usbv ref tron d0+, d0- handling set to the input mode and connect each to vcc or vss through a resistor of 1 k ? to 10 k ? . set to the output mode and open at l or h level. connect to vss (gnd). open, only when using an external clock. connect to v cc open connect each to vss through a resistor of 1 k ? to 10 k ? .
38k0 group user s manual application 2.1 i/o port 2-6 2.1.4 notes on input and output pins (1) modifying output data with bit managing instruction when the port latch of an i/o port is modified with the bit managing instruction* 1 , the value of the unspecified bit may be changed. reason the bit managing instructions are read-modify-write form instructions for reading and writing data by a byte unit. accordingly, when these instructions are executed on a bit of the port latch of an i/o port, the following is executed to all bits of the port latch. as for a bit which is set for an input port : the pin state is read in the cpu, and is written to this bit after bit managing. as for a bit which is set for an output port : the bit value of the port latch is read in the cpu, and is written to this bit after bit managing. note the following : even when a port which is set as an output port is changed for an input port, its port latch holds the output data. as for a bit of the port latch which is set for an input port, its value may be changed even when not specified with a bit managing instruction in case where the pin state differs from its port latch contents. * 1 bit managing instructions : seb , and clb instructions
38k0 group user s manual application 2-7 2.1 i/o port 2.1.5 termination of unused pins (1) terminate unused pins ? i/o ports : set the i/o ports for the input mode and connect them to v cc or v ss through each resistor of 1 k ? to 10 k ? . with regard to ports which can select the built-in pull-up resistor, the built-in pull- up resistor can be used. set the i/o ports for the output mode and open them at l or h . 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 increase 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 periodically to increase the reliability of program. (2) termination remarks ? i/o ports : do not open in the input mode. reason the power source current may increase depending on the first-stage circuit. an effect due to noise may be easily produced as compared with proper termination shown in (1). ? i/o ports : when setting for the input mode, do not connect to v cc or v ss directly. reason if the direction register setup changes for the output mode because of a program runaway or noise, a short circuit may occur between a port and v cc (or v ss ). ? i/o ports : when setting for the input mode, do not connect multiple ports in a lump to v cc or v ss through a resistor. reason if the direction register setup changes for the output mode because of a program runaway or noise, a short circuit may occur between ports. at the termination of unused pins, perform wiring at the shortest possible distance (20 mm or less) from microcomputer pins.
2-8 38k0 group user s manual application 2.2 interrupt 2.2 interrupt this paragraph explains the registers setting method and the notes related to the interrupt. 2.2.1 memory map fig. 2.2.1 memory map of registers related to interrupt 2.2.2 related registers 003f 16 interrupt control register 1 (icon1) interrupt request register 2 (ireq2) interrupt request register 1 (ireq1) 003e 16 003d 16 003c 16 0ff3 16 interrupt edge selection register (intedge) interrupt control register 2 (icon2) b7 b6 b5 b4 b3 b2 b1 b0 rw 0 0 2 0 3 0 4 0 5 0 6 0 7 0 1 0 usb bus reset interrupt request bit interrupt request register 1 (ireq1) [address : 3c 16 ] b function at reset name interrupt request register 1 usb sof interrupt request bit usb device interrupt request bit exb interrupt request bit int 0 interrupt request bit timer x interrupt request bit timer 1 interrupt request bit timer 2 interrupt request bit 0 : no interrupt request issued 1 : interrupt request issued ? 0 can be set by software, but 1 cannot be set. 0 : no interrupt request issued 1 : interrupt request issued 0 : no interrupt request issued 1 : interrupt request issued 0 : no interrupt request issued 1 : interrupt request issued 0 : no interrupt request issued 1 : interrupt request issued 0 : no interrupt request issued 1 : interrupt request issued 0 : no interrupt request issued 1 : interrupt request issued 0 : no interrupt request issued 1 : interrupt request issued ? ? ? ? ? ? ? ? fig. 2.2.2 structure of interrupt request register 1
38k0 group user s manual application 2-9 2.2 interrupt b7 b6 b5 b4 b3 b2 b1 b0 rw 0 0 2 0 3 0 4 0 5 0 6 0 7 0 1 0 int 1 interrupt request bit interrupt request register 2 (ireq2) [address : 3d 16 ] b function at reset name interrupt request register 2 serial i/o receive interrupt request bit serial i/o transmit interrupt request bit cntr 0 interrupt request bit key-on wake-up interrupt request bit a/d conversion interrupt request bit 0 : no interrupt request issued 1 : interrupt request issued ? 0 can be set by software, but 1 cannot be set. 0 : no interrupt request issued 1 : interrupt request issued 0 : no interrupt request issued 1 : interrupt request issued 0 : no interrupt request issued 1 : interrupt request issued 0 : no interrupt request issued 1 : interrupt request issued 0 : no interrupt request issued 1 : interrupt request issued ? ? ? ? ? ? nothing is arranged for this bits. this is a write disabled bit. when this bit is read out, the contents are 0 . nothing is arranged for this bits. this is a write disabled bit. when this bit is read out, the contents are 0 . fig. 2.2.3 structure of interrupt request register 2 fig. 2.2.4 structure of interrupt control register 1 b7 b6 b5 b4 b3 b2 b1 b0 rw 0 0 2 0 3 0 4 0 5 0 6 0 7 0 1 0 usb bus reset interrupt enable bit interrupt control register 1 (icon1) [address : 3e 16 ] b function at reset name interrupt control register 1 usb sof interrupt enable bit usb device interrupt enable bit exb interrupt enable bit int 0 interrupt enable bit timer x interrupt enable bit timer 1 interrupt enable bit timer 2 interrupt enable bit 0 : interrupt disabled 1 : interrupt enabled 0 : interrupt disabled 1 : interrupt enabled 0 : interrupt disabled 1 : interrupt enabled 0 : interrupt disabled 1 : interrupt enabled 0 : interrupt disabled 1 : interrupt enabled 0 : interrupt disabled 1 : interrupt enabled 0 : interrupt disabled 1 : interrupt enabled 0 : interrupt disabled 1 : interrupt enabled
2-10 38k0 group user? manual application 2.2 interrupt b7 b6 b5 b4 b3 b2 b1 b0 rw 0 0 2 0 3 0 4 0 5 0 6 0 7 0 1 0 int 1 interrupt enable bit interrupt control register 2 (icon2) [address : 3d 16 ] b function at reset name interrupt control register 2 serial i/o receive interrupt enable bit serial i/o transmit interrupt enable bit cntr 0 interrupt enable bit key-on wake-up interrupt enable bit a/d conversion interrupt enable bit fix this bit to 0 . 0 : interrupt disabled 1 : interrupt enabled 0 : interrupt disabled 1 : interrupt enabled 0 : interrupt disabled 1 : interrupt enabled 0 : interrupt disabled 1 : interrupt enabled 0 : interrupt disabled 1 : interrupt enabled fix this bit to 0 . 0 : interrupt disabled 1 : interrupt enabled 0 0 fig. 2.2.5 structure of interrupt control register 2 b7 b6 b5 b4 b3 b2 b1 b0 rw 0 0 2 0 3 0 4 0 5 0 60 7 0 1 0 0 : falling edge active 1 : rising edge active int 0 interrupt edge selection bit interrupt edge selection register (intedge) [address : 0ff3 16 ] b function at reset name nothing is arranged for these bits. these are write disabled bits. when these bits are read out, the contents are 0 . interrupt edge selection register 0 : falling edge active 1 : rising edge active int 1 interrupt edge selection bit nothing is arranged for this bits. this is a write disabled bit. when this bit is read out, the contents are 0 . fig. 2.2.6 structure of interrupt edge selection register
38k0 group user s manual application 2-11 2.2 interrupt 2.2.3 interrupt source the 38k0 group permits interrupts of 15 sources. these are vector interrupts with a fixed priority system. accordingly, when two or more interrupt requests occur during the same sampling, the higher-priority interrupt is accepted first. this priority is determined by hardware, but a variety of priority processing can be performed by software, using an interrupt enable bit and an interrupt disable flag. for interrupt sources, vector addresses and interrupt priority, refer to table 2.2.1. table 2.2.1 interrupt sources, vector addresses and priority of 38k0 group remarks low fffc 16 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 high fffd 16 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 notes 1: vector addresses contain interrupt jump destination addresses. 2: reset function in the same way as an interrupt with the highest priority. 3 : nothing is arranged in these vector addresses. 4 : fix bit 1 of interrupt control register 2 (address 003f 16 ) to 0 . vector addresses (note 1) non-maskable valid when usb mode valid when usb mode valid when usb mode valid when external bus is selected external interrupt (active edge selectable) stp release timer underflow external interrupt (active edge selectable) (note 4) valid when serial i/o is selected valid when serial i/o is selected external interrupt (active edge selectable) external interrupt (active edge selectable) non-maskable software interrupt interrupt source reset (note 2) usb bus reset usb sof usb device external bus int 0 timer x timer 1 timer 2 int 1 (note 3) serial i/o reception serial i/o transmission cntr 0 key-on wake up a-d conversion brk instruction priority 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 interrupt request generating conditions at reset at detection of usb bus reset signal (2.5 s interval se0) at detection of usb sof signal at detection of resume signal (k state or se0) or suspend signal (3 ms interval bus idle), or at completion of transaction at completion of reception or transmission or at completion of dma transmission at detection of either rising or falling edge of int 0 input at timer x underflow at timer 1 underflow at timer 2 underflow at detection of either rising or falling edge of int 1 input (note 4) at completion of serial i/o data reception at completion of serial i/o data transmission at detection of either rising or falling edge of cntr 0 input at falling of conjunction of input level for port p0 (at input mode) at completion of a-d conversion at brk instruction execution
2-12 38k0 group user s manual application 2.2 interrupt 2.2.4 interrupt operation when an interrupt request is accepted, the contents of the following registers just before acceptance of the interrupt requests is automatically pushed onto the stack area in the order of ? , ? and ? . ? high-order contents of program counter (pc h ) ? low-order contents of program counter (pc l ) ? contents of processor status register (ps) after the contents of the above registers are pushed onto the stack area, the accepted interrupt vector address enters the program counter and consequently the interrupt processing routine is executed. when the rti instruction is executed at the end of the interrupt processing routine, the contents of the above registers pushed onto the stack area are restored to the respective registers in the order of ? , ? and ? ; and the microcomputer resumes the processing executed just before acceptance of the interrupts. figure 2.2.7 shows an interrupt operation diagram. fig. 2.2.7 interrupt operation diagram i n t e r r u p t o c c u r s ( a c c e p t i n g i n t e r r u p t r e q u e s t ) e x e c u t i n g r o u t i n e s u s p e n d e d o p e r a t i o n r e s u m e p r o c e s s i n g : operation commanded by software : i n t e r n a l o p e r a t i o n p e r f o r m e d a u t o m a t i c a l l y contents of program counter (high-order) are pushed onto stack contents of program counter (low-order) are pushed onto stack contents of processor status register are pushed onto stack 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 a r e p o p p e d f r o m s t a c k contents of program counter (low-order) are popped from stack contents of program counter (high-order) are popped from stack r t i i n s t r u c t i o n i n t e r r u p t p r o c e s s i n g r o u t i n e
38k0 group user s manual application 2-13 2.2 interrupt (1) processing upon acceptance of interrupt request upon acceptance of an interrupt request, the following operations are automatically performed. ? the processing being executed is stopped. ? the contents of the program counter and the processor status register are pushed onto the stack area. figure 2.2.8 shows the changes of the stack pointer and the program counter upon acceptance of an interrupt request. ? concurrently with the push operation, the jump destination address (the beginning address of the interrupt processing routine) of the occurring interrupt stored in the vector address is set in the program counter, then the interrupt processing routine is executed. ? after the interrupt processing routine is started, the corresponding interrupt request bit is automatically cleared to 0 . the interrupt disable flag is set to 1 so that multiple interrupts are disabled. accordingly, for executing the interrupt processing routine, it is necessary to set the jump destination address in the vector area corresponding to each interrupt. fig. 2.2.8 changes of stack pointer and program counter upon acceptance of interrupt request interrupt disable flag = 0 p r o g r a m c o u n t e r stack pointer program counter (low-order) p r o g r a m c o u n t e r ( h i g h - o r d e r ) pc l p c h ( s ) s p r o g r a m c o u n t e r s t a c k p o i n t e r pc l p c h (s) 3 s vector address (from interrupt vector area) i n t e r r u p t d i s a b l e f l a g = 1 interrupt request is accepted s t a c k a r e a (s) processor status register p r o g r a m c o u n t e r ( l o w - o r d e r ) program counter (high-order) (s) ( s ) 3 s t a c k a r e a
2-14 38k0 group user s manual application 2.2 interrupt (2) timing after acceptance of interrupt request the interrupt processing routine begins with the machine cycle following the completion of the instruction that is currently being executed. figure 2.2.9 shows the time up to execution of interrupt processing routine and figure 2.2.10 shows the timing chart after acceptance of interrupt request. fig. 2.2.10 timing chart after acceptance of interrupt request fig. 2.2.9 time up to execution of interrupt processing routine interrupt request generated main routine interrupt processing routine 7 to 23 cycles (when f(x in ) = 6 mhz; system clock 8 mhz /through mode (8 mhz), 0.875 s to 2.875 s) 2 cycles 5 cycles start of interrupt processing 0 to 16 cycles waiting time for post-processing of pipeline stack push and vector fetch ? ? when executin g div instruction p c h p c l ps a l a h s , s p s s-2, sps s-1, sps p c b l b h a l , a h : c p u o p e r a t i o n c o d e f e t c h c y c l e (t h i s i s a n i n t e r n a l s i g n a l t h a t c a n n o t b e o b s e r v e d f r o m t h e e x t e r n a l u n i t . ) : v e c t o r a d d r e s s o f e a c h i n t e r r u p t : j u m p d e s t i n a t i o n a d d r e s s o f e a c h i n t e r r u p t : 0 0 1 6 o r 0 1 1 6 s y n c b l , b h a l , a h s p s data bus n o t u s e d a d d r e s s b u s s y n c r d w r
38k0 group user s manual application 2-15 2.2 interrupt 2.2.5 interrupt control the acceptance of all interrupts, excluding the brk instruction interrupt, can be controlled by the interrupt request bit, interrupt enable bit, and an interrupt disable flag, as described in detail below. figure 2.2.11 shows an interrupt control diagram. fig. 2.2.11 interrupt control diagram the interrupt request bit, interrupt enable bit and interrupt disable flag function independently and do not affect each other. an interrupt is accepted when all the following conditions are satisfied. interrupt request bit .......... 1 interrupt enable bit ........... 1 interrupt disable flag ........ 0 though the interrupt priority is determined by hardware, a variety of priority processing can be performed by software using the above bits and flag. table 2.2.2 shows a list of interrupt control bits according to the interrupt source. (1) interrupt request bits the interrupt request bits are allocated to the interrupt request register 1 (address 3c 16 ) and interrupt request register 2 (address 3d 16 ). the occurrence of an interrupt request causes the corresponding interrupt request bit to be set to 1 . the interrupt request bit is held in the 1 state until the interrupt is accepted. when the interrupt is accepted, this bit is automatically cleared to 0 . each interrupt request bit can be set to 0 , but cannot be set to 1 , by software. (2) interrupt enable bits the interrupt enable bits are allocated to the interrupt control register 1 (address 003e 16 ) and the interrupt control register 2 (address 3f 16 ). the interrupt enable bits control the acceptance of the corresponding interrupt request. when an interrupt enable bit is 0 , the corresponding interrupt request is disabled. if an interrupt request occurs when this bit is 0 , the corresponding interrupt request bit is set to 1 but the interrupt is not accepted. in this case, unless the interrupt request bit is set to 0 by software, the interrupt request bit remains in the 1 state. when an interrupt enable bit is 1 , the corresponding interrupt is enabled. if an interrupt request occurs when this bit is 1 , the interrupt is accepted (when interrupt disable flag = 0 ). each interrupt enable bit can be set to 0 or 1 by software. 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 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
2-16 38k0 group user s manual application 2.2 interrupt (3) interrupt disable flag the interrupt disable flag is allocated to bit 2 of the processor status register. the interrupt disable flag controls the acceptance of interrupt request except brk instruction. when this flag is 1 , the acceptance of interrupt requests is disabled. when the flag is 0 , the acceptance of interrupt requests is enabled. this flag is set to 1 with the sei instruction and is set to 0 with the cli instruction. when a main routine branches to an interrupt processing routine, this flag is automatically set to 1 , so that multiple interrupts are disabled. to use multiple interrupts, set this flag to 0 with the cli instruction within the interrupt processing routine. figure 2.2.12 shows an example of multiple interrupts. table 2.2.2 list of interrupt bits according to interrupt source usb bus reset usb sof usb device external bus int 0 timer x timer 1 timer 2 int 1 serial i/o receive serial i/o transmit cntr 0 key-on wake-up a-d converter interrupt enable bit address 003e 16 003e 16 003e 16 003e 16 003e 16 003e 16 003e 16 003e 16 003f 16 003f 16 003f 16 003f 16 003f 16 003f 16 bit b0 b1 b2 b3 b4 b5 b6 b7 b0 b2 b3 b4 b5 b6 interrupt request bit address 003c 16 003c 16 003c 16 003c 16 003c 16 003c 16 003c 16 003c 16 003d 16 003d 16 003d 16 003d 16 003d 16 003d 16 bit b0 b1 b2 b3 b4 b5 b6 b7 b0 b2 b3 b4 b5 b6 interrupt source
38k0 group user s manual application 2-17 2.2 interrupt fig. 2.2.12 example of multiple interrupts reset i = 1 i n t e r r u p t 1 i = 1 i = 0 i = 1 rti i n t e r r u p t r e q u e s t 1 i n t e r r u p t r e q u e s t nesting t i m e multiple interrupt c1 = 1 c2 = 1 i = 0 i n t e r r u p t r e q u e s t 2 m a i n r o u t i n e i n t e r r u p t 2 r t i : i n t e r r u p t d i s a b l e f l a g : i n t e r r u p t e n a b l e b i t o f i n t e r r u p t 1 : i n t e r r u p t e n a b l e b i t o f i n t e r r u p t 2 : s e t a u t o m a t i c a l l y . : s e t b y s o f t w a r e . i c1 c2 i = 0 i = 0 c 1 = 0 , c 2 = 0
2-18 38k0 group user s manual application 2.2 interrupt 2.2.6 int interrupt the int interrupt requests is generated when the microcomputer detects a level change of each int pin (int 0 , int 1 ). (1) active edge selection int 0 and int 1 can be selected from either a falling edge or rising edge detection as an active edge by the interrupt edge selection register. in the 0 state, the falling edge of the corresponding pin is detected. in the 1 state, the rising edge of the corresponding pin is detected.
38k0 group user s manual application 2-19 2.2 interrupt 2.2.7 key input interrupt a key input interrupt request is generated by applying l level to any port p0 pin that has been set to the input mode. in other words, it is generated when and of the input level goes from 1 to 0 . (1) connection example when key input interrupt is used when using the key input interrupt, compose an active-low key matrix which inputs to port p0. figure 2.2.13 shows a connection example and the port p0 block diagram when using a key input interrupt. in the connection example in figure 2.2.13, a key input interrupt request is generated by pressing one of the keys corresponding to ports p0 0 to p0 3 . fig. 2.2.13 connection example and port p0 block diagram when using key input interrupt ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? p o r t p 0 0 l a t c h port p0 0 direction register = 0 port p0 1 latch port p0 1 direction register = 0 p o r t p 0 2 l a t c h port p0 2 direction register = 0 port p0 3 latch port p0 3 direction register = 0 p o r t p 0 4 l a t c h port p0 4 direction register = 1 p o r t p 0 5 l a t c h port p0 5 direction register = 1 p o r t p 0 6 l a t c h port p0 6 direction register = 1 p o r t p 0 7 l a t c h port p0 7 direction register = 1 p 0 0 i n p u t p 0 1 i n p u t p 0 2 i n p u t p 0 3 i n p u t p0 4 output p0 5 output p 0 6 o u t p u t p0 7 output pull 0 register bit 7 = 0 p o r t p 0 i n p u t r e a d i n g c i r c u i t p o r t p x x l l e v e l o u t p u t ? p-channel transistor for pull-up ? ? cmos output buffer k e y i n p u t i n t e r r u p t r e q u e s t pull 0 register bit 6 = 0 pull 0 register bit 5 = 0 pull 0 register bit 4 = 0 pull 0 register bit 3 = 1 pull 0 register bit 2 = 1 pull 0 register bit 1 = 1 pull 0 register bit 0 = 1
2-20 38k0 group user s manual application 2.2 interrupt (2) related registers setting figure 2.2.14 shows the related registers setting (corresponding to figure 2.2.13). fig. 2.2.14 registers setting related to key input interrupt (corresponding to figure 2.2.13) p0d 0 10 1 ireq2 b0 b7 b0 b7 key-on wake-up interrupt request port p0 direction register (address 01 16 ) bits corresponding to p0 7 to p0 0 interrupt request register 2 (address 3d 16 ) 1 pull0 1 b0 b7 port p0 pull-up control register (address 0ff0 16 ) p0 0 to p0 3 pull-up 10 0 icon2 b0 b7 interrupt control register 2 (address 3f 16 ) 0 ke y -on wake-u p interru p t: enabled 0: input port 1: output port 1 11 0 1 0
38k0 group user? manual application 2-21 2.2 interrupt 2.2.8 notes on interrupts (1) change of relevant register settings when the setting of the following registers or bits is changed, the interrupt request bit may be set to ?? when not requiring the interrupt occurrence synchronized with these setting, take the following sequence. ?nterrupt edge selection register (address 0ff3 16 ) ?imer x mode register (address 23 16 ) set the above listed registers or bits as the following sequence. fig. 2.2.15 sequence of changing relevant register  reason when setting the following, the interrupt request bit may be set to ?? ?hen setting external interrupt active edge concerned register: interrupt edge selection register (address 0ff3 16 ) timer x mode register (address 23 16 ) set the corresponding interrupt enable bit to ? (disabled) . set the interrupt edge select bit (active edge switch bit) or the interrupt (source) select bit to ?? nop (one or more instructions) set the corresponding interrupt request bit to ? (no interrupt request issued). set the corresponding interrupt enable bit to ? (enabled).
2-22 38k0 group user? manual application 2.2 interrupt (2) check of interrupt request bit  when executing the bbc or bbs instruction to an interrupt request bit of an interrupt request register immediately after this bit is set to ??by using a data transfer instruction, execute one or more instructions before executing the bbc or bbs instruction. clear the interrupt request bit to ??(no interrupt issued) nop (one or more instructions) execute the bbc or bbs instruction data transfer instruction: ldm, lda, sta, stx, and sty instructions fig. 2.2.16 sequence of check of interrupt request bit  reason if the bbc or bbs instruction is executed immediately after an interrupt request bit of an interrupt request register is cleared to ?? the value of the interrupt request bit before being cleared to ? is read.
38k0 group user s manual application 2-23 2.3 timer 2.3 timer this paragraph explains the registers setting method and the notes related to the timers. 2.3.1 memory map fig. 2.3.1 memory map of registers related to timers 2.3.2 related registers fig. 2.3.2 structure of prescaler 12, prescaler x 0020 16 0021 16 0022 16 0023 16 0024 16 0025 16 prescaler 12 (pre12) timer 1 (t1) timer 2 (t2) timer x mode register (tm) prescaler x (prex) timer x (tx) 003c 16 003e 16 interrupt control register 1 (icon1) 003d 16 003f 16 interrupt request register 1 (ireq1) interrupt request register 2 (ireq2) interrupt control register 2 (icon2) prescaler 12, prescaler x b7 b6 b5 b4 b3 b2 b1 b0 b function at reset rw 0 1 2 3 4 5 6 7 name 1 1 1 1 1 1 1 1 prescaler 12 (pre12) [address : 20 16 ] prescaler x (prex) [address : 24 16 ] set a count value of each prescaler. the value set in this register is written to both each prescaler and the corresponding prescaler latch at the same time. when this register is read out, the count value of the corres- ponding prescaler is read out.
2-24 38k0 group user s manual application 2.3 timer fig. 2.3.3 structure of timer 1 fig. 2.3.4 structure of timer 2, timer x timer 1 b7 b6 b5 b4 b3 b2 b1 b0 b function at reset rw 0 1 2 3 4 5 6 7 name 1 0 0 0 0 0 0 0 timer 1 (t1) [address : 21 16 ] set a count value of timer 1. the value set in this register is written to both timer 1 and timer 1 latch at the same time. when this register is read out, the timer 1 s count value is read out. timer 2, timer x b7 b6 b5 b4 b3 b2 b1 b0 b function at reset rw 0 1 2 3 4 5 6 7 name 1 1 1 1 1 1 1 1 timer 2 (t2) [address : 22 16 ] timer x (tx) [address : 25 16 ] set a count value of each timer. the value set in this register is written to both each timer and each timer latch at the same time. when this register is read out, each timer s count value is read out.
38k0 group user? manual application 2-25 2.3 timer fig. 2.3.5 structure of timer x mode register timer x operation modes timer mode pulse output mode event counter mode pulse width measurement mode cntr 0 active edge selection bit (bits 2 of address 23 16 ) contents ? cntr 0 interrupt request occurrence: falling edge ; no influence to timer count ? cntr 0 interrupt request occurrence: rising edge ; no influence to timer count ? pulse output start: beginning at ??level cntr 0 interrupt request occurrence: falling edge ? pulse output start: beginning at ??level cntr 0 interrupt request occurrence: rising edge ? timer x: rising edge count cntr 0 interrupt request occurrence: falling edge ? timer x: falling edge count cntr 0 interrupt request occurrence: rising edge ? timer x: ??level width measurement cntr 0 interrupt request occurrence: falling edge ? timer x: ??level width measurement cntr 0 interrupt request occurrence: rising edge table 2.3.1 cntr 0 active edge selection bit function b7 b6 b5 b4 b3 b2 b1 b0 b function at reset rw 0 2 3 4 5 6 7 name 0 0 0 timer x mode register (tm) [address : 23 16 ] timer x mode register 0 0 0 : timer mode 0 1 : pulse output mode 1 0 : event counter mode 1 1 : pulse width measurement mode b1 b0 1 0 timer x operating mode bits cntr 0 active edge selection bit the function depends on the operating mode of timer x. (refer to table 2.3.1) timer x count stop bit 0 : count start 1 : count stop nothing is arranged for these bits. these are write disabled bits. when these bits are read out, the contents are 0 . 0 0 0
2-26 38k0 group user s manual application 2.3 timer fig. 2.3.6 structure of interrupt request register 1 fig. 2.3.7 structure of interrupt request register 2 b7 b6 b5 b4 b3 b2 b1 b0 rw 0 0 2 0 3 0 4 0 5 0 6 0 7 0 1 0 usb bus reset interrupt request bit interrupt request register 1 (ireq1) [address : 3c 16 ] b function at reset name interrupt request register 1 usb sof interrupt request bit usb device interrupt request bit exb interrupt request bit int 0 interrupt request bit timer x interrupt request bit timer 1 interrupt request bit timer 2 interrupt request bit 0 : no interrupt request issued 1 : interrupt request issued ? 0 can be set by software, but 1 cannot be set. 0 : no interrupt request issued 1 : interrupt request issued 0 : no interrupt request issued 1 : interrupt request issued 0 : no interrupt request issued 1 : interrupt request issued 0 : no interrupt request issued 1 : interrupt request issued 0 : no interrupt request issued 1 : interrupt request issued 0 : no interrupt request issued 1 : interrupt request issued 0 : no interrupt request issued 1 : interrupt request issued ? ? ? ? ? ? ? ? b7 b6 b5 b4 b3 b2 b1 b0 rw 0 0 2 0 3 0 4 0 5 0 6 0 7 0 1 0 int 1 interrupt request bit interrupt request register 2 (ireq2) [address : 3d 16 ] b function at reset name interrupt request register 2 serial i/o receive interrupt request bit serial i/o transmit interrupt request bit cntr 0 interrupt request bit key-on wake-up interrupt request bit a/d conversion interrupt request bit 0 : no interrupt request issued 1 : interrupt request issued ? 0 can be set by software, but 1 cannot be set. 0 : no interrupt request issued 1 : interrupt request issued 0 : no interrupt request issued 1 : interrupt request issued 0 : no interrupt request issued 1 : interrupt request issued 0 : no interrupt request issued 1 : interrupt request issued 0 : no interrupt request issued 1 : interrupt request issued ? ? ? ? ? ? nothing is arranged for this bits. this is a write disabled bit. when this bit is read out, the contents are 0 . nothing is arranged for this bits. this is a write disabled bit. when this bit is read out, the contents are 0 .
38k0 group user s manual application 2-27 2.3 timer fig. 2.3.8 structure of interrupt control register 1 fig. 2.3.9 structure of interrupt control register 2 b7 b6 b5 b4 b3 b2 b1 b0 rw 0 0 2 0 3 0 4 0 5 0 6 0 7 0 1 0 usb bus reset interrupt enable bit interrupt control register 1 (icon1) [address : 3e 16 ] b function at reset name interrupt control register 1 usb sof interrupt enable bit usb device interrupt enable bit exb interrupt enable bit int 0 interrupt enable bit timer x interrupt enable bit timer 1 interrupt enable bit timer 2 interrupt enable bit 0 : interrupt disabled 1 : interrupt enabled 0 : interrupt disabled 1 : interrupt enabled 0 : interrupt disabled 1 : interrupt enabled 0 : interrupt disabled 1 : interrupt enabled 0 : interrupt disabled 1 : interrupt enabled 0 : interrupt disabled 1 : interrupt enabled 0 : interrupt disabled 1 : interrupt enabled 0 : interrupt disabled 1 : interrupt enabled b7 b6 b5 b4 b3 b2 b1 b0 rw 0 0 2 0 3 0 4 0 5 0 6 0 7 0 1 0 int 1 interrupt enable bit interrupt control register 2 (icon2) [address : 3d 16 ] b function at reset name interrupt control register 2 serial i/o receive interrupt enable bit serial i/o transmit interrupt enable bit cntr 0 interrupt enable bit key-on wake-up interrupt enable bit a/d conversion interrupt enable bit fix this bit to 0 . 0 : interrupt disabled 1 : interrupt enabled 0 : interrupt disabled 1 : interrupt enabled 0 : interrupt disabled 1 : interrupt enabled 0 : interrupt disabled 1 : interrupt enabled 0 : interrupt disabled 1 : interrupt enabled fix this bit to 0 . 0 : interrupt disabled 1 : interrupt enabled 0 0
2-28 38k0 group user s manual application 2.3 timer 2.3.3 timer application examples (1) basic functions and uses [function 1] control of event interval (timer x, timer 1, timer 2) when a certain time, by setting a count value to each timer, has passed, the timer interrupt request occurs. generation of an output signal timing generation of a wait time [function 2] control of cyclic operation (timer x, timer 1, timer 2) the value of the timer latch is automatically written to the corresponding timer each time the timer underflows, and each timer interrupt request occurs in cycles. generation of cyclic interrupts clock function (measurement of 10 ms); see application example 1 control of a main routine cycle [function 3] output of rectangular waveform (timer x) the output level of the cntr 0 pin is inverted each time the timer underflows (in the pulse output mode). piezoelectric buzzer output; see application example 2 generation of the remote control carrier waveforms [function 4] count of external pulses (timer x) external pulses input to the cntr 0 pin are counted as the timer count source (in the event counter mode). frequency measurement; see application example 3 division of external pulses generation of interrupts due to a cycle using external pulses as the count source; count of a reel pulse [function 5] measurement of external pulse width (timer x) the h or l level width of external pulses input to cntr 0 pin is measured (in the pulse width measurement mode). measurement of external pulse frequency (measurement of pulse width of fg pulse ? for a motor); see application example 4 measurement of external pulse duty (when the frequency is fixed) fg pulse ? : pulse used for detecting the motor speed to control the motor speed.
38k0 group user s manual application 2-29 2.3 timer tm 0 0 1 prex 29 tx 124 b0 b7 b0 b7 b0 b7 timer x mode register (address 23 16 ) timer x operating mode: timer mode timer x count: stop clear to 0 when starting count. prescaler x (address 24 16 ) timer x (address 25 16 ) set division ratio 1 icon1 timer x interrupt: enabled 1 b0 b7 interrupt control register 1 (address 3e 16 ) ireq1 b0 b7 interrupt request register 1 (address 3c 16 ) timer x interrupt request (becomes 1 at 10 ms intervals) 0 fig. 2.3.11 related registers setting (2) timer application example 1: clock function (measurement of 10 ms) outline : the input clock is divided by the timer so that the clock can count up at 10 ms intervals. specifications : the clock f(x in ) = 6 mhz is divided by the timer. the clock is counted up in the process routine of the timer x interrupt which occurs at 10 ms intervals. figure 2.3.10 shows the timers connection and setting of division ratios; figure 2.3.11 shows the related registers setting; figure 2.3.12 shows the control procedure. fig. 2.3.10 timers connection and setting of division ratios f(x in ) = 6 mhz 10 ms 1/16 1/30 1/125 1/100 1 second dividing by 100 with software fixed prescaler x timer x timer x interrupt request bit 0 or 1 0 : no interrupt request issued 1 : interru p t re q uest issued
2-30 38k0 group user s manual application 2.3 timer fig. 2.3.12 control procedure reset initialization main processing ..... clock stop ? n y rti tm (address 23 16 ), bit3 1 prex (address 24 16 ) 30 1 tx (address 25 16 ) 125 1 ireq1 (address 3c 16 ), bit5 0 tm (address 23 16 ), bit3 0 clt ( note 2 ) cld ( note 3 ) push registers to stack ( note 1 ) timer x interrupt process routine clock count up (1/100 second to year) pop registers all interrupts disabled timer x operating mode : timer mode timer x interrupt request bit cleared timer x interrupt enabled division ratio 1 set to prescaler x and timer x timer x count start interrupts enabled timer x count stop timer reset to restart count from 0 second after completion of clock set timer x count start note 2 : when using index x mode flag (t) note 3 : when using decimal mode flag (d) push registers used in interrupt process routine judgment whether clock stops clock counted up pop registers pushed to stack x: this bit is not used here. set it to 0 or 1 arbitrarily. note 1 : perform procedure for completion of clock set only when completing clock set. sei tm (address 23 16 ) xxxx1x00 2 ireq1 (address 3c 16 ) xx0xxxxx 2 icon1 (address 3e 16 ), bit5 1 prex (address 24 16 ) 30 1 tx (address 25 16 ) 125 1 tm (address 23 16 ), bit3 0 cli
38k0 group user s manual application 2-31 2.3 timer (3) timer application example 2: piezoelectric buzzer output outline : the rectangular waveform output function of the timer is applied for a piezoelectric buzzer output. specifications : the rectangular waveform, dividing the clock f(x in ) = 6 mhz into about 2 khz (2038 hz), is output from the p5 1 /cntr 0 pin. the level of the p5 1 /cntr 0 pin is fixed to h while a piezoelectric buzzer output stops. figure 2.3.13 shows a peripheral circuit example, and figure 2.3.14 shows the timers connection and setting of division ratios. figures 2.3.15 shows the related registers setting, and figure 2.3.16 shows the control procedure. fig. 2.3.13 peripheral circuit example fig. 2.3.14 timers connection and setting of division ratios 38k0 group p5 1 /cntr 0 pipipi..... 245 s cntr 0 output the h level is output while a piezoelectric buzzer output stops. 245 s set a division ratio so that the underflow output period of the timer x can be 245 s. 1/16 1/92 1/2 cntr 0 1 f(x in ) = 6 mhz fixed prescaler x timer x fixed
2-32 38k0 group user s manual application 2.3 timer fig. 2.3.15 related registers setting fig. 2.3.16 control procedure tm tx 91 1 0 0 1 prex 0 b0 b7 b0 b7 b0 b7 timer x mode register (address 23 16 ) timer x operating mode: pulse output mode timer x count: stop clear to 0 when starting count. prescaler x (address 24 16 ) timer x (address 25 16 ) set division ratio 1 . cntr 0 active edge selection: output starting at h level reset p5 p5d icon1 tm tx prex 1 ..... ..... ..... 0 xxxx 1001 2 92 1 1 1 ..... output unit tm (address 23 16 ), bit3 0 (address 0a 16 ), bit1 (address 0b 16 ) (address 3e 16 ), bit4 (address 23 16 ) (address 25 16 ) (address 24 16 ) tm (address 23 16 ), bit3 1 tx (address 25 16 ) 92 1 initialization x: this bit is not used here. set it to 0 or 1 arbitrarily. xxx x xx 1 x2 main processing piezoelectric buzzer request ? yes piezoelectric buzzer output start stop piezoelectric buzzer output no timer x interrupt disabled cntr 0 output stop; piezoelectric buzzer output stop division ratio 1 set to timer x and prescaler x processing piezoelectric buzzer request, generated during main processing, in output unit
38k0 group user s manual application 2-33 2.3 timer (4) timer application example 3: frequency measurement outline : the following two values are compared to judge whether the frequency is within a valid range. a value by counting pulses input to p5 1 /cntr 0 pin with the timer. a reference value specifications : the pulse is input to the p5 1 /cntr 0 pin and counted by the timer x. a count value is read out at about 2 ms intervals, the timer 1 interrupt interval. when the count value is 28 to 40, it is judged that the input pulse is valid. because the timer is a down-counter, the count value is compared with 227 to 215 (note). note : 227 to 215 = {255 (initial value of counter) 28} to {255 40}; 28 to 40 means the number of valid value. figure 2.3.17 shows the judgment method of valid/invalid of input pulses; figure 2.3.18 shows the related registers setting; figure 2.3.19 shows the control procedure. fig. 2.3.17 judgment method of valid/invalid of input pulses input pulse 2 ms 71.4 s = 28 counts ...... 71.4 s or more (14 khz or less) 71.4 s (14 khz) 50 s (20 khz) 50 s or less (20 khz or more) invalid valid invalid 2 ms 50 s = 40 counts ...... ......
2-34 38k0 group user s manual application 2.3 timer fig. 2.3.18 related registers setting tm pre12 2 t1 10 1 1 prex tx 249 0 255 icon1 0 ireq1 0 b0 b7 b0 b7 b0 b7 b0 b7 b0 b7 b0 b7 b0 b7 timer x interrupt: disabled timer 1 interrupt: enabled timer x mode register (address 23 16 ) timer x operating mode: event counter mode timer x count: stop clear to 0 when starting count. prescaler 12 (address 20 16 ) timer x (address 25 16 ) set division ratio 1 . interrupt control register 1 (address 3e 16 ) cntr 0 active edge selection: falling edge count prescaler x (address 24 16 ) timer 1 (address 21 16 ) interrupt request register 1 (address 3c 16 ) judge timer x interrupt request bit. ( 1 of this bit when reading the count value indicates the 256 or more p ulses in p ut in the condition of timer x = 255 ) set 255 just before counting pulses. (after a certain time has passed, the number of input pulses is decreased from this value.) 1
38k0 group user s manual application 2-35 2.3 timer fig. 2.3.19 control procedure reset ..... ..... ireq1(address 3c 16 ), bit5 ? 0 1 rti ..... tx (address 25 16 ) 214 < (a) < 228 fpulse 0 x: this bit is not used here. set it to 0 or 1 arbitrary. all interrupts disabled timer x operating mode : event counter mode (count a falling edge of pulses input from cntr 0 pin.) division ratio set so that timer 1 interrupt will occur at 2 ms intervals. timer x count start interrupts enabled note 1 : when using index x mode flag (t) note 2 : when using decimal mode flag (d) push registers used in interrupt process routine pop registers pushed to stack counter value initialized timer x interrupt request bit cleared initialization timer 1 interrupt enabled timer 1 interrupt process routine clt ( note 1 ) cld ( note 2 ) push registers to stack processing as out of range when the count value is 256 or more count value read count value into accumulator (a) stored in range out of range read value with reference value compared comparison result to flag fpulse stored process judgment result pop registers sei tm (address 23 16 ) xxxx 1110 2 pre12 (address 20 16 ) 3 1 t1 (address 21 16 ) 250 1 prex (address 24 16 ) 1 1 tx (address 25 16 ) 256 1 icon1 (address 3e 16 ), bit6 1 tm (address 23 16 ), bit3 0 cli fpulse 1 tx (address 25 16 ) 256 1 ireq1 (address 3c 16 ), bit5 0 (a)
2-36 38k0 group user s manual application 2.3 timer (5) timer application example 4: measurement of fg pulse width for motor outline : the timer x counts the h level width of the pulses input to the p5 1 /cntr 0 pin. an underflow is detected by the timer x interrupt and an end of the input pulse h level is detected by the cntr 0 interrupt. specifications : the timer x counts the h level width of the fg pulse input to the p5 1 /cntr 0 pin. when the clock frequency is 6 mhz, the count source is 2.67 s, which is obtained by dividing the clock frequency by 16. measurement can be performed to 175 ms in the range of ffff 16 to 0000 16 . figure 2.3.20 shows the timers connection and setting of division ratio; figure 2.3.21 shows the related registers setting; figure 2.3.22 shows the control procedure. fig. 2.3.20 timers connection and setting of division ratios 175 ms 1/16 1/256 1/256 f(x in ) = 6 mhz fixed prescaler x timer x timer x interrupt request bit 0 : no interrupt request issued 1 : interrupt request issued 0 or 1
38k0 group user s manual application 2-37 2.3 timer fig. 2.3.21 related registers setting tm prex 255 tx 01 1 1 255 icon1 ireq1 1 0 b0 b7 b0 b7 b0 b7 b0 b7 b0 b7 timer x interrupt: enabled timer x mode register (address 23 16 ) timer x operating mode: pulse width measurement mode timer x count: stop clear to 0 when starting count. prescaler x (address 24 16 ) timer x (address 25 16 ) set division ratio 1 . interrupt control register 1 (address 3e 16 ) cntr 0 active edge selection: h level width measurement cntr 0 interrupt: enabled interrupt request register 1 (address 3c 16 ) timer x interrupt request (set to 1 automatically when timer x underflows) icon2 1 b0 b7 interrupt control register 2 (address 3f 16 ) ireq2 0 b0 b7 interrupt request register 2 (address 3d 16 ) cntr 0 interrupt request ( set to 1 automaticall y when h level in p ut came to the end )
2-38 38k0 group user s manual application 2.3 timer fig. 2.3.22 control procedure reset ..... ..... ..... rti rti (a) prex low-order 8-bit result of inverted (a) pulse width measurement (a) tx high-order 8-bit result of inverted (a) pulse width measurement prex (address 24 16 ) 256 1 tx (address 25 16 ) 256 1 all interrupts disabled timer x operating mode : pulse width measurement mode (measure h level of pulses input from cntr 0 pin.) set division ratio so that timer x interrupt will occur at 175 ms intervals. timer x interrupt request bit cleared timer x interrupt enabled cntr 0 interrupt request bit cleared cntr 0 interrupt enabled timer x count start interrupts enabled note 1 : when using index x mode flag (t) note 2 : when using decimal mode flag (d) push registers used in interrupt process routine pop registers pushed to stack pop registers initialization timer x interrupt process routine clt ( note 1 ) cld ( note 2 ) push registers to stack process errors error occurs cntr 0 interrupt process routine division ratio set so that timer x interrupt will occur at 175 ms intervals. read the count value and store it to ram x: this bit is not used here. set it to 0 or 1 arbitrarily. sei tm (address 23 16 ) xxxx 1011 2 prex (address 24 16 ) 256 1 tx (address 25 16 ) 256 1 ireq1 (address 3c 16 ), bit5 0 icon1 (address 3e 16 ), bit5 1 ireq2 (address 3d 16 ), bit4 0 icon2 (address 3f 16 ), bit4 1 tm (address 23 16 ), bit3 0 cli
38k0 group user s manual application 2-39 2.3 timer 2.3.4 notes on timer if a value n (between 0 and 255) is written to a timer latch, the frequency division ratio is 1/(n+1). when switching the count source by the timer x count source selection bit, the value of timer count is altered in unconsiderable amount owing to generating of a thin pulses in the count input signals. therefore, select the timer count source before set the value to the prescaler and the timer.
2-40 38k0 group user s manual application 2.4 serial i/o 2.4 serial i/o this paragraph explains the registers setting method and the notes related to the serial i/o. 2.4.1 memory map fig. 2.4.1 memory map of registers related to serial i/o 0026 16 0027 16 0fe0 16 0fe1 16 0fe2 16 transmit/receive buffer register (tb/rb) serial i/o status register (siosts) uart control register (uartcon) ~ ~ ~ ~ 0ff3 16 003f 16 003d 16 interrupt request register 2 (ireq2) interrupt control register 2 (icon2) ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ serial i/o control register (siocon) baud rate generator (brg) interrupt edge selection register (intedge) ~ ~ ~ ~ ~ ~ ~ ~
38k0 group user s manual application 2-41 2.4 serial i/o fig. 2.4.3 structure of serial i/o status register fig. 2.4.2 structure of transmit/receive buffer register 2.4.2 related registers transmit/receive buffer register b7 b6 b5 b4 b3 b2 b1 b0 b function at reset rw 0 1 2 3 4 5 6 7 name ? ? ? ? ? ? ? ? transmit/receive buffer register (tb/rb) [address : 26 16 ] the transmission data is written to or the receive data is read out from this buffer register. at writing: a data is written to the transmit buffer register. at reading: the contents of the receive buffer register are read out. note: the contents of transmit buffer register cannot be read out. the data cannot be written to the receive bu ff er register. serial i/o status register b7 b6 b5 b4 b3 b2 b1 b0 b function at reset rw 0 1 2 3 4 5 6 7 name 0 0 0 0 0 0 0 1 serial i/o status register (siosts) [address : 27 16 ] nothing is allocated for this bit. this is a write disabled bit. when this bit is read out, the contents are 1 . ? ? ? ? ? ? ? ? transmit buffer empty flag (tbe) 0 : (oe) u (pe) u (fe) = 0 1 : (oe) u (pe) u (fe) = 1 overrun error flag (oe) 0 : buffer full 1 : buffer empty receive buffer full flag (rbf) transmit shift register shift completion flag (tsc) parity error flag (pe) framing error flag (fe) summing error flag (se) 0 : buffer empty 1 : buffer full 0 : transmit shift in progress 1 : transmit shift completed 0 : no error 1 : overrun error 0 : no error 1 : parity error 0 : no error 1 : framing error
2-42 38k0 group user s manual application 2.4 serial i/o fig. 2.4.5 structure of uart control register fig. 2.4.4 structure of serial i/o control register a a serial i/o control register b7 b6 b5 b4 b3 b2 b1 b0 b function at reset rw 0 1 2 3 4 5 6 7 name 0 0 0 0 0 0 0 serial i/o control register (siocon) [address : 0fe0 16 ] 0 : system clock 1 : system clock/4 brg count source selection bit (css) 0 0 : transmit disabled 1 : transmit enabled 0 : receive disabled 1 : receive enabled transmit interrupt source selection bit (tic) transmit enable bit (te) receive enable bit (re) serial i/o enable bit (sioe) s rdy output enable bit (srdy) 0 : p4 3 pin operates as ordinary i/o pin 1 : p4 3 pin operates as s rdy output pin 0 : interrupt when transmit buffer has emptied 1 : interrupt when transmit shift operation is completed serial i/o synchronous clock selection bit (scs) in clock synchronous serial i/o 0 : brg output divided by 4 1 : external clock input in uart 0 : brg output divided by 16 1 : external clock input divided by 16 serial i/o mode selection bit (siom) 0 : clock asynchronous(uart) serial i/o 1 : clock synchronous serial i/o 0 : serial i/o disabled (pins p4 0 to p4 3 operate as ordinary i/o pins) 1 : serial i/o enabled (pins p4 0 to p4 3 operate as serial i/o pins) b7 b6 b5 b4 b3 b2 b1 b0 b function at reset rw 0 1 2 3 4 5 6 7 name 0 0 0 0 1 uart control register (uartcon) [address : 0fe1 16 ] nothing is allocated for these bits. these are write disabled bits. when these bits are read out, the contents are 1 . ? ? ? uart control register character length selection bit (chas) parity enable bit (pare) stop bit length selection bit (stps) parity selection bit (pars) 0 : 8 bits 1 : 7 bits 0 : parity checking disabled 1 : parity checking enabled 0 : 1 stop bit 1 : 2 stop bits 0 : even parity 1 : odd parity 1 1 0 nothing is allocated for this bit. this is a write disabled bit. when this bit is read out, the contents are 0 . ?
38k0 group user s manual application 2-43 2.4 serial i/o fig. 2.4.6 structure of baud rate generator baud rate generator b7 b6 b5 b4 b3 b2 b1 b0 b function at reset rw 0 1 2 3 4 5 6 7 ? ? ? ? ? ? ? ? baud rate generator (brg) [address : 0fe2 16 ] set a count value of baud rate generator. fig. 2.4.7 structure of interrupt edge selection register b7 b6 b5 b4 b3 b2 b1 b0 rw 0 0 2 0 3 0 4 0 5 0 60 7 0 1 0 0 : falling edge active 1 : rising edge active int 0 interrupt edge selection bit interrupt edge selection register (intedge) [address : 0ff3 16 ] b function at reset name interrupt edge selection register 0 : falling edge active 1 : rising edge active int 1 interrupt edge selection bit nothing is arranged for this bits. this is a write disabled bit. when this bit is read out, the contents are 0 . nothing is arranged for this bits. this is a write disabled bit. when this bit is read out, the contents are 0 .
2-44 38k0 group user s manual application 2.4 serial i/o fig. 2.4.8 structure of interrupt request register 2 fig. 2.4.9 structure of interrupt control register 2 b7 b6 b5 b4 b3 b2 b1 b0 rw 0 0 2 0 3 0 4 0 5 0 6 0 7 0 1 0 int 1 interrupt request bit interrupt request register 2 (ireq2) [address : 3d 16 ] b function at reset name interrupt request register 2 serial i/o receive interrupt request bit serial i/o transmit interrupt request bit cntr 0 interrupt request bit key-on wake-up interrupt request bit a/d conversion interrupt request bit 0 : no interrupt request issued 1 : interrupt request issued ? 0 can be set by software, but 1 cannot be set. 0 : no interrupt request issued 1 : interrupt request issued 0 : no interrupt request issued 1 : interrupt request issued 0 : no interrupt request issued 1 : interrupt request issued 0 : no interrupt request issued 1 : interrupt request issued 0 : no interrupt request issued 1 : interrupt request issued ? ? ? ? ? ? nothing is arranged for this bits. this is a write disabled bit. when this bit is read out, the contents are 0 . nothing is arranged for this bits. this is a write disabled bit. when this bit is read out, the contents are 0 . b7 b6 b5 b4 b3 b2 b1 b0 rw 0 0 2 0 3 0 4 0 5 0 6 0 7 0 1 0 int 1 interrupt enable bit interrupt control register 2 (icon2) [address : 3d 16 ] b function at reset name interrupt control register 2 serial i/o receive interrupt enable bit serial i/o transmit interrupt enable bit cntr 0 interrupt enable bit key-on wake-up interrupt enable bit a/d conversion interrupt enable bit fix this bit to 0 . 0 : interrupt disabled 1 : interrupt enabled 0 : interrupt disabled 1 : interrupt enabled 0 : interrupt disabled 1 : interrupt enabled 0 : interrupt disabled 1 : interrupt enabled 0 : interrupt disabled 1 : interrupt enabled fix this bit to 0 . 0 : interrupt disabled 1 : interrupt enabled 0 0
38k0 group user s manual application 2-45 2.4 serial i/o 2.4.3 serial i/o connection examples (1) control of peripheral ic equipped with cs pin figure 2.4.10 shows connection examples of a peripheral ic equipped with the cs pin. there are connection examples using a clock synchronous serial i/o mode. fig. 2.4.10 serial i/o connection examples (1) port s clk t x d r x d port cs clk in out cs clk in out (4) connection of plural ic 38k0 group peripheral ic 1 peripheral ic 2 port s clk t x d cs clk in out (2) transmission and reception 38k0 group peripheral ic (e prom etc.) 2 (3) transmission and reception (when connecting r x d with t x d (when connecting in with out in peripheral ic) cs clk in out 38k0 group peripheral ic (e prom etc.) 2 ? 2 notes: port means an out p ut p ort controlled b y software. port s clk t x d cs clk data (1) only transmission (using the r x d pin as an i/o port) 38k0 group peripheral ic (osd controller etc.) ? 1 ? 1: select an n-channel open-drain output for t x d pin output control. ? 2: use the out pin of peripheral ic which is an n-channel open- drain output and becomes high impedance during receiving data. port s clk t x d r x d r x d
2-46 38k0 group user s manual application 2.4 serial i/o (2) connection with microcomputer figure 2.4.11 shows connection examples with another microcomputer. fig. 2.4.11 serial i/o connection examples (2) (4) in uart s clk t x d r x d clk in out (2) selecting external clock 38k0 group microcomputer (3) using s rdy signal output function (selecting an external clock) s rdy s clk t x d r x d out 38k0 group microcom p uter clk in out (1) selecting internal clock 38k0 group microcomputer r x d t x d s clk t x d r x d r x d t x d 38k0 group microcomputer rdy clk in
38k0 group user s manual application 2-47 2.4 serial i/o 2.4.4 setting of serial i/o transfer data format a clock synchronous or clock asynchronous (uart) can be selected as a data format of serial i/o. figure 2.4.12 shows the serial i/o transfer data format. fig. 2.4.12 serial i/o transfer data format 1st-8data-1sp st lsb serial i/o uart clock synchronous serial i/o 1st-7data-1sp st lsb 1st-8data-1par-1sp st lsb 1st-7data-1par-1sp st lsb 1st-8data-2sp st lsb 1st-7data-2sp st lsb 1st-8data-1par-2sp st lsb 1st-7data-1par-2sp st lsb msb sp msb sp msb par sp msb par sp msb 2sp msb 2sp msb par 2sp msb par 2sp lsb first st : start bit sp : stop bit par : parity bit
2-48 38k0 group user? manual application 2.4 serial i/o 2.4.5 serial i/o application examples (1) communication using clock synchronous serial i/o (transmit/receive) outline : 2-byte data is transmitted and received, using the clock synchronous serial i/o. ________ the s rdy signal is used for communication control. figure 2.4.13 shows a connection diagram, and figure 2.4.14 shows a timing chart. figure 2.4.15 shows a registers setting related to the transmitting side, and figure 2.4.16 shows registers setting related to the receiving side. fig. 2.4.13 connection diagram specifications : the serial i/o is used (clock synchronous serial i/o is selected.) synchronous clock frequency : 125 khz (f(x in ) = 6 mhz is divided by 48) the s rdy (receivable signal) is used. the receiving side outputs the s rdy signal at intervals of 2 ms (generated by timer), and 2-byte data is transferred from the transmitting side to the receiving side. fig. 2.4.14 timing chart p5 2 / int 1 s clk t x d 38k0 g rou p s rdy s clk r x d 38k0 g rou p transmitting side receiving side d 0 d 4 d 2 d 1 d 6 d 5 d 7 d 3 d 0 d 4 d 2 d 1 d 6 d 5 d 7 d 3 d 0 d 1 t x d s clk s rdy 2 ms
38k0 group user s manual application 2-49 2.4 serial i/o fig. 2.4.15 registers setting related to transmitting side serial i/o status register (address : 27 16 ) siosts transmit buffer empty flag confirm that the data has been transferred from transmit buffer register to transmit shift register. when this flag is 1 , it is possible to write the next transmission data in to transmit buffer register. transmitting side transmit shift register shift completion flag confirm completion of transmitting 1-byte data with this flag. 1 : transmit shift completed a a aa aa b7 b0 interrupt edge selection register (address : 0ff3 16 ) intedge int 1 interru p t ed g e selection bit : fallin g ed g e active a a aa aa b7 b0 baud rate generator (address : 0fe2 16 ) brg set division ratio 1 . 11 b7 b0 serial i/o control register (address : 0fe0 16 ) siocon brg counter source selection bit : f(x in ) serial i/o synchronous clock selection bit : brg/4 transmit enable bit : transmit enabled receive enable bit : receive disabled serial i/o mode selection bit : clock synchronous serial i/o serial i/o enable bit : serial i/o enabled a a aa aa b7 b0 0 0 0 11 1 0
2-50 38k0 group user s manual application 2.4 serial i/o fig. 2.4.16 registers setting related to receiving side aa aa a a b7 b0 receiving side serial i/o control register (address : 0fe0 16 ) siocon serial i/o synchronous clock selection bit : external clock s rdy output enable bit : s rdy output enabled transmit enable bit : transmit enabled set this bit to 1 , using s rdy output. receive enable bit : receive enabled serial i/o mode selection bit : clock synchronous serial i/o serial i/o enable bit : serial i/o enabled 1 1 1 1 1 1 a a aa aa serial i/o status register (address : 27 16 ) siosts b7 b0 receive buffer full flag confirm completion of receiving 1-byte data with this flag. 1 : at completing reception 0 : at reading out contents of receive buffer register overrun error flag 1 : when data is ready in receive shift register while receive buffer register contains the data. parity error flag 1 : when a parity error occurs in enabled parity. framing error flag 1 : when stop bits cannot be detected at the specified timing. summing error flag 1 : when any one of the following errors occurs. overrun error parity error framing error
38k0 group user s manual application 2-51 2.4 serial i/o figure 2.4.17 shows a control procedure of the transmitting side, and figure 2.4.18 shows a control procedure of the receiving side. fig. 2.4.17 control procedure of transmitting side reset initialization siocon (address : 0fe0 16 ) 1101xx00 2 brg (address : 0fe2 16 ) 12 1 intedge (address : 0ff3 16 ), bit2 0 ..... tb/rb (address : 26 16 ) the first byte of a transmission data transmission data write transmit buffer empty flag is set to 0 by this writing. detection of int 1 falling edge ireq2 (address:3d 16 ), bit0? 1 0 judgment of transferring from transmit buffer register to transmit shift register (transmit buffer empty flag) siosts (address : 27 16 ), bit0? 1 0 tb/rb (address : 26 16 ) transmission data write transmit buffer empty flag is set to 0 by this writing. the second byte of a transmission data judgment of transferring from transmit buffer register to transmit shift register (transmit buffer empty flag) siosts (address : 27 16 ), bit0? 1 0 judgment of shift completion of transmit shift register (transmit shift register shift completion flag) siosts (address : 27 16 ), bit2? 1 0 ireq2 (address : 3d 16 ), bit0 0 x: this bit is not used here. set it to 0 or 1 arbitrarily.
2-52 38k0 group user s manual application 2.4 serial i/o fig. 2.4.18 control procedure of receiving side pass 2 ms? reset initialization siocon (address : 0fe0 16 ) 1111x11x 2 ..... tb/rb (address : 26 16 ) dummy data an interval of 2 ms generated by timer y n judgment of completion of receiving (receive buffer full flag) siosts (address : 27 16 ), bit1? 1 0 read out reception data from tb/rb (address : 26 16 ) reception of the first byte data receive buffer full flag is set to 0 by reading data. judgment of completion of receiving (receive buffer full flag) siosts (address : 27 16 ), bit1? 1 0 read out reception data from tb/rb (address : 26 16 ) reception of the second byte data. receive buffer full flag is set to 0 by reading data. s rdy output s rdy signal is output by writing data to the tb/rb. using the s rdy , set transmit enable bit (bit4) of the siocon to 1. x: this bit is not used here. set it to 0 or 1 arbitrarily.
38k0 group user s manual application 2-53 2.4 serial i/o (2) output of serial data (control of peripheral ic) outline : 4-byte data is transmitted and received, using the clock synchronous serial i/o. the cs signal is output to a peripheral ic through port p5 3 . the example for using serial i/o is shown. figure 2.4.19 shows a connection diagram, and figure 2.4.20 shows a timing chart. fig. 2.4.19 connection diagram specifications : the serial i/o is used (clock synchronous serial i/o is selected.) synchronous clock frequency : 125 khz (f(x in ) = 6 mhz is divided by 48) transfer direction : lsb first the serial i/o interrupt is not used. port p5 3 is connected to the cs pin ( l active) of the peripheral ic for transmission control; the output level of port p5 3 is controlled by software. fig. 2.4.20 timing chart s clk cs peripheral ic 38k0 group example for using serial i/o data cs clk clk data p5 3 t x d cs do 0 do 1 do 2 do 3 clk data
2-54 38k0 group user s manual application 2.4 serial i/o figure 2.4.21 shows registers setting related to serial i/o, and figure 2.4.22 shows a setting of serial i/o transmission data. fig. 2.4.22 setting of serial i/o transmission data fig. 2.4.21 registers setting related to serial i/o s rdy output enable bit : s rdy output disabled serial i/o synchronous clock selection bit : brg/4 0 serial i/o transmit interrupt enable bit : interrupt disabled icon2 interrupt control register 2 (address : 3f 16 ) serial i/o transmit interrupt request bit confirm completion of transmitting 1-byte data by one unit. 1 : transmit shift completion ireq2 interrupt request register 2 (address : 3d 16 ) 00 1 siocon serial i/o control register (address : 0fe0 16 ) 0 0 11 brg count source selection bit : f(x in ) transmit interrupt source selection bit : transmit shift operating completion transmit enable bit : transmit enabled 1 receive enable bit : receive disabled b7 b0 0 b7 b0 b7 b0 serial i/o mode selection bit : clock synchronous serial i/o serial i/o enable bit : serial i/o enabled 11 set division ratio 1 . brg baud rate generator (address : 0fe2 16 ) b7 b0 set a transmission data. confirm that transmission of the previous data is completed (bit 3 of the interrupt request register 2 is 1 ) before writing data. tb/rb transmit/receive buffer register (address : 26 16 ) b7 b0
38k0 group user s manual application 2-55 2.4 serial i/o when the registers are set as shown in fig. 2.4.21, the serial i/o can transmit 1-byte data by writing data to the transmit buffer register. thus, after setting the cs signal to l , write the transmission data to the transmit buffer register by each 1 byte, and return the cs signal to h when the target number of bytes has been transmitted. figure 2.4.23 shows a control procedure of serial i/o. fig. 2.4.23 control procedure of serial i/o p5 (address : 0a 16 ), bit3 0 0 n y 1 ireq2 (address : 3d 16 ), bit3? complete to transmit data? initialization siocon (address : 0fe0 16 ) 11011000 2 uartcon (address : 0fe1 16 ), bit4 0 brg (address : 0fe2 16 ) 12 1 icon2 (address : 3f 16 ), bit3 0 p5 (address : 0a 16 ), bit3 1 p5d (address : 0b 16 ) xxxx1xxx 2 .... .... ireq2 (address : 3d 16 ), bit3 0 tb/rb (address : 26 16 ) p5 (address : 0a 16 ), bit3 1 a transmission data return the cs signal output level to h when transmission of the target number of bytes is completed serial i/o transmit interrupt : disabled cs signal output port set ( h level output) reset x: this bit is not used here. set it to 0 or 1 arbitrarily. serial i/o set cs signal output level to l set serial i/o transmit interrupt request bit set to 0 transmission data write (start of transmit 1-byte data) judgment of completion of transmitting 1-byte data use any of ram area as a counter for counting the number of transmitted bytes judgment of completion of transmitting the target number of bytes
2-56 38k0 group user s manual application 2.4 serial i/o (3) cyclic transmission or reception of block data (data of specified number of bytes) between two microcomputers outline : when the clock synchronous serial i/o is used for communication, synchronization of the clock and the data between the transmitting and receiving sides may be lost because of noise included in the synchronous clock. it is necessary to correct that constantly, using heading adjustment . this heading adjustment is carried out by using the interval between blocks in this example. figure 2.4.24 shows a connection diagram. fig. 2.4.24 connection diagram specifications : the serial i/o is used (clock synchronous serial i/o is selected). synchronous clock frequency : 125 khz (f(x in ) = 6 mhz is divided by 48) byte cycle: 488 s number of bytes for transmission or reception : 8 byte/block block transfer cycle : 16 ms block transfer term : 3.5 ms interval between blocks : 12.5 ms heading adjustment time : 8 ms limitations of specifications : reading of the reception data and setting of the next transmission data must be completed within the time obtained from byte cycle time for transferring 1-byte data (in this example, the time taken from generating of the serial i/o receive interrupt request to input of the next synchronous clock is 431 s). heading adjustment time < interval between blocks must be satisfied. s clk master unit s clk slave t x d r x d t x d r x d
38k0 group user s manual application 2-57 2.4 serial i/o the communication is performed according to the timing shown in figure 2.4.25. in the slave unit, when a synchronous clock is not input within a certain time (heading adjustment time), the next clock input is processed as the beginning (heading) of a block. when a clock is input again after one block (8 byte) is received, the clock is ignored. figure 2.4.26 shows related registers setting. fig. 2.4.25 timing chart fig. 2.4.26 related registers setting d 0 byte cycle block transfer term block transfer cycle d 1 d 2 d 7 d 0 interval between blocks processin g for headin g ad j ustment heading adjustment time master unit transmit enabled siocon serial i/o control register (address : 0fe0 16 ) synchronous clock : brg/4 transmit interrupt source : transmit shift operating completion receive enabled clock synchronous serial i/o 0 1 1 110 0 1 serial i/o enabled brg count source : f(x in ) s rdy output disabled not affected by external clock transmit enabled siocon serial i/o control register (address : 0fe0 16 ) not use the serial i/o transmit interrupt receive enabled clock synchronous serial i/o 1 1 1 1 slave unit 1 serial i/o enabled 0 synchronous clock : external clock both of units 11 brg b7 b0 baud rate generator (address : 0fe2 16 ) set division ratio 1 . b7 b0 b7 b0 s rdy output disabled
2-58 38k0 group user s manual application 2.4 serial i/o control procedure : control in the master unit after setting the related registers shown in figure 2.4.26, the master unit starts transmission or reception of 1-byte data by writing transmission data to the transmit buffer register. to perform the communication in the timing shown in figure 2.4.25, take the timing into account and write transmission data. additionally, read out the reception data when the serial i/o transmit interrupt request bit is set to 1, or before the next transmission data is written to the transmit buffer register. figure 2.4.27 shows a control procedure of the master unit using timer interrupts. fig. 2.4.27 control procedure of master unit interrupt processing routine executed every 488 s write a transmission data read a reception data n within a block transfer term? y y complete to transfer a block? n rti write the first transmission data (first byte) in a block count a block interval counter n start a block transfer? y generation of a certain block interval by using a timer or other functions check the block interval counter and determine to start a block transfer clt ( note 1 ) cld ( note 2 ) push register to stack note 1: when using the index x mode flag (t). note 2: when using the decimal mode flag (d). push the register used in the interrupt processing routine into the stack pop registers pop registers which is pushed to stack
38k0 group user s manual application 2-59 2.4 serial i/o control in the slave unit after setting the related registers as shown in figure 2.4.26, the slave unit becomes the state where a synchronous clock can be received at any time, and the serial i/o receive interrupt request bit is set to 1 each time an 8-bit synchronous clock is received. in the serial i/o receive interrupt processing routine, the data to be transmitted next is written to the transmit buffer register after the received data is read out. however, if no serial i/o receive interrupt occurs for a certain time (heading adjustment time or more), the following processing will be performed. 1. the first 1-byte data of the transmission data in the block is written into the transmit buffer register. 2. the data to be received next is processed as the first 1 byte of the received data in the block. figure 2.4.28 shows a control procedure of the slave unit using the serial i/o receive interrupt and any timer interrupt (for heading adjustment). fig. 2.4.28 control procedure of slave unit write a transmission data read a reception data n within a block transfer term? y y a received byte counter 8? n rti write dummy data (ff 16 ) a received byte counter +1 heading adjustment counter initial value ( note 3 ) serial i/o receive interrupt processing routine timer interrupt processing routine heading adjustment counter 1 n heading adjustment counter = 0? y rti write the first transmission data (first byte) in a block a received byte counter 0 confirmation of the received byte counter to judge the block transfer term clt ( note 1 ) cld ( note 2 ) push register to stack push the register used in the interrupt processing routine into the stack clt ( note 1 ) cld ( note 2 ) push register to stack push the register used in the interrupt processing routine into the stack pop registers pop registers which is pushed to stack pop registers pop registers which is pushed to stack notes 1: when using the index x mode flag (t). 2: when using the decimal mode flag (d). 3: in this example, set the value which is equal to the heading adjustment time divided by the timer interrupt cycle as the initial value of the heading adjustment counter. for example: when the heading adjustment time is 8 ms and the timer interrupt cycle is 1 ms, set 8 as the initial value.
2-60 38k0 group user s manual application 2.4 serial i/o (4) communication (transmit/receive) using asynchronous serial i/o (uart) outline : 2-byte data is transmitted and received, using the asynchronous serial i/o. port p2 0 is used for communication control. figure 2.4.29 shows a connection diagram, and figure 2.4.30 shows a timing chart. fig. 2.4.29 connection diagram (communication using uart) specifications : the serial i/o is used (uart is selected). transfer bit rate : 9600 bps (f(x in ) = 6 mhz is divided by 624) communication control using port p2 0 (the output level of port p2 0 is controlled by software.) 2-byte data is transferred from the transmitting side to the receiving side at intervals of 10 ms generated by the timer. fig. 2.4.30 timing chart (using uart) transmitting side p2 0 38k0 group p2 0 38k0 group receiving sid e t x dr x d p2 0 10 ms d 0 d 1 d 2 d 3 d 4 d 5 d 6 d 7 st sp(2) d 0 d 1 d 2 d 3 d 4 d 5 d 6 d 7 st sp(2) d 0 st . ..... t x d . ..... ~ ~ ~ ~
38k0 group user? manual application 2-61 2.4 serial i/o notes 1: select the brg count source with bit 0 of the serial i/o control register (address : 0fe0 16 ). 2: these are setting values with small errors. 3: equation of transfer bit rate: ? m: when bit 0 of the serial i/o control register (address : 0fe0 16 ) is set to ?? a value of m is 1. when bit 0 of the serial i/o control register (address : 0fe0 16 ) is set to ?? a value of m is 4. table 2.4.1 shows setting examples of the baud rate generator (brg) values and transfer bit rate values; figure 2.4.31 shows registers setting related to the transmitting side; figure 2.4.32 shows registers setting related to the receiving side. table 2.4.1 setting examples of baud rate generator values and transfer bit rate values transfer bit rate (bps) = (brg setting value + 1) ? 16 ? m ? f(x in ) transfer bit rate (bps) (note 3) 600 1200 2400 4800 9600 14400 19200 38400 57600 brg count source (note 1) f(x in )/4 f(x in )/4 f(x in ) f(x in ) f(x in ) f(x in ) f(x in ) f(x in ) f(x in ) at f(x in ) = 6 mh z brg setting value (note 2) 155 77 155 77 38 25 19 9 at f(x in ) = 8 mh z brg setting value (note 2) 207 103 207 103 51 34 25 12 8
2-62 38k0 group user s manual application 2.4 serial i/o fig. 2.4.31 registers setting related to transmitting side aa aa a a aa aa a a aa aa a a serial i/o status register (address : 27 16 ) siosts transmitting side baud rate generator (address : 0fe2 16 ) brg 38 siocon 1001 00 0 uart control register (address : 0fe1 16 ) uartcon 0 10 f(x in ) transfer bit rate ? 16 ? m 1 b7 b0 serial i/o control register (address : 0fe0 16 ) b7 b0 b7 b0 b7 b0 set when bit 0 of the serial i/o control register (address : 0fe0 16 ) is set to 0, a value of m is 1. when bit 0 of the serial i/o control register (address : 0fe0 16 ) is set to 1, a value of m is 4. ? ? brg count source selection bit : f(x in ) serial i/o synchronous clock selection bit : brg/16 transmit enable bit : transmit enabled receive enable bit : receive disabled serial i/o mode selection bit : asynchronous serial i/o(uart) serial i/o enable bit : serial i/o enabled s rdy output enable bit : s rdy out disabled character length selection bit : 8 bits parity enable bit : parity checking disabled stop bit length selection bit : 2 stop bits transmit buffer empty flag confirm that the data has been transferred from transmit buffer register to transmit shift register. when this flag is 1 , it is possible to write the next transmission data in to transmit buffer register. transmit shift register shift completion flag confirm completion of transmitting 1-byte data with this flag. 1 : transmit shift completed
38k0 group user s manual application 2-63 2.4 serial i/o fig. 2.4.32 registers setting related to receiving side aa aa a a aa aa a a aa aa a a receiving side serial i/o status register (address : 27 16 ) siosts brg 38 serial i/o control register (address : 0fe0 16 ) siocon 10 0 100 0 uartcon 0 10 b7 b0 b7 b0 uart control register (address : 0fe1 16 ) b7 b0 character length selection bit : 8 bits parity enable bit : parity checking disabled stop bit length selection bit : 2 stop bits baud rate generator (address : 0fe2 16 ) b7 b0 f(x in ) transfer bit rate ? 16 ? m 1 set when bit 0 of the serial i/o control register (address : 0fe0 16 ) is set to 0, a value of m is 1. when bit 0 of the serial i/o control register (address : 0fe0 16 ) is set to 1, a value of m is 4. ? ? brg count source selection bit : f(x in ) serial i/o synchronous clock selection bit : brg/16 transmit enable bit : transmit disabled receive enable bit : receive enabled serial i/o mode selection bit : asynchronous serial i/o(uart) serial i/o enable bit : serial i/o enabled s rdy output enable bit : s rdy out disabled receive buffer full flag confirm completion of receiving 1-byte data with this flag. 1 : at completing reception 0 : at reading out contents of receive buffer register overrun error flag 1 : when data is ready in receive shift register while receive buffer register contains the data. parity error flag 1 : when a parity error occurs in enabled parity. framing error flag 1 : when stop bits cannot be detected at the specified timing. summing error flag 1 : when any one of the following errors occurs. overrun error parity error framing error
2-64 38k0 group user? manual application 2.4 serial i/o figure 2.4.33 shows a control procedure of the transmitting side, and figure 2.4.34 shows a control procedure of the receiving side. fig. 2.4.33 control procedure of transmitting side siosts (address : 27 16 ), bit0? reset communication completion p2 (address : 04 16 ), bit0 1 pass 10 ms? y n tb/rb (address : 26 16 ) the second byte of a transmission data 1 0 siosts (address : 27 16 ), bit2? 1 0 initialization siocon (address : 0fe0 16 ) 1001x000 2 uartcon (address : 0fe1 16 ) 00001000 2 brg (address : 0fe2 16 ) 39 1 p2 (address : 04 16 ), bit0 0 p2d (address : 05 16 ) xxxxxxx1 2 ..... tb/rb (address : 26 16 ) the first byte of a transmission data p2 (address : 04 16 ), bit0 0 1 0 port p2 0 set for communication control an interval of 10 ms generated by timer communication start transmission data write transmit buffer empty flag is set to 0 by this writing. transmission data write transmit buffer empty flag is set to 0 by this writing. judgment of transferring data from transmit buffer register to transmit shift register (transmit buffer empty flag) judgment of transferring data from transmit buffer register to transmit shift register (transmit buffer empty flag) judgment of shift completion of transmit shift register (transmit shift register shift completion flag) siosts (address : 27 16 ), bit0?  x: this bit is not used here. set it to 0 or 1 arbitrarily.
38k0 group user s manual application 2-65 2.4 serial i/o fig. 2.4.34 control procedure of receiving side reset judgment of completion of receiving (receive buffer full flag) siosts (address : 27 16 ), bit1? 1 0 read out a reception data from rb (address : 26 16 ) siosts (address : 27 16 ), bit6? 0 1 initialization siocon (address : 0fe0 16 ) 1010x000 2 uartcon (address : 0fe1 16 ) 00001000 2 brg (address : 0fe2 16 ) 39 1 p2d (address : 05 16 ) xxxxxxx0 2 ..... siosts (address : 27 16 ), bit1? 1 0 judgment of an error flag siosts (address : 27 16 ), bit6? 0 1 p2 (address : 04 16 ), bit0? 0 1 processing for error read out a reception data from rb (address : 26 16 ) reception of the first byte data receive buffer full flag is set to 0 by reading data. judgment of completion of receiving (receive buffer full flag) reception of the second byte data receive buffer full flag is set to 0 by reading data. judgment of an error flag  x: this bit is not used here. set it to 0 or 1 arbitrarily.
2-66 38k0 group user s manual application 2.4 serial i/o 2.4.6 notes on serial i/o (1) notes when selecting clock synchronous serial i/o (serial i/o) ? stop of transmission operation clear the serial i/o enable bit and the transmit enable bit to 0 (serial i/o and transmit disabled). reason since transmission is not stopped and the transmission circuit is not initialized even if only the serial i/o enable bit is cleared to 0 (serial i/o disabled), the internal transmission is running (in this case, since pins txd, rxd, s clk , and s rdy function as i/o ports, the transmission data is not output). when data is written to the transmit buffer register in this state, data starts to be shifted to the transmit shift register. when the serial i/o enable bit is set to 1 at this time, the data during internally shifting is output to the txd pin and an operation failure occurs. ? stop of receive operation clear the receive enable bit to 0 (receive disabled), or clear the serial i/o enable bit to 0 (serial i/o disabled). ? stop of transmit/receive operation clear the transmit enable bit and receive enable bit to 0 simultaneously (transmit and receive disabled). (when data is transmitted and received in the clock synchronous serial i/o mode, any one of data transmission and reception cannot be stopped.) reason in the clock synchronous serial i/o mode, the same clock is used for transmission and reception. if any one of transmission and reception is disabled, a bit error occurs because transmission and reception cannot be synchronized. in this mode, the clock circuit of the transmission circuit also operates for data reception. accordingly, the transmission circuit does not stop by clearing only the transmit enable bit to 0 (transmit disabled). also, the transmission circuit is not initialized by clearing the serial i/o enable bit to 0 (serial i/o disabled) (refer to (1) ? ).
38k0 group user s manual application 2-67 2.4 serial i/o (2) notes when selecting clock asynchronous serial i/o (serial i/o) ? stop of transmission operation clear the transmit enable bit to 0 (transmit disabled). reason since transmission is not stopped and the transmission circuit is not initialized even if only the serial i/o enable bit is cleared to 0 (serial i/o disabled), the internal transmission is running (in this case, since pins txd, rxd, s clk , and s rdy function as i/o ports, the transmission data is not output). when data is written to the transmit buffer register in this state, data starts to be shifted to the transmit shift register. when the serial i/o enable bit is set to 1 at this time, the data during internally shifting is output to the txd pin and an operation failure occurs. ? stop of receive operation clear the receive enable bit to 0 (receive disabled). ? stop of transmit/receive operation only transmission operation is stopped. clear the transmit enable bit to 0 (transmit disabled). reason since transmission is not stopped and the transmission circuit is not initialized even if only the serial i/o enable bit is cleared to 0 (serial i/o disabled), the internal transmission is running (in this case, since pins txd, rxd, s clk , and s rdy function as i/o ports, the transmission data is not output). when data is written to the transmit buffer register in this state, data starts to be shifted to the transmit shift register. when the serial i/o enable bit is set to 1 at this time, the data during internally shifting is output to the txd pin and an operation failure occurs. only receive operation is stopped. clear the receive enable bit to 0 (receive disabled). (3) s rdy output of reception side (serial i/o) when signals are output from the s rdy pin on the reception side by using an external clock in the clock synchronous serial i/o mode, set all of the receive enable bit, the s rdy output enable bit, and the transmit enable bit to 1 (transmit enabled). (4) setting serial i/o control register again (serial i/o) set the serial i/o control register again after the transmission and the reception circuits are reset by clearing both the transmit enable bit and the receive enable bit to 0. fig. 2.4.35 sequence of setting serial i/o control register again clear both the transmit enable bit (te) and the receive enable bit (re) to 0 set the bits 0 to 3 and bit 6 of the serial i/o control register set both the transmit enable bit (te) and the receive enable bit (re), or one of them to 1 can be set with the ldm instruction at the same time
2-68 38k0 group user s manual application 2.4 serial i/o (5) data transmission control with referring to transmit shift register completion flag (serial i/o) the transmit shift register completion flag changes from 1 to 0 with a delay of 0.5 to 1.5 shift clocks. when data transmission is controlled with referring to the flag after writing the data to the transmit buffer register, note the delay. (6) transmission control when external clock is selected (serial i/o) when an external clock is used as the synchronous clock for data transmission, set the transmit enable bit to 1 at h of the s clk input level. also, write the transmit data to the transmit buffer register (serial i/o shift register) at h of the s clk input level. (7) transmit interrupt request when transmit enable bit is set (serial i/o) when the transmit interrupt is used, set the transmit interrupt enable bit to transmit enabled as shown in the following sequence. ? set the interrupt enable bit to 0 (disabled) with clb instruction. ? prepare serial i/o for transmission/reception. ? set the interrupt request bit to 0 with clb instruction after 1 or more instruction has been executed. ? set the interrupt enable bit to 1 (enabled). reason when the transmission enable bit is set to 1 , the transmit buffer empty flag and transmit shift register completion flag are set to 1 . the interrupt request is generated and the transmission interrupt bit is set regardless of which of the two timings listed below is selected as the timing for the transmission interrupt to be generated. transmit buffer empty flag is set to 1 transmit shift register completion flag is set to 1
38k0 group user s manual application 2-69 2.5 usb function 2.5 usb function some application notes are available on the web site: mitsubishi mcu technical information - usb mcu (http://www.infomicom.maec.co.jp/indexe.htm) please refer to them for explanation and application of usb function.
38k0 group user s manual application 2.6 external bus interface(exb) 2-70 2.6 external bus interface(exb) some application notes are available on the web site: mitsubishi mcu technical information - usb mcu (http://www.infomicom.maec.co.jp/indexe.htm) please refer to them for explanation and application of external bus interface.
38k0 group user? manual application 2-71 2.7 a-d converter 2.7 a-d converter this paragraph explains the registers setting method and the notes related to the a-d converter. 2.7.1 memory map fig. 2.7.1 memory map of registers related to a-d converter 2.7.2 related registers fig. 2.7.2 structure of a-d control register 0036 16 0037 16 0038 16 a-d control register (adcon) a-d conversion register 1 (ad1) a-d conversion register 2 (ad2) 003f 16 interrupt control register 2 (icon2) 003d 16 interrupt request register 2 (ireq2) aa aa b7 b6 b5 b4 b3 b2 b1 b0 b function at reset rw 0 1 2 3 4 5 6 7 name 1 a-d control register (adcon) [address : 36 16 ] a-d control register 0 0 0 0 : p1 0 /dq 0 /an 0 0 0 1 : p1 1 /dq 1 /an 1 0 1 0 : p1 2 /dq 2 /an 2 0 1 1 : p1 3 /dq 3 /an 3 1 0 0 : p1 4 /dq 4 /an 4 1 0 1 : p1 5 /dq 5 /an 5 1 1 0 : p1 6 /dq 6 /an 6 1 1 1 : p1 7 /dq 7 /an 7 analog input pin selection bits b2 b1 b0 ad conversion completion bit 0 : conversion in progress 1 : conversion completed nothing is arranged for these bits. these are write disabled bits. when these bits are read out, the contents are indefinite. ? ? ? ?
2-72 38k0 group user s manual application 2.7 a-d converter fig. 2.7.3 structure of a-d conversion register 1 fig. 2.7.4 structure of a-d conversion register 2 a-d conversion register 1 b7 b6 b5 b4 b3 b2 b1 b0 b function at reset rw 0 1 2 3 4 5 6 7 ? ? ? ? ? ? ? ? a-d conversion register 1 (ad1) [address : 37 16 ] the read-only register in which the a-d conversion s results are stored. ? ? ? ? ? ? ? ? < 8-bit read> b7 b8 b7 b6 b5 b4 b3 b0 b2 b9 < 10-bit read> b7 b6 b5 b4 b3 b2 b1 b0 b0 b7 a a a-d conversion register 2 b7 b6 b5 b4 b3 b2 b1 b0 b function at reset rw 0 1 2 3 4 5 6 7 name ? ? 0 0 0 0 0 0 the read-only register in which the a-d conversion s results are stored. ? ? ? ? ? ? ? < 10-bit read> aa aa b7 b9 b0 b8 nothing is allocated for these bits. these are write disabled bits. when these bits are read out, the contents are 0 . a-d conversion register 2 (ad2) [address : 38 ] 16 fix this bit to 0 . 0 0 ?
38k0 group user s manual application 2-73 2.7 a-d converter fig. 2.7.5 structure of interrupt request register 2 fig. 2.7.6 structure of interrupt control register 2 b7 b6 b5 b4 b3 b2 b1 b0 rw 0 0 2 0 3 0 4 0 5 0 6 0 7 0 1 0 int 1 interrupt request bit interrupt request register 2 (ireq2) [address : 3d 16 ] b function at reset name interrupt request register 2 serial i/o receive interrupt request bit serial i/o transmit interrupt request bit cntr 0 interrupt request bit key-on wake-up interrupt request bit a/d conversion interrupt request bit 0 : no interrupt request issued 1 : interrupt request issued ? 0 can be set by software, but 1 cannot be set. 0 : no interrupt request issued 1 : interrupt request issued 0 : no interrupt request issued 1 : interrupt request issued 0 : no interrupt request issued 1 : interrupt request issued 0 : no interrupt request issued 1 : interrupt request issued 0 : no interrupt request issued 1 : interrupt request issued ? ? ? ? ? ? nothing is arranged for this bits. this is a write disabled bit. when this bit is read out, the contents are 0 . nothing is arranged for this bits. this is a write disabled bit. when this bit is read out, the contents are 0 . b7 b6 b5 b4 b3 b2 b1 b0 rw 0 0 2 0 3 0 4 0 5 0 6 0 7 0 1 0 int 1 interrupt enable bit interrupt control register 2 (icon2) [address : 3d 16 ] b function at reset name interrupt control register 2 serial i/o receive interrupt enable bit serial i/o transmit interrupt enable bit cntr 0 interrupt enable bit key-on wake-up interrupt enable bit a/d conversion interrupt enable bit fix this bit to 0 . 0 : interrupt disabled 1 : interrupt enabled 0 : interrupt disabled 1 : interrupt enabled 0 : interrupt disabled 1 : interrupt enabled 0 : interrupt disabled 1 : interrupt enabled 0 : interrupt disabled 1 : interrupt enabled fix this bit to 0 . 0 : interrupt disabled 1 : interrupt enabled 0 0
2-74 38k0 group user s manual application 2.7 a-d converter 2.7.3 a-d converter application examples (1) conversion of analog input voltage outline : the analog input voltage input from a sensor is converted to digital values. figure 2.7.7 shows a connection diagram, and figure 2.7.8 shows the related registers setting. fig. 2.7.7 connection diagram specifications : the analog input voltage input from a sensor is converted to digital values. p1 0 /dq 0 /an 0 pin is used as an analog input pin. fig. 2.7.8 related registers setting p1 0 /dq 0 /an 0 38k0 grou p sensor a-d control register (address 36 16 ) adcon 0 analog input pin : p1 0 /dq 0 /an 0 selected a-d conversion start 0 0 b0 b7 a-d conversion register 2 (address 38 16 ) a a ad2 ad1 b0 b7 b0 b7 aa aa (read-only) a-d conversion register 1 (address 37 16 ) (read-only) a result of a-d conversion is stored ( note ). note : after bit 3 of adcon is set to 1 , read out that contents. when reading 10-bit data, read address 0038 16 before address 0037 16 ; when reading 8-bit data, read address 0037 16 only. when readin g 10-bit data, bits 2 to 6 of address 0038 16 are 0 . 0 0
38k0 group user s manual application 2-75 2.7 a-d converter an analog input signal from a sensor is converted to the digital value according to the related registers setting shown by figure 2.7.8. figure 2.7.9 shows the control procedure for 8-bit read, and figure 2.7.10 shows the control procedure for 10-bit read. fig. 2.7.9 control procedure for 8-bit read fig. 2.7.10 control procedure for 10-bit read adcon (address 36 16 ) xxxx0000 2 read out ad1 (address 37 16 ) adcon (address 36 16 ), bit3 ? 1 0 p1 0 /dq 0 /an 0 pin selected as analog input pin a-d conversion start judgment of a-d conversion completion read out of conversion result x: this bit is not used here. set it to 0 or 1 arbitrarily. read out ad2 (address 38 16 ) adcon (address 36 16 ), bit3 ? 1 0 p1 0 /dq 0 /an 0 pin selected as analog input pin a-d conversion start judgment of a-d conversion completion read out of high-order digit (b9, b8) of conversion result read out ad1 (address 37 16 ) read out of low-order digit (b7 b0) of conversion result x: this bit is not used here. set it to 0 or 1 arbitrarily. adcon (address 36 16 ) xxxx0000 2
2-76 38k0 group user s manual application 2.7 a-d converter 2.7.4 notes on a-d converter (1) analog input pin make the signal source impedance for analog input low, or equip an analog input pin with an external capacitor of 0.01 f to 1 f. further, be sure to verify the operation of application products on the user side. reason an analog input pin includes the capacitor for analog voltage comparison. accordingly, when signals from signal source with high impedance are input to an analog input pin, charge and discharge noise generates. this may cause the a-d conversion precision to be worse. (2) clock frequency during a-d conversion the comparator consists of a capacity coupling, and a charge of the capacity will be lost if the clock frequency is too low. thus, make sure the following during an a-d conversion. f(x in ) is 500 khz or more do not execute the stp instruction
38k0 group user s manual application 2-77 2.8 watchdog timer 2.8 watchdog timer this paragraph explains the registers setting method and the notes related to the watchdog timer. 2.8.1 memory map fig. 2.8.1 memory map of registers related to watchdog timer 2.8.2 related registers fig. 2.8.2 structure of watchdog timer control register 0039 16 watchdog timer control register (wdtcon) 003b 16 cpu mode register (cpum) watchdog timer control register b7 b6 b5 b4 b3 b2 b1 b0 b function at reset rw 0 1 2 3 4 5 6 7 name 1 1 1 1 1 1 0 0 watchdog timer control register (wdtcon) [address : 39 16 ] watchdog timer h (for read-out of high-order 6 bits) stp instruction disable bit 0 : stp instruction enabled 1 : stp instruction disabled watchdog timer h count source selection bit 0 : watchdog timer l underflow 1 : system clock/16 ? ? ? ? ? ?
2-78 38k0 group user s manual application 2.8 watchdog timer fig. 2.8.3 structure of cpu mode register b7 b6 b5 b4 b3 b2 b1 b0 r w 0 0 2 0 3 4 5 6 7 1 0 0 1 0 01 b1 b0 0 0 : single-chip mode 0 1 : not available 1 0 : not available 1 1 : not available b name function at reset 0 : 0 page 1 : 1 page * cpu mode register (cpum: address 3b 16 ) cpu mode register processor mode bits stack page selection bit fix this bit to 1 . fix this bit to 0 . 0 : main clock f(x in ) 1 : f syn system clock selection bit b7 b6 0 0 : = f(system clock)/8 (8-divide mode) 0 1 : = f(system clock)/4 (4-divide mode) 1 0 : = f(system clock)/2 (2-divide mode) 1 1 : = f(system clock) (through mode) system clock division ratio selection bits * : the initial value of bit 1 depends on the cnvss level.
38k0 group user s manual application 2-79 2.8 watchdog timer 2.8.3 watchdog timer application examples (1) detection of program runaway outline : if program runaway occurs, let the microcomputer reset, using the internal timer for detection of program runaway. specifications : an underflow of watchdog timer h is judged to be program runaway, and the microcomputer is returned to the reset status. before the watchdog timer h underflows, 0 is set into bit 7 of the watchdog timer control register at every cycle in a main routine. through mode is used as a system clock division ratio. an underflow signal of the watchdog timer l is supplied as the count source of watchdog timer h. figure 2.8.4 shows a watchdog timer connection and division ratio setting; figure 2.8.5 shows the related registers setting; figure 2.8.6 shows the control procedure. fig. 2.8.4 watchdog timer connection and division ratio setting f(x in ) = 6 mhz 1/16 1/256 1/256 reset aa aa a a aa aa aa aa aa a fixed watchdog timer l watchdog timer h stp instruction disable bit stp instruction reset circuit internal reset
2-80 38k0 group user s manual application 2.8 watchdog timer fig. 2.8.6 control procedure fig. 2.8.5 related registers setting 2.8.4 notes on watchdog timer make sure that the watchdog timer does not underflow while waiting stop release, because the watchdog timer keeps counting during that term. when the stp instruction disable bit has been set to 1 , it is impossible to switch it to 0 by a program. cpum 0 b0 b7 0 1 1 wdtcon 1 b0 b7 0 0 0 cpu mode register (address 3b 16 ) processor mode: single-chip mode system clock: main clock system clock division ratio: f(system clock) (through mode) watchdog timer h (for read-out of high-order 6 bits) watchdog timer control register (address 39 16 ) enable stp instruction watchdo g timer h count source: watchdo g timer l underflow 0 1 initialization sei clt cld cpum (address 3b 16 ) 11001x00 2 : : cli wdtcon (address 39 16 ), bit7,bit6 00 2 reset main processing : : processor mode: single-chip mode main clock f(x in ): operating through mode selected as main clock division ratio watchdog timer l underflow selected as watchdog timer h count source stp instruction enabled interrupts enabled all interrupts disabled
38k0 group user s manual 2-81 application 2.9 reset 2.9 reset 2.9.1 connection example of reset ic fig. 2.9.1 example of poweron reset circuit figure 2.9.2 shows the system example which switches to the ram backup mode by detecting a drop of the system power source voltage with the int interrupt. fig. 2.9.2 ram backup system v cc reset v ss general-purpose reset ic gnd 1 3 4 5 0.1 f power source output delay capacity 38k0 group v cc reset 1 5 reset int cd v cc 1 v cc 2 v1 gnd 2 6 3 7 m62009l, m62009p, m62009fp 4 int v ss system power source voltage +5 v + 38k0 group
2-82 application 38k0 group user s manual 2.9 reset ____________ 2.9.2 notes on reset pin connecting capacitor in case where the reset signal rise time is long, connect a ceramic capacitor or others across the reset pin and the v ss pin. use a 1000 pf or more capacitor for high frequency use. when connecting the capacitor, note the following : make the length of the wiring which is connected to a capacitor as short as possible. be sure to verify the operation of application products on the user side. reason if the several nanosecond or several ten nanosecond impulse noise enters the reset pin, it may cause a microcomputer failure.
38k0 group user s manual application 2-83 2.10 frequency synthesizer (pll) 2.10 frequency synthesizer (pll) this paragraph explains the registers setting method and the notes related to the frequency synthesizer (pll circuit). 2.10.1 memory map fig. 2.10.2 structure of usb control register 2.10.2 related registers cpu mode register (cpum) usb control register (usbcon) 003b 16 0010 16 0ff8 16 pll control register (pllcon) fig. 2.10.1 memory map of registers related to pll b7 b6 b5 b4 b3 b2 b1 b0 rw 0 0 2 0 3 0 4 0 5 0 6 0 7 0 1 0 b function at reset name usb control register remote wakeup bit tron output control bit tron output enable bit usb reference voltage control bit usb reference voltage enable bit usb difference input enable bit usb clock select bit usb module operation enable bit 0 : l output mode (valid in trone = 1 ) 1 : h output mode (valid in trone = 1 ) 0 : tron port output disabled (hi-z state) 1 : tron port output enabled 0 : normal mode (valid in vrefe = 1 ) 1 : low current mode (valid in vrefe = 1 ) 0 : usb reference voltage circuit operation disabled 1 : usb reference voltage circuit operation enabled 0 : upstream-port difference input circuit operation disabled 1 : upstream--port difference input circuit operation enabled 0 : external oscillating clock f(x in ) 1 : pll circuit output clock f vco 0 : usb module reset 1 : usb module operation enabled 0 : returning to bus idle state by writing 1 first and then 0 . (remote wakeup signal) 1 : k-state output usb control register (usbcon) [address 10 16 ]
38k0 group user s manual application 2.10 frequency synthesizer (pll) 2-84 fig. 2.10.3 structure of cpu mode register b7 b6 b5 b4 b3 b2 b1 b0 r w 0 0 2 0 3 4 5 6 7 1 0 0 1 0 01 b1 b0 0 0 : single-chip mode 0 1 : not available 1 0 : not available 1 1 : not available b name function at reset 0 : 0 page 1 : 1 page * cpu mode register (cpum: address 3b 16 ) cpu mode register processor mode bits stack page selection bit fix this bit to 1 . fix this bit to 0 . 0 : main clock f(x in ) 1 : f syn system clock selection bit b7 b6 0 0 : = f(system clock)/8 (8-divide mode) 0 1 : = f(system clock)/4 (4-divide mode) 1 0 : = f(system clock)/2 (2-divide mode) 1 1 : = f(system clock) (through mode) system clock division ratio selection bits * : the initial value of bit 1 depends on the cnvss level. fig. 2.10.4 structure of pll control register b7 b6 b5 b4 b3 b2 b1 b0 rw 0 0 2 0 3 0 4 5 6 0 7 1 usb clock division ratio selection bits pll control register (pllcon) [address : 0ff8 16 ] b function at reset name pll control register b4 b3 0 0 : divided by 8 (f syn = f usb /8) 0 1 : divided by 6 (f syn = f usb /6) 1 0 : divided by 4 (f syn = f usb /4) 1 1 : not selected nothing is arranged for these bit. these are write disabled bits. when these bits are read out, the contents are 0 . b6 b5 0 0 : not multiplied (f vco = f xin ) 0 1 : double (f vco = f xin ? 2) 1 0 : quadruple (f vco = f xin ? 4) 1 1 : multiplied by 8 (f vco = f xin ? 8) pll operation mode selection bits pll enable bit 0 : disabled 1 : enabled
38k0 group user s manual application 2-85 2.10 frequency synthesizer (pll) 2.10.3 functional description the frequency synthesizer generates the 48 mhz clock which is multiples of the external input reference f(x in ) and is needed for operating usb function. when using the usb function, set pll enable bit of pll control register (pllcon: address 0ff8 16 ) to 1 (enabled) to send the 48 mhz pll output clock (f vco ) into usb function control unit. figure 2.10.5 shows the block diagram for the frequency synthesizer circuit. table 2.10.1 pll operation mode selection bits setting example f(x in ) 6 mh z 12 mh z pll operation mode selection bits * 11 10 48 mh z 48 mh z f vco f vco (pll output clock) f vco is generated by multiplying pll input clock according to the contents of pll operation mode selection bits (bits 6, 5 of pllcon), where f vco =f(x in ) ? n, n:value selected by pll operation mode selection bits set pll operation mode selection bits so that f vco may be set to 48 mhz. while the pll enable bit is 0 (disabled), f vco retains l level (except when pll operation mode selection bits are set to 00 2 ). table 2.10.1 shows the example of pll operation mode selection bits setting. pll f usb f ( x i n ) f v c o p l l c o n d i v i s i o n c i r c u i t f syn (address 0ff8 16 ) usbcon (address 0010 16 ) fig. 2.10.5 block diagram for frequency synthesizer circuit *: pll control register (bits 6,5) f usb (usb clock) either f(x in ) (main clock) or f vco (pll output clock) can be selected for f usb by usb clock select bit of usb control register (bit6 of usbcon: address 0010 16 ), and it is supplied to the usb function control circuit. when supplying f vco to the usb function control circuit, after setting pll enable bit to 1 (enabled) and then set usb clock select bit to 1 (usb clock). furthermore, when pll operation mode selection bits are set to 00 2 , the clock input into pll is used as f vco , which is not multiplied, regardless of pll operation enabled or disabled.
38k0 group user s manual application 2.10 frequency synthesizer (pll) 2-86 table 2.10.2 usb clock division ratio selection bits setting example f usb 6 mh z 8 mh z 12 mh z usb clock division ratio selection bits * 00 01 10 48 mh z f syn f syn (f usb division clock) according to the setting of the usb clock division ratio selection bits (bits 4, 3 of pllcon), the division clock of f usb is supplied to f syn . f syn =f usb / m, m:value selected by usb clock division ratio selection bits set the usb clock division ratio selection bits so that f syn may be set to 6 mhz, 8 mhz or 12 mhz. when using f syn as internal system clock, set the system clock selection bit of cpu mode register (bit 5 of cpum: address 003b 16 ) to 1 (f syn ). table 2.10.2 shows the example of usb clock division ratio selection bits setting. *: pll control register (bit4,3) setting for starting up pll circuit when hardware reset figure 2.10.6 shows the example of related registers setting. fig. 2.10.6 related registers setting when hardware reset x: this bit is not used here. set it to 0 or 1 arbitrarily. select main clock f(x in ) as a system clock select main clock f(x in ) as a usb clock pll operation mode (bit6,5): m ultiplied by 8 usb division mode (bit4,3): divided by 6 enable pll operation (bit7) select f syn as a system clock select pll circuit output clock f vco as a usb clock note: the above setting example assumes the operation when the external oscillating clock is 6 mh z and the internal system clock is f syn . wait for oscillation stabilization when multiplying oscillation by pll, wait for oscillation stabilization. cpum (address: 3b 16 ) 11001x00 2 cpum (address: 3b 16 ) 11101x00 2 usbcon (address: 10 16 ) x0xxxxxx 2 pllcon (address: 0ff8 16 ) 11101000 2 wait (approximately 1 ms) usbcon (address: 10 16 ) x1xxxxxx 2
38k0 group user s manual application 2-87 2.10 frequency synthesizer (pll) procedure for stop and return of pll circuit when stop mode figure 2.10.7 shows the stop procedure of pll circuit, and figure 2.10.8 shows the return procedure of pll circuit. fig. 2.10.7 related registers setting when stop mode x: this bit is not used here. set it to 0 or 1 arbitrarily. select main clock f(x in ) as a system clock disable pll operation (bit7) (f vco is fixed to l .) select pll circuit output clock f vco as a usb clock and does not change this setting cpum (address: 3b 16 ) 11001x00 2 pllcon (address: 0ff8 16 ) 0xxxx000 2 usbcon (address: 10 16 ) x1xxxxxx 2 pll circuit operation enabled (supply pll circuit output clock f vco as usb clock) stp instruction (stop mode) stop mode note: the above setting example assumes the operation when the external oscillating clock is 6 mh z and the internal system clock is f syn .
38k0 group user s manual application 2.10 frequency synthesizer (pll) 2-88 x: this bit is not used here. set it to 0 or 1 arbitrarily. select main clock f(x in ) as a usb clock pll operation mode (bit6,5): m ultiplied by 8 usb division mode (bit4,3): divided by 6 enable pll operation (bit7) select f syn (8mh z ) as a system clock select pll circuit output clock f vco as a usb clock wait for oscillation stabilization when multiplying oscillation by pll, wait for oscillation stabilization. cpum (address: 3b 16 ) 11101x00 2 usbcon (address: 10 16 ) x0xxxxxx 2 pllcon (address: 0ff8 16 ) 11101000 2 wait (approximately 1 ms) usbcon (address: 10 16 ) x1xxxxxx 2 same setting procedure when hardware reset pllcon (address: 0ff8 16 ) bit6,5 00 2 pll operation mode (bit6,5): not m ultiplied (change pll circuit output clock f vco to f(x in )) after recovery from stop mode note: the above setting example assumes the operation when the external oscillating clock is 6 mh z and the internal system clock is f syn . fig. 2.10.8 related registers setting when recovery from stop mode 2.10.4 notes on pll 6 mh z or 12 mh z external oscillator can be connected as an input reference clock (f(x in )). when using the frequency synthesized clock function, we recommend using the fastest frequency possible of f(x in ) as an input clock reference for the pll. when enabling pll operation from pll disabled status (disabled when reset), set the usb clock select bit of usbcon to 0 (f(x in )) to operate with the main clock (f(x in )). when supplying f vco to the usb block after setting pll operation enable bit to 1 (pll enabled), wait for the oscillation stable time (1 ms or less) of pll to avoid any instability caused by the clock, then set usb clock select bit to 1 (usb clock). when selecting f syn as an internal system clock, f usb must be 48 mhz. when selecting f syn as an internal system clock, change the system clock selection bit to main clock (f(x in )) before executing stp instruction. it is because the following are needed for the low-power consumption: f usb must be stopped by disabling pll operation in stop mode. the taimer 1 for waiting oscillation stabilization when returning from stop mode will require the input count source.
38k0 group user s manual application 2-89 2.11 clock generating circuit 2.11 clock generating circuit this paragraph explains the registers setting method and the notes related to the clock generating circuit. 2.11.1 memory map fig. 2.11.2 structure of usb control register 2.11.2 related registers cpu mode register (cpum) usb control register (usbcon) 003b 16 0010 16 0ff8 16 pll control register (pllcon) fig. 2.11.1 memory map of registers related to clock generating circuit b7 b6 b5 b4 b3 b2 b1 b0 rw 0 0 2 0 3 0 4 0 5 0 6 0 7 0 1 0 b function at reset name usb control register remote wakeup bit tron output control bit tron output enable bit usb reference voltage control bit usb reference voltage enable bit usb difference input enable bit usb clock select bit usb module operation enable bit 0 : l output mode (valid in trone = 1 ) 1 : h output mode (valid in trone = 1 ) 0 : tron port output disabled (hi-z state) 1 : tron port output enabled 0 : normal mode (valid in vrefe = 1 ) 1 : low current mode (valid in vrefe = 1 ) 0 : usb reference voltage circuit operation disabled 1 : usb reference voltage circuit operation enabled 0 : upstream-port difference input circuit operation disabled 1 : upstream--port difference input circuit operation enabled 0 : external oscillating clock f(x in ) 1 : pll circuit output clock f vco 0 : usb module reset 1 : usb module operation enabled 0 : returning to bus idle state by writing 1 first and then 0 . (remote wakeup signal) 1 : k-state output usb control register (usbcon) [address 10 16 ]
38k0 group user s manual application 2.11 clock generating circuit 2-90 fig. 2.11.3 structure of cpu mode register b7 b6 b5 b4 b3 b2 b1 b0 r w 0 0 2 0 3 4 5 6 7 1 0 0 1 0 01 b1 b0 0 0 : single-chip mode 0 1 : not available 1 0 : not available 1 1 : not available b name function at reset 0 : 0 page 1 : 1 page * cpu mode register (cpum: address 3b 16 ) cpu mode register processor mode bits stack page selection bit fix this bit to 1 . fix this bit to 0 . 0 : main clock f(x in ) 1 : f syn system clock selection bit b7 b6 0 0 : = f(system clock)/8 (8-divide mode) 0 1 : = f(system clock)/4 (4-divide mode) 1 0 : = f(system clock)/2 (2-divide mode) 1 1 : = f(system clock) (through mode) system clock division ratio selection bits * : the initial value of bit 1 depends on the cnvss level. fig. 2.11.4 structure of pll control register b7 b6 b5 b4 b3 b2 b1 b0 rw 0 0 2 0 3 0 4 5 6 0 7 1 usb clock division ratio selection bits pll control register (pllcon) [address : 0ff8 16 ] b function at reset name pll control register b4 b3 0 0 : divided by 8 (f syn = f usb /8) 0 1 : divided by 6 (f syn = f usb /6) 1 0 : divided by 4 (f syn = f usb /4) 1 1 : not selected nothing is arranged for these bit. these are write disabled bits. when these bits are read out, the contents are 0 . b6 b5 0 0 : not multiplied (f vco = f xin ) 0 1 : double (f vco = f xin ? 2) 1 0 : quadruple (f vco = f xin ? 4) 1 1 : multiplied by 8 (f vco = f xin ? 8) pll operation mode selection bits pll enable bit 0 : disabled 1 : enabled
38k0 group user? manual application 2-91 2.11 clock generating circuit 2.11.3 oscillation control either can be selected as an internal system clock between the following two by system clock selection bit. main clock f(x in ) f syn (f usb division clock) any one can be selected as an internal clock among the following four by system clock division ratio selection bits. f(x in ) or f syn /8 (8-divide mode) f(x in ) or f syn /4 (4-divide mode) f(x in ) or f syn /2 (2-divide mode) f(x in ) or f syn (through mode) (1) generation of internal clock f( ) using main clock f(x in ) table 2.11.1 shows the example of internal clock f( ) generation using main clock f(x in ); figure 2.11.5 shows the related registers setting. table 2.11.1 example of internal clock f( ) generation using main clock f(x in ) system clock 6 mh z 8 mh z 12 mh z system clock division ratio selection bits * 0 0 0 1 1 0 1 1 0 0 0 1 1 0 1 1 0 0 0 1 1 0 do not select (1 1) 0.75 mh z 1.5 mh z 3 mh z 6 mh z 1 mh z 2 mh z 4 mh z 8 mh z 1.5 mh z 3 mh z 6 mh z 12 mh z power source voltage v cc [v] 3.00 to 5.25 4.00 to 5.25 4.50 to 5.25 (planning) f( ) *: cpu mode register (bits 7,6) fig. 2.11.5 related registers setting b7 b0 01 cpu mode register (cpum: address 3b 16 ) 0 : main clock f(x in ) b7 b6 0 0 :
38k0 group user s manual application 2.11 clock generating circuit 2-92 (2) generation of internal clock f( ) using f syn (f usb division clock) table 2.11.2 shows the example of internal clock f( table 2.11.2 example of internal clock f( ) generation using f syn f syn 6 mh z 8 mh z 12 mh z system clock division ratio selection bits * 2 0 0 0 1 1 0 1 1 0 0 0 1 1 0 1 1 0 0 0 1 1 0 do not select (1 1) 0.75 mh z 1.5 mh z 3 mh z 6 mh z 1 mh z 2 mh z 4 mh z 8 mh z 1.5 mh z 3 mh z 6 mh z 12 mh z power source voltage v cc [v] 3.00 to 5.25 4.00 to 5.25 4.50 to 5.25 (planning) f( *1: pll control register (bits 4,3) *2: cpu mode register (bits 7,6) f usb 48 mh z usb clock division ratio selection bits * 1 0 0 0 1 1 1
38k0 group user s manual application 2-93 2.11 clock generating circuit fig. 2.11.6 related registers setting b7 b0 01 cpu mode register (cpum: address 3b 16 ) 0 : main clock f(x in ) b7 b6 0 0 : = f(system clock)/8 (8-divide mode) 0 1 : = f(system clock)/4 (4-divide mode) 1 0 : = f(system clock)/2 (2-divide mode) 1 1 : = f(system clock) (through mode) 0 0 0 1. select main clock f(x in ) as system clock and set clock division mode. b7 b0 usb control register (usbcon: address 10 16 ) 0 : main clock f(x in ) 0 2. select main clock f(x in ) as usb clock. b7 b0 0 1 pll control register (pllcon: address 0ff8 16 ) 0 0 3. enable pll circuit, and generating pll output clock (f vco ) 48 mh z and f syn . b4 b3 0 0 : divided by 8 (f syn = f usb /8) 0 1 : divided by 6 (f syn = f usb /6) 1 0 : divided by 4 (f syn = f usb /4) 1 1 : not selected b6 b5 0 0 : not multiplied (f vco = f xin ) 0 1 : double (f vco = f xin ? 2) 1 0 : quadruple (f vco = f xin ? 4) 1 1 : multiplied by 8 (f vco = f xin ? 8) 1 : pll enabled b7 b0 usb control register (usbcon: address 10 16 ) 1 : f vco 1 4. select pll output clock (f vco ) as usb clock. b7 b0 cpu mode register (cpum: address 3b 16 ) 1 : f syn 1 5. select f syn as system clock. note: when selecting f syn as an internal system clock, refer to 2.10 frequency synthesizer (pll) for details concerning how to generate f usb (usb clock) from f(x in ) and the notes on pll circuit.
38k0 group user s manual application 2.12 standby function 2-94 2.12 standby function the 38k0 group is provided with standby functions to stop the cpu by software and put the cpu into the low-power operation. the following two types of standby functions are available. stop mode using stp instruction wait mode using wit instruction 2.12.1 memory map fig. 2.12.1 memory map of registers related to standby function 2.12.2 related registers fig. 2.12.2 structure of misrg misrg (misrg) 0ffb 16 b7 b6 b5 b4 b3 b2 b1 b0 r w 0 0 2 3 4 5 6 7 1 ? b name functions at reset misrg (misrg: address 0ffb 16 ) misrg 0 : automatically set 01 16 to timer 1, ff 16 to prescaler 12 1 : automatically set nothing nothing is arranged for these bits. these are write disabled bits. when these bits are read out, the contents are indefinite. oscillation stabilizing time set after stp instruction released bit
38k0 group user s manual application 2-95 2.12 standby function 2.12.3 stop mode the stop mode is set by executing the stp instruction. in the stop mode, the oscillation of clock (x in x out ) stops and the internal clock stops at the h level. the cpu stops and peripheral units stop operating. as a result, power dissipation is reduced. (1) state in stop mode table 2.12.1 shows the state in the stop mode. table 2.12.1 state in stop mode item oscillation cpu internal clock i/o ports p0 p6 timer watchdog timer serial i/o usb function external bus interface a-d converter comparator state in stop mode stopped. stopped. stopped at h level. retains the state at the stp instruction execution. stopped. (timers 1, 2, x) however, timers x can be operated in the event counter mode. stopped. stopped. however, these can be operated only when an external clock is selected. stopped. stopped. stopped. stopped.
38k0 group user s manual application 2.12 standby function 2-96 (2) release of stop mode the stop mode is released by a reset input or by the occurrence of an interrupt request. note the differences in the restoration process according to reset input or interrupt request, as described below. restoration by reset input the stop mode is released by holding the reset pin to the l input level during the stop mode. oscillation is started when all ports are in the input state and the stop mode of the main clock (x in - x out ) is released. oscillation is unstable when restarted. for this reason, time for stabilizing of oscillation (oscillation stabilizing time) is required. the input of the reset pin should be held at the l level until oscillation stabilizes. when the reset pin is held at the l level for 16 cycles or more of x in after the oscillation has stabilized, the microcomputer will go to the reset state. after the input level of the reset pin is returned to h , the reset state is released in approximately 10.5 to 18.5 cycles of the x in input. figure 2.12.3 shows the oscillation stabilizing time at restoration by reset input. at release of the stop mode by reset input, the internal ram retains its contents previous to the reset. however, the previous contents of the cpu register and sfr are not retained. for more details concerning reset, refer to 2.9 reset . fig. 2.12.3 oscillation stabilizing time at restoration by reset input vcc reset x in stop mode oscillation stabilizing time 16 cycles or more of x in operating mode time to hold internal reset state = approximately 10.5 to 18.5 cycles of x in input execute stop instruction
38k0 group user s manual application 2-97 2.12 standby function restoration by interrupt request the occurrence of an interrupt request in the stop mode releases the stop mode. as a result, oscillation is resumed. the interrupts available for restoration are: int 0 , int 1 cntr 0 serial i/o using an external clock timer x using an external event count key input (key-on wake-up) usb function (resume) however, when using any of these interrupt requests for restoration from the stop mode, in order to enable the selected interrupt, you must execute the stp instruction after setting the following conditions. [necessary register setting] ? interrupt disable flag i = 0 (interrupt enabled) ? timer 1 interrupt enable bit = 0 (interrupt disabled) ? interrupt request bit of interrupt source to be used for restoration = 0 (no interrupt request issued) ? interrupt enable bit of interrupt source to be used for restoration = 1 (interrupts enabled) for more details concerning interrupts, refer to 2.2 interrupts . oscillation is unstable when restarted. for this reason, time for stabilizing of oscillation (oscillation stabilizing time) is required. for restoration by an interrupt request, waiting time prior to supplying internal clock to the cpu is automatically generated ? 2 by prescaler 12 and timer 1 ? 1 . this waiting time is reserved as the oscillation stabilizing time on the system clock side. the supply of internal clock to the cpu is started at the timer 1 underflow. figure 2.12.4 shows an execution sequence example at restoration by the occurrence of an int 0 interrupt request. ? 1: if the stp instruction is executed when the oscillation stabilizing time set after stp instruction released bit is 0 , ff 16 and 01 16 are automatically set in the prescaler 12 counter/latch and timer 1 counter/latch, respectively. when the oscillation stabilizing time set after stp instruction released bit is 1 , nothing is automatically set to either prescaler 12 or timer 1. for this reason, any suitable value can be set to prescaler 12 and timer 1 for the oscillation stabilizing time. ? 2: immediately after the oscillation is started, the count source is supplied to the prescaler 12 so that a count operation is started.
38k0 group user s manual application 2.12 standby function 2-98 fig. 2.12.4 execution sequence example at restoration by occurrence of int 0 interrupt request (3) notes on using stop mode register setting since values of the prescaler 12 and timer 1 are automatically reloaded when returning from the stop mode, set them again, respectively. (when the oscillation stabilizing time set after stp instruction released bit is 0 ) clock restoration when the main clock side is set as a system clock, the oscillation stabilizing time for approximately 8,000 cycles of the x in input is reserved at restoration from the stop mode. stop mode x in (system clock) int 0 pin prescaler 12 counter timer 1 counter int 0 interrupt request bit peripheral device cpu operating operating stopped stopped operating operating 512 counts oscillation stabilizing time x in ; h ff 16 01 16 execute stp instruction int 0 interrupt signal input (int 0 interrupt request occurs) oscillation start prescaler 12 count start 512 counts down by prescaler 12 start supplying internal clock to cpu accept int 0 interrupt request note: f(x in )/16 is input as the prescaler 12 count source. when restoring microcomputer from stop mode by int 0 interrupt (rising edge selected)
38k0 group user s manual application 2-99 2.12 standby function 2.12.4 wait mode the wait mode is set by execution of the wit instruction. in the wait mode, oscillation continues, but the internal clock stops at the h level. the cpu stops, but most of the peripheral units continue operating. (1) state in wait mode the continuation of oscillation permits clock supply to the peripheral units. table 2.12.2 shows the state in the wait mode. table 2.12.2 state in wait mode item oscillation cpu internal clock i/o ports p0 p6 timer watchdog timer serial i/o usb function external bus interface a-d converter comparator state in wait mode operating. stopped. stopped at h level. retains the state at the wit instruction execution. operating. operating. operating. operating. stopped. operating. operating.
38k0 group user s manual application 2.12 standby function 2-100 (2) release of wait mode the wait mode is released by reset input or by the occurrence of an interrupt request. note the differences in the restoration process according to reset input or interrupt request, as described below. in the wait mode, oscillation is continued, so an instruction can be executed immediately after the wait mode is released. restoration by reset input the wait mode is released by holding the input level of the reset pin at l in the wait mode. upon release of the wait mode, all ports are in the input state, and supply of the internal clock to the cpu is started. to reset the microcomputer, the reset pin should be held at an l level for 16 cycles or more of x in . the reset state is released in approximately 10.5 cycles to 18.5 cycles of the x in input after the input of the reset pin is returned to the h level. at release of wait mode, the internal ram retains its contents previous to the reset. however, the previous contents of the cpu register and sfr are not retained. figure 2.12.5 shows the reset input time. for more details concerning reset, refer to 2.9 reset . fig. 2.12.5 reset input time vcc reset x in wait mode 16 cycles of x in operating mode time to hold internal reset state = approximately 10.5 to 18.5 cycles of x in input execute wit instruction
38k0 group user s manual application 2-101 2.12 standby function restoration by interrupt request in the wait mode, the occurrence of an interrupt request releases the wait mode and supply of the internal clock to the cpu is started. at the same time, the interrupt request used for restoration is accepted, so the interrupt processing routine is executed. however, when using an interrupt request for restoration from the wait mode, in order to enable the selected interrupt, you must execute the stp instruction after setting the following conditions. [necessary register setting] ? interrupt disable flag i = 0 (interrupt enabled) ? interrupt request bit of interrupt source to be used for restoration = 0 (no interrupt request issued) ? interrupt enable bit of interrupt source to be used for restoration = 1 (interrupts enabled) for more details concerning interrupts, refer to 2.2 interrupts . 2.12.5 notes on stand-by function in stand-by state* 1 for low-power dissipation, do not make input levels of an input port and an i/o port undefined . pull-up (connect the port to v cc ) these ports through a resistor. when determining a resistance value, note the following points: external circuit variation of output levels during the ordinary operation when using built-in pull-up resistor, note on varied current values. when setting as an input port: fix its input level when setting as an output port: prevent current from flowing out to external reason the potential which is input to the input buffer in a microcomputer is unstable in the state that input levels of an input port and an i/o port are undefined . this may cause power source current. * 1 stand-by state : the stop mode by executing the stp instruction the wait mode by executing the wit instruction
2-102 38k0 group user s manual application 2.13 flash memory fig. 2.13.1 memory map of flash memory version for 38k0 group 2.13 flash memory this paragraph explains the registers setting method and the notes related to the flash memory version. 2.13.1 overview the functions of the flash memory version are similar to those of the mask rom version except that the flash memory is built-in and some of the sfr area differ from that of the mask rom version (refer to 2.13.2 memory map ). in the flash memory version, the built-in flash memory can be programmed or erased by using the following three modes. cpu rewrite mode parallel i/o mode standard serial i/o mode 2.13.2 memory map 38k0 group flash memory version has 32 kbytes of built-in flash memory. figure 2.13.1 shows the memory map of the flash memory version. internal ram area (2 kbyte) not used built-in flash memory area (32 kbytes) 0000 16 0040 16 083f 16 0840 16 0fe0 16 1000 16 ffff 16 ram 8000 16 ffff 16 32 kbytes user rom area boot rom area ffff 16 f000 16 4 kbytes 0fff 16 reserved rom area 8000 16 8080 16 sfr area sfr area not used note: access to boot rom area pararell i/o mode cpu rewrite mode standard serial mode read/write avilable read only available read only available
38k0 group user? manual application 2-103 2.13 flash memory fig. 2.13.3 structure of flash memory control register fig. 2.13.2 memory map of registers related to flash memory 2.13.3 related registers flash memory control register (fmcr) 0ffe 16 address flash memory control register b7 b6 b5 b4 b3 b2 b1 b0 flash memory co ntrol register (fmcr : address 0ffe 16 ) (note 1) b 0 1 2 4 name functions at reset r w 0 0 0 user area/boot area selection bit (note 4) cpu rewrite mode select bit (note 2) 0 : busy (being written or erased) 1 : ready 5 6 7 0 undefined undefined undefined ry/by status flag 3 0: user rom area 1: boot rom area flash memory reset bit (note 3) 0: normal operation 1: reset cpu rewrite mode entry flag 0: normal mode 1: cpu rewrite mode 0 : normal mode (software commands invalid) 1 : cpu rewrite mode (software commands acceptable) 1 nothing is arranged for these bits. if writing, set 0 . when these bits are read out, the contents are undefined. notes 1: the contents of flash memory control register are xxx00001 just after reset release. 2: for this bit to be set to 1 , the user needs to write 0 and then 1 to it in succession. if it is not this procedure, this bit will not be set to 1 . additionally, it is required to ensure that no interrupt will be generated during that interval. use the control program in the area except the built-in flash memor y for write to this bit. 3: this bit is valid when the cpu rewrite mode select bit is 1 . set this bit 3 to 0 subsequently after setting bit 3 to 1 . 4: use the control program in the area except the built-in flash memory for write to this bit.
2-104 38k0 group user s manual application 2.13 flash memory 2.13.4 parallel i/o mode in the parallel i/o mode, program/erase to the built-in flash memory can be performed by a flash programmer (mfw-i). the memory area of program/erase is from 0f000 16 to 0ffff 16 (boot rom area) or from 08000 16 to 0ffff 16 (user rom area). be especially careful when erasing; if the memory area is not set correctly, the products will be damaged eternally. table 2.13.1 shows the setting of programmers when programming in the parallel i/o mode. mfw-i provided by sunny giken inc. (http://www.sunnygiken.co.jp/english/index.html) table 2.13.1 setting of programmers when parallel programming products M38K09F8HP/lhp m38k09f8fp/lfp parallel adapter mfw-s18 mfw-s19 boot rom area 0f000 16 to 0ffff 16 user rom area 08000 16 to 0ffff 16 2.13.5 standard serial i/o mode table 2.13.2 shows a pin connection example (4 wires) between the programmer (mfw-i) and the microcomputer when programming in the standard serial i/o mode. mfw-i provided by sunny giken inc. (http://www.sunnygiken.co.jp/english/index.html) table 2.13.2 connection example to flash programmer when serial programming (4 wires) pin name p4 2 /e x tc/s clk p4 0 /e x dreq/r x d p4 1 /e x dack/txd ______ p4 3 /e x a1/s rdy cnv ss ____________ reset v cc , pv cc , dv cc ( note 2 ) v ss , pv ss ( note 1 ) pin number 53 51 52 54 7 8 14, 21, 22 11, 20 38k0 group flash memory version notes 1: when connecting a serial programmer, first connect both gnds to the same gnd level. 2: v cc power of mfw-1 is supplied from a target board. power consumption of mfw-1 is max. 200 ma when serial programming. therefore, when the current capacity of target borad is short, connect ac adapter and supply power source to mfw-1. function transfer clock input serial data input serial data output transmit/receive enable output v pp input reset input target board power source monitor input gnd mfw-1 signal name clk r x d t x d busy cnv ss reset v cc (note 2) gnd (note 1) mfw-1 side connector line number 3 10 4 2 1 8 1 7
38k0 group user s manual application 2-105 2.13 flash memory 2.13.6 cpu rewrite mode in the cpu rewrite mode, issuing software commands through the central processing unit (cpu) can rewrite the built-in flash memory. accordingly, the contents of the built-in flash memory can be rewritten with the microcomputer itself mounted on board, without using the programmer. store the rewrite control program to the built-in flash memory in advance. the built-in flash memory cannot be read in the cpu rewrite mode. accordingly, after transferring the rewrite control program to the internal ram, execute it on the ram. the following commands can be used in the cpu rewrite mode: read array, read status register, clear status register, program, erase all block, and block erase. for details concerning each command, refer to chapter 1 flash memory mode (cpu rewrite mode) . (1) cpu rewrite mode beginning/release procedures operation procedure in the cpu rewrite mode for the built-in flash memory is described below. as for the control example, refer to 2.13.7 (2) control example in the cpu rewrite mode. [beginning procedure] ? apply 4.50 to 5.25 v to the cnv ss /v pp pin (at selecting boot rom area). ? release reset. ? set bits 6 and 7 (main clock division ratio selection bits) of the cpu mode register. ? after cpu rewrite mode control program is transferred to internal ram, jump to this control program on ram. (the following operations are controlled by this control program). ? apply 4.50 to 5.25 to the cnv ss /v pp pin (in single-chip mode). ? set 1 to the cpu rewrite mode select bit (bit 1 of address 0ffe 16 ). ? read the cpu rewrite mode entry flag (bit 2 of address 0ffe 16 ) to confirm that the cpu rewrite mode is set to 1 . ? flash memory operations are executed by using software commands. note: the following procedures are also necessary. control for data which is input from the external (serial i/o etc.) and to be programmed to the flash memory. initial setting for ports, etc. writing to the watchdog timer [release procedure] ? execute the read command or set the flash memory reset bit (bit 3 of address 0ffe 16 ). ? set the cpu rewrite mode select bit (bit 0 of address 0ffe 16 ) to 0 .
2-106 38k0 group user s manual application 2.13 flash memory 2.13.7 flash memory mode application examples the control pin processing example on the system board in the standard serial i/o mode and the control example in the cpu rewrite mode are described below. (1) control pin connection example on the system board in standard serial i/o mode as shown in figure 2.13.4, in the standard serial i/o mode, the built-in flash memory can be rewritten with the microcomputer mounted on board. connection examples of control pins (p4 0 /e x dreq/r x d, ______ ____________ p4 1 /e x dack/t x d, p4 2 /e x tc/s clk , p4 3 /e x a1/s rdy , p1 6 , cnv ss , and reset pin) in the standard serial i/o mode are described below. fig. 2.13.4 rewrite example of built-in flash memory in standard serial i/o mode rs-232c m38k09f8fp/hp m38k09f8lfp/lhp serial programmer table 2.13.3 shows the setting condition in the standard serial i/o mode. table 2.13.3 setting condition in serial i/o mode pin name cnv ss /v pp ( note ) p1 6 p4 2 /e x tc/s clk ____________ reset pin number 7 5 53 8 38k0 group flash memory version note: cnv ss /v pp is not v cc but a voltage when programming. 4.50 to 5.25 v v cc v cc edge from v ss to v cc value
38k0 group user s manual application 2-107 2.13 flash memory ? when control signals are not affected to user system circuit when the control signals in the standard serial i/o mode are not used or not affected to the user system circuit, they can be connected as shown in figure 2.13.5. fig. 2.13.5 connection example in standard serial i/o mode (1) ? when control signals are affected to user system circuit-1 figure 2.13.6 shows an example that the jumper switch cut-off the control signals not to supply to the user system circuit in the standard serial i/o mode. fig. 2.13.6 connection example in standard serial i/o mode (2) m38k09f8fp/hp m38k09f8lfp/lhp reset v pp (cnv ss ) t x d(p4 1 /exdack) s clk (p4 2 /extc) r x d(p4 0 /exdreq) x in x out b usy (p4 3 /exa1) v ss dv cc pv cc v cc pv ss (p1 6 ) target board not used or to user system circuit ? 1 user reset signal (low active) ? 1: when not used, set to input mode and pull up or pull down, or set to output mode and open. ? 2: it is necessar y to a pp l y vcc to s clk ( p4 2 /extc ) p in onl y when reset is released in the standard serial i/o mode. ? 2 reset v pp (cnv ss ) x in x out v ss target board to user system circuit user reset signal (low active) ? : it is necessar y to a pp l y vcc to s clk ( p4 2 /extc ) p in onl y when reset is released in the standard serial i/o mode. ? m38k09f8fp/hp m38k09f8lfp/lhp t x d(p4 1 /exdack) s clk (p4 2 /extc) r x d(p4 0 /exdreq) b usy (p4 3 /exa1) dv cc pv cc v cc pv ss (p1 6 )
2-108 38k0 group user s manual application 2.13 flash memory ? when control signals are affected to user system circuit-2 figure 2.13.7 shows an example that the analog switch (74hc4066) cut-off the control signals not to supply to the user system circuit in the standard serial i/o mode. fig. 2.13.7 connection example in standard serial i/o mode (3) reset v pp (cnv ss ) x in x out target board 74hc4066 v ss user reset signal (low active) to user system circuit ? : it is necessary to apply vcc to s clk (p4 2 /extc) pin only when reset is released in the standard serial i/o mode. ? m38k09f8fp/hp m38k09f8lfp/lhp t x d(p4 1 /exdack) s clk (p4 2 /extc) r x d(p4 0 /exdreq) b usy (p4 3 /exa1) dv cc pv cc v cc pv ss (p1 6 )
38k0 group user s manual application 2-109 2.13 flash memory (2) control example in cpu rewrite mode in this example, data is received by using serial i/o, and the data is programmed to the built-in flash memory in the cpu rewrite mode. figure 2.13.8 shows an example of the reprogramming system for the built-in flash memory in the cpu rewrite mode. figure 2.13.9 shows the cpu rewrite mode beginning/release flowchart. fig. 2.13.8 example of rewrite system for built-in flash memory in cpu rewrite mode dv cc pv cc v cc pv ss v ss reset cnv ss s rdy (b usy ) r x d t x d s clk note 1: a pp l y 4.50 to 5.25 v to the v pp p ower source. clock input busy output data input data output v pp power source input (note 1) p1 6 (ce) user reset signal m38k09f8fp/hp m38k09f8lfp/lhp
2-110 38k0 group user s manual application 2.13 flash memory fig. 2.13.9 cpu rewrite mode beginning/release flowchart start single-chip mode or boot mode (note 1) set cpu mode register (note 2) transfer cpu rewrite mode control program to built-in ram end jump to transferred control program on ram (the following operations are controlled by the control program on this ram) set 1 to cpu rewrite mode select bit (by writing 0 and then 1 in succession) check cpu rewrite mode entry flag using software command execute erase, program, or other operation execute read command or set flash memory reset bit (by writing 0 and then 1 in succession) (note 3) set 0 to cpu rewrite mode select bit notes 1: when mcu starts in the single-chip mode, it is necessary to apply 4.50 to 5.25 v to dhe cnvss pin until confirming of the cpu rewrite mode entry flag. 2: set bits 6 and 7 (system clock division ratio selection bits) of the cpu mode register (address 003b 16 ). 3: before releasing the cpu rewrite mode after completing erase or program operation, always be sure to execute the read array command or reset the flash memory.
38k0 group user s manual application 2-111 2.13 flash memory 2.13.8 notes on cpu rewrite mode (1) operation speed during cpu rewrite mode, set the internal clock 1.5 mhz or less using the system clock division ratio selection bits (bits 6 and 7 of address 003b 16 ). (2) instructions inhibited against use the instructions which refer to the internal data of the flash memory cannot be used during the cpu rewrite mode . (3) interrupts inhibited against use the interrupts cannot be used during the cpu rewrite mode because they refer to the internal data of the flash memory. (4) watchdog timer in case of the watchdog timer has been running already, the internal reset generated by watchdog timer underflow does not happen, because of watchdog timer is always clearing during program or erase operation. (5) reset reset is always valid. in case of cnv ss = h when reset is released, boot mode is active. so the program starts from the address contained in address fffc 16 and fffd 16 in boot rom area.
chapter 3 appendix 3.1 electrical characteristics 3.2 standard characteristics 3.3 notes on use 3.4 countermeasures against noise 3.5 list of registers 3.6 package outline 3.7 list of instruction code 3.8 machine instructions 3.9 sfr memory map 3.10 pin configurations
38k0 group user? manual appendix 3.1 electrical characteristics 3-2 ?.3 to 6.5 ?.3 to v cc + 0.3 ?.3 to v cc + 0.3 ?.3 to v cc + 0.3 ?.3 to v cc + 0.3 ?.3 to 6.5 ?.5 to 3.8 ?.3 to v cc + 0.3 ?.5 to 3.8 500 ?0 to 85 25? ?0 to 125 power source voltage analog power source voltage v cc e, v ref , pv cc , dv cc , usbv ref input voltage p0 0 ?0 7 , p1 0 ?1 7 , p2 0 ?2 7 , p3 0 p3 7 , p4 0 ?4 3 , p5 0 ?5 7 , p6 0 ?6 3 input voltage reset, x in , cnv ss2 input voltage cnv ss mask rom version flash memory version input voltage d0+, d0- output voltage p0 0 ?0 7 , p1 0 ?1 7 , p2 0 ?2 7 , p3 0 p3 7 , p4 0 ?4 3 , p5 0 ?5 7 , p6 0 ?6 3 , x out output voltage d0+, d0-, tron power dissipation ( note ) operating temperature storage temperature v v v v v v v v v mw ? ? ? v cc av cc v i v i v i v i v o v o p d t opr t stg conditions symbol ratings unit parameter all voltages are based on v ss . output transistors are cut off. ta = 25? note: the maximum rating value depends on not only the mcu? power dissipation but the heat consumption characteristics of the packa ge. mcu operating in flash memory mode (for flash memory ver- sion) 3.1 electrical characteristics 3.1.1 absolute maximum ratings table 3.1.1 absolute maximum ratings
38k0 group user? manual appendix 3-3 3.1 electrical characteristics (standard) table 3.1.2 recommended operating conditions (vcc = 4.00 to 5.25 v, vss = 0 v, ta = ?0 to 85?, unless otherwise noted) symbol parameter unit limits v cc av cc av cc v ref v ss av ss v ih v ih v ih v ih v il v il v il v il v v v v v v v v v v v v v v v v 5.25 5.25 v cc v cc v cc e v cc 3.6 0.2v cc 0.2v cc e 0.2v cc 0.8 max. power source voltage v cc system clock 12 mhz (8-divide mode) system clock 8 mhz analog power source voltage pv cc , dv cc analog power source voltage v cc e analog reference voltage v ref power source voltage v ss analog power source voltage pv ss ??input voltage p0 0 ?0 7 , p2 0 ?2 7 , p5 0 ?5 7 , p6 0 ?6 3 ??input voltage p1 0 ?1 7 , p3 0 ?3 7 , p4 0 ?4 3 ??input voltage ____________ reset, x in , cnv ss , cnv ss2 ??input voltage d0+, d0- ??input voltage p0 0 ?0 7 , p2 0 ?2 7 , p5 0 ?5 7 , p6 0 ?6 3 ??input voltage p1 0 ?1 7 , p3 0 ?3 7 , p4 0 ?4 3 ??input voltage ___________ reset, x in , cnv ss , cnv ss2 ??input voltage d0+, d0- typ. 5.00 5.00 v cc v cc 0 0 4.00 4.00 2.0 0.8v cc 0.8v cc e 0.8v cc 2.0 0 0 0 0 min. 3.1.2 recommended operating conditions
38k0 group user? manual appendix 3.1 electrical characteristics (standard) 3-4 table 3.1.3 recommended operating conditions (vcc = 4.00 to 5.25 v, vss = 0 v, ta = ?0 to 85?, unless otherwise noted) symbol parameter unit limits i oh(peak) i oh(peak) i ol(peak) i ol(peak) i ol(peak) i oh(avg) i oh(avg) i ol(avg) i ol(avg) i ol(avg) i oh(peak) i oh(peak) i ol(peak) i ol(peak) i ol(peak) i oh(avg) i oh(avg) i ol(avg) i ol(avg) i ol(avg) f(x in ) f(x in ) or f(syn) f( ) ma ma ma ma ma ma ma ma ma ma ma ma ma ma ma ma ma ma ma ma mhz mhz mhz ?0 ?0 80 80 80 ?0 ?0 40 40 40 ?0 ?0 10 20 10 ? ? 5 10 5 12 12 8 max. ??total peak output current ( note 1 )p0 0 ?0 7 , p2 0 ?2 7 , p5 0 ?5 7 , p6 0 ?6 3 ??total peak output current ( note 1 )p1 0 ?1 7 , p3 0 ?3 7 , p4 0 ?4 3 ??total peak output current ( note 1 )p0 0 ?0 7 , p2 0 ?2 7 , p5 0 ?5 7 ??total peak output current ( note 1 )p6 0 ?6 3 ??total peak output current ( note 1 )p1 0 ?1 7 , p3 0 ?3 7 , p4 0 ?4 3 ??total average output current ( note 1 )p0 0 ?0 7 , p2 0 ?2 7 , p5 0 ?5 7 , p6 0 ?6 3 ??total average output current ( note 1 )p1 0 ?1 7 , p3 0 ?3 7 , p4 0 ?4 3 ??total average output current ( note 1 )p0 0 ?0 7 , p2 0 ?2 7 , p5 0 ?5 7 ??total average output current ( note 1 )p6 0 ?6 3 ??total average output current ( note 1 )p1 0 ?1 7 , p3 0 ?3 7 , p4 0 ?4 3 ??peak output current ( note 2 )p0 0 ?0 7 , p2 0 ?2 7 , p5 0 ?5 7 , p6 0 ?6 3 ??peak output current ( note 2 )p1 0 ?1 7 , p3 0 ?3 7 , p4 0 ?4 3 ??peak output current ( note 2 )p0 0 ?0 7 , p2 0 ?2 7 , p5 0 ?5 7 ??peak output current ( note 2 )p6 0 ?6 3 ??peak output current ( note 2 )p1 0 ?1 7 , p3 0 ?3 7 , p4 0 ?4 3 ??average output current ( note 3 )p0 0 ?0 7 , p2 0 ?2 7 , p5 0 ?5 7 , p6 0 ?6 3 ??average output current ( note 3 )p1 0 ?1 7 , p3 0 ?3 7 , p4 0 ?4 3 ??average output current ( note 3 )p0 0 ?0 7 , p2 0 ?2 7 , p5 0 ?5 7 ??average output current ( note 3 )p6 0 ?6 3 ??average output current ( note 3 )p1 0 ?1 7 , p3 0 ?3 7 , p4 0 ?4 3 main clock input oscillation frequency ( note 4 ) system clock frequency frequency typ. min. 6 6 notes 1: the total peak output current is the absolute value of the peak currents flowing through all the applicable ports. the total a verage output current is the average value of the absolute value of the currents measured over 100 ms flowing through all the applicable ports. 2: the peak output current is the absolute value of the peak current flowing in each port. 3: the average output current is the average value of the absolute value of the currents measured over 100 ms. 4: the duty of oscillation frequency is 50 % . 6 mhz or 12 mhz is usable.
38k0 group user? manual appendix 3-5 3.1 electrical characteristics (standard) ??output voltage p0 0 ?0 7 , p2 0 ?2 7 , p5 0 ?5 7 , p6 0 ?6 3 ??output voltage p1 0 ?1 7 , p3 0 ?3 7 , p4 0 ?4 3 ??output voltage d0+, d0- ??output voltage p0 0 ?0 7 , p2 0 ?2 7 , p5 0 ?5 7 ??output voltage p6 0 ?6 3 ??output voltage p1 0 ?1 7 , p3 0 ?3 7 , p4 0 ?4 3 ??output voltage d0+, d0- hysteresis cntr 0 , int 0 , int 1 hysteresis p1 0 /dq 0 ?1 7 /dq 7 , p3 0 ?3 2 , p3 3 /exint, p3 4 /excs, p3 5 /exwr, p3 6 /exrd, p3 7 / exa0, p4 0 /exdreq/rxd, p4 1 /exdack/ ________ txd, p4 2 /extc/s clk , p4 3 /exa1/s rdy hysteresis d0+, d0- ____________ hysteresis reset ??input current p0 0 ?0 7 , p2 0 ?2 7 , p5 0 ?5 7 , p6 0 ?6 3 ??input current p1 0 ?1 7 , p3 0 ?3 7 , p4 0 ?4 3 ____________ ??input current reset, cnv ss ??input current x in ??input current p0 0 ?0 7 , p2 0 ?2 7 , p5 0 ?5 7 , p6 0 ?6 3 ??input current p1 0 ?1 7 , p3 0 ?3 7 , p4 0 ?4 3 ____________ ??input current reset, cnv ss , cnv ss2 ??input current x in ??input current p0 0 ?0 7, p5 0 , p5 2 (pull-ups ?n? ram hold voltage limits v v v v v parameter typ. max. symbol unit test conditions table 3.1.4 electrical characteristics (1) (vcc = 4.00 to 5.25 v, vss = 0 v, ta = ?0 to 85?, unless otherwise noted) i oh = ?0 ma i oh = ? ma i oh = ?0 ma i oh = ? ma d+ and d- pins pull- down with 0 v via a resistor of 15 k ? 5 % i ol = 10 ma i ol = 1 ma i ol = 20 ma i ol = 1 ma i ol = 10 ma i ol = 1 ma d+ and d- pins pull-up with 3.6 v via a resistor of 1.5 k ? 5 % 2.8 0.6 0.6 0.5 3.6 2.0 1.0 2.0 1.0 2.0 1.0 0.3 v v v v v v v v v v v a a a a a a a v ol v t+ ? t- v t+ ? t- v ol v ol v ol 0 v t+ ? t v t+ ? t- i ih i ih i ih i ih i il i il i il i il i il v ram 4.0 ?.0 ?0.0 2.00 v oh v oh v oh min. v cc ?.0 v cc ?.0 v cc e?.0 v cc e?.0 0.25 v i = v cc (pull-ups ?ff? v i = v cc e v i = v cc v i = v cc v i = v ss (pull-ups ?ff? v i = v ss v i = v ss v i = v ss v i = v ss when clock is stopped 5.0 5.0 5.0 ?.0 ?.0 ?.0 ?20.0 5.25 a a v ?0.0 3.1.3 electrical characteristics
38k0 group user? manual appendix 3.1 electrical characteristics (standard) 3-6 power source current (output transistor is isolated.) limits parameter min. typ. 21.0 22.5 22.0 21.0 6.0 125.0 0.1 max. 60 60 60 60 symbol unit test conditions i cc ma ma ma ma ma a table 3.1.5 electrical characteristics (2) (vcc = 4.00 to 5.25 v, vss = 0 v, ta = ?0 to 85?, unless otherwise noted) f(x in ) = system clock = 12 mhz, = 6 mhz, usb reference voltage circuit enabled f(x in ) = 12 mhz, system clock = = 8 mhz, usb reference voltage circuit enabled f(x in ) = 6 mhz, system clock = = 8 mhz, usb reference voltage circuit enabled f(x in ) = system clock = = 6 mhz, usb reference voltage circuit enabled f(x in ) = 12 mhz, system clock = = 8 mhz, usb reference voltage circuit enabled usb reference voltage circuit enabled low current mode usb reference voltage circuit disabled ta = 25 ? usb reference voltage circuit disabled ta = 85 ? notes 1: operating in single-chip mode clock input from x in pin (x out oscillator stopped) f usb = 48 mhz all usb difference-input circuits enabled leaving i/o pins open operating functions: pll circuit, cpu, timers 2: operating in single-chip mode with wait mode clock input from x in pin (x out oscillator stopped) f usb = 48 mhz all usb difference-input circuits enabled leaving i/o pins open operating functions: pll circuit, timers, usb receiving disabled functions: cpu 3: operating in single-chip mode with stop mode oscillation stopped all usb difference-input circuits disabled leaving i/o pins open normal mode ( note 1 ) wait mode ( note 2 ) stop mode ( note 3 ) 250 10 a a
38k0 group user? manual appendix 3-7 3.1 electrical characteristics (standard) resolution linearity error differential nonlinear error zero transition voltage full scale transition voltage conversion time ladder resistor reference power source input current a-d port input current min. typ. max. symbol parameter limits unit test conditions ta = 25 ? ta = 25 ? 01535 lsb lsb bits ?.5 ? 10 mv 5105 50 5125 5150 mv v ot v fst t conv r ladder i vref i i(ad) a-d converter operating; v ref = 5.0 v 122 200 5 35 150 tc(x in ) or tc(f syn ) k ? 5.0 ? ? v cc = v ref = 5.12 v v cc = v ref = 5.12 v table 3.1.6 a-d converter characteristics (v cc = 4.00 to 5.25 v, v ss = 0 v, ta = ?0 to 85?, unless otherwise noted) a-d converter not operating; v ref = 5.0 v 3.1.4 a-d converter characteristics
38k0 group user? manual appendix 3.1 electrical characteristics (standard) 3-8 table 3.1.7 timing requirements (v cc = 4.00 to 5.25 v, v ss = 0 v, ta = ?0 to 85 ?, unless otherwise noted) min. typ. max. symbol parameter limits unit ? ns ns ns ns ns ns ns ns ns ns ns ns ns t w (reset) t c (x in ) t wh (x in ) t wl (x in ) t c (cntr) t wh (cntr) t wl (cntr) t wh (int) t wl (int) t c (s clk ) t wh (s clk ) t wl (s clk ) t su (rxd? clk ) t h (s clk ?xd) reset input ??pulse width main clock input cycle time main clock input ??pulse width main clock input ??pulse width cntr 0 input cycle time cntr 0 input ??pulse width cntr 0 input ??pulse width int 0 , int 1 input ??pulse width int 0 , int 1 input ??pulse width serial i/o clock input cycle time ( note ) serial i/o clock input ??pulse width ( note ) serial i/o clock input ??pulse width ( note ) serial i/o input set up time serial i/o input hold time 2 83 35 35 200 80 80 80 80 800 370 370 220 100 note : these limits are the rating values in the clock synchronous mode, bit 6 of address 0fe0 16 = ?? in the uart mode, bit 6 of address 0fe0 16 = ?? the rating values are set to one fourth. min. typ. max. symbol parameter limits unit 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 t su (s-r) t su (s-w) t h (r-s) t h (w-s) t su (a-r) t su (a-w) t h (r-a) t h (w-a) t su (ack-r) t su (ack-w) t h (r-ack) t h (w-ack) t wh (r) t wl (r) t wh (w) t wl (w) t wh (ack) t wl (ack) t su (d-w) t h (w-d) t su (d-ack) t h (ack-w) t c ( ) t w (cycle) excs setup time for read excs setup time for write excs hold time for read excs hold time for write exa0, exa1 setup time for read exa0, exa1 setup time for write exa0, exa1 hold time for read exa0, exa1 hold time for write exdack setup time for read exdack setup time for write exdack hold time for read exdack hold time for write read ??pulse width read ??pulse width write ??pulse width write ??pulse width exdack ??pulse width exdack ??pulse width data input setup time before write data input hold time after write data input setup time before exdack data input hold time after exdack cpu clock cycle time burst mode access cycle time 0 0 0 0 10 10 0 0 10 10 0 0 80 80 80 80 120 120 40 0 60 5 125 t c ( )?+10 t c ( )?+10 table 3.1.8 timing requirements of external bus interface (exb) (v cc = 4.00 to 5.25 v, v ss = 0 v, ta = ?0 to 85 ?, unless otherwise noted) usb function not operating usb function operating 3.1.5 timing requirements
38k0 group user? manual appendix 3-9 3.1 electrical characteristics (standard) table 3.1.9 switching characteristics (v cc = 4.00 to 5.25 v, v ss = 0 v, ta = ?0 to 85 ?, unless otherwise noted) min. typ. max. symbol parameter limits unit t wh (s clk ) t wl (s clk ) t d (s clk ?xd) t v (s clk ?xd) t r (s clk ) t f (s clk ) t r (cmos) t f (cmos) serial i/o clock output ??pulse width serial i/o clock output ??pulse width serial i/o output delay time serial i/o output valid time serial i/o clock output rising time serial i/o clock output falling time cmos output rising time ( note ) cmos output falling time ( note ) ?0 notes: pins x out , d0+, d0- are excluded. t c (s clk )/2?0 t c (s clk )/2?0 ns ns ns ns ns ns ns ns 140 30 30 30 30 min. typ. max. symbol parameter limits unit t a (r-d) t v (r-d) t a (ack-d) t v (ack-d) t d (r-mdis) t d (w-mdis) t d (r-men) t d (w-men) data output enable time after read data output disable time after read data output enable time after exdack data output disable time after exdack in cycle mode mch_req disable output delay time after read in cycle mode mch_req disable output delay time after write in cycle mode mch_req enable output delay time after read in cycle mode mch_req enable output delay time after write ns ns ns ns ns ns 0 0 fig. 3.1.1 output switching characteristics measurement circuit 1 0 0 p f m e a s u r e d o u t p u t p i n c m o s o u t p u t table 3.1.10 switching characteristics of external bus interface (exb) (v cc = 4.00 to 5.25 v, v ss = 0 v, ta = 20 to 85 c, unless otherwise noted) usb function not operating usb function operating 60 80 t c ( )+10 t c ( )+10 t c ( ) 3+10 t c ( ) 5+10 t c ( ) 3+10 t c ( ) 5+10 ns ns ns ns usb function not operating usb function operating 3.1.6 switching characteristics
38k0 group user s manual appendix 3.1 electrical characteristics (standard) 3-10 table 3.1.11 switching characteristics (usb ports) (v cc = 4.00 to 5.25 v, v ss = 0 v, ta = 20 to 85 c, unless otherwise noted) min. typ. max. symbol parameter limits unit t fr ( d+/d- ) t ff ( d+/d- ) t frfm ( d+/d- ) vcrs( d+/d- ) usb full-speed output rising time cl = 50 pf usb full-speed output rising time cl = 50 pf usb full-speed ports rising/falling ratio t fr ( d+/d- )/t ff ( d+/d- ) usb output signal cross-over voltage 4 4 90 1.3 ns ns % v 20 20 111.11 2.0 fig. 3.1.2 usb output switching characteristics measurement cir- cuit (1) for d0- fig. 3.1.3 usb output switching characteristics measurement cir- cuit (2) for d0+ r l = 2 7 ? c l m e a s u r e d o u t p u t p i n r l = 1 5 k ? u s b p o r t o u t p u t c l t r o n measured output pin r l = 2 7 ? r l = 1 . 5 k ? r l = 15 k ? u s b p o r t o u t p u t
38k0 group user s manual appendix 3-11 3.1 electrical characteristics (l.ver) table 3.1.12 recommended operating conditions (vcc = 3.00 to 5.25 v, vss = 0 v, ta = 20 to 85 c, unless otherwise noted) symbol parameter unit limits v cc av cc av cc v ref v ref v ss av ss v ih v ih v ih v ih v il v il v il v il v v v v v v v v v v v v v v v v v v v 5.25 5.25 5.25 v cc 3.6 v cc v cc v cc e v cc 3.6 0.2v cc 0.2v cc e 0.2v cc 0.8 max. power source voltage v cc system clock 12 mhz (2-/4-/8-divide mode) system clock 8 mhz system clock 6 mhz analog power source voltage pv cc , dv cc analog power source voltage v cc e analog reference voltage v ref analog reference voltage usbv ref vcc = 3.6 to 4.0 v vcc = 3.0 to 3.6 v power source voltage v ss analog power source voltage pv ss h input voltage p0 0 p0 7 , p2 0 p2 7 , p5 0 p5 7 , p6 0 p6 3 h input voltage p1 0 p1 7 , p3 0 p3 7 , p4 0 p4 3 h input voltage reset, x in , cnv ss , cnv ss2 h input voltage d0+, d0- l input voltage p0 0 p0 7 , p2 0 p2 7 , p5 0 p5 7 , p6 0 p6 3 l input voltage p1 0 p1 7 , p3 0 p3 7 , p4 0 p4 3 l input voltage reset, x in , cnv ss , cnv ss2 l input voltage d0+, d0- typ. 5.00 5.00 5.00 v cc v cc 0 0 4.00 4.00 3.00 2.0 3.0 3.0 0.8v cc 0.8v cc e 0.8v cc 2.0 0 0 0 0 min. 3.1.7 recommended operating conditions
38k0 group user s manual appendix 3.1 electrical characteristics (l.ver) 3-12 table 3.1.13 recommended operating conditions (vcc = 3.00 to 5.25 v, vss = 0 v, ta = 20 to 85 c, unless otherwise noted) symbol parameter unit limits i oh(peak) i oh(peak) i ol(peak) i ol(peak) i ol(peak) i oh(avg) i oh(avg) i ol(avg) i ol(avg) i ol(avg) i oh(peak) i oh(peak) i ol(peak) i ol(peak) i ol(peak) i oh(avg) i oh(avg) i ol(avg) i ol(avg) i ol(avg) f(x in ) f(x in ) or f(syn) f( ) ma ma ma ma ma ma ma ma ma ma ma ma ma ma ma ma ma ma ma ma mhz mhz mhz mhz mhz mhz 80 80 80 80 80 40 40 40 40 40 10 10 10 20 10 5 5 5 10 5 12 6 12 6 8 6 max. h total peak output current ( note 1 )p0 0 p0 7 , p2 0 p2 7 , p5 0 p5 7 , p6 0 p6 3 h total peak output current ( note 1 )p1 0 p1 7 , p3 0 p3 7 , p4 0 p4 3 l total peak output current ( note 1 )p0 0 p0 7 , p2 0 p2 7 , p5 0 p5 7 l total peak output current ( note 1 )p6 0 p6 3 l total peak output current ( note 1 )p1 0 p1 7 , p3 0 p3 7 , p4 0 p4 3 h total average output current ( note 1 )p0 0 p0 7 , p2 0 p2 7 , p5 0 p5 7 , p6 0 p6 3 h total average output current ( note 1 )p1 0 p1 7 , p3 0 p3 7 , p4 0 p4 3 l total average output current ( note 1 )p0 0 p0 7 , p2 0 p2 7 , p5 0 p5 7 l total average output current ( note 1 )p6 0 p6 3 l total average output current ( note 1 )p1 0 p1 7 , p3 0 p3 7 , p4 0 p4 3 h peak output current ( note 2 )p0 0 p0 7 , p2 0 p2 7 , p5 0 p5 7 , p6 0 p6 3 h peak output current ( note 2 )p1 0 p1 7 , p3 0 p3 7 , p4 0 p4 3 l peak output current ( note 2 )p0 0 p0 7 , p2 0 p2 7 , p5 0 p5 7 l peak output current ( note 2 )p6 0 p6 3 l peak output current ( note 2 )p1 0 p1 7 , p3 0 p3 7 , p4 0 p4 3 h average output current ( note 3 )p0 0 p0 7 , p2 0 p2 7 , p5 0 p5 7 , p6 0 p6 3 h average output current ( note 3 )p1 0 p1 7 , p3 0 p3 7 , p4 0 p4 3 l average output current ( note 3 )p0 0 p0 7 , p2 0 p2 7 , p5 0 p5 7 l average output current ( note 3 )p6 0 p6 3 l average output current ( note 3 )p1 0 p1 7 , p3 0 p3 7 , p4 0 p4 3 main clock input oscillation frequency vcc = 4.00 to 5.25 v ( note 4 ) vcc = 3.00 to 4.00 v system clock frequency vcc = 4.00 to 5.25 v vcc = 3.00 to 4.00 v frequency vcc = 4.00 to 5.25 v vcc = 3.00 to 4.00 v typ. min. 6 6 6 6 notes 1: the total peak output current is the absolute value of the peak currents flowing through all the applicable ports. the total a verage output current is the average value of the absolute value of the currents measured over 100 ms flowing through all the applicable ports. 2: the peak output current is the absolute value of the peak current flowing in each port. 3: the average output current is the average value of the absolute value of the currents measured over 100 ms. 4: the duty of oscillation frequency is 50 % . 6 mhz or 12 mhz is usable.
38k0 group user s manual appendix 3-13 3.1 electrical characteristics (l.ver) h output voltage p0 0 p0 7 , p2 0 p2 7 , p5 0 p5 7 , p6 0 p6 3 h output voltage p1 0 p1 7 , p3 0 p3 7 , p4 0 p4 3 limits v v v v parameter typ. max. symbol unit test conditions table 3.1.14 electrical characteristics (1) (vcc = 3.00 to 5.25 v, vss = 0 v, ta = 20 to 85 c, unless otherwise noted) i oh = 10 ma (vcc = 4.00 to 5.25 v) i oh = 1 ma i oh = 10 ma (v cc e = 4.00 to 5.25 v) i oh = 1 ma d+ and d- pins pull- down with 0 v via a resistor of 15 k ? 5 % i ol = 10 ma (vcc = 4.00 to 5.25 v) i ol = 1 ma i ol = 20 ma (vcc = 4.00 to 5.25 v) i ol = 1 ma i ol = 10 ma (v cc e = 4.00 to 5.25 v) i ol = 1 ma (v cc e = 3.00 to 5.25 v) d+ and d- pins pull-up with 3.6 v via a resistor of 1.5 k ? 5 % v i = v cc (pull-ups off ) v i = v cc e v i = v cc v i = v cc v i = v ss (pull-ups off ) v i = v ss v i = v ss v i = v ss v i = v ss (vcc = 4.00 to 5.25 v) v i = v ss when clock is stopped 2.8 0.6 0.6 0.5 3.6 2.0 1.0 2.0 1.0 2.0 1.0 0.3 5.0 5.0 5.0 5.0 5.0 5.0 120.0 5.25 v v v v v v v v v v v ol h output voltage d0+, d0- l output voltage p0 0 p0 7 , p2 0 p2 7 , p5 0 p5 7 l output voltage p6 0 p6 3 l output voltage p1 0 p1 7 , p3 0 p3 7 , p4 0 p4 3 l output voltage d0+, d0- hysteresis cntr 0 , int 0 , int 1 hysteresis p1 0 /dq 0 p1 7 /dq 7 , p3 0 p3 2 , p3 3 /exint, p3 4 /excs, p3 5 /exwr, p3 6 /exrd, p3 7 / exa0, p4 0 /exdreq/rxd, p4 1 /exdack/ txd, p4 2 /extc/s clk , p4 3 /exa1/s rdy hysteresis d0+, d0- hysteresis reset h input current p0 0 p0 7 , p2 0 p2 7 , p5 0 p5 7 , p6 0 p6 3 h input current p1 0 p1 7 , p3 0 p3 7 , p4 0 p4 3 h input current reset, cnv ss h input current x in l input current p0 0 p0 7 , p2 0 p2 7 , p5 0 p5 7 , p6 0 p6 3 l input current p1 0 p1 7 , p3 0 p3 7 , p4 0 p4 3 l input current reset, cnv ss , cnv ss2 l input current x in l input current p0 0 p0 7, p5 0 , p5 2 (pull-ups on ) ram hold voltage v t+ v t- v t+ v t- v ol v ol v ol 0 v t+ v t v t+ v t- i ih i ih i ih i ih i il i il i il i il i il v ram v v a a a a a a a a a a v 4.0 4.0 60.0 20.0 10.0 2.00 v oh v oh v oh min. v cc 2.0 v cc 1.0 v cc e 2.0 v cc e 1.0 0.25 3.1.8 electrical characteristics
38k0 group user s manual appendix 3.1 electrical characteristics (l.ver) 3-14 power source current (output transistor is isolated.) limits parameter min. typ. 21.0 22.5 22.0 21.0 9.0 6.0 2.0 125.0 0.1 max. 60 60 60 60 35 30 250 10 symbol unit test conditions i cc ma ma ma ma ma ma ma ma a a a table 3.1.15 electrical characteristics (2) (vcc = 3.00 to 5.25 v, vss = 0 v, ta = 20 to 85 c, unless otherwise noted) f(x in ) = system clock = 12 mhz, = 6 mhz, usb reference voltage circuit enabled f(x in ) = 12 mhz, system clock = = 8 mhz, usb reference voltage circuit enabled f(x in ) = 6 mhz, system clock = = 8 mhz, usb reference voltage circuit enabled f(x in ) = system clock = = 6 mhz, usb reference voltage circuit enabled f(x in ) = system clock = = 6 mhz, usb reference voltage circuit disabled f(x in ) = system clock = = 6 mhz, usb reference voltage circuit disabled f(x in ) = 12 mhz, system clock = = 8 mhz, usb reference voltage circuit enabled f(x in ) = system clock = = 6 mhz, usb reference voltage circuit disabled usb reference voltage circuit enabled low current mode usb reference voltage circuit disabled ta = 25 c usb reference voltage circuit disabled ta = 85 c notes 1: operating in single-chip mode clock input from x in pin (x out oscillator stopped) f usb = 48 mhz all usb difference-input circuits enabled leaving i/o pins open operating functions: pll circuit, cpu, timers 2: operating in single-chip mode with wait mode clock input from x in pin (x out oscillator stopped) f usb = 48 mhz all usb difference-input circuits enabled leaving i/o pins open operating functions: pll circuit, timers, usb receiving disabled functions: cpu 3: operating in single-chip mode with stop mode oscillation stopped all usb difference-input circuits disabled leaving i/o pins open normal mode ( note 1 ) wait mode ( note 2 ) stop mode ( note 3 ) vcc = 3.00 to 4.00 v vcc = 4.00 to 5.25 v vcc = 3.00 to 3.60 v vcc = 4.00 to 5.25 v vcc = 3.00 to 4.00 v vcc = 4.00 to 5.25 v vcc = 3.00 to 5.25 v
38k0 group user s manual appendix 3-15 3.1 electrical characteristics (l.ver) resolution linearity error differential nonlinear error zero transition voltage full scale transition voltage conversion time ladder resistor reference power source input current a-d port input current min. typ. max. symbol parameter limits unit test conditions ta = 25 c ta = 25 c 01535 lsb lsb bits 1.5 3 10 mv 5105 50 5125 5150 mv v ot v fst t conv r ladder i vref i i(ad) a-d converter operating; v ref = 5.0 v 122 200 5 35 150 tc(x in ) or tc(f syn ) k ? 5.0 a a v cc = v ref = 5.12 v v cc = v ref = 5.12 v table 3.1.16 a-d converter characteristics (v cc = 3.00 to 5.25 v, v ss = 0 v, ta = 20 to 85 c, unless otherwise noted) a-d converter not operating; v ref = 5.0 v 3.1.9 a-d converter characteristics
38k0 group user s manual appendix 3.1 electrical characteristics (l.ver) 3-16 table 3.1.17 timing requirements (1) (v cc = 4.00 to 5.25 v, v ss = 0 v, ta = 20 to 85 c, unless otherwise noted) min. typ. max. symbol parameter limits unit s ns ns ns ns ns ns ns ns ns ns ns ns ns t w (reset) t c (x in ) t wh (x in ) t wl (x in ) t c (cntr) t wh (cntr) t wl (cntr) t wh (int) t wl (int) t c (s clk ) t wh (s clk ) t wl (s clk ) t su (rxd s clk ) t h (s clk rxd) reset input l pulse width main clock input cycle time main clock input h pulse width main clock input l pulse width cntr 0 input cycle time cntr 0 input h pulse width cntr 0 input l pulse width int 0 , int 1 input h pulse width int 0 , int 1 input l pulse width serial i/o clock input cycle time ( note ) serial i/o clock input h pulse width ( note ) serial i/o clock input l pulse width ( note ) serial i/o input set up time serial i/o input hold time 2 83 35 35 200 80 80 80 80 800 370 370 220 100 note : these limits are the rating values in the clock synchronous mode, bit 6 of address 0fe0 16 = 1 . in the uart mode, bit 6 of address 0fe0 16 = 0 ; the rating values are set to one fourth. min. typ. max. symbol parameter limits unit s ns ns ns ns ns ns ns ns ns ns ns ns ns t w (reset) t c (x in ) t wh (x in ) t wl (x in ) t c (cntr) t wh (cntr) t wl (cntr) t wh (int) t wl (int) t c (s clk ) t wh (s clk ) t wl (s clk ) t su (rxd s clk ) t h (s clk rxd) reset input l pulse width main clock input cycle time main clock input h pulse width main clock input l pulse width cntr 0 input cycle time cntr 0 input h pulse width cntr 0 input l pulse width int 0 , int 1 input h pulse width int 0 , int 1 input l pulse width serial i/o clock input cycle time ( note ) serial i/o clock input h pulse width ( note ) serial i/o clock input l pulse width ( note ) serial i/o input set up time serial i/o input hold time 2 166 70 70 500 230 230 230 230 2000 950 950 400 200 note : these limits are the rating values in the clock synchronous mode, bit 6 of address 0fe0 16 = 1 . in the uart mode, bit 6 of address 0fe0 16 = 0 ; the rating values are set to one fourth. table 3.1.18 timing requirements (2) (v cc = 3.00 to 4.00 v, v ss = 0 v, ta = 20 to 85 c, unless otherwise noted) 3.1.10 timing requirements
38k0 group user s manual appendix 3-17 3.1 electrical characteristics (l.ver) min. typ. max. symbol parameter limits unit 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 t su (s-r) t su (s-w) t h (r-s) t h (w-s) t su (a-r) t su (a-w) t h (r-a) t h (w-a) t su (ack-r) t su (ack-w) t h (r-ack) t h (w-ack) t wh (r) t wl (r) t wh (w) t wl (w) t wh (ack) t wl (ack) t su (d-w) t h (w-d) t su (d-ack) t h (ack-w) t c ( ) t w (cycle) excs setup time for read excs setup time for write excs hold time for read excs hold time for write exa0, exa1 setup time for read exa0, exa1 setup time for write exa0, exa1 hold time for read exa0, exa1 hold time for write exdack setup time for read exdack setup time for write exdack hold time for read exdack hold time for write read h pulse width read l pulse width write h pulse width write l pulse width exdack h pulse width exdack l pulse width data input setup time before write data input hold time after write data input setup time before exdack data input hold time after exdack cpu clock cycle time burst mode access cycle time 0 0 0 0 10 10 0 0 10 10 0 0 80 80 80 80 120 120 40 0 60 5 125 t c ( ) 3+10 t c ( ) 5+10 table 3.1.19 timing requirements of external bus interface (exb) (1) (v cc = 4.00 to 5.25 v, v ss = 0 v, ta = 20 to 85 c, unless otherwise noted) usb function not operating usb function operating
38k0 group user s manual appendix 3.1 electrical characteristics (l.ver) 3-18 min. typ. max. symbol parameter limits unit 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 t su (s-r) t su (s-w) t h (r-s) t h (w-s) t su (a-r) t su (a-w) t h (r-a) t h (w-a) t su (ack-r) t su (ack-w) t h (r-ack) t h (w-ack) t wh (r) t wl (r) t wh (w) t wl (w) t wh (ack) t wl (ack) t su (d-w) t h (w-d) t su (d-ack) t h (ack-w) t c ( ) t w (cycle) excs setup time for read excs setup time for write excs hold time for read excs hold time for write exa0, exa1 setup time for read exa0, exa1 setup time for write exa0, exa1 hold time for read exa0, exa1 hold time for write exdack setup time for read exdack setup time for write exdack hold time for read exdack hold time for write read h pulse width read l pulse width write h pulse width write l pulse width exdack h pulse width exdack l pulse width data input setup time before write data input hold time after write data input setup time before exdack data input hold time after exdack cpu clock cycle time burst mode access cycle time 0 0 0 0 30 30 0 0 30 30 0 0 120 120 120 120 160 160 60 0 80 10 166 t c ( ) 3+30 t c ( ) 5+30 table 3.1.20 timing requirements of external bus interface (exb) (2) (v cc = 3.00 to 4.00 v, v ss = 0 v, ta = 20 to 85 c, unless otherwise noted) usb function not operating usb function operating
38k0 group user s manual appendix 3-19 3.1 electrical characteristics (l.ver) table 3.1.21 switching characteristics (1) (v cc = 4.00 to 5.25 v, v ss = 0 v, ta = 20 to 85 c, unless otherwise noted) min. typ. max. symbol parameter limits unit t wh (s clk ) t wl (s clk ) t d (s clk txd) t v (s clk txd) t r (s clk ) t f (s clk ) t r (cmos) t f (cmos) serial i/o clock output h pulse width serial i/o clock output l pulse width serial i/o output delay time serial i/o output valid time serial i/o clock output rising time serial i/o clock output falling time cmos output rising time ( note ) cmos output falling time ( note ) 30 notes: pins x out , d0+, d0- are excluded. t c (s clk )/2 30 t c (s clk )/2 30 ns ns ns ns ns ns ns ns 140 30 30 30 30 min. typ. max. symbol parameter limits unit t wh (s clk ) t wl (s clk ) t d (s clk txd) t v (s clk txd) t r (s clk ) t f (s clk ) t r (cmos) t f (cmos) serial i/o clock output h pulse width serial i/o clock output l pulse width serial i/o output delay time serial i/o output valid time serial i/o clock output rising time serial i/o clock output falling time cmos output rising time ( note ) cmos output falling time ( note ) 30 notes: pins x out , d0+, d0- are excluded. t c (s clk )/2 50 t c (s clk )/2 50 ns ns ns ns ns ns ns ns 350 50 50 50 50 table 3.1.22 switching characteristics (2) (v cc = 3.00 to 4.00 v, v ss = 0 v, ta = 20 to 85 c, unless otherwise noted) fig. 3.1.4 output switching characteristics measurement circuit 100 pf measured output pin cmos out p ut 3.1.11 switching characteristics
38k0 group user s manual appendix 3.1 electrical characteristics (l.ver) 3-20 min. typ. max. symbol parameter limits unit t a (r-d) t v (r-d) t a (ack-d) t v (ack-d) t d (r-mdis) t d (w-mdis) t d (r-men) t d (w-men) data output enable time after read data output disable time after read data output enable time after exdack data output disable time after exdack in cycle mode mch_req disable output delay time after read in cycle mode mch_req disable output delay time after write in cycle mode mch_req enable output delay time after read in cycle mode mch_req enable output delay time after write ns ns ns ns ns ns 0 0 table 3.1.23 switching characteristics of external bus interface (exb) (1) (v cc = 4.00 to 5.25 v, v ss = 0 v, ta = 20 to 85 c, unless otherwise noted) usb function not operating usb function operating 60 80 t c ( )+10 t c ( )+10 t c ( ) 3+10 t c ( ) 5+10 t c ( ) 3+10 t c ( ) 5+10 ns ns ns ns usb function not operating usb function operating min. typ. max. symbol parameter limits unit t a (r-d) t v (r-d) t a (ack-d) t v (ack-d) t d (r-mdis) t d (w-mdis) t d (r-men) t d (w-men) data output enable time after read data output disable time after read data output enable time after exdack data output disable time after exdack in cycle mode mch_req disable output delay time after read in cycle mode mch_req disable output delay time after write in cycle mode mch_req enable output delay time after read in cycle mode mch_req enable output delay time after write ns ns ns ns ns ns 0 0 table 3.1.24 switching characteristics of external bus interface (exb) (2) (v cc = 3.00 to 4.00 v, v ss = 0 v, ta = 20 to 85 c, unless otherwise noted) usb function not operating usb function operating 80 120 t c ( )+30 t c ( )+30 t c ( ) 3+30 t c ( ) 5+30 t c ( ) 3+30 t c ( ) 5+30 ns ns ns ns usb function not operating usb function operating
38k0 group user s manual appendix 3-21 3.1 electrical characteristics (l.ver) table 3.1.25 switching characteristics (usb ports) (v cc = 3.00 to 5.25 v, v ss = 0 v, ta = 20 to 85 c, unless otherwise noted) min. typ. max. symbol parameter limits unit t fr ( d+/d- ) t ff ( d+/d- ) t frfm ( d+/d- ) vcrs( d+/d- ) usb full-speed output rising time cl = 50 pf usb full-speed output rising time cl = 50 pf usb full-speed ports rising/falling ratio t fr ( d+/d- )/t ff ( d+/d- ) usb output signal cross-over voltage 4 4 90 1.3 ns ns % v 20 20 111.11 2.0 fig. 3.1.5 usb output switching characteristics measurement cir- cuit (1) for d0- fig. 3.1.6 usb output switching characteristics measurement cir- cuit (2) for d0+ r l = 27 ? c l measured output pin r l = 15 k ? usb port output cl tron measured output pin r l = 27 ? r l = 1.5 k ? r l = 15 k ? usb port output
38k0 group user s manual appendix 3.1 electrical characteristics 3-22 fig. 3.1.7 timing chart (1) 0.2v cc e t d (s clk -txd) t f 0.2v cc e 0.8v cc e 0.8v cc e t r t su (rxd-s clk )t h (s clk -rxd) t v (s clk -txd) t c (s clk ) t wl (s clk ) t wh (s clk ) rxd (at receive) s clk 0.2v cc t wl (x in ) 0.8v cc t wh (x in ) t c (x in ) x in 0.2v cc 0.8 v cc t w (reset) reset 0.2v cc t wl (cntr) 0.8v cc t wh (cntr) t c (cntr) 0.2v cc t wl (int) 0.8v cc t wh (int) txd (at transmit) int 0 /int 1 cntr 0 [serial i/o]
38k0 group user s manual appendix 3-23 3.1 electrical characteristics fig. 3.1.8 timing chart (2) exa0, exa1 dq 0 to dq 7 excs exrd 0.8v cc 0.2v cc t su(a-r) 0.8v cc 0.2v cc t h(r-a) 0.2v cc t h(r-s) t su(s-r) 0.8v cc 0.2v cc t wl(r) 0.8v cc 0.2v cc t a(r-d) t v(r-d) exa0, exa1 dq 0 to dq 7 excs exwr 0.8v cc 0.2v cc t su(a-w ) 0.8v cc 0.2v cc t h(w-a) 0.2v cc t h(w-s) t su(s-w) 0.8v cc 0.2v cc t wl(w) 0.8v cc 0.2v cc t su(d-w) t h(w-d)  timing chart [ exb ] < read > < write >
38k0 group user s manual appendix 3.1 electrical characteristics 3-24 fig. 3.1.9 timing chart (3) exa0, exa1 dq 0 to dq 7 excs exrd 0.8v cc 0.2v cc t su(a-r) 0.8v cc 0.2v cc t h(r-a) 0.2v cc t h(r-s) t su(s-r) 0.8v cc 0.2v cc t wl(r) 0.8v cc 0.2v cc t a(r-d) t v(r-d) exa0, exa1 dq 0 to dq 7 excs exwr 0.8v cc 0.2v cc t su(a-w) 0.8v cc 0.2v cc t h(w-a) 0.2v cc t h(w-s) t su(s-w) 0.8v cc 0.2v cc t wl(w) 0.8v cc 0.2v cc t su(d-w) t h(w-d) exint(mch_req) t d (r-men) 0.2v cc 0.2v cc t d (r-mdis) exint(mch_req) td (w-men) 0.2v cc 0.2v cc td (w-mdis)  timing chart [ exb ] < read > < write >
38k0 group user s manual appendix 3-25 3.1 electrical characteristics fig. 3.1.10 timing chart (4) exdack dq 0 to dq 7 exrd 0.8v cc 0.2v cc 0.2v cc t h(r-ack) t su(ack-r) 0.8v cc 0.2v cc t wl(r) 0.8v cc 0.2v cc t a(r-d) t v(r-d) exdreq(mch_req) t d (r-men) 0.2v cc t d (r-mdis) exdack dq 0 to dq 7 exwr 0.8v cc 0.2v cc 0.2v cc t h(w-ack) t su(ack-w) 0.8v cc 0.2v cc t wl(w) 0.8v cc 0.2v cc exdreq(mch_req) t d (w-men) 0.2v cc t d (w-mdis) t su(d-w) t h(w-d) 0.2v cc 0.2v cc  timing chart [ exb ] < read > < write >
38k0 group user s manual appendix 3.1 electrical characteristics 3-26 fig. 3.1.11 timing chart (5) dq 0 to dq 7 exdack 0.8v cc 0.2v cc 0.8v cc 0.2v cc t wl(ack) 0.8v cc 0.2v cc t a(ack-d) t v(ack-d) exdreq(mch_req) t d (ack-men) 0.2v cc t d (ack-mdis) dq 0 to dq 7 exdack 0.8v cc 0.2v cc 0.8v cc 0.2v cc t wl(ack) 0.8v cc 0.2v cc exdreq(mch_req) t d (ack-men) 0.2v cc t d (ack-mdis) t su(d-ack) t h(ack-d) 0.2v cc 0.2v cc  timing chart [ exb ] < read > < write >
38k0 group user s manual appendix 3-27 3.1 electrical characteristics fig. 3.1.12 timing chart (6) exdack dq 0 to dq 7 exrd 0.8v cc 0.2v cc t wh(r) t a(r-d) t v(r-d) exdreq(mch_req) t d(r-mdis) t wl(r) t w(cycle) 0.2v cc exdack dq 0 to dq 7 exwr t wh(w) t su(d-w) t h(w-d) exdreq(mch_req) t d(w-mdis) t wl(w) 0.8v cc 0.2v cc t w(cycle) 0.2v cc  timing chart [ exb ] < read > < write >
3-28 38k0 group user? manual appendix 3.2 standard characteristics 3.2 standard characteristics there are no information in this issue.
38k0 group user? manual 3-29 appendix 3.3 notes on use 3.3 notes on use 3.3.1 notes on input and output ports (1) modifying output data with bit managing instruction when the port latch of an i/o port is modified with the bit managing instruction ? 1 , the value of the unspecified bit may be changed. reason the bit managing instructions are read-modify-write form instructions for reading and writing data by a byte unit. accordingly, when these instructions are executed on a bit of the port latch of an i/o port, the following is executed to all bits of the port latch. ?s for bit which is set for input port: the pin state is read in the cpu, and is written to this bit after bit managing. ?s for bit which is set for output port: the bit value is read in the cpu, and is written to this bit after bit managing. note the following: ?ven when a port which is set as an output port is changed for an input port, its port latch holds the output data. ?s for a bit of which is set for an input port, its value may be changed even when not specified with a bit managing instruction in case where the pin state differs from its port latch contents. ? 1 bit managing instructions: seb and clb instructions
3-30 appendix 38k0 group user? manual 3.3 notes on use 3.3.2 termination of unused pins (1) terminate unused pins ? i/o ports : ?set the i/o ports for the input mode and connect them to v cc or v ss through each resistor of 1 k ? to 10 k ? . 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 increase 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 periodically to increase the reliability of program. (2) termination remarks ? i/o ports : do not open in the input mode. reason ?the power source current may increase depending on the first-stage circuit. ?an effect due to noise may be easily produced as compared with proper termination shown on the above. ? i/o ports : when setting for the input mode, do not connect to v cc or v ss directly. reason if the direction register setup changes for the output mode because of a program runaway or noise, a short circuit may occur between a port and v cc (or v ss ). ? i/o ports : when setting for the input mode, do not connect multiple ports in a lump to v cc or v ss through a resistor. reason if the direction register setup changes for the output mode because of a program runaway or noise, a short circuit may occur between ports. ?at the termination of unused pins, perform wiring at the shortest possible distance (20 mm or less) from microcomputer pins.
38k0 group user? manual 3-31 appendix 3.3 notes on use set the corresponding interrupt enable bit to ? (disabled) . set the interrupt edge select bit (active edge switch bit) or the interrupt (source) select bit to ?? nop (one or more instructions) set the corresponding interrupt request bit to ? (no interrupt request issued). set the corresponding interrupt enable bit to ? (enabled). 3.3.3 notes on interrupts (1) change of relevant register settings when the setting of the following registers or bits is changed, the interrupt request bit may be set to ?? when not requiring the interrupt occurrence synchronized with these setting, take the following sequence. ?nterrupt edge selection register (address 0ff3 16 ) ?imer x mode register (address 23 16 ) set the above listed registers or bits as the following sequence. fig. 3.3.1 sequence of changing relevant register reason when setting the following, the interrupt request bit may be set to ?? ?hen setting external interrupt active edge concerned register: interrupt edge selection register (address 0ff3 16 ) timer x mode register (address 23 16 )
3-32 appendix 38k0 group user? manual 3.3 notes on use clear the interrupt request bit to ??(no interrupt issued) nop (one or more instructions) execute the bbc or bbs instruction data transfer instruction: ldm, lda, sta, stx, and sty instructions fig. 3.3.2 sequence of check of interrupt request bit reason if the bbc or bbs instruction is executed immediately after an interrupt request bit of an interrupt request register is cleared to ?? the value of the interrupt request bit before being cleared to ? is read. 3.3.4 notes on timer if a value n (between 0 and 255) is written to a timer latch, the frequency division ratio is 1/(n+1). when switching the count source by the timer 12 and x count source selection bits, the value of timer count is altered in unconsiderable amount owing to generating of thin pulses in the count input signals. therefore, select the timer count source before set the value to the prescaler and the timer. (2) check of interrupt request bit when executing the bbc or bbs instruction to an interrupt request bit of an interrupt request register immediately after this bit is set to ??by using a data transfer instruction, execute one or more instructions before executing the bbc or bbs instruction.
38k0 group user? manual 3-33 appendix 3.3 notes on use 3.3.5 notes on serial i/o (1) notes when selecting clock synchronous serial i/o (serial i/o) ? stop of transmission operation clear the serial i/o enable bit and the transmit enable bit to ??(serial i/o and transmit disabled). reason since transmission is not stopped and the transmission circuit is not initialized even if only the serial i/o enable bit is cleared to ??(serial i/o disabled), the internal transmission is running (in this case, since pins txd, rxd, s clk , and s rdy function as i/o ports, the transmission data is not output). when data is written to the transmit buffer register in this state, data starts to be shifted to the transmit shift register. when the serial i/o enable bit is set to ??at this time, the data during internally shifting is output to the txd pin and an operation failure occurs. ? stop of receive operation clear the receive enable bit to ??(receive disabled), or clear the serial i/o enable bit to ??(serial i/o disabled). ? stop of transmit/receive operation clear the transmit enable bit and receive enable bit to ??simultaneously (transmit and receive disabled). (when data is transmitted and received in the clock synchronous serial i/o mode, any one of data transmission and reception cannot be stopped.) reason in the clock synchronous serial i/o mode, the same clock is used for transmission and reception. if any one of transmission and reception is disabled, a bit error occurs because transmission and reception cannot be synchronized. in this mode, the clock circuit of the transmission circuit also operates for data reception. accordingly, the transmission circuit does not stop by clearing only the transmit enable bit to ??(transmit disabled). also, the transmission circuit is not initialized by clearing the serial i/o enable bit to ? (serial i/o disabled) (refer to (1) ? ).
3-34 appendix 38k0 group user? manual 3.3 notes on use (2) notes when selecting clock asynchronous serial i/o (serial i/o) ? stop of transmission operation clear the transmit enable bit to ??(transmit disabled). reason since transmission is not stopped and the transmission circuit is not initialized even if only the serial i/o enable bit is cleared to ??(serial i/o disabled), the internal transmission is running (in this case, since pins txd, rxd, s clk , and s rdy function as i/o ports, the transmission data is not output). when data is written to the transmit buffer register in this state, data starts to be shifted to the transmit shift register. when the serial i/o enable bit is set to ??at this time, the data during internally shifting is output to the txd pin and an operation failure occurs. ? stop of receive operation clear the receive enable bit to ??(receive disabled). ? stop of transmit/receive operation only transmission operation is stopped. clear the transmit enable bit to ??(transmit disabled). reason since transmission is not stopped and the transmission circuit is not initialized even if only the serial i/o enable bit is cleared to ??(serial i/o disabled), the internal transmission is running (in this case, since pins txd, rxd, s clk , and s rdy function as i/o ports, the transmission data is not output). when data is written to the transmit buffer register in this state, data starts to be shifted to the transmit shift register. when the serial i/o enable bit is set to ??at this time, the data during internally shifting is output to the txd pin and an operation failure occurs. only receive operation is stopped. clear the receive enable bit to ??(receive disabled). (3) s rdy output of reception side (serial i/o) when signals are output from the s rdy pin on the reception side by using an external clock in the clock synchronous serial i/o mode, set all of the receive enable bit, the s rdy output enable bit, and the transmit enable bit to ??(transmit enabled). (4) setting serial i/o control register again (serial i/o) set the serial i/o control register again after the transmission and the reception circuits are reset by clearing both the transmit enable bit and the receive enable bit to ?. fig. 3.3.3 sequence of setting serial i/o control register again clear both the transmit enable bit (te) and the receive enable bit (re) to 0 1 can be set with the ldm instruction at the same time
38k0 group user? manual 3-35 appendix 3.3 notes on use (5) data transmission control with referring to transmit shift register completion flag (serial i/o) the transmit shift register completion flag changes from ??to ??with a delay of 0.5 to 1.5 shift clocks. when data transmission is controlled with referring to the flag after writing the data to the transmit buffer register, note the delay. (6) transmission control when external clock is selected (serial i/o) when an external clock is used as the synchronous clock for data transmission, set the transmit enable bit to ??at ??of the s clk input level. also, write the transmit data to the transmit buffer register (serial i/o shift register) at ??of the s clk input level. (7) transmit interrupt request when transmit enable bit is set (serial i/o) when the transmit interrupt is used, set the transmit interrupt enable bit to transmit enabled as shown in the following sequence. ? set the interrupt enable bit to ??(disabled) with clb instruction. ? prepare serial i/o for transmission/reception. ? set the interrupt request bit to ??with clb instruction after 1 or more instruction has been executed. ? set the interrupt enable bit to ??(enabled). reason when the transmission enable bit is set to ?? the transmit buffer empty flag and transmit shift register completion flag are set to ?? the interrupt request is generated and the transmission interrupt bit is set regardless of which of the two timings listed below is selected as the timing for the transmission interrupt to be generated. ?transmit buffer empty flag is set to ? ?transmit shift register completion flag is set to ? 3.3.6 notes on usb function (1) port pins (d0+, d0-) treatment ?he usb specification requires a driver-impedance 28 to 44 ? . in order to meet the usb specification impedance requirements, connect a resistor (27 w recommended) in series to the usb port pins. in addition, in order to reduce the ringing and control the falling/rising timing and a crossover point, connect a capacitor between the usb port 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. ?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 connection. (2) usbv ref pin treatment (noise elimination) ?onnect a capacitor between the usbv ref pin and the vss pin. the capacitor should have a 2.2 f capacitor (electrolytic capacitor) and a 0.1 f capacitor (ceramic type capacitor) connected in parallel. ?n vcc = 3.0 to 3.6 v operation, connect the usbv ref pin directly to the vcc pin in order to supply power to the usb port circuit. in addition, you will need to disable the built-in usb reference voltage circuit in this operation (set bit 4 of the usb control register to ??) if you are using the bus powered supply in this condition, the dc-dc converter must be placed outside the mcu. ?n vcc = 4.00 to 5.25 v operation, do not connect the external dc-dc converter to the usbv ref pin. use the built-in usb reference voltage circuit.
3-36 appendix 38k0 group user s manual 3.3 notes on use 3.3.7 notes on a-d converter (1) analog input pin make the signal source impedance for analog input low, or equip an analog input pin with an external capacitor of 0.01 reason an analog input pin includes the capacitor for analog voltage comparison. accordingly, when signals from signal source with high impedance are input to an analog input pin, charge and discharge noise generates. this may cause the a-d conversion precision to be worse. (2) clock frequency during a-d conversion the comparator consists of a capacity coupling, and a charge of the capacity will be lost if the clock frequency is too low. thus, make sure the following during an a-d conversion. f(x in ) is 500 khz or more do not execute the stp instruction 3.3.8 notes on watchdog timer 1 , it is impossible to switch it to 0 by a program ____________ 3.3.9 notes on reset pin connecting capacitor in case where the reset signal rise time is long, connect a ceramic capacitor or others across the reset pin and the v ss pin. use a 1000 pf or more capacitor for high frequency use. when connecting the capacitor, note the following : make the length of the wiring which is connected to a capacitor as short as possible. be sure to verify the operation of application products on the user side. reason if the several nanosecond or several ten nanosecond impulse noise enters the reset pin, it may cause a microcomputer failure. 3.3.10 notes on pll 0 (f(x in )) to operate with the main clock (f(x in )). 1 (pll enabled), wait for the oscillation stable time (1 ms or less) of pll to avoid any instability caused by the clock, then set usb clock select bit to 1 (usb clock). f usb must be stopped by disabling pll operation in stop mode. the taimer 1 for waiting oscillation stabilization when returning from stop mode will require the input count source. .
38k0 group user s manual 3-37 appendix 3.3 notes on use 3.3.11 notes on stand-by function (1) notes on using stop mode register setting since values of the prescaler 12 and timer 1 are automatically reloaded when returning from the stop mode, set them again, respectively. (when the oscillation stabilizing time set after stp instruction released bit is 0 ) clock restoration when the main clock side is set as a system clock, the oscillation stabilizing time for approximately 8,000 cycles of the x in input is reserved at restoration from the stop mode. (2) notes on stand-by function in stand-by state* 1 for low-power dissipation, do not make input levels of an input port and an i/o port undefined . pull-up (connect the port to v cc ) these ports through a resistor. when determining a resistance value, note the following points: external circuit variation of output levels during the ordinary operation when using built-in pull-up resistor, note on varied current values. when setting as an input port: fix its input level when setting as an output port: prevent current from flowing out to external reason the potential which is input to the input buffer in a microcomputer is unstable in the state that input levels of an input port and an i/o port are undefined . this may cause power source current. * 1 stand-by state : the stop mode by executing the stp instruction the wait mode by executing the wit instruction 3.3.12 notes on cpu rewrite mode (1) operation speed during cpu rewrite mode, set the internal clock (2) instructions inhibited against use the instructions which refer to the internal data of the flash memory cannot be used during the cpu rewrite mode . (3) interrupts inhibited against use the interrupts cannot be used during the cpu rewrite mode because they refer to the internal data of the flash memory. (4) watchdog timer in case of the watchdog timer has been running already, the internal reset generated by watchdog timer underflow does not happen, because of watchdog timer is always clearing during program or erase operation. (5) reset reset is always valid. in case of cnv ss = h when reset is released, boot mode is active. so the program starts from the address contained in address fffc 16 and fffd 16 in boot rom area.
3-38 appendix 38k0 group user s manual 3.3 notes on use 3.3.13 notes on programming (1) processor status register ? initializing of processor status register flags which affect program execution must be initialized after a reset. in particular, it is essential to initialize the t and d flags because they have an important effect on calculations. reason after a reset, the contents of the processor status register (ps) are undefined except for the i flag which is 1 . fig. 3.3.4 initialization of processor status register ? how to reference the processor status register to 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 should be executed after every plp instruction. fig. 3.3.6 stack memory contents after php instruction execution fig. 3.3.5 sequence of plp instruction execution reset plp instruction execution nop ( s ) (s)+1 s t o r e d p s (2) brk instruction ? interrupt priority level when the brk instruction is executed with the following conditions satisfied, the interrupt execution is started from the address of interrupt vector which has the highest priority. interrupt request bit and interrupt enable bit are set to 1 . interrupt disable flag (i) is set to 1 to disable interrupt.
38k0 group user? manual 3-39 appendix 3.3 notes on use (3) decimal calculations ? execution of decimal calculations the adc and sbc are the only instructions which will yield proper decimal notation, set the decimal mode flag (d) to ??with the sed instruction. after executing the adc or sbc instruction, execute another instruction before executing the sec , clc , or cld instruction. ? notes on status flag in decimal mode when decimal mode is selected, the values of three of the flags in the status register (the n, v, and z flags) are invalid after a adc or sbc instruction is executed. 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 determine 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 calculation. (4) jmp instruction when using the jmp instruction in indirect addressing mode, do not specify the last address on a page as an indirect address. (5) multiplication and division instructions ?the index x mode (t) and the decimal mode (d) flags do not affect the mul and div instruction. ?the execution of these instructions does not change the contents of the processor status register. (6) ports the contents of the port direction registers cannot be read. the following cannot be used: ?the data transfer instruction ( lda , etc.) ?the operation instruction when the index x mode flag (t) is ? ?the addressing mode which uses the value of a direction register as an index ?the bit-test instruction ( bbc or bbs , etc.) to a direction register ?the read-modify-write instructions ( ror , clb , or seb , etc.) to a direction register. use instructions such as ldm and sta , etc., to set the port direction registers. (7) instruction execution time the instruction execution time is obtained by multiplying the frequency of the internal clock f 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. the frequency of the internal clock f is half of the x in frequency in high-speed mode. set d flag to ?  adc or sbc instruction  nop instruction  sec , clc , or cld instruction fig. 3.3.7 status flag at decimal calculations
3-40 appendix 38k0 group user s manual 3.3 notes on use 3.3.14 notes on flash memory version the cnvss pin is connected to the internal memory circuit block by a low-ohmic resistance, since it has the multiplexed function to be a programmable power source pin (v pp pin) as well. to improve the noise reduction, connect a track between cnvss pin and vss pin or vcc pin with 1 to 10 k ? 3.3.15 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 manufacturing processes. when manufacturing an application system with the flash memory version and then switching to use of the mask rom version, please perform sufficient evaluations for the commercial samples of the mask rom version.
38k0 group user? manual 3-41 appendix 3.4 countermeasures against noise 3.4 countermeasures against noise countermeasures against noise are described below. the following countermeasures are effective against noise in theory, however, it is necessary not only to take measures as follows but to evaluate before actual use. 3.4.1 shortest wiring length the wiring on a printed circuit board can function as an antenna which feeds noise into the microcomputer. the shorter the total wiring length (by mm unit), the less the possibility of noise insertion into a microcomputer. (1) package select the smallest possible package to make the total wiring length short.  reason the wiring length depends on a microcomputer package. use of a small package, for example qfp and not dip, makes the total wiring length short to reduce influence of noise. fig. 3.4.1 selection of packages (2) wiring for reset pin make the length of wiring which is connected to the reset pin as short as possible. especially, connect a capacitor across the reset pin and the v ss pin with the shortest possible wiring (within 20mm).  reason the width of a pulse input into the reset pin is determined by the timing necessary conditions. if noise having a shorter pulse width than the standard is input to the reset pin, the reset is released before the internal state of the microcomputer is completely initialized. this may cause a program runaway. fig. 3.4.2 wiring for the reset pin d i p sdip sop qfp r e s e t r e s e t c i r c u i t n o i s e v s s v s s reset circuit v ss r e s e t v ss n . g . o.k.
3-42 appendix 38k0 group user s manual 3.4 countermeasures against noise n o i s e c n v s s v s s c n v s s v s s n . g . o . k . (3) wiring for clock input/output pins make the length of wiring which is connected to clock i/o pins as short as possible. make the length of wiring (within 20 mm) across the grounding lead of a capacitor which is connected to an oscillator and the v ss pin of a microcomputer as short as possible. separate the v ss pattern only for oscillation from other v ss patterns.  reason if noise enters clock i/o pins, clock waveforms may be deformed. this may cause a program failure or program runaway. also, if a potential difference is caused by the noise between the v ss level of a microcomputer and the v ss level of an oscillator, the correct clock will not be input in the microcomputer. fig. 3.4.3 wiring for clock i/o pins (4) wiring to cnv ss pin connect the cnv ss pin to the v ss pin with the shortest possible wiring.  reason the processor mode of a microcomputer is influenced by a potential at the cnv ss pin. if a potential difference is caused by the noise between pins cnv ss and v ss , the processor mode may become unstable. this may cause a microcomputer malfunction or a program runaway. fig. 3.4.4 wiring for cnv ss pin n o i s e x in x o u t v ss x in x o u t v ss n.g. o.k.
38k0 group user s manual 3-43 appendix 3.4 countermeasures against noise (5) wiring to v pp pin of flash memory version connect an approximately 5 k ? resistor to the v pp pin the shortest possible in series and also to the v ss pin. when not connecting the resistor, make the length of wiring between the v pp pin and the v ss pin the shortest possible. note: even when a circuit which included an approximately 5 k ? resistor is used in the mask rom version, the microcomputer operates correctly.  reason the v pp pin of the flash memory version is the power source input pin for the built-in flash memory. when programming in the built-in flash memory, the impedance of the v pp pin is low to allow the electric current for writing flow into the flash memory. because of this, noise can enter easily. if noise enters the v pp pin, abnormal instruction codes or data are read from the built-in flash memory, which may cause a program runaway. fig. 3.4.5 wiring for the v pp pin of the flash memory version 3.4.2 connection of bypass capacitor across v ss line and v cc line connect an approximately 0.1 f bypass capacitor across the v ss line and the v cc line as follows: connect a bypass capacitor across the v ss pin and the v cc pin at equal length. connect a bypass capacitor across the v ss pin and the v cc pin with the shortest possible wiring. use lines with a larger diameter than other signal lines for v ss line and v cc line. connect the power source wiring via a bypass capacitor to the v ss pin and the v cc pin. c n v s s / v p p v ss in the shortest distance approximately 5k ? fig. 3.4.6 bypass capacitor across the v ss line and the v cc line v s s v cc v ss v cc n . g .o . k .
3-44 appendix 38k0 group user s manual 3.4 countermeasures against noise 3.4.3 wiring to analog input pins connect an approximately 100 ? to 1 k ? resistor to an analog signal line which is connected to an analog input pin in series. besides, connect the resistor to the microcomputer as close as possible. connect an approximately 1000 pf capacitor across the v ss pin and the analog input pin. besides, connect the capacitor to the v ss pin as close as possible. also, connect the capacitor across the analog input pin and the v ss pin at equal length.  reason signals which is input in an analog input pin (such as an a-d converter/comparator input pin) are usually output signals from sensor. the sensor which detects a change of event is installed far from the printed circuit board with a microcomputer, the wiring to an analog input pin is longer necessarily. this long wiring functions as an antenna which feeds noise into the microcomputer, which causes noise to an analog input pin. if a capacitor between an analog input pin and the v ss pin is grounded at a position far away from the v ss pin, noise on the gnd line may enter a microcomputer through the capacitor. fig. 3.4.7 analog signal line and a resistor and a capacitor analog input pin v s s n o i s e thermisto r microcomputer n.g. o.k. ( n o t e ) n o t e : t h e r e s i s t o r i s u s e d f o r d i v i d i n g r e s i s t a n c e w i t h a t h e r m i s t o r .
38k0 group user s manual 3-45 appendix 3.4 countermeasures against noise (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.  reason signal lines where potential levels change frequently (such as the cntr pin signal line) may affect other lines at signal rising edge or falling edge. if such lines cross over a clock line, clock waveforms may be deformed, which causes a microcomputer failure or a program runaway. fig. 3.4.9 wiring of reset pin 3.4.4 oscillator concerns take care to prevent an oscillator that generates clocks for a microcomputer operation from being affected by other signals. (1) keeping oscillator away from large current signal lines install a microcomputer (and especially an oscillator) as far as possible from signal lines where a current larger than the tolerance of current value flows.  reason in the system using a microcomputer, there are signal lines for controlling motors, leds, and thermal heads or others. when a large current flows through those signal lines, strong noise occurs because of mutual inductance. fig. 3.4.8 wiring for a large current signal line x in x o u t v s s cntr d o n o t c r o s s n.g. x in x out v ss m microcomputer inductance large current gnd
3-46 appendix 38k0 group user s manual 3.4 countermeasures against noise (3) oscillator protection using v ss pattern as for a two-sided printed circuit board, print a v ss pattern on the underside (soldering side) of the position (on the component side) where an oscillator is mounted. connect the v ss pattern to the microcomputer v ss pin with the shortest possible wiring. besides, separate this v ss pattern from other v ss patterns. fig. 3.4.10 v ss pattern on the underside of an oscillator fig. 3.4.11 setup for i/o ports 3.4.5 setup for i/o ports setup i/o ports using hardware and software as follows: connect a resistor of 100 ? or more to an i/o port in series. as for an input port, read data several times by a program for checking whether input levels are equal or not. as for an output port, since the output data may reverse because of noise, rewrite data to its port latch at fixed periods. rewrite data to direction registers at fixed periods. note: when a direction register is set for input port again at fixed periods, a several-nanosecond short pulse may be output from this port. if this is undesirable, connect a capacitor to this port to remove the noise pulse. x in x out v ss a n e x a m p l e o f v s s p a t t e r n s o n t h e u n d e r s i d e o f a p r i n t e d c i r c u i t b o a r d oscillator wiring pattern example s e p a r a t e t h e v s s l i n e f o r o s c i l l a t i o n f r o m o t h e r v s s l i n e s direction register port latch data bus i/o port pins noise noise n.g. o.k.
38k0 group user s manual 3-47 appendix 3.4 countermeasures against noise 3.4.6 providing of watchdog timer function by software if a microcomputer runs away because of noise or others, it can be detected by a software watchdog timer and the microcomputer can be reset to normal operation. this is equal to or more effective than program runaway detection by a hardware watchdog timer. the following shows an example of a watchdog timer provided by software. in the following example, to reset a microcomputer to normal operation, the main routine detects errors of the interrupt processing routine and the interrupt processing routine detects errors of the main routine. this example assumes that interrupt processing is repeated multiple times in a single main routine processing. assigns a single byte of ram to a software watchdog timer (swdt) and writes the initial value n in the swdt once at each execution of the main routine. the initial value n should satisfy the following condition: n+1 ( counts of interrupt processing executed in each main routine) as the main routine execution cycle may change because of an interrupt processing or others, the initial value n should have a margin. watches the operation of the interrupt processing routine by comparing the swdt contents with counts of interrupt processing after the initial value n has been set. detects that the interrupt processing routine has failed and determines to branch to the program initialization routine for recovery processing in the following case: if the swdt contents do not change after interrupt processing. decrements the swdt contents by 1 at each interrupt processing. determines that the main routine operates normally when the swdt contents are reset to the initial value n at almost fixed cycles (at the fixed interrupt processing count). detects that the main routine has failed and determines to branch to the program initialization routine for recovery processing in the following case: if the swdt contents are not initialized to the initial value n but continued to decrement and if they reach 0 or less. fig. 3.4.12 watchdog timer by software main routine (swdt) n cli main processing (swdt) interrupt processing routine errors n interrupt processing routine (swdt) (swdt) 1 interrupt processing (swdt) main routine errors > 0 0 rti return =n? 0? n
38k0 group user? manual 3-48 appendix 3.5 list of registers 3.5 list of registers fig. 3.5.1 structure of port pi fig. 3.5.2 structure of port pi direction register port pi b7 b6 b5 b4 b3 b2 b1 b0 b function at reset rw 0 1 2 3 4 5 6 7 name port pi 0 port pi 1 port pi 2 port pi 3 port pi 4 port pi 5 port pi 6 port pi 7 in output mode write read port latch in input mode write : port latch read : value of pins port pi (pi) (i = 0, 1, 2, 3, 4, 5, 6) (note) [address : 00 16 , 02 16 , 04 16 , 06 16, 08 16 , 0a 16 , 0c 16 ] ? ? ? ? ? ? ? ? note: since the following ports are not allocated, the corrrsponding bits can not be used. p4 4 to p4 7 p6 4 to p6 7 port pi direction register b7 b6 b5 b4 b3 b2 b1 b0 b function at reset rw 0 1 2 3 4 5 6 7 name port pi direction register 0 0 0 0 0 0 0 0 port pi direction register (pid) (i = 0, 1, 2, 3, 4, 5, 6) (note) [address : 01 16 , 03 16 , 05 16 , 07 16, 09 16 , 0b 16 , 0d 16 ] 0 : port pi 0 input mode 1 : port pi 0 output mode 0 : port pi 1 input mode 1 : port pi 1 output mode 0 : port pi 2 input mode 1 : port pi 2 output mode 0 : port pi 3 input mode 1 : port pi 3 output mode 0 : port pi 4 input mode 1 : port pi 4 output mode 0 : port pi 5 input mode 1 : port pi 5 output mode 0 : port pi 6 input mode 1 : port pi 6 output mode 0 : port pi 7 input mode 1 : port pi 7 output mode ? ? ? ? ? ? ? ? note: since the following ports are not allocated, the corrrsponding bits can not be used. p4 4 to p4 7 p6 4 to p6 7
38k0 group user s manual 3-49 appendix 3.5 list of registers fig. 3.5.5 structure of usb function address register b7 b0 usb function address bit not used usbadd0 [6:0] b7 0 0 usb function address register ( usba0) [address 0012 16 ] bit name bit symbol at reset function h/w s/w o o o o : state remaining in ad0e = 0 , this value changes after writing. in ad0e = 1 , this value changes after completion of set_address control transferring. write 0 when writing. 0 is read when reading. 0 w r fig. 3.5.3 structure of usb control register fig. 3.5.4 structure of usb function enable register b7 at reset w function bit name bit symbol b0 remote wakeup bit tron output control bit tron output enable bit usb reference voltage control bit usb reference voltage enable bit usb difference input enable bit usb clock select bit usb module operation enable bit wkup troncon trone vrefcon vrefe usbdife uclkcon usbe o o o o o o o o o o o o o o o o 0 0 0 0 0 0 0 0 usb control register ( usbcon) [address 0010 16 ] : state remaining 0 : returning to bus idle state by writing 1 first and then 0 . (remote wakeup signal) 1 : k-state output 0 : l output mode (valid in trone = 1 ) 1 : h output mode (valid in trone = 1 ) 0 : tron port output disabled (hi-z state) 1 : tron port output enabled 0 : normal mode (valid in vrefe = 1 ) 1 : low current mode (valid in vrefe = 1 ) 0 : usb reference voltage circuit operation disabled 1 : usb reference voltage circuit operation enabled 0 : upstream-port difference input circuit operation disabled 1 : upstream--port difference input circuit operation enabled 0 : external oscillating clock f(x in ) 1 : pll circuit output clock f vco 0 : usb module reset 1 : usb module operation enabled h/w s/w r b7 bit name bit symbol b0 usb function enable bit not used ad0e b7:b1 0 usb function enable register (usbae) [address 0011 16 ] 0: usb function address register invalidated 1: usb function address register validated write 0 when writing. 0 is read when reading. at reset function h/w s/w o o o o : state remaining 0000000 w r
38k0 group user s manual 3-50 appendix 3.5 list of registers fig. 3.5.6 structure of frame number register low b7 b0 frame number low bit fnum [7:0] in- definite in- definite frame number register low ( fnuml) [address 0014 16 ] the frame number is updated at sof reception. bit name bit symbol at reset function h/w s/w o ? w r fig. 3.5.7 structure of frame number register high b7 b0 fnum [10:8] b7:b3 frame number register high ( fnumh) [address 0015 16 ] in- definite in- definite bit name bit symbol at reset function h/w s/w o o frame number high bit not used the frame number is updated at sof reception. write 0 when writing. 0 is read when reading. ? o : state remaining 00000 w r fig. 3.5.8 structure of usb interrupt source enable register b7 b0 ep00e ep01e ep02e ep03e b5:b4 suse rsme 0 0 0 0 0 0 0 0 0 0 0 0 usb interrupt source enable register ( usbicon) [address 0016 16 ] 0 : interrupt disabled 1 : interrupt enabled 0 : interrupt disabled 1 : interrupt enabled 0 : interrupt disabled 1 : interrupt enabled 0 : interrupt disabled 1 : interrupt enabled write 0 when writing. 0 is read when reading. 0 : interrupt disabled 1 : interrupt enabled 0 : interrupt disabled 1 : interrupt enabled bit name bit symbol at reset function h/w s/w o o o o o o o o o o o o o o usb function/endpoint 0 interrupt enable bit usb function/endpoint 1 interrupt enable bit usb function/endpoint 2 interrupt enable bit usb function/endpoint 3 interrupt enable bit not used suspend interrupt enable bit resume interrupt enable bit w r 00 : state remaining
38k0 group user s manual 3-51 appendix 3.5 list of registers fig. 3.5.9 structure of usb interrupt source register b7 b0 usb function/endpoint 0 interrupt bit usb function/endpoint 1 interrupt bit usb function/endpoint 2 interrupt bit usb function/endpoint 3 interrupt bit not used suspend interrupt bit resume interrupt bit ep00 ep01 ep02 ep03 b5:b4 sus rsm 0 0 0 0 0 0 0 0 0 0 0 0 usb interrupt source register ( usbireq) [address 0017 16 ] bit name bit symbol at reset function h/w s/w o o o o o o o ? ? ? ? o o ? this bit is set to 1 when any one of ep00 interrupt source register s bits at least is set to 1 . this bit is cleared to 0 by clearing ep00 interrupt source register to 00 16 . writing to this bit causes no state change. this bit is set to 1 when any one of ep01 interrupt source register s bits at least is set to 1 . this bit is cleared to 0 by clearing ep01 interrupt source register to 00 16 . writing to this bit causes no state change. this bit is set to 1 when any one of ep02 interrupt source register s bits at least is set to 1 . this bit is cleared to 0 by clearing ep02 interrupt source register to 00 16 . writing to this bit causes no state change. this bit is set to 1 when any one of ep03 interrupt source register s bits at least is set to 1 . this bit is cleared to 0 by clearing ep03 interrupt source register to 00 16 . writing to this bit causes no state change. write 0 when writing. 0 is read when reading. 0 : no interrupt request issued 1 : interrupt request issued this bit is set to 1 when detecting 3 ms or more of j- state, using usb clock (f usb ) at 48 mhz. 0 can be set by software, but 1 cannot be set. this bit is set to 1 when the usb bus state changes from j-state to k-state or se0 in the resume interrupt enable bit = 1 . it is also 1 in the condition of internal clock stopped. this bit is cleared to 0 by clearing the resume interrupt enable bit. writing to this bit causes no state change. w r 00 : state remaining fig. 3.5.10 structure of endpoint index register b7 b0 endpoint index bit not used epidx [1:0] b7:b3 0 endpoint index register ( usbindex) [address 0018 16 ] b1 b0 0 0 : endpoint 0 0 1 : endpoint 1 1 0 : endpoint 2 1 1 : endpoint 3 write 0 when writing. 0 is read when reading. bit name bit symbol at reset function o o o o : state remaining h/w s/w 000000 w r
38k0 group user s manual 3-52 appendix 3.5 list of registers fig. 3.5.11 structure of ep00 stage register b7 b0 setup packet detection bit not used setup00 b7:b1 1 1 ep00 stage register ( ep00stg) [address 0019 16 ] bit name bit symbol at reset function h/w s/w this bit is set to 1 at reception of setup packet. writing 0 to this bit clears this bit if the next setup token does not occur. writing 1 to this bit causes no state change of the status flags. write 0 when writing. 0 is read when reading. o o o o : state remaining 000 0 000 w r fig. 3.5.12 structure of ep01 set register b7 b0 double buffer beginning address set bit buffer mode select bit sequence toggle bit clear bit interrupt toggle mode select bit transfer direction bit transfer type bite bsiz01 [1:0] dblb01 sqcl01 itmd01 dir01 typ01 [1:0] 0 0 0 0 0 0 ep01 set register ( ep01cfg) [address 0019 16 ] bit name bit symbol at reset function h/w s/w in double buffer mode set the beginning address of buffer 1 area, using a relative value for the beginning address of buffer 0. b1b0 0 0 = 8 bytes 0 1 = 16 bytes 1 0 = 64 bytes 1 1 = 128 bytes 0 : single buffer mode 1 : double buffer mode 0 : toggle bit clear disabled 1 : writing 1 clears the toggle bit and data0 is used as the next data pid. 0 is always read when reading. 0 : normal mode 1 : contin uous toggle mode (valid at interrupt in transfer) 0 : out (data is received from the host.) 1 : in (data is transmitted to the host.) b7b6 0 0 : transfer disabled 0 1 : bulk transfer 1 0 : interrupt transfer 1 1 : isochronous transfer o o o o o o o o o o o o : state remaining w r
38k0 group user s manual 3-53 appendix 3.5 list of registers fig. 3.5.14 structure of ep03 set register b7 b0 double buffer beginning address set bit buffer mode select bit sequence toggle bit clear bit interrupt toggle mode select bit transfer direction bit transfer type bit bsiz03 [1:0] dblb03 sqcl03 itmd03 dir03 typ03 [1:0] 0 0 0 0 0 0 ep03 set register ( ep03cfg) [address 0019 16 ] bit name bit symbol at reset function h/w s/w in double buffer mode set the beginning address of buffer 1 area, using a relative value for the beginning address of buffer 0. b1b0 0 0 = 8 bytes 0 1 = 16 bytes 1 0 = 64 bytes 1 1 = 128 bytes 0 : single buffer mode 1 : double buffer mode 0 : toggle bit clear disabled 1 : writing 1 clears the toggle bit and data0 is used as the next data pid. 0 is always read when reading. 0 : normal mode 1 : contin uous toggle mode (valid at interrupt in transfer) 0 : out (data is received from the host.) 1 : in (data is transmitted to the host.) b7b6 0 0 : transfer disabled 0 1 : bulk transfer 1 0 : interrupt transfer 1 1 : isochronous transfer o o o o o o o o o o o o : state remaining w r fig. 3.5.13 structure of ep02 set register b7 b0 double buffer beginning address set bit buffer mode select bit sequence toggle bit clear bit interrupt toggle mode select bit transfer direction bit transfer type bite bsiz02 [1:0] dblb02 sqcl02 itmd02 dir02 typ02 [1:0] 0 0 0 0 0 0 ep02 set register ( ep02cfg) [address 0019 16 ] bit name bit symbol at reset function h/w s/w in double buffer mode set the beginning address of buffer 1 area, using a relative value for the beginning address of buffer 0. b1b0 0 0 = 8 bytes 0 1 = 16 bytes 1 0 = 64 bytes 1 1 = 128 bytes 0 : single buffer mode 1 : double buffer mode 0 : toggle bit clear disabled 1 : writing 1 clears the toggle bit and data0 is used as the next data pid. 0 is always read when reading. 0 : normal mode 1 : contin uous toggle mode (valid at interrupt in transfer) 0 : out (data is received from the host.) 1 : in (data is transmitted to the host.) b7b6 0 0 : transfer disabled 0 1 : bulk transfer 1 0 : interrupt transfer 1 1 : isochronous transfer o o o o o o o o o o o o : state remaining w r
38k0 group user s manual 3-54 appendix 3.5 list of registers fig. 3.5.15 structure of ep00 control register 1 b7 b0 response pid bit not used pid00 [1:0] b7:b2 0 ep00 control register 1 ( ep00con1) [address 001a 16 ] bit name bit symbol at reset function h/w s/w b1 b0 0 0 : nak 0 1 : automatic response (ack, nak, data0, data1) 1 x : stall at occurrence of control transfer error: b1 is set to 1 by the hardware. at reception of setup token: b1 and b0 are cleared to 0 by the hardware. write 0 when writing. 0 is read when reading. o o o o : state remaining 000000 w r fig. 3.5.16 structure of ep01 control register 1 b7 b0 response pid bit not used pid01 [1:0] b7:b2 0 ep01 control register 1 ( ep01con1) [address 001a 16 ] bit name bit symbol at reset function h/w s/w b1 b0 0 0 : nak 0 1 : automatic response (ack, nak, data0, data1) 1 x : stall at occurrence of over-max. packet size : b1 is set to 1 by the hardware. write 0 when writing. 0 is read when reading. o o o o : state remaining 000000 w r b7 b0 response pid bit not used pid02 [1: 0] b7:b2 0 ep02 control register 1 ( ep02con1) [address 001a 16 ] bit name bit symbol at reset function h/w s/w b1 b0 0 0 : nak 0 1 : automatic response (ack, nak, data0, data1) 1 x : stall at occurrence of over-max. packet size : b1 is set to 1 by the hardware. write 0 when writing. 0 is read when reading. o o o o : state remaining 00 0 0 00 w r fig. 3.5.17 structure of ep02 control register 1
38k0 group user s manual 3-55 appendix 3.5 list of registers fig. 3.5.20 structure of ep01 control register 2 b7 b0 b0val01 b7:b1 0 ep01 control register 2 ( ep01con2) [address 001b 16 ] bit name bit symbol at reset function h/w s/w o o o o : state remaining buffer 0 enable bit not used when the selected endpoint is in, writing 1 to this bit makes the transmitting data a set state (sie is possible to read). when the selected endpoint is out, writing 1 to this bit makes data reception possible (sie is possible to write). write 0 when writing. 0 is read when reading. 00 0 00 0 0 w r fig. 3.5.18 structure of ep03 control register 1 fig. 3.5.19 structure of ep00 control register 2 b7 b0 response pid bit not used pid03 [1:0] b7:b2 0 ep03 control register 1 ( ep03con1) [address 001a 16 ] bit name bit symbol at reset function h/w s/w b1 b0 0 0 : nak 0 1 : automatic response (ack, nak, data0, data1) 1 x : stall at occurrence of over-max. packet size : b1 is set to 1 by the hardware. write 0 when writing. 0 is read when reading. o o o o : state remaining 000000 w r b7 b0 buffer enable bit not used bval00 b7:b1 0 ep00 control register 2 ( ep00con2) [address 001b 16 ] bit name bit symbol at reset function h/w s/w 0 : nak transmission (sie is disabled to read a buffer.) 1 : transmitting/receiving data set state (sie is possible to read from/write to a buffer.) at reception of setup token: this bit is cleared to 0 by the hardware. write 0 when writing. 0 is read when reading. o o o o : state remaining 000 0 0 0 0 w r
38k0 group user s manual 3-56 appendix 3.5 list of registers fig. 3.5.21 structure of ep02 control register 2 fig. 3.5.22 structure of ep03 control register 2 b7 b0 b0val02 b7:b1 0 ep02 control register 2 ( ep02con2) [address 001b 16 ] bit name bit symbol at reset function h/w s/w o o o o : state remaining buffer 0 enable bit not used when the selected endpoint is in, writing 1 to this bit makes the transmitting data a set state (sie is possible to read). when the selected endpoint is out, writing 1 to this bit makes data reception possible (sie is possible to write). write 0 when writing. 0 is read when reading. 00 0 00 0 0 w r b7 b0 b0val03 b7:b1 0 ep03 control register 2 ( ep03con2) [address 001b 16 ] bit name bit symbol at reset function h/w s/w o o o o : state remaining buffer 0 enable bit not used when the selected endpoint is in, writing 1 to this bit makes the transmitting data a set state (sie is possible to read). when the selected endpoint is out, writing 1 to this bit makes data reception possible (sie is possible to write). write 0 when writing. 0 is read when reading. 00 0 00 0 0 w r fig. 3.5.23 structure of ep00 control register 3 b7 b0 control transfer completion enable bit not used ctende00 b7:b1 0 ep00 control register 3 ( ep00con3) [address 001c 16 ] 0 : nak transmission in the status stage 1 : control transfer completion enabled (sie transmits null/ack.) (valid in pid00 = 01 2 ) at reception of setup token: this bit is cleared to 0 by the hardware. write 0 when writing. 0 is read when reading. o o o o : state remaining bit name bit symbol at reset function h/w s/w 000 0 0 0 0 w r
38k0 group user s manual 3-57 appendix 3.5 list of registers fig. 3.5.25 structure of ep02 control register 3 fig. 3.5.26 structure of ep03 control register 3 b7 b0 b1val02 b7:b1 0 ep02 control register 3 ( ep02con3) [address 001c 16 ] bit name bit symbol at reset function h/w s/w o o o o : state remaining buffer 1 enable bit not used when the selected endpoint is in, writing 1 to this bit makes the transmitting data a set state (sie is possible to read). when the selected endpoint is out, writing 1 to this bit makes data reception possible (sie is possible to write). in double buffer mode this bit is valid. write 0 when writing. 0 is read when reading. 00 0 00 0 0 w r b7 b0 b1val03 b7:b1 0 ep03 control register 3 ( ep03con3) [address 001c 16 ] bit name bit symbol at reset function h/w s/w o o o o : state remaining buffer 1 enable bit not used when the selected endpoint is in, writing 1 to this bit makes the transmitting data a set state (sie is possible to read). when the selected endpoint is out, writing 1 to this bit makes data reception possible (sie is possible to write). in double buffer mode this bit is valid. write 0 when writing. 0 is read when reading. 0000000 w r fig. 3.5.24 structure of ep01 control register 3 b7 b0 b1val01 b7:b1 0 ep01 control register 3 ( ep01con3) [address 001c 16 ] bit name bit symbol at reset function h/w s/w o o o o : state remaining buffer 1 enable bit not used when the selected endpoint is in, writing 1 to this bit makes the transmitting data a set state (sie is possible to read). when the selected endpoint is out, writing 1 to this bit makes data reception possible (sie is possible to write). in double buffer mode this bit is valid. write 0 when writing. 0 is read when reading. 0000000 w r
38k0 group user s manual 3-58 appendix 3.5 list of registers fig. 3.5.27 structure of ep00 interrupt source register b7 b0 usb function/endpoint 0 buffer ready interrupt bit usb function/endpoint 0 control transfer completion interrupt bit usb function/endpoint 0 status stage transition interrupt bit usb function/endpoint 0 setup buffer ready interrupt bit usb function/endpoint 0 error interrupt bit not used brdy00 ctend00 ctsts00 bsrdy00 err00 b7:b5 0 0 0 0 0 0 0 0 0 0 ep00 interrupt source register (ep00req) [address 001d 16 ] bit name bit symbol at reset function h/w s/w o o o o o o o o o o o o 0: no interrupt request issued 1: interrupt request issued this bit is set to 1 when the buffer is ready state (enabled to be read/written) on usb function/endpoint 0. 0 can be set by software, but 1 cannot be set. 0: no interrupt request issued 1: interrupt request issued this bit is set to 1 when control transfer is completed (null/ack transmission in the status stage) on usb function/endpoint 0. 0 can be set by software, but 1 cannot be set. 0: no interrupt request issued 1: interrupt request issued this bit is set to 1 when transition to status stage occurs in ctende00 = 0 (control transfer completion disabled) on usb function/endpoint 0. 0 can be set by software, but 1 cannot be set. at transfer of control write: when receiving in-token in data stage (out) at transfer of control read: when receiving out-token in data stage (in) at no data transfer: nothing occurs. 0: no interrupt request issued 1: interrupt request issued this bit is set to 1 when the exclusive buffer for setup is ready state (enabled to be read) on usb function/endpoint 0. 0 can be set by software, but 1 cannot be set. 0: no interrupt request issued 1: interrupt request issued this bit is set to 1 when control transfer error occurs on usb function/endpoint 0. this bit is cleared to 0 by the hardware when receiving setup token. 0 can be set by software, but 1 cannot be set. write 0 when writing. 0 is read when reading. : state remaining 000 w r
38k0 group user s manual 3-59 appendix 3.5 list of registers fig. 3.5.29 structure of ep02 interrupt source register b7 b0 b0rdy02 b1rdy02 err02 b7 to b3 0 0 0 0 0 0 ep02 interrupt source register (ep02req) [address 001d 16 ] bit name bit symbol at reset function h/w s/w o o o o o o o o usb function/endpoint 2 buffer 0 ready interrupt bit usb function/endpoint 2 buffer 1 ready interrupt bit usb function/endpoint 2 error interrupt bit not used 0 : no interrupt request issued 1 : interrupt request issued this bit is set to 1 when the buffer 0 is ready state (enabled to be read/written) on usb function/endpoint 2. 0 can be set by software, but 1 cannot be set. 0 : no interrupt request issued 1 : interrupt request issued in single buffer mode this bit is invalid. this bit is set to 1 when the buffer 1 is ready state (enabled to be read/written) on usb function/endpoint 2 in double buffer mode. 0 can be set by software, but 1 cannot be set. 0 : no interrupt request issued 1 : interrupt request issued this bit is set to 1 when stall response occurs on usb function/endpoint 2. 0 can be set by software, but 1 cannot be set. write 0 when writing. 0 is read when reading. 00 0 00 w r fig. 3.5.28 structure of ep01 interrupt source register b7 b0 b0rdy01 b1rdy01 err01 b7:b3 0 0 0 0 0 0 ep01 interrupt source register (ep01req) [address 001d 16 ] bit name bit symbol at reset function h/w s/w o o o o o o o o usb function/endpoint 1 buffer 0 ready interrupt bit usb function/endpoint 1 buffer 1 ready interrupt bit usb function/endpoint 1 error interrupt bit not used 0: no interrupt request issued 1: interrupt request issued this bit is set to 1 when the buffer 0 is ready state (enabled to be read/written) on usb function/endpoint 1. 0 can be set by software, but 1 cannot be set. 0: no interrupt request issued 1: interrupt request issued in single buffer mode this bit is invalid. this bit is set to 1 when the buffer 1 is ready state (enabled to be read/written) on usb function/endpoint 1 in double buffer mode. 0 can be set by software, but 1 cannot be set. 0: no interrupt request issued 1: interrupt request issued this bit is set to 1 when stall response occurs on usb function/endpoint 1. 0 can be set by software, but 1 cannot be set. write 0 when writing. 0 is read when reading. 00000 w r
38k0 group user s manual 3-60 appendix 3.5 list of registers fig. 3.5.31 structure of ep00 byte number register fig. 3.5.32 structure of ep01 byte number register 0 b7 b0 b0byt01 [6:0] b7 0 0 ep01 byte number register 0 ( ep01byt0) [address 001e 16 ] bit name bit symbol at reset function h/w s/w in : transmit byte number bit out : receive byte number bit not used : state remaining single buffer mode: set the transmitting byte number. double buffer mode : set the transmitting byte number of buffer 0. single buffer mode : the received byte number is automatically set. double buffer mode : the received byte number of buffer 0 is automatically set. write 0 when writing. 0 is read when reading. o o o o ? o 0 w r b7 b0 bbyt00 [3:0] b7:b4 0 ep00 byte number register ( ep00byt) [address 001e 16 ] out : the received byte number is automatically set. in : set the transmitting byte number. write 0 when writing. 0 is read when reading. bit name bit symbol at reset function h/w s/w o o o o transmit/receive byte number bit not used : state remaining 0000 w r fig. 3.5.30 structure of ep03 interrupt source register b7 b0 b0rdy03 b1rdy03 err03 b7:b3 0 0 0 0 0 0 ep03 interrupt source register (ep03req) [address 001d 16 ] bit name bit symbol at reset function h/w s/w o o o o o o o o usb function/endpoint 3 buffer 0 ready interrupt bit usb function/endpoint 3 buffer 1 ready interrupt bit usb function/endpoint 3 error interrupt bit not used 0 : no interrupt request issued 1 : interrupt request issued this bit is set to 1 when the buffer 0 is ready state (enabled to be read/written) on usb function/endpoint 3. 0 can be set by software, but 1 cannot be set. 0 : no interrupt request issued 1 : interrupt request issued in single buffer mode this bit is invalid. this bit is set to 1 when the buffer 1 is ready state (enabled to be read/written) on usb function/endpoint 3 in double buffer mode. 0 can be set by software, but 1 cannot be set. 0 : no interrupt request issued 1 : interrupt request issued this bit is set to 1 when stall response occurs on usb function/endpoint 3. 0 can be set by software, but 1 cannot be set. write 0 when writing. 0 is read when reading. 00000 w r
38k0 group user s manual 3-61 appendix 3.5 list of registers fig. 3.5.35 structure of ep01 byte number register 1 b7 b0 b1byt01 [6:0] b7 0 0 ep01 byte number register 1 ( ep01byt1) [address 001f 16 ] bit name bit symbol at reset function h/w s/w in : transmit byte number bit out : receive byte number bit not used : state remaining single buffer mode: these bits are invalid. double buffer mode : set the transmitting byte number of buffer 1. single buffer mode: these bits are invalid. double buffer mode : the received byte number of buffer 1 is automatically set. write 0 when writing. 0 is read when reading. o o o o ? o 0 w r fig. 3.5.33 structure of ep02 byte number register 0 fig. 3.5.34 structure of ep03 byte number register 0 b7 b0 b0byt02 [6:0] b7 0 0 ep02 byte number register 0 ( ep02byt0) [address 001e 16 ] bit name bit symbol at reset function h/w s/w in : transmit byte number bit out : receive byte number bit not used : state remaining single buffer mode: set the transmitting byte number. double buffer mode : set the transmitting byte number of buffer 0. single buffer mode: the received byte number is automatically set. double buffer mode : the received byte number of buffer 0 is automatically set. write 0 when writing. 0 is read when reading. o o o o ? o 0 w r b7 b0 b0byt03 [6:0] b7 0 0 ep03 byte number register 0 ( ep03byt0) [address 001e 16 ] bit name bit symbol at reset function h/w s/w in : transmit byte number bit out : receive byte number bit not used : state remaining single buffer mode: set the transmitting byte number. double buffer mode : set the transmitting byte number of buffer 0. single buffer mode: the received byte number is automatically set. double buffer mode : the received byte number of buffer 0 is automatically set. write 0 when writing. 0 is read when reading. o o o o ? o 0 w r
38k0 group user s manual 3-62 appendix 3.5 list of registers fig. 3.5.36 structure of ep02 byte number register 1 b7 b0 b1byt02 [6:0] b7 0 0 ep02 byte number register 1 ( ep02byt1) [address 001f 16 ] bit name bit symbol at reset function h/w s/w in : transmit byte number bit out : receive byte number bit not used : state remaining single buffer mode: these bits are invalid. double buffer mode : set the transmitting byte number of buffer 1. single buffer mode: these bits are invalid. double buffer mode : the received byte number of buffer 1 is automatically set. write 0 when writing. 0 is read when reading. o o o o ? o 0 w r fig. 3.5.37 structure of ep03 byte number register 1 b7 b0 b1byt03 [6:0] b7 0 0 ep03 byte number register 1 ( ep03byt1) [address 001f 16 ] bit name bit symbol at reset function h/w s/w in : transmit byte number bit out : receive byte number bit not used : state remaining single buffer mode: these bits are invalid. double buffer mode : set the transmitting byte number of buffer 1. single buffer mode: these bits are invalid. double buffer mode : the received byte number of buffer 1 is automatically set. write 0 when writing. 0 is read when reading. o o o o ? o 0 w r fig. 3.5.38 structure of prescaler12, prescaler x prescaler 12, prescaler x b7 b6 b5 b4 b3 b2 b1 b0 b function at reset rw 0 1 2 3 4 5 6 7 name 1 1 1 1 1 1 1 1 prescaler 12 (pre12) [address : 20 16 ] prescaler x (prex) [address : 24 16 ] set a count value of each prescaler. the value set in this register is written to both each prescaler and the corresponding prescaler latch at the same time. when this register is read out, the count value of the corres- ponding prescaler is read out.
38k0 group user s manual 3-63 appendix 3.5 list of registers fig. 3.5.40 structure of timer 2, timer x timer 2, timer x b7 b6 b5 b4 b3 b2 b1 b0 b function at reset rw 0 1 2 3 4 5 6 7 name 1 1 1 1 1 1 1 1 timer 2 (t2) [address : 22 16 ] timer x (tx) [address : 25 16 ] set a count value of each timer. the value set in this register is written to both each timer and each timer latch at the same time. when this register is read out, each timer s count value is read out. fig. 3.5.39 structure of timer 1 timer 1 b7 b6 b5 b4 b3 b2 b1 b0 b function at reset rw 0 1 2 3 4 5 6 7 name 1 0 0 0 0 0 0 0 timer 1 (t1) [address : 21 16 ] set a count value of timer 1. the value set in this register is written to both timer 1 and timer 1 latch at the same time. when this register is read out, the timer 1 s count value is read out.
38k0 group user? manual 3-64 appendix 3.5 list of registers fig. 3.5.41 structure of timer x mode register b7 b6 b5 b4 b3 b2 b1 b0 b function at reset rw 0 2 3 4 5 6 7 name 0 0 0 timer x mode register (tm) [address : 23 16 ] timer x mode register 0 0 0 : timer mode 0 1 : pulse output mode 1 0 : event counter mode 1 1 : pulse width measurement mode b1 b0 1 0 timer x operating mode bits cntr 0 active edge selection bit the function depends on the operating mode of timer x. (refer to table 2.3.1) timer x count stop bit 0 : count start 1 : count stop nothing is arranged for these bits. these are write disabled bits. when these bits are read out, the contents are 0 . 0 0 0 fig. 3.5.42 structure of transmit/receive buffer register transmit/receive buffer register b7 b6 b5 b4 b3 b2 b1 b0 b function at reset rw 0 1 2 3 4 5 6 7 name ? ? ? ? ? ? ? ? transmit/receive buffer register (tb/rb) [address : 26 16 ] the transmission data is written to or the receive data is read out from this buffer register. at writing: a data is written to the transmit buffer register. at reading: the contents of the receive buffer register are read out. note: the contents of transmit buffer register cannot be read out. the data cannot be written to the receive bu ff er register.
38k0 group user s manual 3-65 appendix 3.5 list of registers fig. 3.5.43 structure of serial i/o status register serial i/o status register b7 b6 b5 b4 b3 b2 b1 b0 b function at reset rw 0 1 2 3 4 5 6 7 name 0 0 0 0 0 0 0 1 serial i/o status register (siosts) [address : 27 16 ] nothing is allocated for this bit. this is a write disabled bit. when this bit is read out, the contents are 1 . ? ? ? ? ? ? ? ? transmit buffer empty flag (tbe) 0 : (oe) u (pe) u (fe) = 0 1 : (oe) u (pe) u (fe) = 1 overrun error flag (oe) 0 : buffer full 1 : buffer empty receive buffer full flag (rbf) transmit shift register shift completion flag (tsc) parity error flag (pe) framing error flag (fe) summing error flag (se) 0 : buffer empty 1 : buffer full 0 : transmit shift in progress 1 : transmit shift completed 0 : no error 1 : overrun error 0 : no error 1 : parity error 0 : no error 1 : framing error b7 b0 cpu channel receive enable bit cpu channel transmit enable bit memory channel operation enable bit not used rxb_enb txb_enb mc_enb b7:b3 0 0 0 e xb interrupt source enable register ( exbicon) [address 0030 16 ] ( note ) 00 000 bit name bit symbol at reset function h/w s/w 0 : operation disabled (interrupt disabled) 1 : operation enabled (receive buffer full interrupt enabled) 0 : operation disabled (interrupt disabled) 1 : operation enabled (transmit buffer empty interrupt enabled) 0 : operation disabled (memory channel operation end interrupt disabled) 1 : operation enabled (memory channel operation end interrupt disabled) write 0 when writing. 0 is read when reading. o o o o o o o o : state remaining w r note: do not set each bit simultaneously. fig. 3.5.44 structure of exb interrupt source enable register
38k0 group user s manual 3-66 appendix 3.5 list of registers b7 b0 rxb_full txb_empty mc_sts [1:0] ( note 2 ) b7:b4 0000 0 0 0 0 (note 3) 0 (note 4) 0 e xb interrupt source register ( exbireq) [address 0031 16 ] ( note 1 ) bit name bit symbol at reset function h/w s/w o o o o o : state remaining receive buffer full bit transmit buffer empty bit memory channel status bits not used 0 : receive buffer empty 1 : receive buffer full 0 : transmit buffer full 1 : transmit buffer empty b3b2 0 0 : memory channel operation stopped 0 1 : memory channel being operating; no external access 1 0 : memory channel being operating; external accessing 1 1 : memory channel operation end; memory channel operation end interrupt generated write 0 when writing. 0 is read when reading. notes 1 : when the the exa1 pin control bit of external i/o configuration register is 1 , the external mcu bus can read this register contents by setting the exa1 pin to h . 2 : the memory channel status bits indicate the status of memory channel. in mc_enb = 0 these bits are always 00 2 . when the memory channel operation ends, these bits are set to 11 2 and the memory channel operation end interrupt is generated. these bits can be read out during operation, so that it will show that whether the external mcu bus is accessing or not. 3 : this bit is cleared to 0 when reading the transmit/receive buffer register in the cpu channel receive enable bit = 1 or when the cpu channel receive enable bit is 0 . 4 : this bit is cleared to 0 when writing to the transmit/receive buffer register in the cpu channel transmit enable bit = 1 or when the cpu channel transmit enable bit is 0 . w r fig. 3.5.45 structure of exb interrupt source register b7 b0 index [2:0] b7:b3 0 exb index register (exbindex) [address 0033 16 ] 00000 bit name bit symbol at reset function h/w s/w o o o o index bits not used the accessible register, using the register window, depends on these index bits contents as follows: b2b1b0 0 0 0 : external i/o configuration register 0 0 1 : transmit/receive buffer register 0 1 0 : memory channel operation mode register 0 1 1 : memory address counter 1 0 0 : end address register 1 0 1 : do not set. 1 1 0 : do not set. 1 1 1 : do not set. write 0 when writing. 0 is read when reading. : state remaining w r fig. 3.5.46 structure of exb index register
38k0 group user s manual 3-67 appendix 3.5 list of registers b7 b0 low_win [7:0] in- definite in- definite register window 1 (exbreg1) [address 0034 16 ] bit name bit symbol at reset function h/w s/w oo the accessible register, using this register window, depends on the exb index register contents as follows: index value 00 16 : external i/o configuration register 01 16 : transmit/receive buffer register 02 16 : memory channel operation mode register 03 16 : memory address counter 04 16 : end address register w r fig. 3.5.47 structure of register window 1 b7 b0 exb_ctr int_ctr [2:0] a1_ctr b7:b5 index = 00 16 : external i/o configuration register (exbcfgl) [address 0034 16 ] 0 0 0 000 bit name bit symbol at reset function h/w s/w 0 : port 1 : exb function pin selects a signal of p3 3 /exint pin. on/off is programmed by each bit. an output logical sum of p3 3 /exint pins set for on are performed and it is output as an l active signal. b3b2b1 0 0 1 : rxb_rdy (rxbuf ready) output 0 1 0 : txb_rdy (txbuf ready) output 1 0 0 : mch_req (memory channel request) output others : do not set. 0 : port 1 : a1 input (used to read status) write 0 when writing. 0 is read when reading. exb pin control bit (pins p1 0 to p1 7 , p3 0 to p3 4 ) p3 3 /exint pin control bit p4 3 /exa1 pin control bit not used o o o o o o o o : state remaining w r fig. 3.5.48 index00[low]; structure of external i/o configuration register
38k0 group user s manual 3-68 appendix 3.5 list of registers b7 b0 rxbuf/ txbuf 0 index =01 16 : transmit/receive buffer register (rxbuf/txbuf) [address 0034 16 ] bit name bit symbol at reset function h/w s/w oo the data received from an external bus is written here at the rise timing of external write signal. the data transmitted to an external bus is written here at the timing of internal cpu write or memory write. the receive buffer register (rxbuf) contents can be read out by reading to this address with the cpu. the data which the cpu has written to this address is stored in the transmit buffer register (txbuf). however, do not perform write operation with the cpu to this address if the memory channel direction control bits of memory channel operation mode register is 10 2 (transmit mode) and the memory channel status bits of exb interrupt source register are 01 2 or 10 2 (memory channel being operating). w r fig. 3.5.49 index01[low]; structure of transmit/receive buffer register b7 b0 mc_dir [1:0] burst b7:b3 0 0 index =02 16 : memory channel operation mode register (mchmod) [address 0034 16 ] 00000 bit name bit symbol at reset function h/w s/w b1b0 0 0 : operation disabled 0 1 : receive mode 1 0 : transmit mode 1 1 : do not set. 0 : cycle mode (each byte transfer according to assertion or negation) 1 : burst mode (continuous transfer till the terminal count) write 0 when writing. 0 is read when reading. o o o o o o : state remaining memory channel direction control bit burst bit not used w r fig. 3.5.50 index02[low]; structure of memory channel operation mode register b7 b0 im_a [7:0] 0 index = 03 16 : memory address counter (memadl) [address 0034 16 ] bit name bit symbol at reset function h/w s/w oo register to set the low-order address of memory channel operation beginning. this contents are increased each time one memory access ends. w r fig. 3.5.51 index03[low]; structure of memory address counter
38k0 group user s manual 3-69 appendix 3.5 list of registers b7 b0 high_win [7:0] in- definite in- definite register window 2 (exbreg2) [address 0035 16 ] bit name bit symbol at reset function h/w s/w oo the accessible register, using this register window, depends on the exb index register contents as follows: index value 00 16 : external i/o configuration register 01 16 : transmit/receive buffer register 02 16 : memory channel operation mode register 03 16 : memory address counter 04 16 : end address register w r fig. 3.5.53 structure of register window 2 fig. 3.5.54 index00[high]; structure of external i/o configuration register b7 b0 drq_ctr [1:0] dak_ctr [1:0] tc_ctr b7:b5 index = 00 16 : external i/o configuration register (exbcfgh) [address 0035 16 ] 0 0 0 000 bit name bit symbol at reset function h/w s/w b1b0 0 0 : port 0 1 : do not set. 1 0 : exdreq function; rxb_rdy (rxbuf ready) output 1 1 : exdreq function; mch_req (memory channel request) output specifies p4 1 /exdack/txd pin function. selects which mode; requiring read or write signal, or not requiring it for use of dma acknowledge function. b3b2 0 0 : port 0 1 : do not set. 1 0 : exdack function; dma acknowledge input (mode for read and write signals used together) 1 1 :exdack function; dma acknowledge input (mode for read and write signals not required) 0 : port 1 : extc (terminal count) input write 0 when writing. 0 is read when reading. p4 0 /exdreq/rxd pin control bit p4 1 /exdack/txd pin control bit p4 2 /extc/s clk pin control bit not used o o o o o o o o : state remaining w r b7 b0 end_a [7:0] 0 index = 04 16 : end address register (endadl) [address 0034 16 ] bit name bit symbol at reset function h/w s/w oo : state remaining register to set the low-order address of memory channel operation end. w r fig. 3.5.52 index04[low]; structure of end address register
38k0 group user? manual 3-70 appendix 3.5 list of registers b7 b0 im_a [10:8] b7:b3 0 index = 03 16 : memory address counter (memadh) [address 0035 16 ] 00000 bit name bit symbol at reset function h/w s/w o o o o : state remaining not used register to set the high-order address of memory channel operation start. this contents are increased each time one memory access ends. write 0 when writing. 0 is read when reading. w r fig. 3.5.55 index03[high]; structure of memory address counter b7 b0 end_a [10:8] b7:b3 0 index = 04 16 : end address register (endadh) [address 0035 16 ] 00000 bit name bit symbol at reset function h/w s/w o o o o : state remaining not used register to set the high-order address of memory channel operation end. write 0 when writing. 0 is read when reading. w r fig. 3.5.56 index04[high]; structure of end address register fig. 3.5.57 structure of a-d control register a a a a aaaaaaaaaaaaa a aaaaaaaaaaa a a aaaaaaaaaaa a a aaaaaaaaaaa a aaaaaaaaaaaaa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa a a a a aa aa b7 b6 b5 b4 b3 b2 b1 b0 b function at reset rw 0 1 2 3 4 5 6 7 name 1 a-d control register (adcon) [address : 36 16 ] aa aa aa aa a-d control register 0 0 0 0 : p1 0 /dq 0 /an 0 0 0 1 : p1 1 /dq 1 /an 1 0 1 0 : p1 2 /dq 2 /an 2 0 1 1 : p1 3 /dq 3 /an 3 1 0 0 : p1 4 /dq 4 /an 4 1 0 1 : p1 5 /dq 5 /an 5 1 1 0 : p1 6 /dq 6 /an 6 1 1 1 : p1 7 /dq 7 /an 7 analog input pin selection bits b2 b1 b0 ad conversion completion bit 0 : conversion in progress 1 : conversion completed nothing is arranged for these bits. these are write disabled bits. when these bits are read out, the contents are indefinite. ? ? ? ?
38k0 group user s manual 3-71 appendix 3.5 list of registers fig. 3.5.58 structure of a-d conversion register 1 fig. 3.5.59 structure of a-d conversion register 2 a-d conversion register 1 b7 b6 b5 b4 b3 b2 b1 b0 b function at reset rw 0 1 2 3 4 5 6 7 ? ? ? ? ? ? ? ? a-d conversion register 1 (ad1) [address : 37 16 ] the read-only register in which the a-d conversion s results are stored. ? ? ? ? ? ? ? ? < 8-bit read> b7 b8 b7 b6 b5 b4 b3 b0 b2 b9 < 10-bit read> b7 b6 b5 b4 b3 b2 b1 b0 b0 b7 a a a-d conversion register 2 b7 b6 b5 b4 b3 b2 b1 b0 b function at reset rw 0 1 2 3 4 5 6 7 name ? ? 0 0 0 0 0 0 the read-only register in which the a-d conversion s results are stored. ? ? ? ? ? ? ? < 10-bit read> aa aa b7 b9 b0 b8 nothing is allocated for these bits. these are write disabled bits. when these bits are read out, the contents are 0 . a-d conversion register 2 (ad2) [address : 38 ] 16 fix this bit to 0 . 0 0 ?
38k0 group user s manual 3-72 appendix 3.5 list of registers fig. 3.5.60 structure of watchdog timer control register watchdog timer control register b7 b6 b5 b4 b3 b2 b1 b0 b function at reset rw 0 1 2 3 4 5 6 7 name 1 1 1 1 1 1 0 0 watchdog timer control register (wdtcon) [address : 39 16 ] watchdog timer h (for read-out of high-order 6 bits) stp instruction disable bit 0 : stp instruction enabled 1 : stp instruction disabled watchdog timer h count source selection bit 0 : watchdog timer l underflow 1 : system clock/16 ? ? ? ? ? ? fig. 3.5.61 structure of cpu mode register b7 b6 b5 b4 b3 b2 b1 b0 r w 0 0 2 0 3 4 5 6 7 1 0 0 1 0 01 b1 b0 0 0 : single-chip mode 0 1 : not available 1 0 : not available 1 1 : not available b name function at reset 0 : 0 page 1 : 1 page * cpu mode register (cpum: address 3b 16 ) cpu mode register processor mode bits stack page selection bit fix this bit to 1 . fix this bit to 0 . 0 : main clock f(x in ) 1 : f syn system clock selection bit b7 b6 0 0 : = f(system clock)/8 (8-divide mode) 0 1 : = f(system clock)/4 (4-divide mode) 1 0 : = f(system clock)/2 (2-divide mode) 1 1 : = f(system clock) (through mode) system clock division ratio selection bits * : the initial value of bit 1 depends on the cnvss level.
38k0 group user s manual 3-73 appendix 3.5 list of registers b7 b6 b5 b4 b3 b2 b1 b0 rw 0 0 2 0 3 0 4 0 5 0 6 0 7 0 1 0 usb bus reset interrupt request bit interrupt request register 1 (ireq1) [address : 3c 16 ] b function at reset name interrupt request register 1 usb sof interrupt request bit usb device interrupt request bit exb interrupt request bit int 0 interrupt request bit timer x interrupt request bit timer 1 interrupt request bit timer 2 interrupt request bit 0 : no interrupt request issued 1 : interrupt request issued ? 0 can be set by software, but 1 cannot be set. 0 : no interrupt request issued 1 : interrupt request issued 0 : no interrupt request issued 1 : interrupt request issued 0 : no interrupt request issued 1 : interrupt request issued 0 : no interrupt request issued 1 : interrupt request issued 0 : no interrupt request issued 1 : interrupt request issued 0 : no interrupt request issued 1 : interrupt request issued 0 : no interrupt request issued 1 : interrupt request issued ? ? ? ? ? ? ? ? b7 b6 b5 b4 b3 b2 b1 b0 rw 0 0 2 0 3 0 4 0 5 0 6 0 7 0 1 0 int 1 interrupt request bit interrupt request register 2 (ireq2) [address : 3d 16 ] b function at reset name interrupt request register 2 serial i/o receive interrupt request bit serial i/o transmit interrupt request bit cntr 0 interrupt request bit key-on wake-up interrupt request bit a/d conversion interrupt request bit 0 : no interrupt request issued 1 : interrupt request issued ? 0 can be set by software, but 1 cannot be set. 0 : no interrupt request issued 1 : interrupt request issued 0 : no interrupt request issued 1 : interrupt request issued 0 : no interrupt request issued 1 : interrupt request issued 0 : no interrupt request issued 1 : interrupt request issued 0 : no interrupt request issued 1 : interrupt request issued ? ? ? ? ? ? nothing is arranged for this bits. this is a write disabled bit. when this bit is read out, the contents are 0 . nothing is arranged for this bits. this is a write disabled bit. when this bit is read out, the contents are 0 . fig. 3.5.63 structure of interrupt request register 2 fig. 3.5.62 structure of interrupt request register 1
38k0 group user? manual 3-74 appendix 3.5 list of registers fig. 3.5.64 structure of interrupt control register 1 b7 b6 b5 b4 b3 b2 b1 b0 rw 0 0 2 0 3 0 4 0 5 0 6 0 7 0 1 0 int 1 interrupt enable bit interrupt control register 2 (icon2) [address : 3d 16 ] b function at reset name interrupt control register 2 serial i/o receive interrupt enable bit serial i/o transmit interrupt enable bit cntr 0 interrupt enable bit key-on wake-up interrupt enable bit a/d conversion interrupt enable bit fix this bit to 0 . 0 : interrupt disabled 1 : interrupt enabled 0 : interrupt disabled 1 : interrupt enabled 0 : interrupt disabled 1 : interrupt enabled 0 : interrupt disabled 1 : interrupt enabled 0 : interrupt disabled 1 : interrupt enabled fix this bit to 0 . 0 : interrupt disabled 1 : interrupt enabled 0 0 b7 b6 b5 b4 b3 b2 b1 b0 rw 0 0 2 0 3 0 4 0 5 0 6 0 7 0 1 0 usb bus reset interrupt enable bit interrupt control register 1 (icon1) [address : 3e 16 ] b function at reset name interrupt control register 1 usb sof interrupt enable bit usb device interrupt enable bit exb interrupt enable bit int 0 interrupt enable bit timer x interrupt enable bit timer 1 interrupt enable bit timer 2 interrupt enable bit 0 : interrupt disabled 1 : interrupt enabled 0 : interrupt disabled 1 : interrupt enabled 0 : interrupt disabled 1 : interrupt enabled 0 : interrupt disabled 1 : interrupt enabled 0 : interrupt disabled 1 : interrupt enabled 0 : interrupt disabled 1 : interrupt enabled 0 : interrupt disabled 1 : interrupt enabled 0 : interrupt disabled 1 : interrupt enabled fig. 3.5.65 structure of interrupt control register 2
38k0 group user s manual 3-75 appendix 3.5 list of registers fig. 3.5.67 structure of uart control register fig. 3.5.66 structure of serial i/o control register a a serial i/o control register b7 b6 b5 b4 b3 b2 b1 b0 b function at reset rw 0 1 2 3 4 5 6 7 name 0 0 0 0 0 0 0 serial i/o control register (siocon) [address : 0fe0 16 ] 0 : system clock 1 : system clock/4 brg count source selection bit (css) 0 0 : transmit disabled 1 : transmit enabled 0 : receive disabled 1 : receive enabled transmit interrupt source selection bit (tic) transmit enable bit (te) receive enable bit (re) serial i/o enable bit (sioe) s rdy output enable bit (srdy) 0 : p4 3 pin operates as ordinary i/o pin 1 : p4 3 pin operates as s rdy output pin 0 : interrupt when transmit buffer has emptied 1 : interrupt when transmit shift operation is completed serial i/o synchronous clock selection bit (scs) in clock synchronous serial i/o 0 : brg output divided by 4 1 : external clock input in uart 0 : brg output divided by 16 1 : external clock input divided by 16 serial i/o mode selection bit (siom) 0 : clock asynchronous(uart) serial i/o 1 : clock synchronous serial i/o 0 : serial i/o disabled (pins p4 0 to p4 3 operate as ordinary i/o pins) 1 : serial i/o enabled (pins p4 0 to p4 3 operate as serial i/o pins) b7 b6 b5 b4 b3 b2 b1 b0 b function at reset rw 0 1 2 3 4 5 6 7 name 0 0 0 0 1 uart control register (uartcon) [address : 0fe1 16 ] nothing is allocated for these bits. these are write disabled bits. when these bits are read out, the contents are 1 . ? ? ? uart control register character length selection bit (chas) parity enable bit (pare) stop bit length selection bit (stps) parity selection bit (pars) 0 : 8 bits 1 : 7 bits 0 : parity checking disabled 1 : parity checking enabled 0 : 1 stop bit 1 : 2 stop bits 0 : even parity 1 : odd parity 1 1 0 nothing is allocated for this bit. this is a write disabled bit. when this bit is read out, the contents are 0 . ?
38k0 group user s manual 3-76 appendix 3.5 list of registers fig. 3.5.68 structure of baud rate generator baud rate generator b7 b6 b5 b4 b3 b2 b1 b0 b function at reset rw 0 1 2 3 4 5 6 7 ? ? ? ? ? ? ? ? baud rate generator (brg) [address : 0fe2 16 ] set a count value of baud rate generator. b7 b0 mxps01 [6:0] b7 ep01 max. packet size register (ep01max) [address 0fec 16 ] 0 bit name bit symbol at reset function h/w s/w : state remaining o o o o max. packet size bit not used in : these bits are invalid. out : set the maximum packet size. write 0 when writing. 0 is read when reading. 0 w r fig. 3.5.69 structure of ep01 max. packet size register b7 b0 mxps02 [6:0] b7 ep02 max. packet size register (ep02max) [address 0fec 16 ] 0 bit name bit symbol at reset function h/w s/w : state remaining o o o o max. packet size bit not used in : these bits are invalid. out : set the maximum packet size. write 0 when writing. 0 is read when reading. 0 w r fig. 3.5.70 structure of ep02 max. packet size register
38k0 group user s manual 3-77 appendix 3.5 list of registers fig. 3.5.71 structure of ep03 max. packet size register b7 b0 mxps03 [6:0] b7 ep03 max. packet size register (ep03max) [address 0fec 16 ] 0 bit name bit symbol at reset function h/w s/w : state remaining o o o o max. packet size bit not used in : these bits are invalid. out : set the maximum packet size. write 0 when writing. 0 is read when reading. 0 w r b7 b0 ep00 beginning address set bit not used badd00 [4:0] b7:b5 0 ep00 buffer area set register ( ep00buf) [address 0fed 16 ] bit name bit symbol at reset function h/w s/w set the beginning address of ep00 s buffer area. (32-byte unit) b4b3b2b1b0 0 0 0 1 0 : 0040 16 0 0 0 1 1 : 0060 16 .............. 1 1 1 1 0 : 03c0 16 1 1 1 1 1 : 03e0 16 write 0 when writing. 0 is read when reading. o o o o : state remaining 000 w r fig. 3.5.72 structure of ep00 buffer area set register b7 b0 ep01 beginning address set bit not used badd01 [4:0] b7:b5 0 ep01 buffer area set register ( ep01buf) [address 0fed 16 ] bit name bit symbol at reset function h/w s/w set the beginning address of ep01 s buffer area. (32-byte unit) b4b3b2b1b0 0 0 0 1 0 : 0040 16 0 0 0 1 1 : 0060 16 .............. 1 1 1 1 0 : 03c0 16 1 1 1 1 1 : 03e0 16 write 0 when writing. 0 is read when reading. o o o o : state remaining 000 w r fig. 3.5.73 structure of ep01 buffer area set register
38k0 group user s manual 3-78 appendix 3.5 list of registers b7 b0 ep02 beginning address set bit not used badd02 [4:0] b7:b5 0 ep02 buffer area set register ( ep02buf) [address 0fed 16 ] bit name bit symbol at reset function h/w s/w set the beginning address of ep02 s buffer area. (32-byte unit) b4b3b2b1b0 0 0 0 1 0 : 0040 16 0 0 0 1 1 : 0060 16 .............. 1 1 1 1 0 : 03c0 16 1 1 1 1 1 : 03e0 16 write 0 when writing. 0 is read when reading. o o o o : state remaining 000 w r fig. 3.5.74 structure of ep02 buffer area set register b7 b0 ep03 beginning address set bit not used badd03 [4:0] b7:b5 0 ep03 buffer area set register ( ep03buf) [address 0fed 16 ] bit name bit symbol at reset function h/w s/w set the beginning address of ep03 s buffer area. (32-byte unit) b4b3b2b1b0 0 0 0 1 0 : 0040 16 0 0 0 1 1 : 0060 16 .............. 1 1 1 1 0 : 03c0 16 1 1 1 1 1 : 03e0 16 write 0 when writing. 0 is read when reading. o o o o : state remaining 000 w r fig. 3.5.75 structure of ep03 buffer area set register
38k0 group user? manual 3-79 appendix 3.5 list of registers fig. 3.5.77 structure of port p5 pull-up control register b7 b6 b5 b4 b3 b2 b1 b0 r w 0 0 2 0 3 0 40 50 60 7 0 1 0 p5 0 pul l-up control bit port p5 pull-up control register (pull5) [address : 0ff2 16 ] b function at reset name port p5 pull-up control register 0 : no pull-up 1 : pull-up p5 2 pul l-up control bit 0 : no pull-up 1 : pull-up nothing is arranged for this bit. this is a write disabled bit. when this bit is read out, the contents are 0 . nothing is arranged for these bits. these are write disabled bits. when these bits are read out, the contents are 0 . fig. 3.5.76 structure of port p0 pull-up control register b7 b6 b5 b4 b3 b2 b1 b0 rw 0 0 2 0 3 0 4 0 5 0 6 0 7 0 1 0 p0 0 pul l-up control bit port p0 pull-up control register (pull0) [address : 0ff0 16 ] b function at reset name port p0 pull-up control register 0 : no pull-up 1 : pull-up p0 0 pul l-up control bit 0 : no pull-up 1 : pull-up p0 0 pul l-up control bit 0 : no pull-up 1 : pull-up p0 0 pul l-up control bit 0 : no pull-up 1 : pull-up p0 0 pul l-up control bit 0 : no pull-up 1 : pull-up p0 0 pul l-up control bit 0 : no pull-up 1 : pull-up p0 0 pul l-up control bit 0 : no pull-up 1 : pull-up p0 0 pul l-up control bit 0 : no pull-up 1 : pull-up
38k0 group user? manual 3-80 appendix 3.5 list of registers fig. 3.5.78 structure of interrupt edge selection register b7 b6 b5 b4 b3 b2 b1 b0 rw 0 0 2 0 3 0 4 0 5 0 60 7 0 1 0 0 : falling edge active 1 : rising edge active int 0 interrupt edge selection bit interrupt edge selection register (intedge) [address : 0ff3 16 ] b function at reset name nothing is arranged for these bits. these are write disabled bits. when these bits are read out, the contents are 0 . interrupt edge selection register 0 : falling edge active 1 : rising edge active int 1 interrupt edge selection bit nothing is arranged for this bits. this is a write disabled bit. when this bit is read out, the contents are 0 . fig. 3.5.79 structure of pll control register b7 b6 b5 b4 b3 b2 b1 b0 rw 0 0 2 0 3 0 4 5 6 0 7 1 usb clock division ratio selection bits pll control register (pllcon) [address : 0ff8 16 ] b function at reset name pll control register b4 b3 0 0 : divided by 8 (f syn = f usb /8) 0 1 : divided by 6 (f syn = f usb /6) 1 0 : divided by 4 (f syn = f usb /4) 1 1 : not selected nothing is arranged for these bit. these are write disabled bits. when these bits are read out, the contents are 0 . b6 b5 0 0 : not multiplied (f vco = f xin ) 0 1 : double (f vco = f xin ? 2) 1 0 : quadruple (f vco = f xin ? 4) 1 1 : multiplied by 8 (f vco = f xin ? 8) pll operation mode selection bits pll enable bit 0 : disabled 1 : enabled
38k0 group user s manual 3-81 appendix 3.5 list of registers fig. 3.5.80 structure of misrg b7 b6 b5 b4 b3 b2 b1 b0 r w 0 0 2 3 4 5 6 7 1 ? b name functions at reset misrg (misrg: address 0ffb 16 ) misrg 0 : automatically set 01 16 to timer 1, ff 16 to prescaler 12 1 : automatically set nothing nothing is arranged for these bits. these are write disabled bits. when these bits are read out, the contents are indefinite. oscillation stabilizing time set after stp instruction released bit fig. 3.5.81 structure of flash memory control register flash memory control register b7 b6 b5 b4 b3 b2 b1 b0 flash memory co ntrol register (fmcr : address 0ffe 16 ) (note 1) b 0 1 2 4 name functions at reset r w 0 0 0 user area/boot area selection bit (note 4) cpu rewrite mode select bit (note 2) 0 : busy (being written or erased) 1 : ready 5 6 7 0 undefined undefined undefined ry/by status flag 3 0: user rom area 1: boot rom area flash memory reset bit (note 3) 0: normal operation 1: reset cpu rewrite mode entry flag 0: normal mode 1: cpu rewrite mode 0 : normal mode (software commands invalid) 1 : cpu rewrite mode (software commands acceptable) 1 nothing is arranged for these bits. if writing, set 0 . when these bits are read out, the contents are undefined. notes 1: the contents of flash memory control register are xxx00001 just after reset release. 2: for this bit to be set to 1 , the user needs to write 0 and then 1 to it in succession. if it is not this procedure, this bit will not be set to 1 . additionally, it is required to ensure that no interrupt will be generated during that interval. use the control program in the area except the built-in flash memor y for write to this bit. 3: this bit is valid when the cpu rewrite mode select bit is 1 . set this bit 3 to 0 subsequently after setting bit 3 to 1 . 4: use the control program in the area except the built-in flash memory for write to this bit.
38k0 group user? manual appendix 3.6 package outline 3-82 3.6 package outline lqfp64-p-1414-0.8 weight(g) jedec code eiaj package code lead material cu alloy 64p6u-a plastic 64pin 14  14mm body lqfp 0.1 0.8 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 m d 14.4 m e 14.4 0 ? 8 ? 0.1 0.2 1.0 0.7 0.5 0.3 16.2 15.8 14.1 13.9 16.2 15.8 14.0 14.1 13.9 14.0 16.0 16.0 0.175 0.125 0.105 0.45 0.37 0.32 1.4 0 1.7 e under planning lp 0.45 0.95 0.6 0.25 0.75 x a3 recommended mount pad detail f mmp e h e 1 17 32 64 49 16 48 33 h d d a y b x m e f m d l 2 b 2 m e e a 1 a 2 l 1 l lp a3 c
38k0 group user s manual appendix 3-83 3.6 package outline lqfp64-p-1010-0.50 weight(g) jedec code eiaj package code lead material cu alloy 64p6q-a plastic 64pin 10  10mm 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 1.0 m d 10.4 m e 10.4 10 0 0.1 1.0 0.7 0.5 0.3 12.2 12.0 11.8 12.2 12.0 11.8 0.5 10.1 10.0 9.9 10.1 10.0 9.9 0.175 0.125 0.105 0.28 0.18 0.13 1.4 0 1.7 e e e h e 1 64 49 48 33 32 17 16 h d d m d m e a f y b 2 i 2 recommended mount pad lp 0.45 0.6 0.25 0.75 0.08 x a3 b x m a 1 a 2 l 1 l detail f lp a3 c e mmp
addressing mode zp, x zp, y abs abs, x abs, y ind zp, ind ind, x ind, y rel sp 7 6 5 4 3 2 1 0 proc essor st atus register nvtbd i zc op n # op n # op n # op n # op n # op n # op n # op n # op n # op n # op n # 38k0 group user? manual 3-85 appendix 3.7 machine instructions addressing mode symbol function details imp imm a bit, a zp bit, zp opn#opn#opn#opn#opn# op n # 3-84 appendix 38k0 group user? manual 3.7 machine instructions 75 35 16 4 4 6 2 2 2 6d 2d 0e 2c 4 4 6 4 3 3 3 3 7d 3d 1e 5 5 7 3 3 3 79 39 5 5 3 3 61 21 6 6 2 2 90 b0 f0 2 2 2 2 2 2 71 31 6 6 2 2 n n n m 7 v m 6 z z z z c c 30 d0 2 2 2 2 when t = 0, this instruction adds the contents m, c, and a; and stores the results in a and c. when t = 1, this instruction adds the contents of m(x), m and c; and stores the results in m(x) and c. when t=1, the contents of a re- main unchanged, but the contents of status flags are changed. m(x) represents the contents of memory where is indicated by x. when t = 0, this instruction transfers the con- tents of a and m to the alu which performs a bit-wise and operation and stores the result back in a. when t = 1, this instruction transfers the con- tents m(x) and m to the alu which performs a bit-wise and operation and stores the results back in m(x). when t = 1 the contents of a re- main unchanged, but status flags are changed. m(x) represents the contents of memory where is indicated by x. this instruction shifts the content of a or m by one bit to the left, with bit 0 always being set to 0 and bit 7 of a or m always being contained in c. this instruction tests the designated bit i of m or a and takes a branch if the bit is 0. the branch address is specified by a relative ad- dress. if the bit is 1, next instruction is executed. this instruction tests the designated bit i of the m or a and takes a branch if the bit is 1. the branch address is specified by a relative ad- dress. if the bit is 0, next instruction is executed. this instruction takes a branch to the ap- pointed address if c is 0. the branch address is specified by a relative address. if c is 1, the next instruction is executed. this instruction takes a branch to the ap- pointed address if c is 1. the branch address is specified by a relative address. if c is 0, the next instruction is executed. this instruction takes a branch to the ap- pointed address when z is 1. the branch address is specified by a relative address. if z is 0, the next instruction is executed. this instruction takes a bit-wise logical and of a and m contents; however, the contents of a and m are not modified. the contents of n, v, z are changed, but the contents of a, m remain unchanged. this instruction takes a branch to the ap- pointed address when n is 1. the branch address is specified by a relative address. if n is 0, the next instruction is executed. this instruction takes a branch to the ap- pointed address if z is 0. the branch address is specified by a relative address. if z is 1, the next instruction is executed. adc (note 1) (note 5) and (note 1) asl bbc (note 4) bbs (note 4) bcc (note 4) bcs (note 4) beq (note 4) bit bmi (note 4) bne (note 4) 7 0 c 0 29 2 2 0a 2 1 03 + 20i 17 + 20i 07 + 20i 06 5 2 25 3 2 3 65 3 2 69 2 2 4 4 2 2 13 + 20i 5 5 3 3 24 when t = 0 a a + m + c when t = 1 m(x) m(x) + m + c when t = 0 a a m when t = 1 m(x) m(x) m ai or mi = 0? ai or mi = 1? c = 0? c = 1? z = 1? a m n = 1? z = 0? v v v 2 3.7 machine instructions bit, a, r bit, zp, r
addressing mode zp, x zp, y abs abs, x abs, y ind zp, ind ind, x ind, y rel sp 7 6 5 4 3 2 1 0 proc essor st atus register nvtbd i zc op n # op n # op n # op n # op n # op n # op n # op n # op n # op n # op n # 38k0 group user? manual 3-87 appendix 3.7 machine instructions addressing mode symbol function details imp imm a bit, a zp bit, zp opn#opn#opn#opn#opn# op n # 3-86 appendix 38k0 group user? manual 3.7 machine instructions d5 d6 cd ec cc ce 50 70 2 2 2 2 n n n n n 0 4 6 4 4 4 6 3 3 3 3 dd de 5 7 3 3 d953 c162d162 0 1 0 1 0 z z z z z 0 c c c 2 2 10 80 2 4 2 2 this instruction takes a branch to the ap- pointed address if n is 0. the branch address is specified by a relative address. if n is 1, the next instruction is executed. this instruction branches to the appointed ad- dress. the branch address is specified by a relative address. when the brk instruction is executed, the cpu pushes the current pc contents onto the stack. the badrs designated in the interrupt vector table is stored into the pc. this instruction takes a branch to the ap- pointed address if v is 0. the branch address is specified by a relative address. if v is 1, the next instruction is executed. this instruction takes a branch to the ap- pointed address when v is 1. the branch address is specified by a relative address. when v is 0, the next instruction is executed. this instruction clears the designated bit i of a or m. this instruction clears c. this instruction clears d. this instruction clears i. this instruction clears t. this instruction clears v. when t = 0, this instruction subtracts the con- tents of m from the contents of a. the result is not stored and the contents of a or m are not modified. when t = 1, the cmp subtracts the contents of m from the contents of m(x). the result is not stored and the contents of x, m, and a are not modified. m(x) represents the contents of memory where is indicated by x. this instruction takes the one? complement of the contents of m and stores the result in m. this instruction subtracts the contents of m from the contents of x. the result is not stored and the contents of x and m are not modified. this instruction subtracts the contents of m from the contents of y. the result is not stored and the contents of y and m are not modified. this instruction subtracts 1 from the contents of a or m. bpl (note 4) bra brk bvc (note 4) bvs (note 4) clb clc cld cli clt clv cmp (note 3) com cpx cpy dec n = 0? pc pc ?offset b 1 (pc) (pc) + 2 m(s) pc h s s ?1 m(s) pc l s s ?1 m(s) ps s s ?1 i 1 pc l ad l pc h ad h v = 0? v = 1? ai or mi 0 c 0 d 0 i 0 t 0 v 0 when t = 0 a ?m when t = 1 m(x) ?m __ m m x ?m y ?m a a ?1 or m m ?1 18 d8 58 12 b8 2 2 2 2 2 1 1 1 1 1 c9 e0 c0 2 2 2 2 2 2 1a 2 1 1b + 20i c5 44 e4 c4 c6 3 5 3 3 5 2 2 2 2 2 1f + 20i 21 52 00 7 1
addressing mode zp, x zp, y abs abs, x abs, y ind zp, ind ind, x ind, y rel sp 7 6 5 4 3 2 1 0 proc essor st atus register nvtbd i zc op n # op n # op n # op n # op n # op n # op n # op n # op n # op n # op n # 38k0 group user? manual 3-89 appendix 3.7 machine instructions addressing mode symbol function details imp imm a bit, a zp bit, zp opn#opn#opn#opn#opn# op n # 3-88 appendix 38k0 group user? manual 3.7 machine instructions e2 16 2 4d ee 4 6 3 3 5d fe 5 7 3 3 59 5 3 n n n n n n n n n z z z z z z z z z 41 6 2 51 6 2 b5 b4 4c 20 ad ae ac 6c a1 4 4 2 2 b6 4 2 3 6 4 4 4 3 3 3 3 3 bd bc 5 5 b9 be 5 5 3 3 3 3 53b2 02 4 7 2 2 62b162 22 5 2 55 f6 4 6 2 2 this instruction subtracts one from the current contents of x. this instruction subtracts one from the current contents of y. divides the 16-bit data in m(zz+(x)) (low-order byte) and m(zz+(x)+1) (high-order byte) by the contents of a. the quotient is stored in a and the one's complement of the remainder is pushed onto the stack. when t = 0, this instruction transfers the con- tents of the m and a to the alu which performs a bit-wise exclusive or, and stores the result in a. when t = 1, the contents of m(x) and m are transferred to the alu, which performs a bit- wise exclusive or and stores the results in m(x). the contents of a remain unchanged, but status flags are changed. m(x) represents the contents of memory where is indicated by x. this instruction adds one to the contents of a or m. this instruction adds one to the contents of x. this instruction adds one to the contents of y. this instruction jumps to the address desig- nated by the following three addressing modes: absolute indirect absolute zero page indirect absolute this instruction stores the contents of the pc in the stack, then jumps to the address desig- nated by the following addressing modes: absolute special page zero page indirect absolute when t = 0, this instruction transfers the con- tents of m to a. when t = 1, this instruction transfers the con- tents of m to (m(x)). the contents of a remain unchanged, but status flags are changed. m(x) represents the contents of memory where is indicated by x. this instruction loads the immediate value in m. this instruction loads the contents of m in x. this instruction loads the contents of m in y. dex dey div eor (note 1) inc inx iny jmp jsr lda (note 2) ldm ldx ldy x x ?1 y y ?1 a (m(zz + x + 1), m(zz + x )) / a m(s) one's comple- ment of remainder s s ?1 when t = 0 a a v m when t = 1 m(x) m(x) v m a a + 1 or m m + 1 x x + 1 y y + 1 if addressing mode is abs pc l ad l pc h ad h if addressing mode is ind pc l m (ad h , ad l ) pc h m (ad h , ad l + 1) if addressing mode is zp, ind pc l m(00, ad l ) pc h m(00, ad l + 1) m(s) pc h s s ?1 m(s) pc l s s ?1 after executing the above, if addressing mode is abs, pc l ad l pc h ad h if addressing mode is sp, pc l ad l pc h ff if addressing mode is zp, ind, pc l m(00, ad l ) pc h m(00, ad l + 1) when t = 0 a m when t = 1 m(x) m m nn x m y m 3a 21 1 1 1 1 2 2 2 2 ca 88 e8 c8 45 e6 3 5 2 2 49 22 a9 a2 a0 a5 3c a6 a4 3 4 3 3 2 3 2 2 2 2 2 2 2 2
addressing mode zp, x zp, y abs abs, x abs, y ind zp, ind ind, x ind, y rel sp 7 6 5 4 3 2 1 0 proc essor st atus register nvtbd i zc op n # op n # op n # op n # op n # op n # op n # op n # op n # op n # op n # 38k0 group user? manual 3-91 appendix 3.7 machine instructions addressing mode symbol function details imp imm a bit, a zp bit, zp opn#opn#opn#opn#opn# op n # 3-90 appendix 38k0 group user? manual 3.7 machine instructions 0 n n n n z z z z z c c c 56 62 15 6 15 4 2 2 2 4e 0d 6 4 3 3 5e 1d 7 5 3 3 19 53 01 6 2 11 6 2 36 76 2e 6e 6 6 2 2 6 6 3 3 3e 7e 7 7 3 3 (value saved in stack) (value saved in stack) this instruction shifts either a or m one bit to the right such that bit 7 of the result always is set to 0, and the bit 0 is stored in c. multiplies accumulator with the memory speci- fied by the zero page x address mode and stores the high-order byte of the result on the stack and the low-order byte in a. this instruction adds one to the pc but does no otheroperation. when t = 0, this instruction transfers the con- tents of a and m to the alu which performs a bit-wise ?r? and stores the result in a. when t = 1, this instruction transfers the con- tents of m(x) and the m to the alu which performs a bit-wise or, and stores the result in m(x). the contents of a remain unchanged, but status flags are changed. m(x) represents the contents of memory where is indicated by x. this instruction pushes the contents of a to the memory location designated by s, and decrements the contents of s by one. this instruction pushes the contents of ps to the memory location designated by s and dec- rements the contents of s by one. this instruction increments s by one and stores the contents of the memory designated by s in a. this instruction increments s by one and stores the contents of the memory location designated by s in ps. this instruction shifts either a or m one bit left through c. c is stored in bit 0 and bit 7 is stored in c. this instruction shifts either a or m one bit right through c. c is stored in bit 7 and bit 0 is stored in c. this instruction rotates 4 bits of the m content to the right. this instruction increments s by one, and stores the contents of the memory location designated by s in ps. s is again incremented by one and stores the contents of the memory location designated by s in pc l . s is again incremented by one and stores the contents of memory location designated by s in pc h . this instruction increments s by one and stores the contents of the memory location designated by s in pc l . s is again incremented by one and the contents of the memory location is stored in pc h . pc is incremented by 1. lsr mul nop ora (note 1) pha php pla plp rol ror rrf rti rts m(s) a a ? m(zz + x) s s ?1 pc pc + 1 when t = 0 a a v m when t = 1 m(x) m(x) v m s s ?1 m(s) ps s s ?1 s s + 1 a m(s) s s + 1 ps m(s) s s + 1 ps m(s) s s + 1 pc l m(s) s s + 1 pc h m(s) s s + 1 pc l m(s) s s + 1 pc h m(s) (pc) (pc) + 1 7 0 c 7 0 7 0 c 7 0 0 c 4a 2 1 ea 2 1 09 2 2 46 05 5 3 2 2 2a 6a 26 66 82 48 08 68 28 40 60 3 3 4 4 6 6 1 1 1 1 1 1 2 2 1 1 5 5 8 2 2 2
addressing mode zp, x zp, y abs abs, x abs, y ind zp, ind ind, x ind, y rel sp 7 6 5 4 3 2 1 0 proc essor st atus register nvtbd i zc op n # op n # op n # op n # op n # op n # op n # op n # op n # op n # op n # 38k0 group user? manual 3-93 appendix 3.7 machine instructions addressing mode symbol function details imp imm a bit, a zp bit, zp opn#opn#opn#opn#opn# op n # 3-92 appendix 38k0 group user? manual 3.7 machine instructions n n n n n n z z z z z z 3 35 fd 4 ed 2 4 f5 f9 5 3 e1 6 2 f1 6 2 95 94 5 5 2 2 96 52 8d 8e 8c 5 5 5 3 3 3 9d 6 3 99 6 3 81 7 2 91 7 2 n v 1 1 1 z c 1 when t = 0, this instruction subtracts the value of m and the complement of c from a, and stores the results in a and c. when t = 1, the instruction subtracts the con- tents of m and the complement of c from the contents of m(x), and stores the results in m(x) and c. a remain unchanged, but status flag are changed. m(x) represents the contents of memory where is indicated by x. this instruction sets the designated bit i of a or m. this instruction sets c. this instruction set d. this instruction set i. this instruction set t. this instruction stores the contents of a in m. the contents of a does not change. this instruction resets the oscillation control f/ f and the oscillation stops. reset or interrupt input is needed to wake up from this mode. this instruction stores the contents of x in m. the contents of x does not change. this instruction stores the contents of y in m. the contents of y does not change. this instruction stores the contents of a in x. the contents of a does not change. this instruction stores the contents of a in y. the contents of a does not change. this instruction tests whether the contents of m are ??or not and modifies the n and z. this instruction transfers the contents of s in x. this instruction stores the contents of x in a. this instruction stores the contents of x in s. this instruction stores the contents of y in a. the wit instruction stops the internal clock but not the oscillation of the oscillation circuit is not stopped. cpu starts its function after the timer x over flows (comes to the terminal count). all regis- ters or internal memory contents except timer x will not change during this mode. (of course needs vdd). sbc (note 1) (note 5) seb sec sed sei set sta stp stx sty tax tay tst tsx txa txs tya wit when t = 0 _ a a ?m ?c when t = 1 _ m(x) m(x) ?m ?c ai or mi 1 c 1 d 1 i 1 t 1 m a m x m y x a y a m = 0? x s a x s x a y 85 86 84 64 4 4 4 3 2 2 2 2 notes 1 : the number of cycles ??is increased by 3 when t is 1. 2 : the number of cycles ??is increased by 2 when t is 1. 3 : the number of cycles ??is increased by 1 when t is 1. 4 : the number of cycles ??is increased by 2 when branching has occurred. 5 : n, v, and z flags are invalid in decimal operation mode. e9 2 2 0b + 20i 0f + 20i 21 52 e5 3 2 38 f8 78 32 2 2 2 2 1 1 1 1 42 aa a8 ba 8a 9a 98 c2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1
addition subtraction multiplication division logical or logical and logical exclusive or negation shows direction of data flow index register x index register y stack pointer program counter processor status register 8 high-order bits of program counter 8 low-order bits of program counter 8 high-order bits of address 8 low-order bits of address ff in hexadecimal notation immediate value zero page address memory specified by address designation of any ad- dressing mode memory of address indicated by contents of index register x memory of address indicated by contents of stack pointer contents of memory at address indicated by ad h and ad l , in ad h is 8 high-order bits and ad l is 8 low-or- der bits. contents of address indicated by zero page ad l bit i (i = 0 to 7) of accumulator bit i (i = 0 to 7) of memory opcode number of cycles number of bytes implied addressing mode immediate addressing mode accumulator or accumulator addressing mode accumulator bit addressing mode accumulator bit relative addressing mode zero page addressing mode zero page bit addressing mode zero page bit relative addressing mode zero page x addressing mode zero page y addressing mode absolute addressing mode absolute x addressing mode absolute y addressing mode indirect absolute addressing mode zero page indirect absolute addressing mode indirect x addressing mode indirect y addressing mode relative addressing mode special page addressing mode carry flag zero flag interrupt disable flag decimal mode flag break flag x-modified arithmetic mode flag overflow flag negative flag imp imm a bit, a bit, a, r zp bit, zp bit, zp, r zp, x zp, y abs abs, x abs, y ind zp, ind ind, x ind, y rel sp c z i d b t v n symbol contents symbol contents + ? / v v x y s pc ps pc h pc l ad h ad l ff nn zz m m(x) m(s) m(ad h , ad l ) m(00, ad l ) ai mi op n # v 3-94 appendix 3850 group (spec. h) user? manual 3.7 machine instructions
38k0 group user? manual 3-95 appendix 3.8 list of instruction code 3.8 list of instruction code d 7 ?d 4 d 3 ?d 0 hexadecimal notation 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111 0 1 2 3 4 5 6 7 8 9 a b c d e f 0000 0 brk bpl jsr abs bmi rti bvc rts bvs bra bcc ldy imm bcs cpy imm bne cpx imm beq 0001 1 ora ind, x ora ind, y and ind, x and ind, y eor ind, x eor ind, y adc ind, x adc ind, y sta ind, x sta ind, y lda ind, x lda ind, y cmp ind, x cmp ind, y sbc ind, x sbc ind, y 0010 2 jsr zp, ind clt jsr sp set stp mul zp, x rrf zp ldx imm jmp zp, ind wit div zp, x 0011 3 bbs 0, a bbc 0, a bbs 1, a bbc 1, a bbs 2, a bbc 2, a bbs 3, a bbc 3, a bbs 4, a bbc 4, a bbs 5, a bbc 5, a bbs 6, a bbc 6, a bbs 7, a bbc 7, a 0100 4 bit zp com zp tst zp sty zp sty zp, x ldy zp ldy zp, x cpy zp cpx zp 0101 5 ora zp ora zp, x and zp and zp, x eor zp eor zp, x adc zp adc zp, x sta zp sta zp, x lda zp lda zp, x cmp zp cmp zp, x sbc zp sbc zp, x 0110 6 asl zp asl zp, x rol zp rol zp, x lsr zp lsr zp, x ror zp ror zp, x stx zp stx zp, y ldx zp ldx zp, y dec zp dec zp, x inc zp inc zp, x 0111 7 bbs 0, zp bbc 0, zp bbs 1, zp bbc 1, zp bbs 2, zp bbc 2, zp bbs 3, zp bbc 3, zp bbs 4, zp bbc 4, zp bbs 5, zp bbc 5, zp bbs 6, zp bbc 6, zp bbs 7, zp bbc 7, zp 1000 8 php clc plp sec pha cli pla sei dey tya tay clv iny cld inx sed 1001 9 ora imm ora abs, y and imm and abs, y eor imm eor abs, y adc imm adc abs, y sta abs, y lda imm lda abs, y cmp imm cmp abs, y sbc imm sbc abs, y 1010 a asl a dec a rol a inc a lsr a ror a txa txs tax tsx dex nop 1011 b seb 0, a clb 0, a seb 1, a clb 1, a seb 2, a clb 2, a seb 3, a clb 3, a seb 4, a clb 4, a seb 5, a clb 5, a seb 6, a clb 6, a seb 7, a clb 7, a 1100 c bit abs ldm zp jmp abs jmp ind sty abs ldy abs ldy abs, x cpy abs cpx abs 1101 d ora abs ora abs, x and abs and abs, x eor abs eor abs, x adc abs adc abs, x sta abs sta abs, x lda abs lda abs, x cmp abs cmp abs, x sbc abs sbc abs, x 1 110 e asl abs asl abs, x rol abs rol abs, x lsr abs lsr abs, x ror abs ror abs, x stx abs ldx abs ldx abs, y dec abs dec abs, x inc abs inc abs, x 1111 f seb 0, zp clb 0, zp seb 1, zp clb 1, zp seb 2, zp clb 2, zp seb 3, zp clb 3, zp seb 4, zp clb 4, zp seb 5, zp clb 5, zp seb 6, zp clb 6, zp seb 7, zp clb 7, zp : 3-byte instruction : 2-byte instruction : 1-byte instruction
3-96 appendix 38k0 group user? manual 3.9 sfr memory map 3.9 sfr memory map 0020 16 0021 16 0022 16 0023 16 0024 16 0025 16 0026 16 0027 16 0028 16 0029 16 0 0 2 a 1 6 0 0 2 b 1 6 002 c 16 002 d 16 0 0 2 e 1 6 0 0 2 f 1 6 0030 16 0031 16 0032 16 0033 16 0034 16 0035 16 0036 16 0037 16 0038 16 0039 16 0 0 3 a 1 6 003 b 16 003 c 16 003 d 16 003 e 16 003 f 16 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 0010 16 0 0 1 1 1 6 0 0 1 2 1 6 0013 16 0014 16 0015 16 0016 16 0 0 1 7 1 6 0 0 1 8 1 6 0 0 1 9 1 6 0 0 1 a 1 6 001 b 16 0 0 1 c 1 6 0 0 1 d 1 6 001 e 16 0 0 1 f 1 6 p o r t p 0 ( p 0 ) 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 4 ( p 4 ) p ort p 4 di rect i on reg i ster (p 4 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 6 ( p 6 ) p ort p 6 di rect i on reg i ster (p 6 d) s er i a l i / o status reg i ster (siosts) i nterrupt contro l reg i ster 2 (icon 2 ) t ransm i t/ r ece i ve b u ff er reg i ster (tb/rb) cpu mo d e reg i ster (cpum) i nterrupt request reg i ster 1 (ireq 1 ) i nterrupt request reg i ster 2 (ireq 2 ) i nterrupt contro l reg i ster 1 (icon 1 ) p resca l er 12 (pre 12 ) ti mer 2 (t 2 ) p resca l er x (prex) ti mer x (tx) ti mer 1 (t 1 ) ti mer x mo d e reg i ster (tm) a - d contro l reg i ster (adcon) a - d convers i on reg i ster 1 (ad 1 ) p ort p 0 di rect i on reg i ster (p 0 d) 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 ) r eserve d (n ote ) r e s e r v e d ( n o t e ) u s b c o n t r o l r e g i s t e r ( u s b c o n ) usb f unct i on ena bl e reg i ster (usbae) u s b f u n c t i o n a d d r e s s r e g i s t e r ( u s b a 0 ) e n d po i nt i n d ex reg i ster (usbindex) e n d po i nt fi e ld reg i ster 1 (epxxreg 1 ) e n d p o i n t f i e l d r e g i s t e r 2 ( e p x x r e g 2 ) e n d p o i n t f i e l d r e g i s t e r 3 ( e p x x r e g 3 ) e n d p o i n t f i e l d r e g i s t e r 4 ( e p x x r e g 4 ) e n d p o i n t f i e l d r e g i s t e r 5 ( e p x x r e g 5 ) e n d p o i n t f i e l d r e g i s t e r 6 ( e p x x r e g 6 ) e n d p o i n t f i e l d r e g i s t e r 7 ( e p x x r e g 7 ) r e s e r v e d ( n o t e ) r e s e r v e d ( n o t e ) r e s e r v e d ( n o t e ) r e s e r v e d ( n o t e ) r eserve d (n ote ) r e s e r v e d ( n o t e ) r eserve d (n ote ) r e s e r v e d ( n o t e ) f r a m e n u m b e r r e g i s t e r l o w ( f n u m l ) f rame num b er reg i ster hi g h (fnumh) u s b i n t e r r u p t s o u r c e e n a b l e r e g i s t e r ( u s b i c o n ) usb i nterrupt source reg i ster (usbireq) e x b i n t e r r u p t s o u r c e e n a b l e r e g i s t e r ( e x b i c o n ) exb i nterrupt source reg i ster (exbireq) r e s e r v e d ( n o t e ) exb i n d ex reg i ster (exbindex) e x b f i e l d r e g i s t e r 1 ( e x b r e g 1 ) exb fi e ld reg i ster 2 (exbreg 2 ) a - d convers i on reg i ster 2 (ad 2 ) watchdog timer control register (wdtcon) r eserve d (n ote ) 0 f e 0 1 6 0 f e 1 1 6 0 f e 2 1 6 0 fe 3 16 0 fe 4 16 0 f e 5 1 6 0 fe 6 16 0 f e 7 1 6 0 fe 8 16 0 fe 9 16 0 fea 16 fl as h memory contro l reg i ster (fmcr) pll contro l reg i ster (pllcon) p ort p 5 pu ll -up contro l reg i ster (pull 5 ) e n d p o i n t f i e l d r e g i s t e r 8 ( e p x x r e g 8 ) e n d po i nt fi e ld reg i ster 9 (epxxreg 9 ) s e r i a l i / o c o n t r o l r e g i s t e r ( s i o c o n ) uart contro l reg i ster (uartcon) b a u d r a t e g e n e r a t o r ( b r g ) p o r t p 0 p u l l - u p c o n t r o l r e g i s t e r ( p u l l 0 ) interrupt edge selection register (intedge) r eserve d (n ote ) 0 f e b 1 6 0 f e c 1 6 0 f e d 1 6 0 f e e 1 6 0 fef 16 0 ff 0 16 0 ff 1 16 0 ff 2 16 0 ff 3 16 0 f f 4 1 6 0 f f 5 1 6 0 f f 6 1 6 0 f f 7 1 6 0 ff 8 16 0 f f 9 1 6 0 ffa 16 0 ffb 16 0 f f c 1 6 0 f f d 1 6 0 ffe 16 0 fff 16 r e s e r v e d ( n o t e ) r e s e r v e d ( n o t e ) r e s e r v e d ( n o t e ) r e s e r v e d ( n o t e ) r eserve d (n ote ) r eserve d (n ote ) r e s e r v e d ( n o t e ) r eserve d (n ote ) r e s e r v e d ( n o t e ) r e s e r v e d ( n o t e ) r eserve d (n ote ) r e s e r v e d ( n o t e ) r eserve d (n ote ) r e s e r v e d ( n o t e ) r eserve d (n ote ) misrg r e s e r v e d ( n o t e ) r eserve d (n ote ) r e s e r v e d ( n o t e ) r e s e r v e d ( n o t e ) r e s e r v e d ( n o t e ) n o t e : d o n o t w r i t e a n y d a t a t o t h e s e a d d r e s s e s , b e c a u s e t h e s e a r e a s a r e r e s e r v e d . r e s e r v e d ( n o t e )
38k0 group user s manual 3-97 appendix 3.10 pin configurations 3.10 pin configurations 32 31 30 29 28 26 25 24 23 22 21 20 19 18 17 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 27 64 48 47 46 45 43 42 41 40 39 38 37 36 35 34 33 44 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 tron p2 3 p2 2 p2 1 p2 0 d0- d0+ usbv ref dv cc pv cc p0 3 p0 2 p0 1 p0 0 p5 7 p5 6 p5 5 p5 4 p5 3 p5 2 /int 1 p5 1 /cntr 0 p5 0 /int 0 pv ss p1 0 /dq 0 /an 0 p0 6 p0 7 p4 0 /e x dreq/r x d p1 1 /dq 1 /an 1 p1 2 /dq 2 /an 2 p1 3 /dq 3 /an 3 p1 4 /dq 4 /an 4 p1 5 /dq 5 /an 5 p1 6 /dq 6 /an 6 p1 7 /dq 7 /an 7 p6 0 (led 0 ) p6 1 (led 1 ) p6 2 (led 2 ) p6 3 (led 3 ) p4 1 /e x dack/t x d p4 2 /e x tc/s clk p4 3 /e x a1/s rdy p3 0 p3 1 p3 2 p3 3 /e x int p3 4 /e x cs p3 5 /e x wr p3 6 /e x rd p3 7 /e x a0 m38k07m4-xxxfp/hp m38k09f8fp/hp p2 4 p0 4 p2 7 p2 6 cnv ss v cc e v ref v ss x out v cc cnv ss 2 x in reset p2 5 p0 5 m38k07m4l-xxxfp/hp m38k09f8lfp/hp
mitsubishi semiconductors user? manual 38k0 group jan. first edition 2003 editioned by committee of editing of mitsubishi semiconductor user? manual published by mitsubishi electric corp., semiconductor marketing division this book, or parts thereof, may not be reproduced in any form without permission of mitsubishi electric corporation. ?003 mitsubishi electric corporation
user s manual 38k0 group head office: 2-2-3, marunouchi, chiyoda-ku, tokyo 100-8310, japan new publication, effective jan. 2003. specifications subject to change without notice. ? 2003 mitsubishi electric corporation.


▲Up To Search▲   

 
Price & Availability of M38K09F8HP

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

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


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