![]() |
|
If you can't view the Datasheet, Please click here to try to view without PDF Reader . |
|
Datasheet File OCR Text: |
8 bit microcontroller tlcs-870/c1 series TMP89FH46
the information contained herein is subject to change without notice. 021023_d toshiba is continually working to improve the qua lity and reliability of its products. nevertheless, semiconductor devices in general can malfunction or fail due to their inherent electrical sensitivity and vulnerability to physical stress. it is the responsibility of the buyer, when utiliz ing toshiba products, to comply with the standards of safety in making a safe design for the entire sy stem, and to avoid situations in which a malfunction or failure of such toshiba products could cause loss of human life, bodily injury or damage to property. in developing your designs, please ensure that toshiba products are used within specified operating ranges as set forth in the most r ecent toshiba products specifications. also, please keep in mind the precauti ons and conditions set forth in the ? handling guide for semiconductor devices, ? or ? toshiba semiconductor reliability handbook ? etc. 021023_a the toshiba products listed in this document are intended for usage in general electronics applications (computer, personal equipment, of fice equipment, measuring equipment, industrial robotics, domestic appliances, etc.). these toshiba products are neither intended nor warranted for usage in equipment that requires extraordinarily high quality and/or reliability or a malfunction or failure of which may cause loss of human life or bodily injury ( ? unintended usage ? ). unintended usage include atomic energy control instruments, airplane or spaceship instruments, transportation in struments, traffic signal instruments, combustion control instruments, medical instrument s, all types of safety devices, etc. unintended usage of toshiba products listed in this document shall be made at the customer's own risk. 021023_b the products described in this document shall not be used or embedded to any downstream products of which manufacture, use and/or sale are prohib ited under any applicable laws and regulations. 060106_q the information contained herein is presented only as a guide for the applications of our products. no responsibility is assumed by toshiba for any infring ements of patents or other rights of the third parties which may result from its use. no license is granted by implication or otherwise under any patents or other rights of toshiba or the third parties. 070122_c the products described in this document are subject to foreign exchange and foreign trade control laws. 060925_e for a discussion of how the reliability of microcontro llers can be predicted, please refer to section 1.3 of the chapter entitled quality and reliabil ity assurance/handling precautions. 030619_s ? 2007 toshiba corporation all rights reserved revision history date revision 2007/10/27 1 first release 2007/11/3 2 contents revised i table of contents TMP89FH46 1.1 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1.2 pin assignment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 1.3 block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 1.4 pin names and functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 2. cpu core 2.1 configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 2.2 memory space . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 2.2.1 code area ............................................................................................................................... .................. 9 2.2.1.1 ram 2.2.1.2 bootrom 2.2.1.3 flash 2.2.2 data area ............................................................................................................................... ................. 12 2.2.2.1 sfr 2.2.2.2 ram 2.2.2.3 bootrom 2.2.2.4 flash 2.3 system clock controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 2.3.1 configuration ............................................................................................................................... ........... 15 2.3.2 control ............................................................................................................................... ..................... 15 2.3.3 functions ............................................................................................................................... ................. 17 2.3.3.1 clock generator 2.3.3.2 clock gear 2.3.3.3 timing generator 2.3.4 warm-up counter ............................................................................................................................... ..... 20 2.3.4.1 warm-up counter operation when the oscillation is enabled by the hardware 2.3.4.2 warm-up counter operation when the oscillation is enabled by the software 2.3.5 operation mode control circuit ................................................................................................................ 22 2.3.5.1 single-clock mode 2.3.5.2 dual-clock mode 2.3.5.3 stop mode 2.3.5.4 transition of operation modes 2.3.6 operation mode control ......................................................................................................................... 27 2.3.6.1 stop mode 2.3.6.2 idle1/2 and sleep1 modes 2.3.6.3 idle0 and sleep0 modes 2.3.6.4 slow mode 2.4 reset control circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 2.4.1 configuration ............................................................................................................................... ........... 38 2.4.2 control ............................................................................................................................... ..................... 38 2.4.3 functions ............................................................................................................................... ................. 40 2.4.4 reset signal generating factors ............................................................................................................ 41 2.4.4.1 external reset input (reset pin input) 2.4.4.2 power-on reset 2.4.4.3 voltage detection reset 2.4.4.4 watchdog timer reset 2.4.4.5 system clock reset 2.4.4.6 trimming data reset 2.4.4.7 flash standby reset 2.4.4.8 internal factor reset detection status register 2.4.4.9 how to use the external reset input pin as a port ii 3. interrupt control circuit 3.1 configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 3.2 interrupt latches (il25 to il3) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 3.3 interrupt enable register (eir) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 3.3.1 interrupt master enable flag (imf) .......................................................................................................... 49 3.3.2 individual interrupt enable flags (ef25 to ef4) ...................................................................................... 49 3.4 maskable interrupt priority change function . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 3.5 interrupt sequence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 3.5.1 initial setting ............................................................................................................................... ............ 54 3.5.2 interrupt acceptance processing ............................................................................................................. 54 3.5.3 saving/restoring general-purpose registers ............................................................................................ 55 3.5.3.1 using push and pop instructions 3.5.3.2 using data transfer instructions 3.5.3.3 using a register bank to save/restore genera l-purpose registers 3.5.4 interrupt return ............................................................................................................................... ......... 57 3.6 software interrupt (intsw) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 3.6.1 address error detection .......................................................................................................................... 58 3.6.2 debugging ............................................................................................................................... ............... 58 3.7 undefined instruction interrupt (intundef) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 4. external interrupt control circuit 4.1 configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 4.2 control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 4.3 function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 4.3.1 low power consumption function ........................................................................................................... 63 4.3.2 external interrupt 0 ............................................................................................................................... .. 64 4.3.3 external interrupts 1/2/3 .......................................................................................................................... 64 4.3.3.1 interrupt request signal generating condition detection function 4.3.3.2 a noise canceller pass signal monitoring func tion when interrupt request signals are generated 4.3.3.3 noise cancel time selection function 4.3.4 external interrupt 4 ............................................................................................................................... .. 65 4.3.4.1 interrupt request signal generating condition detection function 4.3.4.2 a noise canceller pass signal monitoring func tion when interrupt request signals are generated 4.3.4.3 noise cancel time selection function 4.3.5 external interrupt 5 ............................................................................................................................... .. 67 5. watchdog timer (wdt) 5.1 configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 5.2 control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 5.3 functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 5.3.1 setting of enabling/disabling the watchdog timer operation ................................................................... 71 5.3.2 setting the clear time of the 8-bit up counter .......................................................................................... 72 5.3.3 setting the overflow time of the 8-bit up counter .................................................................................... 72 5.3.4 setting an overflow detection signal of the 8-bit up counter ................................................................... 73 5.3.5 writing the watchdog timer control codes ............................................................................................... 73 5.3.6 reading the 8-bit up counter .................................................................................................................. 74 5.3.7 reading the watchdog timer status ........................................................................................................ 74 6. power-on reset circuit 6.1 configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 6.2 function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 iii 7. voltage detection circuit 7.1 configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 7.2 control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 7.3 function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 7.3.1 enabling/disabling the voltage detection operation ................................................................................ 79 7.3.2 selecting the voltage detection operation mode ..................................................................................... 79 7.3.3 selecting the detection voltage level ...................................................................................................... 79 7.3.4 voltage detection flag and voltage detection status flag ......................................................................... 79 7.3.5 selecting the stop mode release signal ............................................................................................... 80 7.4 register settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81 7.4.1 setting procedure when the operation mode is set to generate voltage detection interrupt request signals 81 7.4.2 setting procedure when the operation mode is set to generate voltage detection reset signals ............ 81 8. i/o ports 8.1 i/o port control registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84 8.2 list of i/o port settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 8.3 i/o port registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 8.3.1 port p0 (p03 to p00) ............................................................................................................................... 88 8.3.2 port p1 (p13 to p10) ............................................................................................................................... 92 8.3.3 port p2 (p27 to p20) ............................................................................................................................... 95 8.3.4 port p4 (p47 to p40) ............................................................................................................................... 99 8.3.5 port p7 (p77 to p70) ............................................................................................................................. 1 02 8.3.6 port p8 (p83 to p80) ............................................................................................................................. 1 04 8.3.7 port p9 (p91 to p90) ............................................................................................................................. 1 06 8.3.8 port pb (pb7 to pb4) ........................................................................................................................... 109 8.4 serial interface selecting function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112 8.5 revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114 9. special function registers 9.1 sfr1 (0x0000 to 0x003f) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115 9.2 sfr2 (0x0f00 to 0x0fff) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116 9.3 sfr3 (0x0e40 to 0x0eff) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118 10. low power consumption f unction for peripherals 10.1 control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122 11. divider output (dvo) 11.1 configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125 11.2 control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125 11.2.1 function ............................................................................................................................... ............... 125 12. time base timer (tbt) 12.1 time base timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127 iv 12.1.1 configuration ............................................................................................................................... ....... 127 12.1.2 control ............................................................................................................................... ................. 127 12.1.3 functions ............................................................................................................................... ............. 128 13. 16-bit timer counter (tca) 13.1 configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132 13.2 control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133 13.3 low power consumption function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137 13.4 timer function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138 13.4.1 timer mode ............................................................................................................................... .......... 138 13.4.1.1 setting 13.4.1.2 operation 13.4.1.3 auto capture 13.4.1.4 register buffer configuration 13.4.2 external trigger timer mode ................................................................................................................ 142 13.4.2.1 setting 13.4.2.2 operation 13.4.2.3 auto capture 13.4.2.4 register buffer configuration 13.4.3 event counter mode ............................................................................................................................ 14 4 13.4.3.1 setting 13.4.3.2 operation 13.4.3.3 auto capture 13.4.3.4 register buffer configuration 13.4.4 window mode ............................................................................................................................... ...... 146 13.4.4.1 setting 13.4.4.2 operation 13.4.4.3 auto capture 13.4.4.4 register buffer configuration 13.4.5 pulse width measurement mode ........................................................................................................ 148 13.4.5.1 setting 13.4.5.2 operation 13.4.6 programmable pulse generate (ppg) mode ...................................................................................... 150 13.4.6.1 setting 13.4.6.2 operation 13.4.6.3 register buffer configuration 13.5 noise canceller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153 13.5.1 setting ............................................................................................................................... .................. 153 14. 8-bit timer counter (tc0) 14.1 configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156 14.2 control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157 14.2.1 timer counter 00 ............................................................................................................................... .. 157 14.2.2 timer counter 01 ............................................................................................................................... .. 159 14.2.3 common to timer counters 00 and 01 ................................................................................................ 161 14.2.4 operation modes and usable source clocks ....................................................................................... 163 14.3 low power consumption function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164 14.4 functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165 14.4.1 8-bit timer mode ............................................................................................................................... ... 165 14.4.1.1 setting 14.4.1.2 operation 14.4.1.3 double buffer 14.4.2 8-bit event counter mode .................................................................................................................... 168 14.4.2.1 setting 14.4.2.2 operation 14.4.2.3 double buffer 14.4.3 8-bit pulse width modulation (pwm) output mode .............................................................................. 170 14.4.3.1 setting 14.4.3.2 operations 14.4.3.3 double buffer 14.4.4 8-bit programmable pulse generate (ppg) output mode .................................................................... 175 14.4.4.1 setting 14.4.4.2 operation v 14.4.4.3 double buffer 14.4.5 16-bit timer mode ............................................................................................................................... . 178 14.4.5.1 setting 14.4.5.2 operations 14.4.5.3 double buffer 14.4.6 16-bit event counter mode .................................................................................................................. 182 14.4.6.1 setting 14.4.6.2 operations 14.4.6.3 double buffer 14.4.7 12-bit pulse width modulation (pwm) output mode ............................................................................ 184 14.4.7.1 setting 14.4.7.2 operations 14.4.7.3 double buffer 14.4.8 16-bit programmable pulse generate (ppg) output mode .................................................................. 190 14.4.8.1 setting 14.4.8.2 operations 14.4.8.3 double buffer 15. real time clock (rtc) 15.1 configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193 15.2 control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193 15.3 function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194 15.3.1 low power consumption function ..................................................................................................... 194 15.3.2 enabling/disabling the real time clock operation ................................................................................. 194 15.3.3 selecting the interrupt generation interval .......................................................................................... 194 15.4 real time clock operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195 15.4.1 enabling the real time clock operation ................................................................................................ 195 15.4.2 disabling the real time clock operation ............................................................................................... 195 16. asynchronous serial interface (uart) 16.1 configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198 16.2 control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199 16.3 low power consumption function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203 16.4 protection to prevent uart0cr1 and uart0cr2 registers from being changed 204 16.5 activation of stop, idle0 or sleep0 mode . . . . . . . . . . . . . . . . . . . . . . . . . . 205 16.5.1 transition of register status ................................................................................................................ 205 16.5.2 transition of txd pin status ............................................................................................................... 205 16.6 transfer data format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206 16.7 infrared data format transfer mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206 16.8 transfer baud rate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207 16.8.1 transfer baud rate calculation method ............................................................................................... 208 16.8.1.1 bit width adjustment using uart0cr2 vi 16.14 ac properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224 16.14.1 irda properties ............................................................................................................................... ... 224 17. synchronous serial interface (sio) 17.1 configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226 17.2 control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227 17.3 low power consumption function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230 17.4 functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231 17.4.1 transfer format ............................................................................................................................... .... 231 17.4.2 serial clock ............................................................................................................................... .......... 231 17.4.3 transfer edge selection ...................................................................................................................... 231 17.5 transfer modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233 17.5.1 8-bit transmit mode ............................................................................................................................. 2 33 17.5.1.1 setting 17.5.1.2 starting the transmit operation 17.5.1.3 transmit buffer and shift operation 17.5.1.4 operation on completion of transmission 17.5.1.5 stopping the transmit operation 17.5.2 8-bit receive mode ............................................................................................................................. 2 38 17.5.2.1 setting 17.5.2.2 starting the receive operation 17.5.2.3 operation on completion of reception 17.5.2.4 stopping the receive operation 17.5.3 8-bit transmit/receive mode ................................................................................................................ 242 17.5.3.1 setting 17.5.3.2 starting the transmit/receive operation 17.5.3.3 transmit buffer and shift operation 17.5.3.4 operation on completion of transmission/reception 17.5.3.5 stopping the transmit/receive operation 17.6 ac characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247 18. serial bus interface (sbi) 18.1 communication format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249 18.1.1 i2c bus ............................................................................................................................... ................ 249 18.1.2 free data format ............................................................................................................................... .. 250 18.2 configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251 18.3 control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252 18.4 functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255 18.4.1 low power consumption function ..................................................................................................... 255 18.4.2 selecting the slave address match detection and the general call detection ............................. 256 18.4.3 selecting the number of clocks for data transfer and selecting the acknowledgement or non-acknowledgment mode ............................................................................................................................... ............................ 256 18.4.3.1 number of clocks for data transfer 18.4.3.2 output of an acknowledge signal 18.4.4 serial clock ............................................................................................................................... .......... 258 18.4.4.1 clock source 18.4.4.2 clock synchronization 18.4.5 master/slave selection ........................................................................................................................ 260 18.4.6 transmitter/receiver selection ............................................................................................................. 260 18.4.7 start/stop condition generation ........................................................................................................... 261 18.4.8 interrupt service request and release ................................................................................................. 262 18.4.9 setting of serial bus interface mode ................................................................................................... 262 18.4.10 software reset ............................................................................................................................... .... 262 18.4.11 arbitration lost detection monitor ...................................................................................................... 263 18.4.12 slave address match detection monitor ............................................................................................ 264 18.4.13 general call detection monitor .................................................................................................. 265 18.4.14 last received bit monitor ................................................................................................................... 265 18.4.15 slave address and address recognition mode specification ............................................................. 265 18.5 data transfer of i2c bus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266 vii 18.5.1 device initialization ............................................................................................................................. 2 66 18.5.2 start condition and slave address generation ..................................................................................... 266 18.5.3 1-word data transfer ............................................................................................................................ 26 7 18.5.3.1 when sbi0sr2 viii 22. serial prom mode 22.1 outline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309 22.2 security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309 22.3 serial prom mode setting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 310 22.3.1 serial prom mode control pins ......................................................................................................... 310 22.4 example connection for on-board writing . . . . . . . . . . . . . . . . . . . . . . . . . . . . 312 22.5 activating the serial prom mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313 22.6 interface specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 314 22.6.1 sio communication ............................................................................................................................ 31 4 22.6.2 uart communication ......................................................................................................................... 314 22.7 memory mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 316 22.8 operation commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 316 22.8.1 flash memory erase command (0xf0) ............................................................................................... 319 22.8.1.1 specifying the erase area 22.8.2 flash memory write command (operation command: 0x30) ............................................................... 322 22.8.3 flash memory read command (operation command: 0x40) ............................................................... 324 22.8.4 ram loader command (operation command: 0x60) ........................................................................... 326 22.8.5 flash memory sum output command (operation command: 0x90) ................................................... 328 22.8.6 product id code output command (operation command: 0xc0) ......................................................... 329 22.8.7 flash memory status output command (0xc3) ................................................................................... 331 22.8.7.1 flash memory status code 22.8.8 mask rom emulation setting command (0xd0) ................................................................................. 334 22.8.9 flash memory security setting command (0xfa) ................................................................................ 335 22.9 error code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 336 22.10 checksum (sum) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 337 22.10.1 calculation method ........................................................................................................................... 337 22.10.2 calculation data ............................................................................................................................... . 337 22.11 intel hex format (binary) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 338 22.12 security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 339 22.12.1 passwords ............................................................................................................................... ......... 339 22.12.1.1 how a password can be specified 22.12.1.2 password structure 22.12.1.3 password setting, cancellation and authentication 22.12.1.4 password values and setting range 22.12.2 security program .............................................................................................................................. 343 22.12.2.1 how the security program functions 22.12.2.2 enabling or disabling the security program 22.12.3 option codes ............................................................................................................................... ...... 344 22.12.4 recommended settings .................................................................................................................... 346 22.13 flowchart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 347 22.14 ac characteristics (uart) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 348 22.14.1 reset timing ............................................................................................................................... ....... 349 22.14.2 flash memory erase command (0xf0) ............................................................................................. 349 22.14.3 flash memory write command (0x30) ............................................................................................... 350 22.14.4 flash memory read command (0x40) ............................................................................................... 350 22.14.5 ram loader command (0x60) ........................................................................................................... 351 22.14.6 flash memory sum output command (0x90) ................................................................................... 351 22.14.7 product id code output command (0xc0) ........................................................................................ 351 22.14.8 flash memory status output command (0xc3) ................................................................................. 352 22.14.9 mask rom emulation setting command (0xd0) ............................................................................... 352 22.14.10 flash memory security setting command (0xfa) ............................................................................ 352 23. on-chip debug function (ocd) 23.1 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353 23.2 control pins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353 23.3 how to connect the on-chip debug emulator to a target system . . . . . . . . . . 354 ix 23.4 security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 354 24. input/output circuit 24.1 control pins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 355 25. electrical characteristics 25.1 absolute maximum ratings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357 25.2 operating conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 358 25.2.1 mcu mode (flash programming or erasing) ...................................................................................... 358 25.2.2 mcu mode (except flash programming or erasing) .......................................................................... 359 25.2.3 serial prom mode ............................................................................................................................. 3 60 25.3 dc characteristics. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 361 25.4 ad conversion characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 364 25.5 power-on reset circuit characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365 25.6 voltage detecting circuit characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 366 25.7 ac characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 367 25.7.1 mcu mode (flash programming or erasing) ...................................................................................... 367 25.7.2 mcu mode (except flash programming or erasing) .......................................................................... 367 25.7.3 serial prom mode ............................................................................................................................. 3 68 25.8 flash characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 368 25.8.1 write characteristics ........................................................................................................................... 368 25.9 recommended oscillating condition- 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 369 25.10 handling precaution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 370 25.11 revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 371 26. package dimensions x page 1 TMP89FH46 cmos 8-bit microcontroller this product uses the super flash ? technology under the licence of silicon storage technology, inc. super flash ? is registered trademark of silicon storage technology, inc. ra000 ? the information contained herein is subject to change without notice. 021023_d ? toshiba is continually working to improv e the quality and reliability of its products . nevertheless, semi conductor devices in general can malfunction or fail due to their inherent el ectrical sensitivity and vu lnerability to physical stre ss. it is the responsibility of the buyer, when utilizing toshiba products, to comply with the standards of safe ty in making a safe design for the entire system, and to avoid situations in which a malfunction or failure of such toshiba products coul d cause loss of human life, bodily injury or damage to property. in developing your designs, please ensure that toshiba products are used within specified operating ranges as set forth in the most recent toshiba products specifications. al so, please keep in mind the precautions and conditions set forth in the ?handling gui de for semiconductor devices,? or ?toshiba se miconductor reliability handbook? etc. 021023_a ? the toshiba products listed in this document are intended fo r usage in general electronics appl ications (computer, personal eq uip- ment, office equipment, measuring equipment, industrial robotics , domestic appliances, etc.). t hese toshiba products are neithe r intended nor warranted for usage in equipment that requires extraordi narily high quality and/or reli ability or a malfunction or failure of which may cause loss of human life or b odily injury (?unintended usage?). unintended usage include atomic energy control instru ments, airplane or spaceship instruments, transpor tation instruments, traffic signal instrum ents, combustion control instruments, medi cal instru- ments, all types of safety devices, etc. unintended usage of to shiba products listed in this document shall be made at the cust omer's own risk. 021023_b ? the products described in this document shall not be used or em bedded to any downstream products of which manufacture, use and /or sale are prohibited under any applicable laws and regulations. 060106_q ? the information contained herein is presented only as a guide for the applications of our produc ts. no responsibility is assum ed by toshiba for any infringements of patents or other rights of the th ird parties which may result from its use. no license is gran ted by impli- cation or otherwise under any patents or other rights of toshiba or the third parties. 070122_c ? the products described in this doc ument are subject to foreign exchange and foreign trade control laws. 060925_e ? for a discussion of how the reliability of microcontrollers can be predi cted, please refer to section 1.3 of the chapter entit led quality and reliability assurance/handling precautions. 030619_s TMP89FH46 1.1 features 1. 8-bit single chip microcomputer tlcs-870/c1 series - instruction execution time : 100 ns (at 10 mhz) 122 s (at 32.768 khz) - 133 types & 732 basic instructions 2. 25 interrupt sources (external : 6 internal : 19 , except reset) 3. input / output ports (42 pins) large current output: 8 pins (typ. 20ma) 4. watchdog timer - interrupt or reset can be selected by the program. 5. power-on reset circuit 6. voltage detection circuit 7. divider output function 8. time base timer 9. 16-bit timer counter : 2 ch - timer, external trigger, event counter, window, pulse width measurement, ppg output modes the TMP89FH46 is a single-chip 8-bit high-speed and high-functionality microcomputer incorporating 16384 bytes of flash memory. it is pin-compatible with th e tmp89ch46 (mask rom version). the TMP89FH46 can re- alize operations equivalent to those of the tmp89ch46 by programming the on-chip flash memory. product no. rom (flash) ram package flash mcu emulation chip TMP89FH46dug 16384 bytes 2048 bytes lqfp48-p-0707-0.50d * tmp89ch46dug * tmp89c900xbg note : * ; under development note : two of above pins can not be used for the i/o port, beca use they should be connected with the high frequency osc input. page 2 1.1 features TMP89FH46 ra000 10. 8-bit timer counter: 4 ch - timer, event counter, pwm, ppg output modes - usable as a 16-bit timer, 12-bit pwm output and 16-bit ppg output by the cascade connection of two channels. 11. real time clock 12. uart : 1ch 13. uart/sio : 1ch note : one sio cha nnel can be used at the same time. 14. i 2 c/sio : 1ch 15. key-on wake-up : 8 ch 16. 10-bit successive approximation type ad converter - analog input : 8ch 17. on-chip debug function - break/event - trace - ram monitor - flash memory writing 18. clock operation mode control circuit : 2 circuit single clock mode / dual clock mode 19. low power consumption operation (8 mode) - stop mode: oscillation stops. (battery/capacitor back-up.) - slow1 mode: low power consumption operation using low-fr equency clock.(high-frequency clock stop.) - slow2 mode: low power consumption operation using low-fre quency clock.(high-frequency clock oscillate.) - idle0 mode: cpu stops, and only the time-based-timer(tbt) on pe ripherals operate using high frequency clock. released when the reference time set to tbt has elapsed. - idle1 mode: the cpu stops, and peripherals operate using hi gh frequency clock. release by interruputs(cpu restarts). - idle2 mode: cpu stops and peripherals operate using high and low frequency clock. release by interruputs. (cpu restarts). - sleep0 mode: cpu stops, and only the time-based-timer(tbt) on peripherals operate using low frequency clock. released when the reference time set to tbt has elapsed. - sleep1 mode: cpu stops, and peripherals operate using low frequency clock. release by interruput.(cpu restarts). 20. wide operation voltage: 4.3 v to 5.5 v at 10mhz /32.768 khz 2.7 v to 5.5 v at 4.2 mhz /32.768 khz 2.2 v to 5.5 v at 2mhz /32.768 khz page 3 TMP89FH46 ra000 1.2 pin assignment figure 1-1 pin assignment vss (xout) p01 mode vdd (xtin) p02 (xtout) p03 ( reset ) p10 ( stop / int5 ) p11 ( int0 ) p12 (ocdck/so0/rxd0/txd0) p20 1 2 3 4 5 6 7 8 9 10 11 12 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 37 38 39 40 41 42 43 44 45 46 47 48 p42 (ain2/kwi2) p45 (ain5/kwi5) p47 (ain7/kwi7) p46 (ain6/kwi6) p75 (int2) p74 ( dvo ) p43 (ain3/kwi3) (int1) p13 (xin) p00 p25 (sclk0) p27 avss avdd p41 (ain1/kwi1) varef p26 p40 (ain0/kwi0) p91 (rxd1/txd1) p90 (txd1/rxd1) p77 (int4) p76 (int3) ( pwm02 / ppg02 /tc02) p80 ( pwm03 / ppg03 /tc03) p81 p82 p83 ( pwm00 / ppg00 /tc00) p70 ( pwm01 / ppg01 /tc01) p71 ( ppga0 /tca0) p72 ( ppga1 /tca1) p73 (so0/rxd0/txd0) pb4 (si0/txd0/rxd0) pb5 (sclk0) pb6 pb7 p24 (scl0/si0) p23 (sda0/so0) p22 (sclk0) p21 (rxd0/txd0/si0/ocdio) p44 (ain4/kwi4) page 4 1.3 block diagram TMP89FH46 ra000 1.3 block diagram figure 1-2 block diagram page 5 TMP89FH46 ra000 1.4 pin names and functions the TMP89FH46 has mcu mode, parallel prom mode, and serial prom mode. table 1-1 shows the pin func- tions in mcu mode. the serial prom mode is explained later in a separate chapter. table 1-1 pin names and functions(1/3) pin name input/output functions p03 xtout io o port03 low frequency osc output p02 xtin io i port02 low frequency osc input p01 xout io o port01 high frequency osc output p00 xin io i port00 high frequency osc input p13 int1 io i port13 external interrupt 1 input p12 int0 io i port12 external interrupt 0 input p11 int5 stop io i i port11 external interrupt 5 input stop mode release input p10 reset io i port10 reset signal input p27 io port27 p26 io port26 p25 sclk0 io io port25 serial clock input/output 0 p24 scl0 si0 io io i port24 i2c bus clock input/output 0 serial data input 0 p23 sda0 so0 io io o port23 i2c bus data input/output 0 serial data output 0 p22 sclk0 io io port22 serial clock input/output 0 p21 rxd0 txd0 si0 ocdio io i o i io port21 uart data input 0 uart data output 0 serial data input 0 ocd data input/output p20 txd0 rxd0 so0 ocdck io o i o i port20 uart data output 0 uart data input 0 serial data output 0 ocd clock input p47 ain7 kwi7 io i i port47 analog input 7 key-on wake-up input 7 p46 ain6 kwi6 io i i port46 analog input 6 key-on wake-up input 6 page 6 1.4 pin names and functions TMP89FH46 ra000 p45 ain5 kwi5 io i i port45 analog input 5 key-on wake-up input 5 p44 ain4 kwi4 io i i port44 analog input 4 key-on wake-up input 4 p43 ain3 kwi3 io i i port43 analog input 3 key-on wake-up input 3 p42 ain2 kwi2 io i i port42 analog input 2 key-on wake-up input 2 p41 ain1 kwi1 io i i port41 analog input 1 key-on wake-up input 1 p40 ain0 kwi0 io i i port40 analog input 0 key-on wake-up input 0 p77 int4 io i port77 external interrupt 4 input p76 int3 io i port76 external interrupt 3 input p75 int2 io i port75 external interrupt 2 input p74 dvo io o port74 divider output p73 tca1 ppga1 io i o port73 tca1 input ppga1 output p72 tca0 ppga0 io i o port72 tca0 input ppga0 output p71 tc01 ppg01 pwm01 io i o o port71 tc01 input ppg01 output pwm01 output p70 tc00 ppg00 pwm00 io i o o port70 tc00 input ppg00 output pwm00 output p83 io port83 p82 io port82 p81 tc03 ppg03 pwm03 io i o o port81 tc03 input ppg03 output pwm03 output p80 tc02 ppg02 pwm02 io i o o port80 tc02 input ppg02 output pwm02 output table 1-1 pin names and functions(2/3) pin name input/output functions page 7 TMP89FH46 ra000 p91 rxd1 txd1 io i o port91 uart data input 1 uart data output 1 p90 txd1 rxd1 io o i port90 uart data output 1 uart data input 1 pb7 io portb7 pb6 sclk0 io io portb6 serial clock input/output 0 pb5 rxd0 txd0 si0 io i o i portb5 uart data input 0 uart data output 0 serial data input 0 pb4 txd0 rxd0 so0 io o i o portb4 uart data output 0 uart data input 0 serial data output 0 mode i test pin for out-going test (fix to low level). varef i analog reference voltage input pin for a/d conversion. avdd i analog power supply pin. avss i analog gnd pin vdd i vdd pin vss i gnd pin table 1-1 pin names and functions(3/3) pin name input/output functions page 8 1.4 pin names and functions TMP89FH46 ra000 page 9 TMP89FH46 ra001 2. cpu core 2.1 configuration the cpu core consists of a cpu, a syst em clock controller and a reset circuit. this chapter describes the cpu core address space, the system clock controller and the reset circuit. 2.2 memory space the 870/c1 cpu memory space consists of a code area to be accessed as instruction operation codes and operands and a data area to be accessed as sources and destin ations of transfer and calculation instructions. both the code and data areas have independent 64-kbyte address spaces. 2.2.1 code area the code area stores operation codes, operands, vector ta bles for vector call instru ctions and interrupt vector tables. the ram, the bootrom and the flash are mapped in the code area. note: only the first 2 kbytes of the bootrom are mapped in the memory map, except in the serial prom mode. figure 2-1 memory m ap in the code area 0x0000 swi instruction (0xff) is fetched. swi instruction (0xff) is fetched. swi instruction (0xff) is fetched. 0x003f 0x0040 ram (2048 bytes) ram (2048 bytes) 0x083f swi instruction (0xff) is fetched. swi instruction (0xff) is fetched. swi instruction (0xff) is fetched. 0x1000 bootrom (2048 bytes) bootrom (2048 bytes) 0x17ff 0x1800 0xbfff 0xc000 flash (16384 bytes) flash (16384 bytes) flash (16384 bytes) flash (16384 bytes) 0xffa0 vector table for vec- tor call instructions (32 bytes) vector table for vec- tor call instructions (32 bytes) vector table for vec- tor call instructions (32 bytes) vector table for vec- tor call instructions (32 bytes) 0xffbf 0xffcc interrupt vector table (52 bytes) interrupt vector table (52 bytes) interrupt vector table (52 bytes) interrupt vector table (52 bytes) 0xffff immediately after re- set release when the ram is mapped in the code area when the bootrom is mapped in the code area when the ram and the bootrom are mapped in the code area page 10 2. cpu core 2.2 memory space TMP89FH46 ra001 2.2.1.1 ram the ram is mapped in the data ar ea immediately after reset release. by setting syscr3 page 11 TMP89FH46 ra001 note: bits 7 to 3 of syssr4 are read as "0". 2.2.1.2 bootrom the bootrom is not mapped in the code area or the data area after reset release. note 1: when the bootrom is not mapped in the code area, an instruction is fetched from the flash or an swi instruction is fetched, depending on the capacity of the internal flash. note 2: only the first 2 kbytes of the bootrom are m apped in the memory map, except in the serial prom mode. note: the flash memory control register 1 has a double-buffer stru cture comprised of the register flscr1 and a shift register. writing "0xd5" to the register flscr2 allows a register setti ng to be reflected and take effect in the shift register. this means that a register setting value does not take effect until "0xd5" is written to the register flscr2. the value of the shift register can be checked by reading the register flscrm. system control status register 4 syssr4 (0x0fdf) 76543210 bit symbol-----rvctrsrareas(rstdis) read/writerrrrrrrr after reset00000000 rareas status of mapping of the ram in the code area 0 : 1 : the enabled syscr3 page 12 2. cpu core 2.2 memory space TMP89FH46 ra001 2.2.1.3 flash the flash is mapped to 0xc000 to 0xfff f in the code area after reset release. 2.2.2 data area the data area stores the data to be accessed as source s and destinations of transfer and calculation instruc- tions. the sfr, the ram, the bootrom and th e flash are mapped in the data area. note: only the first 2 kbytes of the bootrom are mapped in the memory map, except in the serial prom mode. figure 2-2 memory map in the data area flash memory control register 2 flscr2 76543210 (0x0fd1) bit symbol cr1en read/write w after reset******** cr1en flscr1 register enable/disable control 0xd5 others enable a change in the flscr1 setting reserved 0x0000 sfr1 (64 bytes) sfr1 (64 bytes) 0x003f 0x0040 ram (2048 bytes) ram (2048 bytes) 0x083f 0xff is read 0xff is read 0x0e40 sfr3 (192 bytes) sfr3 (192 bytes) 0x0eff 0x0f00 sfr2 (256 bytes) sfr2 (256 bytes) 0x0fff 0x1000 bootrom (2048 bytes) 0x17ff 0x1800 0xff is read 0xff is read 0xbfff 0xc000 flash (16384 bytes) flash (16384 bytes) 0xffff immediately after re- set release when the bootrom is mapped in the data area page 13 TMP89FH46 ra001 2.2.2.1 sfr the sfr is mapped to 0x0000 to 0x003f (sfr1) , 0x0f00 to 0x0fff (sfr2) and 0x0e40 to 0x0eff (sfr3) in the data area after reset release. note: don't access the reserved sfr. 2.2.2.2 ram the ram is mapped to 0x0040 to 0x083f in the data area after reset release. note: the contents of the ram become unstable when the power is turned on and immediately after a reset is released. to execute the program by using the ram, transfer the program to be executed in the ini- tialization routine. 2.2.2.3 bootrom the bootrom is not mapped in the code area or the data area after reset release. note: the flash memory control register 1 has a double-buffer stru cture comprised of the register flscr1 and a shift register. writing "0xd5" to the register flscr2 allows a register setti ng to be reflected and take effect in the shift register. this means that a register setting value does not take effect until "0xd5" is written to the register flscr2. the value of the shift register can be checked by reading the register flscrm. example: ram initialization program ld hl, ram_top_address ; head of address of the ram to be initialized ld a, 0x00 ; initialization data ld bc, byte_of_clear_bytes ; number of bytes of ram to be initialized -1 clr_ram: ld (hl), a ; initialization of the ram inc hl ; initialization address increment dec bc ; have all the rams been initialized? jrs f, clr_ram setting flsmd page 14 2. cpu core 2.2 memory space TMP89FH46 ra001 2.2.2.4 flash the flash is mapped to 0xc000 to 0xfff f in the data area after reset release. cr1en flscr1 register enable/disable control 0xd5 others enable a change in the flscr1 setting reserved page 15 TMP89FH46 ra001 2.3 system clock controller 2.3.1 configuration the system clock controller consists of a clock ge nerator, a clock gear, a timing generator, a warm-up counter and an operation mode control circuit. figure 2-3 system clock controller 2.3.2 control the system clock controller is contro lled by system control register 1 (s yscr1), system control register 2 (syscr2), the warm-up counter contro l register (wuccr), the warm-up c ounter data register (wucdr) and the clock gear control register (cgcr). note 1: fcgck: gear clock [h z], fs: low-frequency clock [hz] note 2: bits 2, 1 and 0 of syscr1 are read as "0". bit 3 is read as "1". system control register 1 syscr1 (0x0fdc) 76543210 bit symbol stop relm outen dv9ck - - - - read/writer/wr/wr/wr/wrrrr after reset00001000 stop activates the stop mode 0 : 1 : operate the cpu and the peripheral circuits stop the cpu and the peripheral circuits (activate the stop mode) relm selects the stop mode release method 0 : 1 : edge-sensitive release mode (release the stop mode at the rising edge of the stop mode release signal) level-sensitive release mode (release th e stop mode at the "h" level of the stop mode release signal) outen selects the port output state in the stop mode 0 : 1 : high impedance output hold dv9ck selects the input clock to stage 9 of the divider 0 : 1 : fcgck/2 9 fs/4 operation mode control circuit xtin xtout clock generator fs fc system clock intwuc interrupt system control register oscillation/stop control low-frequency clock oscillation circuit high-frequency clock oscillation circuit xin xout timing generator fcgck 1/4 syscr1 syscr2 tbtcr wuccr wucdr clock gear control register fcgcksel stop dv9ck xen/xten warm-up counter clock gear (x1/4,x1/2,x1) page 16 2. cpu core 2.3 system clock controller TMP89FH46 ra001 note 3: if the stop mode is activated with syscr1 page 17 TMP89FH46 ra001 note 1: don't start the warm-up counter operation with wucdr set at "0x00". note 1: fcgck: gear clock [h z], fc: high-frequency clock [hz] note 2: don't change cgcr page 18 2. cpu core 2.3 system clock controller TMP89FH46 ra001 the hardware control is executed by reset release an d the operation mode control circuit when the oper- ation is switched to the stop mode as described in "2.3.5 operation mode control circuit". note: no hardware function is availabl e for external direct monitoring of the basic clock. t he oscillation fre- quency can be adjusted by programming the system to output pulses at a certain frequency to a port (for example, a clock output) with interrupts disabled and the watchdog ti mer disabled and monitoring the output. an adjustment program must be created in advance for a system that requires adjustment of the oscillation frequency. to prevent the dead lock of the cpu core due to th e software-controlled enabling/disabling of the oscil- lation, an internal factor reset is generated depending on the combination of values of the clock selected as the main system clock, syscr2 page 19 TMP89FH46 ra001 immediately after reset release, the gear clock (fcg ck) becomes the clock that is a quarter of the high- frequency clock (fc). note: don't change cgcr page 20 2. cpu core 2.3 system clock controller TMP89FH46 ra001 2. prescaler and divider these circuits divide fcgck. the divided clocks are supplied to the timer counter, the time base timer and other peripheral circuits. when both syscr1 page 21 TMP89FH46 ra001 2.3.4.1 warm-up counter operation when t he oscillation is enabled by the hardware (1) when a power-on reset is released or a reset is released the warm-up counter serves to secure the time af ter a power-on reset is released before the supply voltage becomes stable and the time after a reset is released before the oscillation by the high-fre- quency clock oscillation circuit becomes stable. when the power is turned on and the supply voltage exceeds the power-on reset release voltage, the warm-up counter reset si gnal is released. at this time, the cpu and the peripheral circuits are held in the reset state. a reset signal initializes wuccr page 22 2. cpu core 2.3 system clock controller TMP89FH46 ra001 note 2: the clock output from the oscillati on circuit is used as the input clock to the warm-up counter. the warm-up time contai ns errors because the oscillation fr equency is unstable until the oscillation circui t becomes stable. set the sufficient time for the oscillation start property of the oscillator. 2.3.4.2 warm-up counter operation when t he oscillation is enabled by the software the warm-up counter serves to secure the time after the oscillation is enabled by the software before the oscillation becomes stable, at a mode change from normal1 to normal2 or from slow1 to slow2. select the input clock to the freque ncy division circui t at wuccr page 23 TMP89FH46 ra001 the main system clock (fm) is generated from the g ear clock (fcgck). therefor e, the machine cycle time is 1/fcgck [s]. the gear clock (fcgck) is generated from the high-frequency clock (fc). in the single-clock mode, the low-frequency cloc k generation circuit pins p03 (xtin) and p04 (xtout) can be used as the i/o ports. (1) normal1 mode in this mode, the cpu core and the peripheral circuits operate using the gear clock (fcgck). the normal1 mode becomes active after reset release. (2) idle1 mode in this mode, the cpu and the watchdog timer stop and the peripheral circuits operate using the gear clock (fcgck). the idle1 mode is activated by setting sy scr2 page 24 2. cpu core 2.3 system clock controller TMP89FH46 ra001 2.3.5.2 dual-clock mode the gear clock (fcgck) and the low-frequency clock (fs) are used for the op eration in the dual-clock mode. the main system clock (fm) is generated from the gear clock (fcgck) in the normal2 or idle2 mode, and generated from the clock that is a quarter of the low-frequency clock (fs) in the slow1/2 or sleep0/1 mode. therefore, the mach ine cycle time is 1/fcgck [s] in the normal2 or idle2 mode and is 4/fs [s] in the slow1/2 or sleep0/1 mode. p03 (xtin) and p04 (xtout) are used as the low-frequency clock oscillation circuit pins. (these pins cannot be used as i/o ports in the dual-clock mode.) the operation of the tlcs-870/c1 se ries becomes the single-clock mode after reset release. to operate it in the dual-clock mode, allow the low-frequency clock to oscillate at the beginning of the program. (1) normal2 mode in this mode, the cpu core operates using the gear clock (fcgck), and the pe ripheral circuits oper- ate using the gear clock (fcgck) or the clock th at is a quarter of the low-frequency clock (fs). (2) slow2 mode in this mode, the cpu core and th e peripheral circuits operate usin g the clock that is a quarter of the low-frequency clock (fs). in the slow mode, some peripheral circuits b ecome the same as the states when a reset is released. for operations of the peripheral circuits in the slow mode, refer to the section of each peripheral circuit. set syscr2 page 25 TMP89FH46 ra001 (5) sleep1 mode in this mode, the high-frequency clock oscillatio n circuit stops operation, the cpu and the watch- dog timer stop, and the peripheral circuits operate using the clock that is a quarter of the low-fre- quency clock (fs). in the sleep1 mode, some peripheral circuits b ecome the same as the states when a reset is released. for operations of the peri pheral circuits in the sleep1 mode, refer to the section of each peripheral circuit. the sleep1 mode can be activated and released in the same way as for the idle1 mode. the operation returns to the slow1 mode after this mode is released. in the slow1 or sleep1 mode, outputs of the pres caler and stages 1 to 8 of the divider stop. (6) sleep0 mode in this mode, the high-frequency clock oscillation circuit stops operation, the time base timer oper- ates using the clock that is a quarter of the low- frequency clock (fs), and th e core and the peripheral circuits stop. in the sleep0 mode, the peripheral circuits stop in the states when the sleep0 mode is activated or become the same as the states when a reset is released. for operations of the peripheral circuits in the sleep0 mode, refer to the s ection of each peripheral circuit. the sleep0 mode can be activated and released in the same way as for the idle0 mode. the operation returns to the slow1 mode after this mode is released. in the sleep0 mode, the cpu stops and the timing generator stops the clock supply to the periph- eral circuits except the time base timer. 2.3.5.3 stop mode in this mode, all the operations in the system, incl uding the oscillation circuits, are stopped and the internal states in effect before the system was stopped are held with low power consumption. in the stop mode, the peripheral circuits stop in th e states when the stop m ode is activated or become the same as the states when a reset is released. for ope rations of the peripheral circuits in the stop mode, refer to the section of each peripheral circuit. the stop mode is activated by setting syscr1 page 26 2. cpu core 2.3 system clock controller TMP89FH46 ra001 2.3.5.4 transition of operation modes note 1: the normal1 and normal2 mode s are generically called t he normal mode; the slow1 and slow2 modes are called the slow mode; the idle0, idle1 and idle2 modes are called the idle mode; and the sleep0 and sleep1 are called the sleep mode. note 2: the mode is released by the falling edge of the source clock selected at tbtcr page 27 TMP89FH46 ra001 2.3.6 operation mode control 2.3.6.1 stop mode the stop mode is controlled by system control register 1 (syscr1) and the stop mode release sig- nals. (1) start the stop mode the stop mode is started by setting syscr1 page 28 2. cpu core 2.3 system clock controller TMP89FH46 ra001 2. release by key-on wakeup 3. release by the volt age detection circuits note: during the stop period (from the start of the stop mode to the end of the warm-up), due to changes in the external interrupt pin signal, interrupt latches may be set to "1" and interrupts may be accepted immediately after the stop mode is released. before starting the stop mode, therefore, disable interrupts. also, before enabl ing interrupts after stop mode is released, clear unnecessary interrupt latches. 1. release by the stop pin release the stop mode by using the stop pin. to release the stop mode by using the stop pin, set vdcr2 page 29 TMP89FH46 ra001 even if the stop pin input returns to low after the warm-up starts, the stop mode is not restarted. figure 2-8 level-sensitive re lease mode (example when the hi gh-frequency clock oscillation circuit is selected) note: when the stop mode is released, the warm-up counter source clock automatically changes to the clock that generated the main system clock when the stop mode was started, regardless of wuccr page 30 2. cpu core 2.3 system clock controller TMP89FH46 ra001 2. release by the key-on wakeup the stop mode is released by inputting the prescribed level to the key-on wakeup pin. the level to release the stop mode can be selected from "h" and "l". for release by the key-on wakeup, refer to section "key-on wakeup". 3. release by the volt age detection circuits the stop mode is released by the supply voltage detection by the voltage detection cir- cuits. to release the stop mode by using the voltage detection circuits, set vdcr2 page 31 TMP89FH46 ra001 note: when the operation returns to the normal2 mode, fc is i nput to the frequency division circuit of the warm-up counter. 2.3.6.2 idle1/2 and sleep1 modes the idle1/2 and sleep1 modes are controlled by the system control register 2 (syscr2) and maskable interrupts. the following stat es are maintained during these modes. 1. the cpu and the watchdog timer stop their operations. the peripheral circuits continue to oper- ate. 2. the data memory, the registers, the program status word and th e port output latches are all held in the status in effect before id le1/2 or sleep1 mode was started. 3. the program counter holds the address of the inst ruction 2 ahead of the instruction which starts the idle1/2 or sleep1 mode. table 2-4 oscillation start operat ion at release of the stop mode operation mode before the stop mode is started high-frequency clock low-frequency clock oscillation start operation after release single-clock mode normal1 high-frequency clock oscillation circuit - the high-frequency clock oscillation circuit starts oscillation. the low-frequency clock oscillation circuit stops oscillation. dual-clock mode normal2 high-frequency clock oscillation circuit low-frequency clock oscillation cir- cuit the high-frequency clock oscillation circuit starts oscillation. the low-frequency clock oscillation circuit starts oscillation. slow1 - low-frequency clock oscillation cir- cuit the high-frequency clock oscillation circuit stops oscillation. the low-frequency clock oscillation circuit starts oscillation. page 32 2. cpu core 2.3 system clock controller TMP89FH46 ra001 figure 2-10 idle1/ 2 and sleep 1 modes cpu and wdt stop interrupt processing reset yes no no no no imf = "1" reset input yes yes (interrupt release mode) (normal release mode) interrupt request starting idle1/2 mode or sleep1 mode by an instruction execution of the instruction which follows the idle1/2 mode or sleep1 mode start instruction page 33 TMP89FH46 ra001 (1) start the idle1/2 and sleep1 modes after the interrupt master enable flag (imf) is se t to "0", set the individual interrupt enable flag (ef) to "1", which releases idle1/2 and sleep1 modes. to start the idle1/2 or sleep1 mode, set syscr2 page 34 2. cpu core 2.3 system clock controller TMP89FH46 ra001 figure 2-11 id le0 and sleep0 modes ? start the idle0 and sleep0 modes stop (disable) the peripherals such as a timer counter. to start the idle0 or sleep0 mode, set syscr2 page 35 TMP89FH46 ra001 (1) normal release mode (imf , ef5, tbtcr page 36 2. cpu core 2.3 system clock controller TMP89FH46 ra001 (2) switching from the slow1 mode to the normal1 mode set syscr2 page 37 TMP89FH46 ra001 figure 2-13 switching the ma in system clock (fm) (swit ching from fs/4 to fcgck) example : switching from the slow1 m ode to the normal1 mode after the stabili ty of the high-fre quency clock oscilla- tion circuit is confirmed at the warm-up c ounter (fc = 10 mhz, warm-up time = 4.0 ms) ; #### initialize routine #### set (p0fc).2 ; p0fc2 = 1 (uses p02/03 as oscillators) | | ld (wuccr), 0x09 ; wuccr page 38 2. cpu core 2.4 reset control circuit TMP89FH46 ra001 2.4 reset control circuit the reset circuit controls the external and inte rnal factor resets and initializes the system. 2.4.1 configuration the reset control circuit consists of the following reset signal generation circuits: 1. external reset input (external factor) 2. power-on reset (internal factor) 3. voltage detection reset 1 (internal factor) 4. voltage detection reset 2 (internal factor) 5. watchdog timer reset (internal factor) 6. system clock rese t (internal factor) 7. trimming data reset (internal factor) 8. flash standby reset (internal factor) figure 2-14 reset control circuit 2.4.2 control the reset control circuit is controll ed by system control register 3 (s yscr3), system control register 4 (syscr4), system control status regi ster (syssr4) and the in ternal factor reset detection status register (irstsr). note 1: the enabled syscr3 page 39 TMP89FH46 ra001 note 3: after syscr3 page 40 2. cpu core 2.4 reset control circuit TMP89FH46 ra001 note 1: irstsr is initialized by an ex ternal reset input or power-on reset. note 2: care must be taken in system designing since the irstsr may not fulfill its functions due to disturbing noise and other effects. note 3: irstsr page 41 TMP89FH46 ra001 note: the voltage detection circuits are disabled by an external reset input or power-on reset only. 2.4.4 reset signal generating factors reset signals are generated by each factor as follows: 2.4.4.1 external reset input ( reset pin input) port p10 is also used as the reset pin, and it serves as the reset pin after the power is turned on. if the supply voltage is lower than the recommended operating voltage range, for example, when the power is turned on, the supply voltage is raised to the operating voltage range with the reset pin kept at the "l" level, and a reset is applied 5 s after the oscillation is stabilized. if the supply voltage is within the recommended operating voltage range, the reset pin is kept at the "l" level for 5 s with the stabilized oscillation, and then a reset is applied. in each case, after a reset is app lied, it is released by turning the reset pin to "h" and the warm-up operation that follows re set release gets started. table 2-5 initialization of built-in hardware by reset operation and its status after release built-in hardware during reset during the warm-up opera- tion that follows reset release immediately after the warm-up operation that fol- lows reset release program counter (pc) mcu mode: 0xfffe serial prom mode:0x01ff mcu mode: 0xfffe serial prom mode:0x01ff mcu mode: 0xfffe serial prom mode:0x01ff stack pointer (sp) 0x00ff 0x00ff 0x00ff ram indeterminate indeterminate indeterminate general-purpose registers (w, a, b, c, d, e, h, l, ix and iy) indeterminate indeterminate indeterminate register bank selector (rbs) 0 0 0 jump status flag (jf) indeterminate indeterminate indeterminate zero flag (zf) indeterminate indeterminate indeterminate carry flag (cf) indeterminate indeterminate indeterminate half carry flag (hf) indeterminate indeterminate indeterminate sign flag (sf) indeterminate indeterminate indeterminate overflow flag (vf) indeterminate indeterminate indeterminate interrupt master enable flag (imf) 0 0 0 individual interrupt enable flag (ef) 0 0 0 interrupt latch (il) 0 0 0 high-frequency clock oscillation circuit oscillation enabled oscillation enabled oscillation enabled low-frequency clock oscillation circuit oscillation disabled oscillation disabled oscillation disabled warm-up counter reset start stop timing generator prescaler and divider 0 0 0 watchdog timer disabled disabled enabled voltage detection circuit disabled or enabl ed disabled or enabled disabled or enabled i/o port pin status hiz hiz hiz special function register refer to the sfr map. refer to the sfr map. refer to the sfr map. page 42 2. cpu core 2.4 reset control circuit TMP89FH46 ra001 note: when the supply voltage is equal to or lower than the detection voltage of the power-on reset circuit, the power-on reset remains active, even if the reset pin is turned to "h". figure 2-15 external reset input (when the power is turned on) figure 2-16 external reset input (when the power is stabilized) reset time warm-up operation during reset cpu and peripheral circuits start operation operating voltage reset pin cpu/peripheral circuits reset reset time warm-up operation during reset cpu and peripheral circuits start operation reset pin reset signal operating voltage page 43 TMP89FH46 ra001 2.4.4.2 power-on reset the power-on reset is an internal factor rese t that occurs when the power is turned on. when power supply voltage goes on, if the supply vol tage is equal to or lower than the releasing voltage of the power-on reset circuit, a reset signal is generated and if it is higher than the releasing voltage of the power-on reset circuit, a reset signal is released. when power supply voltage goes down, if the supply voltage is equal to or lower than the detecting voltage of the power-on reset circuit, a reset signal is generated. refer to "power-on reset circuit". 2.4.4.3 voltage detection reset the voltage detection reset is an internal factor rese t that occurs when it is de tected that the supply volt- age has reached a predeter mined detection voltage. refer to "voltage detection circuit". 2.4.4.4 watchdog timer reset the watchdog timer reset is an internal factor reset that occurs when an overflow of the watchdog timer is detected. refer to "watchdog timer". 2.4.4.5 system clock reset the system clock reset is an internal factor reset that occurs when it is detected that the oscillation enable register is set to a combinat ion that puts the cpu into deadlock. refer to "clock control circuit". 2.4.4.6 trimming data reset the trimming data reset is an internal factor reset that occurs when the trimming data latched in the internal circuit is broken down during operation due to noise or other factors. the trimming data is a data bit provided for adjustment of the ladder resistor that generates the compar- ison voltage for the power-on reset and the voltage detection circuits. this bit is loaded from the non-volatile exclusive use memory during the warm-up time that follows reset release (tpwup) and latched into the internal circuit. if the trimming data loaded from the non-volatile exclusive use memory during the warm-up operation that follows reset release is abno rmal, irstsr page 44 2. cpu core 2.4 reset control circuit TMP89FH46 ra001 2.4.4.8 internal factor reset detection status register by reading the internal factor reset detection status register irstsr af ter the release of an internal fac- tor reset, except the power-on reset, the f actor which causes a reset can be detected. the internal factor reset detection status register is initialized by an external reset input or power-on reset. set irstsr page 45 TMP89FH46 ra003 3. interrupt control circuit the TMP89FH46 has a total of 25 interrupt sources excluding reset. interrupts can be nested with priorities. three of the internal interrupt sources are n on-maskable while the rest are maskable. interrupt sources are provided with interrupt latches (il) , which hold interrupt requests, and have independent vec- tor addresses. when a request for an inte rrupt is generated, its interrupt latch is set to "1", which requests the cpu to accept the interrupt. acceptance of inte rrupts is enabled or disabled by soft ware using the interrupt master enable flag (imf) and individual enab le flag (ef) for each interrupt source. if multiple maskable interrupts are generated simultaneously, the interrupts are accepted in order of descending priority. the pr iorities are determ ined by the inter- rupt priority change control register (ilprs1-ilprs6) as levels and determined by the hardware as the basic prior- ities. however, there are no prioritized interr upt sources among non-maskable interrupts. note 1: to use the watchdog timer interrupt (intwdt), clear wdct r |